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/DistributionCollectionRecord.vue |  596 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 596 insertions(+), 0 deletions(-)

diff --git a/src/views/CNAS/systemManagement/documentControl/components/DistributionCollectionRecord.vue b/src/views/CNAS/systemManagement/documentControl/components/DistributionCollectionRecord.vue
new file mode 100644
index 0000000..887fbfb
--- /dev/null
+++ b/src/views/CNAS/systemManagement/documentControl/components/DistributionCollectionRecord.vue
@@ -0,0 +1,596 @@
+<template>
+  <!-- 鍙戞斁鍥炴敹璁板綍 -->
+  <div class="distribution-collection-record" style="height: 100%;">
+    <div class="search">
+      <div class="search_thing">
+        <div class="search_label">鏂囦欢缂栧彿锛�</div>
+        <div class="search_input"><el-input v-model="queryParams.documentCode" clearable placeholder="璇疯緭鍏�" size="small"
+            @keyup.enter.native="refreshTable()"></el-input></div>
+      </div>
+      <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="btns" style="padding-left: 30px;">
+        <el-button v-if="addPower" size="small" type="primary"
+          @click="addDialogVisible = true, addInfo = {}, radio = '鍙戞斁'">娣诲姞鍙戞斁璁板綍</el-button>
+        <el-button v-if="outPower" :loading="outLoading" size="small" type="primary" @click="handleOut">瀵煎嚭</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="'娣诲姞' + radio + '璁板綍'" :visible.sync="addDialogVisible" top="10vh" width="800px">
+      <el-row v-if="addDialogVisible">
+        <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-select v-model="addInfo.documentCode" :disabled="radio == '鍥炴敹'" allow-create clearable filterable
+                size="small" style="width: 100%;" @change="changeFileList">
+                <el-option v-for="item in fileList" :key="item.documentCode" :label="item.documentCode"
+                  :value="item.documentCode">
+                </el-option>
+              </el-select>
+            </div>
+          </div>
+        </el-col>
+        <el-col v-if="radio == '鍙戞斁'" :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-select v-model="addInfo.issueUser" filterable size="small" style="width: 100%;">
+                <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 v-else :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-select v-model="addInfo.recycleUser" filterable size="small" style="width: 100%;">
+                <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"><span style="color:red;margin-right: 4px;">*</span>瀹℃壒浜猴細</div>
+            <div class="search_input">
+              <el-select v-model="addInfo.receiveUser" :disabled="radio != '鍙戞斁'" filterable size="small"
+                style="width: 100%;">
+                <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-input v-model="addInfo.name" :disabled="radio == '鍥炴敹'" clearable
+                placeholder="璇疯緭鍏�" size="small"></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 v-model="addInfo.version" :disabled="radio == '鍥炴敹'" clearable
+                placeholder="璇疯緭鍏�" size="small"></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-select v-model="addInfo.state" :disabled="radio == '鍥炴敹'" size="small" style="width: 100%;">
+                <el-option v-for="(item, index) in fileState" :key="index" :label="item.label"
+                  :value="item.value"></el-option>
+              </el-select>
+            </div>
+          </div>
+        </el-col>
+        <el-col v-if="radio == '鍙戞斁'" :span="12" style="margin-bottom: 16px;">
+          <div class="search_thing">
+            <div class="search_label">鍙戞斁缂栧彿锛�</div>
+            <div class="search_input"><el-input v-model="addInfo.issueCode" clearable placeholder="璇疯緭鍏�"
+                size="small"></el-input></div>
+          </div>
+        </el-col>
+        <el-col v-else :span="12" style="margin-bottom: 16px;">
+          <div class="search_thing">
+            <div class="search_label">鍥炴敹缂栧彿锛�</div>
+            <div class="search_input"><el-input v-model="addInfo.recycleCode" clearable placeholder="璇疯緭鍏�"
+                size="small"></el-input></div>
+          </div>
+        </el-col>
+        <el-col v-if="radio == '鍙戞斁'" :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.issueDate" format="yyyy-MM-dd" placeholder="閫夋嫨鏃ユ湡" size="small"
+                style="width: 100%;" type="date" value-format="yyyy-MM-dd">
+              </el-date-picker>
+            </div>
+          </div>
+        </el-col>
+        <el-col v-else :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.recycleDate" format="yyyy-MM-dd" placeholder="閫夋嫨鏃ユ湡" size="small"
+                style="width: 100%;" type="date" value-format="yyyy-MM-dd">
+              </el-date-picker>
+            </div>
+          </div>
+        </el-col>
+        <el-col v-if="radio == '鍙戞斁'" :span="12" style="margin-bottom: 16px;">
+          <div class="search_thing">
+            <div class="search_label">鍙戞斁璇存槑锛�</div>
+            <div class="search_input"><el-input v-model="addInfo.issueNote" :rows="2" clearable placeholder="璇疯緭鍏�"
+                size="small" type="textarea"></el-input></div>
+          </div>
+        </el-col>
+        <el-col v-else :span="12" style="margin-bottom: 16px;">
+          <div class="search_thing">
+            <div class="search_label">鍥炴敹璇存槑锛�</div>
+            <div class="search_input"><el-input v-model="addInfo.recycleNote" :rows="2" clearable placeholder="璇疯緭鍏�"
+                size="small" type="textarea"></el-input></div>
+          </div>
+        </el-col>
+        <el-col v-if="radio == '鍙戞斁'" :span="12" style="margin-bottom: 16px;">
+          <div class="search_thing">
+            <div class="search_label">涓婁紶闄勪欢锛�</div>
+            <div class="search_input"><el-upload :auto-upload="false" :multiple="false" :on-change="handleChangeUpload"
+                accept='.pdf,.doc,.docx,.xls,.xlsx' action="#" style="margin: 8px 0 0px 50px;">
+                <el-button size="small" type="primary">涓婁紶闄勪欢</el-button>
+              </el-upload></div>
+          </div>
+        </el-col>
+      </el-row>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="addDialogVisible = false">鍙� 娑�</el-button>
+        <el-button :loading="addLoading" type="primary" @click="handleAdd">纭� 瀹�</el-button>
+      </span>
+    </el-dialog>
+    <el-dialog :visible.sync="lookDialogVisible" fullscreen title="鏌ョ湅闄勪欢" top="5vh" width="800px">
+      <filePreview v-if="lookDialogVisible" :currentFile="{}" :fileUrl="javaApi + '/word/' + currentInfo.url"
+        style="height: 90vh;overflow-y: auto;" />
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import limsTable from "@/components/Table/lims-table.vue";
+import filePreview from '@/components/Preview/filePreview.vue'
+import {
+  selectUserCondition,
+} from "@/api/system/user.js";
+import {
+  pageManageDocumentList,
+  pageManageDocumentCancel,
+  exportManageDocumentIssueRecycle,
+  addManageDocumentIssueRecycle,
+  doManageDocumentIssueRecycle,
+  checkManageDocumentIssueRecycle,
+  pageManageDocumentIssueRecycle,
+  delManageDocumentIssueRecycle,
+} from '@/api/cnas/systemManagement/documentControl.js'
+import { mapGetters } from "vuex";
+export default {
+  components: {
+    filePreview,
+    limsTable
+  },
+  computed: {
+    ...mapGetters(["userId"]),
+  },
+  data() {
+    return {
+      ddPower: false,
+      outPower: true,
+      addInfo: {},
+      addPower: true,
+      addLoading: false,
+      addDialogVisible: false,
+      outLoading: false,
+      personList: [],
+      fileList: [],
+      fileList0: [],
+      radio: '鍙戞斁',
+      fileState: [],
+      file: null,
+      currentInfo: {},
+      lookDialogVisible: false,
+      queryParams: {},
+      tableData: [],
+      column: [
+        { label: "鏂囦欢缂栧彿", prop: "documentCode" },
+        { label: "鏂囦欢鍚嶇О", prop: "name" },
+        {
+          label: "鏂囦欢鐗堟湰",
+          prop: "version",
+        },
+        { label: "鏂囦欢鐘舵��", prop: "documentState" },
+        { label: "鍙戞斁缂栧彿", prop: "issueCode" },
+        { label: "鍙戞斁浜�", prop: "issueUserName" },
+        { label: "鍙戞斁鏃ユ湡", prop: "issueDate" },
+        { label: "鍥炴敹浜�", prop: "recycleUserName" },
+        { label: "鍥炴敹鏃ユ湡", prop: "recycleDate" },
+        {
+          dataType: "action",
+          fixed: "right",
+          label: "鎿嶄綔",
+          operation: [
+            {
+              name: "鍥炴敹璁板綍",
+              type: "text",
+              clickFun: (row) => {
+                this.handleUpdate(row);
+              }
+            },
+            {
+              name: "鍒犻櫎",
+              type: "text",
+              clickFun: (row) => {
+                this.handleDelete(row);
+              },
+              disabFun: (row, index) => {
+                return row.documentState == '閫氳繃'
+              }
+            },
+            {
+              name: "鏌ョ湅闄勪欢",
+              type: "text",
+              clickFun: (row) => {
+                this.handleLook(row);
+              },
+              disabFun: (row, index) => {
+                return !row.url
+              }
+            },
+            {
+              name: "瀹℃牳",
+              type: "text",
+              clickFun: (row) => {
+                this.handleCheck(row);
+              },
+              disabFun: (row, index) => {
+                return row.receiveUser != this.userId || row.documentState == '閫氳繃'
+              }
+            },
+          ],
+        },
+      ],
+      page: {
+        total: 0,
+        size: 10,
+        current: 0,
+      },
+      tableLoading: false,
+    }
+  },
+  mounted() {
+    this.getList()
+    this.getAuthorizedPerson()
+    this.getFileList()
+    this.getFileList0()
+    this.selectEnumByCategory()
+  },
+  methods: {
+    getPower() {
+      let power = JSON.parse(sessionStorage.getItem('power'))
+      let out = false
+      let del = false
+      let add = false
+      // let check = false
+      for (var i = 0; i < power.length; i++) {
+        if (power[i].menuMethod == 'exportManageDocumentIssueRecycle') {
+          out = true
+        }
+        if (power[i].menuMethod == 'addManageDocumentIssueRecycle') {
+          add = true
+        }
+        if (power[i].menuMethod == 'delManageDocumentIssueRecycle') {
+          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 (!add) {
+        this.componentData.do.splice(0, 1)
+      }
+      this.addPower = add
+      this.outPower = out
+    },
+    getList() {
+      this.tableLoading = true;
+      let param = { ...this.queryParams, ...this.page };
+      delete param.total;
+      pageManageDocumentIssueRecycle({ ...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();
+    },
+    refresh() {
+      this.queryParams = {};
+      this.page.current = 1;
+      this.getList();
+    },
+    refreshTable() {
+      this.page.current = 1;
+      this.getList();
+    },
+    selectEnumByCategory() {
+      // 鏂囦欢鐘舵��
+      this.getDicts("document_state").then((response) => {
+        this.fileState = this.dictToValue(response.data);
+      });
+    },
+    // 鑾峰彇浜哄憳鍒楄〃
+    getAuthorizedPerson() {
+      selectUserCondition().then(res => {
+        let data = []
+        res.data.forEach(a => {
+          data.push({
+            label: a.name,
+            value: a.id
+          })
+        })
+        this.personList = data
+      })
+    },
+    // 鑾峰彇鏂囦欢鍒楄〃--鏂囦欢娓呭崟
+    getFileList() {
+      pageManageDocumentList({
+        current: -1,
+        size: -1
+      }).then(res => {
+        this.fileList = res.data.records
+      }).catch(err => { })
+    },
+    // 鑾峰彇鏂囦欢鍒楄〃--浣滃簾鏂囦欢
+    getFileList0() {
+      pageManageDocumentCancel({
+        current: -1,
+        size: -1
+      }).then(res => {
+        this.fileList0 = res.data.records
+      }).catch(err => { })
+    },
+    // 瀵煎嚭
+    handleOut() {
+      this.outLoading = true
+      // queryParams
+      exportManageDocumentIssueRecycle(this.queryParams).then(res => {
+        this.outLoading = false
+        const blob = new Blob([res], { type: 'application/octet-stream' });
+        this.$download.saveAs(blob, '鍙戞斁鍥炴敹璁板綍.xlsx');
+      })
+    },
+    changeFileList(e) {
+      if (e) {
+        let obj = this.fileList.find(a => a.documentCode == e)
+        if (obj) {
+          this.addInfo.name = obj.name
+          this.addInfo.version = obj.version
+          this.addInfo.state = obj.state
+        }
+      }
+    },
+    // 鎻愪氦
+    handleAdd() {
+      if (!this.addInfo.documentCode) {
+        this.$message.error('璇烽�夋嫨鏂囦欢')
+        return
+      }
+      if (!this.addInfo.receiveUser) {
+        this.$message.error('璇烽�夋嫨瀹℃壒浜�')
+        return
+      }
+      if (this.radio == '鍙戞斁') {
+        if (!this.addInfo.issueUser) {
+          this.$message.error('璇烽�夋嫨鍙戞斁浜�')
+          return
+        }
+      } else {
+        if (!this.addInfo.recycleUser) {
+          this.$message.error('璇烽�夋嫨鍥炴敹浜�')
+          return
+        }
+      }
+      this.addLoading = true;
+      if (!this.addInfo.id) {
+        // 鏂板鍙戞斁璁板綍
+        let fd = new FormData();
+        //鏂囦欢淇℃伅涓璻aw鎵嶆槸鐪熺殑鏂囦欢
+        if (this.file) {
+          fd.append("file", this.file.raw);
+        }
+        for (let key in this.addInfo) {
+          fd.append(key, this.addInfo[key])
+        }
+        addManageDocumentIssueRecycle(fd).then(res => {
+          this.addLoading = false;
+          if (res.code == 200) {
+            this.$message.success('鍙戞斁鎴愬姛')
+            this.addDialogVisible = false
+            this.refreshTable()
+          }
+        })
+      } else {
+        let { documentCode, id, issueUser, recycleUser, receiveUser, name, version, documentState, issueCode, recycleCode, issueDate, recycleDate, issueNote, recycleNote } = this.addInfo
+        // 娣诲姞鍥炴敹璁板綍
+        doManageDocumentIssueRecycle({
+          documentCode,
+          id,
+          issueUser,
+          recycleUser,
+          receiveUser,
+          name,
+          version,
+          documentState,
+          issueCode,
+          recycleCode,
+          issueDate,
+          recycleDate,
+          issueNote,
+          recycleNote
+        }).then(res => {
+          this.addLoading = false;
+          if (res.code == 200) {
+            this.$message.success('鎻愪氦鎴愬姛')
+            this.addDialogVisible = false
+            this.refreshTable()
+          }
+        })
+      }
+    },
+    // 娣诲姞鍥炴敹
+    handleUpdate(row) {
+      this.addInfo = this.HaveJson(row)
+      this.radio = '鍥炴敹'
+      this.addDialogVisible = true
+    },
+    // 瀹℃牳
+    handleCheck(row) {
+      this.$confirm('鏄惁瀹℃牳閫氳繃?', '鎻愮ず', {
+        confirmButtonText: '閫氳繃',
+        cancelButtonText: '涓嶉�氳繃',
+        type: 'warning',
+        closeOnClickModal: false, // 绂佹鐐瑰嚮閬僵灞傚叧闂�
+        distinguishCancelAndClose: true,
+        beforeClose: (action, instance, done) => {
+          if (action === 'confirm') {
+            // 鐐瑰嚮鈥滅‘瀹氣�濇寜閽紝鍏佽鍏抽棴
+            checkManageDocumentIssueRecycle({ id: row.id, documentState: '閫氳繃' }).then(res => {
+              this.refreshTable()
+              done();
+              this.$message({
+                type: 'success',
+                message: '鎻愪氦鎴愬姛'
+              })
+            })
+              .catch(err => {
+
+              })
+          } else if (action === 'cancel') {
+            // 鐐瑰嚮鈥滃彇娑堚�濇寜閽紝涓嶅厑璁稿叧闂�
+            checkManageDocumentIssueRecycle({ id: row.id, documentState: '涓嶉�氳繃' }).then(res => {
+              this.refreshTable()
+              done();
+              this.$message({
+                type: 'success',
+                message: '鎻愪氦鎴愬姛'
+              })
+            })
+              .catch(err => {
+
+              })
+          } else if (action === 'close') {
+            // 鐐瑰嚮鈥溍椻�濇寜閽紝涓嶅厑璁稿叧闂�
+            done();
+            console.log("脳鎸夐挳鐐瑰嚮浜嬩欢锛屼笉鍏抽棴寮规");
+          }
+        }
+      })
+    },
+    handleChangeUpload(file, fileLists) {
+      this.file = file
+      this.$set(this.addInfo, 'name', file.name)
+    },
+    // 鏌ョ湅闄勪欢
+    handleLook(row) {
+      this.currentInfo = this.HaveJson(row)
+      this.lookDialogVisible = true
+    },
+    handleDelete(row) {
+      this.$confirm("鏄惁鍒犻櫎璇ユ潯鏁版嵁?", "鎻愮ず", {
+        confirmButtonText: "纭畾",
+        cancelButtonText: "鍙栨秷",
+        type: "warning",
+      })
+        .then(() => {
+          delManageDocumentIssueRecycle({ 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;
+}
+</style>

--
Gitblit v1.9.3