DeptDict.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. <template>
  2. <page-layer>
  3. <template #header>
  4. <el-input v-model="text" class="w-50 m-2" style="width: 160px" placeholder="请输入关键字" clearable />
  5. <el-button type="primary" icon="Search" @click="qeryDeptDict" style="margin-left: 5px">查询</el-button>
  6. <el-button type="primary" icon="Plus" @click="addDeptInfo" style="margin-left: 5px">新增科室</el-button>
  7. <el-button type="primary" icon="Download" @click="exportData" style="margin-left: 5px">导出</el-button>
  8. </template>
  9. <template #main>
  10. <el-table :data="tableData.slice(pageSize * (currentPage - 1), pageSize * currentPage)" border
  11. style="width: 100%" :height="tableHeight" stripe highlight-current-row>
  12. <el-table-column type="index" label="序号" width="50" fixed />
  13. <el-table-column prop="delFlag" label="停用" width="50" fixed>
  14. <template #default="scope">
  15. <span v-if="scope.row.delFlag === '1'" style="color:#d12020;">停用</span>
  16. <span v-else></span>
  17. </template>
  18. </el-table-column>
  19. <el-table-column prop="code" label="科室编码" width="120" fixed />
  20. <el-table-column prop="name" label="名称" width="180" fixed />
  21. <el-table-column prop="className" label="分类" />
  22. <el-table-column prop="pyCode" label="拼音码" width="120" />
  23. <el-table-column prop="dcode" label="五笔码" width="120" />
  24. <el-table-column prop="ncode" label="院内码" />
  25. <el-table-column prop="mzFlag" label="门诊开放">
  26. <template #default="scope">
  27. <span v-if="scope.row.mzFlag === '1'" style="color:#007175;">是</span>
  28. <span v-else style="color:#d12020;">否</span>
  29. </template>
  30. </el-table-column>
  31. <el-table-column prop="yjFlag" label="医技上线">
  32. <template #default="scope">
  33. <span v-if="scope.row.yjFlag === '1'" style="color:#007175;">是</span>
  34. <span v-else style="color:#d12020;">否</span>
  35. </template>
  36. </el-table-column>
  37. <el-table-column prop="xnhDeptCode" label="新农合科室编码" width="100" />
  38. <el-table-column prop="xnhDeptName" label="新农合科室名称" width="180" />
  39. <el-table-column prop="parentName" label="父科室" width="180" />
  40. <el-table-column prop="ghChargeFlag" label="收取挂号费">
  41. <template #default="scope">
  42. <span v-if="scope.row.ghChargeFlag === '1'" style="color:#007175;">是</span>
  43. <span v-else style="color:#d12020;">否</span>
  44. </template>
  45. </el-table-column>
  46. <el-table-column prop="supplyFlag" label="用药方式执行科室" width="120">
  47. <template #default="scope">
  48. <span v-if="scope.row.supplyFlag === '1'" style="color:#007175;">是</span>
  49. <span v-else style="color:#d12020;">否</span>
  50. </template>
  51. </el-table-column>
  52. <el-table-column prop="ghjzFlag" label="门诊挂号就诊" width="100">
  53. <template #default="scope">
  54. <span v-if="scope.row.ghjzFlag === '1'" style="color:#007175;">是</span>
  55. <span v-else style="color:#d12020;">否</span>
  56. </template>
  57. </el-table-column>
  58. <el-table-column prop="officePos" label="就诊地点" width="280" />
  59. <el-table-column label="操作" fixed="right" width="200" align="center" header-align="center">
  60. <template #default="scope">
  61. <el-button type="primary" size="small" @click="handleEdit(scope.row)">编辑</el-button>
  62. <el-button :type="scope.row.delFlag === '1' ? 'primary' : 'warning'" size="small"
  63. @click="handleStop(scope.row)">
  64. <span v-if="scope.row.delFlag === '1'">启用</span>
  65. <span v-else>停用</span>
  66. </el-button>
  67. <el-button type="danger" size="small" @click="handleDelete(scope.row)">删除</el-button>
  68. </template>
  69. </el-table-column>
  70. </el-table>
  71. <el-pagination :current-page="currentPage" :page-size="pageSize" :page-sizes="[15, 30, 45, 60]"
  72. :total="tableData.length" layout="total, sizes, prev, pager, next, jumper" style="margin-top: 5px"
  73. @size-change="handleSizeChange" @current-change="handleCurrentChange">
  74. </el-pagination>
  75. </template>
  76. </page-layer>
  77. <el-dialog v-model="showDeptEdit" :close-on-click-modal="false" :close-on-press-escape="false" :title="deptTitle"
  78. width="70%" destroy-on-close>
  79. <DeptInformation :deptDetail="deptDetail" @closeDeptEditFor="closeDeptEditAdd" />
  80. </el-dialog>
  81. </template>
  82. <script setup name="DeptDict">
  83. import { ref, onMounted, nextTick } from 'vue'
  84. import PageLayer from '@/layout/PageLayer.vue'
  85. import store from '@/store'
  86. import { ElMessage, ElMessageBox } from 'element-plus'
  87. import { selectDeptDict, selectDeptDictByCode, updateDeptStopOrUsed, delDeptDictByCode } from '@/api/dictionary/personnel/deptDict.js'
  88. import DeptInformation from '@/views/dictionary/personnel/DeptInformation.vue'
  89. import { Export } from '@/utils/ExportExcel'
  90. import { clone } from '@/utils/clone'
  91. const windowSize = store.state.app.windowSize;
  92. const tableHeight = windowSize.h / 1.07;
  93. const pageSize = ref(30)
  94. const currentPage = ref(1)
  95. const handleSizeChange = (val) => {
  96. pageSize.value = val
  97. }
  98. const handleCurrentChange = (val) => {
  99. currentPage.value = val
  100. }
  101. const text = ref('')
  102. const tableData = ref([])
  103. const deptTitle = ref('')
  104. const showDeptEdit = ref(false)
  105. const deptDetail = ref({})
  106. onMounted(() => {
  107. nextTick(() => {
  108. qeryDeptDict()
  109. })
  110. })
  111. // 查询科室字典
  112. const qeryDeptDict = () => {
  113. selectDeptDict(text.value)
  114. .then((res) => {
  115. tableData.value = res
  116. });
  117. }
  118. // 新增科室字典
  119. const addDeptInfo = () => {
  120. deptDetail.value = {}
  121. showDeptEdit.value = true
  122. }
  123. const handleEdit = (row) => {
  124. selectDeptDictByCode(row.code).then((res) => {
  125. deptTitle.value = '编辑科室信息'
  126. deptDetail.value = res
  127. showDeptEdit.value = true
  128. })
  129. }
  130. const handleDelete = (row) => {
  131. let title = '请确认是否删除<span style="color:#d12020;">' + row.name + '</span>?'
  132. ElMessageBox.confirm(title, {
  133. cancelButtonText: '取消',
  134. confirmButtonText: '确定',
  135. type: 'warning',
  136. distinguishCancelAndClose: true,
  137. dangerouslyUseHTMLString: true
  138. }).then(() => {
  139. delDeptDictByCode(row.code).then((res) => {
  140. ElMessage({
  141. type: "warning",
  142. message: res.cg,
  143. duration: 2500,
  144. showClose: true,
  145. });
  146. qeryDeptDict()
  147. return
  148. })
  149. }).catch((action) => {
  150. if (action === 'cancel') {
  151. }
  152. })
  153. }
  154. const handleStop = (row) => {
  155. let delFlag
  156. let title
  157. if ('1' === row.delFlag) {
  158. delFlag = '0'
  159. title = '请确认是否启用<span style="color:#d12020;">' + row.name + '</span>?'
  160. } else {
  161. delFlag = '1'
  162. title = '请确认是否停用<span style="color:#d12020;">' + row.name + '</span>?'
  163. }
  164. ElMessageBox.confirm(title, {
  165. cancelButtonText: '取消',
  166. confirmButtonText: '确定',
  167. type: 'warning',
  168. distinguishCancelAndClose: true,
  169. dangerouslyUseHTMLString: true
  170. }).then(() => {
  171. updateDeptStopOrUsed(row.code, delFlag).then((res) => {
  172. ElMessage({
  173. type: "warning",
  174. message: res.cg,
  175. duration: 2500,
  176. showClose: true,
  177. });
  178. qeryDeptDict()
  179. return
  180. })
  181. }).catch((action) => {
  182. if (action === 'cancel') {
  183. }
  184. })
  185. }
  186. const closeDeptEditAdd = () => {
  187. showDeptEdit.value = false
  188. qeryDeptDict()
  189. }
  190. // 导出科室
  191. const exportData = () => {
  192. if (tableData.value.length === 0) {
  193. ElMessage({
  194. message: "没有可以导出的数据!",
  195. type: "warning",
  196. duration: 2500,
  197. showClose: true,
  198. });
  199. } else {
  200. const title = {
  201. delFlag: "停用",
  202. code: "科室编码",
  203. name: "名称",
  204. className: "分类",
  205. pyCode: "拼音码",
  206. dcode: "五笔码",
  207. ncode: "院内码",
  208. mzFlag: "门诊开放",
  209. yjFlag: "医技上线",
  210. xnhDeptCode: "新农合科室编码",
  211. xnhDeptName: "新农合科室名称",
  212. parentName: "父科室",
  213. ghChargeFlag: "收取挂号费",
  214. supplyFlag: "用药方式执行科室",
  215. ghjzFlag: "门诊挂号就诊",
  216. officePos: "就诊地点",
  217. };
  218. let d = clone(tableData.value)
  219. d.forEach(val => {
  220. if(val.delFlag === '1'){
  221. val.delFlag = '停用'
  222. } else {
  223. val.delFlag = ''
  224. }
  225. if(val.mzFlag === '1'){
  226. val.mzFlag = '是'
  227. } else {
  228. val.mzFlag = '否'
  229. }
  230. if(val.yjFlag === '1'){
  231. val.yjFlag = '是'
  232. } else {
  233. val.yjFlag = '否'
  234. }
  235. if(val.ghChargeFlag === '1'){
  236. val.ghChargeFlag = '是'
  237. } else {
  238. val.ghChargeFlag = '否'
  239. }
  240. if(val.supplyFlag === '1'){
  241. val.supplyFlag = '是'
  242. } else {
  243. val.supplyFlag = '否'
  244. }
  245. if(val.ghjzFlag === '1'){
  246. val.ghjzFlag = '是'
  247. } else {
  248. val.ghjzFlag = '否'
  249. }
  250. });
  251. Export(d, title, "科室字典信息");
  252. }
  253. }
  254. </script>