|
|
@@ -205,6 +205,15 @@
|
|
|
>
|
|
|
工步
|
|
|
</el-link>
|
|
|
+ <el-link
|
|
|
+ type="primary"
|
|
|
+ :underline="false"
|
|
|
+ icon="el-icon-plus"
|
|
|
+ @click="openCreateStep(row)"
|
|
|
+ v-if="attributeData.status != 1"
|
|
|
+ >
|
|
|
+ 创建工步
|
|
|
+ </el-link>
|
|
|
<el-link
|
|
|
type="primary"
|
|
|
:underline="false"
|
|
|
@@ -249,7 +258,7 @@
|
|
|
:data="current"
|
|
|
:controlList="controlList"
|
|
|
:isView="isView"
|
|
|
- @done="reload"
|
|
|
+ @done="handleStepEditDone"
|
|
|
ref="userEdit"
|
|
|
:typeList="typeList"
|
|
|
/>
|
|
|
@@ -270,6 +279,7 @@
|
|
|
import workingStep from './workingStep.vue';
|
|
|
import { getMbomPage, workingStepDelete } from '@/api/material/BOM';
|
|
|
import control from '@/api/technology/control';
|
|
|
+ import stepManagement from '@/api/technology/stepManagement';
|
|
|
import UserEdit from '@/views/technology/stepManagement/components/user-edit.vue';
|
|
|
export default {
|
|
|
name: 'process',
|
|
|
@@ -450,7 +460,8 @@
|
|
|
showEdit: false,
|
|
|
current: null,
|
|
|
isView: false,
|
|
|
- controlList: []
|
|
|
+ controlList: [],
|
|
|
+ createStepTargetProcess: null
|
|
|
};
|
|
|
},
|
|
|
methods: {
|
|
|
@@ -521,6 +532,7 @@
|
|
|
openStepConfigure(row, isView) {
|
|
|
console.log('123123123', row);
|
|
|
// this.$refs.workingStepRef.open(row, this.taskParam, !!isView);
|
|
|
+ this.createStepTargetProcess = null;
|
|
|
this.isView = !!isView;
|
|
|
this.getControlList();
|
|
|
this.current = row;
|
|
|
@@ -528,6 +540,93 @@
|
|
|
this.$refs.userEdit.$refs.form &&
|
|
|
this.$refs.userEdit.$refs.form.clearValidate();
|
|
|
},
|
|
|
+ openCreateStep(row) {
|
|
|
+ this.createStepTargetProcess = row;
|
|
|
+ this.isView = false;
|
|
|
+ this.getControlList();
|
|
|
+ this.current = null;
|
|
|
+ this.showEdit = true;
|
|
|
+ this.$refs.userEdit.$refs.form &&
|
|
|
+ this.$refs.userEdit.$refs.form.clearValidate();
|
|
|
+ },
|
|
|
+ async handleStepEditDone(stepData, formData) {
|
|
|
+ if (this.createStepTargetProcess && !this.current) {
|
|
|
+ const currentProcess = this.createStepTargetProcess;
|
|
|
+ this.createStepTargetProcess = null;
|
|
|
+ const currentStep = await this.getCreatedStep(stepData, formData);
|
|
|
+ if (currentStep && currentStep.id) {
|
|
|
+ this.chooseStepModal([currentStep], currentProcess);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.openStepSetting(currentProcess);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.createStepTargetProcess = null;
|
|
|
+ this.reload();
|
|
|
+ },
|
|
|
+ async getCreatedStep(stepData, formData) {
|
|
|
+ if (stepData && stepData.id) {
|
|
|
+ return stepData;
|
|
|
+ }
|
|
|
+ if (!formData || (!formData.name && !formData.code)) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ const res = await stepManagement.list({
|
|
|
+ pageNum: 1,
|
|
|
+ size: 50,
|
|
|
+ name: formData.name,
|
|
|
+ code: formData.code,
|
|
|
+ status: formData.status
|
|
|
+ });
|
|
|
+ const stepList = Array.isArray(res)
|
|
|
+ ? res
|
|
|
+ : Array.isArray(res?.list)
|
|
|
+ ? res.list
|
|
|
+ : [];
|
|
|
+ if (!stepList.length) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ return (
|
|
|
+ stepList.find((item) => {
|
|
|
+ return (
|
|
|
+ item.name === formData.name &&
|
|
|
+ (!formData.code || item.code === formData.code)
|
|
|
+ );
|
|
|
+ }) ||
|
|
|
+ stepList.sort((a, b) => Number(b.id || 0) - Number(a.id || 0))[0]
|
|
|
+ );
|
|
|
+ },
|
|
|
+ async refreshStepList(current) {
|
|
|
+ const data = await getStepListById({
|
|
|
+ paramId: current.id,
|
|
|
+ bomCategoryId: this.taskParam.id
|
|
|
+ });
|
|
|
+ const tableList = this.$refs.table.getData() || [];
|
|
|
+ const clonedArray = JSON.parse(JSON.stringify(tableList));
|
|
|
+ clonedArray.forEach((item) => {
|
|
|
+ if (item.id == current.id) {
|
|
|
+ item.categoryParamStepList = data;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ this.$refs.table.setData([...clonedArray]);
|
|
|
+ this.expandCurrentProcess(current.id);
|
|
|
+ },
|
|
|
+ expandCurrentProcess(processId) {
|
|
|
+ this.$nextTick(() => {
|
|
|
+ const tableRef = this.$refs.table;
|
|
|
+ const tableList = tableRef.getData ? tableRef.getData() : [];
|
|
|
+ const currentRow = tableList.find((item) => item.id == processId);
|
|
|
+ if (!currentRow) {
|
|
|
+ this.$forceUpdate();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ tableRef.toggleRowExpansionAll(false);
|
|
|
+ if (tableRef.toggleRowExpansion) {
|
|
|
+ tableRef.toggleRowExpansion(currentRow, true);
|
|
|
+ }
|
|
|
+ this.$forceUpdate();
|
|
|
+ });
|
|
|
+ },
|
|
|
|
|
|
getControlList() {
|
|
|
const params = {
|
|
|
@@ -631,11 +730,7 @@
|
|
|
|
|
|
this.$refs.table.setData([...clonedArray]);
|
|
|
this.$emit('chooseProcess', clonedArray);
|
|
|
-
|
|
|
- this.$nextTick(() => {
|
|
|
- this.$refs.table.toggleRowExpansionAll();
|
|
|
- this.$forceUpdate();
|
|
|
- });
|
|
|
+ this.expandCurrentProcess(current.id);
|
|
|
},
|
|
|
chooseStepModal(data, current) {
|
|
|
console.log(data, 'data');
|
|
|
@@ -655,7 +750,7 @@
|
|
|
});
|
|
|
workingStepSave(params).then((data) => {
|
|
|
this.$message.success('保存成功');
|
|
|
- this.reload();
|
|
|
+ this.refreshStepList(current);
|
|
|
});
|
|
|
}
|
|
|
// this.reload();
|