parent
a4dcd298bf
commit
5e2ac14b14
@ -0,0 +1,693 @@
|
||||
<template>
|
||||
<transition name="el-zoom-in-center">
|
||||
<div class="JNPF-preview-main">
|
||||
<div class="JNPF-common-page-header">
|
||||
<el-page-header @back="goBack" :content="!dataForm.id ? '新建' : '编辑'" />
|
||||
<div class="options">
|
||||
<el-dropdown class="dropdown" placement="bottom">
|
||||
<el-button style="width:70px">
|
||||
更 多<i class="el-icon-arrow-down el-icon--right"></i>
|
||||
</el-button>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<template v-if="dataForm.id">
|
||||
<el-dropdown-item @click.native="prev" :disabled='prevDis'>
|
||||
{{ '上一条' }}
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item @click.native="next" :disabled='nextDis'>
|
||||
{{ '下一条' }}
|
||||
</el-dropdown-item>
|
||||
</template>
|
||||
<el-dropdown-item type="primary" @click.native="dataFormSubmit(2)" :loading="continueBtnLoading"
|
||||
:disabled='btnLoading'>
|
||||
{{ !dataForm.id ? '确定并新增' : '确定并继续' }}</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
<el-button type="primary" @click="dataFormSubmit()" :loading="btnLoading" :disabled='continueBtnLoading'> 保
|
||||
存</el-button>
|
||||
<el-button @click="goBack"> 取 消</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<el-row :gutter="15" class=" main" :style="{ margin: '0 auto', width: '100%' }">
|
||||
<el-form ref="formRef" :model="dataForm" :rules="dataRule" size="small" label-width="100px"
|
||||
label-position="right">
|
||||
<template v-if="!loading">
|
||||
<!-- 具体表单 -->
|
||||
<el-col :span="24">
|
||||
<jnpf-form-tip-item>
|
||||
<JnpfGroupTitle content="基本信息" contentPosition="left">
|
||||
</JnpfGroupTitle>
|
||||
</jnpf-form-tip-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<jnpf-form-tip-item label="价格编号" prop="priceCode">
|
||||
<JnpfInput v-model="dataForm.priceCode" @change="changeData('priceCode', -1)" placeholder="系统自动生成"
|
||||
readonly :style='{ "width": "100%" }'>
|
||||
</JnpfInput>
|
||||
</jnpf-form-tip-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<jnpf-form-tip-item label="价格类型" prop="priceType">
|
||||
<JnpfSelect v-model="dataForm.priceType" @change="changeData('priceType', -1)" placeholder="请选择"
|
||||
clearable :style='{ "width": "100%" }' :options="priceTypeOptions" :props="priceTypeProps">
|
||||
</JnpfSelect>
|
||||
</jnpf-form-tip-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<jnpf-form-tip-item label="报价方" prop="buinessId">
|
||||
<JnpfDepSelect v-model="dataForm.buinessId" @change="changeData('buinessId', -1)" placeholder="请选择"
|
||||
selectType="all" :ableIds="ableAll.buinessIdableIds" clearable :style='{ "width": "100%" }'>
|
||||
</JnpfDepSelect>
|
||||
</jnpf-form-tip-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<jnpf-form-tip-item>
|
||||
<JnpfGroupTitle content="价格信息" contentPosition="left">
|
||||
</JnpfGroupTitle>
|
||||
</jnpf-form-tip-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<jnpf-form-tip-item label-width="0">
|
||||
<div class="JNPF-common-title">
|
||||
<h2></h2>
|
||||
</div>
|
||||
<el-table :data="dataForm.nxpriceproductList" size='mini'>
|
||||
<el-table-column type="index" width="50" label="序号" align="center" />
|
||||
<el-table-column label="回收价" prop="recoveryPrice">
|
||||
<template slot="header" v-if="false">
|
||||
<span class="required-sign">*</span>回收价
|
||||
</template>
|
||||
<template slot-scope="scope">
|
||||
<JnpfInput v-model="scope.row.recoveryPrice"
|
||||
@change="changeData('nxpriceproduct-recoveryPrice', scope.$index)" placeholder="请输入" clearable
|
||||
:style='{ "width": "100%" }'>
|
||||
</JnpfInput>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="赠送积分" prop="rewardPoints">
|
||||
<template slot="header" v-if="false">
|
||||
<span class="required-sign">*</span>赠送积分
|
||||
</template>
|
||||
<template slot-scope="scope">
|
||||
<JnpfInput v-model="scope.row.rewardPoints"
|
||||
@change="changeData('nxpriceproduct-rewardPoints', scope.$index)" placeholder="请输入" clearable
|
||||
:style='{ "width": "100%" }'>
|
||||
</JnpfInput>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="商品id" prop="productId">
|
||||
<template slot="header" v-if="false">
|
||||
<span class="required-sign">*</span>商品id
|
||||
</template>
|
||||
<template slot-scope="scope">
|
||||
<JnpfCascader v-model="scope.row.productId"
|
||||
@change="changeData('nxpriceproduct-productId', scope.$index)" placeholder="请选择" show-all-levels
|
||||
clearable :style='{ "width": "100%" }' separator="/" :options="scope.row.productIdOptions"
|
||||
:props="nxpriceproductproductIdProps">
|
||||
</JnpfCascader>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="50">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" type="text" class="JNPF-table-delBtn"
|
||||
@click="delnxpriceproductList(scope.$index)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="table-actions" @click="addnxpriceproductList()">
|
||||
<el-button type="text" icon="el-icon-plus">添加</el-button>
|
||||
</div>
|
||||
</jnpf-form-tip-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<jnpf-form-tip-item>
|
||||
<JnpfGroupTitle content="适配服务站" contentPosition="left">
|
||||
</JnpfGroupTitle>
|
||||
</jnpf-form-tip-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<jnpf-form-tip-item label-width="0">
|
||||
<div class="JNPF-common-title">
|
||||
<h2></h2>
|
||||
</div>
|
||||
<el-table :data="dataForm.nxpricerecycleList" size='mini'>
|
||||
<el-table-column type="index" width="50" label="序号" align="center" />
|
||||
<el-table-column label="回收站" prop="recycleId">
|
||||
<template slot="header" v-if="true">
|
||||
<span class="required-sign">*</span>回收站
|
||||
</template>
|
||||
<template slot-scope="scope">
|
||||
<JnpfPopupSelect v-model="scope.row.recycleId"
|
||||
@change="changeData('nxpricerecycle-recycleId', scope.$index)" :rowIndex="scope.$index"
|
||||
:formData="dataForm" :templateJson="interfaceRes.nxpricerecyclerecycleId" placeholder="请选择"
|
||||
hasPage propsValue="id" popupWidth="800px" popupTitle="选择数据" popupType="dialog"
|
||||
relationField='station_name' :field="'recycleId' + scope.$index" interfaceId="534688845753483781"
|
||||
:pageSize="20" :columnOptions="nxpricerecyclerecycleIdcolumnOptions" clearable
|
||||
:style='{ "width": "100%" }'>
|
||||
</JnpfPopupSelect>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="50">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" type="text" class="JNPF-table-delBtn"
|
||||
@click="delnxpricerecycleList(scope.$index)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="table-actions" @click="addnxpricerecycleList()">
|
||||
<el-button type="text" icon="el-icon-plus">添加</el-button>
|
||||
</div>
|
||||
</jnpf-form-tip-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<jnpf-form-tip-item label="备注" prop="remak">
|
||||
<JnpfInput v-model="dataForm.remak" @change="changeData('remak', -1)" placeholder="请输入" clearable
|
||||
:style='{ "width": "100%" }'>
|
||||
</JnpfInput>
|
||||
</jnpf-form-tip-item>
|
||||
</el-col>
|
||||
<!-- 表单结束 -->
|
||||
</template>
|
||||
</el-form>
|
||||
<SelectDialog v-if="selectDialogVisible" :config="currTableConf" :formData="dataForm" ref="selectDialog"
|
||||
@select="addForSelect" @close="selectDialogVisible = false" />
|
||||
</el-row>
|
||||
</div>
|
||||
</transition>
|
||||
</template>
|
||||
|
||||
|
||||
<script>
|
||||
import request from '@/utils/request'
|
||||
import { mapGetters } from "vuex";
|
||||
import { getDataInterfaceRes } from '@/api/systemData/dataInterface'
|
||||
import { getDictionaryDataSelector } from '@/api/systemData/dictionary'
|
||||
import { getDefaultCurrentValueUserId } from '@/api/permission/user'
|
||||
import { getDefaultCurrentValueDepartmentId } from '@/api/permission/organize'
|
||||
import { getDateDay, getLaterData, getBeforeData, getBeforeTime, getLaterTime } from '@/components/Generator/utils/index.js'
|
||||
import { thousandsFormat } from "@/components/Generator/utils/index"
|
||||
export default {
|
||||
components: {},
|
||||
props: [],
|
||||
data() {
|
||||
return {
|
||||
dataFormSubmitType: 0,
|
||||
continueBtnLoading: false,
|
||||
index: 0,
|
||||
prevDis: false,
|
||||
nextDis: false,
|
||||
allList: [],
|
||||
visible: false,
|
||||
loading: false,
|
||||
btnLoading: false,
|
||||
formRef: 'formRef',
|
||||
setting: {},
|
||||
eventType: '',
|
||||
userBoxVisible: false,
|
||||
selectDialogVisible: false,
|
||||
currTableConf: {},
|
||||
dataValueAll: {},
|
||||
addTableConf: {
|
||||
nxpriceproductList: { "popupType": "dialog", "hasPage": true, "popupTitle": "选择数据", "pageSize": 20, "columnOptions": [], "interfaceId": "", "interfaceName": "", "relationOptions": [], "templateJson": [], "popupWidth": "800px" },
|
||||
nxpricerecycleList: { "popupType": "dialog", "hasPage": true, "popupTitle": "选择数据", "pageSize": 20, "columnOptions": [], "interfaceId": "", "interfaceName": "", "relationOptions": [], "templateJson": [], "popupWidth": "800px" },
|
||||
},
|
||||
//可选范围默认值
|
||||
ableAll: {
|
||||
},
|
||||
tableRows: {
|
||||
nxpriceproductList: {
|
||||
recoveryPrice: '',
|
||||
recoveryPriceOptions: [],
|
||||
rewardPoints: '',
|
||||
rewardPointsOptions: [],
|
||||
productId: [],
|
||||
productIdOptions: [],
|
||||
enabledmark: undefined
|
||||
},
|
||||
nxpricerecycleList: {
|
||||
recycleId: '',
|
||||
recycleIdOptions: [],
|
||||
enabledmark: undefined
|
||||
},
|
||||
},
|
||||
Vmodel: "",
|
||||
currVmodel: "",
|
||||
dataForm: {
|
||||
priceCode: undefined,
|
||||
priceType: "1",
|
||||
buinessId: undefined,
|
||||
creatorUserId: undefined,
|
||||
creatorTime: undefined,
|
||||
lastModifyTime: undefined,
|
||||
lastModifyUserId: undefined,
|
||||
remak: undefined,
|
||||
nxpriceproductList: [],
|
||||
nxpricerecycleList: [],
|
||||
version: 0,
|
||||
},
|
||||
tableRequiredData: {},
|
||||
dataRule:
|
||||
{
|
||||
priceType: [
|
||||
{
|
||||
required: true,
|
||||
message: '请至少选择一个',
|
||||
trigger: 'change'
|
||||
},
|
||||
],
|
||||
buinessId: [
|
||||
{
|
||||
required: true,
|
||||
message: '请选择',
|
||||
trigger: 'change'
|
||||
},
|
||||
],
|
||||
},
|
||||
priceTypeOptions: [{ "fullName": "回收价", "id": "1" }],
|
||||
priceTypeProps: { "label": "fullName", "value": "id" },
|
||||
nxpriceproductproductIdOptions: [],
|
||||
nxpriceproductproductIdProps: { "label": "name", "value": "id", "children": "children" },
|
||||
nxpricerecyclerecycleIdcolumnOptions: [{ "label": "回收站编号", "value": "station_code" }, { "label": "回收站名称", "value": "station_name" },],
|
||||
childIndex: -1,
|
||||
isEdit: false,
|
||||
interfaceRes: {
|
||||
priceCode: [],
|
||||
priceType: [],
|
||||
buinessId: [],
|
||||
creatorUserId: [],
|
||||
creatorTime: [],
|
||||
lastModifyTime: [],
|
||||
lastModifyUserId: [],
|
||||
remak: [],
|
||||
nxpriceproductrecoveryPrice: [],
|
||||
nxpriceproductrewardPoints: [],
|
||||
nxpriceproductproductId: [],
|
||||
nxpricerecyclerecycleId: [],
|
||||
},
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(['userInfo'])
|
||||
},
|
||||
watch: {},
|
||||
created() {
|
||||
this.dataAll()
|
||||
this.initDefaultData()
|
||||
this.dataValueAll = JSON.parse(JSON.stringify(this.dataForm))
|
||||
},
|
||||
mounted() { },
|
||||
methods: {
|
||||
prev() {
|
||||
this.index--
|
||||
if (this.index === 0) {
|
||||
this.prevDis = true
|
||||
}
|
||||
this.nextDis = false
|
||||
for (let index = 0; index < this.allList.length; index++) {
|
||||
const element = this.allList[index];
|
||||
if (this.index == index) {
|
||||
this.getInfo(element.id)
|
||||
}
|
||||
}
|
||||
},
|
||||
next() {
|
||||
this.index++
|
||||
if (this.index === this.allList.length - 1) {
|
||||
this.nextDis = true
|
||||
}
|
||||
this.prevDis = false
|
||||
for (let index = 0; index < this.allList.length; index++) {
|
||||
const element = this.allList[index];
|
||||
if (this.index == index) {
|
||||
this.getInfo(element.id)
|
||||
}
|
||||
}
|
||||
},
|
||||
getInfo(id) {
|
||||
request({
|
||||
url: '/api/scm/NxPrice/' + id,
|
||||
method: 'get'
|
||||
}).then(res => {
|
||||
this.dataInfo(res.data)
|
||||
});
|
||||
},
|
||||
goBack() {
|
||||
this.visible = false
|
||||
this.$emit('refreshDataList', true)
|
||||
},
|
||||
changeData(model, index) {
|
||||
this.isEdit = false
|
||||
this.childIndex = index
|
||||
let modelAll = model.split("-");
|
||||
let faceMode = "";
|
||||
for (let i = 0; i < modelAll.length; i++) {
|
||||
faceMode += modelAll[i];
|
||||
}
|
||||
for (let key in this.interfaceRes) {
|
||||
if (key != faceMode) {
|
||||
let faceReList = this.interfaceRes[key]
|
||||
for (let i = 0; i < faceReList.length; i++) {
|
||||
if (faceReList[i].relationField == model) {
|
||||
let options = 'get' + key + 'Options';
|
||||
if (this[options]) {
|
||||
this[options]()
|
||||
}
|
||||
this.changeData(key, index)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
changeDataFormData(type, data, model, index, defaultValue) {
|
||||
if (!this.isEdit) {
|
||||
if (type == 2) {
|
||||
for (let i = 0; i < this.dataForm[data].length; i++) {
|
||||
if (index == -1) {
|
||||
this.dataForm[data][i][model] = defaultValue
|
||||
} else if (index == i) {
|
||||
this.dataForm[data][i][model] = defaultValue
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.dataForm[data] = defaultValue
|
||||
}
|
||||
}
|
||||
},
|
||||
dataAll() {
|
||||
this.getnxpriceproductproductIdOptions();
|
||||
},
|
||||
nxpriceproductExist() {
|
||||
let isOk = true;
|
||||
for (let i = 0; i < this.dataForm.nxpriceproductList.length; i++) {
|
||||
const e = this.dataForm.nxpriceproductList[i];
|
||||
}
|
||||
return isOk;
|
||||
},
|
||||
nxpricerecycleExist() {
|
||||
let isOk = true;
|
||||
for (let i = 0; i < this.dataForm.nxpricerecycleList.length; i++) {
|
||||
const e = this.dataForm.nxpricerecycleList[i];
|
||||
if (!e.recycleId) {
|
||||
this.$message({
|
||||
message: '回收站不能为空',
|
||||
type: 'error',
|
||||
duration: 1000
|
||||
});
|
||||
isOk = false
|
||||
break
|
||||
}
|
||||
}
|
||||
return isOk;
|
||||
},
|
||||
getnxpriceproductproductIdOptions() {
|
||||
const index = this.childIndex
|
||||
let templateJsonList = JSON.parse(JSON.stringify(this.interfaceRes.nxpriceproductproductId))
|
||||
for (let i = 0; i < templateJsonList.length; i++) {
|
||||
let json = templateJsonList[i];
|
||||
if (json.relationField) {
|
||||
let relationFieldAll = json.relationField.split("-");
|
||||
let val = json.defaultValue;
|
||||
if (relationFieldAll.length > 1 && index > -1) {
|
||||
val = this.dataForm[relationFieldAll[0] + 'List'] && this.dataForm[relationFieldAll[0] + 'List'].length ? this.dataForm[relationFieldAll[0] + 'List'][index][relationFieldAll[1]] : ''
|
||||
} else {
|
||||
val = this.dataForm[relationFieldAll]
|
||||
}
|
||||
json.defaultValue = val
|
||||
}
|
||||
}
|
||||
let template = {
|
||||
paramList: templateJsonList
|
||||
}
|
||||
getDataInterfaceRes('551316225821512901', template).then(res => {
|
||||
let data = res.data
|
||||
this.nxpriceproductproductIdOptions = data
|
||||
if (index == -1) return
|
||||
this.dataForm.nxpriceproductList[index].productIdOptions = data
|
||||
this.changeDataFormData(2, 'nxpriceproductList', 'productId', index, [])
|
||||
})
|
||||
},
|
||||
goBack() {
|
||||
this.$emit('refresh')
|
||||
},
|
||||
clearData() {
|
||||
this.dataForm = JSON.parse(JSON.stringify(this.dataValueAll))
|
||||
},
|
||||
init(id, isDetail, allList) {
|
||||
this.prevDis = false
|
||||
this.nextDis = false
|
||||
this.allList = allList || []
|
||||
if (allList.length) {
|
||||
this.index = this.allList.findIndex(item => item.id === id)
|
||||
if (this.index == 0) {
|
||||
this.prevDis = true
|
||||
}
|
||||
if (this.index == this.allList.length - 1) {
|
||||
this.nextDis = true
|
||||
}
|
||||
} else {
|
||||
this.prevDis = true
|
||||
this.nextDis = true
|
||||
}
|
||||
this.dataForm.id = id || 0;
|
||||
this.visible = true;
|
||||
this.$nextTick(() => {
|
||||
if (this.dataForm.id) {
|
||||
this.loading = true
|
||||
request({
|
||||
url: '/api/scm/NxPrice/' + this.dataForm.id,
|
||||
method: 'get'
|
||||
}).then(res => {
|
||||
this.dataInfo(res.data)
|
||||
this.loading = false
|
||||
});
|
||||
} else {
|
||||
this.clearData()
|
||||
this.initDefaultData()
|
||||
}
|
||||
});
|
||||
this.$store.commit('generator/UPDATE_RELATION_DATA', {})
|
||||
},
|
||||
//初始化默认数据
|
||||
initDefaultData() {
|
||||
if (this.userInfo.departmentId != null && this.userInfo.departmentId != '') {
|
||||
this.dataForm.buinessId = this.userInfo.departmentId
|
||||
}
|
||||
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmit(type) {
|
||||
this.dataFormSubmitType = type ? type : 0
|
||||
this.$refs['formRef'].validate((valid) => {
|
||||
if (valid) {
|
||||
if (!this.nxpriceproductExist()) return
|
||||
if (!this.nxpricerecycleExist()) return
|
||||
this.request()
|
||||
}
|
||||
})
|
||||
},
|
||||
request() {
|
||||
let _data = this.dataList()
|
||||
if (this.dataFormSubmitType == 2) {
|
||||
this.continueBtnLoading = true
|
||||
} else {
|
||||
this.btnLoading = true
|
||||
}
|
||||
if (!this.dataForm.id) {
|
||||
request({
|
||||
url: '/api/scm/NxPrice',
|
||||
method: 'post',
|
||||
data: _data
|
||||
}).then((res) => {
|
||||
this.$message({
|
||||
message: res.msg,
|
||||
type: 'success',
|
||||
duration: 1000,
|
||||
onClose: () => {
|
||||
if (this.dataFormSubmitType == 2) {
|
||||
this.$nextTick(() => {
|
||||
this.clearData()
|
||||
this.initDefaultData()
|
||||
})
|
||||
this.continueBtnLoading = false
|
||||
return
|
||||
}
|
||||
this.visible = false
|
||||
this.btnLoading = false
|
||||
this.$emit('refresh', true)
|
||||
}
|
||||
})
|
||||
}).catch(() => {
|
||||
this.btnLoading = false
|
||||
this.continueBtnLoading = false
|
||||
})
|
||||
} else {
|
||||
request({
|
||||
url: '/api/scm/NxPrice/' + this.dataForm.id,
|
||||
method: 'PUT',
|
||||
data: _data
|
||||
}).then((res) => {
|
||||
this.$message({
|
||||
message: res.msg,
|
||||
type: 'success',
|
||||
duration: 1000,
|
||||
onClose: () => {
|
||||
if (this.dataFormSubmitType == 2) return this.continueBtnLoading = false
|
||||
this.visible = false
|
||||
this.btnLoading = false
|
||||
this.$emit('refresh', true)
|
||||
}
|
||||
})
|
||||
}).catch(() => {
|
||||
this.btnLoading = false
|
||||
this.continueBtnLoading = false
|
||||
})
|
||||
}
|
||||
},
|
||||
addnxpriceproductList() {
|
||||
let item = {
|
||||
recoveryPrice: undefined,
|
||||
rewardPoints: undefined,
|
||||
productId: [],
|
||||
productIdOptions: [],
|
||||
}
|
||||
this.getnxpriceproductList(item)
|
||||
},
|
||||
delnxpriceproductList(index) {
|
||||
this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.dataForm.nxpriceproductList.splice(index, 1);
|
||||
}).catch(() => {
|
||||
});
|
||||
},
|
||||
getnxpriceproductList(value) {
|
||||
let item = { ...this.tableRows.nxpriceproductList, ...value }
|
||||
this.dataForm.nxpriceproductList.push(item)
|
||||
this.childIndex = this.dataForm.nxpriceproductList.length - 1
|
||||
this.isEdit = true
|
||||
this.getnxpriceproductproductIdOptions()
|
||||
this.isEdit = false
|
||||
this.childIndex = -1
|
||||
},
|
||||
addnxpricerecycleList() {
|
||||
let item = {
|
||||
recycleId: '',
|
||||
}
|
||||
this.getnxpricerecycleList(item)
|
||||
},
|
||||
delnxpricerecycleList(index) {
|
||||
this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.dataForm.nxpricerecycleList.splice(index, 1);
|
||||
}).catch(() => {
|
||||
});
|
||||
},
|
||||
getnxpricerecycleList(value) {
|
||||
let item = { ...this.tableRows.nxpricerecycleList, ...value }
|
||||
this.dataForm.nxpricerecycleList.push(item)
|
||||
this.childIndex = this.dataForm.nxpricerecycleList.length - 1
|
||||
this.isEdit = true
|
||||
this.isEdit = false
|
||||
this.childIndex = -1
|
||||
},
|
||||
openSelectDialog(key) {
|
||||
this.currTableConf = this.addTableConf[key]
|
||||
this.currVmodel = key
|
||||
this.selectDialogVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.selectDialog.init()
|
||||
})
|
||||
},
|
||||
addForSelect(data) {
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
let t = data[i]
|
||||
if (this['get' + this.currVmodel]) {
|
||||
this['get' + this.currVmodel](t)
|
||||
}
|
||||
}
|
||||
},
|
||||
dateTime(timeRule, timeType, timeTarget, timeValueData, dataValue) {
|
||||
let timeDataValue = null;
|
||||
let timeValue = Number(timeValueData)
|
||||
if (timeRule) {
|
||||
if (timeType == 1) {
|
||||
timeDataValue = timeValue
|
||||
} else if (timeType == 2) {
|
||||
timeDataValue = dataValue
|
||||
} else if (timeType == 3) {
|
||||
timeDataValue = new Date().getTime()
|
||||
} else if (timeType == 4) {
|
||||
let previousDate = '';
|
||||
if (timeTarget == 1 || timeTarget == 2) {
|
||||
previousDate = getDateDay(timeTarget, timeType, timeValue)
|
||||
timeDataValue = new Date(previousDate).getTime()
|
||||
} else if (timeTarget == 3) {
|
||||
previousDate = getBeforeData(timeValue)
|
||||
timeDataValue = new Date(previousDate).getTime()
|
||||
} else {
|
||||
timeDataValue = getBeforeTime(timeTarget, timeValue).getTime()
|
||||
}
|
||||
} else if (timeType == 5) {
|
||||
let previousDate = '';
|
||||
if (timeTarget == 1 || timeTarget == 2) {
|
||||
previousDate = getDateDay(timeTarget, timeType, timeValue)
|
||||
timeDataValue = new Date(previousDate).getTime()
|
||||
} else if (timeTarget == 3) {
|
||||
previousDate = getLaterData(timeValue)
|
||||
timeDataValue = new Date(previousDate).getTime()
|
||||
} else {
|
||||
timeDataValue = getLaterTime(timeTarget, timeValue).getTime()
|
||||
}
|
||||
}
|
||||
}
|
||||
return timeDataValue;
|
||||
},
|
||||
time(timeRule, timeType, timeTarget, timeValue, formatType, dataValue) {
|
||||
let format = formatType == 'HH:mm' ? 'HH:mm:00' : formatType
|
||||
let timeDataValue = null
|
||||
if (timeRule) {
|
||||
if (timeType == 1) {
|
||||
timeDataValue = timeValue || '00:00:00'
|
||||
if (timeDataValue.split(':').length == 3) {
|
||||
timeDataValue = timeDataValue
|
||||
} else {
|
||||
timeDataValue = timeDataValue + ':00'
|
||||
}
|
||||
} else if (timeType == 2) {
|
||||
timeDataValue = dataValue
|
||||
} else if (timeType == 3) {
|
||||
timeDataValue = this.jnpf.toDate(new Date(), format)
|
||||
} else if (timeType == 4) {
|
||||
let previousDate = '';
|
||||
previousDate = getBeforeTime(timeTarget, timeValue)
|
||||
timeDataValue = this.jnpf.toDate(previousDate, format)
|
||||
} else if (timeType == 5) {
|
||||
let previousDate = '';
|
||||
previousDate = getLaterTime(timeTarget, timeValue)
|
||||
timeDataValue = this.jnpf.toDate(previousDate, format)
|
||||
}
|
||||
}
|
||||
return timeDataValue;
|
||||
},
|
||||
dataList() {
|
||||
var _data = this.dataForm;
|
||||
return _data;
|
||||
},
|
||||
dataInfo(dataAll) {
|
||||
let _dataAll = dataAll
|
||||
this.dataForm = _dataAll
|
||||
this.isEdit = true
|
||||
this.dataAll()
|
||||
for (let i = 0; i < _dataAll.nxpriceproductList.length; i++) {
|
||||
this.childIndex = i
|
||||
this.getnxpriceproductproductIdOptions()
|
||||
}
|
||||
for (let i = 0; i < _dataAll.nxpricerecycleList.length; i++) {
|
||||
this.childIndex = i
|
||||
}
|
||||
this.childIndex = -1
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
</script>
|
@ -0,0 +1,885 @@
|
||||
<template>
|
||||
<transition name="el-zoom-in-center">
|
||||
<div class="JNPF-preview-main">
|
||||
<div class="JNPF-common-page-header">
|
||||
<el-page-header @back="goBack" :content="!dataForm.id ? '新建' : '编辑'" />
|
||||
<div class="options">
|
||||
<el-dropdown class="dropdown" placement="bottom">
|
||||
<el-button style="width: 70px">
|
||||
更 多<i class="el-icon-arrow-down el-icon--right"></i>
|
||||
</el-button>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<template v-if="dataForm.id">
|
||||
<el-dropdown-item @click.native="prev" :disabled="prevDis">
|
||||
{{ "上一条" }}
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item @click.native="next" :disabled="nextDis">
|
||||
{{ "下一条" }}
|
||||
</el-dropdown-item>
|
||||
</template>
|
||||
<el-dropdown-item type="primary" @click.native="dataFormSubmit(2)" :loading="continueBtnLoading"
|
||||
:disabled="btnLoading">
|
||||
{{
|
||||
!dataForm.id ? "确定并新增" : "确定并继续"
|
||||
}}</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
<el-button type="primary" @click="dataFormSubmit()" :loading="btnLoading" :disabled="continueBtnLoading">
|
||||
保 存</el-button>
|
||||
<el-button @click="goBack"> 取 消</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<el-row :gutter="15" class="main" :style="{ margin: '0 auto', width: '100%' }">
|
||||
<el-form ref="formRef" :model="dataForm" :rules="dataRule" size="small" label-width="100px"
|
||||
label-position="right">
|
||||
<template v-if="!loading">
|
||||
<!-- 具体表单 -->
|
||||
<el-col :span="24">
|
||||
<jnpf-form-tip-item>
|
||||
<JnpfGroupTitle content="基本信息" contentPosition="left">
|
||||
</JnpfGroupTitle>
|
||||
</jnpf-form-tip-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<jnpf-form-tip-item label="价格编号" prop="priceCode">
|
||||
<JnpfInput v-model="dataForm.priceCode" @change="changeData('priceCode', -1)" placeholder="系统自动生成"
|
||||
readonly :style="{ width: '100%' }">
|
||||
</JnpfInput>
|
||||
</jnpf-form-tip-item>
|
||||
</el-col>
|
||||
<!-- <el-col :span="8">
|
||||
<jnpf-form-tip-item label="报价方" prop="buinessId">
|
||||
<JnpfOrganizeSelect
|
||||
v-model="dataForm.buinessId"
|
||||
@change="changeData('buinessId', -1)"
|
||||
placeholder="请选择"
|
||||
selectType="all"
|
||||
:ableIds="ableAll.buinessIdableIds"
|
||||
clearable
|
||||
:style="{ width: '100%' }"
|
||||
>
|
||||
</JnpfOrganizeSelect>
|
||||
</jnpf-form-tip-item>
|
||||
</el-col> -->
|
||||
|
||||
<el-col :span="8">
|
||||
<jnpf-form-tip-item label="报价方" prop="buinessId">
|
||||
<JnpfDepSelect v-model="dataForm.buinessId" @change="changeData('buinessId', -1)" placeholder="请选择"
|
||||
selectType="all" :ableIds="ableAll.buinessId" clearable disabled="true" :style="{ width: '100%' }">
|
||||
</JnpfDepSelect>
|
||||
</jnpf-form-tip-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="8">
|
||||
<jnpf-form-tip-item label="价格类型" prop="priceType">
|
||||
<JnpfSelect v-model="dataForm.priceType" @change="changeData('priceType', -1)" placeholder="请选择"
|
||||
clearable :style="{ width: '100%' }" :options="priceTypeOptions" :props="priceTypeProps">
|
||||
</JnpfSelect>
|
||||
</jnpf-form-tip-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<jnpf-form-tip-item>
|
||||
<JnpfGroupTitle content="价格信息" contentPosition="left">
|
||||
</JnpfGroupTitle>
|
||||
</jnpf-form-tip-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<jnpf-form-tip-item label-width="0">
|
||||
<div class="JNPF-common-title">
|
||||
<h2></h2>
|
||||
</div>
|
||||
<el-table :data="dataForm.nxPriceProductList" size="mini">
|
||||
<el-table-column type="index" width="50" label="序号" align="center" />
|
||||
<el-table-column label="商品名称" prop="productId">
|
||||
<template slot="header" v-if="true">
|
||||
<span class="required-sign">*</span>商品名称
|
||||
</template>
|
||||
<template slot-scope="scope">
|
||||
<JnpfPopupSelect v-model="scope.row.productId" @change="changeProduct" :rowIndex="scope.$index"
|
||||
:formData="dataForm" :templateJson="interfaceRes.nxpriceproductproductId" placeholder="请选择"
|
||||
hasPage propsValue="id" popupWidth="800px" popupTitle="选择数据" popupType="dialog"
|
||||
relationField="name" :field="'productId' + scope.$index" interfaceId="534687918480949765"
|
||||
:pageSize="20" :columnOptions="nxpriceproductproductIdcolumnOptions" clearable
|
||||
:style="{ width: '100%' }">
|
||||
</JnpfPopupSelect>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="单位" prop="unit">
|
||||
<template slot="header" v-if="false">
|
||||
<span class="required-sign"></span>单位
|
||||
</template>
|
||||
<template slot-scope="scope">
|
||||
<JnpfInput v-model="scope.row.unit" disabled @change="
|
||||
changeData('nxpriceproduct-units', scope.$index)
|
||||
" placeholder="请输入" clearable :style="{ width: '100%' }">
|
||||
</JnpfInput>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="回收价" prop="recoveryPrice">
|
||||
<template slot="header" v-if="true">
|
||||
<span class="required-sign">*</span>回收价
|
||||
</template>
|
||||
<template slot-scope="scope">
|
||||
<JnpfInput v-model="scope.row.recoveryPrice" @change="
|
||||
changeData(
|
||||
'nxpriceproduct-recoveryPrice',
|
||||
scope.$index
|
||||
)
|
||||
" placeholder="请输入" clearable :style="{ width: '100%' }">
|
||||
</JnpfInput>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="赠送积分" prop="rewardPoints">
|
||||
<template slot="header" v-if="false">
|
||||
<span class="required-sign">*</span>赠送积分
|
||||
</template>
|
||||
<template slot-scope="scope">
|
||||
<JnpfInput v-model="scope.row.rewardPoints" @change="
|
||||
changeData(
|
||||
'nxpriceproduct-rewardPoints',
|
||||
scope.$index
|
||||
)
|
||||
" placeholder="请输入" clearable :style="{ width: '100%' }">
|
||||
</JnpfInput>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="50">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" type="text" class="JNPF-table-delBtn"
|
||||
@click="delnxpriceproductList(scope.$index)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- <div class="table-actions" @click="addnxpriceproductList()">
|
||||
<el-button type="text" icon="el-icon-plus">添加</el-button>
|
||||
</div> -->
|
||||
|
||||
<div class="table-actions" @click="choice()">
|
||||
<el-button type="text" icon="el-icon-plus">添加</el-button>
|
||||
</div>
|
||||
</jnpf-form-tip-item>
|
||||
</el-col>
|
||||
<!-- <el-col :span="24">
|
||||
<jnpf-form-tip-item>
|
||||
<JnpfGroupTitle content="适配服务站" contentPosition="left">
|
||||
</JnpfGroupTitle>
|
||||
</jnpf-form-tip-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<jnpf-form-tip-item label-width="0">
|
||||
<div class="JNPF-common-title">
|
||||
<h2></h2>
|
||||
</div>
|
||||
<el-table :data="dataForm.nxPriceRecycleList" size="mini">
|
||||
<el-table-column type="index" width="50" label="序号" align="center" />
|
||||
<el-table-column label="回收站" prop="recycleId">
|
||||
<template slot="header" v-if="true">
|
||||
<span class="required-sign">*</span>回收站
|
||||
</template>
|
||||
<template slot-scope="scope">
|
||||
<JnpfPopupSelect v-model="scope.row.recycleId" @change="
|
||||
changeData('nxpricerecycle-recycleId', scope.$index)
|
||||
" :rowIndex="scope.$index" :formData="dataForm" :templateJson="interfaceRes.nxpricerecyclerecycleId" disabled
|
||||
placeholder="请选择" hasPage propsValue="id" popupWidth="800px" popupTitle="选择数据"
|
||||
popupType="dialog" relationField="station_name" :field="'recycleId' + scope.$index"
|
||||
interfaceId="534688845753483781" :pageSize="20"
|
||||
:columnOptions="nxpricerecyclerecycleIdcolumnOptions" clearable :style="{ width: '100%' }">
|
||||
</JnpfPopupSelect>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="回收站名称" prop="stationCode">
|
||||
<template slot="header" v-if="true">
|
||||
<span class="required-sign"></span>回收站编码
|
||||
</template>
|
||||
<template slot-scope="scope">
|
||||
<JnpfInput v-model="scope.row.stationCode" placeholder="请输入" disabled clearable
|
||||
:style="{ width: '100%' }">
|
||||
</JnpfInput>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="操作" width="50">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" type="text" class="JNPF-table-delBtn"
|
||||
@click="delnxpricerecycleList(scope.$index)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="table-actions" @click="addnxpricerecycleList()"
|
||||
v-if="dataForm.nxPriceRecycleList.length == 0">
|
||||
<el-button type="text" icon="el-icon-plus">回收站添加</el-button>
|
||||
</div>
|
||||
</jnpf-form-tip-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<jnpf-form-tip-item label="备注" prop="remak">
|
||||
<JnpfInput v-model="dataForm.remak" @change="changeData('remak', -1)" placeholder="请输入" clearable
|
||||
:style="{ width: '100%' }">
|
||||
</JnpfInput>
|
||||
</jnpf-form-tip-item>
|
||||
</el-col> -->
|
||||
<!-- 表单结束 -->
|
||||
</template>
|
||||
</el-form>
|
||||
<SelectDialog v-if="selectDialogVisible" :config="currTableConf" :formData="dataForm" ref="selectDialog"
|
||||
@select="addForSelect" @close="selectDialogVisible = false" />
|
||||
</el-row>
|
||||
|
||||
<ProductBox v-if="productBoxxVisible" ref="ProductBoxs" @refreshDataList="initList" />
|
||||
</div>
|
||||
</transition>
|
||||
</template>
|
||||
|
||||
|
||||
<script>
|
||||
import request from "@/utils/request";
|
||||
import { mapGetters } from "vuex";
|
||||
import { getDataInterfaceRes } from "@/api/systemData/dataInterface";
|
||||
import { getDictionaryDataSelector } from "@/api/systemData/dictionary";
|
||||
import { getDefaultCurrentValueUserId } from "@/api/permission/user";
|
||||
import { getDefaultCurrentValueDepartmentId } from "@/api/permission/organize";
|
||||
import {
|
||||
getDateDay,
|
||||
getLaterData,
|
||||
getBeforeData,
|
||||
getBeforeTime,
|
||||
getLaterTime,
|
||||
} from "@/components/Generator/utils/index.js";
|
||||
import { thousandsFormat } from "@/components/Generator/utils/index";
|
||||
|
||||
import ProductBox from "@/views/publicPopup/productBox";
|
||||
|
||||
export default {
|
||||
components: { ProductBox },
|
||||
props: [],
|
||||
data() {
|
||||
return {
|
||||
list: [],
|
||||
dataFormSubmitType: 0,
|
||||
continueBtnLoading: false,
|
||||
index: 0,
|
||||
prevDis: false,
|
||||
nextDis: false,
|
||||
allList: [],
|
||||
visible: false,
|
||||
loading: false,
|
||||
btnLoading: false,
|
||||
formRef: "formRef",
|
||||
setting: {},
|
||||
eventType: "",
|
||||
userBoxVisible: false,
|
||||
productBoxxVisible: false,
|
||||
selectDialogVisible: false,
|
||||
currTableConf: {},
|
||||
dataValueAll: {},
|
||||
|
||||
|
||||
addTableConf: {
|
||||
nxPriceProductList: {
|
||||
popupType: "dialog",
|
||||
hasPage: true,
|
||||
popupTitle: "选择数据",
|
||||
pageSize: 20,
|
||||
columnOptions: [],
|
||||
interfaceId: "",
|
||||
interfaceName: "",
|
||||
relationOptions: [],
|
||||
templateJson: [],
|
||||
popupWidth: "800px",
|
||||
},
|
||||
nxPriceRecycleList: {
|
||||
popupType: "dialog",
|
||||
hasPage: true,
|
||||
popupTitle: "选择数据",
|
||||
pageSize: 20,
|
||||
columnOptions: [],
|
||||
interfaceId: "",
|
||||
interfaceName: "",
|
||||
relationOptions: [],
|
||||
templateJson: [],
|
||||
popupWidth: "800px",
|
||||
},
|
||||
},
|
||||
//可选范围默认值
|
||||
ableAll: {},
|
||||
tableRows: {
|
||||
nxPriceProductList: {
|
||||
productId: "",
|
||||
productIdOptions: [],
|
||||
recoveryPrice: "",
|
||||
recoveryPriceOptions: [],
|
||||
rewardPoints: "",
|
||||
rewardPointsOptions: [],
|
||||
enabledmark: undefined,
|
||||
},
|
||||
nxPriceRecycleList: {
|
||||
recycleId: "",
|
||||
recycleIdOptions: [],
|
||||
enabledmark: undefined,
|
||||
},
|
||||
},
|
||||
Vmodel: "",
|
||||
currVmodel: "",
|
||||
dataForm: {
|
||||
priceCode: undefined,
|
||||
buinessId: undefined,
|
||||
priceType: "1",
|
||||
creatorUserId: undefined,
|
||||
creatorTime: undefined,
|
||||
lastModifyTime: undefined,
|
||||
lastModifyUserId: undefined,
|
||||
remak: undefined,
|
||||
nxPriceProductList: [],
|
||||
nxPriceRecycleList: [],
|
||||
version: 0,
|
||||
},
|
||||
tableRequiredData: {},
|
||||
dataRule: {
|
||||
buinessId: [
|
||||
{
|
||||
required: true,
|
||||
message: "请至少选择一个",
|
||||
trigger: "change",
|
||||
},
|
||||
],
|
||||
priceType: [
|
||||
{
|
||||
required: true,
|
||||
message: "请至少选择一个",
|
||||
trigger: "change",
|
||||
},
|
||||
],
|
||||
recycleId: [
|
||||
{
|
||||
required: true,
|
||||
message: "请至少选择一个",
|
||||
trigger: "change",
|
||||
},
|
||||
],
|
||||
productId: [
|
||||
{
|
||||
required: true,
|
||||
message: "请至少选择一个",
|
||||
trigger: "change",
|
||||
},
|
||||
],
|
||||
},
|
||||
priceTypeOptions: [{ fullName: "回收价", id: "1" }],
|
||||
priceTypeProps: { label: "fullName", value: "id" },
|
||||
nxpriceproductproductIdcolumnOptions: [
|
||||
{ label: "编码", value: "code" },
|
||||
{ label: "名称", value: "name" },
|
||||
{ label: "规格", value: "spec" },
|
||||
],
|
||||
nxpricerecyclerecycleIdcolumnOptions: [
|
||||
{ label: "回收站编号", value: "station_code" },
|
||||
{ label: "回收站名称", value: "station_name" },
|
||||
],
|
||||
childIndex: -1,
|
||||
isEdit: false,
|
||||
interfaceRes: {
|
||||
priceCode: [],
|
||||
buinessId: [],
|
||||
priceType: [],
|
||||
creatorUserId: [],
|
||||
creatorTime: [],
|
||||
lastModifyTime: [],
|
||||
lastModifyUserId: [],
|
||||
remak: [],
|
||||
nxpriceproductproductId: [],
|
||||
nxpriceproductrecoveryPrice: [],
|
||||
nxpriceproductrewardPoints: [],
|
||||
nxpricerecyclerecycleId: [],
|
||||
},
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(["userInfo"]),
|
||||
},
|
||||
watch: {},
|
||||
created() {
|
||||
this.dataAll();
|
||||
this.initDefaultData();
|
||||
this.dataValueAll = JSON.parse(JSON.stringify(this.dataForm));
|
||||
},
|
||||
mounted() { },
|
||||
methods: {
|
||||
prev() {
|
||||
this.index--;
|
||||
if (this.index === 0) {
|
||||
this.prevDis = true;
|
||||
}
|
||||
this.nextDis = false;
|
||||
for (let index = 0; index < this.allList.length; index++) {
|
||||
const element = this.allList[index];
|
||||
if (this.index == index) {
|
||||
this.getInfo(element.id);
|
||||
}
|
||||
}
|
||||
},
|
||||
next() {
|
||||
this.index++;
|
||||
if (this.index === this.allList.length - 1) {
|
||||
this.nextDis = true;
|
||||
}
|
||||
this.prevDis = false;
|
||||
for (let index = 0; index < this.allList.length; index++) {
|
||||
const element = this.allList[index];
|
||||
if (this.index == index) {
|
||||
this.getInfo(element.id);
|
||||
}
|
||||
}
|
||||
},
|
||||
getInfo(id) {
|
||||
request({
|
||||
url: "/api/scm/NxPrice/" + id,
|
||||
method: "get",
|
||||
}).then((res) => {
|
||||
this.dataInfo(res.data);
|
||||
});
|
||||
},
|
||||
goBack() {
|
||||
this.visible = false;
|
||||
this.$emit("refreshDataList", true);
|
||||
},
|
||||
|
||||
changeProduct(model, row) {
|
||||
row.productId = row.id;
|
||||
|
||||
this.dataForm.nxPriceProductList.push(row);
|
||||
// debugger;
|
||||
// console.log(this.dataForm.nxPriceProductList);
|
||||
this.dataForm.nxPriceProductList.splice(-2, 1);
|
||||
|
||||
// this.dataForm.units = row.units;
|
||||
},
|
||||
|
||||
changeData(model, index) {
|
||||
this.isEdit = false;
|
||||
this.childIndex = index;
|
||||
let modelAll = model.split("-");
|
||||
let faceMode = "";
|
||||
for (let i = 0; i < modelAll.length; i++) {
|
||||
faceMode += modelAll[i];
|
||||
}
|
||||
for (let key in this.interfaceRes) {
|
||||
if (key != faceMode) {
|
||||
let faceReList = this.interfaceRes[key];
|
||||
for (let i = 0; i < faceReList.length; i++) {
|
||||
if (faceReList[i].relationField == model) {
|
||||
let options = "get" + key + "Options";
|
||||
if (this[options]) {
|
||||
this[options]();
|
||||
}
|
||||
this.changeData(key, index);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
changeDataFormData(type, data, model, index, defaultValue) {
|
||||
if (!this.isEdit) {
|
||||
if (type == 2) {
|
||||
for (let i = 0; i < this.dataForm[data].length; i++) {
|
||||
if (index == -1) {
|
||||
this.dataForm[data][i][model] = defaultValue;
|
||||
} else if (index == i) {
|
||||
this.dataForm[data][i][model] = defaultValue;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.dataForm[data] = defaultValue;
|
||||
}
|
||||
}
|
||||
},
|
||||
dataAll() { },
|
||||
nxpriceproductExist() {
|
||||
let isOk = true;
|
||||
for (let i = 0; i < this.dataForm.nxPriceProductList.length; i++) {
|
||||
const e = this.dataForm.nxPriceProductList[i];
|
||||
if (!e.productId) {
|
||||
this.$message({
|
||||
message: "商品名称不能为空",
|
||||
type: "error",
|
||||
duration: 1000,
|
||||
});
|
||||
isOk = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return isOk;
|
||||
},
|
||||
nxpricerecycleExist() {
|
||||
let isOk = true;
|
||||
for (let i = 0; i < this.dataForm.nxPriceRecycleList.length; i++) {
|
||||
const e = this.dataForm.nxPriceRecycleList[i];
|
||||
// if (!e.recycleId) {
|
||||
// this.$message({
|
||||
// message: "回收站不能为空",
|
||||
// type: "error",
|
||||
// duration: 1000,
|
||||
// });
|
||||
// isOk = false;
|
||||
// break;
|
||||
// }
|
||||
}
|
||||
return isOk;
|
||||
},
|
||||
goBack() {
|
||||
this.$emit("refresh");
|
||||
},
|
||||
clearData() {
|
||||
this.dataForm = JSON.parse(JSON.stringify(this.dataValueAll));
|
||||
},
|
||||
init(id, isDetail, allList) {
|
||||
this.prevDis = false;
|
||||
this.nextDis = false;
|
||||
this.allList = allList || [];
|
||||
if (allList.length) {
|
||||
this.index = this.allList.findIndex((item) => item.id === id);
|
||||
if (this.index == 0) {
|
||||
this.prevDis = true;
|
||||
}
|
||||
if (this.index == this.allList.length - 1) {
|
||||
this.nextDis = true;
|
||||
}
|
||||
} else {
|
||||
this.prevDis = true;
|
||||
this.nextDis = true;
|
||||
}
|
||||
this.dataForm.id = id || 0;
|
||||
this.visible = true;
|
||||
this.$nextTick(() => {
|
||||
if (this.dataForm.id) {
|
||||
this.loading = true;
|
||||
request({
|
||||
url: "/api/scm/NxPrice/" + this.dataForm.id,
|
||||
method: "get",
|
||||
}).then((res) => {
|
||||
this.dataInfo(res.data);
|
||||
this.loading = false;
|
||||
});
|
||||
} else {
|
||||
this.clearData();
|
||||
this.initDefaultData();
|
||||
}
|
||||
});
|
||||
this.$store.commit("generator/UPDATE_RELATION_DATA", {});
|
||||
},
|
||||
|
||||
choice() {
|
||||
this.productBoxxVisible = true;
|
||||
let excludeIdList = [];
|
||||
for (let i = 0; i < this.dataForm.nxPriceProductList.length; i++) {
|
||||
excludeIdList.push(this.dataForm.nxPriceProductList[i].productId);
|
||||
}
|
||||
this.$nextTick(() => {
|
||||
this.$refs.ProductBoxs.init(excludeIdList);
|
||||
});
|
||||
},
|
||||
initList(list) {
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
const e = list[i];
|
||||
let item = {
|
||||
productId: e.id,
|
||||
name: e.name,
|
||||
code: e.code,
|
||||
spec: e.spec,
|
||||
unit: e.unit,
|
||||
// hasSchedule: e.hasSchedule,
|
||||
// recycleAddress: e.recycleAddress,
|
||||
};
|
||||
this.dataForm.nxPriceProductList.push(item);
|
||||
}
|
||||
},
|
||||
|
||||
//初始化默认数据
|
||||
initDefaultData() {
|
||||
if (
|
||||
this.userInfo.organizeIdList instanceof Array &&
|
||||
this.userInfo.organizeIdList.length > 0
|
||||
) {
|
||||
this.dataForm.buinessId = this.userInfo.organizeIdList;
|
||||
}
|
||||
this.dataForm.firstContactPerson = this.userInfo.userId;
|
||||
if (
|
||||
this.$store.getters.userInfo.organizeId &&
|
||||
this.$store.getters.userInfo.organizeId != null
|
||||
) {
|
||||
this.dataForm.buinessId = this.$store.getters.userInfo.organizeId;
|
||||
}
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmit(type) {
|
||||
this.dataFormSubmitType = type ? type : 0;
|
||||
this.$refs["formRef"].validate((valid) => {
|
||||
if (valid) {
|
||||
if (!this.nxpriceproductExist()) return;
|
||||
if (!this.nxpricerecycleExist()) return;
|
||||
this.request();
|
||||
}
|
||||
});
|
||||
},
|
||||
request() {
|
||||
let _data = this.dataList();
|
||||
if (this.dataFormSubmitType == 2) {
|
||||
this.continueBtnLoading = true;
|
||||
} else {
|
||||
this.btnLoading = true;
|
||||
}
|
||||
if (!this.dataForm.id) {
|
||||
request({
|
||||
url: "/api/scm/NxPrice",
|
||||
method: "post",
|
||||
data: _data,
|
||||
})
|
||||
.then((res) => {
|
||||
this.$message({
|
||||
message: res.msg,
|
||||
type: "success",
|
||||
duration: 1000,
|
||||
onClose: () => {
|
||||
if (this.dataFormSubmitType == 2) {
|
||||
this.$nextTick(() => {
|
||||
this.clearData();
|
||||
this.initDefaultData();
|
||||
});
|
||||
this.continueBtnLoading = false;
|
||||
return;
|
||||
}
|
||||
this.visible = false;
|
||||
this.btnLoading = false;
|
||||
this.$emit("refresh", true);
|
||||
},
|
||||
});
|
||||
})
|
||||
.catch(() => {
|
||||
this.btnLoading = false;
|
||||
this.continueBtnLoading = false;
|
||||
});
|
||||
} else {
|
||||
request({
|
||||
url: "/api/scm/NxPrice/" + this.dataForm.id,
|
||||
method: "PUT",
|
||||
data: _data,
|
||||
})
|
||||
.then((res) => {
|
||||
this.$message({
|
||||
message: res.msg,
|
||||
type: "success",
|
||||
duration: 1000,
|
||||
onClose: () => {
|
||||
if (this.dataFormSubmitType == 2)
|
||||
return (this.continueBtnLoading = false);
|
||||
this.visible = false;
|
||||
this.btnLoading = false;
|
||||
this.$emit("refresh", true);
|
||||
},
|
||||
});
|
||||
})
|
||||
.catch(() => {
|
||||
this.btnLoading = false;
|
||||
this.continueBtnLoading = false;
|
||||
});
|
||||
}
|
||||
},
|
||||
addnxpriceproductList() {
|
||||
let item = {
|
||||
productId: "",
|
||||
recoveryPrice: undefined,
|
||||
rewardPoints: undefined,
|
||||
};
|
||||
this.getnxpriceproductList(item);
|
||||
},
|
||||
delnxpriceproductList(index) {
|
||||
this.$confirm("此操作将永久删除该数据, 是否继续?", "提示", {
|
||||
type: "warning",
|
||||
})
|
||||
.then(() => {
|
||||
this.dataForm.nxPriceProductList.splice(index, 1);
|
||||
})
|
||||
.catch(() => { });
|
||||
},
|
||||
getnxpriceproductList(value) {
|
||||
let item = { ...this.tableRows.nxPriceProductList, ...value };
|
||||
this.dataForm.nxPriceProductList.push(item);
|
||||
this.childIndex = this.dataForm.nxPriceProductList.length - 1;
|
||||
this.isEdit = true;
|
||||
this.isEdit = false;
|
||||
this.childIndex = -1;
|
||||
},
|
||||
addnxpricerecycleList() {
|
||||
|
||||
request({
|
||||
url: "/api/scm/NxPrice/getListRecycleStation",
|
||||
method: "post",
|
||||
}).then((res) => {
|
||||
this.list = res.data.list
|
||||
console.log(this.list);
|
||||
for (let i = 0; i < this.list.length; i++) {
|
||||
|
||||
const e = this.list[i];
|
||||
let list = {
|
||||
recycleId: e.id,
|
||||
stationCode: e.stationCode,
|
||||
// productId: e.id,
|
||||
name: e.name,
|
||||
code: e.code,
|
||||
spec: e.spec,
|
||||
unit: e.unit,
|
||||
// hasSchedule: e.hasSchedule,
|
||||
// recycleAddress: e.recycleAddress,
|
||||
};
|
||||
this.dataForm.nxPriceRecycleList.push(list);
|
||||
}
|
||||
|
||||
// this.dataForm.nxPriceRecycleList.push(res);
|
||||
this.loading = false;
|
||||
});
|
||||
|
||||
// let item = {
|
||||
// recycleId: "",
|
||||
// };
|
||||
// this.getnxpricerecycleList(item);
|
||||
|
||||
|
||||
// .then((res) => {
|
||||
// this.$message({
|
||||
// message: res.msg,
|
||||
// type: "success",
|
||||
// duration: 1000,
|
||||
// onClose: () => {
|
||||
// if (this.dataFormSubmitType == 2)
|
||||
// return (this.continueBtnLoading = false);
|
||||
// this.visible = false;
|
||||
// this.btnLoading = false;
|
||||
// this.$emit("refresh", true);
|
||||
// },
|
||||
// });
|
||||
// })
|
||||
// .catch(() => {
|
||||
// this.btnLoading = false;
|
||||
// this.continueBtnLoading = false;
|
||||
// });
|
||||
|
||||
|
||||
},
|
||||
delnxpricerecycleList(index) {
|
||||
this.$confirm("此操作将永久删除该数据, 是否继续?", "提示", {
|
||||
type: "warning",
|
||||
})
|
||||
.then(() => {
|
||||
this.dataForm.nxPriceRecycleList.splice(index, 1);
|
||||
})
|
||||
.catch(() => { });
|
||||
},
|
||||
getnxpricerecycleList(value) {
|
||||
let item = { ...this.tableRows.nxPriceRecycleList, ...value };
|
||||
this.dataForm.nxPriceRecycleList.push(item);
|
||||
this.childIndex = this.dataForm.nxPriceRecycleList.length - 1;
|
||||
this.isEdit = true;
|
||||
this.isEdit = false;
|
||||
this.childIndex = -1;
|
||||
},
|
||||
openSelectDialog(key) {
|
||||
this.currTableConf = this.addTableConf[key];
|
||||
this.currVmodel = key;
|
||||
this.selectDialogVisible = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs.selectDialog.init();
|
||||
});
|
||||
},
|
||||
addForSelect(data) {
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
let t = data[i];
|
||||
if (this["get" + this.currVmodel]) {
|
||||
this["get" + this.currVmodel](t);
|
||||
}
|
||||
}
|
||||
},
|
||||
dateTime(timeRule, timeType, timeTarget, timeValueData, dataValue) {
|
||||
let timeDataValue = null;
|
||||
let timeValue = Number(timeValueData);
|
||||
if (timeRule) {
|
||||
if (timeType == 1) {
|
||||
timeDataValue = timeValue;
|
||||
} else if (timeType == 2) {
|
||||
timeDataValue = dataValue;
|
||||
} else if (timeType == 3) {
|
||||
timeDataValue = new Date().getTime();
|
||||
} else if (timeType == 4) {
|
||||
let previousDate = "";
|
||||
if (timeTarget == 1 || timeTarget == 2) {
|
||||
previousDate = getDateDay(timeTarget, timeType, timeValue);
|
||||
timeDataValue = new Date(previousDate).getTime();
|
||||
} else if (timeTarget == 3) {
|
||||
previousDate = getBeforeData(timeValue);
|
||||
timeDataValue = new Date(previousDate).getTime();
|
||||
} else {
|
||||
timeDataValue = getBeforeTime(timeTarget, timeValue).getTime();
|
||||
}
|
||||
} else if (timeType == 5) {
|
||||
let previousDate = "";
|
||||
if (timeTarget == 1 || timeTarget == 2) {
|
||||
previousDate = getDateDay(timeTarget, timeType, timeValue);
|
||||
timeDataValue = new Date(previousDate).getTime();
|
||||
} else if (timeTarget == 3) {
|
||||
previousDate = getLaterData(timeValue);
|
||||
timeDataValue = new Date(previousDate).getTime();
|
||||
} else {
|
||||
timeDataValue = getLaterTime(timeTarget, timeValue).getTime();
|
||||
}
|
||||
}
|
||||
}
|
||||
return timeDataValue;
|
||||
},
|
||||
time(timeRule, timeType, timeTarget, timeValue, formatType, dataValue) {
|
||||
let format = formatType == "HH:mm" ? "HH:mm:00" : formatType;
|
||||
let timeDataValue = null;
|
||||
if (timeRule) {
|
||||
if (timeType == 1) {
|
||||
timeDataValue = timeValue || "00:00:00";
|
||||
if (timeDataValue.split(":").length == 3) {
|
||||
timeDataValue = timeDataValue;
|
||||
} else {
|
||||
timeDataValue = timeDataValue + ":00";
|
||||
}
|
||||
} else if (timeType == 2) {
|
||||
timeDataValue = dataValue;
|
||||
} else if (timeType == 3) {
|
||||
timeDataValue = this.jnpf.toDate(new Date(), format);
|
||||
} else if (timeType == 4) {
|
||||
let previousDate = "";
|
||||
previousDate = getBeforeTime(timeTarget, timeValue);
|
||||
timeDataValue = this.jnpf.toDate(previousDate, format);
|
||||
} else if (timeType == 5) {
|
||||
let previousDate = "";
|
||||
previousDate = getLaterTime(timeTarget, timeValue);
|
||||
timeDataValue = this.jnpf.toDate(previousDate, format);
|
||||
}
|
||||
}
|
||||
return timeDataValue;
|
||||
},
|
||||
dataList() {
|
||||
var _data = this.dataForm;
|
||||
return _data;
|
||||
},
|
||||
dataInfo(dataAll) {
|
||||
let _dataAll = dataAll;
|
||||
this.dataForm = _dataAll;
|
||||
this.isEdit = true;
|
||||
this.dataAll();
|
||||
for (let i = 0; i < _dataAll.nxPriceProductList.length; i++) {
|
||||
this.childIndex = i;
|
||||
}
|
||||
for (let i = 0; i < _dataAll.nxPriceRecycleList.length; i++) {
|
||||
this.childIndex = i;
|
||||
}
|
||||
this.childIndex = -1;
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
Loading…
Reference in new issue