Sfoglia il codice sorgente

完善科室字典配置

hsh 1 anno fa
parent
commit
d8c6761ee6

+ 27 - 0
src/api/dictionary/personnel/deptDict.js

@@ -59,4 +59,31 @@ export function saveDeptDict(data) {
         method: 'post',
         data
     })
+}
+
+/**
+ * 根据科室编码更新停用状态
+ * @param {*} code 科室编码
+ * @param {*} delFlag 停用状态(1:停用, 0:初始值)
+ * @returns 
+ */
+export function updateDeptStopOrUsed(code, delFlag) {
+    return request({
+        url: '/personnel/updateDeptStopOrUsed',
+        method: 'get',
+        params: { code, delFlag },
+    })
+}
+
+/**
+ * 根据科室编码删除科室字典信息
+ * @param {*} code 科室编码
+ * @returns 
+ */
+export function delDeptDictByCode(code){
+    return request({
+        url: '/personnel/delDeptDictByCode',
+        method: 'get',
+        params: { code },
+    })
 }

+ 87 - 18
src/views/dictionary/personnel/DeptDict.vue

@@ -3,6 +3,7 @@
         <template #header>
             <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> -->
         </template>
         <template #main>
@@ -11,7 +12,7 @@
                 <el-table-column type="index" label="序号" width="50" fixed />
                 <el-table-column prop="delFlag" label="停用" width="50" fixed>
                     <template #default="scope">
-                        <span v-if="scope.row.delFlag === '1'" style="color:#d12920;">停用</span>
+                        <span v-if="scope.row.delFlag === '1'" style="color:#d12020;">停用</span>
                         <span v-else></span>
                     </template>
                 </el-table-column>
@@ -24,13 +25,13 @@
                 <el-table-column prop="mzFlag" label="门诊开放">
                     <template #default="scope">
                         <span v-if="scope.row.mzFlag === '1'" style="color:#007175;">是</span>
-                        <span v-else></span>
+                        <span v-else style="color:#d12020;"></span>
                     </template>
                 </el-table-column>
                 <el-table-column prop="yjFlag" label="医技上线">
                     <template #default="scope">
                         <span v-if="scope.row.yjFlag === '1'" style="color:#007175;">是</span>
-                        <span v-else></span>
+                        <span v-else style="color:#d12020;"></span>
                     </template>
                 </el-table-column>
                 <el-table-column prop="xnhDeptCode" label="新农合科室编码" width="100" />
@@ -39,25 +40,30 @@
                 <el-table-column prop="ghChargeFlag" label="收取挂号费">
                     <template #default="scope">
                         <span v-if="scope.row.ghChargeFlag === '1'" style="color:#007175;">是</span>
-                        <span v-else></span>
+                        <span v-else style="color:#d12020;"></span>
                     </template>
                 </el-table-column>
                 <el-table-column prop="supplyFlag" label="用药方式执行科室" width="120">
                     <template #default="scope">
                         <span v-if="scope.row.supplyFlag === '1'" style="color:#007175;">是</span>
-                        <span v-else></span>
+                        <span v-else style="color:#d12020;"></span>
                     </template>
                 </el-table-column>
                 <el-table-column prop="ghjzFlag" label="门诊挂号就诊" width="100">
                     <template #default="scope">
                         <span v-if="scope.row.ghjzFlag === '1'" style="color:#007175;">是</span>
-                        <span v-else></span>
+                        <span v-else style="color:#d12020;"></span>
                     </template>
                 </el-table-column>
                 <el-table-column prop="officePos" label="就诊地点" width="280" />
-                <el-table-column label="操作" fixed="right" width="150" align="center" header-align="center">
+                <el-table-column label="操作" fixed="right" width="200" align="center" header-align="center">
                     <template #default="scope">
                         <el-button type="primary" size="small" @click="handleEdit(scope.row)">编辑</el-button>
+                        <el-button :type="scope.row.delFlag === '1' ? 'primary' : 'warning'" size="small"
+                            @click="handleStop(scope.row)">
+                            <span v-if="scope.row.delFlag === '1'">启用</span>
+                            <span v-else>停用</span>
+                        </el-button>
                         <el-button type="danger" size="small" @click="handleDelete(scope.row)">删除</el-button>
                     </template>
                 </el-table-column>
@@ -68,8 +74,9 @@
             </el-pagination>
         </template>
     </page-layer>
-    <el-dialog v-model="showDeptEdit" :close-on-click-modal="false" :title="deptTitle" width="70%">
-        <DeptInformation :deptDetail="deptDetail" />
+    <el-dialog v-model="showDeptEdit" :close-on-click-modal="false" :close-on-press-escape="false" :title="deptTitle"
+        width="70%" destroy-on-close>
+        <DeptInformation :deptDetail="deptDetail" @closeDeptEditFor="closeDeptEditAdd" />
     </el-dialog>
 </template>
 <script setup name="DeptDict">
