| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368 |
- <template>
- <ele-modal
- title="合格证列表"
- :visible.sync="visible"
- width="90%"
- append-to-body
- >
- <div class="ele-body">
- <el-card shadow="never">
- <!-- 搜索表单 -->
- <search @search="reload" />
- <!-- 数据表格 -->
- <ele-pro-table
- ref="table"
- :columns="columns"
- :datasource="datasource"
- row-key="code"
- :page-size="20"
- @columns-change="handleColumnChange"
- :cache-key="cacheKeyUrl"
- :selection.sync="selection"
- :needPage="false"
- height="500px"
- full-height="calc(100vh - 200px)"
- >
- <template v-slot:type="{ row }">{{
- getDictValue('质检计划类型', row.type)
- }}</template>
- </ele-pro-table>
- </el-card>
- </div>
- <div slot="footer">
- <el-button type="primary" @click="save()"> 确认 </el-button>
- <el-button @click="visible = false">关闭</el-button>
- </div>
- </ele-modal>
- </template>
- <script>
- import search from './search.vue';
- import tabMixins from '@/mixins/tableColumnsMixin';
- import { getList } from '@/api/certificateManagement';
- import dictMixins from '@/mixins/dictMixins';
- export default {
- components: {
- search
- },
- mixins: [dictMixins, tabMixins],
- data() {
- return {
- cacheKeyUrl: 'qsm-c2e9664a-certificateManagement',
- selection: [],
- orderTypeList: [
- {
- id: 0,
- label: '库存性订单'
- },
- {
- id: 1,
- label: '生产性订单'
- },
- {
- id: 2,
- label: '无客户生产性订单'
- },
- {
- id: 4,
- label: '不定向订单'
- }
- ],
- visible: false,
- // 表格列配置
- columns: []
- };
- },
- created() {
- this.requestDict('质检计划类型');
- this.requestDict('取样类型');
- },
- methods: {
- open() {
- this.visible = true;
- this.setColumns();
- },
- duplicateChecking() {
- let is = false;
- let key = ['type', 'batchNo', 'produceTaskName', 'orderNo'];
- key.forEach((_key) => {
- if (
- this.selection.some((item) => item[_key] != this.selection[0][_key])
- ) {
- is = true;
- }
- });
- // if(){
- // }
- return is;
- },
- save() {
- if (!this.selection.length) {
- this.$message.error('请选择合格证');
- return;
- }
- if (this.selection.length > 1 && this.duplicateChecking()) {
- this.$message.warning(
- '合格证类型、批次号、工序、订单号必须保持一致!'
- );
- return;
- }
- this.visible = false;
- let data = this.selection[0];
- this.$emit('success', {
- batchNo: data.batchNo,
- certificateId: this.selection.map((item) => item.id).toString(),
- contractor: data.contractor,
- generateType: 2,
- isMerged: 1,
- luxuryProductCode: data.luxuryProductCode,
- luxuryProductName: data.luxuryProductName,
- orderNo: data.orderNo,
- orderType: data.orderType,
- productCode: data.productCode,
- productName: data.productName,
- processingType: data.processingType,
- produceTaskCode: data.produceTaskCode,
- produceTaskId: data.produceTaskId,
- produceTaskName: data.produceTaskName,
- qualityWorkOrderId: data.qualityWorkOrderId,
- // reportTemplateId: data.reportTemplateId,
- // reportTemplateCode: data.reportTemplateCode,
- // reportTemplateName: data.reportTemplateName,
- type: data.type,
- workAme: data.workAme,
- qualifiedQuantity: this.selection.reduce(
- (total, item) => total + item.qualifiedQuantity,
- 0
- ),
- quantity: this.selection.reduce(
- (total, item) => total + item.quantity,
- 0
- )
- });
- },
- setColumns() {
- this.columns = [
- {
- columnKey: 'index',
- label: '序号',
- type: 'index',
- width: 55,
- align: 'center',
- showOverflowTooltip: true,
- fixed: 'left'
- },
- {
- width: 45,
- type: 'selection',
- columnKey: 'selection',
- align: 'center'
- },
- {
- prop: 'code',
- slot: 'code',
- label: '合格证号',
- showOverflowTooltip: true,
- align: 'center',
- minWidth: 130
- },
- {
- prop: 'quantity',
- label: '交验数量',
- showOverflowTooltip: true,
- align: 'center',
- minWidth: 100
- },
- {
- prop: 'qualifiedQuantity',
- label: '合格数量',
- showOverflowTooltip: true,
- align: 'center',
- minWidth: 110
- },
- {
- prop: 'type',
- label: '类型',
- slot: 'type',
- showOverflowTooltip: true,
- align: 'center',
- minWidth: 110
- },
- // {
- // prop: 'remark',
- // minWidth: 180,
- // label: '重要记事',
- // align: 'center',
- // showOverflowTooltip: true
- // },
- {
- prop: 'produceTaskName',
- minWidth: 110,
- label: '工序名称',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: 'produceTaskCode',
- minWidth: 110,
- label: '工序编号',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: 'batchNo',
- minWidth: 110,
- label: '批次号',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: 'orderNo',
- label: '订单号',
- showOverflowTooltip: true,
- align: 'center',
- minWidth: 140
- },
- {
- prop: 'luxuryProductCode',
- minWidth: 110,
- label: '顶级产品编码',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: 'luxuryProductName',
- 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: 'executeDeptName',
- // label: '下发数量',
- // showOverflowTooltip: true,
- // align: 'center',
- // minWidth: 110
- // },
- {
- prop: 'measureUnit',
- minWidth: 110,
- label: '计量单位',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: 'processingType',
- minWidth: 110,
- label: '加工类型',
- align: 'center',
- formatter: (row) => {
- return row.processingType == 2
- ? '加工'
- : row.processingType == 3
- ? '装配'
- : '';
- },
- showOverflowTooltip: true
- },
- {
- prop: 'workAme',
- minWidth: 110,
- label: '作业名称',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: 'contractor',
- minWidth: 110,
- label: '承制单位',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: 'orderType',
- minWidth: 110,
- label: '订单类型',
- align: 'center',
- formatter: (_row, _column, cellValue) => {
- let obj = this.orderTypeList.find(
- (el) => el.id == _row.orderType
- );
- return obj ? obj.label : '';
- },
- 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',
- showOverflowTooltip: true
- },
- {
- prop: 'approvalTime',
- minWidth: 110,
- label: '审批时间',
- align: 'center',
- showOverflowTooltip: true
- }
- ].filter((el) => !el.isNone);
- },
- /*回显类型 */
- /* 表格数据源 */
- datasource({ page, where, limit }) {
- return getList({
- ...where,
- generateType: 1,
- isMerged: 0,
- pageNum: 1,
- size: 999
- });
- },
- /* 刷新表格 */
- reload(where) {
- this.$refs.table.reload({ page: 1, where: where });
- }
- }
- };
- </script>
|