From e5454b769d44a34af423bf87ac8a740bf8c20341 Mon Sep 17 00:00:00 2001 From: Crunchy <3114200645@qq.com> Date: 星期二, 29 四月 2025 13:25:29 +0800 Subject: [PATCH] Merge branch 'dev' into dev_tides --- src/views/standard/model/index.vue | 402 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 402 insertions(+), 0 deletions(-) diff --git a/src/views/standard/model/index.vue b/src/views/standard/model/index.vue index e69de29..6d3ce8f 100644 --- a/src/views/standard/model/index.vue +++ b/src/views/standard/model/index.vue @@ -0,0 +1,402 @@ +<template> + <div class="capacity-scope"> + <div class="search"> + <div class="search_box"> + <div class="search_item"> + <span class="search_label">妯℃澘鍚嶇О</span> + <el-input v-model="queryParams.name" clearable placeholder="璇疯緭鍏�" size="small" + @keyup.enter.native="refreshTable()"></el-input> + </div> + <div class="search_button"> + <el-button type="primary" size="mini" @click="refreshTable">鏌ヨ</el-button> + <el-button size="mini" @click="refresh">閲嶇疆</el-button> + </div> + </div> + <div> + <el-button v-if="checkPermi(['standard:model:add'])" size="small" type="primary" @click="openAdd">鏂板</el-button> + </div> + </div> + <lims-table :tableData="tableData" :column="column" :page="page" :tableLoading="tableLoading" + :height="'calc(100vh - 250px)'" @pagination="pagination"></lims-table> + <el-dialog :before-close="isClose" :close-on-click-modal="false" :close-on-press-escape="false" + :visible.sync="isShow" title="妯℃澘缂栧埗" width="85%"> + <div v-if="isShow" style="width: 100%; height: 82vh; overflow: auto"> + <Excel v-loading="loading" :data="row.thing" :execlTitle="row.name"></Excel> + </div> + </el-dialog> + <el-dialog :before-close="closeCopyTem" :close-on-click-modal="false" :close-on-press-escape="false" + :visible.sync="isShowCopyTem" :title="title" width="35%" :modal-append-to-body="false"> + <el-form ref="copyForm" :model="copyForm" :rules="copyFormRules" label-position="right" label-width="80px"> + <el-form-item label="妯$増缂栧彿" prop="number"> + <el-input v-model="copyForm.number" clearable size="small"></el-input> + </el-form-item> + <el-form-item label="妯$増鍚嶇О" prop="name"> + <el-input v-model="copyForm.name" clearable size="small"></el-input> + </el-form-item> + <el-form-item label="澶囨敞" prop="remark"> + <el-input v-model="copyForm.remark" clearable size="small"></el-input> + </el-form-item> + </el-form> + <span slot="footer" class="dialog-footer"> + <el-button @click="closeCopyTem">鍙� 娑�</el-button> + <el-button :loading="submitCopyInfoLoading" type="primary" @click="submitCopyInfo">纭� 瀹�</el-button> + </span> + </el-dialog> + </div> +</template> + +<script> +import limsTable from "@/components/Table/lims-table.vue"; +import Excel from "@/components/Excel/luckysheet.vue"; +import { + selectStandardTemplatePageList, + copyStandardTemplate, + addStandardTemplate, + upStandardTemplate, + delStandardTemplate, + getEditTemplatePreparation, +} from "@/api/standard/model"; +export default { + name: 'Model', + components: { + Excel, + limsTable, + }, + data() { + return { + addPower: true, + isShow: false, + loading: false, + title: "鏂板", + row: { + id: null, + thing: null, + name: null, + }, + isShowCopyTem: false, + submitCopyInfoLoading: false, + copyForm: { + number: "", + name: "", + remark: "", + id: "", + }, + copyFormRules: { + name: [{ required: true, message: "璇疯緭鍏ユā鐗堝悕绉�", trigger: "blur" }], + }, + queryParams: { + name: null, + }, + tableData: [], + column: [ + { label: "妯℃澘缂栧彿", prop: "number" }, + { label: "妯℃澘鍚嶇О", prop: "name" }, + { label: "澶囨敞", prop: "remark" }, + { label: "鍒涘缓鐢ㄦ埛", prop: "createUserName" }, + { label: "鍒涘缓鏃堕棿", prop: "createTime", width: "160" }, + { label: "鏇存柊鐢ㄦ埛", prop: "updateUserName" }, + { label: "淇敼鏃堕棿", prop: "updateTime", width: "160" }, + { + dataType: "action", + label: "鎿嶄綔", + operation: [ + { + name: "缂栬緫", + type: "text", + clickFun: (row) => { + this.title = "缂栬緫"; + this.copyForm = this.HaveJson(row); + this.isShowCopyTem = true; + }, + showHide: (row) => { + return this.checkPermi(["standard:model:edit"]); + }, + }, + { + name: "鍒犻櫎", + type: "text", + clickFun: (row) => { + this.handleDelete(row); + }, + showHide: (row) => { + return this.checkPermi(["standard:model:del"]); + }, + }, + { + name: "澶嶅埗妯℃澘", + type: "text", + clickFun: (row) => { + this.copyTemplate(row); + }, + showHide: (row) => { + return this.checkPermi(["standard:model:copy"]); + }, + }, + { + name: "妯℃澘缂栧埗", + type: "text", + clickFun: (row) => { + this.templateWrite(row); + }, + showHide: (row) => { + return this.checkPermi([ + "standard:model:edit", + "standard:model:add", + ]); + }, + }, + ], + }, + ], + page: { + total: 0, + size: 10, + current: 0, + }, + tableLoading: false, + }; + }, + mounted() { + window.excelClosed = this.confirmSave; + window.returnView = this.returnView; + this.getList(); + }, + methods: { + getList() { + this.tableLoading = true; + let param = { ...this.queryParams, ...this.page }; + delete param.total; + selectStandardTemplatePageList({ ...param }) + .then((res) => { + this.tableLoading = false; + if (res.code === 200) { + this.tableData = res.data.records; + this.page.total = res.data.total; + } + }) + .catch((err) => { + this.tableLoading = false; + }); + }, + pagination({ page, limit }) { + this.page.current = page; + this.page.size = limit; + this.getList(); + }, + refreshTable(event) { + if (event && typeof event.preventDefault === 'function') { + event.preventDefault(); // 闃绘榛樿琛屼负 + } + this.page.current = 1; + this.getList(); + }, + refresh() { + this.queryParams = {}; + this.page.current = 1; + this.getList(); + }, + openAdd() { + this.title = "鏂板"; + this.copyForm = {}; + this.isShowCopyTem = true; + }, + // 澶嶅埗妯$増 + copyTemplate(row) { + this.title = "澶嶅埗妯$増"; + this.isShowCopyTem = true; + this.copyForm.id = row.id; + }, + // 鏂板/缂栬緫/澶嶅埗妯℃澘 + submitCopyInfo() { + this.$refs["copyForm"].validate((valid) => { + if (valid) { + this.submitCopyInfoLoading = true; + const params = { + id: this.copyForm.id, + name: this.copyForm.name, + number: this.copyForm.number, + remark: this.copyForm.remark, + }; + switch (this.title) { + case "鏂板": + delete params.id; + addStandardTemplate(params) + .then((res) => { + this.isShowCopyTem = false; + this.submitCopyInfoLoading = false; + this.$message.success("鏂板鎴愬姛"); + this.refreshTable("page"); + }) + .catch((err) => { + console.log("copyTemplate----", err); + this.submitCopyInfoLoading = false; + }); + break; + case "缂栬緫": + params.thing = this.copyForm.thing ? this.copyForm.thing : ""; + upStandardTemplate(params) + .then((res) => { + this.isShowCopyTem = false; + this.submitCopyInfoLoading = false; + this.$message.success("淇敼鎴愬姛"); + this.refreshTable("page"); + }) + .catch((err) => { + console.log("copyTemplate----", err); + this.submitCopyInfoLoading = false; + }); + break; + case "澶嶅埗妯$増": + copyStandardTemplate(params) + .then((res) => { + this.isShowCopyTem = false; + this.submitCopyInfoLoading = false; + this.$message.success("澶嶅埗鎴愬姛"); + this.refreshTable("page"); + }) + .catch((err) => { + console.log("copyTemplate----", err); + this.submitCopyInfoLoading = false; + }); + break; + } + } else { + console.log("error submit!!"); + return false; + } + }); + }, + closeCopyTem() { + this.$refs.copyForm.resetFields(); + this.isShowCopyTem = false; + }, + // 鍒犻櫎 + handleDelete(row) { + this.$confirm("鏄惁鍒犻櫎璇ユ潯鏁版嵁?", "鎻愮ず", { + confirmButtonText: "纭畾", + cancelButtonText: "鍙栨秷", + type: "warning", + }) + .then(() => { + delStandardTemplate({ id: row.id }).then((res) => { + this.$message.success("鍒犻櫎鎴愬姛"); + this.refreshTable("page"); + }); + }) + .catch(() => { }); + }, + templateWrite(row) { + getEditTemplatePreparation({ id: row.id }).then((res) => { + if (res.code != 200) { + return; + } + this.row = row; + this.row.thing = res.data; + this.isShow = true; + }); + }, + returnView() { + this.isShow = false; + }, + confirmSave() { + this.$confirm("鏄惁闇�瑕佷繚瀛�?", "鎻愮ず", { + confirmButtonText: "纭畾", + cancelButtonText: "鍙栨秷", + type: "warning", + }) + .then(() => { + this.closed(); + }) + .catch(() => { }); + }, + closed() { + this.loading = true; + let data = luckysheet.toJson(); + delete data.title; + delete data.container; + delete data.lang; + delete data.showsheetbar; + delete data.showstatisticBarConfig; + delete data.enableAddRow; + delete data.enableAddBackTop; + delete data.showtoolbarConfig; + delete data.cellRightClickConfig; + delete data.myFolderUrl; + delete data.functionButton; + if (data.data[0].config.borderInfo != undefined) { + for (var i = 0; i < data.data[0].config.borderInfo.length; i++) { + let str = data.data[0].config.borderInfo; + if (str[i].rangeType === "range") { + if (str[i].borderType === "border-none") { + data.data[0].config.borderInfo.splice(i, 1); + i -= 1; + } + } + } + } + data.data[0].celldata.forEach((a) => { + if ( + a.v.ps != undefined && + (a.v.ps.value === "妫�楠屽��" || + a.v.ps.value === "璁惧鍚嶇О" || + a.v.ps.value === "璁惧缂栫爜" || + a.v.ps.value === "缁撹") + ) { + if (a.v.v === undefined) { + a.v.v = ""; + } + } + }); + upStandardTemplate({ + id: this.row.id, + thing: JSON.stringify(data), + name: luckysheet.getWorkbookName(["name"]), + }).then((res) => { + this.loading = false; + this.$message.success("宸蹭繚瀛�"); + this.isShow = false; + }); + }, + isClose(done) { + this.$confirm("鏄惁闇�瑕佷繚瀛�?", "璀﹀憡", { + confirmButtonText: "纭畾", + cancelButtonText: "鍙栨秷", + type: "warning", + }) + .then(() => { + this.closed(); + }) + .catch(() => { + done(); + }); + }, + }, +}; +</script> + +<style scoped> +.search { + height: 46px; + display: flex; + justify-content: space-between; +} +.search_box { + display: flex; +} +.search_item { + margin-bottom: 18px; + margin-right: 10px; + display: flex; + align-items: center; + line-height: 32px; +} +.search_label { + width: 88px; + font-size: 14px; + font-weight: 700; + color: #606266; +} +.search_button { + line-height: 26px; +} +</style> -- Gitblit v1.9.3