|
@@ -1,444 +1,236 @@
|
|
|
<template>
|
|
<template>
|
|
|
<div style="margin-top: 10px; padding: 0 20px">
|
|
<div style="margin-top: 10px; padding: 0 20px">
|
|
|
<el-form ref="formRef" :model="form" :rules="rules" label-width="100px">
|
|
<el-form ref="formRef" :model="form" :rules="rules" label-width="100px">
|
|
|
- <header-title title="基本信息"></header-title>
|
|
|
|
|
|
|
+ <header-title title="基本信息" />
|
|
|
|
|
|
|
|
<el-row :gutter="10">
|
|
<el-row :gutter="10">
|
|
|
<el-col :span="8">
|
|
<el-col :span="8">
|
|
|
<el-form-item label="放行单编码">
|
|
<el-form-item label="放行单编码">
|
|
|
- <el-input
|
|
|
|
|
- v-model="form.code"
|
|
|
|
|
- placeholder="系统自动生成"
|
|
|
|
|
- disabled
|
|
|
|
|
- ></el-input>
|
|
|
|
|
|
|
+ <el-input v-model="form.code" disabled placeholder="系统自动生成" />
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
<el-col :span="8">
|
|
|
<el-form-item label="放行单名称" prop="name">
|
|
<el-form-item label="放行单名称" prop="name">
|
|
|
- <el-input
|
|
|
|
|
- v-model="form.name"
|
|
|
|
|
- placeholder="请输入"
|
|
|
|
|
- disabled
|
|
|
|
|
- ></el-input>
|
|
|
|
|
|
|
+ <el-input v-model="form.name" disabled placeholder="请输入" />
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
</el-row>
|
|
</el-row>
|
|
|
|
|
|
|
|
- <header-title title="物品清单"> </header-title>
|
|
|
|
|
-
|
|
|
|
|
|
|
+ <header-title title="物品清单" />
|
|
|
<ele-pro-table
|
|
<ele-pro-table
|
|
|
ref="table"
|
|
ref="table"
|
|
|
row-key="userId"
|
|
row-key="userId"
|
|
|
:columns="ordersColumns"
|
|
:columns="ordersColumns"
|
|
|
:datasource="form.orders"
|
|
:datasource="form.orders"
|
|
|
- >
|
|
|
|
|
- <!-- <template v-slot:action="{ row }">
|
|
|
|
|
- <el-link icon="el-icon-edit" type="primary" :underline="false"
|
|
|
|
|
- >详情</el-link
|
|
|
|
|
- >
|
|
|
|
|
- </template> -->
|
|
|
|
|
- </ele-pro-table>
|
|
|
|
|
-
|
|
|
|
|
- <header-title title="生产放行规则"> </header-title>
|
|
|
|
|
|
|
+ />
|
|
|
|
|
|
|
|
|
|
+ <header-title title="生产放行规则" />
|
|
|
<ele-pro-table
|
|
<ele-pro-table
|
|
|
- ref="scTable"
|
|
|
|
|
row-key="id"
|
|
row-key="id"
|
|
|
:columns="detailsColumns"
|
|
:columns="detailsColumns"
|
|
|
:datasource="scDetails"
|
|
:datasource="scDetails"
|
|
|
>
|
|
>
|
|
|
- <template v-slot:isPass="{ row }">
|
|
|
|
|
- <el-radio-group v-model="row.isPass">
|
|
|
|
|
|
|
+ <template #isPass="{ row }">
|
|
|
|
|
+ <el-radio-group v-model="row.isPass" :disabled="isScDisabled">
|
|
|
<el-radio :label="1">是</el-radio>
|
|
<el-radio :label="1">是</el-radio>
|
|
|
<el-radio :label="0">否</el-radio>
|
|
<el-radio :label="0">否</el-radio>
|
|
|
</el-radio-group>
|
|
</el-radio-group>
|
|
|
</template>
|
|
</template>
|
|
|
- <template v-slot:remark="{ row }">
|
|
|
|
|
|
|
+
|
|
|
|
|
+ <template #remark="{ row }">
|
|
|
<el-input
|
|
<el-input
|
|
|
- type="textarea"
|
|
|
|
|
v-model="row.remark"
|
|
v-model="row.remark"
|
|
|
- placeholder="请输入备注"
|
|
|
|
|
|
|
+ type="textarea"
|
|
|
:rows="1"
|
|
:rows="1"
|
|
|
- ></el-input>
|
|
|
|
|
|
|
+ :disabled="isScDisabled"
|
|
|
|
|
+ placeholder="请输入备注"
|
|
|
|
|
+ />
|
|
|
</template>
|
|
</template>
|
|
|
</ele-pro-table>
|
|
</ele-pro-table>
|
|
|
|
|
|
|
|
- <!-- <table
|
|
|
|
|
- class="detail-table"
|
|
|
|
|
- key="first-table"
|
|
|
|
|
- style="width: 500px; margin: 15px 0"
|
|
|
|
|
- >
|
|
|
|
|
- <tr>
|
|
|
|
|
- <td>结论</td>
|
|
|
|
|
- <td>
|
|
|
|
|
- <el-radio-group v-model="form.workConclution">
|
|
|
|
|
- <el-radio :label="0">不符合规定</el-radio>
|
|
|
|
|
- <el-radio :label="1">符合规定</el-radio>
|
|
|
|
|
- </el-radio-group>
|
|
|
|
|
- </td>
|
|
|
|
|
- </tr>
|
|
|
|
|
- <tr>
|
|
|
|
|
- <td>验收人</td>
|
|
|
|
|
- <td>
|
|
|
|
|
- <div class="mask-box">
|
|
|
|
|
- <el-input
|
|
|
|
|
- v-model="form.workCheckUserName"
|
|
|
|
|
- placeholder="请输选择验收人"
|
|
|
|
|
- readonly
|
|
|
|
|
- ></el-input>
|
|
|
|
|
- </div>
|
|
|
|
|
- </td>
|
|
|
|
|
- </tr>
|
|
|
|
|
- <tr>
|
|
|
|
|
- <td>验收时间</td>
|
|
|
|
|
- <td>
|
|
|
|
|
- <el-date-picker
|
|
|
|
|
- v-model="form.workCheckTime"
|
|
|
|
|
- type="datetime"
|
|
|
|
|
- placeholder="选择日期时间"
|
|
|
|
|
- style="width: 100%"
|
|
|
|
|
- value-format="yyyy-MM-dd HH:mm:ss"
|
|
|
|
|
- ></el-date-picker>
|
|
|
|
|
- </td>
|
|
|
|
|
- </tr>
|
|
|
|
|
- </table> -->
|
|
|
|
|
-
|
|
|
|
|
- <header-title title="质检放行规则"></header-title>
|
|
|
|
|
-
|
|
|
|
|
|
|
+ <header-title title="质检放行规则" />
|
|
|
<ele-pro-table
|
|
<ele-pro-table
|
|
|
- ref="zjTable"
|
|
|
|
|
row-key="id"
|
|
row-key="id"
|
|
|
:columns="detailsColumns"
|
|
:columns="detailsColumns"
|
|
|
:datasource="zjDetails"
|
|
:datasource="zjDetails"
|
|
|
>
|
|
>
|
|
|
- <template v-slot:isPass="{ row }">
|
|
|
|
|
- <el-radio-group v-model="row.isPass">
|
|
|
|
|
|
|
+ <template #isPass="{ row }">
|
|
|
|
|
+ <el-radio-group v-model="row.isPass" :disabled="isZjDisabled">
|
|
|
<el-radio :label="1">是</el-radio>
|
|
<el-radio :label="1">是</el-radio>
|
|
|
<el-radio :label="0">否</el-radio>
|
|
<el-radio :label="0">否</el-radio>
|
|
|
</el-radio-group>
|
|
</el-radio-group>
|
|
|
</template>
|
|
</template>
|
|
|
- <template v-slot:remark="{ row }">
|
|
|
|
|
|
|
+
|
|
|
|
|
+ <template #remark="{ row }">
|
|
|
<el-input
|
|
<el-input
|
|
|
- type="textarea"
|
|
|
|
|
v-model="row.remark"
|
|
v-model="row.remark"
|
|
|
- placeholder="请输入备注"
|
|
|
|
|
|
|
+ type="textarea"
|
|
|
:rows="1"
|
|
:rows="1"
|
|
|
- ></el-input>
|
|
|
|
|
|
|
+ :disabled="isZjDisabled"
|
|
|
|
|
+ placeholder="请输入备注"
|
|
|
|
|
+ />
|
|
|
</template>
|
|
</template>
|
|
|
</ele-pro-table>
|
|
</ele-pro-table>
|
|
|
-
|
|
|
|
|
- <!-- <table
|
|
|
|
|
- class="detail-table"
|
|
|
|
|
- key="tow"
|
|
|
|
|
- style="width: 500px; margin: 15px 0"
|
|
|
|
|
- >
|
|
|
|
|
- <tr>
|
|
|
|
|
- <td>结论</td>
|
|
|
|
|
- <td>
|
|
|
|
|
- <el-radio-group v-model="form.qualityConclution">
|
|
|
|
|
- <el-radio :label="0">不符合规定</el-radio>
|
|
|
|
|
- <el-radio :label="1">符合规定</el-radio>
|
|
|
|
|
- </el-radio-group>
|
|
|
|
|
- </td>
|
|
|
|
|
- </tr>
|
|
|
|
|
- <tr>
|
|
|
|
|
- <td>验收人</td>
|
|
|
|
|
- <td>
|
|
|
|
|
- <div class="mask-box" @click="openSelectUser(1)">
|
|
|
|
|
- <el-input
|
|
|
|
|
- v-model="form.qualityCheckUserName"
|
|
|
|
|
- placeholder="请输选择验收人"
|
|
|
|
|
- readonly
|
|
|
|
|
- ></el-input>
|
|
|
|
|
- </div>
|
|
|
|
|
- </td>
|
|
|
|
|
- </tr>
|
|
|
|
|
- <tr>
|
|
|
|
|
- <td>验收时间</td>
|
|
|
|
|
- <td>
|
|
|
|
|
- <el-date-picker
|
|
|
|
|
- v-model="form.qualityCheckTime"
|
|
|
|
|
- type="datetime"
|
|
|
|
|
- placeholder="选择日期时间"
|
|
|
|
|
- style="width: 100%"
|
|
|
|
|
- value-format="yyyy-MM-dd HH:mm:ss"
|
|
|
|
|
- ></el-date-picker>
|
|
|
|
|
- </td>
|
|
|
|
|
- </tr>
|
|
|
|
|
- </table> -->
|
|
|
|
|
</el-form>
|
|
</el-form>
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
import dictMixins from '@/mixins/dictMixins';
|
|
import dictMixins from '@/mixins/dictMixins';
|
|
|
- import { checklisttemplateGetById } from '@/api/checklisttemplate/index';
|
|
|
|
|
import { checklistrecordGetById } from '@/api/checklistrecord/index';
|
|
import { checklistrecordGetById } from '@/api/checklistrecord/index';
|
|
|
|
|
|
|
|
|
|
+ /** 常量 */
|
|
|
|
|
+ const CHECK_TYPE = {
|
|
|
|
|
+ SC: 1, // 生产
|
|
|
|
|
+ ZJ: 2 // 质检
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
export default {
|
|
export default {
|
|
|
mixins: [dictMixins],
|
|
mixins: [dictMixins],
|
|
|
- components: {},
|
|
|
|
|
|
|
+
|
|
|
props: {
|
|
props: {
|
|
|
- // 业务id
|
|
|
|
|
- businessId: {
|
|
|
|
|
- default: ''
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
- mounted() {
|
|
|
|
|
- console.log('this.businessId', this.businessId);
|
|
|
|
|
- this.getCheckDetails(this.businessId);
|
|
|
|
|
|
|
+ businessId: { default: '' },
|
|
|
|
|
+ tasks: { type: Array, default: () => [] }
|
|
|
},
|
|
},
|
|
|
|
|
+
|
|
|
data() {
|
|
data() {
|
|
|
const formBaseData = {
|
|
const formBaseData = {
|
|
|
id: null,
|
|
id: null,
|
|
|
approvalStatus: null,
|
|
approvalStatus: null,
|
|
|
checklistType: 0,
|
|
checklistType: 0,
|
|
|
code: '',
|
|
code: '',
|
|
|
- createUserName: '',
|
|
|
|
|
- details: [],
|
|
|
|
|
name: '',
|
|
name: '',
|
|
|
orders: [],
|
|
orders: [],
|
|
|
- processInstanceId: '',
|
|
|
|
|
- qualityCheckTime: '',
|
|
|
|
|
- qualityCheckUserId: null,
|
|
|
|
|
- qualityCheckUserName: '',
|
|
|
|
|
- qualityConclution: null,
|
|
|
|
|
- templateId: 0,
|
|
|
|
|
- templateName: '',
|
|
|
|
|
- workCheckTime: '',
|
|
|
|
|
- workCheckUserId: null,
|
|
|
|
|
- workCheckUserName: '',
|
|
|
|
|
- workConclution: null
|
|
|
|
|
|
|
+ details: [],
|
|
|
|
|
+ workConclution: null,
|
|
|
|
|
+ qualityConclution: null
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
return {
|
|
return {
|
|
|
- visible: false,
|
|
|
|
|
- title: '放行申请单',
|
|
|
|
|
|
|
+ loading: false,
|
|
|
|
|
+ nodeType: '',
|
|
|
formBaseData,
|
|
formBaseData,
|
|
|
form: JSON.parse(JSON.stringify(formBaseData)),
|
|
form: JSON.parse(JSON.stringify(formBaseData)),
|
|
|
- rules: {
|
|
|
|
|
- name: [
|
|
|
|
|
- { required: true, message: '请输入放行单名称', trigger: 'blur' },
|
|
|
|
|
- { required: true, message: '请输入放行单名称', trigger: 'change' }
|
|
|
|
|
- ]
|
|
|
|
|
- },
|
|
|
|
|
- // 类型 add / edit / detail
|
|
|
|
|
- type: '',
|
|
|
|
|
- // 生产工单查询条件
|
|
|
|
|
- workOrderWhere: {
|
|
|
|
|
- statusList: ['6']
|
|
|
|
|
- },
|
|
|
|
|
- loading: false,
|
|
|
|
|
- butLoading: false,
|
|
|
|
|
- tabOptions: [
|
|
|
|
|
- { key: 'main', name: '放行单详情' },
|
|
|
|
|
- { key: 'bpm', name: '流程详情' }
|
|
|
|
|
- ],
|
|
|
|
|
- // 当前选项
|
|
|
|
|
- activeComp: 'main',
|
|
|
|
|
- showSelectUser: false,
|
|
|
|
|
- // 0 生产验收人 1 质检验收人
|
|
|
|
|
- selectUserType: 0
|
|
|
|
|
|
|
+ rules: {}
|
|
|
};
|
|
};
|
|
|
},
|
|
},
|
|
|
|
|
+
|
|
|
|
|
+ mounted() {
|
|
|
|
|
+ const currentTask = this.tasks.find((v) => v.result === 1);
|
|
|
|
|
+ this.nodeType = currentTask?.definitionKey || '';
|
|
|
|
|
+ this.getCheckDetails(this.businessId);
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
watch: {
|
|
watch: {
|
|
|
'form.details': {
|
|
'form.details': {
|
|
|
|
|
+ deep: true,
|
|
|
handler(details) {
|
|
handler(details) {
|
|
|
- console.log('details', details);
|
|
|
|
|
- // 区分生产放行规则 质检放行规则
|
|
|
|
|
- // 根据 审核结果修改 结论
|
|
|
|
|
- const scDetails = details.filter((item) => item.checkType == 1);
|
|
|
|
|
- const zjDetails = details.filter((item) => item.checkType == 2);
|
|
|
|
|
-
|
|
|
|
|
- // 当workConclution全为1 则为1 否则为0
|
|
|
|
|
- if (scDetails.length > 0) {
|
|
|
|
|
- const allPass = scDetails
|
|
|
|
|
- .map((item) => item.isPass)
|
|
|
|
|
- .every((val) => val === 1);
|
|
|
|
|
- this.form.workConclution = allPass ? 1 : 0;
|
|
|
|
|
- } else {
|
|
|
|
|
- this.form.workConclution = null;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- if (zjDetails.length > 0) {
|
|
|
|
|
- const allPass = zjDetails
|
|
|
|
|
- .map((item) => item.isPass)
|
|
|
|
|
- .every((val) => val == 1);
|
|
|
|
|
- this.form.qualityConclution = allPass ? 1 : 0;
|
|
|
|
|
- } else {
|
|
|
|
|
- this.form.qualityConclution = null;
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
- deep: true
|
|
|
|
|
|
|
+ this.updateConclution(details);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
|
|
+
|
|
|
computed: {
|
|
computed: {
|
|
|
|
|
+ /** 表格 columns 不再重复创建 */
|
|
|
ordersColumns() {
|
|
ordersColumns() {
|
|
|
return [
|
|
return [
|
|
|
- {
|
|
|
|
|
- width: 55,
|
|
|
|
|
- type: 'index',
|
|
|
|
|
- columnKey: 'index',
|
|
|
|
|
- label: '序号',
|
|
|
|
|
- align: 'center'
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- prop: 'batchNo',
|
|
|
|
|
- label: '批次号',
|
|
|
|
|
- align: 'center',
|
|
|
|
|
- minWidth: 110,
|
|
|
|
|
- showOverflowTooltip: true
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- prop: 'productCode',
|
|
|
|
|
- label: '产品编码',
|
|
|
|
|
- align: 'center',
|
|
|
|
|
- minWidth: 110,
|
|
|
|
|
- showOverflowTooltip: true
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- prop: 'productName',
|
|
|
|
|
- label: '产品名称',
|
|
|
|
|
- align: 'center',
|
|
|
|
|
- minWidth: 110,
|
|
|
|
|
- showOverflowTooltip: true
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- prop: 'workOrderCode',
|
|
|
|
|
- label: '生产工单号',
|
|
|
|
|
- align: 'center',
|
|
|
|
|
- minWidth: 110,
|
|
|
|
|
- showOverflowTooltip: true
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- prop: 'formingNum',
|
|
|
|
|
- label: '数量',
|
|
|
|
|
- align: 'center',
|
|
|
|
|
- minWidth: 110,
|
|
|
|
|
- showOverflowTooltip: true
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- prop: 'specification',
|
|
|
|
|
- label: '规格',
|
|
|
|
|
- align: 'center',
|
|
|
|
|
- minWidth: 110,
|
|
|
|
|
- showOverflowTooltip: true
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- prop: 'productModel',
|
|
|
|
|
- label: '型号',
|
|
|
|
|
- align: 'center',
|
|
|
|
|
- minWidth: 110,
|
|
|
|
|
- showOverflowTooltip: true
|
|
|
|
|
- }
|
|
|
|
|
- // ,
|
|
|
|
|
- // {
|
|
|
|
|
- // label: '操作',
|
|
|
|
|
- // columnKey: 'action',
|
|
|
|
|
- // slot: 'action',
|
|
|
|
|
- // minWidth: 120
|
|
|
|
|
- // }
|
|
|
|
|
|
|
+ { type: 'index', width: 55, label: '序号', align: 'center' },
|
|
|
|
|
+ { prop: 'batchNo', label: '批次号', align: 'center' },
|
|
|
|
|
+ { prop: 'productCode', label: '产品编码', align: 'center' },
|
|
|
|
|
+ { prop: 'productName', label: '产品名称', align: 'center' },
|
|
|
|
|
+ { prop: 'workOrderCode', label: '生产工单号', align: 'center' },
|
|
|
|
|
+ { prop: 'formingNum', label: '数量', align: 'center' },
|
|
|
|
|
+ { prop: 'specification', label: '规格', align: 'center' },
|
|
|
|
|
+ { prop: 'productModel', label: '型号', align: 'center' }
|
|
|
|
|
+ ];
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ detailsColumns() {
|
|
|
|
|
+ return [
|
|
|
|
|
+ { type: 'index', width: 55, label: '序号', align: 'center' },
|
|
|
|
|
+ { prop: 'mainIndicatorName', label: '指标名称', align: 'center' },
|
|
|
|
|
+ { prop: 'isPass', label: '审核结果', slot: 'isPass' },
|
|
|
|
|
+ { prop: 'remark', label: '备注', slot: 'remark' }
|
|
|
];
|
|
];
|
|
|
},
|
|
},
|
|
|
- // 生产放行规则
|
|
|
|
|
|
|
+
|
|
|
scDetails() {
|
|
scDetails() {
|
|
|
- return this.form.details.filter((item) => item.checkType == 1);
|
|
|
|
|
|
|
+ return this.form.details.filter((v) => v.checkType === CHECK_TYPE.SC);
|
|
|
},
|
|
},
|
|
|
- // 质检放行规则
|
|
|
|
|
|
|
+
|
|
|
zjDetails() {
|
|
zjDetails() {
|
|
|
- return this.form.details.filter((item) => item.checkType == 2);
|
|
|
|
|
|
|
+ return this.form.details.filter((v) => v.checkType === CHECK_TYPE.ZJ);
|
|
|
},
|
|
},
|
|
|
- detailsColumns() {
|
|
|
|
|
- return [
|
|
|
|
|
- {
|
|
|
|
|
- width: 55,
|
|
|
|
|
- type: 'index',
|
|
|
|
|
- columnKey: 'index',
|
|
|
|
|
- label: '序号',
|
|
|
|
|
- align: 'center'
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- prop: 'mainIndicatorName',
|
|
|
|
|
- label: '指标名称',
|
|
|
|
|
- align: 'center',
|
|
|
|
|
- minWidth: 110,
|
|
|
|
|
- showOverflowTooltip: true
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- prop: 'isPass',
|
|
|
|
|
- label: '审核结果',
|
|
|
|
|
- align: 'center',
|
|
|
|
|
- slot: 'isPass',
|
|
|
|
|
- minWidth: 110,
|
|
|
|
|
- showOverflowTooltip: true
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- prop: 'remark',
|
|
|
|
|
- label: '备注',
|
|
|
|
|
- align: 'center',
|
|
|
|
|
- slot: 'remark',
|
|
|
|
|
- minWidth: 110,
|
|
|
|
|
- showOverflowTooltip: true
|
|
|
|
|
- }
|
|
|
|
|
- ];
|
|
|
|
|
|
|
+
|
|
|
|
|
+ isScDisabled() {
|
|
|
|
|
+ return ['qualityApproval', 'leaderApproval'].includes(this.nodeType);
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ isZjDisabled() {
|
|
|
|
|
+ return ['workOrderApproval', 'leaderApproval'].includes(this.nodeType);
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
|
|
+
|
|
|
methods: {
|
|
methods: {
|
|
|
- // 获取放行单详情
|
|
|
|
|
|
|
+ /** 获取详情 */
|
|
|
async getCheckDetails(id) {
|
|
async getCheckDetails(id) {
|
|
|
this.loading = true;
|
|
this.loading = true;
|
|
|
try {
|
|
try {
|
|
|
const data = await checklistrecordGetById(id);
|
|
const data = await checklistrecordGetById(id);
|
|
|
this.$util.assignObject(this.form, data);
|
|
this.$util.assignObject(this.form, data);
|
|
|
- console.log('this.form', this.form);
|
|
|
|
|
- this.loading = false;
|
|
|
|
|
- } catch (error) {
|
|
|
|
|
|
|
+ this.form.details.forEach((d) => (d._originIsPass = d.isPass));
|
|
|
|
|
+ } finally {
|
|
|
this.loading = false;
|
|
this.loading = false;
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
- getValidate() {
|
|
|
|
|
- return Promise.all([
|
|
|
|
|
- new Promise((resolve, reject) => {
|
|
|
|
|
- this.$refs.form.validate((valid) => {
|
|
|
|
|
- if (!valid) {
|
|
|
|
|
- reject(false);
|
|
|
|
|
- } else {
|
|
|
|
|
- resolve(true);
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- }),
|
|
|
|
|
- new Promise((resolve, reject) => {
|
|
|
|
|
- this.$refs.inventoryTable.validateForm((valid) => {
|
|
|
|
|
- if (!valid) {
|
|
|
|
|
- reject(false);
|
|
|
|
|
- } else {
|
|
|
|
|
- resolve(true);
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- })
|
|
|
|
|
- ]);
|
|
|
|
|
|
|
+ /** 统一结论计算 */
|
|
|
|
|
+ updateConclution(details) {
|
|
|
|
|
+ const calc = (type) => {
|
|
|
|
|
+ const list = details.filter((v) => v.checkType === type);
|
|
|
|
|
+ if (!list.length) return null;
|
|
|
|
|
+ return list.every((v) => v.isPass === 1) ? 1 : 0;
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ this.form.workConclution = calc(CHECK_TYPE.SC);
|
|
|
|
|
+ this.form.qualityConclution = calc(CHECK_TYPE.ZJ);
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
|
|
+ /** 提交校验 */
|
|
|
async getTableValue() {
|
|
async getTableValue() {
|
|
|
- try {
|
|
|
|
|
- const invalidItem = this.form.details.find(
|
|
|
|
|
- (item) => item.isPass !== 0 && item.isPass !== 1
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ const typeMap = {
|
|
|
|
|
+ workOrderApproval: CHECK_TYPE.SC,
|
|
|
|
|
+ qualityApproval: CHECK_TYPE.ZJ
|
|
|
|
|
+ };
|
|
|
|
|
|
|
|
- if (invalidItem) {
|
|
|
|
|
|
|
+ const needCheckType = typeMap[this.nodeType];
|
|
|
|
|
+ if (needCheckType) {
|
|
|
|
|
+ const invalid = this.form.details.find(
|
|
|
|
|
+ (v) => v.checkType === needCheckType && ![0, 1].includes(v.isPass)
|
|
|
|
|
+ );
|
|
|
|
|
+ if (invalid) {
|
|
|
this.$message.warning('请先完成所有放行规则的审核结果选择');
|
|
this.$message.warning('请先完成所有放行规则的审核结果选择');
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- const commitData = {
|
|
|
|
|
- formData: this.form
|
|
|
|
|
- };
|
|
|
|
|
- return commitData;
|
|
|
|
|
- } catch (error) {
|
|
|
|
|
- console.log(error);
|
|
|
|
|
|
|
+ const changeList = this.form.details
|
|
|
|
|
+ .filter((v) => v.isPass !== v._originIsPass)
|
|
|
|
|
+ .map((v) => ({
|
|
|
|
|
+ id: v.id,
|
|
|
|
|
+ isPass: v.isPass,
|
|
|
|
|
+ remark: v.remark
|
|
|
|
|
+ }));
|
|
|
|
|
+
|
|
|
|
|
+ if (changeList.some((v) => !v.remark?.trim())) {
|
|
|
|
|
+ this.$message.warning('请填写备注');
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ return {
|
|
|
|
|
+ formData: this.form,
|
|
|
|
|
+ changeList
|
|
|
|
|
+ };
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|