|
|
@@ -236,39 +236,40 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
- <header-title v-if="formData.isExecuteMethod" title="执行方式">
|
|
|
- <el-button type="primary" @click="addExecuteMethod"
|
|
|
+ <header-title title="规则明细">
|
|
|
+ <el-button
|
|
|
+ v-if="formData.isExecuteMethod"
|
|
|
+ type="primary"
|
|
|
+ @click="addExecuteMethod"
|
|
|
>添加执行方式</el-button
|
|
|
>
|
|
|
</header-title>
|
|
|
|
|
|
- <div v-if="formData.isExecuteMethod" class="executeMethodlist">
|
|
|
- <div
|
|
|
- class="executeMethodItem"
|
|
|
- v-for="i in formData.executeMethodList"
|
|
|
- :key="i"
|
|
|
- :class="{
|
|
|
- executeMethodItemActive: i == formData.executeMethodTitle
|
|
|
- }"
|
|
|
- @click="formData.executeMethodTitle = i"
|
|
|
+ <el-tabs
|
|
|
+ v-if="formData.isExecuteMethod"
|
|
|
+ v-model="formData.executeMethodTitle"
|
|
|
+ type="card"
|
|
|
+ closable
|
|
|
+ @tab-remove="deleteExecuteMethod"
|
|
|
+ >
|
|
|
+ <el-tab-pane
|
|
|
+ :key="item"
|
|
|
+ v-for="item in formData.executeMethodList"
|
|
|
+ :label="item"
|
|
|
+ :name="item"
|
|
|
>
|
|
|
- <span> {{ i }}</span>
|
|
|
- <i
|
|
|
- class="el-icon-error"
|
|
|
- size="24"
|
|
|
- @click="deleteExecuteMethod(i)"
|
|
|
- ></i>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
+ {{ item.content }}
|
|
|
+ </el-tab-pane>
|
|
|
+ </el-tabs>
|
|
|
|
|
|
- <header-title title="规则明细"></header-title>
|
|
|
<ele-pro-table
|
|
|
ref="table"
|
|
|
:columns="bankColumns"
|
|
|
- :datasource="formData.details"
|
|
|
+ :datasource="detailsList"
|
|
|
:need-page="false"
|
|
|
row-key="id"
|
|
|
class="table_list"
|
|
|
+ :cache-key="cacheKeyUrl"
|
|
|
>
|
|
|
<template v-slot:toolbar>
|
|
|
<el-button
|
|
|
@@ -323,6 +324,9 @@
|
|
|
v-model="row.paramValue"
|
|
|
placeholder="请输入参数内容"
|
|
|
size="mini"
|
|
|
+ type="textarea"
|
|
|
+ rows="1"
|
|
|
+ autosize
|
|
|
></el-input>
|
|
|
</template>
|
|
|
<template v-slot:defaultValue="{ row }">
|
|
|
@@ -431,6 +435,18 @@
|
|
|
size="mini"
|
|
|
></el-input>
|
|
|
</template>
|
|
|
+
|
|
|
+ <template v-slot:executeMethodTitle="{ row }">
|
|
|
+ <el-select v-model="row.executeMethodTitle" clearable size="mini">
|
|
|
+ <el-option
|
|
|
+ v-for="item in formData.executeMethodList"
|
|
|
+ :key="item"
|
|
|
+ :label="item"
|
|
|
+ :value="item"
|
|
|
+ ></el-option>
|
|
|
+ </el-select>
|
|
|
+ </template>
|
|
|
+
|
|
|
<template v-slot:action="{ row }">
|
|
|
<el-link
|
|
|
type="danger"
|
|
|
@@ -535,12 +551,6 @@
|
|
|
align: 'center',
|
|
|
label: '序号'
|
|
|
},
|
|
|
- // {
|
|
|
- // prop: 'executeMethodTitle',
|
|
|
- // label: '执行方式',
|
|
|
- // align: 'center',
|
|
|
- // minWidth: 110
|
|
|
- // },
|
|
|
{
|
|
|
prop: 'paramType',
|
|
|
label: '参数类型',
|
|
|
@@ -553,7 +563,7 @@
|
|
|
label: '参数内容',
|
|
|
align: 'center',
|
|
|
slot: 'paramValue',
|
|
|
- minWidth: 180
|
|
|
+ minWidth: 261
|
|
|
},
|
|
|
{
|
|
|
prop: 'defaultValue',
|
|
|
@@ -604,6 +614,13 @@
|
|
|
slot: 'remark',
|
|
|
minWidth: 110
|
|
|
},
|
|
|
+ {
|
|
|
+ prop: 'executeMethodTitle',
|
|
|
+ label: '执行方式',
|
|
|
+ align: 'center',
|
|
|
+ slot: 'executeMethodTitle',
|
|
|
+ minWidth: 180
|
|
|
+ },
|
|
|
{
|
|
|
columnKey: 'action',
|
|
|
label: '操作',
|
|
|
@@ -669,6 +686,18 @@
|
|
|
fixed: 'right'
|
|
|
}
|
|
|
];
|
|
|
+ },
|
|
|
+ cacheKeyUrl() {
|
|
|
+ return `main-permit-add-2510181429-reportWorkType`;
|
|
|
+ },
|
|
|
+ detailsList() {
|
|
|
+ if (this.formData.isExecuteMethod) {
|
|
|
+ return this.formData.details.filter(
|
|
|
+ (i) => i.executeMethodTitle == this.formData.executeMethodTitle
|
|
|
+ );
|
|
|
+ } else {
|
|
|
+ return this.formData.details;
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
data() {
|
|
|
@@ -849,8 +878,29 @@
|
|
|
};
|
|
|
|
|
|
if (data.isExecuteMethod) {
|
|
|
- data.executeMethodList = Object.keys(data.detailMap);
|
|
|
- data.details = Object.values(data.detailMap).flat();
|
|
|
+ data.executeMethodList = Object.keys(data.detailMap).map((i) => {
|
|
|
+ return i === '' ? '无执行方式' : i;
|
|
|
+ });
|
|
|
+
|
|
|
+ if (data.executeMethodList.includes('无执行方式')) {
|
|
|
+ // 将无执行方式 放到第一个
|
|
|
+ data.executeMethodList = data.executeMethodList.filter(
|
|
|
+ (i) => i !== '无执行方式'
|
|
|
+ );
|
|
|
+ data.executeMethodList.unshift('无执行方式');
|
|
|
+ } else {
|
|
|
+ // 添加一个 无执行方式
|
|
|
+ data.executeMethodList.unshift('无执行方式');
|
|
|
+ }
|
|
|
+
|
|
|
+ data.details = Object.values(data.detailMap)
|
|
|
+ .flat()
|
|
|
+ .map((i) => {
|
|
|
+ if (i.executeMethodTitle == '') {
|
|
|
+ i.executeMethodTitle = '无执行方式';
|
|
|
+ }
|
|
|
+ return i;
|
|
|
+ });
|
|
|
data.executeMethodTitle = data.executeMethodList[0] || '';
|
|
|
} else {
|
|
|
data.executeMethodList = [];
|
|
|
@@ -940,7 +990,7 @@
|
|
|
}
|
|
|
|
|
|
if (this.formData.relateProductMethod == 2) {
|
|
|
- // 关联分类
|
|
|
+ // 关联产品
|
|
|
if (this.formData.categories.length == 0) {
|
|
|
return this.$message.warning('请选择关联产品');
|
|
|
}
|
|
|
@@ -1003,7 +1053,7 @@
|
|
|
}
|
|
|
|
|
|
if (this.formData.relateProductMethod == 2) {
|
|
|
- // 关联分类
|
|
|
+ // 关联产品
|
|
|
if (this.formData.categories.length == 0) {
|
|
|
return this.$message.warning('请选择关联产品');
|
|
|
}
|
|
|
@@ -1054,7 +1104,14 @@
|
|
|
return { ...i, sortNum: index + 1 };
|
|
|
});
|
|
|
|
|
|
- const body = { ...this.formData };
|
|
|
+ const body = JSON.parse(JSON.stringify(this.formData));
|
|
|
+
|
|
|
+ body.details = body.details.map((i) => {
|
|
|
+ if (i.executeMethodTitle == '无执行方式') {
|
|
|
+ i.executeMethodTitle = '';
|
|
|
+ }
|
|
|
+ return i;
|
|
|
+ });
|
|
|
|
|
|
body.startDate = this.$util.toDateString(
|
|
|
body.startDate,
|
|
|
@@ -1069,9 +1126,7 @@
|
|
|
if (this.type == 'edit') {
|
|
|
if (body.produceTaskConfigBatchSavePo.produceTaskId) {
|
|
|
// 修改工序
|
|
|
-
|
|
|
if (body.relateProductMethod == 1) {
|
|
|
- debugger;
|
|
|
// 分类
|
|
|
body.categoryLevels.forEach((categoryId) => {
|
|
|
// 判断是否已经存在
|
|
|
@@ -1138,6 +1193,42 @@
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
+
|
|
|
+ if (body.relateProductMethod == 0) {
|
|
|
+ // 不关联产品 但存在工序
|
|
|
+ // 判断是否已经存在
|
|
|
+ const item = body.produceTaskConfigs.find(
|
|
|
+ (i) =>
|
|
|
+ i.produceTaskId ==
|
|
|
+ body.produceTaskConfigBatchSavePo.produceTaskId
|
|
|
+ );
|
|
|
+
|
|
|
+ if (item) {
|
|
|
+ // 修改
|
|
|
+ body.produceTaskConfigBatchSavePo.updatePOs.push({
|
|
|
+ ...item,
|
|
|
+ produceTaskId:
|
|
|
+ body.produceTaskConfigBatchSavePo.produceTaskId,
|
|
|
+ produceTaskName:
|
|
|
+ body.produceTaskConfigBatchSavePo.produceTaskName,
|
|
|
+ reportWorkType: this.formData.reportWorkType
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ // 新增
|
|
|
+ body.produceTaskConfigBatchSavePo.deletedIds =
|
|
|
+ this.formData.produceTaskConfigs.map((i) => i.id);
|
|
|
+
|
|
|
+ body.produceTaskConfigBatchSavePo.addPOs.push({
|
|
|
+ executeMethod: 2,
|
|
|
+ itemType: 2,
|
|
|
+ produceTaskId:
|
|
|
+ body.produceTaskConfigBatchSavePo.produceTaskId,
|
|
|
+ produceTaskName:
|
|
|
+ body.produceTaskConfigBatchSavePo.produceTaskName,
|
|
|
+ reportWorkType: this.formData.reportWorkType
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
} else {
|
|
|
// 删除工序 全删
|
|
|
body.produceTaskConfigBatchSavePo.deletedIds =
|
|
|
@@ -1182,6 +1273,18 @@
|
|
|
});
|
|
|
});
|
|
|
}
|
|
|
+
|
|
|
+ if (body.relateProductMethod == 0) {
|
|
|
+ // 不关联
|
|
|
+ body.produceTaskConfigBatchSavePo.addPOs.push({
|
|
|
+ executeMethod: 2,
|
|
|
+ itemType: 2,
|
|
|
+ produceTaskId: body.produceTaskConfigBatchSavePo.produceTaskId,
|
|
|
+ produceTaskName:
|
|
|
+ body.produceTaskConfigBatchSavePo.produceTaskName,
|
|
|
+ reportWorkType: this.formData.reportWorkType
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
body.produceTaskConfigBatchSavePo.updatePOs = [];
|
|
|
@@ -1231,13 +1334,6 @@
|
|
|
},
|
|
|
// 添加
|
|
|
addRow() {
|
|
|
- if (
|
|
|
- this.formData.isExecuteMethod &&
|
|
|
- !this.formData.executeMethodTitle
|
|
|
- ) {
|
|
|
- return this.$message.warning('请先选择执行方式');
|
|
|
- }
|
|
|
-
|
|
|
this.formData.details.push({
|
|
|
id: new Date().getTime(),
|
|
|
defaultValue: '',
|
|
|
@@ -1253,6 +1349,7 @@
|
|
|
productCode: '',
|
|
|
executeMethodTitle: this.formData.executeMethodTitle
|
|
|
});
|
|
|
+ console.log('this.formData.details', this.formData.details);
|
|
|
},
|
|
|
deleteRow(row) {
|
|
|
const index = this.formData.details.indexOf(row);
|
|
|
@@ -1353,7 +1450,7 @@
|
|
|
...productList
|
|
|
];
|
|
|
},
|
|
|
- /// 获取产品分类
|
|
|
+ // 获取产品分类
|
|
|
async getProductCategory() {
|
|
|
let { data } = await getTreeByPid(9);
|
|
|
console.log('产品分类', data);
|
|
|
@@ -1418,9 +1515,23 @@
|
|
|
this.formData.details = this.formData.details.map((i) => {
|
|
|
return {
|
|
|
...i,
|
|
|
- executeMethodTitle: ''
|
|
|
+ executeMethodTitle: '无执行方式'
|
|
|
};
|
|
|
});
|
|
|
+ } else {
|
|
|
+ if (this.formData.executeMethodList.length == 0) {
|
|
|
+ // 添加一个默认执行方式
|
|
|
+ this.formData.executeMethodList.push('无执行方式');
|
|
|
+
|
|
|
+ this.formData.details = this.formData.details.map((i) => {
|
|
|
+ return {
|
|
|
+ ...i,
|
|
|
+ executeMethodTitle: '无执行方式'
|
|
|
+ };
|
|
|
+ });
|
|
|
+
|
|
|
+ this.formData.executeMethodTitle = '无执行方式';
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
clearProductTask() {
|
|
|
@@ -1480,28 +1591,4 @@
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- .executeMethodlist {
|
|
|
- display: flex;
|
|
|
- flex-flow: row wrap;
|
|
|
- margin-bottom: 20px;
|
|
|
- gap: 20px;
|
|
|
-
|
|
|
- .executeMethodItem {
|
|
|
- border: 1px solid #333;
|
|
|
- padding: 10px 10px;
|
|
|
- display: flex;
|
|
|
- gap: 4px;
|
|
|
- align-items: center;
|
|
|
- justify-content: space-between;
|
|
|
- background: #fff;
|
|
|
- cursor: pointer;
|
|
|
-
|
|
|
- &Active {
|
|
|
- border-color: #409eff;
|
|
|
- background: #409eff;
|
|
|
- color: #fff;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
</style>
|