|
|
@@ -25,6 +25,7 @@
|
|
|
style="width: 100%"
|
|
|
v-model="formData.classify"
|
|
|
placeholder="请选择"
|
|
|
+ :disabled="type == 'processEdit'"
|
|
|
>
|
|
|
<el-option
|
|
|
v-for="item in recordSheet"
|
|
|
@@ -58,7 +59,11 @@
|
|
|
<el-row style="margin-bottom: 10px">
|
|
|
<el-col :span="8">
|
|
|
<el-form-item label="记录规则名称" prop="name">
|
|
|
- <el-input v-model="formData.name" placeholder="请输入"></el-input>
|
|
|
+ <el-input
|
|
|
+ v-model="formData.name"
|
|
|
+ placeholder="请输入"
|
|
|
+ :disabled="type == 'processEdit'"
|
|
|
+ ></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
|
|
|
@@ -69,6 +74,7 @@
|
|
|
type="date"
|
|
|
placeholder="请选择启用日期"
|
|
|
style="width: 100%"
|
|
|
+ :disabled="type == 'processEdit'"
|
|
|
></el-date-picker>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
@@ -80,6 +86,7 @@
|
|
|
type="date"
|
|
|
placeholder="请选择停用日期"
|
|
|
style="width: 100%"
|
|
|
+ :disabled="type == 'processEdit'"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
@@ -105,20 +112,22 @@
|
|
|
dictName="记录规则报工类型"
|
|
|
placeholder="请选择模块"
|
|
|
:clearable="false"
|
|
|
+ :disabled="type == 'processEdit'"
|
|
|
></dict-selection>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col v-if="formData.reportWorkType == 2" :span="8">
|
|
|
<el-form-item label="关联工序">
|
|
|
<el-input
|
|
|
- v-model="formData.produceTaskConfigBatchSavePo.produceTaskName"
|
|
|
+ v-model="formData.produceTaskName"
|
|
|
@click.native="openProduceTaskDialog"
|
|
|
readonly
|
|
|
placeholder="关联工序"
|
|
|
clearable
|
|
|
+ :disabled="type == 'processEdit'"
|
|
|
>
|
|
|
<i
|
|
|
- v-if="formData.produceTaskConfigBatchSavePo.produceTaskName"
|
|
|
+ v-if="formData.produceTaskName"
|
|
|
slot="suffix"
|
|
|
class="el-input__icon el-icon-close"
|
|
|
size="24"
|
|
|
@@ -139,56 +148,6 @@
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
- <el-row
|
|
|
- v-if="
|
|
|
- formData.reportWorkType != 0 &&
|
|
|
- formData.produceTaskConfigBatchSavePo.produceTaskId
|
|
|
- "
|
|
|
- style="margin-bottom: 10px"
|
|
|
- >
|
|
|
- <el-col
|
|
|
- v-if="
|
|
|
- formData.reportWorkType == 2 &&
|
|
|
- formData.produceTaskConfigBatchSavePo.produceTaskId
|
|
|
- "
|
|
|
- :span="8"
|
|
|
- >
|
|
|
- <el-form-item
|
|
|
- label="关联产品方式"
|
|
|
- required
|
|
|
- prop="relateProductMethod"
|
|
|
- >
|
|
|
- <el-select
|
|
|
- v-model="formData.relateProductMethod"
|
|
|
- placeholder="请选择关联产品方式"
|
|
|
- style="width: 100%"
|
|
|
- >
|
|
|
- <el-option
|
|
|
- v-for="item in relateProductMethodOpeions"
|
|
|
- :key="item.value"
|
|
|
- :label="item.label"
|
|
|
- :value="item.value"
|
|
|
- >
|
|
|
- </el-option>
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
-
|
|
|
- <el-col v-if="formData.relateProductMethod == 1" :span="8">
|
|
|
- <el-form-item label="关联产品分类" required prop="categoryLevels">
|
|
|
- <ele-tree-select
|
|
|
- multiple
|
|
|
- clearable
|
|
|
- :data="productCategory"
|
|
|
- v-model="formData.categoryLevels"
|
|
|
- placeholder="请选择关联产品分类"
|
|
|
- default-expand-all
|
|
|
- labelKey="name"
|
|
|
- valueKey="id"
|
|
|
- />
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
<el-row style="margin-bottom: 10px">
|
|
|
<el-col :span="24">
|
|
|
<el-form-item label="周期" prop="frequencyValue" required>
|
|
|
@@ -196,47 +155,12 @@
|
|
|
ref="cycleMultipleRef"
|
|
|
:formData="formData"
|
|
|
:pageType="type"
|
|
|
+ :disabled="type == 'processEdit'"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
|
|
|
- <template v-if="formData.relateProductMethod == 2">
|
|
|
- <div style="margin-bottom: 20px">
|
|
|
- <header-title title="关联产品">
|
|
|
- <el-button
|
|
|
- size="mini"
|
|
|
- type="primary"
|
|
|
- icon="el-icon-plus"
|
|
|
- class="ele-btn-icon"
|
|
|
- @click="relateProductSelect"
|
|
|
- >
|
|
|
- 添加产品
|
|
|
- </el-button>
|
|
|
- </header-title>
|
|
|
-
|
|
|
- <ele-pro-table
|
|
|
- ref="productTableRef"
|
|
|
- :columns="productColumns"
|
|
|
- :datasource="formData.categories"
|
|
|
- :needPage="false"
|
|
|
- row-key="id"
|
|
|
- >
|
|
|
- <template v-slot:action="{ row }">
|
|
|
- <el-link
|
|
|
- v-if="type != 'detail'"
|
|
|
- type="danger"
|
|
|
- :underline="false"
|
|
|
- icon="el-icon-delete"
|
|
|
- @click="productColumnsDeleteRow(row)"
|
|
|
- >
|
|
|
- 删除
|
|
|
- </el-link>
|
|
|
- </template>
|
|
|
- </ele-pro-table>
|
|
|
- </div>
|
|
|
- </template>
|
|
|
-
|
|
|
<header-title title="规则明细">
|
|
|
<el-button
|
|
|
v-if="formData.isExecuteMethod"
|
|
|
@@ -284,7 +208,7 @@
|
|
|
</el-button>
|
|
|
|
|
|
<el-form-item
|
|
|
- v-if="formData.executeMethodTitle"
|
|
|
+ v-if="formData.isExecuteMethod"
|
|
|
label="编辑执行方式:"
|
|
|
label-width="110px"
|
|
|
style="margin-bottom: 0"
|
|
|
@@ -474,7 +398,7 @@
|
|
|
</el-form>
|
|
|
<template v-slot:footer>
|
|
|
<el-button
|
|
|
- v-if="type != 'detail'"
|
|
|
+ v-if="type != 'detail' && type != 'processEdit'"
|
|
|
:loading="btnLoading"
|
|
|
type="primary"
|
|
|
@click="saveAndPublish"
|
|
|
@@ -482,13 +406,21 @@
|
|
|
保存并发布
|
|
|
</el-button>
|
|
|
<el-button
|
|
|
- v-if="type != 'detail'"
|
|
|
+ v-if="type != 'detail' && type != 'processEdit'"
|
|
|
:loading="btnLoading"
|
|
|
type="primary"
|
|
|
@click="confirm"
|
|
|
>
|
|
|
保存
|
|
|
</el-button>
|
|
|
+ <el-button
|
|
|
+ v-if="type == 'processEdit'"
|
|
|
+ :loading="btnLoading"
|
|
|
+ type="primary"
|
|
|
+ @click="processEditSave"
|
|
|
+ >
|
|
|
+ 保存
|
|
|
+ </el-button>
|
|
|
<el-button :loading="btnLoading" @click="handleClose">取消</el-button>
|
|
|
</template>
|
|
|
|
|
|
@@ -507,12 +439,6 @@
|
|
|
@changeProduct="changeProduct"
|
|
|
></ProductModal>
|
|
|
|
|
|
- <ProductModalCorrelation
|
|
|
- ref="ProductModalCorrelationRef"
|
|
|
- @changeProduct="changeRelateProduct"
|
|
|
- multiple
|
|
|
- ></ProductModalCorrelation>
|
|
|
-
|
|
|
<processModal
|
|
|
ref="processModalRef"
|
|
|
@chooseProcess="processChooseProcess"
|
|
|
@@ -766,30 +692,18 @@
|
|
|
fromId: null,
|
|
|
// 模块分类 参考字典项:record_rules_report_work_type
|
|
|
reportWorkType: '1',
|
|
|
- // 关联产品方式,0-不关联,1-关联分类,2-关联产品
|
|
|
- relateProductMethod: 0,
|
|
|
- // 关联分类
|
|
|
- categoryLevels: [],
|
|
|
- // 关联产品
|
|
|
- categories: [],
|
|
|
// 执行方式
|
|
|
isExecuteMethod: 0,
|
|
|
produceTaskConfigs: [],
|
|
|
- // 关联工序
|
|
|
- produceTaskConfigBatchSavePo: {
|
|
|
- addPOs: [],
|
|
|
- deletedIds: [],
|
|
|
- produceTaskId: '',
|
|
|
- produceTaskName: '',
|
|
|
- updatePOs: []
|
|
|
- },
|
|
|
// 执行方式列表
|
|
|
executeMethodList: [],
|
|
|
// 执行方式 活跃项
|
|
|
executeMethodTitle: '',
|
|
|
bigVersion: '',
|
|
|
versionMark: '',
|
|
|
- smallVersion: ''
|
|
|
+ smallVersion: '',
|
|
|
+ produceTaskId: '',
|
|
|
+ produceTaskName: ''
|
|
|
};
|
|
|
|
|
|
return {
|
|
|
@@ -828,14 +742,6 @@
|
|
|
reportWorkType: [
|
|
|
{ required: true, message: '请选择模块分类', trigger: 'change' },
|
|
|
{ required: true, message: '请选择模块分类', trigger: 'blur' }
|
|
|
- ],
|
|
|
- categoryLevels: [
|
|
|
- {
|
|
|
- required: true,
|
|
|
- message: '请选择关联产品分类',
|
|
|
- trigger: 'change'
|
|
|
- },
|
|
|
- { required: true, message: '请选择关联产品分类', trigger: 'blur' }
|
|
|
]
|
|
|
},
|
|
|
recordSheet: [], // 记录表
|
|
|
@@ -845,11 +751,6 @@
|
|
|
btnLoading: false,
|
|
|
currentRow: null,
|
|
|
type: '',
|
|
|
- relateProductMethodOpeions: [
|
|
|
- { label: '不关联', value: 0 },
|
|
|
- // { label: '关联分类', value: 1 },
|
|
|
- { label: '关联产品', value: 2 }
|
|
|
- ],
|
|
|
// 产品分类
|
|
|
productCategory: [],
|
|
|
loading: false,
|
|
|
@@ -876,6 +777,11 @@
|
|
|
this.getDetils(row.id);
|
|
|
}
|
|
|
|
|
|
+ // 过程监测临时修改
|
|
|
+ if (type == 'processEdit') {
|
|
|
+ this.processEditSetValue(row);
|
|
|
+ }
|
|
|
+
|
|
|
if (type == 'add') {
|
|
|
this.formData.version = 1;
|
|
|
|
|
|
@@ -889,45 +795,43 @@
|
|
|
|
|
|
console.log('this.formData', this.formData);
|
|
|
},
|
|
|
+ async processEditSetValue(row) {
|
|
|
+ const data = await recordrulesGetById(row.rulesId);
|
|
|
+
|
|
|
+ const info = JSON.parse(JSON.stringify(row));
|
|
|
+ if (data.isExecuteMethod) {
|
|
|
+ data.executeMethodList = produceTaskConfigRuleDetails.map((i) => {
|
|
|
+ return i.executeMethodTitle;
|
|
|
+ });
|
|
|
+
|
|
|
+ data.details = produceTaskConfigRuleDetails;
|
|
|
+ data.executeMethodTitle = data.executeMethodList[0] || '';
|
|
|
+ } else {
|
|
|
+ data.executeMethodList = [];
|
|
|
+ data.details = info.produceTaskConfigRuleDetails || [];
|
|
|
+ data.executeMethodTitle = '';
|
|
|
+ }
|
|
|
+
|
|
|
+ this.$util.assignObject(this.formData, data);
|
|
|
+
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs.cycleMultipleRef?.setRecordRulesCycleList(
|
|
|
+ this.formData.recordRulesCycleList
|
|
|
+ );
|
|
|
+ });
|
|
|
+
|
|
|
+ this.formData.startDate = new Date(info.startDate);
|
|
|
+ this.formData.stopDate = new Date(info.stopDate);
|
|
|
+ this.formData.classify = this.formData.classify + '';
|
|
|
+ this.formData.reportWorkType = this.formData.reportWorkType + '';
|
|
|
+
|
|
|
+ this.loading = false;
|
|
|
+ },
|
|
|
async getDetils(id) {
|
|
|
this.loading = true;
|
|
|
try {
|
|
|
const data = await recordrulesGetById(id);
|
|
|
|
|
|
- if (data.relateProductMethod == 1) {
|
|
|
- data.categoryLevels = data.produceTaskConfigs
|
|
|
- .map((i) => i.categoryLevelId)
|
|
|
- .filter((i) => i != null);
|
|
|
- } else {
|
|
|
- data.categoryLevels = [];
|
|
|
- }
|
|
|
-
|
|
|
- if (data.relateProductMethod == 2) {
|
|
|
- // 产品
|
|
|
- data.categories = data.produceTaskConfigs.map((i) => {
|
|
|
- return {
|
|
|
- id: i.productId,
|
|
|
- code: i.productCode,
|
|
|
- name: i.productName,
|
|
|
- brandNum: i.brandNum,
|
|
|
- modelType: i.modelType,
|
|
|
- measuringUnit: i.measuringUnit,
|
|
|
- packingUnit: i.packingUnit
|
|
|
- };
|
|
|
- });
|
|
|
- } else {
|
|
|
- data.categories = [];
|
|
|
- }
|
|
|
-
|
|
|
- data.produceTaskConfigBatchSavePo = {
|
|
|
- addPOs: [],
|
|
|
- deletedIds: [],
|
|
|
- produceTaskId: data.produceTaskConfigs[0]?.produceTaskId,
|
|
|
- produceTaskName: data.produceTaskConfigs[0]?.produceTaskName,
|
|
|
- updatePOs: [],
|
|
|
- isTemplate: 1
|
|
|
- };
|
|
|
-
|
|
|
if (data.isExecuteMethod) {
|
|
|
data.executeMethodList = Object.keys(data.detailMap).map((i) => {
|
|
|
return i === '' ? '无执行方式' : i;
|
|
|
@@ -939,9 +843,6 @@
|
|
|
(i) => i !== '无执行方式'
|
|
|
);
|
|
|
data.executeMethodList.unshift('无执行方式');
|
|
|
- } else {
|
|
|
- // 添加一个 无执行方式
|
|
|
- data.executeMethodList.unshift('无执行方式');
|
|
|
}
|
|
|
|
|
|
data.details = Object.values(data.detailMap)
|
|
|
@@ -1046,13 +947,6 @@
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (this.formData.relateProductMethod == 2) {
|
|
|
- // 关联产品
|
|
|
- if (this.formData.categories.length == 0) {
|
|
|
- return this.$message.warning('请选择关联产品');
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
try {
|
|
|
this.btnLoading = true;
|
|
|
|
|
|
@@ -1109,13 +1003,6 @@
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (this.formData.relateProductMethod == 2) {
|
|
|
- // 关联产品
|
|
|
- if (this.formData.categories.length == 0) {
|
|
|
- return this.$message.warning('请选择关联产品');
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
// 判断参数类型是否选择
|
|
|
for (const detail of this.formData.details) {
|
|
|
if (!detail.paramType) {
|
|
|
@@ -1128,7 +1015,11 @@
|
|
|
|
|
|
const body = this.formatBody();
|
|
|
|
|
|
- await recordrulesSaveAndPublish(body);
|
|
|
+ if (this.type != 'saveAndPublish') {
|
|
|
+ await recordrulesSaveAndPublish(body);
|
|
|
+ } else {
|
|
|
+ this.$emit('processSave', body);
|
|
|
+ }
|
|
|
|
|
|
this.btnLoading = false;
|
|
|
this.$message.success('操作成功');
|
|
|
@@ -1170,13 +1061,6 @@
|
|
|
|
|
|
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,
|
|
|
'yyyy-MM-dd HH:mm:ss'
|
|
|
@@ -1187,180 +1071,6 @@
|
|
|
'yyyy-MM-dd HH:mm:ss'
|
|
|
);
|
|
|
|
|
|
- if (this.type == 'edit') {
|
|
|
- if (body.produceTaskConfigBatchSavePo.produceTaskId) {
|
|
|
- // 修改工序
|
|
|
- if (body.relateProductMethod == 1) {
|
|
|
- // 分类
|
|
|
- body.categoryLevels.forEach((categoryId) => {
|
|
|
- // 判断是否已经存在
|
|
|
- const exist = body.produceTaskConfigs.find(
|
|
|
- (i) => i.categoryLevelId == categoryId
|
|
|
- );
|
|
|
-
|
|
|
- if (!exist) {
|
|
|
- body.produceTaskConfigBatchSavePo.addPOs.push({
|
|
|
- executeMethod: 2,
|
|
|
- itemType: 1,
|
|
|
- produceTaskId:
|
|
|
- body.produceTaskConfigBatchSavePo.produceTaskId,
|
|
|
- produceTaskName:
|
|
|
- body.produceTaskConfigBatchSavePo.produceTaskName,
|
|
|
- categoryLevelId: categoryId,
|
|
|
- reportWorkType: this.formData.reportWorkType,
|
|
|
- isTemplate: 1
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
- // 删除取消的分类
|
|
|
- body.produceTaskConfigs.forEach((config) => {
|
|
|
- if (
|
|
|
- !body.categoryLevels.includes(config.categoryLevelId) &&
|
|
|
- config.id
|
|
|
- ) {
|
|
|
- body.produceTaskConfigBatchSavePo.deletedIds.push(config.id);
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- if (body.relateProductMethod == 2) {
|
|
|
- // 产品
|
|
|
- body.categories.forEach((product) => {
|
|
|
- // 判断是否已经存在
|
|
|
- const exist = body.produceTaskConfigs.find(
|
|
|
- (i) => i.productId == product.id
|
|
|
- );
|
|
|
- if (!exist) {
|
|
|
- body.produceTaskConfigBatchSavePo.addPOs.push({
|
|
|
- executeMethod: 2,
|
|
|
- itemType: 2,
|
|
|
- produceTaskId:
|
|
|
- body.produceTaskConfigBatchSavePo.produceTaskId,
|
|
|
- produceTaskName:
|
|
|
- body.produceTaskConfigBatchSavePo.produceTaskName,
|
|
|
- productCode: product.code,
|
|
|
- productId: product.id || product.productId,
|
|
|
- productName: product.name || product.productName,
|
|
|
- reportWorkType: this.formData.reportWorkType,
|
|
|
- isTemplate: 1
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
- // 删除取消的产品
|
|
|
- body.produceTaskConfigs.forEach((config) => {
|
|
|
- const exist = body.categories.find((product) => {
|
|
|
- return product.id == config.productId;
|
|
|
- });
|
|
|
-
|
|
|
- if (!exist && config.id) {
|
|
|
- body.produceTaskConfigBatchSavePo.deletedIds.push(config.id);
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- 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,
|
|
|
- isTemplate: 1
|
|
|
- });
|
|
|
- } 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,
|
|
|
- isTemplate: 1
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- // 删除工序 全删
|
|
|
- body.produceTaskConfigBatchSavePo.deletedIds =
|
|
|
- this.formData.produceTaskConfigs.map((i) => i.id);
|
|
|
- }
|
|
|
- } else {
|
|
|
- // 新增工序
|
|
|
- if (
|
|
|
- body.reportWorkType != 0 &&
|
|
|
- body.produceTaskConfigBatchSavePo.produceTaskId
|
|
|
- ) {
|
|
|
- if (body.relateProductMethod == 1) {
|
|
|
- // 分类
|
|
|
- body.categoryLevels.forEach((categoryId) => {
|
|
|
- body.produceTaskConfigBatchSavePo.addPOs.push({
|
|
|
- executeMethod: 2,
|
|
|
- itemType: 1,
|
|
|
- produceTaskId:
|
|
|
- body.produceTaskConfigBatchSavePo.produceTaskId,
|
|
|
- produceTaskName:
|
|
|
- body.produceTaskConfigBatchSavePo.produceTaskName,
|
|
|
- categoryLevelId: categoryId,
|
|
|
- reportWorkType: this.formData.reportWorkType,
|
|
|
- isTemplate: 1
|
|
|
- });
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- if (body.relateProductMethod == 2) {
|
|
|
- // 产品
|
|
|
- body.categories.forEach((product) => {
|
|
|
- body.produceTaskConfigBatchSavePo.addPOs.push({
|
|
|
- executeMethod: 2,
|
|
|
- itemType: 2,
|
|
|
- produceTaskId:
|
|
|
- body.produceTaskConfigBatchSavePo.produceTaskId,
|
|
|
- produceTaskName:
|
|
|
- body.produceTaskConfigBatchSavePo.produceTaskName,
|
|
|
- productCode: product.code,
|
|
|
- productId: product.id || product.productId,
|
|
|
- productName: product.name || product.productName,
|
|
|
- reportWorkType: this.formData.reportWorkType,
|
|
|
- isTemplate: 1
|
|
|
- });
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- if (body.relateProductMethod == 0) {
|
|
|
- // 不关联
|
|
|
- body.produceTaskConfigBatchSavePo.addPOs.push({
|
|
|
- executeMethod: 2,
|
|
|
- itemType: 2,
|
|
|
- produceTaskId: body.produceTaskConfigBatchSavePo.produceTaskId,
|
|
|
- produceTaskName:
|
|
|
- body.produceTaskConfigBatchSavePo.produceTaskName,
|
|
|
- reportWorkType: this.formData.reportWorkType,
|
|
|
- isTemplate: 1
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- body.produceTaskConfigBatchSavePo.updatePOs = [];
|
|
|
- }
|
|
|
-
|
|
|
return body;
|
|
|
},
|
|
|
// startDate 启用日期要大于当前时间
|
|
|
@@ -1428,12 +1138,6 @@
|
|
|
this.formData.details.splice(index, 1);
|
|
|
}
|
|
|
},
|
|
|
- // 删除关联产品
|
|
|
- productColumnsDeleteRow(row) {
|
|
|
- this.formData.categories = this.formData.categories.filter((i) => {
|
|
|
- return i.id !== row.id;
|
|
|
- });
|
|
|
- },
|
|
|
handleAdd(row) {
|
|
|
this.currentRow = row;
|
|
|
this.$refs.toolModalRef.open(row.toolCodes);
|
|
|
@@ -1505,27 +1209,6 @@
|
|
|
row.productName = '';
|
|
|
row.productCode = '';
|
|
|
},
|
|
|
- // 关联产品
|
|
|
- async relateProductSelect() {
|
|
|
- // 查询工序详情
|
|
|
- const productTaskInfo = await productionAPI.getById(
|
|
|
- this.formData.produceTaskConfigBatchSavePo.produceTaskId
|
|
|
- );
|
|
|
- console.log('productTaskInfo', productTaskInfo);
|
|
|
- this.$refs.ProductModalCorrelationRef.open([], productTaskInfo.code);
|
|
|
- },
|
|
|
- changeRelateProduct(array) {
|
|
|
- console.log('this.formData.categories ', array);
|
|
|
-
|
|
|
- const productList = array.filter(
|
|
|
- (i) => !this.formData.categories.some((cat) => cat.id === i.id)
|
|
|
- );
|
|
|
-
|
|
|
- this.formData.categories = [
|
|
|
- ...this.formData.categories,
|
|
|
- ...productList
|
|
|
- ];
|
|
|
- },
|
|
|
// 获取产品分类
|
|
|
async getProductCategory() {
|
|
|
let { data } = await getTreeByPid(9);
|
|
|
@@ -1539,9 +1222,8 @@
|
|
|
// 工序
|
|
|
processChooseProcess(process) {
|
|
|
console.log('选择的工序', process);
|
|
|
- this.formData.produceTaskConfigBatchSavePo.produceTaskId = process.id;
|
|
|
- this.formData.produceTaskConfigBatchSavePo.produceTaskName =
|
|
|
- process.name;
|
|
|
+ this.formData.produceTaskId = process.id;
|
|
|
+ this.formData.produceTaskName = process.name;
|
|
|
},
|
|
|
// 添加执行方式
|
|
|
addExecuteMethod() {
|
|
|
@@ -1602,11 +1284,45 @@
|
|
|
}
|
|
|
},
|
|
|
clearProductTask() {
|
|
|
- this.formData.produceTaskConfigBatchSavePo.produceTaskId = '';
|
|
|
- this.formData.produceTaskConfigBatchSavePo.produceTaskName = '';
|
|
|
- this.formData.relateProductMethod = 0;
|
|
|
- this.formData.categoryLevels = [];
|
|
|
- this.formData.categories = [];
|
|
|
+ this.formData.produceTaskId = '';
|
|
|
+ this.formData.produceTaskName = '';
|
|
|
+ },
|
|
|
+ // 过程监测修改 保存
|
|
|
+ processEditSave() {
|
|
|
+ // 只验证详情内容
|
|
|
+ if (this.formData.details.length == 0) {
|
|
|
+ return this.$message.warning('至少条件一条规则项');
|
|
|
+ }
|
|
|
+
|
|
|
+ if (this.formData.isExecuteMethod) {
|
|
|
+ // 判断 formData.executeMethodList中的item 是否在details中有一条executeMethodTitle的数据
|
|
|
+
|
|
|
+ if (this.formData.executeMethodList.length == 0) {
|
|
|
+ return this.$message.warning(`请添加执行方式`);
|
|
|
+ }
|
|
|
+
|
|
|
+ for (const item of this.formData.executeMethodList) {
|
|
|
+ const exists = this.formData.details.some(
|
|
|
+ (detail) => detail.executeMethodTitle === item
|
|
|
+ );
|
|
|
+ if (!exists) {
|
|
|
+ this.$message.warning(
|
|
|
+ `请为执行方式 "${item}" 添加至少一条规则项`
|
|
|
+ );
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 判断参数类型是否选择
|
|
|
+ for (const detail of this.formData.details) {
|
|
|
+ if (!detail.paramType) {
|
|
|
+ return this.$message.warning('请选择规则明细中的参数类型!');
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ this.$emit('processSave', this.formatBody());
|
|
|
+ this.handleClose();
|
|
|
}
|
|
|
}
|
|
|
};
|