|
@@ -1,33 +1,68 @@
|
|
|
<template>
|
|
<template>
|
|
|
- <ele-modal :visible.sync="visible" :title="title" width="80vw" append-to-body @close="cancel" :maxable="true">
|
|
|
|
|
- <el-form ref="form" :model="form" :rules="rules" label-width="90px" class="create-form">
|
|
|
|
|
|
|
+ <ele-modal
|
|
|
|
|
+ :visible.sync="visible"
|
|
|
|
|
+ :title="title"
|
|
|
|
|
+ width="80vw"
|
|
|
|
|
+ append-to-body
|
|
|
|
|
+ @close="cancel"
|
|
|
|
|
+ :maxable="true"
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-form
|
|
|
|
|
+ ref="form"
|
|
|
|
|
+ :model="form"
|
|
|
|
|
+ :rules="rules"
|
|
|
|
|
+ label-width="90px"
|
|
|
|
|
+ class="create-form"
|
|
|
|
|
+ >
|
|
|
<el-row :gutter="15">
|
|
<el-row :gutter="15">
|
|
|
<el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
|
|
<el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
|
|
|
<el-form-item label="编码:">
|
|
<el-form-item label="编码:">
|
|
|
- <el-input :maxlength="20" v-model="form.code" disabled />
|
|
|
|
|
|
|
+ <el-input
|
|
|
|
|
+ :maxlength="20"
|
|
|
|
|
+ v-model="form.unqualifiedProductsCode"
|
|
|
|
|
+ disabled
|
|
|
|
|
+ />
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
<el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
|
|
<el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
|
|
|
<el-form-item label="来源编码:">
|
|
<el-form-item label="来源编码:">
|
|
|
- <el-input :maxlength="20" v-model="form.unqualifiedSourceCode" disabled />
|
|
|
|
|
|
|
+ <el-input :maxlength="20" v-model="form.sourceCode" disabled />
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
<el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
|
|
<el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
|
|
|
<el-form-item label="数量:">
|
|
<el-form-item label="数量:">
|
|
|
- <el-input :maxlength="20" v-model="form.unqualifiedQuantity" disabled />
|
|
|
|
|
|
|
+ <el-input
|
|
|
|
|
+ :maxlength="20"
|
|
|
|
|
+ v-model="form.unqualifiedQuantity"
|
|
|
|
|
+ disabled
|
|
|
|
|
+ />
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
|
|
|
|
|
<el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
|
|
<el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
|
|
|
<el-form-item label="工艺路线:">
|
|
<el-form-item label="工艺路线:">
|
|
|
- <el-input @click.native="openVersion" clearable v-model="form.produceRoutingName" />
|
|
|
|
|
|
|
+ <el-input
|
|
|
|
|
+ @click.native="openVersion"
|
|
|
|
|
+ clearable
|
|
|
|
|
+ v-model="form.produceRoutingName"
|
|
|
|
|
+ />
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
<el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
|
|
<el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
|
|
|
<el-form-item label="工序:">
|
|
<el-form-item label="工序:">
|
|
|
- <el-select style="width: 100%" v-model="form.produceTaskId" placeholder="请选择" clearable
|
|
|
|
|
- @change="produceTaskChange">
|
|
|
|
|
- <el-option v-for="item in produceTaskList" :key="item.id" :label="item.name" :value="item.id">
|
|
|
|
|
|
|
+ <el-select
|
|
|
|
|
+ style="width: 100%"
|
|
|
|
|
+ v-model="form.taskId"
|
|
|
|
|
+ placeholder="请选择"
|
|
|
|
|
+ clearable
|
|
|
|
|
+ @change="produceTaskChange"
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-option
|
|
|
|
|
+ v-for="item in produceTaskList"
|
|
|
|
|
+ :key="item.id"
|
|
|
|
|
+ :label="item.name"
|
|
|
|
|
+ :value="item.id"
|
|
|
|
|
+ >
|
|
|
</el-option>
|
|
</el-option>
|
|
|
</el-select>
|
|
</el-select>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
@@ -38,6 +73,7 @@
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
</el-row>
|
|
</el-row>
|
|
|
|
|
+ <!-- -->
|
|
|
<el-table :data="form.poList" border height="40vh">
|
|
<el-table :data="form.poList" border height="40vh">
|
|
|
<el-table-column label="序号" align="center" width="60">
|
|
<el-table-column label="序号" align="center" width="60">
|
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
@@ -49,12 +85,20 @@
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
<el-table-column label="产品编码" align="center" prop="categoryCode">
|
|
<el-table-column label="产品编码" align="center" prop="categoryCode">
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
- <el-table-column label="牌号" align="center" prop="brandNo">
|
|
|
|
|
|
|
+ <el-table-column label="牌号" align="center" prop="brandNum">
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
<el-table-column label="刻码" align="center" prop="engrave">
|
|
<el-table-column label="刻码" align="center" prop="engrave">
|
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
|
- <el-form-item label-width="0px" :prop="'poList.' + scope.$index + '.engrave'">
|
|
|
|
|
- <el-input v-model="scope.row.engrave" size="small" style="width: 100%" placeholder="输入刻码"></el-input>
|
|
|
|
|
|
|
+ <el-form-item
|
|
|
|
|
+ label-width="0px"
|
|
|
|
|
+ :prop="'poList.' + scope.$index + '.engrave'"
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-input
|
|
|
|
|
+ v-model="scope.row.engrave"
|
|
|
|
|
+ size="small"
|
|
|
|
|
+ style="width: 100%"
|
|
|
|
|
+ placeholder="输入刻码"
|
|
|
|
|
+ ></el-input>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
@@ -65,41 +109,67 @@
|
|
|
|
|
|
|
|
<el-table-column label="数量" align="center" prop="unqualifiedQuantity">
|
|
<el-table-column label="数量" align="center" prop="unqualifiedQuantity">
|
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
|
- <el-form-item label-width="0px" :prop="'poList.' + scope.$index + '.unqualifiedQuantity'" :rules="[
|
|
|
|
|
- {
|
|
|
|
|
- required: true,
|
|
|
|
|
- message: '请输入数量',
|
|
|
|
|
- trigger: 'blur'
|
|
|
|
|
- },
|
|
|
|
|
- { validator: validatePass, trigger: 'change' }
|
|
|
|
|
- ]">
|
|
|
|
|
- <el-input :disabled="!!scope.row.id" v-model.number="scope.row.unqualifiedQuantity" size="small"
|
|
|
|
|
- oninput="value=value.replace(/[^\d]/g,'')" style="width: 100%" placeholder="输入数量" @input="
|
|
|
|
|
|
|
+ <el-form-item
|
|
|
|
|
+ label-width="0px"
|
|
|
|
|
+ :prop="'poList.' + scope.$index + '.unqualifiedQuantity'"
|
|
|
|
|
+ :rules="[
|
|
|
|
|
+ {
|
|
|
|
|
+ required: true,
|
|
|
|
|
+ message: '请输入数量',
|
|
|
|
|
+ trigger: 'blur'
|
|
|
|
|
+ },
|
|
|
|
|
+ { validator: validatePass, trigger: 'change' }
|
|
|
|
|
+ ]"
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-input
|
|
|
|
|
+ v-model.number="scope.row.unqualifiedQuantity"
|
|
|
|
|
+ size="small"
|
|
|
|
|
+ oninput="value=value.replace(/[^\d]/g,'')"
|
|
|
|
|
+ style="width: 100%"
|
|
|
|
|
+ placeholder="输入数量"
|
|
|
|
|
+ ></el-input>
|
|
|
|
|
+ <!-- @input="
|
|
|
inputNumber(scope.$index, scope.row.unqualifiedQuantity)
|
|
inputNumber(scope.$index, scope.row.unqualifiedQuantity)
|
|
|
- "></el-input>
|
|
|
|
|
|
|
+ " -->
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
- <el-table-column label="工艺路线" align="center" prop="produceRoutingName">
|
|
|
|
|
|
|
+ <el-table-column
|
|
|
|
|
+ label="工艺路线"
|
|
|
|
|
+ align="center"
|
|
|
|
|
+ prop="produceRoutingName"
|
|
|
|
|
+ >
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
<el-table-column label="工序" align="center" prop="produceTaskName">
|
|
<el-table-column label="工序" align="center" prop="produceTaskName">
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
|
|
|
|
|
<el-table-column label="原因" align="center" prop="unqualifiedReason">
|
|
<el-table-column label="原因" align="center" prop="unqualifiedReason">
|
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
|
- <el-form-item label-width="0px" :prop="'poList.' + scope.$index + '.unqualifiedReason'" :rules="{
|
|
|
|
|
- required: true,
|
|
|
|
|
- message: '请输入原因',
|
|
|
|
|
- trigger: 'blur'
|
|
|
|
|
- }">
|
|
|
|
|
- <el-input v-model="scope.row.unqualifiedReason" size="small" style="width: 100%"
|
|
|
|
|
- placeholder="输入原因"></el-input>
|
|
|
|
|
|
|
+ <el-form-item
|
|
|
|
|
+ label-width="0px"
|
|
|
|
|
+ :prop="'poList.' + scope.$index + '.unqualifiedReason'"
|
|
|
|
|
+ :rules="{
|
|
|
|
|
+ required: true,
|
|
|
|
|
+ message: '请输入原因',
|
|
|
|
|
+ trigger: 'blur'
|
|
|
|
|
+ }"
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-input
|
|
|
|
|
+ v-model="scope.row.unqualifiedReason"
|
|
|
|
|
+ size="small"
|
|
|
|
|
+ style="width: 100%"
|
|
|
|
|
+ placeholder="输入原因"
|
|
|
|
|
+ ></el-input>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
<el-table-column label="操作" align="center" width="70">
|
|
<el-table-column label="操作" align="center" width="70">
|
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
|
- <el-link type="danger" :underline="false" @click="handleDeleteItem(scope.$index, scope.row.id)">
|
|
|
|
|
|
|
+ <el-link
|
|
|
|
|
+ type="danger"
|
|
|
|
|
+ :underline="false"
|
|
|
|
|
+ @click="handleDeleteItem(scope.$index, scope.row.id)"
|
|
|
|
|
+ >
|
|
|
删除
|
|
删除
|
|
|
</el-link>
|
|
</el-link>
|
|
|
</template>
|
|
</template>
|
|
@@ -119,289 +189,373 @@
|
|
|
<!-- 选择产品 -->
|
|
<!-- 选择产品 -->
|
|
|
<EquipmentDialog ref="equipmentRefs" @choose="confirmChoose">
|
|
<EquipmentDialog ref="equipmentRefs" @choose="confirmChoose">
|
|
|
</EquipmentDialog>
|
|
</EquipmentDialog>
|
|
|
- <ProductionVersion ref="versionRefs" @changeProduct="changeProduct"></ProductionVersion>
|
|
|
|
|
|
|
+ <ProductionVersion
|
|
|
|
|
+ ref="versionRefs"
|
|
|
|
|
+ @changeProduct="changeProduct"
|
|
|
|
|
+ ></ProductionVersion>
|
|
|
</ele-modal>
|
|
</ele-modal>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
-import EquipmentDialog from '../components/EquipmentDialog.vue';
|
|
|
|
|
-import ProductionVersion from '@/components/ProductionVersion/ProductionVersion.vue';
|
|
|
|
|
-import { getProduceTaskList } from '@/api/aps';
|
|
|
|
|
-import {
|
|
|
|
|
- unqualifiedProductsAdd,
|
|
|
|
|
- getDetail,
|
|
|
|
|
- deleteUnacceptedProductDetail
|
|
|
|
|
-} from '@/api/unacceptedProduct/index';
|
|
|
|
|
-export default {
|
|
|
|
|
- components: {
|
|
|
|
|
- EquipmentDialog,
|
|
|
|
|
- ProductionVersion
|
|
|
|
|
- },
|
|
|
|
|
- data() {
|
|
|
|
|
- return {
|
|
|
|
|
- validatePass: (rule, value, callback) => {
|
|
|
|
|
- if (!value) {
|
|
|
|
|
- callback(new Error('数量不能为0'));
|
|
|
|
|
|
|
+ import EquipmentDialog from '../components/EquipmentDialog.vue';
|
|
|
|
|
+ import ProductionVersion from '@/components/ProductionVersion/ProductionVersion.vue';
|
|
|
|
|
+ import { getProduceTaskList } from '@/api/aps';
|
|
|
|
|
+ import {
|
|
|
|
|
+ unqualifiedProductsAdd,
|
|
|
|
|
+ updateData,
|
|
|
|
|
+ getDetail,
|
|
|
|
|
+ deleteUnacceptedProductDetail,
|
|
|
|
|
+ getById
|
|
|
|
|
+ } from '@/api/unacceptedProduct/index';
|
|
|
|
|
+ export default {
|
|
|
|
|
+ components: {
|
|
|
|
|
+ EquipmentDialog,
|
|
|
|
|
+ ProductionVersion
|
|
|
|
|
+ },
|
|
|
|
|
+ data() {
|
|
|
|
|
+ return {
|
|
|
|
|
+ validatePass: (rule, value, callback) => {
|
|
|
|
|
+ if (!value) {
|
|
|
|
|
+ callback(new Error('数量不能为0'));
|
|
|
|
|
+ } else {
|
|
|
|
|
+ callback();
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ id:'',
|
|
|
|
|
+ visible: false,
|
|
|
|
|
+ loading: false,
|
|
|
|
|
+ produceTaskList: [],
|
|
|
|
|
+ form: {
|
|
|
|
|
+ poList: [],
|
|
|
|
|
+ unqualifiedProductsCode: '',
|
|
|
|
|
+ sourceCode: '',
|
|
|
|
|
+ batchNo: '',
|
|
|
|
|
+ brandNum: '',
|
|
|
|
|
+ categoryCode: '',
|
|
|
|
|
+ categoryId: '',
|
|
|
|
|
+ categoryName: '',
|
|
|
|
|
+ specification: '',
|
|
|
|
|
+ modelType: '',
|
|
|
|
|
+ produceRoutingId: '',
|
|
|
|
|
+ produceRoutingName: '',
|
|
|
|
|
+ taskId: '',
|
|
|
|
|
+ taskName: '',
|
|
|
|
|
+ unqualifiedQuantity: '',
|
|
|
|
|
+ measureQuantity: '',
|
|
|
|
|
+ measureUnit: '',
|
|
|
|
|
+ weight: '',
|
|
|
|
|
+ weightUnit: ''
|
|
|
|
|
+ },
|
|
|
|
|
+ // 表单验证规则
|
|
|
|
|
+ rules: {
|
|
|
|
|
+ deliveryTime: [
|
|
|
|
|
+ { required: true, message: '请选择交付日期', trigger: 'change' }
|
|
|
|
|
+ ]
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ title: '创建'
|
|
|
|
|
+ };
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ computed: {
|
|
|
|
|
+ // 是否开启响应式布局
|
|
|
|
|
+ styleResponsive() {
|
|
|
|
|
+ return this.$store.state.theme.styleResponsive;
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ created() {},
|
|
|
|
|
+ methods: {
|
|
|
|
|
+ open(row, type) {
|
|
|
|
|
+ this.visible = true;
|
|
|
|
|
+ if (type == 'add') {
|
|
|
|
|
+ this.title = '创建';
|
|
|
|
|
+ this.form = row;
|
|
|
|
|
+ this.getProduceTaskList();
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ console.log(row, 'row');
|
|
|
|
|
+ if (row) {
|
|
|
|
|
+ this.title = '修改';
|
|
|
|
|
+ this.getDetail(row);
|
|
|
} else {
|
|
} else {
|
|
|
- callback();
|
|
|
|
|
|
|
+ this.title = '创建';
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
- visible: false,
|
|
|
|
|
- loading: false,
|
|
|
|
|
- produceTaskList: [],
|
|
|
|
|
- form: {
|
|
|
|
|
- poList: [],
|
|
|
|
|
- code: '',
|
|
|
|
|
- unqualifiedSourceCode: '',
|
|
|
|
|
- unqualifiedSourceId: '',
|
|
|
|
|
|
|
+ //选择工艺路线
|
|
|
|
|
+ openVersion() {
|
|
|
|
|
+ this.$refs.versionRefs.open();
|
|
|
|
|
+ },
|
|
|
|
|
+ //工艺路线回调
|
|
|
|
|
+ changeProduct(data) {
|
|
|
|
|
+ this.form.produceRoutingId = data.id;
|
|
|
|
|
+ this.form.produceRoutingName = data.name;
|
|
|
|
|
+ this.form.taskId = '';
|
|
|
|
|
+ this.form.taskName = '';
|
|
|
|
|
+ if (this.title == '修改') {
|
|
|
|
|
+ this.form.poList.forEach((item) => {
|
|
|
|
|
+ item.produceRoutingId = data.id;
|
|
|
|
|
+ item.produceRoutingName = data.name;
|
|
|
|
|
+ item.produceTaskId = '';
|
|
|
|
|
+ item.produceTaskName = '';
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- unqualifiedQuantity: '',
|
|
|
|
|
- type: '',
|
|
|
|
|
- status: null,
|
|
|
|
|
- reviewerId: null,
|
|
|
|
|
- reviewerName: '',
|
|
|
|
|
- createUserName: '',
|
|
|
|
|
- brandNo: '',
|
|
|
|
|
- produceRoutingId: '',
|
|
|
|
|
- produceRoutingName: '',
|
|
|
|
|
- produceTaskId: '',
|
|
|
|
|
- produceTaskName: '',
|
|
|
|
|
- batchNo: ''
|
|
|
|
|
|
|
+ this.getProduceTaskList();
|
|
|
|
|
+ },
|
|
|
|
|
+ async getProduceTaskList() {
|
|
|
|
|
+ const res = await getProduceTaskList({
|
|
|
|
|
+ isDetail: true,
|
|
|
|
|
+ pageNum: 1,
|
|
|
|
|
+ routingId: this.form.produceRoutingId,
|
|
|
|
|
+ size: -1
|
|
|
|
|
+ });
|
|
|
|
|
+ this.produceTaskList = res.list;
|
|
|
},
|
|
},
|
|
|
- // 表单验证规则
|
|
|
|
|
- rules: {
|
|
|
|
|
- deliveryTime: [
|
|
|
|
|
- { required: true, message: '请选择交付日期', trigger: 'change' }
|
|
|
|
|
- ]
|
|
|
|
|
|
|
+ produceTaskChange() {
|
|
|
|
|
+ if (!this.form.taskId) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ this.form.taskName = this.produceTaskList.find(
|
|
|
|
|
+ (item) => item.id == this.form.taskId
|
|
|
|
|
+ ).name;
|
|
|
|
|
+ this.form.poList.forEach((item, index) => {
|
|
|
|
|
+ this.$set(
|
|
|
|
|
+ this.form.poList[index],
|
|
|
|
|
+ 'produceRoutingId',
|
|
|
|
|
+ this.form.produceRoutingId
|
|
|
|
|
+ );
|
|
|
|
|
+ this.$set(
|
|
|
|
|
+ this.form.poList[index],
|
|
|
|
|
+ 'produceRoutingName',
|
|
|
|
|
+ this.form.produceRoutingName
|
|
|
|
|
+ );
|
|
|
|
|
+ this.$set(this.form.poList[index], 'produceTaskId', this.form.taskId);
|
|
|
|
|
+ this.$set(
|
|
|
|
|
+ this.form.poList[index],
|
|
|
|
|
+ 'produceTaskName',
|
|
|
|
|
+ this.form.taskName
|
|
|
|
|
+ );
|
|
|
|
|
+ });
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
- title: '创建'
|
|
|
|
|
- };
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ async getDetail(row) {
|
|
|
|
|
+ console.log(row.id, 'row.id');
|
|
|
|
|
+ // this.form = row;
|
|
|
|
|
|
|
|
- computed: {
|
|
|
|
|
- // 是否开启响应式布局
|
|
|
|
|
- styleResponsive() {
|
|
|
|
|
- return this.$store.state.theme.styleResponsive;
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
- created() { },
|
|
|
|
|
- methods: {
|
|
|
|
|
- open(row, type) {
|
|
|
|
|
- this.visible = true;
|
|
|
|
|
- if (type == 'add') {
|
|
|
|
|
- this.title = '创建';
|
|
|
|
|
- this.form = row;
|
|
|
|
|
- this.getProduceTaskList();
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
- console.log(row, 'row');
|
|
|
|
|
- if (row) {
|
|
|
|
|
- this.title = '修改';
|
|
|
|
|
- this.getDetail(row);
|
|
|
|
|
- } else {
|
|
|
|
|
- this.title = '创建';
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
- //选择工艺路线
|
|
|
|
|
- openVersion() {
|
|
|
|
|
- this.$refs.versionRefs.open();
|
|
|
|
|
- },
|
|
|
|
|
- //工艺路线回调
|
|
|
|
|
- changeProduct(data) {
|
|
|
|
|
- this.form.produceRoutingId = data.id;
|
|
|
|
|
- this.form.produceRoutingName = data.name;
|
|
|
|
|
- this.form.produceTaskId = '';
|
|
|
|
|
- this.form.produceTaskName = '';
|
|
|
|
|
- this.getProduceTaskList();
|
|
|
|
|
- },
|
|
|
|
|
- async getProduceTaskList() {
|
|
|
|
|
- const res = await getProduceTaskList({
|
|
|
|
|
- isDetail: true,
|
|
|
|
|
- pageNum: 1,
|
|
|
|
|
- routingId: this.form.produceRoutingId,
|
|
|
|
|
- size: -1
|
|
|
|
|
- });
|
|
|
|
|
- this.produceTaskList = res.list;
|
|
|
|
|
- },
|
|
|
|
|
- produceTaskChange() {
|
|
|
|
|
- if (!this.form.produceTaskId) {
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
- this.form.produceTaskName = this.produceTaskList.find(
|
|
|
|
|
- (item) => item.id == this.form.produceTaskId
|
|
|
|
|
- ).name;
|
|
|
|
|
- this.form.poList.forEach((item, index) => {
|
|
|
|
|
- this.$set(
|
|
|
|
|
- this.form.poList[index],
|
|
|
|
|
- 'produceRoutingId',
|
|
|
|
|
- this.form.produceRoutingId
|
|
|
|
|
- );
|
|
|
|
|
- this.$set(
|
|
|
|
|
- this.form.poList[index],
|
|
|
|
|
- 'produceRoutingName',
|
|
|
|
|
- this.form.produceRoutingName
|
|
|
|
|
- );
|
|
|
|
|
- this.$set(
|
|
|
|
|
- this.form.poList[index],
|
|
|
|
|
- 'produceTaskId',
|
|
|
|
|
- this.form.produceTaskId
|
|
|
|
|
- );
|
|
|
|
|
- this.$set(
|
|
|
|
|
- this.form.poList[index],
|
|
|
|
|
- 'produceTaskName',
|
|
|
|
|
- this.form.produceTaskName
|
|
|
|
|
- );
|
|
|
|
|
- });
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ const data = await getById(row.id);
|
|
|
|
|
+ this.form.id=row.id
|
|
|
|
|
+ this.form.unqualifiedProductsCode = data.unqualifiedProductsCode;
|
|
|
|
|
+ this.form.sourceCode = data.sourceCode;
|
|
|
|
|
+ this.form.batchNo = data.batchNo;
|
|
|
|
|
+ this.form.brandNum = data.brandNum;
|
|
|
|
|
+ this.form.categoryCode = data.categoryCode;
|
|
|
|
|
+ this.form.categoryId = data.categoryId;
|
|
|
|
|
+ this.form.categoryName = data.categoryName;
|
|
|
|
|
+ this.form.specification = data.specification;
|
|
|
|
|
+ this.form.modelType = data.modelType;
|
|
|
|
|
+ this.form.produceRoutingId = data.produceRoutingId;
|
|
|
|
|
+ this.form.produceRoutingName = data.produceRoutingName;
|
|
|
|
|
+ this.form.taskId = data.taskId;
|
|
|
|
|
+ this.form.taskName = data.taskName;
|
|
|
|
|
+ this.form.unqualifiedQuantity = data.unqualifiedQuantity;
|
|
|
|
|
|
|
|
- getDetail(row) {
|
|
|
|
|
- console.log(row.id, 'row.id')
|
|
|
|
|
- this.form = row;
|
|
|
|
|
- getDetail(row.id).then((res) => {
|
|
|
|
|
- this.getProduceTaskList();
|
|
|
|
|
- this.form.poList = res;
|
|
|
|
|
- });
|
|
|
|
|
- },
|
|
|
|
|
- cancel() {
|
|
|
|
|
- this.form = {
|
|
|
|
|
- poList: [],
|
|
|
|
|
- code: '',
|
|
|
|
|
- workOrderId: '',
|
|
|
|
|
- productCode: '',
|
|
|
|
|
- productName: '',
|
|
|
|
|
- specifications: '',
|
|
|
|
|
- unqualifiedQuantity: '',
|
|
|
|
|
- type: '',
|
|
|
|
|
- status: null,
|
|
|
|
|
- reviewerId: null,
|
|
|
|
|
- reviewerName: '',
|
|
|
|
|
- createUserName: '',
|
|
|
|
|
- brandNo: '',
|
|
|
|
|
- produceRoutingId: '',
|
|
|
|
|
- produceRoutingName: '',
|
|
|
|
|
- produceTaskId: '',
|
|
|
|
|
- produceTaskName: '',
|
|
|
|
|
- batchNo: ''
|
|
|
|
|
- };
|
|
|
|
|
- this.$refs.form.clearValidate();
|
|
|
|
|
- this.visible = false;
|
|
|
|
|
- },
|
|
|
|
|
- // 删除产品
|
|
|
|
|
- handleDeleteItem(index, id) {
|
|
|
|
|
- this.$confirm('确认删除吗?', '提示', {
|
|
|
|
|
- confirmButtonText: '确定',
|
|
|
|
|
- cancleButtonText: '取消',
|
|
|
|
|
- type: 'warning'
|
|
|
|
|
- })
|
|
|
|
|
- .then((res) => {
|
|
|
|
|
- if (id) {
|
|
|
|
|
- deleteUnacceptedProductDetail([id]).then((res) => {
|
|
|
|
|
- this.form.poList.splice(index, 1);
|
|
|
|
|
- });
|
|
|
|
|
- } else {
|
|
|
|
|
- this.form.poList.splice(index, 1);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ this.form.measureQuantity = data.measureQuantity;
|
|
|
|
|
+ this.form.measureUnit = data.measureUnit;
|
|
|
|
|
+ this.form.weight = data.weight;
|
|
|
|
|
+ this.form.weightUnit = data.weightUnit;
|
|
|
|
|
+
|
|
|
|
|
+ this.form.poList = data.poList;
|
|
|
|
|
+
|
|
|
|
|
+ // getDetail(row.id).then((res) => {
|
|
|
|
|
+ // // this.getProduceTaskList();
|
|
|
|
|
+ // // this.form.poList = res;
|
|
|
|
|
+ // });
|
|
|
|
|
+ },
|
|
|
|
|
+ cancel() {
|
|
|
|
|
+ this.form = {
|
|
|
|
|
+ poList: [],
|
|
|
|
|
+ unqualifiedProductsCode: '',
|
|
|
|
|
+ sourceCode: '',
|
|
|
|
|
+ batchNo: '',
|
|
|
|
|
+ brandNum: '',
|
|
|
|
|
+ categoryCode: '',
|
|
|
|
|
+ categoryId: '',
|
|
|
|
|
+ categoryName: '',
|
|
|
|
|
+ weight: '',
|
|
|
|
|
+ specification: '',
|
|
|
|
|
+ modelType: '',
|
|
|
|
|
+ produceRoutingId: '',
|
|
|
|
|
+ produceRoutingName: '',
|
|
|
|
|
+ taskId: '',
|
|
|
|
|
+ taskName: '',
|
|
|
|
|
+ measureQuantity: '',
|
|
|
|
|
+ measureUnit: '',
|
|
|
|
|
+ weight: '',
|
|
|
|
|
+ weightUnit: ''
|
|
|
|
|
+ };
|
|
|
|
|
+ this.$refs.form.clearValidate();
|
|
|
|
|
+ this.visible = false;
|
|
|
|
|
+ },
|
|
|
|
|
+ // 删除产品
|
|
|
|
|
+ handleDeleteItem(index, id) {
|
|
|
|
|
+ this.$confirm('确认删除吗?', '提示', {
|
|
|
|
|
+ confirmButtonText: '确定',
|
|
|
|
|
+ cancleButtonText: '取消',
|
|
|
|
|
+ type: 'warning'
|
|
|
})
|
|
})
|
|
|
- .catch(() => { });
|
|
|
|
|
|
|
+ .then((res) => {
|
|
|
|
|
+ if (id) {
|
|
|
|
|
+ deleteUnacceptedProductDetail([id]).then((res) => {
|
|
|
|
|
+ this.form.poList.splice(index, 1);
|
|
|
|
|
+ });
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.form.poList.splice(index, 1);
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ .catch(() => {});
|
|
|
|
|
|
|
|
- this.inputNumber();
|
|
|
|
|
- },
|
|
|
|
|
- addEquipment() {
|
|
|
|
|
- this.$refs.equipmentRefs.open();
|
|
|
|
|
- },
|
|
|
|
|
- /* 保存编辑 */
|
|
|
|
|
- save() {
|
|
|
|
|
- console.log(this.form.poList);
|
|
|
|
|
- this.$refs.form.validate((valid) => {
|
|
|
|
|
- if (!valid) {
|
|
|
|
|
- return false;
|
|
|
|
|
- }
|
|
|
|
|
- if (!this.form.poList.length) {
|
|
|
|
|
- return this.$message.warning('产品列表不能为空!');
|
|
|
|
|
- }
|
|
|
|
|
- for (let key in this.form) {
|
|
|
|
|
- if (key.includes('create')) {
|
|
|
|
|
- this.form[key] = '';
|
|
|
|
|
|
|
+ // this.inputNumber();
|
|
|
|
|
+ },
|
|
|
|
|
+ addEquipment() {
|
|
|
|
|
+ this.$refs.equipmentRefs.open();
|
|
|
|
|
+ },
|
|
|
|
|
+ /* 保存编辑 */
|
|
|
|
|
+ save() {
|
|
|
|
|
+ console.log(this.form.poList);
|
|
|
|
|
+ this.$refs.form.validate((valid) => {
|
|
|
|
|
+ if (!valid) {
|
|
|
|
|
+ return false;
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
- this.form.poList.forEach((item) => {
|
|
|
|
|
- for (let key in item) {
|
|
|
|
|
|
|
+ if (!this.form.poList.length) {
|
|
|
|
|
+ return this.$message.warning('产品列表不能为空!');
|
|
|
|
|
+ }
|
|
|
|
|
+ for (let key in this.form) {
|
|
|
if (key.includes('create')) {
|
|
if (key.includes('create')) {
|
|
|
- item[key] = '';
|
|
|
|
|
|
|
+ this.form[key] = '';
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- });
|
|
|
|
|
- this.loading = true;
|
|
|
|
|
- unqualifiedProductsAdd(this.form)
|
|
|
|
|
- .then((res) => {
|
|
|
|
|
- this.loading = false;
|
|
|
|
|
- this.$message.success('成功');
|
|
|
|
|
- this.cancel();
|
|
|
|
|
- this.$emit('refresh');
|
|
|
|
|
- })
|
|
|
|
|
- .catch((e) => {
|
|
|
|
|
- this.loading = false;
|
|
|
|
|
|
|
+ this.form.poList.forEach((item) => {
|
|
|
|
|
+ for (let key in item) {
|
|
|
|
|
+ if (key.includes('create')) {
|
|
|
|
|
+ item[key] = '';
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
});
|
|
});
|
|
|
- });
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ this.loading = true;
|
|
|
|
|
|
|
|
- // 确定选择
|
|
|
|
|
- confirmChoose(data) {
|
|
|
|
|
- let list = [];
|
|
|
|
|
- list = data.map((item, index) => {
|
|
|
|
|
- if (item.productCode) {
|
|
|
|
|
- return item;
|
|
|
|
|
- } else {
|
|
|
|
|
- return {
|
|
|
|
|
- productCode: item.code,
|
|
|
|
|
- productName: item.name,
|
|
|
|
|
- // productUnitWeight: item.netWeight,
|
|
|
|
|
- // weightUnit: item.weightUnit,
|
|
|
|
|
- specification: item.specification,
|
|
|
|
|
- brandNo: item.brandNum,
|
|
|
|
|
- unqualifiedQuantity: '',
|
|
|
|
|
- unqualifiedReason: '',
|
|
|
|
|
- produceRoutingId: '',
|
|
|
|
|
- produceRoutingName: '',
|
|
|
|
|
- produceTaskId: '',
|
|
|
|
|
- produceTaskName: ''
|
|
|
|
|
- };
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ if (this.title == '创建') {
|
|
|
|
|
+ unqualifiedProductsAdd(this.form)
|
|
|
|
|
+ .then((res) => {
|
|
|
|
|
+ this.loading = false;
|
|
|
|
|
+ this.$message.success('成功');
|
|
|
|
|
+ this.cancel();
|
|
|
|
|
+ this.$emit('refresh');
|
|
|
|
|
+ })
|
|
|
|
|
+ .catch((e) => {
|
|
|
|
|
+ this.loading = false;
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- this.form.poList = this.form.poList.concat(list);
|
|
|
|
|
|
|
+ if (this.title == '修改') {
|
|
|
|
|
+ updateData({...this.form,id:this.id})
|
|
|
|
|
+ .then((res) => {
|
|
|
|
|
+ this.loading = false;
|
|
|
|
|
+ this.$message.success('成功');
|
|
|
|
|
+ this.cancel();
|
|
|
|
|
+ this.$emit('refresh');
|
|
|
|
|
+ })
|
|
|
|
|
+ .catch((e) => {
|
|
|
|
|
+ this.loading = false;
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
|
|
|
- this.produceTaskChange();
|
|
|
|
|
- this.inputNumber();
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ // 确定选择
|
|
|
|
|
+ confirmChoose(data) {
|
|
|
|
|
+ console.log(data);
|
|
|
|
|
+ this.form.poList = [];
|
|
|
|
|
+
|
|
|
|
|
+ let list = [];
|
|
|
|
|
+ list = data.map((item, index) => {
|
|
|
|
|
+ if (item.productCode) {
|
|
|
|
|
+ return item;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return {
|
|
|
|
|
+ categoryCode: item.code,
|
|
|
|
|
+ categoryName: item.name,
|
|
|
|
|
+ categoryId: item.id,
|
|
|
|
|
+ brandNum: item.brandNum,
|
|
|
|
|
+ brandNo: item.batchNo,
|
|
|
|
|
+ specification: item.specification,
|
|
|
|
|
+ modelType: item.modelType,
|
|
|
|
|
+ engrave: '',
|
|
|
|
|
+ unqualifiedQuantity: '',
|
|
|
|
|
+ unqualifiedReason: '',
|
|
|
|
|
+ produceRoutingId: '',
|
|
|
|
|
+ produceRoutingName: '',
|
|
|
|
|
+ produceTaskId: '',
|
|
|
|
|
+ produceTaskName: '',
|
|
|
|
|
+ measureQuantity: '',
|
|
|
|
|
+ measureUnit: item.measuringUnit,
|
|
|
|
|
+ weight: '',
|
|
|
|
|
+ weightUnit: item.weightUnit
|
|
|
|
|
+ };
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ this.form.categoryCode = data[0].code;
|
|
|
|
|
+ this.form.categoryName = data[0].name;
|
|
|
|
|
+ this.form.categoryId = data[0].id;
|
|
|
|
|
+ this.form.brandNum = data[0].brandNum;
|
|
|
|
|
+ this.form.brandNo = data[0].batchNo;
|
|
|
|
|
+ this.form.specification = data[0].specification;
|
|
|
|
|
+ this.form.modelType = data[0].modelType;
|
|
|
|
|
+ this.form.measureQuantity = '';
|
|
|
|
|
+ this.form.measureUnit = data[0].measuringUnit;
|
|
|
|
|
+ this.form.weight = '';
|
|
|
|
|
+ this.form.weightUnit = data[0].weightUnit;
|
|
|
|
|
+ this.form.unqualifiedQuantity = data.length;
|
|
|
|
|
+
|
|
|
|
|
+ this.form.poList = this.form.poList.concat(list);
|
|
|
|
|
+
|
|
|
|
|
+ this.produceTaskChange();
|
|
|
|
|
+ // this.inputNumber();
|
|
|
|
|
+ },
|
|
|
|
|
|
|
|
- inputNumber() {
|
|
|
|
|
- this.form.unqualifiedQuantity = 0;
|
|
|
|
|
- this.form.poList.forEach((item) => {
|
|
|
|
|
- this.form.unqualifiedQuantity += Number(item.unqualifiedQuantity) || 0;
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ inputNumber() {
|
|
|
|
|
+ this.form.unqualifiedQuantity = 0;
|
|
|
|
|
+ this.form.poList.forEach((item) => {
|
|
|
|
|
+ this.form.unqualifiedQuantity +=
|
|
|
|
|
+ Number(item.unqualifiedQuantity) || 0;
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ watch: {
|
|
|
|
|
+ 'form.produceRoutingId': {
|
|
|
|
|
+ handler(val) {
|
|
|
|
|
+ this.getProduceTaskList();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
-};
|
|
|
|
|
|
|
+ };
|
|
|
</script>
|
|
</script>
|
|
|
<style lang="scss" scoped>
|
|
<style lang="scss" scoped>
|
|
|
-.basic-details-title {
|
|
|
|
|
- margin: 10px 0;
|
|
|
|
|
-}
|
|
|
|
|
|
|
+ .basic-details-title {
|
|
|
|
|
+ margin: 10px 0;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
-.add-product {
|
|
|
|
|
- width: 100%;
|
|
|
|
|
- display: flex;
|
|
|
|
|
- align-items: center;
|
|
|
|
|
- justify-content: flex-end;
|
|
|
|
|
- font-size: 30px;
|
|
|
|
|
- color: #1890ff;
|
|
|
|
|
- margin: 10px 0;
|
|
|
|
|
- cursor: pointer;
|
|
|
|
|
-}
|
|
|
|
|
|
|
+ .add-product {
|
|
|
|
|
+ width: 100%;
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+ justify-content: flex-end;
|
|
|
|
|
+ font-size: 30px;
|
|
|
|
|
+ color: #1890ff;
|
|
|
|
|
+ margin: 10px 0;
|
|
|
|
|
+ cursor: pointer;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
-.create-form .el-form-item {
|
|
|
|
|
- margin-bottom: 15px !important;
|
|
|
|
|
-}
|
|
|
|
|
|
|
+ .create-form .el-form-item {
|
|
|
|
|
+ margin-bottom: 15px !important;
|
|
|
|
|
+ }
|
|
|
</style>
|
|
</style>
|