From e888346ebcd8e3e099a15c7edd7bf367c057193a Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期二, 04 三月 2025 15:33:33 +0800
Subject: [PATCH] Merge branch 'refs/heads/dev'

---
 src/views/CNAS/systemManagement/documentControl/components/ControlledFileApplication.vue |  578 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 578 insertions(+), 0 deletions(-)

diff --git a/src/views/CNAS/systemManagement/documentControl/components/ControlledFileApplication.vue b/src/views/CNAS/systemManagement/documentControl/components/ControlledFileApplication.vue
new file mode 100644
index 0000000..85dd9a0
--- /dev/null
+++ b/src/views/CNAS/systemManagement/documentControl/components/ControlledFileApplication.vue
@@ -0,0 +1,578 @@
+<template>
+  <!-- 鏂囦欢鍙楁帶鐢宠 -->
+  <div class="controlled-file-application" style="height: 100%;">
+    <div class="search">
+      <div class="search_thing">
+        <div class="search_label">鐢宠鏂囦欢缂栧彿锛�</div>
+        <div class="search_input"><el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="queryParams.documentCode"
+            @keyup.enter.native="refreshTable()"></el-input></div>
+      </div>
+      <!-- <div class="search_thing">
+        <div class="search_label">鐢宠浜猴細</div>
+        <div class="search_input"><el-input size="small" placeholder="璇疯緭鍏�" clearable
+            v-model="queryParams.createUserName" @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="btns" style="padding-left: 30px;">
+        <el-button size="small" type="primary"
+          @click="addDialogVisible = true, addInfo = {}, file = null">鏂囦欢鍙楁帶鐢宠</el-button>
+      </div>
+    </div>
+    <div class="table">
+      <lims-table :tableData="tableData" :column="column" :page="page" :tableLoading="tableLoading"
+        :height="'calc(100vh - 290px)'" @pagination="pagination"></lims-table>
+    </div>
+    <el-dialog title="鏂囦欢鍙楁帶鐢宠" :visible.sync="addDialogVisible" width="800px" top="10vh">
+      <el-row>
+        <el-col :span="12" style="margin-bottom: 16px;">
+          <div class="search_thing">
+            <div class="search_label"><span style="color:red;margin-right: 4px;">*</span>鐢宠缂栧彿锛�</div>
+            <div class="search_input"><el-input size="small" placeholder="璇疯緭鍏�" clearable
+                v-model="addInfo.documentCode"></el-input></div>
+          </div>
+        </el-col>
+        <el-col :span="12" style="margin-bottom: 16px;">
+          <div class="search_thing">
+            <div class="search_label">璐d换浜猴細</div>
+            <div class="search_input">
+              <el-select v-model="addInfo.dutyUser" size="small" style="width: 100%;" filterable>
+                <el-option v-for="item in personList" :key="item.value" :label="item.label" :value="item.value">
+                </el-option>
+              </el-select>
+            </div>
+          </div>
+        </el-col>
+        <el-col :span="12" style="margin-bottom: 16px;">
+          <div class="search_thing">
+            <div class="search_label">鏂囦欢绫诲埆锛�</div>
+            <div class="search_input">
+              <el-select v-model="addInfo.type" size="small" style="width: 100%;">
+                <el-option v-for="item in fileType" :key="item.value" :label="item.label" :value="item.value">
+                </el-option>
+              </el-select>
+            </div>
+          </div>
+        </el-col>
+        <el-col :span="12" style="margin-bottom: 16px;">
+          <div class="search_thing">
+            <div class="search_label">鏂囦欢鍚嶇О锛�</div>
+            <div class="search_input"><el-input size="small" placeholder="璇疯緭鍏�" clearable
+                v-model="addInfo.name"></el-input></div>
+          </div>
+        </el-col>
+        <el-col :span="12" style="margin-bottom: 16px;">
+          <div class="search_thing">
+            <div class="search_label">鏂囦欢鐗堟湰锛�</div>
+            <div class="search_input"><el-input size="small" placeholder="璇疯緭鍏�" clearable
+                v-model="addInfo.version"></el-input></div>
+          </div>
+        </el-col>
+        <el-col :span="12" style="margin-bottom: 16px;">
+          <div class="search_thing">
+            <div class="search_label">涓婁紶闄勪欢锛�</div>
+            <div class="search_input"><el-upload style="margin: 8px 0 0px 50px;" action="#" :auto-upload="false"
+                :multiple="false" accept='.pdf' :on-change="handleChangeUpload" v-if="addDialogVisible">
+                <el-button size="small" type="primary">涓婁紶闄勪欢</el-button>
+              </el-upload></div>
+          </div>
+        </el-col>
+        <el-col :span="12" style="margin-bottom: 16px;">
+          <div class="search_thing">
+            <div class="search_label">浣滆�咃細</div>
+            <div class="search_input">
+              <!-- <el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="addInfo.writer"></el-input> -->
+              <el-select v-model="addInfo.writer" size="small" style="width: 100%;" filterable>
+                <el-option v-for="item in personList" :key="item.value" :label="item.label" :value="item.label">
+                </el-option>
+              </el-select>
+            </div>
+          </div>
+        </el-col>
+        <el-col :span="12" style="margin-bottom: 16px;">
+          <div class="search_thing">
+            <div class="search_label">鎻愪氦鏃ユ湡锛�</div>
+            <div class="search_input">
+              <el-date-picker v-model="addInfo.submitDate" type="date" size="small" placeholder="閫夋嫨鏃ユ湡"
+                format="yyyy-MM-dd" value-format="yyyy-MM-dd" style="width: 100%;">
+              </el-date-picker>
+            </div>
+          </div>
+        </el-col>
+        <el-col :span="12" style="margin-bottom: 16px;">
+          <div class="search_thing">
+            <div class="search_label">璇存槑锛�</div>
+            <div class="search_input"><el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="addInfo.instructions"
+                type="textarea" :rows="2"></el-input></div>
+          </div>
+        </el-col>
+      </el-row>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="addDialogVisible = false">鍙� 娑�</el-button>
+        <el-button type="primary" @click="handleAdd" :loading="addLoading">纭� 瀹�</el-button>
+      </span>
+    </el-dialog>
+    <el-dialog title="鏌ョ湅闄勪欢" :visible.sync="lookDialogVisible" width="800px" top="5vh" fullscreen>
+      <filePreview v-if="lookDialogVisible" :fileUrl="javaApi + '/word/' + currentInfo.url" :currentFile="{}"
+        style="height: 90vh;overflow-y: auto;" />
+    </el-dialog>
+    <el-dialog title="瀹℃牳" :visible.sync="checkDialogVisible" width="1000px" top="5vh">
+      <UpPdfStamp ref="UpPdfStamp" v-if="checkDialogVisible" @uploadPDF="uploadPDF" :isUpFile="false"></UpPdfStamp>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="handleCheckSub('涓嶉�氳繃')" :loading="noCheckLoading">涓嶉�氳繃</el-button>
+        <el-button type="primary" @click="handleCheckSub('閫氳繃')" :loading="checkLoading">閫� 杩�</el-button>
+      </span>
+    </el-dialog>
+    <el-dialog title="閫夋嫨鍙楁帶绔�" :visible.sync="checkStampDialogVisible" width="600px" top="5vh">
+      <div class="stamp-list">
+        <img :src="require('@/assets/stamps/' + item + '.png')" alt="" v-for="(item, index) in stampsList" :key="index"
+          style="width: 120px;height: 80px;margin: 6px;" class="stamp" :class="{ active: currentStamp == item }"
+          @click="currentStamp = item">
+      </div>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="checkStampDialogVisible = false">鍙� 娑�</el-button>
+        <el-button type="primary" @click="handleCheck0(currentInfo)">纭� 瀹�</el-button>
+      </span>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import UpPdfStamp from '@/components/UpPdfStamp/index.vue'
+import filePreview from '@/components/Preview/filePreview.vue'
+import limsTable from "@/components/Table/lims-table.vue";
+import {
+  selectUserCondition,
+} from "@/api/system/user.js";
+import {
+  addManageDocumentControlled,
+  doManageDocumentControlled,
+  checkManageDocumentControlledPdf,
+  delManageDocumentControlled,
+  pageManageDocumentControlled,
+  checkManageDocumentControlled,
+} from '@/api/cnas/systemManagement/documentControl.js'
+import { mapGetters } from "vuex";
+export default {
+  components: {
+    filePreview,
+    UpPdfStamp,
+    limsTable
+  },
+  computed: {
+    ...mapGetters(["nickName"]),
+  },
+  data() {
+    return {
+      upLoading: false,
+      addPower: false,
+      addDialogVisible: false,
+      addLoading: false,
+      lookDialogVisible: false,
+      checkDialogVisible: false,
+      checkStampDialogVisible: false,
+      addInfo: {},
+      personList: [],
+      fileType: [],
+      file: null,
+      currentInfo: {},
+      checkLoading: false,
+      noCheckLoading: false,
+      type: '',
+      stampsList: ['涓讳换', '璐ㄩ噺璐熻矗浜�', '鎶�鏈礋璐d汉', '缁煎悎瀹�', '閫氫俊', '鐢靛姏', '瑁呭', '鍌ㄨ兘', '灏勯'],
+      currentStamp: '涓讳换',
+      queryParams: {},
+      tableData: [],
+      column: [
+        { label: "鐢宠鏂囦欢缂栧彿", prop: "documentCode" },
+        {
+          label: "鏂囦欢绫诲埆", prop: "type", width: "120px", dataType: "tag",
+          formatData: (params) => {
+            return this.fileType.find((m) => m.value == params).label;
+          },
+          formatType: (params) => {
+            return this.fileType.find((m) => m.value == params).type;
+          },
+        },
+        {
+          label: "鐢宠浜�",
+          prop: "createUserName",
+        },
+        { label: "鐢宠鏃堕棿", prop: "createTime" },
+        { label: "璇存槑", prop: "instructions" },
+        { label: "鎻愪氦鏃ユ湡", prop: "submitDate" },
+        { label: "璐d换浜�", prop: "dutyUserName" },
+        {
+          label: "鐢宠鐘舵��", prop: "state", dataType: "tag",
+          formatData: (params) => {
+            return params;
+          },
+          formatType: (params) => {
+            if (params == '閫氳繃') {
+              return 'success'
+            } else {
+              return 'danger'
+            }
+          },
+        },
+        {
+          dataType: "action",
+          fixed: "right",
+          label: "鎿嶄綔",
+          operation: [
+            {
+              name: "缂栬緫",
+              type: "text",
+              clickFun: (row) => {
+                this.handleUpdate(row);
+              },
+              disabled: (row) => {
+                return row.state == '閫氳繃'
+              }
+            },
+            {
+              name: "瀹℃牳",
+              type: "text",
+              clickFun: (row) => {
+                this.handleCheck(row);
+              },
+              disabled: (row) => {
+                return !row.dutyUserName.includes(this.nickName) || row.state == '閫氳繃'
+              }
+            },
+            {
+              name: "鏌ョ湅闄勪欢",
+              type: "text",
+              clickFun: (row) => {
+                this.handleLook(row);
+              },
+            },
+            {
+              name: "涓嬭浇",
+              type: "text",
+              clickFun: (row) => {
+                this.handleDown(row);
+              },
+            },
+
+            {
+              name: "鍒犻櫎",
+              type: "text",
+              clickFun: (row) => {
+                this.handleDelete(row);
+              },
+              disabled: (row, index) => {
+                return row.state == '閫氳繃'
+              }
+            },
+          ],
+        },
+      ],
+      page: {
+        total: 0,
+        size: 10,
+        current: 0,
+      },
+      tableLoading: false,
+    }
+  },
+  mounted() {
+    this.getList()
+    this.getAuthorizedPerson()
+    this.selectEnumByCategory()
+  },
+  methods: {
+    getList() {
+      this.tableLoading = true;
+      let param = { ...this.queryParams, ...this.page };
+      delete param.total;
+      pageManageDocumentControlled({ ...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() {
+      this.page.current = 1;
+      this.getList();
+    },
+    refresh() {
+      this.queryParams = {};
+      this.page.current = 1;
+      this.getList();
+    },
+    getPower() {
+      let power = JSON.parse(sessionStorage.getItem('power'))
+      let up = false
+      let del = false
+      let add = false
+      // let check = false
+      for (var i = 0; i < power.length; i++) {
+        if (power[i].menuMethod == 'addManageDocumentControlled') {
+          up = true
+        }
+        if (power[i].menuMethod == 'addManageDocumentControlled') {
+          add = true
+        }
+        if (power[i].menuMethod == 'delManageDocumentControlled') {
+          del = true
+        }
+        // if (power[i].menuMethod == 'checkManageDocumentControlled') {
+        //   check = true
+        // }
+      }
+      // if (!check) {
+      //   this.componentData.do.splice(2, 1)
+      // }
+      if (!del) {
+        this.componentData.do.splice(1, 1)
+      }
+      if (!up) {
+        this.componentData.do.splice(0, 1)
+      }
+      this.addPower = add
+    },
+    getAuthorizedPerson() {
+      selectUserCondition().then(res => {
+        let data = []
+        res.data.forEach(a => {
+          data.push({
+            label: a.name,
+            value: a.id
+          })
+        })
+        this.personList = data
+      })
+    },
+    selectEnumByCategory() {
+      // 鏂囦欢绫诲埆
+      this.getDicts("document_type").then((response) => {
+        this.fileType = this.dictToValue(response.data);
+      });
+    },
+    // 鎻愪氦
+    handleAdd() {
+      if (!this.addInfo.documentCode) return this.$message({ type: 'error', message: "璇疯緭鍏ョ紪鍙�" })
+      if (!this.addInfo.id) {
+        // 鏂板
+        let fd = new FormData();
+        //鏂囦欢淇℃伅涓璻aw鎵嶆槸鐪熺殑鏂囦欢
+        if (this.file) {
+          fd.append("file", this.file.raw);
+        }
+        for (let m in this.addInfo) {
+          fd.append(m, this.addInfo[m])
+        }
+        this.addLoading = true
+        addManageDocumentControlled(fd).then(res => {
+          this.addLoading = false
+          if (res.code == 200) {
+            this.$message({
+              type: 'success',
+              message: '娣诲姞鎴愬姛'
+            })
+            this.refreshTable()
+            this.addDialogVisible = false
+          } else {
+            this.$message({
+              type: 'error',
+              message: '娣诲姞澶辫触'
+            })
+          }
+        })
+      } else {
+        // 淇敼
+        let { id, documentCode, dutyUser, type, name, version, writer, submitDate, instructions } = this.addInfo
+        let fd = new FormData();
+        //鏂囦欢淇℃伅涓璻aw鎵嶆槸鐪熺殑鏂囦欢
+        if (this.file) {
+          fd.append("file", this.file.raw);
+        }
+        fd.append("id", id);
+        fd.append("documentCode", documentCode);
+        fd.append("dutyUser", dutyUser);
+        fd.append("type", type);
+        fd.append("name", name);
+        fd.append("version", version);
+        fd.append("writer", writer);
+        fd.append("submitDate", submitDate);
+        fd.append("instructions", instructions);
+        this.addLoading = true
+        doManageDocumentControlled(fd).then(res => {
+          this.addLoading = false
+          if (res.code == 200) {
+            this.refreshTable()
+            this.addDialogVisible = false
+          } else {
+            this.$message({
+              type: 'error',
+              message: '娣诲姞澶辫触'
+            })
+          }
+        })
+      }
+    },
+    handleChangeUpload(file, fileLists) {
+      this.file = file
+      this.$set(this.addInfo, 'name', file.name)
+    },
+    // 缂栬緫
+    handleUpdate(row) {
+      this.title = '鏂囦欢鍙樻洿鐢宠'
+      this.addInfo = this.HaveJson(row)
+      this.addDialogVisible = true
+    },
+    // 鏌ョ湅闄勪欢
+    handleLook(row) {
+      this.currentInfo = row
+      this.lookDialogVisible = true
+    },
+    // 瀹℃牳
+    handleCheck(row) {
+      this.title = '瀹℃牳'
+      this.currentInfo = row
+      if (!row.url) return this.$message.warning('鏂囦欢鏈笂浼�')
+      this.checkStampDialogVisible = true
+    },
+    handleCheck0(row) {
+      this.checkStampDialogVisible = false
+      this.checkDialogVisible = true
+      checkManageDocumentControlledPdf({ id: row.id }).then(res => {
+        const blob = new Blob([res]);
+        const file = new File([blob], row.name, { type: 'application/pdf' })
+        this.$refs.UpPdfStamp.lookFile(file, this.currentStamp)
+      }).catch(err => {
+        console.log(err)
+      })
+    },
+    handleDown(row) {
+      if (!row.url) return this.$message.warning('鏂囦欢鏈笂浼�')
+      let url = this.javaApi + '/word/' + row.url
+      this.$download.saveAs(url, row.url);
+    },
+    async uploadPDF(pdfBlob) {
+      const formData = new FormData();
+      formData.append('file', pdfBlob, this.fileName + '.pdf'); // 鏂囦欢瀛楁
+      formData.append('id', this.currentInfo.id); // 鏂囦欢鍚嶅瓧娈�
+      formData.append('state', this.type); // 鏂囦欢鍚嶅瓧娈�
+      formData.append('writer', this.currentInfo.writer); // 鏂囦欢鍚嶅瓧娈�
+
+      try {
+        let res = await checkManageDocumentControlled(formData)
+        this.checkLoading = false
+        this.noCheckLoading = false
+        if (res.code == 200) {
+          this.$message({ message: '鎿嶄綔鎴愬姛', type: 'success' });
+          this.checkDialogVisible = false;
+          this.refreshTable()
+          return true
+        } else {
+          this.$message({ message: '鎿嶄綔澶辫触', type: 'error' });
+          return false
+        }
+      } catch (e) {
+        this.checkLoading = false
+        this.noCheckLoading = false
+      }
+
+
+    },
+    handleCheckSub(type) {
+      this.type = type
+      if (type == '閫氳繃') {
+        this.checkLoading = true
+      } else {
+        this.noCheckLoading = true
+      }
+      this.addLoading = true
+      this.$refs['UpPdfStamp'].generatePDF()
+    },
+    handleDelete(row) {
+      this.$confirm("鏄惁鍒犻櫎璇ユ潯鏁版嵁?", "鎻愮ず", {
+        confirmButtonText: "纭畾",
+        cancelButtonText: "鍙栨秷",
+        type: "warning",
+      })
+        .then(() => {
+          delManageDocumentControlled({ id: row.id }).then((res) => {
+            if (res.code == 201) return;
+            this.$message.success("鍒犻櫎鎴愬姛");
+            this.refresh();
+          });
+        })
+        .catch(() => { });
+    },
+  }
+}
+</script>
+
+<style scoped>
+.title {
+  height: 60px;
+  line-height: 60px;
+}
+
+.search {
+  background-color: #fff;
+  height: 40px;
+  display: flex;
+  align-items: center;
+  position: relative;
+}
+
+.search_thing {
+  width: 350px;
+  display: flex;
+  align-items: center;
+}
+
+.search_label {
+  width: 110px;
+  font-size: 14px;
+  text-align: right;
+}
+
+.search_input {
+  width: calc(100% - 110px);
+}
+
+.table {
+  background-color: #fff;
+  height: calc(100% - 60px - 80px);
+  padding: 20px;
+}
+
+.btns {
+  position: absolute;
+  right: 20px;
+  top: 5px;
+}
+
+.stamp {
+  cursor: pointer;
+  border: #fff 1px solid;
+}
+
+.stamp:hover {
+  border: #3A7BFA 1px solid;
+  box-shadow: inset 0px 0px 15px #3A7BFA;
+}
+
+.stamp.active {
+  border: #3A7BFA 1px solid;
+  box-shadow: inset 0px 0px 15px #3A7BFA;
+}
+</style>

--
Gitblit v1.9.3