|
|
@@ -142,7 +142,7 @@
|
|
|
<el-form-item label="是否有执行方式" label-width="130px">
|
|
|
<el-radio-group
|
|
|
v-model="formData.isExecuteMethod"
|
|
|
- @change="executeMethodChange"
|
|
|
+ @change="isExecuteMethodChange"
|
|
|
>
|
|
|
<el-radio :label="1">是</el-radio>
|
|
|
<el-radio :label="0">否</el-radio>
|
|
|
@@ -150,6 +150,30 @@
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
+ <el-row
|
|
|
+ v-if="formData.isExecuteMethod == 1 && formData.reportWorkType == 2"
|
|
|
+ style="margin-bottom: 15px"
|
|
|
+ >
|
|
|
+ <el-col v-if="formData.isExecuteMethod == 1" :span="8">
|
|
|
+ <el-form-item label="执行方式" required prop="executeMethodId">
|
|
|
+ <el-select
|
|
|
+ v-model="formData.executeMethodId"
|
|
|
+ filterable
|
|
|
+ placeholder="请选择"
|
|
|
+ style="width: 100%"
|
|
|
+ @change="executeMethodIdChange"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in executeMethodList"
|
|
|
+ :key="item.id"
|
|
|
+ :label="item.name"
|
|
|
+ :value="item.id"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
<el-row style="margin-bottom: 15px">
|
|
|
<el-col :span="24">
|
|
|
<el-form-item label="周期" prop="frequencyValue" required>
|
|
|
@@ -163,36 +187,12 @@
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
|
|
|
- <header-title title="规则明细">
|
|
|
- <el-button
|
|
|
- v-if="formData.isExecuteMethod"
|
|
|
- type="primary"
|
|
|
- @click="addExecuteMethod"
|
|
|
- >添加执行方式</el-button
|
|
|
- >
|
|
|
- </header-title>
|
|
|
-
|
|
|
- <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"
|
|
|
- >
|
|
|
- {{ item.content }}
|
|
|
- </el-tab-pane>
|
|
|
- </el-tabs>
|
|
|
+ <header-title title="规则明细"> </header-title>
|
|
|
|
|
|
<ele-pro-table
|
|
|
ref="table"
|
|
|
:columns="bankColumns"
|
|
|
- :datasource="detailsList"
|
|
|
+ :datasource="formData.details"
|
|
|
:need-page="false"
|
|
|
row-key="id"
|
|
|
class="table_list"
|
|
|
@@ -208,15 +208,6 @@
|
|
|
>
|
|
|
新建
|
|
|
</el-button>
|
|
|
-
|
|
|
- <el-form-item
|
|
|
- v-if="formData.isExecuteMethod"
|
|
|
- label="编辑执行方式:"
|
|
|
- label-width="110px"
|
|
|
- style="margin-bottom: 0"
|
|
|
- >
|
|
|
- <el-input type="text" v-model="executeMethodTitleComputed" />
|
|
|
- </el-form-item>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
@@ -373,18 +364,6 @@
|
|
|
></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> -->
|
|
|
- {{ row.executeMethodTitle }}
|
|
|
- </template>
|
|
|
-
|
|
|
<template v-slot:action="{ row }">
|
|
|
<el-link
|
|
|
v-if="type != 'detail'"
|
|
|
@@ -471,7 +450,7 @@
|
|
|
import { getTreeByPid } from '@/api/classifyManage';
|
|
|
import processModal from './processModal.vue';
|
|
|
import ProductModalCorrelation from './ProductModal.vue';
|
|
|
- import productionAPI from '@/api/technology/production/index.js';
|
|
|
+ import { recordrulesexecutemethodPage } from '@/api/recordrulesexecutemethod/index';
|
|
|
|
|
|
export default {
|
|
|
components: {
|
|
|
@@ -558,13 +537,6 @@
|
|
|
slot: 'remark',
|
|
|
minWidth: 110
|
|
|
},
|
|
|
- {
|
|
|
- prop: 'executeMethodTitle',
|
|
|
- label: '执行方式',
|
|
|
- align: 'center',
|
|
|
- slot: 'executeMethodTitle',
|
|
|
- minWidth: 110
|
|
|
- },
|
|
|
{
|
|
|
columnKey: 'action',
|
|
|
label: '操作',
|
|
|
@@ -637,47 +609,6 @@
|
|
|
},
|
|
|
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;
|
|
|
- }
|
|
|
- },
|
|
|
- executeMethodTitleComputed: {
|
|
|
- get() {
|
|
|
- return this.formData.executeMethodTitle;
|
|
|
- },
|
|
|
- set(value) {
|
|
|
- // 更改 明细表的 executeMethodTitle
|
|
|
- this.formData.details = this.formData.details.map((i) => {
|
|
|
- if (i.executeMethodTitle == this.formData.executeMethodTitle) {
|
|
|
- return {
|
|
|
- ...i,
|
|
|
- executeMethodTitle: value
|
|
|
- };
|
|
|
- }
|
|
|
- return i;
|
|
|
- });
|
|
|
-
|
|
|
- this.formData.executeMethodList = this.formData.executeMethodList.map(
|
|
|
- (i) => {
|
|
|
- if (i == this.formData.executeMethodTitle) {
|
|
|
- return value;
|
|
|
- }
|
|
|
- return i;
|
|
|
- }
|
|
|
- );
|
|
|
-
|
|
|
- this.formData.executeMethodTitle = value;
|
|
|
-
|
|
|
- if (!value) {
|
|
|
- this.$message.warning('执行方式不能为空!');
|
|
|
- }
|
|
|
- }
|
|
|
}
|
|
|
},
|
|
|
data() {
|
|
|
@@ -700,11 +631,9 @@
|
|
|
reportWorkType: '1',
|
|
|
// 执行方式
|
|
|
isExecuteMethod: 0,
|
|
|
+ executeMethodId: null,
|
|
|
+ executeMethodName: '',
|
|
|
produceTaskConfigs: [],
|
|
|
- // 执行方式列表
|
|
|
- executeMethodList: [],
|
|
|
- // 执行方式 活跃项
|
|
|
- executeMethodTitle: '',
|
|
|
bigVersion: '',
|
|
|
versionMark: '',
|
|
|
smallVersion: '',
|
|
|
@@ -748,6 +677,10 @@
|
|
|
reportWorkType: [
|
|
|
{ required: true, message: '请选择模块分类', trigger: 'change' },
|
|
|
{ required: true, message: '请选择模块分类', trigger: 'blur' }
|
|
|
+ ],
|
|
|
+ executeMethodId: [
|
|
|
+ { required: true, message: '请选择执行方式', trigger: 'change' },
|
|
|
+ { required: true, message: '请选择执行方式', trigger: 'blur' }
|
|
|
]
|
|
|
},
|
|
|
recordSheet: [], // 记录表
|
|
|
@@ -760,7 +693,9 @@
|
|
|
// 产品分类
|
|
|
productCategory: [],
|
|
|
loading: false,
|
|
|
- produceTaskCode: ''
|
|
|
+ produceTaskCode: '',
|
|
|
+ // 执行方式列表
|
|
|
+ executeMethodList: []
|
|
|
};
|
|
|
},
|
|
|
mounted() {
|
|
|
@@ -806,25 +741,10 @@
|
|
|
const data = await recordrulesGetById(row.rulesId);
|
|
|
|
|
|
const info = JSON.parse(JSON.stringify(row));
|
|
|
- data.executeMethodList = info.produceTaskConfigRuleDetails.map((i) => {
|
|
|
- return i.executeMethodTitle;
|
|
|
- });
|
|
|
- // 去重
|
|
|
- data.executeMethodList = [...new Set(data.executeMethodList)].filter(
|
|
|
- (i) => i
|
|
|
- );
|
|
|
|
|
|
data.details = info.produceTaskConfigRuleDetails;
|
|
|
- if (data.executeMethodList.length) {
|
|
|
- data.executeMethodTitle = data.executeMethodList[0] || '';
|
|
|
- } else {
|
|
|
- data.executeMethodTitle = '';
|
|
|
- }
|
|
|
|
|
|
this.$util.assignObject(this.formData, data);
|
|
|
- if (data.executeMethodList.length) {
|
|
|
- this.formData.isExecuteMethod = 1;
|
|
|
- }
|
|
|
|
|
|
this.$nextTick(() => {
|
|
|
this.$refs.cycleMultipleRef?.setRecordRulesCycleList(
|
|
|
@@ -832,11 +752,15 @@
|
|
|
);
|
|
|
});
|
|
|
|
|
|
+ this.formData.executeMethodId = info.recordRulesExecuteMethodId;
|
|
|
+ this.formData.executeMethodName = info.recordRulesExecuteMethodName;
|
|
|
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.getExecuteMethodList();
|
|
|
+
|
|
|
this.loading = false;
|
|
|
},
|
|
|
async getDetils(id) {
|
|
|
@@ -844,19 +768,6 @@
|
|
|
try {
|
|
|
const data = await recordrulesGetById(id);
|
|
|
|
|
|
- if (data.isExecuteMethod) {
|
|
|
- data.executeMethodList = Object.keys(data.detailMap).map((i) => {
|
|
|
- return i;
|
|
|
- });
|
|
|
-
|
|
|
- data.details = Object.values(data.detailMap).flat();
|
|
|
- data.executeMethodTitle = data.executeMethodList[0] || '';
|
|
|
- } else {
|
|
|
- data.executeMethodList = [];
|
|
|
- data.details = data.details || [];
|
|
|
- data.executeMethodTitle = '';
|
|
|
- }
|
|
|
-
|
|
|
this.$util.assignObject(this.formData, data);
|
|
|
|
|
|
this.$nextTick(() => {
|
|
|
@@ -880,8 +791,12 @@
|
|
|
this.formData.id = null;
|
|
|
this.formData.produceTaskId = null;
|
|
|
this.formData.produceTaskName = null;
|
|
|
+ this.formData.executeMethodId = null;
|
|
|
+ this.formData.executeMethodName = '';
|
|
|
}
|
|
|
|
|
|
+ this.getExecuteMethodList();
|
|
|
+
|
|
|
this.loading = false;
|
|
|
} catch (error) {
|
|
|
this.loading = false;
|
|
|
@@ -924,30 +839,6 @@
|
|
|
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) {
|
|
|
- if (!item) {
|
|
|
- return this.$message.warning(`执行方式不能为空!`);
|
|
|
- }
|
|
|
-
|
|
|
- const exists = this.formData.details.some(
|
|
|
- (detail) => detail.executeMethodTitle === item
|
|
|
- );
|
|
|
- if (!exists) {
|
|
|
- this.$message.warning(
|
|
|
- `请为执行方式 "${item}" 添加至少一条规则项`
|
|
|
- );
|
|
|
- return false;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
try {
|
|
|
this.btnLoading = true;
|
|
|
|
|
|
@@ -984,30 +875,6 @@
|
|
|
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) {
|
|
|
- if (!item) {
|
|
|
- return this.$message.warning(`执行方式不能为空!`);
|
|
|
- }
|
|
|
-
|
|
|
- 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) {
|
|
|
@@ -1132,8 +999,7 @@
|
|
|
tools: [],
|
|
|
unitName: null,
|
|
|
productName: '',
|
|
|
- productCode: '',
|
|
|
- executeMethodTitle: this.formData.executeMethodTitle
|
|
|
+ productCode: ''
|
|
|
});
|
|
|
console.log('this.formData.details', this.formData.details);
|
|
|
},
|
|
|
@@ -1229,82 +1095,41 @@
|
|
|
console.log('选择的工序', process);
|
|
|
this.formData.produceTaskId = process.id;
|
|
|
this.formData.produceTaskName = process.name;
|
|
|
- },
|
|
|
- // 添加执行方式
|
|
|
- addExecuteMethod() {
|
|
|
- this.$prompt('', '请输入执行方式', {
|
|
|
- confirmButtonText: '确定',
|
|
|
- cancelButtonText: '取消',
|
|
|
- inputValidator(value) {
|
|
|
- if (!value) {
|
|
|
- return '执行方式不能为空!';
|
|
|
- }
|
|
|
- return true;
|
|
|
- }
|
|
|
- })
|
|
|
- .then(({ value }) => {
|
|
|
- console.log('value', value);
|
|
|
- if (!value) {
|
|
|
- return this.$message.warning('执行方式不能为空!');
|
|
|
- }
|
|
|
-
|
|
|
- if (this.formData.executeMethodList.includes(value)) {
|
|
|
- return this.$message.warning('执行方式已存在!');
|
|
|
- }
|
|
|
- this.formData.executeMethodList.push(value);
|
|
|
-
|
|
|
- if (this.formData.executeMethodList.length == 1) {
|
|
|
- // 默认高亮
|
|
|
- this.formData.executeMethodTitle = value;
|
|
|
- }
|
|
|
- })
|
|
|
- .catch((err) => {
|
|
|
- console.log('取消输入执行方式', err);
|
|
|
- });
|
|
|
- },
|
|
|
- // 删除执行方式
|
|
|
- deleteExecuteMethod(item) {
|
|
|
- // 如果this.formData.details总包含item 则不能删除
|
|
|
- const exists = this.formData.details.some(
|
|
|
- (detail) => detail.executeMethodTitle === item
|
|
|
- );
|
|
|
- if (exists) {
|
|
|
- return this.$message.warning(
|
|
|
- `执行方式 "${item}" 已被规则项使用,不能删除`
|
|
|
- );
|
|
|
- }
|
|
|
- this.formData.executeMethodList =
|
|
|
- this.formData.executeMethodList.filter((i) => i != item);
|
|
|
- },
|
|
|
- // 是否有执行方式改变
|
|
|
- executeMethodChange() {
|
|
|
- if (!this.formData.isExecuteMethod) {
|
|
|
- this.formData.details = this.formData.details.map((i) => {
|
|
|
- return {
|
|
|
- ...i,
|
|
|
- executeMethodTitle: ''
|
|
|
- };
|
|
|
- });
|
|
|
- this.formData.executeMethodList = [];
|
|
|
- } 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 = '无执行方式';
|
|
|
- }
|
|
|
- }
|
|
|
+ this.formData.executeMethodId = null;
|
|
|
+ this.formData.executeMethodName = '';
|
|
|
+ // 查询工序下的执行方式
|
|
|
+ this.getExecuteMethodList();
|
|
|
},
|
|
|
clearProductTask() {
|
|
|
this.formData.produceTaskId = '';
|
|
|
this.formData.produceTaskName = '';
|
|
|
+ this.formData.executeMethodId = null;
|
|
|
+ this.formData.executeMethodName = '';
|
|
|
+ this.executeMethodList = [];
|
|
|
+ },
|
|
|
+ // 查询执行方式
|
|
|
+ async getExecuteMethodList() {
|
|
|
+ if (
|
|
|
+ this.formData.produceTaskId == '' &&
|
|
|
+ this.formData.reportWorkType == 2
|
|
|
+ ) {
|
|
|
+ this.executeMethodList = [];
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const data = await recordrulesexecutemethodPage({
|
|
|
+ pageNum: 1,
|
|
|
+ size: 9999,
|
|
|
+ enable: 1,
|
|
|
+ produceTaskId: this.formData.produceTaskId
|
|
|
+ });
|
|
|
+ this.executeMethodList = data.list;
|
|
|
+ // 有执行方式
|
|
|
+ if (
|
|
|
+ this.executeMethodList.length &&
|
|
|
+ this.formData.reportWorkType == 2
|
|
|
+ ) {
|
|
|
+ this.formData.isExecuteMethod = 1;
|
|
|
+ }
|
|
|
},
|
|
|
// 过程监测修改 保存
|
|
|
processEditSave() {
|
|
|
@@ -1313,30 +1138,6 @@
|
|
|
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) {
|
|
|
- if (!item) {
|
|
|
- return this.$message.warning(`执行方式不能为空!`);
|
|
|
- }
|
|
|
-
|
|
|
- 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) {
|
|
|
@@ -1346,6 +1147,23 @@
|
|
|
|
|
|
this.$emit('processSave', this.formatBody());
|
|
|
this.handleClose();
|
|
|
+ },
|
|
|
+ // 执行方式改变 同步执行方式名称
|
|
|
+ executeMethodIdChange() {
|
|
|
+ const selected = this.executeMethodList.find(
|
|
|
+ (item) => item.id === this.formData.executeMethodId
|
|
|
+ );
|
|
|
+ if (selected) {
|
|
|
+ this.formData.executeMethodName = selected.name;
|
|
|
+ } else {
|
|
|
+ this.formData.executeMethodName = '';
|
|
|
+ }
|
|
|
+ },
|
|
|
+ isExecuteMethodChange() {
|
|
|
+ if (this.formData.isExecuteMethod == 0) {
|
|
|
+ this.formData.executeMethodId = null;
|
|
|
+ this.formData.executeMethodName = '';
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
};
|