| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253 |
- <template>
- <el-dialog
- title="首件两检报工"
- :visible.sync="dialogVisible"
- width="85%"
- :before-close="handleClose"
- >
- <div>
- <div class="step-list" v-loading="loading">
- <ele-pro-table
- ref="table"
- row-key="id"
- :columns="columns"
- :datasource="list"
- cache-key="mes-ruleRecordsList-2511172018"
- autoAmendPage
- :need-page="false"
- @refresh="getData"
- >
- <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 }">
- <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>
- </div>
- <self-inspection-reporting
- ref="selfReportingRef"
- @refreshData="getData"
- ></self-inspection-reporting>
- <self-inspection-request
- ref="selfRequestRef"
- @refreshData="getData"
- ></self-inspection-request>
- </el-dialog>
- </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';
- export default {
- mixins: [dictMixins, tableColumnsMixin],
- components: {
- selfInspectionReporting,
- selfInspectionRequest
- },
- data() {
- return {
- dialogVisible: false,
- loading: false,
- produceTaskInfo: null,
- workOrder: null,
- butLoad: false,
- list: [],
- type: ''
- };
- },
- computed: {
- columns() {
- return [
- {
- width: 50,
- type: 'index',
- columnKey: 'index',
- label: '序号',
- align: 'center'
- },
- {
- prop: 'name',
- label: '名称',
- align: 'center',
- showOverflowTooltip: true,
- minWidth: 150
- },
- {
- prop: 'workstationName',
- 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: {
- open(workOrder, produceTaskInfo, type) {
- this.workOrder = workOrder;
- this.produceTaskInfo = produceTaskInfo;
- this.type = type;
- this.dialogVisible = true;
- this.getData();
- },
- // 获取数据
- async getData() {
- this.loading = true;
- try {
- const isSourceTask = this.type == 1;
- const params = {
- workOrderId: this.workOrder?.id,
- produceTaskId: isSourceTask
- ? this.produceTaskInfo?.sourceTaskId
- : this.produceTaskInfo?.id,
- produceTaskInstanceId: isSourceTask
- ? this.produceTaskInfo?.id
- : this.workOrder?.taskId
- };
- const { list = [] } = await getQualityInspectionList(params);
- this.list = list;
- } catch (error) {
- this.list = [];
- } finally {
- this.loading = false;
- }
- },
- handleClose() {
- this.dialogVisible = false;
- 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);
- },
- reportClick(row, type, mode) {
- this.$refs.selfReportingRef.open(row, type, mode);
- }
- }
- };
- </script>
- <style lang="scss" scoped></style>
|