|
|
<template> <div class="mod-config"> <el-form label-position="top" style="margin-top: 1px; margin-left: 0px;"> <el-form :inline="true" label-position="top" style="margin-top: 0px"> <download-excel :fields="fields()" :data="exportData" type="xls" :name="exportName" :header="exportHeader" :footer="exportFooter" :fetch="createExportData" :before-generate="startDownload" :before-finish="finishDownload" worksheet="导出信息" class="el-button el-button--primary el-button--medium"> {{ '导出' }} </download-excel> </el-form> </el-form> <el-table :data="dataList" height="240" border v-loading="dataListLoading" 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" :min-width="item.columnWidth" :label="item.columnLabel"> <template slot-scope="scope"> <div v-if="item.columnProp === 'testNo'"> <el-link v-if="!item.columnHidden" @click="handleClick(scope.row)">{{ scope.row[item.columnProp] }}</el-link> <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span> </div> <div v-else> <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> </div> </template> </el-table-column> </el-table> </div></template>
<script>import { quotationInformationSearch, // 测试信息列表查询
} from '@/api/quotation/quotationInformation.js'import {testInformationList} from "../../../../api/test/testInformation";export default { data() { return { dataList: [], searchData: { site: '', username: this.$store.state.user.name, projectId: '', page: 1, limit: 1000 }, visible: false, dataListLoading: false, currentRow: '', columnList: [ { userId: this.$store.state.user.name, functionId: 103001, serialNumber: '103001Table1TestNo', tableId: '103001Table1', tableName: '测试信息表', columnProp: 'testNo', 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: 103001, serialNumber: '103001Table1TrackerName', tableId: '103001Table1', tableName: '测试信息表', columnProp: 'trackerName', headerAlign: 'center', align: 'center', columnLabel: 'Artwork', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 80 }, { userId: this.$store.state.user.name, functionId: 103001, serialNumber: '103001Table1EngineerName', tableId: '103001Table1', tableName: '测试信息表', columnProp: 'engineerName', headerAlign: 'center', align: 'center', columnLabel: ' TP工程师', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 80 }, { userId: this.$store.state.user.name, functionId: 103001, serialNumber: '103001Table1TestPartNo', tableId: '103001Table1', tableName: '测试信息表', columnProp: 'plmPartNo', headerAlign: 'center', align: 'left', columnLabel: 'PLM物料编码', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 150 }, { userId: this.$store.state.user.name, functionId: 102001, serialNumber: '102001Table1FinalPartNo', tableId: '102001Table1', tableName: '询价信息表', columnProp: 'finalPartNo', headerAlign: 'center', align: 'left', columnLabel: 'IFS物料编码', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 80 }, { userId: this.$store.state.user.name, functionId: 103001, serialNumber: '103001Table1PartName', tableId: '103001Table1', tableName: '测试信息表', columnProp: 'partName', 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: 102001, serialNumber: '102001Table1CustomerPartNo', tableId: '102001Table1', tableName: '询价信息表', columnProp: 'customerPartNo', headerAlign: 'center', align: 'left', columnLabel: '客户料号', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 80 }, { userId: this.$store.state.user.name, functionId: 103001, serialNumber: '103001Table1PriorityLevel', tableId: '103001Table1', tableName: '测试信息表', columnProp: 'priorityLevel', headerAlign: 'center', align: 'center', columnLabel: '优先等级', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 80 }, { userId: this.$store.state.user.name, functionId: 103001, serialNumber: '103001Table1TestNumber', tableId: '103001Table1', tableName: '测试信息表', columnProp: 'testNumber', headerAlign: 'center', align: 'center', columnLabel: '测试数量', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 80 }, { userId: this.$store.state.user.name, functionId: 103001, serialNumber: '103001Table1RequiredDeliveryDate', tableId: '103001Table1', tableName: '测试信息表', columnProp: 'requiredDeliveryDate', headerAlign: 'center', align: 'center', columnLabel: '要求交付日期', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 160 }, { userId: this.$store.state.user.name, functionId: 103001, serialNumber: '103001Table1TestStatus', tableId: '103001Table1', tableName: '测试信息表', columnProp: 'testStatus', headerAlign: 'center', align: 'center', columnLabel: '状态', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 80 }, { userId: this.$store.state.user.name, functionId: 103001, serialNumber: '103001Table1NodeName', tableId: '103001Table1', tableName: '测试信息表', columnProp: 'nodeName', headerAlign: 'center', align: 'center', columnLabel: '节点名称', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 80 }, { userId: this.$store.state.user.name, functionId: 103001, serialNumber: '103001Table1NodeCreateBy', tableId: '103001Table1', tableName: '测试信息表', columnProp: 'nodeCreateBy', headerAlign: 'center', align: 'center', columnLabel: '节点审批人', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 80 }, ], // 导出 start
exportData: [], exportName: '项目测试' + this.dayjs().format('YYYYMMDDHHmmss'), exportHeader: ["项目测试"], exportFooter: [], // 导出 end
} }, methods: { //初始化组件的参数
init(inData) { //初始化参数
this.searchData = JSON.parse(JSON.stringify(inData)); //刷新表格
this.searchTable(); }, searchTable() { testInformationList(this.searchData).then(({data}) => { //区分请求成功和失败的状况
if (data && data.code === 0) { this.dataList = data.rows } else { this.dataList = []; } }); }, createExportData() { return this.dataList; }, 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 }, handleClick(row){ if (this.$router.resolve(`/test-requestForTest`).resolved.name === '404'){ this.$alert('权限不足,访问失败', '警告', {confirmButtonText: '确定',}); }else { this.$router.push({name:`test-requestForTest`,params:{testNo:row.testNo},}) } } },}</script>
<style scoped>
</style>
|