|
|
@@ -23,7 +23,7 @@
|
|
|
label-width="80px"
|
|
|
>
|
|
|
<el-row style="margin-bottom: 10px">
|
|
|
- <el-col :span="4"
|
|
|
+ <el-col :span="6"
|
|
|
><el-form-item label="类型 " prop="type">
|
|
|
<el-select
|
|
|
clearable
|
|
|
@@ -39,7 +39,7 @@
|
|
|
/>
|
|
|
</el-select> </el-form-item
|
|
|
></el-col>
|
|
|
- <el-col :span="8">
|
|
|
+ <el-col :span="7">
|
|
|
<el-form-item label="名称" prop="qualitySchemeTemplateName">
|
|
|
<el-input
|
|
|
v-model="dataForm.qualitySchemeTemplateName"
|
|
|
@@ -47,7 +47,7 @@
|
|
|
></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col :span="8">
|
|
|
+ <el-col :span="7">
|
|
|
<el-form-item label="编码" prop="qualitySchemeTemplateCode">
|
|
|
<el-input
|
|
|
v-model="dataForm.qualitySchemeTemplateCode"
|
|
|
@@ -70,7 +70,23 @@
|
|
|
></el-col>
|
|
|
</el-row>
|
|
|
<el-row>
|
|
|
- <el-col :span="24">
|
|
|
+ <el-col :span="6">
|
|
|
+ <el-form-item label="工序" prop="taskName">
|
|
|
+ <el-input
|
|
|
+ v-model="dataForm.taskName"
|
|
|
+ placeholder="请选择"
|
|
|
+ style="width: calc(100% - 56px); margin-right: 10px"
|
|
|
+ disabled
|
|
|
+ ></el-input>
|
|
|
+ <el-button
|
|
|
+ size="small"
|
|
|
+ type="primary"
|
|
|
+ @click.native="handleTaskinstance"
|
|
|
+ >选择
|
|
|
+ </el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="18">
|
|
|
<el-form-item label="备注" prop="templateRemark">
|
|
|
<el-input
|
|
|
type="textarea"
|
|
|
@@ -86,23 +102,34 @@
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
<el-row>
|
|
|
- <el-col style="width: 370px">
|
|
|
+ <el-col style="width: 260px">
|
|
|
+ <el-form-item label="检验方式" prop="qualityMode">
|
|
|
+ <DictSelection
|
|
|
+ dictName="检验方案"
|
|
|
+ clearable
|
|
|
+ v-model="dataForm.qualityMode"
|
|
|
+ >
|
|
|
+ </DictSelection>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+
|
|
|
+ <el-col style="width: 360px" v-if="dataForm.qualityMode == 2">
|
|
|
<el-form-item label="取样数量" prop="sampleProportion">
|
|
|
<el-input
|
|
|
type="number"
|
|
|
v-model="dataForm.sampleProportion"
|
|
|
placeholder="请输入"
|
|
|
- style="width: 200px"
|
|
|
+ style="width: 180px"
|
|
|
></el-input>
|
|
|
<DictSelection
|
|
|
- style="width: 85px"
|
|
|
+ style="width: 95px"
|
|
|
dictName="计量单位"
|
|
|
placeholder=" "
|
|
|
v-model="dataForm.sampleProportionUnit"
|
|
|
></DictSelection>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col style="width: 450px">
|
|
|
+ <el-col style="width: 430px">
|
|
|
<el-form-item
|
|
|
label="质检报告有效期"
|
|
|
prop="validityPeriod"
|
|
|
@@ -112,7 +139,7 @@
|
|
|
type="number"
|
|
|
v-model="dataForm.validityPeriod"
|
|
|
placeholder="请输入"
|
|
|
- style="width: 200px"
|
|
|
+ style="width: 180px"
|
|
|
></el-input>
|
|
|
<el-select
|
|
|
style="width: 85px"
|
|
|
@@ -224,7 +251,7 @@
|
|
|
</template>
|
|
|
</ele-pro-table>
|
|
|
</el-row>
|
|
|
- <el-row v-if="dataForm.type !== 2">
|
|
|
+ <el-row>
|
|
|
<ele-pro-table
|
|
|
ref="table"
|
|
|
:columns="categoryColumns"
|
|
|
@@ -274,348 +301,370 @@
|
|
|
:disabledCode="templateCategoryList.map((item) => item.code)"
|
|
|
>
|
|
|
</EquipmentDialog>
|
|
|
+ <taskinstance-dialog
|
|
|
+ ref="taskinstanceDialogRef"
|
|
|
+ v-if="taskinstanceDialogFlag"
|
|
|
+ @saveTaskInstance="saveTaskInstance"
|
|
|
+ :visible.sync="taskinstanceDialogFlag"
|
|
|
+ ></taskinstance-dialog>
|
|
|
</ele-modal>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import termPop from '@/views/inspectionTemplate/inspectionClassify/index.vue';
|
|
|
-import EquipmentDialog from '@/views/unqualifiedProduct/unqualifiedList/components/EquipmentDialog.vue';
|
|
|
-import { getByCode } from '@/api/system/dictionary-data';
|
|
|
-import tabMixins from '@/mixins/tableColumnsMixin';
|
|
|
+ import termPop from '@/views/inspectionTemplate/inspectionClassify/index.vue';
|
|
|
+ import EquipmentDialog from '@/views/unqualifiedProduct/unqualifiedList/components/EquipmentDialog.vue';
|
|
|
+ import { getByCode } from '@/api/system/dictionary-data';
|
|
|
+ import tabMixins from '@/mixins/tableColumnsMixin';
|
|
|
+ import taskinstanceDialog from '@/components/procedure/taskinstanceDialog.vue';
|
|
|
|
|
|
-import {
|
|
|
- save,
|
|
|
- update,
|
|
|
- getById,
|
|
|
- templatecategoryPage
|
|
|
-} from '@/api/inspectionTemplate';
|
|
|
-import { getCode } from '@/api/login';
|
|
|
-export default {
|
|
|
- components: { termPop, EquipmentDialog },
|
|
|
- mixins: [tabMixins],
|
|
|
- data() {
|
|
|
- return {
|
|
|
- cacheKeyUrl: 'qms-c2e9664a-inspectionTemplate-AddorUpdate',
|
|
|
- columnsVersion: 1,
|
|
|
- visible: false,
|
|
|
- dataForm: {
|
|
|
- id: 0,
|
|
|
- type: null,
|
|
|
- qualitySchemeTemplateName: '',
|
|
|
- qualitySchemeTemplateCode: '',
|
|
|
- inspectionItemVOList: [],
|
|
|
- status: 1,
|
|
|
- templateRemark: '',
|
|
|
- sampleProportion: '',
|
|
|
- sampleProportionUnit: '%',
|
|
|
- validityPeriod: '',
|
|
|
- validityPeriodUnit: ''
|
|
|
- },
|
|
|
- columns: [
|
|
|
- {
|
|
|
- width: 45,
|
|
|
- type: 'selection',
|
|
|
- columnKey: 'selection',
|
|
|
- align: 'center',
|
|
|
- reserveSelection: true
|
|
|
- },
|
|
|
- {
|
|
|
- columnKey: 'index',
|
|
|
- label: '序号',
|
|
|
- type: 'index',
|
|
|
- width: 55,
|
|
|
- align: 'center',
|
|
|
- showOverflowTooltip: true,
|
|
|
- fixed: 'left'
|
|
|
- },
|
|
|
- {
|
|
|
- label: '排序',
|
|
|
- width: 100,
|
|
|
- align: 'center',
|
|
|
- slot: 'sort',
|
|
|
- prop: 'sort',
|
|
|
- fixed: 'left'
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'categoryLevelClassName',
|
|
|
- label: '质检类型',
|
|
|
- align: 'center',
|
|
|
- minWidth: 150
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'inspectionCode',
|
|
|
- label: '编码',
|
|
|
- showOverflowTooltip: true,
|
|
|
- align: 'center',
|
|
|
- minWidth: 150
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'inspectionName',
|
|
|
- slot: 'inspectionName',
|
|
|
- label: '名称',
|
|
|
- showOverflowTooltip: true,
|
|
|
- align: 'center',
|
|
|
- minWidth: 150
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'defaultValue',
|
|
|
- slot: 'defaultValue',
|
|
|
- label: '工艺参数',
|
|
|
- align: 'center',
|
|
|
- minWidth: 400,
|
|
|
- columnKey: 'defaultValue'
|
|
|
+ import {
|
|
|
+ save,
|
|
|
+ update,
|
|
|
+ getById,
|
|
|
+ templatecategoryPage
|
|
|
+ } from '@/api/inspectionTemplate';
|
|
|
+ import { getCode } from '@/api/login';
|
|
|
+ export default {
|
|
|
+ components: { termPop, EquipmentDialog, taskinstanceDialog },
|
|
|
+ mixins: [tabMixins],
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ cacheKeyUrl: 'qms-c2e9664a-inspectionTemplate-AddorUpdate',
|
|
|
+ columnsVersion: 1,
|
|
|
+ visible: false,
|
|
|
+ taskinstanceDialogFlag: false,
|
|
|
+ dataForm: {
|
|
|
+ id: 0,
|
|
|
+ type: null,
|
|
|
+ qualitySchemeTemplateName: '',
|
|
|
+ qualitySchemeTemplateCode: '',
|
|
|
+ inspectionItemVOList: [],
|
|
|
+ status: 1,
|
|
|
+ templateRemark: '',
|
|
|
+ sampleProportion: '',
|
|
|
+ sampleProportionUnit: '%',
|
|
|
+ validityPeriod: '',
|
|
|
+ validityPeriodUnit: '',
|
|
|
+ qualityMode: '',
|
|
|
+ taskId:'',
|
|
|
+ taskName:'',
|
|
|
},
|
|
|
+ columns: [
|
|
|
+ {
|
|
|
+ width: 45,
|
|
|
+ type: 'selection',
|
|
|
+ columnKey: 'selection',
|
|
|
+ align: 'center',
|
|
|
+ reserveSelection: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ columnKey: 'index',
|
|
|
+ label: '序号',
|
|
|
+ type: 'index',
|
|
|
+ width: 55,
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ fixed: 'left'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '排序',
|
|
|
+ width: 100,
|
|
|
+ align: 'center',
|
|
|
+ slot: 'sort',
|
|
|
+ prop: 'sort',
|
|
|
+ fixed: 'left'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'categoryLevelClassName',
|
|
|
+ label: '质检类型',
|
|
|
+ align: 'center',
|
|
|
+ minWidth: 150
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'inspectionCode',
|
|
|
+ label: '编码',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ align: 'center',
|
|
|
+ minWidth: 150
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'inspectionName',
|
|
|
+ slot: 'inspectionName',
|
|
|
+ label: '名称',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ align: 'center',
|
|
|
+ minWidth: 150
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'defaultValue',
|
|
|
+ slot: 'defaultValue',
|
|
|
+ label: '工艺参数',
|
|
|
+ align: 'center',
|
|
|
+ minWidth: 400,
|
|
|
+ columnKey: 'defaultValue'
|
|
|
+ },
|
|
|
|
|
|
- {
|
|
|
- columnKey: 'action',
|
|
|
- label: '操作',
|
|
|
- width: 80,
|
|
|
- align: 'center',
|
|
|
- resizable: false,
|
|
|
- slot: 'action',
|
|
|
- fixed: 'right'
|
|
|
- }
|
|
|
- ],
|
|
|
- categoryColumns: [
|
|
|
- {
|
|
|
- width: 45,
|
|
|
- type: 'selection',
|
|
|
- columnKey: 'selection',
|
|
|
- align: 'center',
|
|
|
- reserveSelection: true
|
|
|
- },
|
|
|
- {
|
|
|
- columnKey: 'index',
|
|
|
- label: '序号',
|
|
|
- type: 'index',
|
|
|
- width: 55,
|
|
|
- align: 'center',
|
|
|
- showOverflowTooltip: true,
|
|
|
- fixed: 'left'
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'categoryLevelPath',
|
|
|
- label: '分类',
|
|
|
- align: 'center',
|
|
|
- minWidth: 150
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'code',
|
|
|
- label: '编码',
|
|
|
- showOverflowTooltip: true,
|
|
|
- align: 'center',
|
|
|
- minWidth: 150
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'name',
|
|
|
- label: '名称',
|
|
|
- showOverflowTooltip: true,
|
|
|
- align: 'center',
|
|
|
- minWidth: 150
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'specification',
|
|
|
- label: '规格',
|
|
|
- align: 'center',
|
|
|
- minWidth: 150
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'modelType',
|
|
|
- label: '型号',
|
|
|
- align: 'center',
|
|
|
- minWidth: 150
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'brandNum',
|
|
|
- label: '牌号',
|
|
|
- align: 'center',
|
|
|
- minWidth: 150
|
|
|
- },
|
|
|
- {
|
|
|
- columnKey: 'action',
|
|
|
- label: '操作',
|
|
|
- width: 80,
|
|
|
- align: 'center',
|
|
|
- resizable: false,
|
|
|
- slot: 'action',
|
|
|
- fixed: 'right'
|
|
|
- }
|
|
|
- ],
|
|
|
- dataRule: {
|
|
|
- type: [{ required: true, message: '请选择类型', trigger: 'blur' }],
|
|
|
- qualitySchemeTemplateName: [
|
|
|
- { required: true, message: '请输入质检方案名称', trigger: 'blur' }
|
|
|
+ {
|
|
|
+ columnKey: 'action',
|
|
|
+ label: '操作',
|
|
|
+ width: 80,
|
|
|
+ align: 'center',
|
|
|
+ resizable: false,
|
|
|
+ slot: 'action',
|
|
|
+ fixed: 'right'
|
|
|
+ }
|
|
|
],
|
|
|
- status: [
|
|
|
+ categoryColumns: [
|
|
|
+ {
|
|
|
+ width: 45,
|
|
|
+ type: 'selection',
|
|
|
+ columnKey: 'selection',
|
|
|
+ align: 'center',
|
|
|
+ reserveSelection: true
|
|
|
+ },
|
|
|
{
|
|
|
- required: true,
|
|
|
- message: '请选择状态',
|
|
|
- trigger: 'blur'
|
|
|
+ columnKey: 'index',
|
|
|
+ label: '序号',
|
|
|
+ type: 'index',
|
|
|
+ width: 55,
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ fixed: 'left'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'categoryLevelPath',
|
|
|
+ label: '分类',
|
|
|
+ align: 'center',
|
|
|
+ minWidth: 150
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'code',
|
|
|
+ label: '编码',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ align: 'center',
|
|
|
+ minWidth: 150
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'name',
|
|
|
+ label: '名称',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ align: 'center',
|
|
|
+ minWidth: 150
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'specification',
|
|
|
+ label: '规格',
|
|
|
+ align: 'center',
|
|
|
+ minWidth: 150
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'modelType',
|
|
|
+ label: '型号',
|
|
|
+ align: 'center',
|
|
|
+ minWidth: 150
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'brandNum',
|
|
|
+ label: '牌号',
|
|
|
+ align: 'center',
|
|
|
+ minWidth: 150
|
|
|
+ },
|
|
|
+ {
|
|
|
+ columnKey: 'action',
|
|
|
+ label: '操作',
|
|
|
+ width: 80,
|
|
|
+ align: 'center',
|
|
|
+ resizable: false,
|
|
|
+ slot: 'action',
|
|
|
+ fixed: 'right'
|
|
|
}
|
|
|
- ]
|
|
|
- },
|
|
|
- list: [],
|
|
|
- templateCategoryList: [],
|
|
|
- typeList: []
|
|
|
- };
|
|
|
- },
|
|
|
- methods: {
|
|
|
+ ],
|
|
|
+ dataRule: {
|
|
|
+ type: [{ required: true, message: '请选择类型', trigger: 'blur' }],
|
|
|
+ qualitySchemeTemplateName: [
|
|
|
+ { required: true, message: '请输入质检方案名称', trigger: 'blur' }
|
|
|
+ ],
|
|
|
+ status: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: '请选择状态',
|
|
|
+ trigger: 'blur'
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ list: [],
|
|
|
+ templateCategoryList: [],
|
|
|
+ typeList: []
|
|
|
+ };
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
//失去焦点自动排序
|
|
|
handleSortBlur() {
|
|
|
- this.list = this.list.map(item => ({
|
|
|
- ...item,
|
|
|
- sort: item.sort === '' || item.sort == null ? 0 : Number(item.sort)
|
|
|
- }));
|
|
|
+ this.list = this.list.map((item) => ({
|
|
|
+ ...item,
|
|
|
+ sort: item.sort === '' || item.sort == null ? 0 : Number(item.sort)
|
|
|
+ }));
|
|
|
|
|
|
- this.list.sort((a, b) => a.sort - b.sort);
|
|
|
- },
|
|
|
- async getTnspectionPlanType() {
|
|
|
- let res = await getByCode('inspection_plan_type');
|
|
|
- if (res?.code == 0) {
|
|
|
- let list = res.data.map((item) => {
|
|
|
- let key = Object.keys(item)[0];
|
|
|
- return { value: key, label: item[key] };
|
|
|
+ this.list.sort((a, b) => a.sort - b.sort);
|
|
|
+ },
|
|
|
+ handleTaskinstance() {
|
|
|
+ this.taskinstanceDialogFlag = true;
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs.taskinstanceDialogRef.open();
|
|
|
});
|
|
|
- this.typeList = list;
|
|
|
- }
|
|
|
- },
|
|
|
- handAdd(type) {
|
|
|
- if (type == 1) {
|
|
|
- this.$refs.termRef.open(this.list);
|
|
|
- }
|
|
|
- if (type == 2) {
|
|
|
- this.$refs.equipmentRefs.open();
|
|
|
- }
|
|
|
- },
|
|
|
- handleClose() {
|
|
|
- this.visible = false;
|
|
|
- this.templateCategoryList = [];
|
|
|
- },
|
|
|
- selectionChange(selection) {
|
|
|
- console.log(selection, 'selection');
|
|
|
- },
|
|
|
- selectChange(list) {
|
|
|
- this.list = list.map((item) => {
|
|
|
- item['sort'] = item['sort'] || 0;
|
|
|
- return item;
|
|
|
- });
|
|
|
- },
|
|
|
- handDel(index, type) {
|
|
|
- if (type == 1) {
|
|
|
- this.list.splice(index, 1);
|
|
|
- }
|
|
|
- if (type == 2) {
|
|
|
- this.templateCategoryList.splice(index, 1);
|
|
|
- }
|
|
|
- },
|
|
|
- confirmChoose(list) {
|
|
|
- let categoryList = list.map((item) => {
|
|
|
- item['name'] = item.name;
|
|
|
- item['categoryId'] = item.id;
|
|
|
- item['id'] = '';
|
|
|
- return item;
|
|
|
- });
|
|
|
- this.templateCategoryList.push(...categoryList);
|
|
|
- },
|
|
|
- init(id) {
|
|
|
- this.getTnspectionPlanType();
|
|
|
- this.dataForm.id = id || 0;
|
|
|
- this.visible = true;
|
|
|
- this.$nextTick(async () => {
|
|
|
- this.$refs['dataForm'].resetFields();
|
|
|
- if (this.dataForm.id) {
|
|
|
- getById(this.dataForm.id).then(({ data }) => {
|
|
|
- this.dataForm = data;
|
|
|
- let itemVOList = [];
|
|
|
- if (data.inspectionItemVOList.length > 0) {
|
|
|
- itemVOList = data.inspectionItemVOList.map((item) => {
|
|
|
- item.inspectionItemId = this.dataForm.id;
|
|
|
- // item.push({
|
|
|
- // inspectionItemId: this.dataForm.id
|
|
|
- // });
|
|
|
- return item;
|
|
|
- });
|
|
|
- }
|
|
|
- // this.list = data.inspectionItemVOList;
|
|
|
- this.list = itemVOList;
|
|
|
- console.log(this.list);
|
|
|
- });
|
|
|
- templatecategoryPage({
|
|
|
- templateId: this.dataForm.id,
|
|
|
- size: -1
|
|
|
- }).then((data) => {
|
|
|
- console.log(data, 'data');
|
|
|
- this.templateCategoryList = data.list;
|
|
|
+ },
|
|
|
+ async getTnspectionPlanType() {
|
|
|
+ let res = await getByCode('inspection_plan_type');
|
|
|
+ if (res?.code == 0) {
|
|
|
+ let list = res.data.map((item) => {
|
|
|
+ let key = Object.keys(item)[0];
|
|
|
+ return { value: key, label: item[key] };
|
|
|
});
|
|
|
- // this.templateCategoryList=data.templateCategoryList||[];
|
|
|
- } else {
|
|
|
- const code = await getCode('template_code');
|
|
|
- this.dataForm.qualitySchemeTemplateCode = code;
|
|
|
- this.list = [];
|
|
|
+ this.typeList = list;
|
|
|
}
|
|
|
- });
|
|
|
- },
|
|
|
- // 表单提交
|
|
|
- dataFormSubmit() {
|
|
|
- this.$refs['dataForm'].validate((valid) => {
|
|
|
- if (valid) {
|
|
|
- if (!this.dataForm.id) {
|
|
|
- delete this.dataForm.id;
|
|
|
- }
|
|
|
- const saveOrUpdate = this.dataForm.id ? update : save;
|
|
|
+ },
|
|
|
+ handAdd(type) {
|
|
|
+ if (type == 1) {
|
|
|
+ this.$refs.termRef.open(this.list);
|
|
|
+ }
|
|
|
+ if (type == 2) {
|
|
|
+ this.$refs.equipmentRefs.open();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ handleClose() {
|
|
|
+ this.visible = false;
|
|
|
+ this.templateCategoryList = [];
|
|
|
+ },
|
|
|
+ selectionChange(selection) {
|
|
|
+ console.log(selection, 'selection');
|
|
|
+ },
|
|
|
+ selectChange(list) {
|
|
|
+ this.list = list.map((item) => {
|
|
|
+ item['sort'] = item['sort'] || 0;
|
|
|
+ return item;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ handDel(index, type) {
|
|
|
+ if (type == 1) {
|
|
|
+ this.list.splice(index, 1);
|
|
|
+ }
|
|
|
+ if (type == 2) {
|
|
|
+ this.templateCategoryList.splice(index, 1);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ confirmChoose(list) {
|
|
|
+ let categoryList = list.map((item) => {
|
|
|
+ item['name'] = item.name;
|
|
|
+ item['categoryId'] = item.id;
|
|
|
+ item['id'] = '';
|
|
|
+ return item;
|
|
|
+ });
|
|
|
+ this.templateCategoryList.push(...categoryList);
|
|
|
+ },
|
|
|
+ init(id) {
|
|
|
+ this.getTnspectionPlanType();
|
|
|
+ this.dataForm.id = id || 0;
|
|
|
+ this.visible = true;
|
|
|
+ this.$nextTick(async () => {
|
|
|
+ this.$refs['dataForm'].resetFields();
|
|
|
if (this.dataForm.id) {
|
|
|
- this.dataForm.inspectionItemVOList = this.list.map((item) => {
|
|
|
- if (!item.inspectionItemId) {
|
|
|
- item.inspectionItemId = this.dataForm.id;
|
|
|
- item.id = '';
|
|
|
+ getById(this.dataForm.id).then(({ data }) => {
|
|
|
+ this.dataForm = data;
|
|
|
+ let itemVOList = [];
|
|
|
+ if (data.inspectionItemVOList.length > 0) {
|
|
|
+ itemVOList = data.inspectionItemVOList.map((item) => {
|
|
|
+ item.inspectionItemId = this.dataForm.id;
|
|
|
+ // item.push({
|
|
|
+ // inspectionItemId: this.dataForm.id
|
|
|
+ // });
|
|
|
+ return item;
|
|
|
+ });
|
|
|
}
|
|
|
- return item;
|
|
|
+ // this.list = data.inspectionItemVOList;
|
|
|
+ this.list = itemVOList;
|
|
|
+ console.log(this.list);
|
|
|
});
|
|
|
- } else {
|
|
|
- this.dataForm.inspectionItemVOList = this.list.map((item) => {
|
|
|
- item.id = '';
|
|
|
- return item;
|
|
|
+ templatecategoryPage({
|
|
|
+ templateId: this.dataForm.id,
|
|
|
+ size: -1
|
|
|
+ }).then((data) => {
|
|
|
+ console.log(data, 'data');
|
|
|
+ this.templateCategoryList = data.list;
|
|
|
});
|
|
|
+ // this.templateCategoryList=data.templateCategoryList||[];
|
|
|
+ } else {
|
|
|
+ const code = await getCode('template_code');
|
|
|
+ this.dataForm.qualitySchemeTemplateCode = code;
|
|
|
+ this.list = [];
|
|
|
}
|
|
|
+ });
|
|
|
+ },
|
|
|
+ saveTaskInstance(data) {
|
|
|
+ console.log(data, 'data');
|
|
|
+ this.dataForm.taskId = data.id;
|
|
|
+ this.dataForm.taskName = data.name;
|
|
|
+ },
|
|
|
+ // 表单提交
|
|
|
+ dataFormSubmit() {
|
|
|
+ this.$refs['dataForm'].validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ if (!this.dataForm.id) {
|
|
|
+ delete this.dataForm.id;
|
|
|
+ }
|
|
|
+ const saveOrUpdate = this.dataForm.id ? update : save;
|
|
|
+ if (this.dataForm.id) {
|
|
|
+ this.dataForm.inspectionItemVOList = this.list.map((item) => {
|
|
|
+ if (!item.inspectionItemId) {
|
|
|
+ item.inspectionItemId = this.dataForm.id;
|
|
|
+ item.id = '';
|
|
|
+ }
|
|
|
+ return item;
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.dataForm.inspectionItemVOList = this.list.map((item) => {
|
|
|
+ item.id = '';
|
|
|
+ return item;
|
|
|
+ });
|
|
|
+ }
|
|
|
|
|
|
- this.dataForm.templateCategoryList = this.templateCategoryList;
|
|
|
+ this.dataForm.templateCategoryList = this.templateCategoryList;
|
|
|
|
|
|
- saveOrUpdate(this.dataForm)
|
|
|
- .then((msg) => {
|
|
|
- this.loading = false;
|
|
|
- this.$refs['dataForm'].resetFields();
|
|
|
- // this.dataForm = {};
|
|
|
- const info = this.dataForm.id ? '修改成功' : '新增成功';
|
|
|
- this.$message.success(info);
|
|
|
- this.visible = false;
|
|
|
+ saveOrUpdate(this.dataForm)
|
|
|
+ .then((msg) => {
|
|
|
+ this.loading = false;
|
|
|
+ this.$refs['dataForm'].resetFields();
|
|
|
+ // this.dataForm = {};
|
|
|
+ const info = this.dataForm.id ? '修改成功' : '新增成功';
|
|
|
+ this.$message.success(info);
|
|
|
+ this.visible = false;
|
|
|
|
|
|
- this.templateCategoryList = []; // 必加:清空物品列表
|
|
|
- this.list = []; // 可选:若需清空质检项列表,可添加这行
|
|
|
- // this.updateVisible(false);
|
|
|
- this.$emit('refreshDataList');
|
|
|
- })
|
|
|
- .catch((e) => {
|
|
|
- this.loading = false;
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- },
|
|
|
- watch: {
|
|
|
- 'dataForm.type': {
|
|
|
- handler(val) {
|
|
|
- if (val == 2) {
|
|
|
- this.templateCategoryList = [];
|
|
|
+ this.templateCategoryList = []; // 必加:清空物品列表
|
|
|
+ this.list = []; // 可选:若需清空质检项列表,可添加这行
|
|
|
+ // this.updateVisible(false);
|
|
|
+ this.$emit('refreshDataList');
|
|
|
+ })
|
|
|
+ .catch((e) => {
|
|
|
+ this.loading = false;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ 'dataForm.type': {
|
|
|
+ handler(val) {
|
|
|
+ if (val == 2) {
|
|
|
+ this.templateCategoryList = [];
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
-};
|
|
|
+ };
|
|
|
</script>
|
|
|
<style lang="scss" scoped>
|
|
|
-.title {
|
|
|
- font-weight: bold;
|
|
|
- padding-bottom: 20px;
|
|
|
- padding-top: 20px;
|
|
|
-}
|
|
|
+ .title {
|
|
|
+ font-weight: bold;
|
|
|
+ padding-bottom: 20px;
|
|
|
+ padding-top: 20px;
|
|
|
+ }
|
|
|
</style>
|