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

diff --git a/src/views/CNAS/systemManagement/documentControl/components/FileObsoletionRequest.vue b/src/views/CNAS/systemManagement/documentControl/components/FileObsoletionRequest.vue
new file mode 100644
index 0000000..2ce1df6
--- /dev/null
+++ b/src/views/CNAS/systemManagement/documentControl/components/FileObsoletionRequest.vue
@@ -0,0 +1,492 @@
+<template>
+  <!-- 鏂囦欢浣滃簾鐢宠 -->
+  <div class="file-obsoletion-request" 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" 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 = {}">鏂囦欢浣滃簾鐢宠</el-button>
+        <el-button :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 :visible.sync="addDialogVisible" title="鏂囦欢浣滃簾鐢宠" top="10vh" width="800px">
+      <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-select v-model="addInfo.documentCode" 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 :span="12" style="margin-bottom: 16px;">
+          <div class="search_thing">
+            <div class="search_label">瀹℃壒浜猴細</div>
+            <div class="search_input">
+              <el-select v-model="addInfo.checkUser" 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" 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" 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" 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 :span="12" style="margin-bottom: 16px;">
+          <div class="search_thing">
+            <div class="search_label">浣滃簾鏂瑰紡锛�</div>
+            <div class="search_input">
+              <el-select v-model="addInfo.method" size="small" style="width: 100%;">
+                <el-option label="浣滃簾" value="浣滃簾"></el-option>
+                <el-option label="鏃犳晥" 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-date-picker v-model="addInfo.expectCancelDate" 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 :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.actuallyCancelDate" 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 :span="12" style="margin-bottom: 16px;">
+          <div class="search_thing">
+            <div class="search_label">浣滃簾璇存槑锛�</div>
+            <div class="search_input"><el-input v-model="addInfo.cancelNote" :rows="2" clearable placeholder="璇疯緭鍏�"
+                size="small" type="textarea"></el-input></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>
+  </div>
+</template>
+
+<script>
+import limsTable from "@/components/Table/lims-table.vue";
+import {
+  selectUserCondition,
+} from "@/api/system/user.js";
+import {
+  addManageDocumentCancel,
+  pageManageDocumentList,
+  doManageDocumentCancel,
+  checkManageDocumentCancel,
+  exportManageDocumentCancel,
+  delManageDocumentCancel,
+  pageManageDocumentCancel,
+} from '@/api/cnas/systemManagement/documentControl.js'
+import { mapGetters } from "vuex";
+export default {
+  components: {
+    limsTable
+  },
+  computed: {
+    ...mapGetters(["userId"]),
+  },
+  data() {
+    return {
+      addPower: false,
+      outPower: false,
+      addInfo: {},
+      addLoading: false,
+      addDialogVisible: false,
+      personList: [],
+      fileList: [],
+      outLoading: false,
+      fileState: [],
+      queryParams: {},
+      tableData: [],
+      column: [
+        { label: "鏂囦欢缂栧彿", prop: "documentCode" },
+        { label: "鐢宠浜�", prop: "createUserName", width: "120px" },
+        {
+          label: "浣滃簾璇存槑",
+          prop: "cancelNote",
+        },
+        { label: "鏈熸湜浣滃簾鏃堕棿", prop: "expectCancelDate" },
+        { label: "瀹為檯浣滃簾鏃ユ湡", prop: "actuallyCancelDate" },
+        {
+          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, index) => {
+                return row.state == '閫氳繃'
+              }
+            },
+            {
+              name: "鍒犻櫎",
+              type: "text",
+              clickFun: (row) => {
+                this.handleDelete(row);
+              },
+              disabled: (row, index) => {
+                return row.state == '閫氳繃'
+              }
+            },
+            {
+              name: "瀹℃牳",
+              type: "text",
+              clickFun: (row) => {
+                this.handleCheck(row);
+              },
+              disabled: (row, index) => {
+                return row.checkUser != this.userId || row.state == '閫氳繃'
+              }
+            },
+          ],
+        },
+      ],
+      page: {
+        total: 0,
+        size: 10,
+        current: 0,
+      },
+      tableLoading: false,
+    }
+  },
+  mounted() {
+    this.getList()
+    this.getAuthorizedPerson()
+    this.getFileList()
+    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 == 'exportManageDocumentCancel') {
+          out = true
+        }
+        if (power[i].menuMethod == 'addManageDocumentCancel') {
+          add = true
+        }
+        if (power[i].menuMethod == 'delManageDocumentCancel') {
+          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;
+      pageManageDocumentCancel({ ...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 => { })
+    },
+    // 鎻愪氦
+    handleAdd() {
+      if (!this.addInfo.documentCode) {
+        this.$message.error('璇疯緭鍏ョ敵璇风紪鍙�')
+        return false
+      }
+      this.addInfo.method = '浣滃簾'
+      this.addLoading = true
+      if (!this.addInfo.id) {
+        // 鏂板
+        addManageDocumentCancel(this.addInfo).then(res => {
+          this.addLoading = false
+          this.refreshTable()
+          this.$message({
+            type: 'success',
+            message: '鎻愪氦鎴愬姛'
+          })
+          this.addDialogVisible = false
+        }).catch(err => { })
+      } else {
+        // 缂栬緫
+        doManageDocumentCancel({
+          id: this.addInfo.id,
+          method: '浣滃簾',
+          documentCode: this.addInfo.documentCode,
+          checkUser: this.addInfo.checkUser,
+          name: this.addInfo.name,
+          version: this.addInfo.version,
+          documentState: this.addInfo.documentState,
+          expectCancelDate: this.addInfo.expectCancelDate,
+          actuallyCancelDate: this.addInfo.actuallyCancelDate,
+          cancelNote: this.addInfo.cancelNote,
+        }).then(res => {
+          this.addLoading = false
+          this.refreshTable()
+          this.$message({
+            type: 'success',
+            message: '鎻愪氦鎴愬姛'
+          })
+          this.addDialogVisible = false
+        }).catch(err => { })
+      }
+
+    },
+    // 閫変腑鏂囦欢
+    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.documentState = obj.state
+        }
+      }
+    },
+    handleUpdate(row) {
+      this.addInfo = this.HaveJson(row)
+      this.addDialogVisible = true
+    },
+    // 瀹℃牳
+    handleCheck(row) {
+      this.$confirm('鏄惁瀹℃牳閫氳繃?', '鎻愮ず', {
+        confirmButtonText: '閫氳繃',
+        cancelButtonText: '涓嶉�氳繃',
+        type: 'warning',
+        closeOnClickModal: false, // 绂佹鐐瑰嚮閬僵灞傚叧闂�
+        distinguishCancelAndClose: true,
+        beforeClose: (action, instance, done) => {
+          if (action === 'confirm') {
+            // 鐐瑰嚮鈥滅‘瀹氣�濇寜閽紝鍏佽鍏抽棴
+            checkManageDocumentCancel({ id: row.id, state: '閫氳繃' }).then(res => {
+              this.refreshTable()
+              done();
+              this.$message({
+                type: 'success',
+                message: '鎻愪氦鎴愬姛'
+              })
+            })
+              .catch(err => {
+
+              })
+          } else if (action === 'cancel') {
+            // 鐐瑰嚮鈥滃彇娑堚�濇寜閽紝涓嶅厑璁稿叧闂�
+            checkManageDocumentCancel({ id: row.id, state: '涓嶉�氳繃' }).then(res => {
+              this.refreshTable()
+              done();
+              this.$message({
+                type: 'success',
+                message: '鎻愪氦鎴愬姛'
+              })
+            })
+              .catch(err => {
+
+              })
+          } else if (action === 'close') {
+            // 鐐瑰嚮鈥溍椻�濇寜閽紝涓嶅厑璁稿叧闂�
+            done();
+            console.log("脳鎸夐挳鐐瑰嚮浜嬩欢锛屼笉鍏抽棴寮规");
+          }
+        }
+      })
+    },
+    // 瀵煎嚭
+    handleOut() {
+      this.outLoading = true
+      exportManageDocumentCancel(this.queryParams).then(res => {
+        this.outLoading = false
+        const blob = new Blob([res], { type: 'application/octet-stream' });
+        this.$download.saveAs(blob, '鏂囦欢浣滃簾琛�.xlsx')
+      })
+    },
+    handleDelete(row) {
+      this.$confirm("鏄惁鍒犻櫎璇ユ潯鏁版嵁?", "鎻愮ず", {
+        confirmButtonText: "纭畾",
+        cancelButtonText: "鍙栨秷",
+        type: "warning",
+      })
+        .then(() => {
+          delManageDocumentCancel({ 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