Browse Source

科室字典增加导出

hsh 1 year ago
parent
commit
1bc75832c3
1 changed files with 72 additions and 3 deletions
  1. 72 3
      src/views/dictionary/personnel/DeptDict.vue

+ 72 - 3
src/views/dictionary/personnel/DeptDict.vue

@@ -4,7 +4,7 @@
             <el-input v-model="text" class="w-50 m-2" style="width: 160px" placeholder="请输入关键字" clearable />
             <el-button type="primary" icon="Search" @click="qeryDeptDict" style="margin-left: 5px">查询</el-button>
             <el-button type="primary" icon="Plus" @click="addDeptInfo" style="margin-left: 5px">新增科室</el-button>
-            <!-- <el-button type="primary" icon="Download" @click="exportData" style="margin-left: 5px">导出</el-button> -->
+            <el-button type="primary" icon="Download" @click="exportData" style="margin-left: 5px">导出</el-button>
         </template>
         <template #main>
             <el-table :data="tableData.slice(pageSize * (currentPage - 1), pageSize * currentPage)" border
@@ -80,12 +80,14 @@
     </el-dialog>
 </template>
 <script setup name="DeptDict">
-import { ref, reactive, onMounted, nextTick } from 'vue'
+import { ref, onMounted, nextTick } from 'vue'
 import PageLayer from '@/layout/PageLayer.vue'
 import store from '@/store'
 import { ElMessage, ElMessageBox } from 'element-plus'
 import { selectDeptDict, selectDeptDictByCode, updateDeptStopOrUsed, delDeptDictByCode } from '@/api/dictionary/personnel/deptDict.js'
 import DeptInformation from '@/views/dictionary/personnel/DeptInformation.vue'
+import { Export } from '@/utils/ExportExcel'
+import { clone } from '@/utils/clone'
 
 const windowSize = store.state.app.windowSize;
 const tableHeight = windowSize.h / 1.07;
@@ -152,7 +154,7 @@ const handleDelete = (row) => {
         })
     }).catch((action) => {
         if (action === 'cancel') {
-  
+
         }
     })
 
@@ -199,4 +201,71 @@ const closeDeptEditAdd = () => {
     qeryDeptDict()
 }
 
+// 导出科室
+const exportData = () => {
+    if (tableData.value.length === 0) {
+        ElMessage({
+            message: "没有可以导出的数据!",
+            type: "warning",
+            duration: 2500,
+            showClose: true,
+        });
+    } else {
+        const title = {
+            delFlag: "停用",
+            code: "科室编码",
+            name: "名称",
+            className: "分类",
+            pyCode: "拼音码",
+            dcode: "五笔码",
+            ncode: "院内码",
+            mzFlag: "门诊开放",
+            yjFlag: "医技上线",
+            xnhDeptCode: "新农合科室编码",
+            xnhDeptName: "新农合科室名称",
+            parentName: "父科室",
+            ghChargeFlag: "收取挂号费",
+            supplyFlag: "用药方式执行科室",
+            ghjzFlag: "门诊挂号就诊",
+            officePos: "就诊地点",
+        };
+
+        let d = clone(tableData.value)
+        d.forEach(val => {
+            if(val.delFlag === '1'){
+                val.delFlag = '停用'
+            } else {
+                val.delFlag = ''
+            }
+            if(val.mzFlag === '1'){
+                val.mzFlag = '是'
+            } else {
+                val.mzFlag = '否'
+            }
+            if(val.yjFlag === '1'){
+                val.yjFlag = '是'
+            } else {
+                val.yjFlag = '否'
+            }
+            if(val.ghChargeFlag === '1'){
+                val.ghChargeFlag = '是'
+            } else {
+                val.ghChargeFlag = '否'
+            }
+            if(val.supplyFlag === '1'){
+                val.supplyFlag = '是'
+            } else {
+                val.supplyFlag = '否'
+            }
+            if(val.ghjzFlag === '1'){
+                val.ghjzFlag = '是'
+            } else {
+                val.ghjzFlag = '否'
+            }
+        });
+
+        Export(d, title, "科室字典信息");
+
+    }
+}
 </script>