index.vue 11 KB

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