|
|
<template> <div class="mod-config">
<!-- 收藏 --> <div> <span @click="favoriteFunction()"> <icon-svg :name="favorite?'xiangqufill':'xiangqu'" class="sl-svg"></icon-svg> </span> </div>
<!-- 条件查询 --> <el-form :inline="true" label-position="top" :model="searchData"> <el-form-item :label="'BU'"> <el-select v-model="searchData.buDesc" placeholder="请选择" clearable style="width: 75px"> <el-option v-for = "i in userBuList" :key = "i.buNo" :label = "i.buDesc" :value = "i.buDesc"> </el-option> </el-select> </el-form-item> <el-form-item :label="'检验单号'"> <el-input v-model="searchData.inspectionNo" clearable style="width: 140px"></el-input> </el-form-item> <el-form-item :label="'单据号'"> <el-input v-model="searchData.poOrderNo" clearable style="width: 150px"></el-input> </el-form-item> <el-form-item :label="'单据行号'"> <el-input v-model="searchData.poItemNo" clearable style="width: 120px"></el-input> </el-form-item> <el-form-item :label="'物料编码'"> <el-input v-model="searchData.partNo" clearable style="width: 120px"></el-input> </el-form-item> <el-form-item :label="'物料名称'"> <el-input v-model="searchData.partDesc" clearable style="width: 315px"></el-input> </el-form-item> </el-form> <el-form :inline="true" label-position="top" :model="searchData"> <el-form-item :label="'通知单号'"> <el-input v-model="searchData.receiptNo" clearable style="width: 144px"></el-input> </el-form-item> <el-form-item :label="'关联单号1'"> <el-input v-model="searchData.refInfo1" clearable style="width: 155px"></el-input> </el-form-item> <el-form-item :label="'关联单号2'"> <el-input v-model="searchData.refInfo2" clearable style="width: 155px"></el-input> </el-form-item> <el-form-item :label="'关联单号3'"> <el-input v-model="searchData.refInfo3" clearable style="width: 155px"></el-input> </el-form-item> <el-form-item :label="'关联单号4'"> <el-input v-model="searchData.refInfo4" clearable style="width: 155px"></el-input> </el-form-item> <el-form-item :label="'关联单号5'"> <el-input v-model="searchData.refInfo5" clearable style="width: 155px"></el-input> </el-form-item> </el-form> <el-form :inline="true" label-position="top" :model="searchData"> <el-form-item :label="'质检员'"> <el-input v-model="searchData.inspectorName" clearable style="width: 120px"></el-input> </el-form-item> <el-form-item> <span slot="label" @click="getBaseList(509)"><a herf="#">供应商编码</a></span> <el-input v-model="searchData.supplierNo" clearable style="width: 145px"></el-input> </el-form-item> <el-form-item> <span slot="label" @click="getBaseList(508)"><a herf="#">仓库编码</a></span> <el-input v-model="searchData.warehouseId" clearable style="width: 130px"></el-input> </el-form-item> <el-form-item :label="'仓库名称'"> <el-input v-model="searchData.warehouseName" clearable style="width: 200px"></el-input> </el-form-item> <el-form-item :label="'状态'"> <el-select v-model="searchData.states" multiple style="width: 340px"> <el-option label="未开始" value="未开始"></el-option> <el-option label="待检验" value="待检验"></el-option> <el-option label="待审核" value="待审核"></el-option> <el-option label="已完成" value="已完成"></el-option> </el-select> </el-form-item> </el-form> <el-form :inline="true" label-position="top" :model="searchData"> <el-form-item :label="'检验结论'"> <el-select v-model="searchData.inspectionResult" clearable style="width: 80px"> <el-option label="合格" value="合格"></el-option> <el-option label="不合格" value="不合格"></el-option> <el-option label="免检" value="免检"></el-option> </el-select> </el-form-item> <el-form-item :label="'项目检验结论'"> <el-select v-model="searchData.itemResult" clearable style="width: 80px"> <el-option label="合格" value="Y"></el-option> <el-option label="不合格" value="N"></el-option> </el-select> </el-form-item> <el-form-item :label="'处置措施'"> <el-select v-model="searchData.disposalMeasures" clearable style="width: 90px"> <el-option v-for = "i in disposalMeasuresOptions" :key = "i.id" :label = "i.disposalMeasures" :value = "i.disposalMeasures"> </el-option> </el-select> </el-form-item> <el-form-item :label="'送检日期'"> <el-date-picker style="width: 120px" v-model="searchData.startDate2" type="date" value-format='yyyy-MM-dd' format='yyyy-MM-dd' placeholder="开始日期"></el-date-picker> - <el-date-picker style="width: 120px" v-model="searchData.endDate2" type="date" value-format='yyyy-MM-dd' format='yyyy-MM-dd' placeholder="结束日期"></el-date-picker> </el-form-item> <el-form-item :label="'检验日期'"> <el-date-picker style="width: 120px" v-model="searchData.startDate" type="date" value-format='yyyy-MM-dd' format='yyyy-MM-dd' placeholder="开始日期"></el-date-picker> - <el-date-picker style="width: 120px" v-model="searchData.endDate" type="date" value-format='yyyy-MM-dd' format='yyyy-MM-dd' placeholder="结束日期"></el-date-picker> </el-form-item> <el-form-item :label="' '"> <el-button v-if="!authSearch" type="primary" @click="getDataList">查询</el-button> <el-button v-if="!authSearch" type="primary" :loading="downLoading" @click="downloadQcRecord">导出</el-button> </el-form-item> </el-form>
<!-- 展示列表 --> <el-table :height="height - 45" :data="dataList" border @row-click="IQCClickRow" :row-style="rowStyle" style="width: 100%;"> <el-table-column v-for="(item,index) in columnList" :key="index" :sortable="item.columnSortable" :prop="item.columnProp" :header-align="item.headerAlign" :show-overflow-tooltip="item.showOverflowTooltip" :align="item.align" :fixed="item.fixed==''?false:item.fixed" :width="item.columnWidth" :label="item.columnLabel"> <template slot-scope="scope"> <span v-if="!item.columnHidden"> {{ scope.row[item.columnProp] }}</span> <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span> </template> </el-table-column> <el-table-column fixed="right" header-align="center" align="center" width="90" label="操作"> <template slot-scope="scope"> <a style="cursor: pointer" @click="subDetailModal(scope.row)">检验明细</a> </template> </el-table-column> </el-table>
<el-pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" :current-page="pageIndex" :page-sizes="[20, 50, 100, 200, 500]" :page-size="pageSize" :total="totalPage" layout="total, sizes, prev, pager, next, jumper"> </el-pagination>
<el-drawer title="检验项目子明细" :visible.sync="subDetailModalFlag" direction="rtl" :with-header="false"> <div style="padding: 5px"> <el-table :height="height + 210" :data="templateTableData" border style="width: 100%;"> <el-table-column v-for="(item,index) in SubDetailColumnList" :key="index" :sortable="item.columnSortable" :prop="item.columnProp" :header-align="item.headerAlign" :show-overflow-tooltip="item.showOverflowTooltip" :align="item.align" :fixed="item.fixed==''?false:item.fixed" :min-width="item.columnWidth" :label="item.columnLabel"> <template slot-scope="scope"> <span v-if="!item.columnHidden"> {{ scope.row[item.columnProp] }}</span> <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span> </template> </el-table-column> </el-table> <!-- 分页--> <el-pagination @size-change="sizeChangeHandle2" @current-change="currentChangeHandle2" :current-page="pageIndex2" :page-sizes="[20, 50, 100, 200, 500]" :page-size="pageSize2" :total="subDetailDataList.length" layout="total, sizes, prev, pager, next, jumper"> </el-pagination> </div> </el-drawer>
<Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist> </div></template>
<script> import { getIQCReport, // 获取IQC报表
downloadQcRecord, // 导出
} from "@/api/qc/qc_report.js" import { getSiteAndBuByUserName, // 获取site bu
selectIQCSubDetailedRecord, // 查询子明细
disposalMeasuresSearch, // 获取处置措施列表
} from "@/api/qc/qc.js" import {getTableDefaultListLanguage, getTableUserListLanguage} from "@/api/table.js" import {userFavoriteList, saveUserFavorite, removeUserFavorite} from '@/api/userFavorite.js' import Chooselist from '@/views/modules/common/Chooselist_eam' export default { components: { Chooselist }, computed: { templateTableData () { let start = (this.pageIndex2 - 1) * this.pageSize2 let end = start + this.pageSize2 if (end > this.subDetailDataList.length){ end = this.subDetailDataList.length } return this.subDetailDataList.slice(start,end) } }, data () { return { // 是否收藏
favorite: false, // 导出 start
exportData: [], exportName: "IQC报表" + this.dayjs().format('YYYYMMDDHHmmss'), exportHeader: ["IQC报表"], exportFooter: [], exportList: [], // 导出 end
searchData: { site: '', userName: this.$store.state.user.name, inspectionNo: '', inspectionTypeNo: '105', isQualified: '', buDesc: '', startDate: '', endDate: '', startDate2: '', endDate2: '', partNo:'', partDesc:'', state: '', inspectionResult: '', itemResult: '', supplierNo: '', disposalMeasures: '', inspectorName: '', page: 1, limit: 10, poOrderNo: '', poItemNo: '', orderType: '', states: [], warehouseId: '', warehouseName: '', receiptNo: '', refInfo1: '', refInfo2: '', refInfo3: '', refInfo4: '', refInfo5: '', downloadType: 'iqc', }, pageIndex: 1, pageSize: 20, totalPage: 0, pageIndex2: 1, pageSize2: 50, totalPage2: 0, height: 200, dataList: [], // 标头展示
columnList: [ { userId: this.$store.state.user.name, functionId: 107001001, serialNumber: '107001001Table1State', tableId: "107001001Table1", tableName: "IQC报表", columnProp: 'state', headerAlign: "center", align: "center", columnLabel: '状态', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 100, }, { userId: this.$store.state.user.name, functionId: 107001001, serialNumber: '107001001Table1BuDesc', tableId: "107001001Table1", tableName: "IQC报表", columnProp: 'buDesc', headerAlign: "center", align: "center", columnLabel: 'BU', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 100, }, { userId: this.$store.state.user.name, functionId: 107001001, serialNumber: '107001001Table1InspectionNo', tableId: "107001001Table1", tableName: "IQC报表", columnProp: 'inspectionNo', headerAlign: "center", align: "center", columnLabel: '检验单号', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 120, }, { userId: this.$store.state.user.name, functionId: 107001001, serialNumber: '107001001Table1InspectionResult', tableId: "107001001Table1", tableName: "IQC报表", columnProp: 'inspectionResult', headerAlign: "center", align: "center", columnLabel: '检验结论', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 100, }, { userId: this.$store.state.user.name, functionId: 107001001, serialNumber: '107001001Table1TaskDate', tableId: "107001001Table1", tableName: "IQC报表", columnProp: 'taskDate', headerAlign: "center", align: "center", columnLabel: '送检日期', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 130, }, { userId: this.$store.state.user.name, functionId: 107001001, serialNumber: '107001001Table1InspectionCycle', tableId: "107001001Table1", tableName: "IQC报表", columnProp: 'inspectionCycle', headerAlign: "center", align: "right", columnLabel: '检验周期(h)', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 100, }, { userId: this.$store.state.user.name, functionId: 107001001, serialNumber: '107001001Table1RollNo', tableId: "107001001Table1", tableName: "IQC报表", columnProp: 'rollNo', headerAlign: "center", align: "center", columnLabel: '标签条码', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 120, }, { userId: this.$store.state.user.name, functionId: 107001001, serialNumber: '107001001Table1WarehouseName', tableId: "107001001Table1", tableName: "IQC报表", columnProp: 'warehouseName', headerAlign: "center", align: "left", columnLabel: '仓库', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 200, }, { userId: this.$store.state.user.name, functionId: 107001001, serialNumber: '107001001Table1PartNo', tableId: "107001001Table1", tableName: "IQC报表", columnProp: 'partNo', headerAlign: "center", align: "center", columnLabel: '物料编码', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 150, }, { userId: this.$store.state.user.name, functionId: 107001001, serialNumber: '107001001Table1PartDesc', tableId: "107001001Table1", tableName: "IQC报表", columnProp: 'partDesc', headerAlign: "center", align: "left", columnLabel: '物料名称', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 350, }, { userId: this.$store.state.user.name, functionId: 107001001, serialNumber: '107001001Table1Umid', tableId: "107001001Table1", tableName: "IQC报表", columnProp: 'umId', headerAlign: "center", align: "left", columnLabel: '计量单位', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 100, }, { userId: this.$store.state.user.name, functionId: 107001001, serialNumber: '107001001Table1RollQty', tableId: "107001001Table1", tableName: "IQC报表", columnProp: 'rollQty', headerAlign: "center", align: "right", columnLabel: '到货数量', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 100, }, { userId: this.$store.state.user.name, functionId: 107001001, serialNumber: '107001001Table1RollCount', tableId: "107001001Table1", tableName: "IQC报表", columnProp: 'rollCount', headerAlign: "center", align: "right", columnLabel: '送检数量', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 100, }, { userId: this.$store.state.user.name, functionId: 107001001, serialNumber: '107001001Table1SamplingQty', tableId: "107001001Table1", tableName: "IQC报表", columnProp: 'samplingQty', headerAlign: "center", align: "right", columnLabel: '抽样数量', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 100, }, { userId: this.$store.state.user.name, functionId: 107001001, serialNumber: '107001001Table1PassQty', tableId: "107001001Table1", tableName: "IQC报表", columnProp: 'passQty', headerAlign: "center", align: "right", columnLabel: '合格数量', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 100, }, { userId: this.$store.state.user.name, functionId: 107001001, serialNumber: '107001001Table1NotPassQty', tableId: "107001001Table1", tableName: "IQC报表", columnProp: 'notPassQty', headerAlign: "center", align: "right", columnLabel: '不合格数量', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 100, }, { userId: this.$store.state.user.name, functionId: 107001001, serialNumber: '107001001Table1PoOrderNo', tableId: "107001001Table1", tableName: "IQC报表", columnProp: 'poOrderNo', headerAlign: "center", align: "center", columnLabel: '单据号', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 130, }, { userId: this.$store.state.user.name, functionId: 107001001, serialNumber: '107001001Table1ReceiptNo', tableId: "107001001Table1", tableName: "IQC报表", columnProp: 'receiptNo', headerAlign: "center", align: "center", columnLabel: '通知单号', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 130, }, { userId: this.$store.state.user.name, functionId: 107001001, serialNumber: '107001001Table1ReceiptItemNo', tableId: "107001001Table1", tableName: "IQC报表", columnProp: 'receiptItemNo', headerAlign: "center", align: "center", columnLabel: '通知单序号', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 100, }, { userId: this.$store.state.user.name, functionId: 107001001, serialNumber: '107001001Table1RefInfo1', tableId: "107001001Table1", tableName: "IQC报表", columnProp: 'refInfo1', headerAlign: "center", align: "center", columnLabel: '关联单号1', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 130, }, { userId: this.$store.state.user.name, functionId: 107001001, serialNumber: '107001001Table1RefInfo2', tableId: "107001001Table1", tableName: "IQC报表", columnProp: 'refInfo2', headerAlign: "center", align: "center", columnLabel: '关联单号2', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 130, }, { userId: this.$store.state.user.name, functionId: 107001001, serialNumber: '107001001Table1RefInfo3', tableId: "107001001Table1", tableName: "IQC报表", columnProp: 'refInfo3', headerAlign: "center", align: "center", columnLabel: '关联单号3', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 130, }, { userId: this.$store.state.user.name, functionId: 107001001, serialNumber: '107001001Table1RefInfo4', tableId: "107001001Table1", tableName: "IQC报表", columnProp: 'refInfo4', headerAlign: "center", align: "center", columnLabel: '关联单号4', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 130, }, { userId: this.$store.state.user.name, functionId: 107001001, serialNumber: '107001001Table1RefInfo5', tableId: "107001001Table1", tableName: "IQC报表", columnProp: 'refInfo5', headerAlign: "center", align: "center", columnLabel: '关联单号5', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 130, }, { userId: this.$store.state.user.name, functionId: 107001001, serialNumber: '107001001Table1PoItemNo', tableId: "107001001Table1", tableName: "IQC报表", columnProp: 'poItemNo', headerAlign: "center", align: "right", columnLabel: '单据行号', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 100, }, { userId: this.$store.state.user.name, functionId: 107001001, serialNumber: '107001001Table1SupplierDesc', tableId: "107001001Table1", tableName: "IQC报表", columnProp: 'supplierDesc', headerAlign: "center", align: "left", columnLabel: '供应商', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 200, }, { userId: this.$store.state.user.name, functionId: 107001001, serialNumber: '107001001Table1InspectionRemark', tableId: "107001001Table1", tableName: "IQC报表", columnProp: 'inspectionRemark', headerAlign: "center", align: "left", columnLabel: '质检备注', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 200, }, { userId: this.$store.state.user.name, functionId: 107001001, serialNumber: '107001001Table1DisposalMeasures', tableId: "107001001Table1", tableName: "IQC报表", columnProp: 'disposalMeasures', headerAlign: "center", align: "center", columnLabel: '处置措施', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 120, }, { userId: this.$store.state.user.name, functionId: 107001001, serialNumber: '107001001Table1DisposalRemark', tableId: "107001001Table1", tableName: "IQC报表", columnProp: 'disposalRemark', headerAlign: "center", align: "left", columnLabel: '处置说明', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 200, }, { userId: this.$store.state.user.name, functionId: 107001001, serialNumber: '107001001Table1ActionDate', tableId: "107001001Table1", tableName: "IQC报表", columnProp: 'actionDate', headerAlign: "center", align: "center", columnLabel: '开始检验时间', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 170, }, { userId: this.$store.state.user.name, functionId: 107001001, serialNumber: '107001001Table1InspectorDate', tableId: "107001001Table1", tableName: "IQC报表", columnProp: 'inspectorDate', headerAlign: "center", align: "center", columnLabel: '检验时间', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 170, }, { userId: this.$store.state.user.name, functionId: 107001001, serialNumber: '107001001Table1InspectorName', tableId: "107001001Table1", tableName: "IQC报表", columnProp: 'inspectorName', headerAlign: "center", align: "center", columnLabel: '质检员', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 100, }, { userId: this.$store.state.user.name, functionId: 107001001, serialNumber: '107001001Table1ItemNo', tableId: "107001001Table1", tableName: "IQC报表", columnProp: 'itemNo', headerAlign: "center", align: "center", columnLabel: '检验项目编码', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 120, }, { userId: this.$store.state.user.name, functionId: 107001001, serialNumber: '107001001Table1ItemDesc', tableId: "107001001Table1", tableName: "IQC报表", columnProp: 'itemDesc', headerAlign: "center", align: "left", columnLabel: '检验项目名称', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 200, }, { userId: this.$store.state.user.name, functionId: 107001001, serialNumber: '107001001Table1DefaultValue', tableId: "107001001Table1", tableName: "IQC报表", columnProp: 'defaultValue', headerAlign: "center", align: "center", columnLabel: '标准值', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 100, }, { userId: this.$store.state.user.name, functionId: 107001001, serialNumber: '107001001Table1MaxValue', tableId: "107001001Table1", tableName: "IQC报表", columnProp: 'maxValue', headerAlign: "center", align: "right", columnLabel: '上限值', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 100, }, { userId: this.$store.state.user.name, functionId: 107001001, serialNumber: '107001001Table1MinValue', tableId: "107001001Table1", tableName: "IQC报表", columnProp: 'minValue', headerAlign: "center", align: "right", columnLabel: '下限值', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 100, }, { userId: this.$store.state.user.name, functionId: 107001001, serialNumber: '107001001Table1ItemSamplingQty', tableId: "107001001Table1", tableName: "IQC报表", columnProp: 'itemSamplingQty', headerAlign: "center", align: "right", columnLabel: '抽样数量(项目)', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 100, }, { userId: this.$store.state.user.name, functionId: 107001001, serialNumber: '107001001Table1UnqualifiedQuantity', tableId: "107001001Table1", tableName: "IQC报表", columnProp: 'unqualifiedQuantity', headerAlign: "center", align: "right", columnLabel: '不合格数量(项目)', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 120, }, { userId: this.$store.state.user.name, functionId: 107001001, serialNumber: '107001001Table1TextValue', tableId: "107001001Table1", tableName: "IQC报表", columnProp: 'textValue', headerAlign: "center", align: "center", columnLabel: '实测值', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 100, }, { userId: this.$store.state.user.name, functionId: 107001001, serialNumber: '107001001Table1ItemResultDesc', tableId: "107001001Table1", tableName: "IQC报表", columnProp: 'itemResultDesc', headerAlign: "center", align: "center", columnLabel: '项目检验结论', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 100, }, ], SubDetailColumnList: [ { userId: this.$store.state.user.name, functionId: 107001001, serialNumber: '107001001Table2SamplingLocation', tableId: "107001001Table2", tableName: "IQC子明细", columnProp: 'samplingLocation', headerAlign: "center", align: "center", columnLabel: '抽样位置A', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 100, }, { userId: this.$store.state.user.name, functionId: 107001001, serialNumber: '107001001Table2SamplingLocationB', tableId: "107001001Table2", tableName: "IQC子明细", columnProp: 'samplingLocationB', headerAlign: "center", align: "center", columnLabel: '抽样位置B', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 100, }, { userId: this.$store.state.user.name, functionId: 107001001, serialNumber: '107001001Table2SubDetailValue', tableId: "107001001Table2", tableName: "IQC子明细", columnProp: 'subDetailValue', headerAlign: "center", align: "center", columnLabel: '实测值', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 100, }, ], options: [], userBuList: [], authSearch: false, menuId: this.$route.meta.menuId, subDetailModalFlag: false, subDetailDataList: [], currentRow: {}, disposalMeasuresOptions: [], downLoading: false } },
mounted () { this.$nextTick(() => { this.height = window.innerHeight - 250 }) },
created () { // 按钮控制
this.getButtonAuthData() // 获取用户的 site 和 bu
this.getSiteAndBuByUserName() // 获取处置措施
this.disposalMeasuresSearch() // 校验用户是否收藏
this.favoriteIsOk() // 动态列
this.getTableUserColumn(this.$route.meta.menuId+'table1',1) if (!this.authSearch) { // 获取数据列表
this.getDataList() } },
methods: {
// 导出按钮
downloadQcRecord () { this.downLoading = true downloadQcRecord(this.searchData) .then(response => { const blob = new Blob([response.data],{ type: 'application/vnd.ms-excel'}); const url = window.URL.createObjectURL(blob); const link= document.createElement('a'); link.href = url; link.download='IQC报表.xlsx';// 设置下载文件名
link.click(); window.URL.revokeObjectURL(url);//释放URL对象
this.downLoading = false }).catch(()=>{ this.downLoading = false }) },
// 单机选中
IQCClickRow (row) { this.currentRow = JSON.parse(JSON.stringify(row)) },
rowStyle ({row}) { if (this.currentRow.inspectionNo === row.inspectionNo && this.currentRow.itemNo === row.itemNo) { return { 'background-color': '#E8F7F6', cursor: 'pointer' } } },
// 获取用户的bu
getSiteAndBuByUserName () { let tempData = { username: this.$store.state.user.name, } getSiteAndBuByUserName(tempData).then(({data}) => { if (data.code === 0) { this.userBuList = data.rows } }) },
// 每页数
sizeChangeHandle (val) { this.pageSize = val this.pageIndex = 1 this.getDataList() },
// 当前页
currentChangeHandle (val) { this.pageIndex = val this.getDataList() },
// 查询获取数据列表
getDataList () { this.searchData.limit = this.pageSize this.searchData.page = this.pageIndex getIQCReport(this.searchData).then(({data}) => { if (data.code === 0) { this.dataList = data.page.list this.pageIndex = data.page.currPage this.pageSize = data.page.pageSize this.totalPage = data.page.totalCount } }) },
// 子明细每页数
sizeChangeHandle2 (val) { this.pageSize2 = val },
// 子明细当前页
currentChangeHandle2 (val) { this.pageIndex2 = val },
// 打开子明细
subDetailModal (row) { this.pageIndex2 = 1 selectIQCSubDetailedRecord(row).then(({data}) => { if (data && data.code === 0) { this.subDetailDataList = data.rows this.subDetailModalFlag = true } }) },
// 获取处置措施列表
disposalMeasuresSearch () { let tempData = { inspectionTypeNo: '105' } disposalMeasuresSearch(tempData).then(({data}) => { if (data.code === 0) { this.disposalMeasuresOptions = data.rows } }) },
// 获取基础数据列表S
getBaseList (val,type) { this.tagNo = val this.$nextTick(() => { let strVal = '' if (val === 508) { strVal = this.searchData.warehouseId this.$refs.baseList.init(val, strVal) } if (val === 509) { strVal = this.searchData.supplierNo this.$refs.baseList.init(val, strVal) } }) },
// 列表方法的回调
getBaseData (val) { if (this.tagNo === 508) { this.searchData.warehouseId = val.WareHouseID } if (this.tagNo === 509) { this.searchData.supplierNo = val.SupplierID } },
// 校验用户是否收藏
favoriteIsOk () { let userFavorite = { userId: this.$store.state.user.id, languageCode: this.$i18n.locale } userFavoriteList(userFavorite).then(({data}) => { for (let i = 0; i < data.list.length; i++) { if(this.$route.meta.menuId === data.list[i].menuId){ this.favorite = true } } }) },
// 收藏 OR 取消收藏
favoriteFunction () { let userFavorite = { userId: this.$store.state.user.id, functionId: this.$route.meta.menuId, } if (this.favorite) { removeUserFavorite(userFavorite).then(({data}) => { this.$message.success(data.msg) this.favorite = false }) } else { // 收藏
saveUserFavorite(userFavorite).then(({data}) => { this.$message.success(data.msg) this.favorite = true }) } },
//导出excel
async createExportData() { this.searchData.limit = -1 this.searchData.page = 1 await getIQCReport(this.searchData).then(({data}) => { this.exportList = data.page.list }) return this.exportList },
startDownload() {},
finishDownload() {},
fields () { let json = "{" this.columnList.forEach((item, index) => { if (index == this.columnList.length - 1) { json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\"" } else { json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\"" + "," } }) json += "}" let s = eval("(" + json + ")") return s },
// 动态列开始 获取 用户保存的 格式列
async getTableUserColumn (tableId, columnId) { let queryTableUser = { userId: this.$store.state.user.name, functionId: this.$route.meta.menuId, tableId: tableId, status: true, languageCode: this.$i18n.locale } await getTableUserListLanguage(queryTableUser).then(({data}) => { if (data.rows.length > 0) { switch (columnId) { case 1: this.columnList = data.rows break } } else { this.getColumnList(tableId, columnId) } }) },
// 获取 tableDefault 列
async getColumnList (tableId, columnId) { let queryTable = { functionId: this.$route.meta.menuId, tableId: tableId, languageCode: this.$i18n.locale } await getTableDefaultListLanguage(queryTable).then(({data}) => { if (!data.rows.length === 0) { switch (columnId) { case 1: this.columnList = data.rows break } } }) },
//获取按钮的权限数据
getButtonAuthData () { let searchFlag = this.isAuth(this.menuId+":search") //处理页面的权限数据
this.authSearch = !searchFlag }, } }</script><style scoped>.el-table /deep/ .cell{ height: auto; line-height: 1.5;}</style>
|