@@ -77,7 +84,7 @@ import { ref, reactive, onMounted, nextTick } from 'vue'
 import PageLayer from '@/layout/PageLayer.vue'
 import store from '@/store'
 import { ElMessage, ElMessageBox } from 'element-plus'
-import { selectDeptDict, selectDeptDictByCode } from '@/api/dictionary/personnel/deptDict.js'
+import { selectDeptDict, selectDeptDictByCode, updateDeptStopOrUsed, delDeptDictByCode } from '@/api/dictionary/personnel/deptDict.js'
 import DeptInformation from '@/views/dictionary/personnel/DeptInformation.vue'
 
 const windowSize = store.state.app.windowSize;
@@ -110,6 +117,12 @@ const qeryDeptDict = () => {
         });
 }
 
+// 新增科室字典
+const addDeptInfo = () => {
+    deptDetail.value = {}
+    showDeptEdit.value = true
+}
+
 const handleEdit = (row) => {
     selectDeptDictByCode(row.code).then((res) => {
         deptTitle.value = '编辑科室信息'
@@ -119,15 +132,71 @@ const handleEdit = (row) => {
 }
 
 const handleDelete = (row) => {
-    console.log(row);
-    ElMessage({
-        type: "warning",
-        message: "功能更新中,请等待。。。",
-        duration: 2500,
-        showClose: true,
-    });
-    return
+    let title = '请确认是否删除<span style="color:#d12020;">' + row.name + '</span>?'
+    ElMessageBox.confirm(title, {
+        cancelButtonText: '取消',
+        confirmButtonText: '确定',
+        type: 'warning',
+        distinguishCancelAndClose: true,
+        dangerouslyUseHTMLString: true
+    }).then(() => {
+        delDeptDictByCode(row.code).then((res) => {
+            ElMessage({
+                type: "warning",
+                message: res.cg,
+                duration: 2500,
+                showClose: true,
+            });
+            qeryDeptDict()
+            return
+        })
+    }).catch((action) => {
+        if (action === 'cancel') {
+  
+        }
+    })
+
+}
+
+const handleStop = (row) => {
+    let delFlag
+    let title
+    if ('1' === row.delFlag) {
+        delFlag = '0'
+        title = '请确认是否启用<span style="color:#d12020;">' + row.name + '</span>?'
+    } else {
+        delFlag = '1'
+        title = '请确认是否停用<span style="color:#d12020;">' + row.name + '</span>?'
+    }
+
+    ElMessageBox.confirm(title, {
+        cancelButtonText: '取消',
+        confirmButtonText: '确定',
+        type: 'warning',
+        distinguishCancelAndClose: true,
+        dangerouslyUseHTMLString: true
+    }).then(() => {
+        updateDeptStopOrUsed(row.code, delFlag).then((res) => {
+            ElMessage({
+                type: "warning",
+                message: res.cg,
+                duration: 2500,
+                showClose: true,
+            });
+            qeryDeptDict()
+            return
+        })
+    }).catch((action) => {
+        if (action === 'cancel') {
+
+        }
+    })
+}
+
+const closeDeptEditAdd = () => {
+    showDeptEdit.value = false
 
+    qeryDeptDict()
 }
 
 </script>

+ 12 - 15
src/views/dictionary/personnel/DeptInformation.vue

@@ -115,7 +115,6 @@
 import { ref, onMounted, nextTick } from 'vue'
 import PageLayer from '@/layout/PageLayer.vue'
 import { selectDeptDictForEffective, selectUnitClass, saveDeptDict } from '@/api/dictionary/personnel/deptDict.js'
-// import { FormInstance, FormRules } from 'element-plus'
 import { ElMessage, ElMessageBox } from 'element-plus'
 const props = defineProps({
     deptDetail: {
@@ -123,6 +122,7 @@ const props = defineProps({
         default: {}
     }
 })
+const emit = defineEmits(['closeDeptEditFor'])
 let deptForm = ref({
     code: '', // 科室编码
     name: '', // 科室名称
@@ -145,7 +145,6 @@ const deptUseList = ref([])
 const unitClassList = ref([])
 
 watch(() => props.deptDetail, () => {
-    console.log(props.deptDetail)
     deptForm.value = props.deptDetail
 })
 
@@ -183,21 +182,19 @@ const submitForm = async (formEl) => {
         type: 'warning',
         distinguishCancelAndClose: true,
     }).then(() => {
-        console.log('确定&取消')
-        ElMessage({
-            type: "success",
-            message: "功能更新中,请等待。。。",
-            duration: 2500,
-            showClose: true,
-        });
-        return
-        // await saveDeptDict(deptForm).then((res) => {
-        //     console.log(res)
-
-        // })
+        saveDeptDict(deptForm.value).then((res) => {
+            emit('closeDeptEditFor', {})
+            ElMessage({
+                type: "success",
+                message: res.cg,
+                duration: 2500,
+                showClose: true,
+            });
+            return
+        })
     }).catch((action) => {
         if (action === 'cancel') {
-            console.log('取消')
+            emit('closeDeptEditFor', {})
         }
     })