|
@@ -40,8 +40,8 @@
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="6">
|
|
|
- <el-form-item label="工单类型" prop="pgOrderType">
|
|
|
- <el-select v-model="formData.pgOrderType" placeholder="请选择">
|
|
|
+ <el-form-item label="工单类型" prop="orderSmallType">
|
|
|
+ <el-select v-model="formData.orderSmallType" placeholder="请选择">
|
|
|
<el-option
|
|
|
v-for="item in orderTypeList"
|
|
|
:key="item.id"
|
|
@@ -177,14 +177,16 @@
|
|
|
v-model="scope.row.mainId"
|
|
|
filterable
|
|
|
placeholder="请选择"
|
|
|
- @change="changeMain(scope.$index, scope.row)">
|
|
|
+ @change="changeMain(scope.$index, scope.row)"
|
|
|
+ v-if="scope.row.isEdit">
|
|
|
<el-option
|
|
|
- v-for="item in categoryList"
|
|
|
+ v-for="item in mainList"
|
|
|
:key="item.categoryId"
|
|
|
:label="item.name"
|
|
|
:value="item.categoryId">
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
+ <div v-else>{{scope.row.mainName}}</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column align="center" label="小类" prop="smallId" min-width="160">
|
|
@@ -194,14 +196,16 @@
|
|
|
v-model="scope.row.smallId"
|
|
|
filterable
|
|
|
placeholder="请选择"
|
|
|
- @change="changeSmall(scope.$index, scope.row)">
|
|
|
+ @change="changeSmall(scope.$index, scope.row)"
|
|
|
+ v-if="scope.row.isEdit">
|
|
|
<el-option
|
|
|
- v-for="item in scope.row.mainId ? categoryList.find(o => o.categoryId == scope.row.mainId).children : []"
|
|
|
+ v-for="item in smallList"
|
|
|
:key="item.categoryId"
|
|
|
:label="item.name"
|
|
|
:value="item.categoryId">
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
+ <div v-else>{{scope.row.smallName}}</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column align="center" label="规格型号" prop="specId" min-width="160">
|
|
@@ -209,7 +213,9 @@
|
|
|
<el-select
|
|
|
size="small"
|
|
|
v-model="scope.row.specId"
|
|
|
- placeholder="请选择">
|
|
|
+ placeholder="请选择"
|
|
|
+ @change="changeSpec(scope.$index, scope.row)"
|
|
|
+ v-if="scope.row.isEdit">
|
|
|
<el-option
|
|
|
v-for="item in specList"
|
|
|
:key="item.id"
|
|
@@ -217,6 +223,7 @@
|
|
|
:value="item.id">
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
+ <div v-else>{{scope.row.specName}}</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column align="center" label="属性" prop="attrId" min-width="160">
|
|
@@ -225,7 +232,9 @@
|
|
|
size="small"
|
|
|
v-model="scope.row.attrId"
|
|
|
multiple
|
|
|
- placeholder="请选择">
|
|
|
+ placeholder="请选择"
|
|
|
+ @change="changeAttr(scope.$index, scope.row)"
|
|
|
+ v-if="scope.row.isEdit">
|
|
|
<el-option
|
|
|
v-for="item in attrList"
|
|
|
:key="item.id"
|
|
@@ -235,6 +244,7 @@
|
|
|
{{ `${item.categoryName} - ${item.dictName}` }}
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
+ <div v-else>{{scope.row.attrName.join('、')}}</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column align="center" label="单位" min-width="120">
|
|
@@ -242,19 +252,22 @@
|
|
|
</el-table-column>
|
|
|
<el-table-column align="center" label="数量" prop="num" min-width="120">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-input size="small" v-model="scope.row.num"></el-input>
|
|
|
+ <el-input size="small" v-model="scope.row.num" v-if="scope.row.isEdit"></el-input>
|
|
|
+ <div v-else>{{scope.row.num}}</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column align="center" label="金额" prop="price" min-width="120">
|
|
|
+ <el-table-column align="center" label="金额" prop="payAmount" min-width="120">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-input size="small" v-model="scope.row.price"></el-input>
|
|
|
+ <el-input size="small" v-model="scope.row.payAmount" v-if="scope.row.isEdit"></el-input>
|
|
|
+ <div v-else>{{scope.row.payAmount}}</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
|
|
|
<el-table-column align="center" label="操作" min-width="120" fixed="right">
|
|
|
<template slot-scope="scope">
|
|
|
- <!-- <el-button type="text" @click="edit('theory', scope.$index)">编辑</el-button> -->
|
|
|
- <el-popconfirm title="确定删除吗?" @confirm="deleteOld(scope.$index)">
|
|
|
+ <el-button type="text" @click="saveOld(scope.$index, scope.row)" v-if="scope.row.isEdit">保存</el-button>
|
|
|
+ <el-button type="text" @click="editOld(scope.$index, scope.row)" v-else>编辑</el-button>
|
|
|
+ <el-popconfirm title="确定删除吗?" @confirm="deleteOld(scope.$index)" style="margin-left: 10px">
|
|
|
<el-button slot="reference" type="text">删除</el-button>
|
|
|
</el-popconfirm>
|
|
|
</template>
|
|
@@ -327,10 +340,11 @@ export default {
|
|
|
formDialogTitles: ["新增", "编辑"],
|
|
|
formDialog: false,
|
|
|
formData: {
|
|
|
+ id: '',
|
|
|
companyWechatName: '', // 所属商户
|
|
|
salesType: '', // 销售类型
|
|
|
orderId: '', // 订单编号
|
|
|
- pgOrderType: '', // 工单类型
|
|
|
+ orderSmallType: '', // 工单类型
|
|
|
pgOrderId: '', // 工单编号
|
|
|
overTime: '', // 完工时间
|
|
|
userName: '', // 客户名称
|
|
@@ -385,7 +399,8 @@ export default {
|
|
|
detailTabs: 'a',
|
|
|
|
|
|
oldList: [], // 旧机列表
|
|
|
- categoryList: [],
|
|
|
+ mainList: [],
|
|
|
+ smallList: [],
|
|
|
specList: [],
|
|
|
attrList: [],
|
|
|
|
|
@@ -500,31 +515,43 @@ export default {
|
|
|
this.formCancel()
|
|
|
this.$nextTick(()=>{
|
|
|
this.getOrderTypeList();
|
|
|
- this.getCategoryList();
|
|
|
- this.formType = type
|
|
|
- this.formVisible = true
|
|
|
+ this.formType = type;
|
|
|
+ this.formVisible = true;
|
|
|
if (type == 'add') {
|
|
|
this.formDialogType = 0
|
|
|
this.formData.companyWechatName = this.name;
|
|
|
this.getinitlbslist();
|
|
|
} else if(type == 'edit'){
|
|
|
- this.formDialogType = 1
|
|
|
+ this.formDialogType = 1;
|
|
|
getDetail({ oldManagerId: id }).then(res => {
|
|
|
- if(res.data.orderOldProductDTOList?.length > 0) {
|
|
|
- this.oldList = res.data.orderOldProductDTOList.map(item => {
|
|
|
+ const data = res.data;
|
|
|
+
|
|
|
+ this.formData = Object.keys(this.formData).reduce((result, key) => {
|
|
|
+ if (data.hasOwnProperty(key)) {
|
|
|
+ result[key] = data[key];
|
|
|
+ }else {
|
|
|
+ result[key] = this.formData[key];
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }, {});
|
|
|
+
|
|
|
+ if(data.itemList?.length > 0) {
|
|
|
+ this.oldList = data.itemList.map(item => {
|
|
|
return {
|
|
|
+ isEdit: false,
|
|
|
mainId: item.mainId,
|
|
|
+ mainName: item.mainName,
|
|
|
smallId: item.smallId,
|
|
|
+ smallName: item.smallName,
|
|
|
specId: item.specId,
|
|
|
- attrId: item.itemList.map(o => o.goodsCategoryItemId),
|
|
|
+ specName: item.specName,
|
|
|
+ attrId: item.oldProductManagerItemAttributes.map(o => o.goodsCategoryItemId),
|
|
|
+ attrName: item.oldProductManagerItemAttributes.map(o => o.dictName),
|
|
|
num: item.num,
|
|
|
- price: item.payAmount,
|
|
|
+ payAmount: item.payAmount,
|
|
|
}
|
|
|
})
|
|
|
- this.getAttrList(res.data.orderOldProductDTOList[0].smallId);
|
|
|
}
|
|
|
-
|
|
|
- Object.assign(this.formData, res.data)
|
|
|
this.getinitlbslist();
|
|
|
})
|
|
|
}
|
|
@@ -540,6 +567,7 @@ export default {
|
|
|
formCancel() {
|
|
|
this.formVisible = false
|
|
|
this.$refs?.formRef?.resetFields()
|
|
|
+ this.formData.id = '';
|
|
|
this.formData.province = '';
|
|
|
this.formData.provinceId = '';
|
|
|
this.formData.city = '';
|
|
@@ -556,18 +584,23 @@ export default {
|
|
|
formConfirm(cancel) {
|
|
|
this.$refs.formRef.validate((valid, invalidFields, errLabels) => {
|
|
|
if (valid) {
|
|
|
+ if(this.oldList.some(o => o.isEdit)) return this.$errorMsg('旧机信息存在未保存信息');
|
|
|
+
|
|
|
+ let orderSmallTypeText = this.orderTypeList.find(o => o.id == this.formData.orderSmallType).orderSmallTypeText;
|
|
|
let oldList = this.oldList.map(item => {
|
|
|
return {
|
|
|
id: item.specId,
|
|
|
itemIds: item.attrId,
|
|
|
num: item.num,
|
|
|
- payAmount: item.price
|
|
|
+ payAmount: item.payAmount
|
|
|
}
|
|
|
})
|
|
|
|
|
|
if(this.formDialogType == 0) {
|
|
|
addData({
|
|
|
...this.formData,
|
|
|
+ overTime: this.formData.overTime.length == 10 ? this.formData.overTime + ' 00:00:00' : this.formData.overTime,
|
|
|
+ orderSmallTypeText,
|
|
|
orderOldProductAdds: oldList
|
|
|
}).then(res => {
|
|
|
this.$message({ type: 'success', message: `${this.formDialogTitles[this.formDialogType]}成功!` })
|
|
@@ -577,6 +610,8 @@ export default {
|
|
|
}else {
|
|
|
editData({
|
|
|
...this.formData,
|
|
|
+ overTime: this.formData.overTime.length == 10 ? this.formData.overTime + ' 00:00:00' : this.formData.overTime,
|
|
|
+ orderSmallTypeText,
|
|
|
orderOldProductAdds: oldList
|
|
|
}).then(res => {
|
|
|
this.$message({ type: 'success', message: `${this.formDialogTitles[this.formDialogType]}成功!` })
|
|
@@ -812,7 +847,7 @@ export default {
|
|
|
ids.push(value.id)
|
|
|
})
|
|
|
outData({oldManagerId: ids.join(',')}).then(() => {
|
|
|
- this.$message({ type: 'success', message: '删除成功!' })
|
|
|
+ this.$message({ type: 'success', message: '出库成功!' })
|
|
|
this.$refs.pageRef.refreshList()
|
|
|
})
|
|
|
} else {
|
|
@@ -830,12 +865,14 @@ export default {
|
|
|
this.orderTypeList = res.data.records;
|
|
|
})
|
|
|
},
|
|
|
-
|
|
|
|
|
|
// 获取类目列表
|
|
|
getCategoryList() {
|
|
|
- getCategoryList().then(res => {
|
|
|
- this.categoryList = res.data;
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ getCategoryList().then(res => {
|
|
|
+ this.mainList = res.data;
|
|
|
+ resolve(1);
|
|
|
+ })
|
|
|
})
|
|
|
},
|
|
|
|
|
@@ -846,7 +883,7 @@ export default {
|
|
|
pageSize: -1,
|
|
|
params: [
|
|
|
{param: 'small_id', compare: '=', value: smallId},
|
|
|
- // {param: 'type_attribute', compare: '=', value: 'SPEC'}
|
|
|
+ {param: 'status', compare: '=', value: 'ON'}
|
|
|
]
|
|
|
}).then(res => {
|
|
|
this.specList = res.data.records.filter(o => o.typeAttribute == 'SPEC');
|
|
@@ -864,18 +901,52 @@ export default {
|
|
|
|
|
|
// 添加旧机
|
|
|
addOld() {
|
|
|
+ if(this.oldList.some(o => o.isEdit)) return this.$errorMsg('旧机信息存在未保存信息');
|
|
|
+
|
|
|
+ this.getCategoryList();
|
|
|
let obj = {
|
|
|
+ isEdit: true,
|
|
|
mainId: '',
|
|
|
+ mainName: '',
|
|
|
smallId: '',
|
|
|
+ smallName: '',
|
|
|
specId: '',
|
|
|
+ specName: '',
|
|
|
attrId: [],
|
|
|
+ attrName: [],
|
|
|
num: '',
|
|
|
- price: '',
|
|
|
+ payAmount: '',
|
|
|
}
|
|
|
let item = JSON.parse(JSON.stringify(obj));
|
|
|
this.oldList.push(item);
|
|
|
},
|
|
|
|
|
|
+ // 编辑旧机
|
|
|
+ async editOld(index, row) {
|
|
|
+ if(this.oldList.some(o => o.isEdit)) return this.$errorMsg('旧机信息存在未保存信息');
|
|
|
+
|
|
|
+ this.oldList[index].isEdit = true;
|
|
|
+ await this.getCategoryList();
|
|
|
+ this.smallList = this.mainList.find(o => o.categoryId == row.mainId).children;
|
|
|
+ this.getAttrList(row.smallId);
|
|
|
+ },
|
|
|
+
|
|
|
+ // 保存旧机
|
|
|
+ saveOld(index) {
|
|
|
+ const data = this.oldList[index];
|
|
|
+ if(!data.mainId) return this.$errorMsg('请选择大类');
|
|
|
+ if(!data.smallId) return this.$errorMsg('请选择小类');
|
|
|
+ if(!data.specId) return this.$errorMsg('请选择规格型号');
|
|
|
+ if(!data.num) return this.$errorMsg('请输入数量');
|
|
|
+ if(!data.payAmount) return this.$errorMsg('请输入金额');
|
|
|
+
|
|
|
+ this.oldList[index].isEdit = false;
|
|
|
+ this.mainList = [];
|
|
|
+ this.smallList = [];
|
|
|
+ this.specList = [];
|
|
|
+ this.attrList = [];
|
|
|
+ },
|
|
|
+
|
|
|
// 删除旧机
|
|
|
deleteOld(index) {
|
|
|
this.oldList.splice(index, 1);
|
|
@@ -883,6 +954,9 @@ export default {
|
|
|
|
|
|
// 切换大类
|
|
|
changeMain(index, row) {
|
|
|
+ this.oldList[index].mainName = this.mainList.find(o => o.categoryId == row.mainId).name;
|
|
|
+ this.smallList = this.mainList.find(o => o.categoryId == row.mainId).children;
|
|
|
+
|
|
|
this.oldList[index].smallId = '';
|
|
|
this.oldList[index].specId = '';
|
|
|
this.oldList[index].attrId = [];
|
|
@@ -892,6 +966,8 @@ export default {
|
|
|
|
|
|
// 切换小类
|
|
|
changeSmall(index, row) {
|
|
|
+ this.oldList[index].smallName = this.smallList.find(o => o.categoryId == row.smallId).name;
|
|
|
+
|
|
|
this.oldList[index].specId = '';
|
|
|
this.oldList[index].attrId = [];
|
|
|
this.specList = [];
|
|
@@ -899,6 +975,25 @@ export default {
|
|
|
this.getAttrList(row.smallId);
|
|
|
},
|
|
|
|
|
|
+ // 切换规格
|
|
|
+ changeSpec(index, row) {
|
|
|
+ this.oldList[index].specName = this.specList.find(o => o.id == row.specId).dictName;
|
|
|
+ },
|
|
|
+
|
|
|
+ // 切换属性
|
|
|
+ changeAttr(index, row) {
|
|
|
+ let names = [];
|
|
|
+ // 遍历对象数组
|
|
|
+ this.attrList.forEach(obj => {
|
|
|
+ // 如果当前对象的ID在ID数组中
|
|
|
+ if (row.attrId.includes(obj.id)) {
|
|
|
+ // 将当前对象的name属性添加到names数组中
|
|
|
+ names.push(obj.dictName);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ this.oldList[index].attrName = names;
|
|
|
+ },
|
|
|
+
|
|
|
}
|
|
|
|
|
|
}
|