index.vue 9.9 KB

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