| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401 |
- <template>
- <ele-modal
- title="首件两检报工"
- :visible.sync="dialogVisible"
- width="95%"
- :before-close="handleClose"
- append-to-body
- :maxable="true"
- :close-on-click-modal="false"
- :close-on-press-escape="false"
- >
- <div class="two-layout">
- <el-row :gutter="10" class="full-row">
- <el-col :span="12" class="full-col">
- <div class="pane">
- <div class="pane-title">首件两检</div>
- <div
- v-show="leftMode === 'list'"
- class="fill-box"
- v-loading="loading"
- >
- <ele-pro-table
- ref="table"
- row-key="id"
- :columns="columns"
- :datasource="list"
- cache-key="mes-ruleRecordsList-20260208-1"
- autoAmendPage
- :need-page="false"
- @refresh="getData"
- height="calc(80vh - 160px)"
- >
- <template v-slot:selfCheck="{ row }">
- <el-button
- type="primary"
- @click="selfRequest(row)"
- v-if="row.status == 0"
- >自检请托</el-button
- >
- <el-button
- type="primary"
- :disabled="row.status != 0"
- @click="reportClick(row, 1)"
- >{{ row.status == 0 ? '报工' : '已报工' }}</el-button
- >
- <el-button
- type="primary"
- v-if="row.status == 2 || row.status == 3"
- @click="reportClick(row, 1, 'detail')"
- >详情</el-button
- >
- </template>
- <template
- v-slot:specialInspection="{ row }"
- v-if="
- $hasPermission(
- 'mes:firstarticledualinspectionitem:specialreport'
- )
- "
- >
- <el-button
- type="primary"
- :disabled="row.status != 2"
- @click="reportClick(row, 2)"
- >{{ row.status == 3 ? '已报工' : '报工' }}</el-button
- >
- <el-button
- type="primary"
- v-if="row.status == 3"
- @click="reportClick(row, 2, 'detail')"
- >详情</el-button
- >
- </template>
- <template v-slot:status="{ row }">
- <el-tag v-if="row.status == 0">待自检</el-tag>
- <el-tag v-if="row.status == 2">待专检</el-tag>
- <el-tag v-if="row.status == 3">已完成</el-tag>
- </template>
- </ele-pro-table>
- </div>
- <self-inspection-reporting
- v-if="leftMode === 'report'"
- ref="selfReportingRef"
- @cancel="backToList"
- @success="reportSuccess"
- />
- <self-inspection-request
- v-if="leftMode === 'request'"
- ref="selfRequestRef"
- @cancel="backToList"
- @success="reportSuccess"
- />
- </div>
- </el-col>
- <el-col :span="12" class="full-col">
- <div class="pane">
- <div class="pane-title">工艺文件</div>
- <wokePopup ref="wokePopupRef"></wokePopup>
- </div>
- </el-col>
- </el-row>
- </div>
- <!-- <self-inspection-reporting
- ref="selfReportingRef"
- @refreshData="getData"
- ></self-inspection-reporting>
- <self-inspection-request
- ref="selfRequestRef"
- @refreshData="getData"
- ></self-inspection-request> -->
- </ele-modal>
- </template>
- <script>
- import { getQualityInspectionList } from '@/api/produce/qualityInspection.js';
- import dictMixins from '@/mixins/dictMixins';
- import tableColumnsMixin from '@/mixins/tableColumnsMixin';
- import selfInspectionReporting from './components/selfInspectionReporting.vue';
- import selfInspectionRequest from './components/selfInspectionRequest.vue';
- import wokePopup from '../picking/newWokePopup.vue';
- import { parameterGetByCode } from '@/api/system/dictionary-data';
- export default {
- mixins: [dictMixins, tableColumnsMixin],
- components: {
- selfInspectionReporting,
- selfInspectionRequest,
- wokePopup
- },
- data() {
- return {
- dialogVisible: false,
- loading: false,
- produceTaskInfo: null,
- workOrder: null,
- butLoad: false,
- list: [],
- type: '',
- leftMode: 'list',
- currentRow: null,
- reportType: null
- };
- },
- computed: {
- columns() {
- return [
- {
- width: 50,
- type: 'index',
- columnKey: 'index',
- label: '序号',
- align: 'center'
- },
- {
- prop: 'name',
- label: '名称',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 150
- },
- {
- prop: 'assignObjectName',
- label: '工位名称',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 150
- },
- {
- prop: 'deviceName',
- label: '设备名称',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 150
- },
- {
- prop: 'selfCheckUserName',
- label: '自检报工人',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 120
- },
- {
- prop: 'selfCheckTime',
- label: '自检时间',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 120
- },
- {
- prop: 'specialCheckUserName',
- label: '专检报工人',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 120
- },
- {
- prop: 'specialCheckTime',
- label: '专检时间',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 120
- },
- {
- prop: 'status',
- slot: 'status',
- label: '状态',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 100
- },
- {
- label: '自检报工',
- align: 'center',
- width: 150,
- fixed: 'right',
- slot: 'selfCheck'
- },
- {
- label: '专检报工',
- align: 'center',
- width: 150,
- fixed: 'right',
- slot: 'specialInspection'
- }
- ];
- }
- },
- methods: {
- async open(workOrder, produceTaskInfo, type, req) {
- // 每次打开重置子界面,避免仍停留在上一次的报工/请托或残留行数据
- this.leftMode = 'list';
- this.currentRow = null;
- this.reportType = null;
- this.workOrder = workOrder;
- this.produceTaskInfo = produceTaskInfo;
- this.type = type;
- this.dialogVisible = true;
- this.getData();
- const res = await parameterGetByCode({
- code: 'mes_craft_file_by_category_code'
- });
- const byCategory = res?.value === '1';
- if (byCategory) {
- this.$refs.wokePopupRef.openTwo(req);
- } else {
- this.$refs.wokePopupRef.open(req);
- }
- },
- // 获取数据
- async getData() {
- this.loading = true;
- try {
- const isSourceTask = this.type == 1;
- const params = {
- produceTaskId: isSourceTask
- ? this.produceTaskInfo?.sourceTaskId
- : this.produceTaskInfo?.id,
- produceTaskInstanceId: isSourceTask
- ? this.produceTaskInfo?.id
- : this.workOrder?.taskId,
- ...(isSourceTask
- ? { type: 2, assigneeId: this.workOrder?.id }
- : { workOrderId: this.workOrder?.id })
- };
- const { list = [] } = await getQualityInspectionList(params);
- this.list = list;
- } catch (error) {
- this.list = [];
- } finally {
- this.loading = false;
- }
- },
- handleClose() {
- this.dialogVisible = false;
- this.leftMode = 'list';
- this.currentRow = null;
- this.reportType = null;
- this.$emit('close');
- },
- async handleUpdate() {
- try {
- this.butLoad = true;
- await this.getData();
- this.$message.success('已更新');
- this.butLoad = false;
- } catch (error) {
- this.butLoad = false;
- }
- },
- // selfRequest(row) {
- // this.$refs.selfRequestRef.open(row, this.workOrder);
- // },
- selfRequest(row) {
- this.currentRow = row;
- this.leftMode = 'request';
- this.$nextTick(() => {
- this.$refs.selfRequestRef.open(row, this.workOrder);
- });
- },
- // reportClick(row, type, mode) {
- // this.$refs.selfReportingRef.open(row, type, mode);
- // }
- reportClick(row, type, mode) {
- this.currentRow = row;
- this.reportType = type;
- this.leftMode = 'report';
- this.$nextTick(() => {
- this.$refs.selfReportingRef.open(row, type, mode);
- });
- },
- async backToList() {
- this.leftMode = 'list';
- await this.getData();
- },
- async reportSuccess() {
- this.leftMode = 'list';
- await this.getData();
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- .two-layout {
- height: 80vh;
- display: flex;
- flex-direction: column;
- }
- .full-row {
- flex: 1;
- height: 100%;
- }
- .full-col {
- height: 100%;
- }
- .pane {
- height: 100%;
- background: #fff;
- border-radius: 4px;
- padding: 10px;
- display: flex;
- flex-direction: column;
- min-height: 0;
- }
- // .step-list {
- // height: 60vh;
- // display: flex;
- // flex-direction: column;
- // }
- /* 表格父级 */
- .table-wrapper {
- flex: 1;
- min-height: 0;
- display: flex;
- }
- .pane-title {
- font-size: 16px;
- font-weight: 600;
- color: #03541c;
- padding-bottom: 10px;
- margin-bottom: 10px;
- border-bottom: 1px solid #ebeef5;
- flex-shrink: 0;
- }
- </style>
|