| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591 |
- <template>
- <div class="ele-body">
- <el-card shadow="never">
- <!-- 搜索表单 -->
- <search @search="reload" />
- <!-- 数据表格 -->
- <ele-pro-table
- ref="table"
- :columns="columns"
- :datasource="datasource"
- :selection.sync="selection"
- row-key="code"
- :page-size="20"
- @columns-change="handleColumnChange"
- :cache-key="cacheKeyUrl"
- >
- <!-- 表头工具栏 -->
- <template v-slot:qualityType="{ row }">
- {{ getDictValue('质检计划类型', row.qualityType) }}
- </template>
- <template v-slot:qualityMode="{ row }">
- {{ getDictValue('取样类型', row.qualityMode) }}
- </template>
- <template v-slot:code="{ row }">
- <el-link
- type="primary"
- :underline="false"
- @click="report(row, 'detail')"
- >{{ row.code }}</el-link
- >
- </template>
- <template v-slot:approvalStatus="{ row }">
- <el-link
- v-if="row.processInstanceId"
- type="primary"
- :underline="false"
- @click="bpmDetailOpen(row, 'detail')"
- >{{ reviewStatus[row.approvalStatus] }}
- </el-link>
- <span v-else> {{ reviewStatus[row.approvalStatus] }}</span>
- </template>
- <!-- 操作列 -->
- <template v-slot:action="{ row }">
- <el-link
- type="primary"
- :underline="false"
- icon="el-icon-edit"
- @click="openEdit(row)"
- v-if="
- [0, 3].includes(row.approvalStatus) &&
- pageName == 'inspectionProjectRequest'
- "
- >
- 编辑
- </el-link>
- <el-link
- type="primary"
- :underline="false"
- v-if="
- [0, 3].includes(row.approvalStatus) &&
- pageName == 'inspectionProjectRequest'
- "
- @click="approvalSubmit(row)"
- >提交</el-link
- >
- <!-- <el-link
- type="primary"
- :underline="false"
- v-if="
- [2].includes(row.approvalStatus) &&
- pageName == 'inspectionProjectEntrusted' &&
- row.status == 0
- "
- @click="sampleCollection(row)"
- >收样</el-link
- > -->
- <el-link
- type="primary"
- :underline="false"
- v-if="
- [2].includes(row.approvalStatus) &&
- pageName == 'inspectionProjectEntrusted' &&
- row.status == 1
- "
- @click="report(row, 'edit')"
- >报工</el-link
- >
- <el-link
- type="primary"
- :underline="false"
- v-if="
- [2].includes(row.approvalStatus) &&
- pageName == 'inspectionProjectEntrusted' &&
- row.status == 1
- "
- @click="openTransfer(row)"
- >转派</el-link
- >
- <!-- <el-link
- v-if="row.qualityWorkOrderId"
- type="primary"
- :underline="false"
- @click="craftFiles(row.qualityWorkOrderId)"
- >工艺文件</el-link
- > -->
- <el-link
- type="danger"
- :underline="false"
- icon="el-icon-edit"
- @click="remove(row)"
- v-if="
- [0, 3].includes(row.approvalStatus) &&
- pageName == 'inspectionProjectRequest'
- "
- >
- 删除
- </el-link>
- </template>
- </ele-pro-table>
- </el-card>
- <!-- 编辑弹窗 -->
- <inspectionProjectTaskSend
- ref="inspectionProjectTaskSendRef"
- @reload="reload"
- />
- <!-- 编辑弹窗 -->
- <inspectionProjectReport
- ref="inspectionProjectReportRef"
- @reload="reload"
- />
- <processSubmitDialog
- :processSubmitDialogFlag.sync="processSubmitDialogFlag"
- v-if="processSubmitDialogFlag"
- ref="processSubmitDialogRef"
- @reload="reload"
- ></processSubmitDialog>
- <Transfer
- v-if="transferVisible"
- :transferVisible.sync="transferVisible"
- @success="transferConfirm"
- :id="transferId"
- ></Transfer>
- <ele-modal
- :visible.sync="bpmDetailShow"
- :close-on-click-modal="false"
- :close-on-press-escape="false"
- append-to-body
- width="70%"
- :maxable="true"
- >
- <bpmDetail
- v-if="bpmDetailShow && processInstanceId"
- :id="processInstanceId"
- ></bpmDetail>
- <template v-slot:footer>
- <el-button @click="bpmDetailShow = false">关闭</el-button>
- </template>
- </ele-modal>
- </div>
- </template>
- <script>
- import search from './components/search.vue';
- import Transfer from './components/transfer.vue';
- import tabMixins from '@/mixins/tableColumnsMixin';
- import inspectionProjectTaskSend from '@/views/inspectionProjectTask/components/inspectionProjectTaskSend.vue';
- import inspectionProjectReport from '@/views/inspectionWork/components/inspectionProjectReport.vue';
- import {
- getList,
- sampleCollection,
- getById,
- verificationQualityInspector,
- removeItem
- } from '@/api/inspectionProjectRequest';
- import { craftFiles } from '@/api/inspectionWork';
- import dictMixins from '@/mixins/dictMixins';
- import { reviewStatus } from '@/enum/dict';
- import processSubmitDialog from '@/components/processSubmitDialog/processSubmitDialog.vue';
- import bpmDetail from '@/views/bpm/processInstance/detail.vue';
- import { recordingMethodList } from '@/utils/util.js';
- export default {
- components: {
- search,
- inspectionProjectTaskSend,
- processSubmitDialog,
- inspectionProjectReport,
- Transfer,
- bpmDetail
- },
- props: {
- cacheKeyUrl: {
- type: String,
- default: 'qsm-c2e9664a-inspectionProjectRequest'
- },
- pageName: {
- type: String,
- default: 'inspectionProjectRequest'
- }
- },
- mixins: [dictMixins, tabMixins],
- data() {
- return {
- processSubmitDialogFlag: false,
- transferVisible: false,
- reviewStatus,
- transferId: '',
- processInstanceId: '',
- bpmDetailShow: false,
- // 表格列配置
- columns: []
- };
- },
- created() {
- this.requestDict('质检计划类型');
- this.requestDict('取样类型');
- this.getColumns();
- },
- methods: {
- bpmDetailOpen(row) {
- this.bpmDetailShow = true;
- this.processInstanceId = row.processInstanceId;
- },
- getColumns() {
- this.columns = [
- {
- columnKey: 'index',
- label: '序号',
- type: 'index',
- width: 55,
- align: 'center',
- showOverflowTooltip: true,
- fixed: 'left'
- },
- {
- prop: 'code',
- slot: 'code',
- label: '请托单号',
- showOverflowTooltip: true,
- align: 'center',
- minWidth: 130
- },
- {
- prop: 'name',
- label: '任务名称',
- showOverflowTooltip: true,
- align: 'center',
- minWidth: 110
- },
- {
- prop: 'receiveDeptName',
- label: '接收部门',
- showOverflowTooltip: true,
- align: 'center',
- minWidth: 110
- },
- {
- prop: 'receiveUserName',
- minWidth: 110,
- label: '接收人员',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: 'executeDeptName',
- label: '执行部门',
- showOverflowTooltip: true,
- align: 'center',
- minWidth: 110
- },
- {
- prop: 'executeUserName',
- minWidth: 110,
- label: '执行人员',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: 'requiredCompletionTime',
- minWidth: 110,
- label: '完成日期',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: 'urgent',
- minWidth: 110,
- label: '紧急程度',
- align: 'center',
- formatter: (row) => {
- return row.urgent == 1
- ? '普通'
- : row.urgent == 2
- ? '紧急'
- : '重要';
- },
- showOverflowTooltip: true
- },
- {
- prop: 'qualityWorkOrderCode',
- minWidth: 110,
- label: '质检工单编码',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: 'qualityWorkOrderName',
- minWidth: 110,
- label: '质检工单名称',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: 'sourceCode',
- minWidth: 110,
- label: '来源单号',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: 'qualityType',
- slot: 'qualityType',
- minWidth: 110,
- label: '类型',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- slot: 'qualityMode',
- prop: 'qualityMode',
- minWidth: 110,
- label: '质检方式',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: 'productCode',
- minWidth: 110,
- label: '编码',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: 'productName',
- minWidth: 110,
- label: '名称',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: 'batchNo',
- minWidth: 110,
- label: '批次号',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: 'specification',
- minWidth: 110,
- label: '规格',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: 'brandNo',
- minWidth: 110,
- label: '牌号',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: 'produceTaskName',
- minWidth: 110,
- label: '工序名称',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: 'recordingMethod',
- label: '记录方法',
- align: 'center',
- formatter: (row) => {
- return (
- recordingMethodList.find(
- (item) => item.value == row.recordingMethod
- )?.label || ''
- );
- },
- width: 130,
- showOverflowTooltip: true
- },
- {
- prop: 'status',
- minWidth: 110,
- label: '状态',
- align: 'center',
- formatter: (row) => {
- return row.status == 1
- ? '未报工'
- : row.status == 2
- ? '已报工'
- : '';
- },
- showOverflowTooltip: true
- },
- {
- prop: 'approvalStatus',
- slot: 'approvalStatus',
- label: '审核状态',
- align: 'center',
- minWidth: 110,
- showOverflowTooltip: true
- },
- {
- prop: 'createUserName',
- minWidth: 110,
- label: '创建人',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: 'createTime',
- minWidth: 110,
- label: '创建时间',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: 'approvalUserName',
- minWidth: 110,
- label: '审核人',
- align: 'center',
- // isNone: this.pageName != 'inspectionProjectEntrusted',
- showOverflowTooltip: true
- },
- {
- prop: 'approvalTime',
- minWidth: 110,
- label: '审核时间',
- align: 'center',
- // isNone: this.pageName != 'inspectionProjectEntrusted',
- showOverflowTooltip: true
- },
- {
- prop: 'sampleReceiverName',
- minWidth: 110,
- label: '收样人',
- align: 'center',
- // isNone: this.pageName != 'inspectionProjectEntrusted',
- showOverflowTooltip: true
- },
- {
- prop: 'sampleReceiverTime',
- minWidth: 110,
- label: '收样时间',
- // isNone: this.pageName != 'inspectionProjectEntrusted',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- columnKey: 'action',
- label: '操作',
- width: 220,
- align: 'center',
- resizable: false,
- slot: 'action',
- fixed: 'right',
- showOverflowTooltip: true
- }
- ].filter((item) => !item.isNone);
- },
- approvalSubmit(res) {
- this.processSubmitDialogFlag = true;
- this.$nextTick(() => {
- let params = {
- businessId: res.id,
- businessKey: 'quality_inspection_item_entrustment',
- formCreateUserId: res.createUserId,
- variables: {
- businessCode: res.code,
- businessName: res.name,
- businessType: '请托'
- }
- };
- this.$refs.processSubmitDialogRef.init(params);
- });
- },
- /*回显类型 */
- /* 表格数据源 */
- datasource({ page, where, limit }) {
- return getList({
- ...where,
- pageNum: page,
- size: limit
- });
- },
- /* 刷新表格 */
- reload(where) {
- this.$refs.table.reload({ page: 1, where: where });
- },
- /* 打开编辑弹窗 */
- openEdit(row) {
- this.$refs.inspectionProjectTaskSendRef.open(
- row,
- '2',
- 'inspectionProjectRequest'
- );
- },
- /* 报工 */
- async report(row, type) {
- if (type != 'detail') {
- const code = await verificationQualityInspector(row.id);
- if (code == '-1') {
- return;
- }
- }
- const res = await getById(row.id);
- this.$refs.inspectionProjectReportRef.open(
- {
- workData: { ...res, measureUnit: res.sampleMeasureUnit },
- list: res.templateList
- },
- type,
- 'inspectionProjectRequest'
- );
- },
- // async craftFiles(id) {
- // if (id) {
- // const data = await craftFiles(id);
- // if (data.length) {
- // this.$nextTick(() => {
- // this.$refs.fileListRef.open(
- // data.map((item) => item.id),
- // 'view'
- // );
- // });
- // }
- // }
- // },
- async sampleCollection(row) {
- const code = await verificationQualityInspector(row.id);
- if (code == '-1') {
- return;
- }
- sampleCollection({ id: row.id }).then((res) => {
- this.$message.success('收样成功');
- this.reload();
- });
- },
- async openTransfer(row) {
- const code = await verificationQualityInspector(row.id);
- if (code == '-1') {
- return;
- }
- this.transferVisible = true;
- this.transferId = row.id;
- },
- transferConfirm() {
- this.transferVisible = false;
- this.$message.success('转派成功');
- this.reload();
- },
- /* 删除 */
- remove(row) {
- const loading = this.$loading({ lock: true });
- removeItem([row.id])
- .then((msg) => {
- loading.close();
- this.$message.success('删除' + msg);
- this.reload();
- })
- .catch((e) => {
- loading.close();
- });
- }
- }
- };
- </script>
|