YpDictInfo.vue 20 KB

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