|
|
<template> <div> <el-form :inline="true" label-position="top" :model="searchData" @keyup.enter.native="getDataList()"> <el-form-item :label="'BU'"> <el-select v-model="searchData.buDesc" placeholder="请选择" clearable style="width: 130px"> <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.projectNo" style="width: 120px"></el-input> </el-form-item> <el-form-item :label="'项目名称'"> <el-input v-model="searchData.projectDesc" style="width: 120px"></el-input> </el-form-item> <el-form-item :label="'项目料号'"> <el-input v-model="searchData.testPartNo" style="width: 120px"></el-input> </el-form-item> <el-form-item :label="'料号描述'"> <el-input v-model="searchData.partDesc" style="width: 120px"></el-input> </el-form-item> <el-form-item :label="'客户编码'"> <el-input v-model="searchData.customerNo" style="width: 120px"></el-input> </el-form-item> <el-form-item :label="'客户名称'"> <el-input v-model="searchData.customerDesc" style="width: 120px"></el-input> </el-form-item> <el-form-item :label="'项目分类'"> <el-select v-model="searchData.projectCategory" placeholder="请选择" clearable style="width: 130px"> <el-option v-for = "i in projectCategoryList" :key = "i.projectCategory" :label = "i.projectCategory" :value = "i.projectCategory"> </el-option> </el-select> </el-form-item> <el-form-item :label="'项目状态'"> <el-select v-model="searchData.status" placeholder="请选择" clearable style="width: 130px"> <el-option v-for = "i in statusList" :key = "i.status" :label = "i.status" :value = "i.status"> </el-option> </el-select> </el-form-item> <el-form-item :label="'立项日期:'"> <el-date-picker style="width: 120px" v-model="searchData.startDate" type="date" value-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" placeholder="选择日期"> </el-date-picker> </el-form-item> <!-- <el-form-item :label="'在用'">--> <!-- <el-select filterable v-model="searchData.active" style="width: 130px">--> <!-- <el-option label="全部" value=""></el-option>--> <!-- <el-option label="是" value="Y"></el-option>--> <!-- <el-option label="否" value="N"></el-option>--> <!-- </el-select>--> <!-- </el-form-item>--> <el-form-item :label="' '"> <el-button @click="getDataList()">查询</el-button> </el-form-item> </el-form>
<el-table :data="dataList" border :height="height" style="width: 100%;margin-top: 0px;"> <el-table-column v-for="(item,index) in columnProjectList" :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-column header-align="center" align="center" width="70" prop="userDisplay" label="指定确认人"></el-table-column> <el-table-column header-align="center" align="center" :formatter="formatDate" prop="wantedConfirmDate" label="要求确认日期"></el-table-column> <el-table-column header-align="center" align="center" prop="confirmFlag" label="是否确认"></el-table-column> <el-table-column header-align="center" align="center" prop="confirmedBy" label="实际确认人"></el-table-column> <el-table-column header-align="center" align="center" prop="remark" label="备注"></el-table-column> <el-table-column header-align="center" align="center" prop="confirmedDate" label="实际确认时间"></el-table-column> <el-table-column header-align="center" align="center" prop="createDate" label="推送时间"></el-table-column> <el-table-column header-align="center" align="center" prop="createBy" label="推送人"></el-table-column> <el-table-column header-align="center" align="center" width="90" fixed="left" label="操作"> <template slot-scope="scope"> <a type="text" size="small" @click="toMes(scope.row)">项目信息</a> <a type="text" size="small" @click="confirmDocument(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-dialog title="确认" @close="closeUploadFileVisible" :visible.sync="confirmVisible" width="579px" style="margin-top: 0vh;height: 100%;" :close-on-click-modal="false"> <el-form :inline="true" label-position="top" :model="modalData" style="margin-left: 7px;margin-top: -5px;"> <el-form-item label="项目编码" prop="projectNo" class="red-label"> <el-input v-model="modalData.projectNo" readonly style="width: 110px;" class="red-text"></el-input> </el-form-item> <el-form-item label="项目名称" prop="projectDesc" > <el-input v-model="modalData.projectDesc" readonly style="width: 170px;" class="red-text"></el-input> </el-form-item> <el-form-item label="BU" prop="bu"> <el-input v-model="modalData.bu" readonly style="width: 110px;" class="red-text"></el-input> </el-form-item> <el-form-item label="项目分类" prop="cProjectTypeDb"> <el-input v-model="modalData.cProjectTypeDb" readonly style="width: 110px;" class="red-text"></el-input> </el-form-item> </el-form> <el-form :inline="true" label-position="top" :model="modalData" style="margin-left: 7px;margin-top: -5px;"> <el-form-item label="指定确认人" prop="userDisplay"> <el-input v-model="confirmData.userDisplay" readonly style="width: 110px;"></el-input> </el-form-item> <el-form-item label="要求确认日期" prop="wantedConfirmDate"> <el-input v-model="confirmData.wantedConfirmDate" readonly style="width: 170px;" class="red-text"></el-input> </el-form-item> </el-form> <el-form :inline="true" label-position="top" :model="confirmData" style="margin-left: 7px;margin-top: -5px;"> <el-form-item label="备注" prop="remark"> <el-input v-model="confirmData.remark" style="width: 541px" type="textarea" :rows="1"></el-input> </el-form-item> </el-form> <el-form :inline="true" label-position="top" :model="confirmData" style="margin-left: 7px;margin-top: -15px;"> <el-form-item label=" "> <a href="javascript:void(0);" @click="triggerUpload" type="text" size="small">点击选择文件</a> <tr></tr> <el-input v-model="this.fileName" readonly placeholder="文件名称" style="width: 541px"></el-input> <el-upload class="custom-upload" :file-list="fileList" action="javascript:void(0);" ref="uploadFile" :on-change="onChange" :on-close="closeFileUpdate" multiple :auto-upload="false" style="text-align: left;margin-top: 0px;margin-left: 6px;display: none;"> </el-upload> </el-form-item> </el-form> <el-table :height="height - 200" :data="projectConfirmatorFileList" border style="width: 100%;margin-top: 17px;margin-left: 0px;"> <el-table-column prop="fileName" header-align="center" align="center" min-width="120" label="文件名"> </el-table-column> <el-table-column prop="createDate" header-align="center" align="center" min-width="80" label="上传时间"> </el-table-column> <el-table-column prop="createdBy" header-align="center" align="center" min-width="60" label="上传人"> </el-table-column> </el-table> <div slot="footer" class="dialog-footer" style="margin-top: 0px"> <el-button type="primary" @click="saveUploadFile()">确定</el-button> <el-button @click="closeUploadFileVisible()">关闭</el-button> </div> </el-dialog>
<el-dialog title="查看附件" @close="closeViewDocumentFileVisible" :visible.sync="viewDocumentFileVisible" width="520px" style="margin-top: 0vh" :close-on-click-modal="false"> <el-table :height="height + 200" :data="projectConfirmatorFileList" border style="width: 100%;margin-top: 0px;margin-left: 0px;"> <el-table-column prop="fileName" header-align="center" align="center" min-width="120" label="文件名"> </el-table-column> <el-table-column prop="createDate" header-align="center" align="center" min-width="80" label="上传时间"> </el-table-column> <el-table-column prop="createdBy" header-align="center" align="center" min-width="50" label="上传人"> </el-table-column> <el-table-column header-align="center" align="center" width="100" label="操作"> <template slot-scope="scope"> <a type="text" size="small" @click="viewFile(scope.row)">查看</a> <a type="text" size="small" @click="downloadFile(scope.row)">下载</a> <a type="text" size="small" @click="deleteFile(scope.row)">删除</a> </template> </el-table-column> </el-table> <div slot="footer" class="dialog-footer" style="margin-top: 0px"> <el-button @click="closeViewDocumentFileVisible()">关闭</el-button> </div> </el-dialog> </div></template>
<script>
import { searchProjectUploadsDocumentList, searchProjectOverUploadsDocumentList, searchConfirmProgressList, searchOverConfirmProgressList, searchAllConfirmProgressList} from "../../../api/eam/eamProofing";import { deleteProjectFile, searchConfirmProgressPusherList, searchProjectConfirmatorFileList, updateProjectDocumentConfirm, uploadProjectFile} from "../../../api/eam/eamProject";import {downLoadObjectFile} from "../../../api/eam/eam_object_list";import {getSiteAndBuByUserName} from "../../../api/qc/qc";import {removeUserFavorite, saveUserFavorite, userFavoriteList} from "../../../api/userFavorite";import {getTableDefaultListLanguage, getTableUserListLanguage} from "../../../api/table";import moment from "moment/moment";import {EventBus} from "../../../main";
export default { data() { return { dataList: [], confirmProgressList: [], projectConfirmatorFileList: [], fileList: [], height: 200, pageIndex: 1, pageSize: 20, totalPage: 0, fileName:'', dataListLoading: false, viewDocumentFileVisible: false, confirmVisible: false, searchData: { site: this.$store.state.user.site, userId: this.$store.state.user.id, projectId: '', projectNo: '', projectDesc: '', projectPartId: '', testPartNo: '', partDesc: '', customerNo: '', customerDesc: '', buDesc: '', projectCategory: '', status: '', startDate:'', endDate:'', projectCreationDate: new Date(), projectCloseDate:'', needDate:'', page: 1, limit: 10, }, modalData:{ flag:'', id:'', bu: '', buNo: '', site: this.$store.state.user.site, projectId: '', oriProjectId: '', projectDesc:'', projectCloseDate:'', proofingNo:'', needDate:'', customerNo:'', finalCustomerId:'', customerDesc:'', projectCategory:'', testPartNo:'', partDesc:'', priority:'', projectManager:'', projectManagerName:'', projectOwner:'', projectOwnerName:'', cProjectRegion:'', cProjectBuildDate:'', cQualityEngineer1:'', cQualityEngineer1Name:'', cQualityEngineer2:'', cQualityEngineer2Name:'', cQualityEngineer3:'', cQualityEngineer3Name:'', cManufactureEngineer:'', cManufactureEngineerName:'', engineer:'', engineerName:'', //projectCreationDate为当前服务器的时间
projectCreationDate: new Date(), finalPartNo:'', finalPartDesc:'', wantedConfirmDate: new Date(), // active:'',
createBy: this.$store.state.user.name, updateBy: this.$store.state.user.name, }, confirmData:{ site: '', projectId: '', orderRef1: '', orderRef2: '', documentId: '', documentType: '', itemNo: '', userid: '', wantedConfirmDate: '', confirmFlag: '', confirmedBy: '', remark: '', confirmedDate: '', createDate: '', createBy: '', page: 1, limit: 1000 }, columnProjectList: [ { userId: this.$store.state.user.name, functionId: 101001013, serialNumber: '101001013Table1BuDesc', tableId: "101001013Table1", tableName: "BU文档清单表", 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: 101001014, serialNumber: '101001014Table1ProjectId', tableId: "101001014Table1", tableName: "项目信息表", columnProp: 'projectNo', 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: 101001014, serialNumber: '101001014Table1ProjectDesc', tableId: "101001014Table1", tableName: "项目信息表", columnProp: 'projectDesc', 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: 101001014, serialNumber: '101001014Table1TestPartNo', tableId: "101001014Table1", tableName: "项目信息表", columnProp: 'testPartNo', 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: 101001014, serialNumber: '101001014Table1PartDesc', tableId: "101001014Table1", tableName: "项目信息表", columnProp: 'partDesc', 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: 101001014, serialNumber: '101001014Table1customerNo', tableId: "101001014Table1", tableName: "项目信息表", columnProp: "customerNo", 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: 101001014, serialNumber: '101001014Table1customerDesc', tableId: "101001014Table1", tableName: "项目信息表", columnProp: "customerDesc", headerAlign: "center", align: "left", columnLabel: "客户名称", columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 150 }, { userId: this.$store.state.user.name, functionId: 101001014, serialNumber: '101001014Table1BuildDate', tableId: "101001014Table1", tableName: "项目信息表", columnProp: "buildDate", 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: 101001014, serialNumber: '101001014Table1ProjectCategory', tableId: "101001014Table1", tableName: "项目信息表", columnProp: 'projectCategory', headerAlign: "center", align: "left", columnLabel: '项目分类', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 120, }, { userId: this.$store.state.user.name, functionId: 101001014, serialNumber: '101001014Table1Priority', tableId: "101001014Table1", tableName: "项目信息表", columnProp: 'priority', 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: 101001014, serialNumber: '101001014Table1CProjectRegion', tableId: "101001014Table1", tableName: "项目信息表", columnProp: 'cProjectRegion', headerAlign: "center", align: "left", columnLabel: '区域', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 120, }, { userId: this.$store.state.user.name, functionId: 101001014, serialNumber: '101001014Table1ProjectManager', tableId: "101001014Table1", tableName: "项目信息表", columnProp: 'projectManagerName', headerAlign: "center", align: "left", columnLabel: 'PM/Sales', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 120, }, { userId: this.$store.state.user.name, functionId: 101001014, serialNumber: '101001014Table1ProjectOwner', tableId: "101001014Table1", tableName: "项目信息表", columnProp: 'projectOwnerName', headerAlign: "center", align: "left", columnLabel: 'PjM', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 120, }, { userId: this.$store.state.user.name, functionId: 101001014, serialNumber: '101001014Table1Engineer', tableId: "101001014Table1", tableName: "项目信息表", columnProp: 'engineerName', headerAlign: "center", align: "left", columnLabel: 'Engineer', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 120, }, { userId: this.$store.state.user.name, functionId: 101001014, serialNumber: '101001014Table1CQualityEngineer1', tableId: "101001014Table1", tableName: "项目信息表", columnProp: 'cQualityEngineer1Name', headerAlign: "center", align: "left", columnLabel: 'IPQC-Lam/Pri/Etch/Slit', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 120, }, { userId: this.$store.state.user.name, functionId: 101001014, serialNumber: '101001014Table1CQualityEngineer2', tableId: "101001014Table1", tableName: "项目信息表", columnProp: 'cQualityEngineer2Name', headerAlign: "center", align: "left", columnLabel: 'IPQC-Converting', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 120, }, { userId: this.$store.state.user.name, functionId: 101001014, serialNumber: '101001014Table1CQualityEngineer3', tableId: "101001014Table1", tableName: "项目信息表", columnProp: 'cQualityEngineer3Name', headerAlign: "center", align: "left", columnLabel: 'FQC', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 120, }, { userId: this.$store.state.user.name, functionId: 101001014, serialNumber: '101001014Table1CManufactureEngineer', tableId: "101001014Table1", tableName: "项目信息表", columnProp: 'cManufactureEngineerName', headerAlign: "center", align: "left", columnLabel: 'MFG', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 120, }, { userId: this.$store.state.user.name, functionId: 101001014, serialNumber: '101001014Table1Status', tableId: "101001014Table1", tableName: "项目信息表", columnProp: 'status', 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: 101001014, serialNumber: '101001014Table1NeedDate', tableId: "101001014Table1", tableName: "项目信息表", columnProp: 'needDate', 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: 101001014, serialNumber: '101001014Table1CloseDate', tableId: "101001014Table1", tableName: "项目信息表", columnProp: 'closeDate', 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: 101001014, serialNumber: '101001014Table1FinalPartNo', tableId: "101001014Table1", tableName: "项目信息表", columnProp: 'finalPartNo', headerAlign: "center", align: "left", columnLabel: 'ERP正式料号', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 120, }, ], userBuList: [], projectCategoryList: [ { projectCategory: 'Low Risk', }, { projectCategory: 'High Risk', }, { projectCategory: 'Sustaining', } ], statusList: [ { status: '草稿', }, { status: '进行中', }, { status: '已量产', } ], }; }, created() { // 获取用户的 site 和 bu
this.getSiteAndBuByUserName() // 校验用户是否收藏
this.favoriteIsOk() // 动态列
this.getTableUserColumn(this.$route.meta.menuId+'table1',1) this.getDataList() }, activated() { if (this.$route.query.flag) { this.getDataList() } }, mounted () { this.$nextTick(() => { this.height = window.innerHeight - 200 }) EventBus.$on('updateAgencyMatterForConfirm', () => { this.getDataList(); }); }, methods: { // 获取用户的bu
getSiteAndBuByUserName () { let tempData = { username: this.$store.state.user.name, } getSiteAndBuByUserName(tempData).then(({data}) => { if (data.code === 0) { this.userBuList = data.rows } }) },
// 获取数据列表
getDataList () { this.searchData.limit = this.pageSize this.searchData.page = this.pageIndex if (this.$route.query.flag === '4') { searchOverConfirmProgressList(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 this.dataList.forEach((item) => { item.projectManagerName = item.projectManager.split('-')[1] item.projectOwnerName = item.projectOwner.split('-')[1] item.engineerName = item.engineer.split('-')[1] item.cQualityEngineer1Name = item.cQualityEngineer1.split('-')[1] item.cQualityEngineer2Name = item.cQualityEngineer2.split('-')[1] item.cQualityEngineer3Name = item.cQualityEngineer3.split('-')[1] item.cManufactureEngineerName = item.cManufactureEngineer.split('-')[1] }) } }) } else if (this.$route.query.flag === '3') { searchConfirmProgressList(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 this.dataList.forEach((item) => { item.projectManagerName = item.projectManager.split('-')[1] item.projectOwnerName = item.projectOwner.split('-')[1] item.engineerName = item.engineer.split('-')[1] item.cQualityEngineer1Name = item.cQualityEngineer1.split('-')[1] item.cQualityEngineer2Name = item.cQualityEngineer2.split('-')[1] item.cQualityEngineer3Name = item.cQualityEngineer3.split('-')[1] item.cManufactureEngineerName = item.cManufactureEngineer.split('-')[1] }) } }) }else { searchAllConfirmProgressList(this.searchData).then(({data}) => { if (data.code === 0) { let pjmList = [] // 遍历data.page.list
data.list.forEach((item) => { if (!pjmList.includes(item.projectOwner.split('-')[0])) { pjmList.push(item.projectOwner.split('-')[0]) } }) console.log(pjmList) console.log(this.$store.state.user.name) if (pjmList.includes(this.$store.state.user.name)) { this.dataList = data.page.list this.pageIndex = data.page.currPage this.pageSize = data.page.pageSize this.totalPage = data.page.totalCount this.dataList.forEach((item) => { item.projectManagerName = item.projectManager.split('-')[1] item.projectOwnerName = item.projectOwner.split('-')[1] item.engineerName = item.engineer.split('-')[1] item.cQualityEngineer1Name = item.cQualityEngineer1.split('-')[1] item.cQualityEngineer2Name = item.cQualityEngineer2.split('-')[1] item.cQualityEngineer3Name = item.cQualityEngineer3.split('-')[1] item.cManufactureEngineerName = item.cManufactureEngineer.split('-')[1] }) } } else { this.$route.query.flag = '3' } }) } },
toMes (row) { this.$router.push({ path: 'eam-eamProjectPartInfo', query: { projectNo: row.projectNo, testPartNo: row.testPartNo }}) },
// 每页数
sizeChangeHandle (val) { this.pageSize = val this.pageIndex = 1 this.getDataList() }, // 当前页
currentChangeHandle (val) { this.pageIndex = val this.getDataList() },
viewDocumentFile(row) { this.confirmData = { site: row.site, documentType: row.documentType, orderRef1: row.orderRef1, orderRef2: row.orderRef2, itemNo: row.itemNo, userid: row.userid, username: row.username, userDisplay: row.userDisplay, wantedConfirmDate: row.wantedConfirmDate, confirmFlag: row.confirmFlag, confirmedDate: new Date(), createBy: row.createBy, createDate: row.createDate, confirmedBy: this.$store.state.user.userDisplay, documentId: row.documentId, remark: row.remark } let inData = { orderRef1: row.site, orderRef2: row.itemNo, orderRef3: row.userid, orderRef4: row.orderRef1, orderRef5: row.orderRef2, page: 1, limit: 1000 } searchProjectConfirmatorFileList(inData).then(({data}) => { if (data && data.code === 0){ this.projectConfirmatorFileList = data.page.list; } }) this.viewDocumentFileVisible = true }, closeViewDocumentFileVisible(){ this.viewDocumentFileVisible = false; this.projectConfirmatorFileList = []; }, // 查看文件
viewFile(row) { // 预览文件
let image = ['jpg', 'jpeg', 'png', 'gif', 'bmp'] let video = ['mp4', 'avi', 'mov', 'wmv', 'flv'] let office = ['doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx'] let txt = ['txt'] let type = '' let pdf = ['pdf'] if (image.includes(row.fileType.toLowerCase())) { type = 'image/' + row.fileType downLoadObjectFile(row).then(({data}) => { const blob = new Blob([data], { type: type }); // 创建URL来生成预览
const fileURL = URL.createObjectURL(blob); // 在新标签页中打开文件预览
const newTab = window.open(fileURL, '_blank') }) } else if (video.includes(row.fileType.toLowerCase())) { type = 'video/' + row.fileType downLoadObjectFile(row).then(({data}) => { const blob = new Blob([data], { type: type }); // 创建URL来生成预览
const fileURL = URL.createObjectURL(blob); // 在新标签页中打开文件预览
const newTab = window.open(fileURL, '_blank') }) } else if (txt.includes(row.fileType.toLowerCase())) { type = 'text/plain' downLoadObjectFile(row).then(({data}) => { const blob = new Blob([data], { type: type }); // 创建URL来生成预览
const fileURL = URL.createObjectURL(blob); // 在新标签页中打开文件预览
const newTab = window.open(fileURL, '_blank') }) } else if (office.includes(row.fileType.toLowerCase())) { if (row.fileType.toLowerCase() === 'doc' || row.fileType.toLowerCase() === 'docx') { type = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' } else if (row.fileType.toLowerCase() === 'ppt' || row.fileType.toLowerCase() === 'pptx') { type = 'application/vnd.openxmlformats-officedocument.presentationml.presentation' } else { type = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' } downLoadObjectFile(row).then(({data}) => { const blob = new Blob([data], { type: type }); // 创建URL来生成预览
const fileURL = URL.createObjectURL(blob); // 在新标签页中打开文件预览
const newTab = window.open(fileURL, '_blank') }) } else if (pdf.includes(row.fileType.toLowerCase())) { type = 'application/pdf' downLoadObjectFile(row).then(({data}) => { const blob = new Blob([data], { type: type }); // 创建URL来生成预览
const fileURL = URL.createObjectURL(blob); // 在新标签页中打开文件预览
const newTab = window.open(fileURL, '_blank') }) } else { this.$message({ message: '不支持的文件类型', type: 'warning' }) } }, // 下载
downloadFile (row) { downLoadObjectFile(row) .then(({data}) => { // 不限制文件下载类型
const blob = new Blob([data], {type:'application/octet-stream;charset=utf-8'}) // 下载文件名称
const fileName = row.fileName // a标签下载
const linkNode = document.createElement('a') linkNode.download = fileName // a标签的download属性规定下载文件的名称
linkNode.style.display = 'none' linkNode.href = URL.createObjectURL(blob) // 生成一个Blob URL
document.body.appendChild(linkNode) linkNode.click() // 模拟在按钮上的一次鼠标单击
URL.revokeObjectURL(linkNode.href) // 释放URL 对象
document.body.removeChild(linkNode) }) }, deleteFile(row) { if (this.confirmData.confirmedBy === this.$store.state.user.userDisplay) { this.$confirm('是否删除该文件?', '提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' }).then(() => { let inData = { id: row.id, orderRef1: row.orderRef1, orderRef2: row.orderRef2, orderRef3: row.orderRef3, orderRef4: row.orderRef4, orderRef5: row.orderRef5, createdBy: this.$store.state.user.name } deleteProjectFile(inData).then(({data}) => { if (data && data.code === 0) { this.$message({ message: '删除成功', type: 'success' }) this.getProjectConfirmatorFileList(this.confirmData) } else { this.$message({ message: '删除失败', type: 'error' }) } }) }).catch(() => { this.$message({ type: 'info', message: '已取消删除' }); }); } else { this.$message({ message: '只有确认人员才能删除文件', type: 'error' }) } }, confirmDocument(row) { this.confirmData = { site: row.site, documentType: row.documentType, orderRef1: row.orderRef1, orderRef2: row.orderRef2, itemNo: row.itemNo, userid: row.userid, username: row.username, userDisplay: row.userDisplay, wantedConfirmDate: row.wantedConfirmDate, confirmFlag: row.confirmFlag, confirmedDate: new Date(), createBy: row.createBy, createDate: row.createDate, confirmedBy: this.$store.state.user.userDisplay, documentId: row.documentId, remark: row.remark } this.modalData = { site: row.site, projectId: row.projectId, projectNo: row.projectNo, projectDesc: row.projectDesc, projectPartId: row.projectPartId, testPartNo: row.testPartNo, partDesc: row.partDesc, customerNo: row.customerNo, customerDesc: row.customerDesc, buNo: row.buNo, bu: row.site + '_' + row.buNo, cProjectTypeDb: row.projectCategory, } this.getProjectConfirmatorFileList(row) this.confirmVisible = true },
getProjectConfirmatorFileList (row) { let inData = { orderRef1: row.site, orderRef3: row.userid, orderRef2: row.itemNo, orderRef4: row.orderRef1, orderRef5: row.orderRef2, page: 1, limit: 1000 } searchProjectConfirmatorFileList(inData).then(({data}) => { if (data && data.code === 0){ this.projectConfirmatorFileList = data.page.list; } }) },
closeUploadFileVisible(){ this.confirmVisible = false; this.projectConfirmatorFileList = []; this.fileList = []; this.closeFileUpdate() },
saveUploadFile(){ this.confirmData.confirmedDate = moment(this.confirmData.confirmedDate).utcOffset('+8').format('YYYY-MM-DD HH:mm:ss'); this.confirmData.confirmedBy = this.$store.state.user.userDisplay; this.confirmData.userid = this.$store.state.user.id; updateProjectDocumentConfirm(this.confirmData) .then(({data}) => { if (data.code === 0) { this.confirmVisible = false; this.getDataList(); // 成功操作后触发事件
EventBus.$emit('updateProjectPartInfo'); }else { this.$alert(data.msg, '错误', { confirmButtonText: '确定' }) } }) let remark = this.confirmData.remark; const formData = new FormData(); //片接文件
for (let i = 0; i < this.fileList.length; i++) { formData.append("file",this.fileList[i].raw) } formData.append("folder", 'projectPDConfirmFiles'); formData.append("orderRef1", this.confirmData.site); formData.append("orderRef4", this.confirmData.orderRef1); formData.append("orderRef2", this.confirmData.itemNo); formData.append("orderRef3", this.confirmData.userid); formData.append("orderRef5", this.confirmData.orderRef2); formData.append("createdBy", this.$store.state.user.name); formData.append("updatedBy", this.$store.state.user.name); formData.append("remark", remark); uploadProjectFile(formData).then(({data}) => { if (data.code === 0) { this.$message.success('操作成功'); //清空文件上传记录
this.$refs.uploadFile.clearFiles(); this.closeFileUpdate(); this.projectConfirmatorFileList = []; }else { this.$alert(data.msg, '错误', { confirmButtonText: '确定' }) } }) },
closeFileUpdate() { this.fileName = ''; this.uploadDialog = false; //this.fileRemark = ''
this.$refs.uploadFile.clearFiles() this.fileList = [] },
/*选择上传文件时*/ onChange(file,fileList){ const newFileName = file.name; if (this.fileName) { this.fileName += ', ' + newFileName; } else { this.fileName = newFileName; } this.fileList.push(file); },
triggerUpload() { this.$refs.uploadFile.$el.querySelector('input').click() },
formatDate(row, column) { // row 是当前行的数据对象
// column 是当前列的属性信息对象
const date = row[column.property]; if (date) { const s = new Date(date).toLocaleDateString('zh-CN', { year: 'numeric', month: '2-digit', day: '2-digit' }); return s.replace(/\//g, '-') } else { return ''; } }, rowStyle ({row}) { }, getCombinedDocumentType(row) { // 根据您的需求,组合或拼接需要显示的字段
if (row.documentType === null || row.documentType === undefined) { return row.documentDesc }else { return row.documentType } }, // 校验用户是否收藏
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 }) } },
// 动态列开始 获取 用户保存的 格式列
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) { //this.columnList1 = []
switch (columnId) { case 1: this.columnList = data.rows break; // case 2:
// this.detailColumnList = data.rows
// break;
// case 3:
// this.columnList2 = data.rows
// break;
// case 4:
// this.columnList3 = 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; // case 2:
// this.detailColumnList = data.rows
// break;
// case 3:
// this.columnList2 = data.rows
// break;
// case 4:
// this.columnList3 = data.rows
// break;
} } else { // this.showDefault = true.
} }) }, //获取按钮的权限数据
getButtonAuthData () { let searchFlag = this.isAuth(this.menuId+":search") let saveFlag = this.isAuth(this.menuId+":save") let updateFlag = this.isAuth(this.menuId+":update") let deleteFlag = this.isAuth(this.menuId+":delete") //处理页面的权限数据
this.authSearch = !searchFlag this.authSave = !saveFlag this.authUpdate = !updateFlag this.authDelete = !deleteFlag }, },};</script>
<style scoped>
.red-text /deep/ .el-input__inner { color: red;}
.card-item { cursor: pointer; margin-bottom: 20px; transition: transform 0.3s, box-shadow 0.3s; overflow: hidden; //padding: 10px;
display: flex; flex-direction: column; justify-content: space-between; align-items: center; height: 208px; width: 230px; margin-left: 40px; margin-top: 10px;}
.card-item:hover { transform: translateY(-5px); box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);}
.card-title { font-size: 18px; font-weight: bold; margin-bottom: 10px; margin-top: 20px;}
.card-count { font-size: 55px; color: #17B3A3; text-align: center; font-weight: bold; margin-top: 50px;}
.project-list { font-size: 12px; color: #333; line-height: 1.5; margin-bottom: 5px;}
.el-divider { margin: 10px 0;}</style>
|