|
|
@@ -1,6 +1,7 @@
|
|
|
<template>
|
|
|
<ele-modal
|
|
|
:visible.sync="visible"
|
|
|
+ v-if="visible"
|
|
|
:title="title"
|
|
|
width="75vw"
|
|
|
append-to-body
|
|
|
@@ -60,56 +61,14 @@
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col v-bind="styleResponsive ? { lg: 6, md: 24 } : { span: 6 }">
|
|
|
- <el-form-item label="编码:" prop="code">
|
|
|
- <el-input v-model="form.code" disabled />
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
+
|
|
|
<el-col v-bind="styleResponsive ? { lg: 6, md: 24 } : { span: 6 }">
|
|
|
<el-form-item label="名称:" prop="name">
|
|
|
<el-input v-model="form.name" :disabled="type == 'detail'" />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col v-bind="styleResponsive ? { lg: 6, md: 24 } : { span: 6 }">
|
|
|
- <el-form-item label="生产工单:" prop="workOrderCode">
|
|
|
- <el-input
|
|
|
- v-model="form.workOrderCode"
|
|
|
- placeholder="请选择"
|
|
|
- style="width: 100%"
|
|
|
- clearable
|
|
|
- :disabled="type == 'detail'"
|
|
|
- @click.native="addProduct"
|
|
|
- >
|
|
|
- </el-input>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col v-bind="styleResponsive ? { lg: 6, md: 24 } : { span: 6 }">
|
|
|
- <el-form-item label="工序:" prop="procedureList">
|
|
|
- <el-select
|
|
|
- style="width: 100%"
|
|
|
- v-model="form.procedureList"
|
|
|
- multiple
|
|
|
- placeholder="请选择"
|
|
|
- clearable
|
|
|
- :disabled="type == 'detail'"
|
|
|
- >
|
|
|
- <el-option
|
|
|
- v-for="item in produceTaskList"
|
|
|
- :key="item.id"
|
|
|
- :label="item.name"
|
|
|
- :value="item.id"
|
|
|
- >
|
|
|
- </el-option>
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
<el-col :span="6">
|
|
|
<el-form-item label="请托部门:" prop="pleaseEntrustDeptName">
|
|
|
- <!-- <deptSelect
|
|
|
- :disabled="type == 'detail'"
|
|
|
- v-model="form.pleaseEntrustDeptId"
|
|
|
- @changeGroup="searchDeptNodeClick"
|
|
|
- /> -->
|
|
|
<el-input v-model="form.pleaseEntrustDeptName" clearable disabled>
|
|
|
</el-input>
|
|
|
</el-form-item>
|
|
|
@@ -117,22 +76,6 @@
|
|
|
<el-col :span="6">
|
|
|
<el-form-item label="请托人:" prop="pleaseEntrustUserId">
|
|
|
<el-input v-model="form.pleaseEntrustUserName" clearable disabled />
|
|
|
-
|
|
|
- <!-- <el-select
|
|
|
- :disabled="type == 'detail'"
|
|
|
- v-model="form.pleaseEntrustUserId"
|
|
|
- size="small"
|
|
|
- style="width: 100%"
|
|
|
- filterable
|
|
|
- >
|
|
|
- <el-option
|
|
|
- v-for="item in executorList"
|
|
|
- :key="item.id"
|
|
|
- :value="item.id"
|
|
|
- @click.native="changeExecutor(item)"
|
|
|
- :label="item.name"
|
|
|
- ></el-option>
|
|
|
- </el-select> -->
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col v-bind="styleResponsive ? { lg: 6, md: 8 } : { span: 6 }">
|
|
|
@@ -170,7 +113,7 @@
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col :span="6">
|
|
|
+ <!-- <el-col :span="6">
|
|
|
<el-form-item label="完成时间:" prop="finishTime">
|
|
|
<el-date-picker
|
|
|
style="width: 100%"
|
|
|
@@ -191,97 +134,87 @@
|
|
|
:disabled="type == 'detail'"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
- </el-col>
|
|
|
- <!-- <el-col :span="8">
|
|
|
- s
|
|
|
</el-col> -->
|
|
|
</el-row>
|
|
|
<headerTitle title="产品信息" style="margin-top: 15px"></headerTitle>
|
|
|
|
|
|
- <el-table :data="form.pleaseEntrustObjList" border height="40vh">
|
|
|
- <el-table-column label="序号" align="center" width="60">
|
|
|
- <template slot-scope="scope">
|
|
|
- <span>{{ scope.$index + 1 }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
-
|
|
|
- <el-table-column label="产品名称" align="center" prop="productName">
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="产品编码" align="center" prop="productCode">
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="牌号" align="center" prop="brandNo">
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="批次号" align="center" prop="batchNo">
|
|
|
- </el-table-column>
|
|
|
- <!-- <el-table-column label="型号" align="center" prop="model">
|
|
|
- </el-table-column> -->
|
|
|
- <el-table-column label="规格" align="center" prop="specification">
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="数量" align="center" prop="productNumber">
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-form-item
|
|
|
- label-width="0px"
|
|
|
- :prop="'pleaseEntrustObjList.' + scope.$index + '.productNumber'"
|
|
|
- :rules="[
|
|
|
- {
|
|
|
- required: true,
|
|
|
- message: '请输入数量',
|
|
|
- trigger: 'blur'
|
|
|
- }
|
|
|
- ]"
|
|
|
- >
|
|
|
- <el-input
|
|
|
- :disabled="type == 'detail'"
|
|
|
- v-model.number="scope.row.productNumber"
|
|
|
- size="small"
|
|
|
- oninput="value=value.replace(/[^\d]/g,'')"
|
|
|
- style="width: 100%"
|
|
|
- placeholder="输入数量"
|
|
|
- ></el-input>
|
|
|
- </el-form-item>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column
|
|
|
- label="完成时间"
|
|
|
- align="center"
|
|
|
- prop="finishTime"
|
|
|
- width="180"
|
|
|
- >
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-form-item
|
|
|
- label-width="0px"
|
|
|
- :prop="'pleaseEntrustObjList.' + scope.$index + '.finishTime'"
|
|
|
- :rules="[
|
|
|
- {
|
|
|
- required: true,
|
|
|
- message: '请选择',
|
|
|
- trigger: 'blur'
|
|
|
- }
|
|
|
- ]"
|
|
|
+ <el-button
|
|
|
+ size="small"
|
|
|
+ type="primary"
|
|
|
+ icon="el-icon-plus"
|
|
|
+ class="ele-btn-icon"
|
|
|
+ @click="addOder"
|
|
|
+ style="margin-bottom: 10px"
|
|
|
+ >
|
|
|
+ 新建
|
|
|
+ </el-button>
|
|
|
+
|
|
|
+ <el-button
|
|
|
+ size="small"
|
|
|
+ type="danger"
|
|
|
+ icon="el-icon-delete"
|
|
|
+ class="ele-btn-icon"
|
|
|
+ @click="removeOder"
|
|
|
+ plain
|
|
|
+ style="margin-bottom: 10px"
|
|
|
+ >
|
|
|
+ 删除
|
|
|
+ </el-button>
|
|
|
+
|
|
|
+ <ele-pro-table
|
|
|
+ ref="entrustCreateTable"
|
|
|
+ :columns="columns"
|
|
|
+ :datasource="orderList"
|
|
|
+ :selection.sync="selection"
|
|
|
+ :current.sync="current"
|
|
|
+ highlight-current-row
|
|
|
+ row-key="id"
|
|
|
+ height="40vh"
|
|
|
+ >
|
|
|
+ <template v-slot:totalCount="{ row }">
|
|
|
+ <el-input v-model="row.totalCount"> </el-input>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <template v-slot:describes="{ row }">
|
|
|
+ <el-input v-model="row.describes"> </el-input>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <template v-slot:taskId="{ row, $index }">
|
|
|
+ <el-select
|
|
|
+ clearable
|
|
|
+ filterable
|
|
|
+ style="width: 100%"
|
|
|
+ v-model="row.taskId"
|
|
|
+ placeholder="请选择"
|
|
|
+ @change="taskListChange(row, $index)"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in row.taskList"
|
|
|
+ :label="item.name"
|
|
|
+ :value="item.id"
|
|
|
+ :key="item.id"
|
|
|
>
|
|
|
- <el-date-picker
|
|
|
- :disabled="type == 'detail'"
|
|
|
- style="width: 100%"
|
|
|
- v-model="scope.row.finishTime"
|
|
|
- type="date"
|
|
|
- value-format="yyyy-MM-dd"
|
|
|
- ></el-date-picker>
|
|
|
- </el-form-item>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- </el-table>
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <template v-slot:planDeliveryTime="{ row }">
|
|
|
+ <el-date-picker
|
|
|
+ v-model="row.planDeliveryTime"
|
|
|
+ type="datetime"
|
|
|
+ placeholder="选择日期时间"
|
|
|
+ format="yyyy-MM-dd HH:mm:ss"
|
|
|
+ value-format="yyyy-MM-dd HH:mm:ss"
|
|
|
+ >
|
|
|
+ </el-date-picker>
|
|
|
+ </template>
|
|
|
+ </ele-pro-table>
|
|
|
</el-form>
|
|
|
|
|
|
<template v-slot:footer>
|
|
|
<el-button @click="cancel">取消</el-button>
|
|
|
- <el-button
|
|
|
- type="primary"
|
|
|
- @click="save"
|
|
|
- :loading="loading"
|
|
|
- v-if="type != 'detail'"
|
|
|
- >
|
|
|
- 确定
|
|
|
- </el-button>
|
|
|
+ <el-button type="primary" @click="save(1)"> 保存 </el-button>
|
|
|
+ <el-button type="primary" @click="save(2)"> 提交 </el-button>
|
|
|
</template>
|
|
|
<detail
|
|
|
v-if="activeComp === 'bpm' && form.processInstanceId"
|
|
|
@@ -293,7 +226,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
- import { save } from '@/api/entrust/index';
|
|
|
+ import { save, addSubmit, pleaseEntrustDetail } from '@/api/entrust/index';
|
|
|
import produceOrder from './produceOrder';
|
|
|
import detail from '@/views/bpm/processInstance/detail.vue';
|
|
|
import deptSelect from '@/components/CommomSelect/dept-select.vue';
|
|
|
@@ -333,8 +266,14 @@
|
|
|
data() {
|
|
|
return {
|
|
|
visible: false,
|
|
|
- loading: false,
|
|
|
+ loading: null,
|
|
|
activeComp: 'main',
|
|
|
+ planType: [
|
|
|
+ { label: '所有计划类型', value: null },
|
|
|
+ { label: '内销计划', value: '1' },
|
|
|
+ { label: '外销计划', value: '2' },
|
|
|
+ { label: '预制计划', value: '3' }
|
|
|
+ ],
|
|
|
options: [
|
|
|
{
|
|
|
name: '一般',
|
|
|
@@ -361,12 +300,225 @@
|
|
|
beEntrustedDeptId: [
|
|
|
{ required: true, message: '请选择', trigger: 'change' }
|
|
|
],
|
|
|
- finishTime: [{ required: true, message: '请选择', trigger: 'change' }]
|
|
|
+ finishTime: [
|
|
|
+ { required: true, message: '请选择', trigger: 'change' }
|
|
|
+ ],
|
|
|
+ beEntrustedFactoriesId: [
|
|
|
+ { required: true, message: '请选择', trigger: 'change' }
|
|
|
+ ]
|
|
|
},
|
|
|
type: '',
|
|
|
title: '创建',
|
|
|
produceTaskList: [],
|
|
|
- factoryList: []
|
|
|
+ factoryList: [],
|
|
|
+ orderList: [],
|
|
|
+ selection: [],
|
|
|
+ current: null,
|
|
|
+ columns: [
|
|
|
+ {
|
|
|
+ width: 45,
|
|
|
+ type: 'selection',
|
|
|
+ columnKey: 'selection',
|
|
|
+ align: 'center',
|
|
|
+ reserveSelection: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ columnKey: 'index',
|
|
|
+ label: '序号',
|
|
|
+ type: 'index',
|
|
|
+ width: 55,
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ fixed: 'left'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'categoryName',
|
|
|
+ label: '产品名称',
|
|
|
+ align: 'center',
|
|
|
+ minWidth: 110,
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'apsWorkOrderCode',
|
|
|
+ label: '生产订单号',
|
|
|
+ slot: 'apsWorkOrderCode',
|
|
|
+ align: 'center',
|
|
|
+ minWidth: 110,
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'productionPlanCode',
|
|
|
+ label: '计划编号',
|
|
|
+ align: 'center',
|
|
|
+ minWidth: 110,
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'brandNum',
|
|
|
+ label: '牌号',
|
|
|
+ align: 'center',
|
|
|
+ minWidth: 110,
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'batchNo',
|
|
|
+ label: '批次号',
|
|
|
+ align: 'center',
|
|
|
+ minWidth: 110,
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'describes',
|
|
|
+ slot: 'describes',
|
|
|
+ label: '需求描述',
|
|
|
+ align: 'center',
|
|
|
+ minWidth: 110,
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'totalCount',
|
|
|
+ slot: 'totalCount',
|
|
|
+ label: '请托数量',
|
|
|
+ align: 'center',
|
|
|
+ minWidth: 110,
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'planType',
|
|
|
+ label: '计划类型',
|
|
|
+ align: 'center',
|
|
|
+ minWidth: 110,
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ formatter: (row) => {
|
|
|
+ const obj = this.planType.find((i) => i.value == row.planType);
|
|
|
+ return obj && obj.label;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'code',
|
|
|
+ label: '生产工单号',
|
|
|
+ align: 'center',
|
|
|
+ minWidth: 110,
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'specification',
|
|
|
+ label: '规格',
|
|
|
+ align: 'center',
|
|
|
+ minWidth: 110,
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'name',
|
|
|
+ label: '名称',
|
|
|
+ width: 130,
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ align: 'center'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'modelType',
|
|
|
+ label: '型号',
|
|
|
+ align: 'center',
|
|
|
+ minWidth: 110,
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'produceRoutingName',
|
|
|
+ label: '工艺路线',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'bomType',
|
|
|
+ label: 'BOM分类',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ formatter: (row) => {
|
|
|
+ if (row.bomType == 1) {
|
|
|
+ return '产品(PBOM)';
|
|
|
+ }
|
|
|
+ if (row.bomType == 2) {
|
|
|
+ return '加工(MBOM)';
|
|
|
+ }
|
|
|
+ if (row.bomType == 3) {
|
|
|
+ return '装配(ABOM)';
|
|
|
+ }
|
|
|
+ return '';
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'bomCategoryVersions',
|
|
|
+ label: 'BOM版本',
|
|
|
+ align: 'center',
|
|
|
+ width: 130,
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ formatter: (row) => {
|
|
|
+ if (row.bomCategoryName) {
|
|
|
+ return `${row.bomCategoryName} (V${row.bomCategoryVersions}.0)`;
|
|
|
+ }
|
|
|
+ return '';
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'taskId',
|
|
|
+ slot: 'taskId',
|
|
|
+ label: '工序',
|
|
|
+ align: 'center',
|
|
|
+ minWidth: 150,
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'productCode',
|
|
|
+ label: '编码',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'planDeliveryTime',
|
|
|
+ slot: 'planDeliveryTime',
|
|
|
+ label: '完成日期',
|
|
|
+ align: 'center',
|
|
|
+ minWidth: 260
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'planStartTime',
|
|
|
+ label: '计划开始时间',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ minWidth: 130,
|
|
|
+ sortable: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'planCompleteTime',
|
|
|
+ label: '计划结束时间',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ minWidth: 130,
|
|
|
+ sortable: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'startTime',
|
|
|
+ label: '工单开始时间',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ minWidth: 130,
|
|
|
+ sortable: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'completeTime',
|
|
|
+ label: '工单结束时间',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ minWidth: 130,
|
|
|
+ sortable: true
|
|
|
+ }
|
|
|
+ // {
|
|
|
+ // prop: 'priority',
|
|
|
+ // label: '优先级',
|
|
|
+ // align: 'center',
|
|
|
+ // minWidth: 120
|
|
|
+ // }
|
|
|
+ ]
|
|
|
};
|
|
|
},
|
|
|
|
|
|
@@ -382,21 +534,72 @@
|
|
|
methods: {
|
|
|
open(type, row) {
|
|
|
this.visible = true;
|
|
|
+ this.orderList = [];
|
|
|
+ if (type == 'add') {
|
|
|
+ this.form.pleaseEntrustDeptName =
|
|
|
+ this.$store.state.user.info.groupName;
|
|
|
+ this.form.pleaseEntrustDeptId = this.$store.state.user.info.groupId;
|
|
|
+ this.form.pleaseEntrustUserName = this.$store.state.user.info.name;
|
|
|
+ this.form.pleaseEntrustUserId = this.$store.state.user.info.userId;
|
|
|
|
|
|
- (this.activeComp = 'main'), (this.type = type);
|
|
|
- if (type != 'add') {
|
|
|
- this.form = JSON.parse(JSON.stringify(row));
|
|
|
- this.getProduceTaskList();
|
|
|
- this.form.procedureList = this.form.procedureList.map(
|
|
|
- (item) => item.produceTaskId
|
|
|
+ const data = this.factoryList.filter(
|
|
|
+ (it) => it.factoryId == this.$store.state.user.info.factoryId
|
|
|
);
|
|
|
- this.form.type = this.form.type + '';
|
|
|
+
|
|
|
+ if (data.length != 0) {
|
|
|
+ this.form.factoriesId = data[0].factoryId;
|
|
|
+ this.form.factoriesName = data[0].factoryName;
|
|
|
+ }
|
|
|
+ } else if (type == 'edit') {
|
|
|
+ this.getDetail(row.id);
|
|
|
}
|
|
|
+
|
|
|
this.title = type == 'add' ? '新增' : type == 'edit' ? '修改' : '详情';
|
|
|
},
|
|
|
|
|
|
- addProduct() {
|
|
|
- this.$refs.produceOrderRef.open();
|
|
|
+ addOder() {
|
|
|
+ this.$refs.produceOrderRef.open(this.orderList);
|
|
|
+ },
|
|
|
+
|
|
|
+ async getDetail(id) {
|
|
|
+ await pleaseEntrustDetail(id).then((res) => {
|
|
|
+ this.form.pleaseEntrustDeptName = res.data.applyDeptName;
|
|
|
+ this.form.pleaseEntrustDeptId = res.data.applyDeptId;
|
|
|
+ this.form.pleaseEntrustUserName = res.data.createUserName;
|
|
|
+ this.form.pleaseEntrustUserId = res.data.createUserId;
|
|
|
+ this.form.factoriesId = res.data.applyFactoriesId;
|
|
|
+ this.form.factoriesName = res.data.applyFactoriesName;
|
|
|
+ this.form.beEntrustedDeptId = res.data.beEntrustedDeptId;
|
|
|
+ this.form.beEntrustedDeptName = res.data.beEntrustedDeptName;
|
|
|
+ this.form.beEntrustedFactoriesName =
|
|
|
+ res.data.beEntrustedFactoriesName;
|
|
|
+ this.form.beEntrustedFactoriesId = res.data.beEntrustedFactoriesId;
|
|
|
+ this.form.name = res.data.name;
|
|
|
+ this.form.type = res.data.type;
|
|
|
+ this.form.priority = res.data.priority;
|
|
|
+
|
|
|
+ res.data.taskList = [];
|
|
|
+
|
|
|
+ this.orderList.push(this.deepCopy(res.data));
|
|
|
+
|
|
|
+ // console.log(this.orderList, 'this.orderListthis.orderList');
|
|
|
+ this.getOrderTaskList();
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ removeOder() {
|
|
|
+ this.$confirm('此操作将删除这些工单, 是否继续?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ for (let item of this.selection) {
|
|
|
+ const index = this.orderList.findIndex((it) => it.id == item.id);
|
|
|
+ this.orderList.splice(index, 1);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
},
|
|
|
|
|
|
beEntrustedDeptIdChange(val, row) {
|
|
|
@@ -405,6 +608,7 @@
|
|
|
factoryListChange(row) {
|
|
|
this.form.beEntrustedFactoriesName = row.name;
|
|
|
},
|
|
|
+
|
|
|
async getFactoryList() {
|
|
|
const { list } = await warehouseDefinition.getFactoryarea({
|
|
|
pageNum: 1,
|
|
|
@@ -418,57 +622,115 @@
|
|
|
this.produceTaskList = [];
|
|
|
this.visible = false;
|
|
|
},
|
|
|
- choose(data) {
|
|
|
- this.form.workOrderCode = data.code;
|
|
|
- this.form.produceRoutingId = data.produceRoutingId;
|
|
|
- this.form.produceRoutingName = data.produceRoutingName;
|
|
|
- this.form.pleaseEntrustObjList = [data];
|
|
|
- this.form.procedureList = [];
|
|
|
- this.getProduceTaskList();
|
|
|
- },
|
|
|
- async getProduceTaskList() {
|
|
|
- const res = await getProduceTaskList({
|
|
|
- isDetail: true,
|
|
|
- pageNum: 1,
|
|
|
- routingId: this.form.produceRoutingId,
|
|
|
- size: -1
|
|
|
+ choose(list) {
|
|
|
+ if (list.length == 0) {
|
|
|
+ this.orderList = [];
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ const existingKeys = new Set(
|
|
|
+ this.orderList.map((i) => i.id || i.apsWorkOrderCode)
|
|
|
+ );
|
|
|
+ const data = list.filter(
|
|
|
+ (item) => !existingKeys.has(item.id || item.apsWorkOrderCode)
|
|
|
+ );
|
|
|
+
|
|
|
+ data.forEach((item) => {
|
|
|
+ item.describes = '';
|
|
|
+ item.totalCount = '';
|
|
|
+ item.taskList = [];
|
|
|
+ item.taskId = '';
|
|
|
+ item.taskName = '';
|
|
|
+ item.beEntrustedFactoriesId = '';
|
|
|
+ item.beEntrustedFactoriesName = '';
|
|
|
+ item.status = '';
|
|
|
+ item.beEntrustedDeptName = '';
|
|
|
+ item.beEntrustedDeptId = '';
|
|
|
+ item.categoryName = item.productName;
|
|
|
+ item.categoryCode = item.productCode;
|
|
|
+ item.brandNum = item.brandNo;
|
|
|
+ item.modelType = item.model;
|
|
|
+ item.name = this.form.name;
|
|
|
+ item.type = this.form.type;
|
|
|
+ item.planDeliveryTime = item.startTime;
|
|
|
+ item.applyDeptId = this.form.pleaseEntrustDeptId;
|
|
|
+ item.applyDeptName = this.form.pleaseEntrustDeptName;
|
|
|
+ item.applyFactoriesId = this.form.factoriesId;
|
|
|
+ item.applyFactoriesName = this.form.factoriesName;
|
|
|
+ this.orderList.push(this.deepCopy(item));
|
|
|
});
|
|
|
- console.log(res, 'res');
|
|
|
- this.produceTaskList = res.list;
|
|
|
+
|
|
|
+ this.getOrderTaskList();
|
|
|
},
|
|
|
- /* 保存编辑 */
|
|
|
- save() {
|
|
|
+
|
|
|
+ async getOrderTaskList() {
|
|
|
+ for (const item of this.orderList) {
|
|
|
+ const res = await getProduceTaskList({
|
|
|
+ isDetail: true,
|
|
|
+ pageNum: 1,
|
|
|
+ routingId: item.produceRoutingId,
|
|
|
+ size: -1
|
|
|
+ });
|
|
|
+
|
|
|
+ item.taskList = res.list;
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ deepCopy(obj, hash = new WeakMap()) {
|
|
|
+ if (obj === null) return null;
|
|
|
+ if (obj instanceof Date) return new Date(obj);
|
|
|
+ if (obj instanceof RegExp) return new RegExp(obj);
|
|
|
+ if (typeof obj !== 'object' && typeof obj !== 'function') return obj;
|
|
|
+ if (hash.has(obj)) return hash.get(obj);
|
|
|
+
|
|
|
+ const result = Array.isArray(obj) ? [] : {};
|
|
|
+ hash.set(obj, result);
|
|
|
+
|
|
|
+ return Object.keys(obj).reduce((acc, key) => {
|
|
|
+ acc[key] = this.deepCopy(obj[key], hash);
|
|
|
+ return acc;
|
|
|
+ }, result);
|
|
|
+ },
|
|
|
+
|
|
|
+ taskListChange(item, index) {
|
|
|
+ const data = item.taskList.filter((it) => it.id == item.taskId);
|
|
|
+
|
|
|
+ this.orderList[index].taskName = data[0].name;
|
|
|
+ },
|
|
|
+
|
|
|
+ save(type) {
|
|
|
this.$refs.form.validate((valid) => {
|
|
|
if (!valid) {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- // for (let key in this.form) {
|
|
|
- // if (key.includes('create')) {
|
|
|
- // this.form[key] = '';
|
|
|
- // }
|
|
|
- // }
|
|
|
- this.loading = true;
|
|
|
- let data = JSON.parse(JSON.stringify(this.form));
|
|
|
- data.procedureList = data.procedureList.map((item) => {
|
|
|
- return {
|
|
|
- produceTaskId: item,
|
|
|
- produceTaskName: this.produceTaskList.find(
|
|
|
- (val) => val.id == item
|
|
|
- ).name
|
|
|
- };
|
|
|
+ this.orderList.forEach((item) => {
|
|
|
+ item.beEntrustedFactoriesId = this.form.beEntrustedFactoriesId;
|
|
|
+ item.beEntrustedFactoriesName = this.form.beEntrustedFactoriesName;
|
|
|
+ item.beEntrustedDeptName = this.form.beEntrustedDeptName;
|
|
|
+ item.beEntrustedDeptId = this.form.beEntrustedDeptId;
|
|
|
+ item.name = this.form.name;
|
|
|
+ item.status = type == 1 ? 0 : 1;
|
|
|
+ item.approvalStatus = type == 1 ? 0 : 1;
|
|
|
});
|
|
|
- // console.log(data);
|
|
|
- // return;
|
|
|
- save(data)
|
|
|
+
|
|
|
+ const URL = type == 1 ? save : addSubmit;
|
|
|
+
|
|
|
+ this.loading = this.$loading({
|
|
|
+ lock: true,
|
|
|
+ text: '加载中',
|
|
|
+ background: 'rgba(0, 0, 0, 0.7)'
|
|
|
+ });
|
|
|
+
|
|
|
+ URL(this.orderList)
|
|
|
.then((res) => {
|
|
|
- this.loading = false;
|
|
|
+ this.loading.close();
|
|
|
this.$message.success('成功');
|
|
|
this.cancel();
|
|
|
this.$emit('refresh');
|
|
|
})
|
|
|
.catch((e) => {
|
|
|
- this.loading = false;
|
|
|
+ this.loading.close();
|
|
|
});
|
|
|
});
|
|
|
}
|