index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413
  1. <template>
  2. <div class="m-4">
  3. <div>
  4. <XTTitle title="并发症维护" />
  5. <div style="margin-top: 16px">
  6. <Row>
  7. <Col :span="6">
  8. <Card>
  9. <Input
  10. v-model:value="searchName"
  11. placeholder="请输入并发症名称"
  12. style="width: 70%; margin-bottom: 10px"
  13. @change="handleSearch"
  14. >
  15. <template #prefix> <Icon icon="icon-search|iconfont" :size="14" /></template>
  16. </Input>
  17. <a-dropdown-button size="small">
  18. <template #overlay>
  19. <a-menu @click="handleMenuClick">
  20. <a-menu-item key="1">添加并发症</a-menu-item>
  21. <!-- <a-menu-item key="2">批量导入</a-menu-item> -->
  22. <a-menu-item key="3">批量导出</a-menu-item>
  23. </a-menu>
  24. </template>
  25. </a-dropdown-button>
  26. <List item-layout="horizontal" :data-source="complicationList">
  27. <template #renderItem="{ item, index }">
  28. <ListItem
  29. @click="handleDetail(item, index)"
  30. :key="index"
  31. :class="{ actives: classIndex === index }"
  32. >
  33. <ListItemMeta>
  34. <template #title>
  35. {{ item.name }}
  36. </template>
  37. </ListItemMeta>
  38. </ListItem>
  39. </template>
  40. </List>
  41. </Card></Col
  42. >
  43. <Col :span="18">
  44. <Card :title="detailName">
  45. <template #extra>
  46. <Button shape="circle" v-auth="['bizSys:complication:edit']" @click="handleEditInfo"
  47. ><Icon icon="icon-xt-details_edit_default|iconfont" :size="14"
  48. /></Button>
  49. <Button
  50. shape="circle"
  51. v-auth="['bizSys:complication:remove']"
  52. @click="handleDel(detailForm.id)"
  53. style="margin-left: 20px"
  54. ><Icon icon="icon-xt-details_delete_default|iconfont" :size="14"
  55. /></Button>
  56. </template>
  57. <div class="mx-3 my-2">
  58. <DescCard :showHead="false" type="touxi" :data="detailFromData" />
  59. </div>
  60. <Card
  61. title="说明模板"
  62. size="small"
  63. class="note-card"
  64. headStyle="background: #FFFFFF;border: 0px;font-size: 14px !important;"
  65. >
  66. <template #extra
  67. ><Button shape="circle" v-auth="['bizSys:wardInfo:add']" @click="handleAddNote"
  68. ><Icon icon="icon-plus|iconfont" :size="14" /></Button
  69. ></template>
  70. <BasicTable @register="registerTable">
  71. <template #bodyCell="{ column, record }">
  72. <!-- <template v-if="column.key === 'disable'">
  73. <Tag :color="formatDictColor(disableOptions, record.disable)">
  74. {{ formatDictValue(disableOptions, record.disable) }}
  75. </Tag>
  76. </template> -->
  77. <template v-if="column.key === 'action'">
  78. <TableAction
  79. :actions="[
  80. {
  81. auth: 'bizSys:complicationExplain:edit',
  82. icon: 'icon-xt-details_edit_default|iconfont',
  83. tooltip: '编辑',
  84. onClick: handleEditNote.bind(null, record),
  85. },
  86. {
  87. auth: 'bizSys:complicationExplain:remove',
  88. icon: 'icon-xt-details_delete_default|iconfont',
  89. tooltip: '删除',
  90. popConfirm: {
  91. title: '是否删除此说明模板',
  92. placement: 'left',
  93. confirm: handleDelNote.bind(null, record),
  94. },
  95. },
  96. ]"
  97. />
  98. </template>
  99. </template>
  100. </BasicTable>
  101. </Card>
  102. </Card>
  103. </Col>
  104. </Row>
  105. </div>
  106. </div>
  107. <ComplicationFormModal
  108. @register="registerComplicationModal"
  109. @success="handleComplicationSuccess"
  110. />
  111. <NoteFormModal @register="registerNoteModal" @success="handleAddNoteSuccess" />
  112. </div>
  113. </template>
  114. <script lang="ts" setup>
  115. import { Card, Row, Col, List, Input, Button } from 'ant-design-vue';
  116. import { XTTitle } from '/@/components/XTTitle/index';
  117. import Icon from '/@/components/Icon/src/Icon.vue';
  118. import {
  119. getComplicationList,
  120. complicationById,
  121. complicationDelById,
  122. getNoteList,
  123. complicationExplainDelById,
  124. complicationExport,
  125. } from '/@/api/biz/management/complication';
  126. import { noteInfoColumns } from './data';
  127. import { BasicTable, useTable, TableAction } from '/@/components/Table';
  128. import ComplicationFormModal from './complicationFormModal.vue';
  129. import NoteFormModal from './noteFormModal.vue';
  130. import DescCard from '/@/components/XTCard/src/DescCard.vue';
  131. import { useMessage } from '/@/hooks/web/useMessage';
  132. import { useModal } from '/@/components/Modal';
  133. import { onBeforeMount, ref } from 'vue';
  134. import { downloadByBase64 } from '/@/utils/file/download';
  135. const { createConfirm, createMessage } = useMessage();
  136. const ListItem = List.Item;
  137. const ListItemMeta = List.Item.Meta;
  138. const searchName = ref();
  139. const complicationList = ref([]);
  140. const classIndex = ref([]);
  141. const detailName = ref('详细信息');
  142. const detailForm = ref({
  143. id: null,
  144. });
  145. const detailFromData = ref([
  146. {
  147. label: '并发症名',
  148. value: '并发症名称',
  149. },
  150. {
  151. label: '排序',
  152. value: '1',
  153. },
  154. {
  155. label: '并发症描述',
  156. value: '并发症描述有点长....',
  157. },
  158. ]);
  159. const [registerTable, { reload }] = useTable({
  160. api: getNoteList,
  161. rowKey: 'id',
  162. columns: noteInfoColumns,
  163. showIndexColumn: false,
  164. striped: false,
  165. formConfig: {
  166. labelWidth: 120,
  167. autoSubmitOnEnter: true,
  168. baseColProps: { xs: 24, sm: 12, md: 12, lg: 8 },
  169. resetButtonOptions: {
  170. preIcon: 'icon-delete|iconfont',
  171. },
  172. submitButtonOptions: {
  173. preIcon: 'icon-search|iconfont',
  174. },
  175. },
  176. pagination: false,
  177. useSearchForm: false,
  178. actionColumn: {
  179. width: 320,
  180. title: '操作',
  181. dataIndex: 'action',
  182. },
  183. beforeFetch: handleNoteBeforeFetch,
  184. });
  185. const [registerComplicationModal, { openModal: openComplicationModal }] = useModal();
  186. const [registerNoteModal, { openModal: openNoteModal }] = useModal();
  187. /**
  188. * 页面加载前事件
  189. */
  190. onBeforeMount(async () => {
  191. getDataList();
  192. });
  193. /**
  194. * 获取并发症信息
  195. */
  196. async function getDataList(params?: object) {
  197. const res = await getComplicationList({
  198. ...params,
  199. page: { current: 1, size: 999 },
  200. orders: [{ field: 'sort', direction: 'DESC' }],
  201. });
  202. complicationList.value = res.data;
  203. if (complicationList.value && complicationList.value.length > 0) {
  204. handleDetail(complicationList.value[0], 0);
  205. }
  206. }
  207. // 点击更多中的各个按钮触发
  208. function handleMenuClick(e) {
  209. if (e.key == 1) {
  210. openComplicationModal(true, {
  211. isUpdate: false,
  212. });
  213. } else if (e.key == 2) {
  214. console.log('批量导入');
  215. } else {
  216. console.log('批量导出');
  217. batchExport();
  218. }
  219. }
  220. // 导出并发症
  221. async function batchExport() {
  222. const keys = [];
  223. complicationList.value.forEach(item => {
  224. keys.push(item.id);
  225. });
  226. debugger;
  227. complicationExport(keys).then(res => {
  228. if (res && res.fileName && res.base64) {
  229. downloadByBase64(res.base64, res.fileName);
  230. } else {
  231. createMessage.error('获取导出文件失败!');
  232. }
  233. });
  234. }
  235. /**
  236. *并发症保存/修改/删除完成后回调函数
  237. */
  238. function handleComplicationSuccess() {
  239. if (searchName.value) {
  240. handleSearch();
  241. } else {
  242. getDataList();
  243. }
  244. }
  245. /**
  246. * 搜索并发症
  247. */
  248. function handleSearch() {
  249. const searchVal = searchName.value;
  250. getDataList({ name: searchVal });
  251. }
  252. /**
  253. *点击并发症名称展示右侧详情
  254. */
  255. async function handleDetail(item, index) {
  256. classIndex.value = index; // 点击的时改变点击并发症样式
  257. if (item && item.id) {
  258. const complication = await complicationById(item.id);
  259. detailName.value = complication.name;
  260. detailForm.value = complication;
  261. detailFromData.value = [
  262. {
  263. label: '并发症名',
  264. value: complication.name,
  265. },
  266. {
  267. label: '排序',
  268. value: complication.sort,
  269. },
  270. {
  271. label: '并发症描述',
  272. value: complication.remark,
  273. },
  274. ];
  275. }
  276. reload();
  277. }
  278. /**
  279. * 打开编辑方法
  280. */
  281. function handleEditInfo() {
  282. openComplicationModal(true, {
  283. record: detailForm.value,
  284. isUpdate: true,
  285. });
  286. }
  287. // 删除并发症操作
  288. function handleDel(id) {
  289. if (id) {
  290. createConfirm({
  291. iconType: 'warning',
  292. title: '警告',
  293. content: '是否需要删除此并发症',
  294. onOk: async () => {
  295. await complicationDelById([id]);
  296. handleComplicationSuccess();
  297. },
  298. });
  299. } else {
  300. createMessage.error('请选择要删除的并发症名称');
  301. }
  302. }
  303. /*******************说明模板相关方法 */
  304. function handleAddNote() {
  305. openNoteModal(true, {
  306. id: detailForm.value.id,
  307. isUpdate: false,
  308. });
  309. }
  310. //打开说明模板编辑弹框
  311. function handleEditNote(record) {
  312. openNoteModal(true, {
  313. record: record,
  314. isUpdate: true,
  315. });
  316. }
  317. //说明模板查询前事件
  318. function handleNoteBeforeFetch(params) {
  319. return {
  320. ...params,
  321. ids: detailForm.value.id,
  322. };
  323. }
  324. // 删除说明模板事件
  325. async function handleDelNote(record) {
  326. await complicationExplainDelById([record.id]);
  327. createMessage.success('删除此说明模板成功');
  328. reload();
  329. }
  330. function handleAddNoteSuccess() {
  331. reload();
  332. }
  333. </script>
  334. <style lang="less" scoped>
  335. ::v-deep(.ant-btn-group-sm .ant-btn.ant-btn-icon-only) {
  336. height: 32px !important;
  337. width: 32px !important;
  338. }
  339. ::v-deep(.ant-list-item) {
  340. border-bottom: 0 !important;
  341. line-height: 50px;
  342. padding-left: 6px;
  343. cursor: pointer;
  344. }
  345. .actives {
  346. background-color: rgb(246 248 250 / 100%);
  347. border-left: 3px solid rgb(0 117 255 / 100%);
  348. h4 {
  349. color: rgb(0 117 255 / 100%) !important;
  350. }
  351. }
  352. ::v-deep(.ant-card-head-title) {
  353. font-size: 18px;
  354. font-weight: 600;
  355. color: #000a18;
  356. }
  357. ::v-deep(.ant-btn-link) {
  358. color: rgb(61 65 85 / 100%);
  359. }
  360. ::v-deep(.ant-card) {
  361. height: 800px;
  362. overflow: auto;
  363. }
  364. ::v-deep(.ant-table-body) {
  365. height: 460px !important;
  366. }
  367. .note-card {
  368. border: 0;
  369. height: 520px !important;
  370. ::v-deep(.ant-card-body) {
  371. height: 500px;
  372. }
  373. }
  374. ::v-deep(.ant-table-tbody > tr > td) {
  375. text-align: left !important;
  376. border-top: 0 !important;
  377. border-right: 0 !important;
  378. border-bottom: 1px solid #f0f0f0 !important;
  379. border-left: 0 !important;
  380. }
  381. ::v-deep(.fan-basic-table .ant-table-wrapper table) {
  382. border: 0 !important;
  383. }
  384. ::v-deep(.ant-table-thead > tr > th) {
  385. text-align: left !important;
  386. color: #818694;
  387. }
  388. ::v-deep(.fan-basic-table-action.center) {
  389. justify-content: left !important;
  390. }
  391. </style>