From 5c5465e7718a84d5b2a39f4e5fae7d220bd4d8ed Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期三, 05 三月 2025 10:13:14 +0800
Subject: [PATCH] 检验任务复核检验任务下载报告,下载的内容以后缀.htm形式出现
---
src/views/standard/model/index.vue | 420 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 420 insertions(+), 0 deletions(-)
diff --git a/src/views/standard/model/index.vue b/src/views/standard/model/index.vue
index e69de29..ab46ae4 100644
--- a/src/views/standard/model/index.vue
+++ b/src/views/standard/model/index.vue
@@ -0,0 +1,420 @@
+<template>
+ <div class="standard-template">
+ <div class="search">
+ <div class="search_thing">
+ <div class="search_label">妯℃澘鍚嶇О锛�</div>
+ <div class="search_input">
+ <el-input v-model="queryParams.name" clearable placeholder="璇疯緭鍏�" size="small"
+ @keyup.enter.native="refreshTable()"></el-input>
+ </div>
+ </div>
+ <div class="search_thing" style="padding-left: 30px">
+ <el-button size="small" @click="refresh()">閲� 缃�</el-button>
+ <el-button size="small" type="primary" @click="refreshTable()">鏌� 璇�</el-button>
+ </div>
+ <div class="btn">
+ <el-button v-if="checkPermi(['standard:model:add'])" size="small" type="primary" @click="openAdd">鏂板</el-button>
+ <!-- <el-button
+ v-if="checkPermi(['standard:model:copy'])"
+ size="small"
+ @click="copyTemplate"
+ >澶嶅埗妯$増</el-button
+ > -->
+ </div>
+ </div>
+ <lims-table :tableData="tableData" :column="column" :page="page" :tableLoading="tableLoading"
+ :height="'calc(100vh - 250px)'" style="padding: 20px; padding-top: 0" @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" },
+ { label: "鏇存柊鐢ㄦ埛", prop: "updateUserName" },
+ { label: "淇敼鏃堕棿", prop: "updateTime" },
+ {
+ dataType: "action",
+ fixed: "right",
+ 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(e) {
+ 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) => {
+ if (res.code == 201) return;
+ 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) => {
+ if (res.code == 201) return;
+ 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) => {
+ if (res.code == 201) return;
+ 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) => {
+ if (res.code == 201) return;
+ 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) => {
+ if (res.code == 201) return;
+ 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>
+/* >>>.el-dialog__wrapper {
+ z-index: 100 !important;
+} */
+
+.search {
+ background-color: #fff;
+ height: 80px;
+ display: flex;
+ align-items: center;
+ position: relative;
+}
+
+.search_thing {
+ width: 350px;
+ display: flex;
+ align-items: center;
+}
+
+.search_label {
+ width: 90px;
+ font-size: 14px;
+ text-align: right;
+}
+
+.search_input {
+ width: calc(100% - 110px);
+}
+
+.btn {
+ position: absolute;
+ right: 14px;
+ top: 20px;
+}
+</style>
--
Gitblit v1.9.3