YpDictInfo.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552
  1. <template>
  2. <div class="layout_display_flex_y">
  3. <div style="margin-bottom: 6px; background-color: #fff;">
  4. <el-input v-model="text" class="w-50 m-2" style="width: 320px" placeholder="请输入编码/名称/首拼/五笔" clearable>
  5. <template #prepend>编码/名称/首拼/五笔 </template>
  6. </el-input>
  7. <el-select v-model="groupNo" placeholder="请选择药库" filterable clearable style="width: 240px;margin-left: 3px">
  8. <el-option v-for="item in ypGroupNameData" :key="item.code" :label="item.name" :value="item.code">
  9. <span style="float: left">{{ item.label }}</span>
  10. <span style="float: right; color: var(--el-text-color-secondary); font-size: 13px; ">
  11. {{ item.value }}
  12. </span>
  13. </el-option>
  14. </el-select>
  15. <el-switch v-model="isSee" inline-prompt active-text="停用可见" inactive-text="停用不可见" active-value="0" inactive-value="1"
  16. style="--el-switch-on-color: #13ce66; --el-switch-off-color: #ff4949; margin-left: 5px"/>
  17. <el-button type="primary" icon="Search" @click="queryYpDict" style="margin-left: 5px">查询</el-button>
  18. <el-button type="primary" icon="Plus" @click="addYpDict" style="margin-left: 5px">新增</el-button>
  19. <el-button type="primary" icon="Download" @click="exportData" style="margin-left: 5px">导出</el-button>
  20. </div>
  21. <div class="layout_display_flex_y layout_flex_1-y">
  22. <div class="layout_flex_1-y">
  23. <el-table :data="drugDictData.slice(pageSize * (currentPage - 1), pageSize * currentPage)" border
  24. style="width: 100%" height="100%" stripe highlight-current-row>
  25. <el-table-column type="index" label="序号" width="60" />
  26. <el-table-column prop="code" label="药品编码" width="80" />
  27. <el-table-column prop="serial" label="药品包装" width="70" />
  28. <el-table-column prop="name" label="药品名称" width="240" show-overflow-tooltip />
  29. <el-table-column prop="specification" label="药品规格" width="180" show-overflow-tooltip />
  30. <el-table-column prop="packRetprice" label="药品零售价" width="100" />
  31. <el-table-column prop="manuFactory" label="生产厂家" width="200" show-overflow-tooltip />
  32. <el-table-column prop="delFlag" label="状态" width="70">
  33. <template #default="scope">
  34. <span v-if="scope.row.delFlag === '1'" style="color:#d12020;">停用</span>
  35. <span v-else></span>
  36. </template>
  37. </el-table-column>
  38. <el-table-column prop="ykFlag" label="药库状态" width="80" v-if="isYk">
  39. <template #default="scope">
  40. <span v-if="scope.row.ykFlag === '1'" style="color:#d12020;">药库停用</span>
  41. <span v-else></span>
  42. </template>
  43. </el-table-column>
  44. <el-table-column prop="pyCode" label="拼音码" width="150" />
  45. <el-table-column prop="dCode" label="五笔码" width="150" />
  46. <el-table-column fixed="right" label="操作" min-width="625" width="625" center>
  47. <template #default="scope">
  48. <el-button type="primary" size="small" v-if="!scope.row.isEdit"
  49. @click="editYpDict(scope.row)">编辑</el-button>
  50. <el-button :type="scope.row.tempPurchaseFlag === '1' ? 'primary' : 'info'" size="small"
  51. v-if="!scope.row.isEdit" @click="tempPurchase(scope.row)">临购</el-button>
  52. <el-button :type="scope.row.jbFlag === '1' ? 'primary' : 'info'" size="small"
  53. v-if="!scope.row.isEdit" @click="baseDrugConfirm(scope.row)">基本</el-button>
  54. <el-button :type="scope.row.highWarningFlag === '1' ? 'primary' : 'info'" size="small"
  55. v-if="!scope.row.isEdit" @click="highWarningDrug(scope.row)">高警示</el-button>
  56. <el-button :type="scope.row.winningBidderFlag === '1' ? 'primary' : 'info'" size="small"
  57. v-if="!scope.row.isEdit" @click="winningBidderDrug(scope.row)">带量中选</el-button>
  58. <el-button :type="scope.row.focusMonitorFlag === '1' ? 'primary' : 'info'" size="small"
  59. v-if="!scope.row.isEdit" @click="focusMonitorDrug(scope.row)">重点监控</el-button>
  60. <el-button type="primary" size="small" v-if="!scope.row.isEdit"
  61. @click="editYpDictName(scope.row)">别名</el-button>
  62. <el-button :type="scope.row.delFlag === '1' ? 'info' : 'primary'" size="small"
  63. @click="stopYpDict(scope.row)">
  64. <span v-if="scope.row.delFlag === '1'">启用</span>
  65. <span v-else>停用</span>
  66. </el-button>
  67. <el-button :type="scope.row.ykFlag === '1' ? 'info' : 'primary'" size="small"
  68. @click="stopYkYpDict(scope.row)" v-show="isYk">
  69. <span v-if="scope.row.ykFlag === '1'">药库启用</span>
  70. <span v-else>药库停用</span>
  71. </el-button>
  72. </template>
  73. </el-table-column>
  74. </el-table>
  75. </div>
  76. <div>
  77. <el-pagination :current-page="currentPage" :page-size="pageSize" :page-sizes="[15, 30, 45, 60]"
  78. :total="drugDictData.length" layout="total, sizes, prev, pager, next, jumper" style="margin-top: 5px"
  79. @size-change="handleSizeChange" @current-change="handleCurrentChange">
  80. </el-pagination>
  81. </div>
  82. </div>
  83. </div>
  84. <el-dialog v-model="showYpEdit" :close-on-click-modal="false" :close-on-press-escape="false" :title="ypTitle"
  85. class="yp-edit-dialog" width="80%" destroy-on-close fullscreen>
  86. <YpZdDict :ypDetail="ypDetail" @closeYpEditFor="closeYpEditAdd" />
  87. </el-dialog>
  88. <el-dialog v-model="showYpPrintName" :close-on-click-modal="false" :close-on-press-escape="false"
  89. :title="ypPrintName" width="80%" destroy-on-close>
  90. <YpPrintName :ypPrintNameDetail="ypPrintNameDetail" @closeYpPrintNameEditFor="closeYpPrintName" />
  91. </el-dialog>
  92. </template>
  93. <script setup name="YpDictInfo">
  94. import {nextTick, onMounted, ref} from 'vue'
  95. import {ElMessage, ElMessageBox} from 'element-plus'
  96. import {clone} from '@/utils/clone'
  97. import {Export} from '@/utils/ExportExcel'
  98. import {
  99. selectYpDict,
  100. selectYpDictByCode,
  101. selectYpGroupNameByYfFlag,
  102. selectYpStorageInfo,
  103. updateYkYpStopOrUsed,
  104. updateYpJbFlag,
  105. updateYpStopOrUsed,
  106. updateYpTempPurchase,
  107. updateYpHighWarning,
  108. updateYpWinningBidder,
  109. updateYpFocusMonitor
  110. } from '@/api/yp-dict/yp-dict-info.js'
  111. import YpZdDict from '@/views/yp-dict/YpZdDict.vue'
  112. import YpPrintName from '@/views/yp-dict/YpPrintName.vue'
  113. const text = ref('')
  114. const isSee = ref('1')
  115. const drugDictData = ref([])
  116. const ypTitle = ref('')
  117. const showYpEdit = ref(false)
  118. const ypDetail = ref({})
  119. const ypPrintName = ref('')
  120. const showYpPrintName = ref(false)
  121. const ypPrintNameDetail = ref({})
  122. const ypGroupNameData = ref([])
  123. const groupNo = ref('')
  124. const isYk = ref(false)
  125. const pageSize = ref(30)
  126. const currentPage = ref(1)
  127. const handleSizeChange = (val) => {
  128. pageSize.value = val
  129. }
  130. const handleCurrentChange = (val) => {
  131. currentPage.value = val
  132. }
  133. onMounted(() => {
  134. nextTick(() => {
  135. queryYpGroupNameByYfFlag('')
  136. queryYpDict()
  137. })
  138. })
  139. // 查询所有药库明细
  140. const queryYpGroupNameByYfFlag = (val) => {
  141. selectYpGroupNameByYfFlag(val, '0')
  142. .then((res) => {
  143. ypGroupNameData.value = res
  144. })
  145. .catch(() => {
  146. ypGroupNameData.value = []
  147. })
  148. }
  149. // 查询
  150. const queryYpDict = () => {
  151. isYk.value = !!groupNo.value;
  152. if(groupNo.value === undefined){
  153. groupNo.value = ''
  154. }
  155. selectYpDict(text.value, groupNo.value, isSee.value)
  156. .then((res) => {
  157. drugDictData.value = res
  158. })
  159. .catch(() => {
  160. drugDictData.value = []
  161. })
  162. }
  163. // 新增
  164. const addYpDict = () => {
  165. ypTitle.value = '新增药品账页信息'
  166. // 新增标识
  167. ypDetail.value.modeFlag = 'add'
  168. showYpEdit.value = true
  169. }
  170. const closeYpEditAdd = () => {
  171. showYpEdit.value = false
  172. queryYpDict()
  173. }
  174. // 编辑
  175. const editYpDict = (row) => {
  176. selectYpDictByCode(row.code, row.serial).then((res) => {
  177. ypTitle.value = '编码:' + row.code + ' 序号:' + row.serial + ' 规格:' + row.specification + ' 名称:' + row.name + ' 账页信息'
  178. ypDetail.value = res
  179. // 修改标识
  180. ypDetail.value.modeFlag = 'edit'
  181. showYpEdit.value = true
  182. })
  183. }
  184. // 编辑别名
  185. const editYpDictName = (row) => {
  186. ypPrintName.value = row.name + "别名"
  187. showYpPrintName.value = true
  188. ypPrintNameDetail.value.chargeCode = row.code
  189. }
  190. const closeYpPrintName = () => {
  191. showYpPrintName.value = false
  192. queryYpDict()
  193. }
  194. const stopYpDict = (row) => {
  195. let delFlag
  196. let title
  197. if ('1' === row.delFlag) {
  198. delFlag = '0'
  199. title = '请确认是否启用<span style="color:#d12020;">' + row.name + '</span>?'
  200. } else {
  201. delFlag = '1'
  202. title = '请确认是否停用<span style="color:#d12020;">(药房也全部停用)</span><span style="color:#d12020;">' + row.name + '</span>?'
  203. }
  204. // 查询停用药品是否存在库存
  205. if('1' !== row.delFlag) {
  206. selectYpStorageInfo(row.code, '').then((res) => {
  207. ElMessageBox.confirm(res.msg, {
  208. cancelButtonText: '取消',
  209. confirmButtonText: '确定',
  210. type: 'warning',
  211. distinguishCancelAndClose: true,
  212. dangerouslyUseHTMLString: true
  213. }).then(() => {
  214. callSaveYpDict(title, row, delFlag)
  215. }).catch((action) => {
  216. if (action === 'cancel') {
  217. queryYpDict()
  218. }
  219. })
  220. })
  221. } else {
  222. callSaveYpDict(title, row, delFlag)
  223. }
  224. }
  225. const callSaveYpDict = (title, row, delFlag) => {
  226. ElMessageBox.confirm(title, {
  227. cancelButtonText: '取消',
  228. confirmButtonText: '确定',
  229. type: 'warning',
  230. distinguishCancelAndClose: true,
  231. dangerouslyUseHTMLString: true
  232. }).then(() => {
  233. updateYpStopOrUsed(row.code, row.serial, delFlag).then((res) => {
  234. ElMessage({
  235. type: "success",
  236. message: res.cg,
  237. duration: 2500,
  238. showClose: true,
  239. });
  240. queryYpDict()
  241. })
  242. }).catch((action) => {
  243. if (action === 'cancel') {
  244. queryYpDict()
  245. }
  246. })
  247. }
  248. // 设置成临购药品
  249. const tempPurchase = (row) => {
  250. let flag
  251. let title
  252. if ('1' === row.tempPurchaseFlag) {
  253. flag = ''
  254. title = '请确认是否停止临购药品<span style="color:#d12020;">' + row.name + '</span>?'
  255. } else {
  256. flag = '1'
  257. title = '请确认是否设置成临购药品<span style="color:#d12020;">' + row.name + '</span>?'
  258. }
  259. ElMessageBox.confirm(title, {
  260. cancelButtonText: '取消',
  261. confirmButtonText: '确定',
  262. type: 'warning',
  263. distinguishCancelAndClose: true,
  264. dangerouslyUseHTMLString: true
  265. }).then(() => {
  266. updateYpTempPurchase(row.code, row.serial, flag).then((res) => {
  267. ElMessage({
  268. type: "success",
  269. message: res.cg,
  270. duration: 2500,
  271. showClose: true,
  272. });
  273. queryYpDict()
  274. })
  275. }).catch((action) => {
  276. if (action === 'cancel') {
  277. queryYpDict()
  278. }
  279. })
  280. }
  281. // 药库药品是否启用/停用操作
  282. const stopYkYpDict = (row) => {
  283. let delFlag
  284. let title
  285. if (!groupNo.value) {
  286. ElMessage({
  287. type: "warning",
  288. message: "请选择药库!",
  289. duration: 2500,
  290. showClose: true,
  291. });
  292. return
  293. }
  294. if ('1' === row.ykFlag) {
  295. delFlag = '0'
  296. title = '请确认药库是否启用<span style="color:#d12020;">' + row.name + '</span>?'
  297. } else {
  298. delFlag = '1'
  299. title = '请确认药库是否停用<span style="color:#d12020;">' + row.name + '</span>?'
  300. }
  301. // 查询药库停用药品是否存在库存
  302. if('1' !== row.ykFlag) {
  303. selectYpStorageInfo(row.code, groupNo.value).then((res) => {
  304. ElMessageBox.confirm(res.msg, {
  305. cancelButtonText: '取消',
  306. confirmButtonText: '确定',
  307. type: 'warning',
  308. distinguishCancelAndClose: true,
  309. dangerouslyUseHTMLString: true
  310. }).then(() => {
  311. callYkYpStopOrUsed(title, row, delFlag)
  312. }).catch((action) => {
  313. if (action === 'cancel') {
  314. queryYpDict()
  315. }
  316. })
  317. })
  318. } else {
  319. callYkYpStopOrUsed(title, row, delFlag)
  320. }
  321. }
  322. const callYkYpStopOrUsed = (title, row, delFlag) => {
  323. ElMessageBox.confirm(title, {
  324. cancelButtonText: '取消',
  325. confirmButtonText: '确定',
  326. type: 'warning',
  327. distinguishCancelAndClose: true,
  328. dangerouslyUseHTMLString: true
  329. }).then(() => {
  330. updateYkYpStopOrUsed(groupNo.value, row.code, row.serial, delFlag).then((res) => {
  331. ElMessage({
  332. type: "success",
  333. message: res.cg,
  334. duration: 2500,
  335. showClose: true,
  336. });
  337. queryYpDict()
  338. })
  339. }).catch((action) => {
  340. if (action === 'cancel') {
  341. queryYpDict()
  342. }
  343. })
  344. }
  345. // 国家基本药物设置
  346. const baseDrugConfirm = (row) => {
  347. let flag
  348. let title
  349. if ('1' === row.jbFlag) {
  350. flag = ''
  351. title = '请确认是否取消国家基本药物<span style="color:#d12020;">' + row.name + '</span>?'
  352. } else {
  353. flag = '1'
  354. title = '请确认是否将<span style="color:#d12020;">' + row.name + '</span>设置成国家基本药物?'
  355. }
  356. ElMessageBox.confirm(title, {
  357. cancelButtonText: '取消',
  358. confirmButtonText: '确定',
  359. type: 'warning',
  360. distinguishCancelAndClose: true,
  361. dangerouslyUseHTMLString: true
  362. }).then(() => {
  363. updateYpJbFlag(row.code, row.serial, flag).then((res) => {
  364. ElMessage({
  365. type: "success",
  366. message: res.cg,
  367. duration: 2500,
  368. showClose: true,
  369. });
  370. queryYpDict()
  371. })
  372. }).catch((action) => {
  373. if (action === 'cancel') {
  374. queryYpDict()
  375. }
  376. })
  377. }
  378. // 高警示药品标志维护
  379. const highWarningDrug = (row) => {
  380. let flag
  381. let title
  382. if ('1' === row.highWarningFlag) {
  383. flag = ''
  384. title = '请确认是否取消高警示药品<span style="color:#d12020;">' + row.name + '</span>?'
  385. } else {
  386. flag = '1'
  387. title = '请确认是否将<span style="color:#d12020;">' + row.name + '</span>设置成高警示药品?'
  388. }
  389. ElMessageBox.confirm(title, {
  390. cancelButtonText: '取消',
  391. confirmButtonText: '确定',
  392. type: 'warning',
  393. distinguishCancelAndClose: true,
  394. dangerouslyUseHTMLString: true
  395. }).then(() => {
  396. updateYpHighWarning(row.code, row.serial, flag).then((res) => {
  397. ElMessage({
  398. type: "success",
  399. message: res.cg,
  400. duration: 2500,
  401. showClose: true,
  402. });
  403. queryYpDict()
  404. })
  405. }).catch((action) => {
  406. if (action === 'cancel') {
  407. queryYpDict()
  408. }
  409. })
  410. }
  411. // 国家组织药品集中采购中标药品---“带量中选”维护
  412. const winningBidderDrug = (row) => {
  413. let flag
  414. let title
  415. if ('1' === row.winningBidderFlag) {
  416. flag = ''
  417. title = '请确认是否取消国家组织药品集中采购中标药品<span style="color:#d12020;">' + row.name + '</span>?'
  418. } else {
  419. flag = '1'
  420. title = '请确认是否将<span style="color:#d12020;">' + row.name + '</span>设置成国家组织药品集中采购中标药品?'
  421. }
  422. ElMessageBox.confirm(title, {
  423. cancelButtonText: '取消',
  424. confirmButtonText: '确定',
  425. type: 'warning',
  426. distinguishCancelAndClose: true,
  427. dangerouslyUseHTMLString: true
  428. }).then(() => {
  429. updateYpWinningBidder(row.code, row.serial, flag).then((res) => {
  430. ElMessage({
  431. type: "success",
  432. message: res.cg,
  433. duration: 2500,
  434. showClose: true,
  435. });
  436. queryYpDict()
  437. })
  438. }).catch((action) => {
  439. if (action === 'cancel') {
  440. queryYpDict()
  441. }
  442. })
  443. }
  444. // 重点监控药品维护
  445. const focusMonitorDrug = (row) => {
  446. let flag
  447. let title
  448. if ('1' === row.focusMonitorFlag) {
  449. flag = ''
  450. title = '请确认是否取消重点监控药品<span style="color:#d12020;">' + row.name + '</span>?'
  451. } else {
  452. flag = '1'
  453. title = '请确认是否将<span style="color:#d12020;">' + row.name + '</span>设置成重点监控药品?'
  454. }
  455. ElMessageBox.confirm(title, {
  456. cancelButtonText: '取消',
  457. confirmButtonText: '确定',
  458. type: 'warning',
  459. distinguishCancelAndClose: true,
  460. dangerouslyUseHTMLString: true
  461. }).then(() => {
  462. updateYpFocusMonitor(row.code, row.serial, flag).then((res) => {
  463. ElMessage({
  464. type: "success",
  465. message: res.cg,
  466. duration: 2500,
  467. showClose: true,
  468. });
  469. queryYpDict()
  470. })
  471. }).catch((action) => {
  472. if (action === 'cancel') {
  473. queryYpDict()
  474. }
  475. })
  476. }
  477. // 导出药品账页信息
  478. const exportData = () => {
  479. if (drugDictData.value.length === 0) {
  480. ElMessage({
  481. message: "没有可以导出的数据!",
  482. type: "warning",
  483. duration: 2500,
  484. showClose: true,
  485. });
  486. } else {
  487. const title = {
  488. code: "药品编码",
  489. serial: "药品包装",
  490. name: "药品名称",
  491. specification: "药品规格",
  492. packRetprice: "药品零售价",
  493. manuFactory: '生产厂家',
  494. delFlag: "状态",
  495. ykFlag: "药库状态",
  496. pyCode: "拼音码",
  497. dCode: "五笔码",
  498. };
  499. const d = clone(drugDictData.value)
  500. d.forEach(val => {
  501. if (val.delFlag === '1') {
  502. val.delFlag = '停用'
  503. } else {
  504. val.delFlag = ''
  505. }
  506. if (val.ykFlag === '1') {
  507. val.ykFlag = '药库停用'
  508. } else {
  509. val.ykFlag = ''
  510. }
  511. });
  512. Export(d, title, "药品账页信息")
  513. }
  514. }
  515. </script>
  516. <style lang="scss">
  517. .yp-edit-dialog {
  518. .el-dialog__body {
  519. padding: 2px 5px !important;
  520. }
  521. }
  522. </style>