From 07a41ade45c962e93a9d449ce1be0eec52e66a6a Mon Sep 17 00:00:00 2001 From: spring <2396852758@qq.com> Date: 星期三, 19 三月 2025 10:44:32 +0800 Subject: [PATCH] 内部单不能修改报告 --- src/components/equipment/equipment-acceptance.vue | 534 ++++++++++++++++++++++++++++++++++++----------------------- 1 files changed, 327 insertions(+), 207 deletions(-) diff --git a/src/components/equipment/equipment-acceptance.vue b/src/components/equipment/equipment-acceptance.vue index 8bda75d..1f2ec01 100644 --- a/src/components/equipment/equipment-acceptance.vue +++ b/src/components/equipment/equipment-acceptance.vue @@ -2,48 +2,117 @@ <div> <div> <div style="margin: 10px 0;text-align: right"> - <el-button size="small" type="primary" @click="handleForm('add')">鏂板</el-button> + <el-button size="small" type="primary" @click="handleForm('add')" + >鏂板</el-button + > </div> <div> - <el-table ref="yearTable" v-loading="yearTableDetailDataLoading" :data="yearTableDetailData" - height="calc(100vh - 18em)" - style="width: 100% ;"> + <el-table + ref="yearTable" + v-loading="yearTableDetailDataLoading" + :data="yearTableDetailData" + height="calc(100vh - 18em)" + style="width: 100% ;" + > <!-- 琛ㄦ牸鍒� --> - <el-table-column align="center" header-align="center" label="搴忓彿" prop="prop" type="index" width="70"></el-table-column> - <el-table-column label="鍒拌揣鏃ユ湡" min-width="150" prop="arrivalDate"></el-table-column> - <el-table-column label="閲戦" min-width="100" prop="goldAmount"></el-table-column> - <el-table-column label="缁翠慨鍗曚綅" min-width="150" prop="maintenanceunit"></el-table-column> + <el-table-column + align="center" + header-align="center" + label="搴忓彿" + prop="prop" + type="index" + width="70" + ></el-table-column> + <el-table-column + label="鍒拌揣鏃ユ湡" + min-width="150" + prop="arrivalDate" + ></el-table-column> + <el-table-column + label="閲戦" + min-width="100" + prop="goldAmount" + ></el-table-column> + <el-table-column + label="缁翠慨鍗曚綅" + min-width="150" + prop="maintenanceunit" + ></el-table-column> <!-- 鎿嶄綔鎸夐挳 --> <el-table-column align="center" label="鎿嶄綔" min-width="180"> <template slot-scope="scope"> - <el-button size="small" type="text" @click="handleForm('edit',scope.row.acceptanceId)">缂栬緫</el-button> - <el-button size="small" type="text" @click="handleForm('view',scope.row.acceptanceId)">鏌ョ湅</el-button> - <el-button size="small" type="text" @click="record(scope.row)">闄勪欢</el-button> - <el-button size="small" type="text" @click="handleDownOne(scope.row.acceptanceId)">瀵煎嚭</el-button> - <el-button size="small" style="color: #f56c6c" type="text" @click="deleteFun(scope.row.acceptanceId)">鍒犻櫎</el-button> + <el-button + size="small" + type="text" + @click="handleForm('edit', scope.row.acceptanceId)" + >缂栬緫</el-button + > + <el-button + size="small" + type="text" + @click="handleForm('view', scope.row.acceptanceId)" + >鏌ョ湅</el-button + > + <el-button size="small" type="text" @click="record(scope.row)" + >闄勪欢</el-button + > + <el-button + size="small" + type="text" + @click="handleDownOne(scope.row.acceptanceId)" + >瀵煎嚭</el-button + > + <el-button + size="small" + style="color: #f56c6c" + type="text" + @click="deleteFun(scope.row.acceptanceId)" + >鍒犻櫎</el-button + > </template> </el-table-column> </el-table> - <el-pagination :current-page="1" :page-size="pagination1.size" :page-sizes="[10, 20, 30, 50, 100]" - :total="pagination1.total" layout="->,total, sizes, prev, pager, next, jumper" @size-change="handleSizeChange1" - @current-change="handleCurrentChange1"> + <el-pagination + :current-page="1" + :page-size="pagination1.size" + :page-sizes="[10, 20, 30, 50, 100]" + :total="pagination1.total" + layout="->,total, sizes, prev, pager, next, jumper" + @size-change="handleSizeChange1" + @current-change="handleCurrentChange1" + > </el-pagination> </div> </div> - <acceptance-form v-if="applicationForm" ref="applicationForm" @closeDialog="closeDialog"></acceptance-form> + <acceptance-form + v-if="applicationForm" + ref="applicationForm" + @closeDialog="closeDialog" + ></acceptance-form> <!--涓婁紶鎶ュ憡--> - <el-dialog :visible.sync="filesDialogVisible" title="闄勪欢" width="80%" @closed="closeFilesLook"> + <el-dialog + :visible.sync="filesDialogVisible" + title="闄勪欢" + width="80%" + @closed="closeFilesLook" + > <div style="display: flex;justify-content: space-between;"> - <el-upload ref='upload' - :action="fileAction" - :auto-upload="true" - :before-upload="fileBeforeUpload" - :data="{acceptanceId: acceptanceId}" - :headers="headers" :on-error="onError" - :on-success="handleSuccessUp" - :show-file-list="false" - accept='.jpg,.jpeg,.png,.gif,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.pdf,.zip,.rar' style="width: 80px !important;"> - <el-button size="small" style="height: 38px" type="primary">闄勪欢涓婁紶</el-button> + <el-upload + ref="upload" + :action="fileAction" + :auto-upload="true" + :before-upload="fileBeforeUpload" + :data="{ acceptanceId: acceptanceId }" + :headers="headers" + :on-error="onError" + :on-success="handleSuccessUp" + :show-file-list="false" + accept=".jpg,.jpeg,.png,.gif,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.pdf,.zip,.rar" + style="width: 80px !important;" + > + <el-button size="small" style="height: 38px" type="primary" + >闄勪欢涓婁紶</el-button + > </el-upload> </div> <div> @@ -54,16 +123,24 @@ :highlightCurrentRow="true" :table-data="tableData" :table-loading="tableLoading" - style="margin-top: 0.5em;"> + style="margin-top: 0.5em;" + > </ZTTable> </div> </el-dialog> <el-dialog :visible.sync="lookDialogVisible" fullscreen - title="鏌ョ湅闄勪欢" top="5vh" width="800px"> - <filePreview v-if="lookDialogVisible" :currentFile="{}" - :fileUrl="fileUrl" style="height: 90vh;overflow-y: auto;"/> + title="鏌ョ湅闄勪欢" + top="5vh" + width="800px" + > + <filePreview + v-if="lookDialogVisible" + :currentFile="{}" + :fileUrl="fileUrl" + style="height: 90vh;overflow-y: auto;" + /> </el-dialog> </div> </template> @@ -72,16 +149,16 @@ import AcceptanceForm from "./acceptance-form.vue"; import ZTTable from "../caorui/ZTTable/index.vue"; import filePreview from "../tool/file-preview.vue"; +import file from "../../util/file"; export default { name: "equipment-acceptance", // import 寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢� - components: {filePreview, ZTTable, AcceptanceForm}, + components: { filePreview, ZTTable, AcceptanceForm }, props: { clickNodeVal: { type: Object, - default: () => { - } + default: () => {} } }, data() { @@ -90,7 +167,7 @@ pagination1: { size: 10, current: 1, - total: 0, + total: 0 }, yearTableDetailDataLoading: false, yearTableDetailData: [], @@ -98,36 +175,36 @@ filesDialogVisible: false, columnData: [ { - label: '鏂囦欢鍚嶇О', - prop: 'fileName', - minWidth: '150px' + label: "鏂囦欢鍚嶇О", + prop: "fileName", + minWidth: "150px" }, { - dataType: 'action', - minWidth: '100', - label: '鎿嶄綔', - fixed: 'right', + dataType: "action", + minWidth: "100", + label: "鎿嶄綔", + fixed: "right", operation: [ { - name: '棰勮', - type: 'text', - clickFun: (row) => { - this.handleLook(row) + name: "棰勮", + type: "text", + clickFun: row => { + this.handleLook(row); } }, { - name: '涓嬭浇', - type: 'text', - clickFun: (row) => { - this.upload(row) + name: "涓嬭浇", + type: "text", + clickFun: row => { + this.upload(row); } }, { - name: '鍒犻櫎', - type: 'text', - color: '#f56c6c', - clickFun: (row) => { - this.delete(row) + name: "鍒犻櫎", + type: "text", + color: "#f56c6c", + clickFun: row => { + this.delete(row); } } ] @@ -135,210 +212,252 @@ ], tableData: [], tableLoading: false, - acceptanceId: '', // 涓婁紶闄勪欢褰撳墠琛岀殑id - currentInfo:{}, + acceptanceId: "", // 涓婁紶闄勪欢褰撳墠琛岀殑id + currentInfo: {}, lookDialogVisible: false, - fileUrl: '' - } + fileUrl: "" + }; }, mounted() { - this.getYearTableDetailData(this.clickNodeVal.value) + this.getYearTableDetailData(this.clickNodeVal.value); }, // 鏂规硶闆嗗悎 methods: { // 鏌ヨ getYearTableDetailData(deviceId) { - this.yearTableDetailDataLoading = true - this.$axios.post(this.$api.deviceAcceptance.pageDeviceAcceptance, { - page: { - current: this.pagination1.current, - size: this.pagination1.size, - }, - entity: { - deviceId: deviceId, - } - }, { - headers: { - 'Content-Type': 'application/json' - }, - noQs: true - }).then(res => { - if (res.code == 200) { - this.yearTableDetailData = res.data.records - this.pagination1.total = res.data.total - } - this.yearTableDetailDataLoading = false - }).catch(err => { - this.yearTableDetailDataLoading = false - }) + this.yearTableDetailDataLoading = true; + this.$axios + .post( + this.$api.deviceAcceptance.pageDeviceAcceptance, + { + page: { + current: this.pagination1.current, + size: this.pagination1.size + }, + entity: { + deviceId: deviceId + } + }, + { + headers: { + "Content-Type": "application/json" + }, + noQs: true + } + ) + .then(res => { + if (res.code == 200) { + this.yearTableDetailData = res.data.records; + this.pagination1.total = res.data.total; + } + this.yearTableDetailDataLoading = false; + }) + .catch(err => { + this.yearTableDetailDataLoading = false; + }); }, handleForm(type, id) { - this.applicationForm = true + this.applicationForm = true; this.$nextTick(() => { - this.$refs.applicationForm.openDialog(type, id, this.clickNodeVal.value) - }) + this.$refs.applicationForm.openDialog( + type, + id, + this.clickNodeVal.value + ); + }); }, closeDialog() { - this.applicationForm = false - this.getYearTableDetailData(this.clickNodeVal.value) + this.applicationForm = false; + this.getYearTableDetailData(this.clickNodeVal.value); }, // 鎵撳紑鎶ュ憡寮规 - record (row) { - this.filesDialogVisible = true - this.acceptanceId = row.acceptanceId - this.searchTableList() + record(row) { + this.filesDialogVisible = true; + this.acceptanceId = row.acceptanceId; + this.searchTableList(); }, // 鏌ヨ闄勪欢鍒楄〃 - searchTableList () { - this.tableLoading = true - this.$axios.get(this.$api.deviceAcceptance.getDeviceAcceptanceFileList + '?acceptanceId=' + this.acceptanceId).then(res => { - this.tableLoading = false - if (res.code === 201) return - this.tableData = res.data - }).catch(err => { - this.tableLoading = false - console.log('err---', err); - }) + searchTableList() { + this.tableLoading = true; + this.$axios + .get( + this.$api.deviceAcceptance.getDeviceAcceptanceFileList + + "?acceptanceId=" + + this.acceptanceId + ) + .then(res => { + this.tableLoading = false; + if (res.code === 201) return; + this.tableData = res.data; + }) + .catch(err => { + this.tableLoading = false; + console.log("err---", err); + }); }, // 鏌ョ湅鏂囦欢 - handleLook(row){ - this.currentInfo = row - this.lookDialogVisible = true - const state = /\.(jpg|jpeg|png|gif)$/i.test(this.currentInfo.fileUrl) + handleLook(row) { + this.currentInfo = row; + this.lookDialogVisible = true; + const state = /\.(jpg|jpeg|png|gif)$/i.test(this.currentInfo.fileUrl); if (state) { - this.fileUrl = this.javaApi+'/img/'+ this.currentInfo.fileUrl + this.fileUrl = this.javaApi + "/img/" + this.currentInfo.fileUrl; } else { - this.fileUrl = this.javaApi+'/word/'+ this.currentInfo.fileUrl + this.fileUrl = this.javaApi + "/word/" + this.currentInfo.fileUrl; } }, // 涓嬭浇 - upload (row) { - let url = ''; - if(row.type==1){ - url = this.javaApi+'/img/'+row.fileUrl - file.downloadIamge(url,row.fileName) - }else{ - url = this.javaApi+'/word/'+row.fileUrl - const link = document.createElement('a'); + upload(row) { + let url = ""; + if (row.type == 1) { + url = this.javaApi + "/img/" + row.fileUrl; + file.downloadIamge(url, row.fileName); + } else { + url = this.javaApi + "/word/" + row.fileUrl; + const link = document.createElement("a"); link.href = url; link.download = row.fileName; link.click(); } }, // 鍒犻櫎 - delete (row) { - this.$confirm('姝ゆ搷浣滃皢鍒犻櫎璇ユ暟鎹�, 鏄惁缁х画?', '鎻愮ず', { - confirmButtonText: '纭畾', - cancelButtonText: '鍙栨秷', - type: 'warning' - }).then(() => { - this.tableLoading = true - this.$axios.get(this.$api.deviceAcceptance.delDeviceAcceptanceFileList + '?acceptanceFileId=' + row.acceptanceFileId).then(res => { - this.tableLoading = false - if (res.code === 201) return - this.$message.success('鍒犻櫎鎴愬姛') - this.searchTableList() - }).catch(err => { - this.tableLoading = false - console.log('err---', err); + delete(row) { + this.$confirm("姝ゆ搷浣滃皢鍒犻櫎璇ユ暟鎹�, 鏄惁缁х画?", "鎻愮ず", { + confirmButtonText: "纭畾", + cancelButtonText: "鍙栨秷", + type: "warning" + }) + .then(() => { + this.tableLoading = true; + this.$axios + .get( + this.$api.deviceAcceptance.delDeviceAcceptanceFileList + + "?acceptanceFileId=" + + row.acceptanceFileId + ) + .then(res => { + this.tableLoading = false; + if (res.code === 201) return; + this.$message.success("鍒犻櫎鎴愬姛"); + this.searchTableList(); + }) + .catch(err => { + this.tableLoading = false; + console.log("err---", err); + }); }) - }).catch(() => { - this.$message({ - type: 'info', - message: '宸插彇娑堝垹闄�' + .catch(() => { + this.$message({ + type: "info", + message: "宸插彇娑堝垹闄�" + }); }); - }); }, // 涓婁紶闄勪欢 fileBeforeUpload(file) { - let flag = true + let flag = true; if (file.size > 1024 * 1024 * 10) { - this.$message.error('涓婁紶鏂囦欢涓嶈秴杩�10M'); - this.$refs.upload.clearFiles() - flag = false + this.$message.error("涓婁紶鏂囦欢涓嶈秴杩�10M"); + this.$refs.upload.clearFiles(); + flag = false; } if (!flag) { return Promise.reject(flag); //姝g‘鐨勭粓姝� } }, - onError(err, file, fileList,type) { - this.$message.error('涓婁紶澶辫触') - this.$refs.upload.clearFiles() + onError(err, file, fileList, type) { + this.$message.error("涓婁紶澶辫触"); + this.$refs.upload.clearFiles(); }, - handleSuccessUp(response, ) { + handleSuccessUp(response) { this.upLoading = false; if (response.code == 200) { - this.$message.success('涓婁紶鎴愬姛'); - this.searchTableList() + this.$message.success("涓婁紶鎴愬姛"); + this.searchTableList(); } }, - closeFilesLook () { - this.filesDialogVisible = false + closeFilesLook() { + this.filesDialogVisible = false; }, // 鍒嗛〉 handleSizeChange1(val) { - this.pagination1.size = val - this.getYearTableDetailData(this.clickNodeVal.value) + this.pagination1.size = val; + this.getYearTableDetailData(this.clickNodeVal.value); }, // 鍒嗛〉 handleCurrentChange1(val) { - this.pagination1.current = val - this.getYearTableDetailData(this.clickNodeVal.value) + this.pagination1.current = val; + this.getYearTableDetailData(this.clickNodeVal.value); }, // 瀵煎嚭 handleDownOne(id) { - this.outLoading = true - this.$axios.get(this.$api.deviceAcceptance.exportDeviceAcceptance + '?acceptanceId=' + id, { - responseType: "blob" - }).then(res => { - this.outLoading = false - const blob = new Blob([res], {type: 'application/octet-stream'}); - //灏咮lob 瀵硅薄杞崲鎴愬瓧绗︿覆 - let reader = new FileReader(); - reader.readAsText(blob, 'utf-8'); - reader.onload = () => { - try { - let result = JSON.parse(reader.result); - if (result.message) { - this.$message.error(result.message); - } else { - const url = URL.createObjectURL(blob); - const link = document.createElement('a'); - link.href = url; - link.download = '璁惧楠屾敹.doc'; - link.click(); - this.$message.success('瀵煎嚭鎴愬姛') - } - } catch (err) { - console.log(err); - const url = URL.createObjectURL(blob); - const link = document.createElement('a'); - link.href = url; - link.download = '璁惧楠屾敹.doc'; - link.click(); - this.$message.success('瀵煎嚭鎴愬姛') + this.outLoading = true; + this.$axios + .get( + this.$api.deviceAcceptance.exportDeviceAcceptance + + "?acceptanceId=" + + id, + { + responseType: "blob" } - } - }) + ) + .then(res => { + this.outLoading = false; + const blob = new Blob([res], { type: "application/octet-stream" }); + //灏咮lob 瀵硅薄杞崲鎴愬瓧绗︿覆 + let reader = new FileReader(); + reader.readAsText(blob, "utf-8"); + reader.onload = () => { + try { + let result = JSON.parse(reader.result); + if (result.message) { + this.$message.error(result.message); + } else { + const url = URL.createObjectURL(blob); + const link = document.createElement("a"); + link.href = url; + link.download = "璁惧楠屾敹.doc"; + link.click(); + this.$message.success("瀵煎嚭鎴愬姛"); + } + } catch (err) { + console.log(err); + const url = URL.createObjectURL(blob); + const link = document.createElement("a"); + link.href = url; + link.download = "璁惧楠屾敹.doc"; + link.click(); + this.$message.success("瀵煎嚭鎴愬姛"); + } + }; + }); }, // 鍒犻櫎 deleteFun(id) { - this.$confirm('姝ゆ搷浣滃皢姘镐箙鍒犻櫎璇ユ暟鎹�, 鏄惁缁х画?', '鎻愮ず', { - confirmButtonText: '纭畾', - cancelButtonText: '鍙栨秷', - type: 'warning' - }).then(() => { - this.$axios.get(this.$api.deviceAcceptance.delDeviceAcceptance + '?acceptanceId=' + id).then(res => { - this.$message.success('鍒犻櫎鎴愬姛锛�'); - this.getYearTableDetailData(this.clickNodeVal.value); + this.$confirm("姝ゆ搷浣滃皢姘镐箙鍒犻櫎璇ユ暟鎹�, 鏄惁缁х画?", "鎻愮ず", { + confirmButtonText: "纭畾", + cancelButtonText: "鍙栨秷", + type: "warning" + }) + .then(() => { + this.$axios + .get( + this.$api.deviceAcceptance.delDeviceAcceptance + + "?acceptanceId=" + + id + ) + .then(res => { + this.$message.success("鍒犻櫎鎴愬姛锛�"); + this.getYearTableDetailData(this.clickNodeVal.value); + }); + }) + .catch(() => { + this.$message({ + type: "info", + message: "宸插彇娑堝垹闄�" + }); }); - }).catch(() => { - this.$message({ - type: 'info', - message: '宸插彇娑堝垹闄�' - }); - }); - }, + } }, watch: { // 鐩戝惉鐐瑰嚮el-tree鐨勬暟鎹紝杩涜鏁版嵁鍒锋柊 @@ -346,20 +465,21 @@ if (newVal.value) { this.getYearTableDetailData(newVal.value); } - }, + } }, computed: { headers() { return { - 'token': sessionStorage.getItem('token') - } + token: sessionStorage.getItem("token") + }; }, fileAction() { - return this.javaApi + this.$api.deviceAcceptance.uploadDeviceAcceptanceFile - + return ( + this.javaApi + this.$api.deviceAcceptance.uploadDeviceAcceptanceFile + ); } - }, -} + } +}; </script> <style scoped> -- Gitblit v1.9.3