YpDictInfo.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610
  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="710" width="710" 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. <el-button :type="scope.row.returnFlag === '1' ? 'primary' : 'info'" size="small" v-show="scope.row.categoriesFlag === '0'"
  73. v-if="!scope.row.isEdit" @click="kfReturnDrug(scope.row)">口服退药</el-button>
  74. </template>
  75. </el-table-column>
  76. </el-table>
  77. </div>
  78. <div>
  79. <el-pagination :current-page="currentPage" :page-size="pageSize" :page-sizes="[15, 30, 45, 60]"
  80. :total="drugDictData.length" layout="total, sizes, prev, pager, next, jumper" style="margin-top: 5px"
  81. @size-change="handleSizeChange" @current-change="handleCurrentChange">
  82. </el-pagination>
  83. </div>
  84. </div>
  85. </div>
  86. <el-dialog v-model="showYpEdit" :close-on-click-modal="false" :close-on-press-escape="false" :title="ypTitle"
  87. class="yp-edit-dialog" width="80%" destroy-on-close fullscreen>
  88. <YpZdDict :ypDetail="ypDetail" @closeYpEditFor="closeYpEditAdd" />
  89. </el-dialog>
  90. <el-dialog v-model="showYpPrintName" :close-on-click-modal="false" :close-on-press-escape="false"
  91. :title="ypPrintName" width="80%" destroy-on-close>
  92. <YpPrintName :ypPrintNameDetail="ypPrintNameDetail" @closeYpPrintNameEditFor="closeYpPrintName" />
  93. </el-dialog>
  94. </template>
  95. <script setup name="YpDictInfo">
  96. import {nextTick, onMounted, ref} from 'vue'
  97. import {ElMessage, ElMessageBox} from 'element-plus'
  98. import {clone} from '@/utils/clone'
  99. import {Export} from '@/utils/ExportExcel'
  100. import {
  101. selectYpDict,
  102. selectYpDictByCode,
  103. selectYpGroupNameByYfFlag,
  104. selectYpStorageInfo,
  105. updateYkYpStopOrUsed,
  106. updateYpJbFlag,
  107. updateYpStopOrUsed,
  108. updateYpTempPurchase,
  109. updateYpHighWarning,
  110. updateYpWinningBidder,
  111. updateYpFocusMonitor,
  112. updateYpReturnFlag
  113. } from '@/api/yp-dict/yp-dict-info.js'
  114. import YpZdDict from '@/views/yp-dict/YpZdDict.vue'
  115. import YpPrintName from '@/views/yp-dict/YpPrintName.vue'
  116. const text = ref('')
  117. const isSee = ref('1')
  118. const drugDictData = ref([])
  119. const ypTitle = ref('')
  120. const showYpEdit = ref(false)
  121. const ypDetail = ref({})
  122. const ypPrintName = ref('')
  123. const showYpPrintName = ref(false)
  124. const ypPrintNameDetail = ref({})
  125. const ypGroupNameData = ref([])
  126. const groupNo = ref('')
  127. const isYk = ref(false)
  128. const pageSize = ref(30)
  129. const currentPage = ref(1)
  130. const handleSizeChange = (val) => {
  131. pageSize.value = val
  132. }
  133. const handleCurrentChange = (val) => {
  134. currentPage.value = val
  135. }
  136. onMounted(() => {
  137. nextTick(() => {
  138. queryYpGroupNameByYfFlag('')
  139. queryYpDict()
  140. })
  141. })
  142. // 查询所有药库明细
  143. const queryYpGroupNameByYfFlag = (val) => {
  144. selectYpGroupNameByYfFlag(val, '0')
  145. .then((res) => {
  146. ypGroupNameData.value = res
  147. })
  148. .catch(() => {
  149. ypGroupNameData.value = []
  150. })
  151. }
  152. // 查询
  153. const queryYpDict = () => {
  154. isYk.value = !!groupNo.value;
  155. if(groupNo.value === undefined){
  156. groupNo.value = ''
  157. }
  158. selectYpDict(text.value, groupNo.value, isSee.value)
  159. .then((res) => {
  160. drugDictData.value = res
  161. })
  162. .catch(() => {
  163. drugDictData.value = []
  164. })
  165. }
  166. // 新增
  167. const addYpDict = () => {
  168. if(groupNo.value === undefined || groupNo.value === '') {
  169. ElMessage({
  170. type: "warning",
  171. message: "新增药品账页请选择药库!",
  172. duration: 2500,
  173. showClose: true,
  174. });
  175. return false
  176. }
  177. ypTitle.value = '新增药品账页信息'
  178. // 新增标识
  179. ypDetail.value.modeFlag = 'add'
  180. ypDetail.value.groupNo = groupNo.value
  181. showYpEdit.value = true
  182. }
  183. const closeYpEditAdd = () => {
  184. showYpEdit.value = false
  185. queryYpDict()
  186. }
  187. // 编辑
  188. const editYpDict = (row) => {
  189. selectYpDictByCode(row.code, row.serial).then((res) => {
  190. ypTitle.value = '编码:' + row.code + ' 序号:' + row.serial + ' 规格:' + row.specification + ' 名称:' + row.name + ' 账页信息'
  191. ypDetail.value = res
  192. // 修改标识
  193. ypDetail.value.modeFlag = 'edit'
  194. showYpEdit.value = true
  195. })
  196. }
  197. // 编辑别名
  198. const editYpDictName = (row) => {
  199. ypPrintName.value = row.name + "别名"
  200. showYpPrintName.value = true
  201. ypPrintNameDetail.value.chargeCode = row.code
  202. }
  203. const closeYpPrintName = () => {
  204. showYpPrintName.value = false
  205. queryYpDict()
  206. }
  207. const stopYpDict = (row) => {
  208. let delFlag
  209. let title
  210. if ('1' === row.delFlag) {
  211. delFlag = '0'
  212. title = '请确认是否启用<span style="color:#d12020;">' + row.name + '</span>?'
  213. } else {
  214. delFlag = '1'
  215. title = '请确认是否停用<span style="color:#d12020;">(药房也全部停用)</span><span style="color:#d12020;">' + row.name + '</span>?'
  216. }
  217. // 查询停用药品是否存在库存
  218. if('1' !== row.delFlag) {
  219. selectYpStorageInfo(row.code, '').then((res) => {
  220. ElMessageBox.confirm(res.msg, {
  221. cancelButtonText: '取消',
  222. confirmButtonText: '确定',
  223. type: 'warning',
  224. distinguishCancelAndClose: true,
  225. dangerouslyUseHTMLString: true
  226. }).then(() => {
  227. callSaveYpDict(title, row, delFlag)
  228. }).catch((action) => {
  229. if (action === 'cancel') {
  230. queryYpDict()
  231. }
  232. })
  233. })
  234. } else {
  235. callSaveYpDict(title, row, delFlag)
  236. }
  237. }
  238. const callSaveYpDict = (title, row, delFlag) => {
  239. ElMessageBox.confirm(title, {
  240. cancelButtonText: '取消',
  241. confirmButtonText: '确定',
  242. type: 'warning',
  243. distinguishCancelAndClose: true,
  244. dangerouslyUseHTMLString: true
  245. }).then(() => {
  246. updateYpStopOrUsed(row.code, row.serial, delFlag).then((res) => {
  247. ElMessage({
  248. type: "success",
  249. message: res.cg,
  250. duration: 2500,
  251. showClose: true,
  252. });
  253. queryYpDict()
  254. })
  255. }).catch((action) => {
  256. if (action === 'cancel') {
  257. queryYpDict()
  258. }
  259. })
  260. }
  261. // 设置成临购药品
  262. const tempPurchase = (row) => {
  263. let flag
  264. let title
  265. if ('1' === row.tempPurchaseFlag) {
  266. flag = ''
  267. title = '请确认是否停止临购药品<span style="color:#d12020;">' + row.name + '</span>?'
  268. } else {
  269. flag = '1'
  270. title = '请确认是否设置成临购药品<span style="color:#d12020;">' + row.name + '</span>?'
  271. }
  272. ElMessageBox.confirm(title, {
  273. cancelButtonText: '取消',
  274. confirmButtonText: '确定',
  275. type: 'warning',
  276. distinguishCancelAndClose: true,
  277. dangerouslyUseHTMLString: true
  278. }).then(() => {
  279. updateYpTempPurchase(row.code, row.serial, flag).then((res) => {
  280. ElMessage({
  281. type: "success",
  282. message: res.cg,
  283. duration: 2500,
  284. showClose: true,
  285. });
  286. queryYpDict()
  287. })
  288. }).catch((action) => {
  289. if (action === 'cancel') {
  290. queryYpDict()
  291. }
  292. })
  293. }
  294. // 药库药品是否启用/停用操作
  295. const stopYkYpDict = (row) => {
  296. let delFlag
  297. let title
  298. if (!groupNo.value) {
  299. ElMessage({
  300. type: "warning",
  301. message: "请选择药库!",
  302. duration: 2500,
  303. showClose: true,
  304. });
  305. return
  306. }
  307. if ('1' === row.ykFlag) {
  308. delFlag = '0'
  309. title = '请确认药库是否启用<span style="color:#d12020;">' + row.name + '</span>?'
  310. } else {
  311. delFlag = '1'
  312. title = '请确认药库是否停用<span style="color:#d12020;">' + row.name + '</span>?'
  313. }
  314. // 查询药库停用药品是否存在库存
  315. if('1' !== row.ykFlag) {
  316. selectYpStorageInfo(row.code, groupNo.value).then((res) => {
  317. ElMessageBox.confirm(res.msg, {
  318. cancelButtonText: '取消',
  319. confirmButtonText: '确定',
  320. type: 'warning',
  321. distinguishCancelAndClose: true,
  322. dangerouslyUseHTMLString: true
  323. }).then(() => {
  324. callYkYpStopOrUsed(title, row, delFlag)
  325. }).catch((action) => {
  326. if (action === 'cancel') {
  327. queryYpDict()
  328. }
  329. })
  330. })
  331. } else {
  332. callYkYpStopOrUsed(title, row, delFlag)
  333. }
  334. }
  335. const callYkYpStopOrUsed = (title, row, delFlag) => {
  336. ElMessageBox.confirm(title, {
  337. cancelButtonText: '取消',
  338. confirmButtonText: '确定',
  339. type: 'warning',
  340. distinguishCancelAndClose: true,
  341. dangerouslyUseHTMLString: true
  342. }).then(() => {
  343. updateYkYpStopOrUsed(groupNo.value, row.code, row.serial, delFlag).then((res) => {
  344. ElMessage({
  345. type: "success",
  346. message: res.cg,
  347. duration: 2500,
  348. showClose: true,
  349. });
  350. queryYpDict()
  351. })
  352. }).catch((action) => {
  353. if (action === 'cancel') {
  354. queryYpDict()
  355. }
  356. })
  357. }
  358. // 国家基本药物设置
  359. const baseDrugConfirm = (row) => {
  360. let flag
  361. let title
  362. if ('1' === row.jbFlag) {
  363. flag = ''
  364. title = '请确认是否取消国家基本药物<span style="color:#d12020;">' + row.name + '</span>?'
  365. } else {
  366. flag = '1'
  367. title = '请确认是否将<span style="color:#d12020;">' + row.name + '</span>设置成国家基本药物?'
  368. }
  369. ElMessageBox.confirm(title, {
  370. cancelButtonText: '取消',
  371. confirmButtonText: '确定',
  372. type: 'warning',
  373. distinguishCancelAndClose: true,
  374. dangerouslyUseHTMLString: true
  375. }).then(() => {
  376. updateYpJbFlag(row.code, row.serial, flag).then((res) => {
  377. ElMessage({
  378. type: "success",
  379. message: res.cg,
  380. duration: 2500,
  381. showClose: true,
  382. });
  383. queryYpDict()
  384. })
  385. }).catch((action) => {
  386. if (action === 'cancel') {
  387. queryYpDict()
  388. }
  389. })
  390. }
  391. // 高警示药品标志维护
  392. const highWarningDrug = (row) => {
  393. let flag
  394. let title
  395. if ('1' === row.highWarningFlag) {
  396. flag = ''
  397. title = '请确认是否取消高警示药品<span style="color:#d12020;">' + row.name + '</span>?'
  398. } else {
  399. flag = '1'
  400. title = '请确认是否将<span style="color:#d12020;">' + row.name + '</span>设置成高警示药品?'
  401. }
  402. ElMessageBox.confirm(title, {
  403. cancelButtonText: '取消',
  404. confirmButtonText: '确定',
  405. type: 'warning',
  406. distinguishCancelAndClose: true,
  407. dangerouslyUseHTMLString: true
  408. }).then(() => {
  409. updateYpHighWarning(row.code, row.serial, flag).then((res) => {
  410. ElMessage({
  411. type: "success",
  412. message: res.cg,
  413. duration: 2500,
  414. showClose: true,
  415. });
  416. queryYpDict()
  417. })
  418. }).catch((action) => {
  419. if (action === 'cancel') {
  420. queryYpDict()
  421. }
  422. })
  423. }
  424. // 国家组织药品集中采购中标药品---“带量中选”维护
  425. const winningBidderDrug = (row) => {
  426. let flag
  427. let title
  428. if ('1' === row.winningBidderFlag) {
  429. flag = ''
  430. title = '请确认是否取消国家组织药品集中采购中标药品<span style="color:#d12020;">' + row.name + '</span>?'
  431. } else {
  432. flag = '1'
  433. title = '请确认是否将<span style="color:#d12020;">' + row.name + '</span>设置成国家组织药品集中采购中标药品?'
  434. }
  435. ElMessageBox.confirm(title, {
  436. cancelButtonText: '取消',
  437. confirmButtonText: '确定',
  438. type: 'warning',
  439. distinguishCancelAndClose: true,
  440. dangerouslyUseHTMLString: true
  441. }).then(() => {
  442. updateYpWinningBidder(row.code, row.serial, flag).then((res) => {
  443. ElMessage({
  444. type: "success",
  445. message: res.cg,
  446. duration: 2500,
  447. showClose: true,
  448. });
  449. queryYpDict()
  450. })
  451. }).catch((action) => {
  452. if (action === 'cancel') {
  453. queryYpDict()
  454. }
  455. })
  456. }
  457. // 重点监控药品维护
  458. const focusMonitorDrug = (row) => {
  459. let flag
  460. let title
  461. if ('1' === row.focusMonitorFlag) {
  462. flag = ''
  463. title = '请确认是否取消重点监控药品<span style="color:#d12020;">' + row.name + '</span>?'
  464. } else {
  465. flag = '1'
  466. title = '请确认是否将<span style="color:#d12020;">' + row.name + '</span>设置成重点监控药品?'
  467. }
  468. ElMessageBox.confirm(title, {
  469. cancelButtonText: '取消',
  470. confirmButtonText: '确定',
  471. type: 'warning',
  472. distinguishCancelAndClose: true,
  473. dangerouslyUseHTMLString: true
  474. }).then(() => {
  475. updateYpFocusMonitor(row.code, row.serial, flag).then((res) => {
  476. ElMessage({
  477. type: "success",
  478. message: res.cg,
  479. duration: 2500,
  480. showClose: true,
  481. });
  482. queryYpDict()
  483. })
  484. }).catch((action) => {
  485. if (action === 'cancel') {
  486. queryYpDict()
  487. }
  488. })
  489. }
  490. // 口服药能否退药标志kfReturnKDrug
  491. const kfReturnDrug = (row) => {
  492. if('0' !== row.categoriesFlag){
  493. ElMessage({
  494. type: "error",
  495. message: '非口服药不能设置口服药退药标志',
  496. duration: 2500,
  497. showClose: true,
  498. });
  499. return
  500. }
  501. let flag
  502. let title
  503. if ('1' === row.returnFlag) {
  504. flag = ''
  505. title = '请确认是否取消药品<span style="color:#d12020;">' + row.name + '</span>允许退药?'
  506. } else {
  507. flag = '1'
  508. title = '请确认是否将药品<span style="color:#d12020;">' + row.name + '</span>设置成允许退药?'
  509. }
  510. ElMessageBox.confirm(title, {
  511. cancelButtonText: '取消',
  512. confirmButtonText: '确定',
  513. type: 'warning',
  514. distinguishCancelAndClose: true,
  515. dangerouslyUseHTMLString: true
  516. }).then(() => {
  517. updateYpReturnFlag(row.code, row.serial, flag).then((res) => {
  518. ElMessage({
  519. type: "success",
  520. message: res.cg,
  521. duration: 2500,
  522. showClose: true,
  523. });
  524. queryYpDict()
  525. })
  526. }).catch((action) => {
  527. if (action === 'cancel') {
  528. queryYpDict()
  529. }
  530. })
  531. }
  532. // 导出药品账页信息
  533. const exportData = () => {
  534. if (drugDictData.value.length === 0) {
  535. ElMessage({
  536. message: "没有可以导出的数据!",
  537. type: "warning",
  538. duration: 2500,
  539. showClose: true,
  540. });
  541. } else {
  542. const title = {
  543. code: "药品编码",
  544. serial: "药品包装",
  545. name: "药品名称",
  546. specification: "药品规格",
  547. packRetprice: "药品零售价",
  548. manuFactory: '生产厂家',
  549. delFlag: "状态",
  550. ykFlag: "药库状态",
  551. pyCode: "拼音码",
  552. dCode: "五笔码",
  553. };
  554. const d = clone(drugDictData.value)
  555. d.forEach(val => {
  556. if (val.delFlag === '1') {
  557. val.delFlag = '停用'
  558. } else {
  559. val.delFlag = ''
  560. }
  561. if (val.ykFlag === '1') {
  562. val.ykFlag = '药库停用'
  563. } else {
  564. val.ykFlag = ''
  565. }
  566. });
  567. Export(d, title, "药品账页信息")
  568. }
  569. }
  570. </script>
  571. <style lang="scss">
  572. .yp-edit-dialog {
  573. .el-dialog__body {
  574. padding: 2px 5px !important;
  575. }
  576. }
  577. </style>