OrderIten.vue 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320
  1. <script setup lang="ts">
  2. import * as api from "@/api/orderZdMaintain";
  3. import CyComboGrid from "@/components/cy/combo-grid/src/CyComboGrid.vue";
  4. import { listFilter } from "@/utils/list-utlis";
  5. import { useDialog } from "@/components/cy/CyDialog/index";
  6. import { xcMessage } from "@/utils/xiaochan-element-plus";
  7. const EditorDialog = defineAsyncComponent(() => import("./EditorDialog.vue"));
  8. const operations = [
  9. { code: "p", name: "手术" },
  10. { code: "x", name: "材料" },
  11. { code: "o", name: "其他" },
  12. { code: "s", name: "输血" },
  13. ];
  14. const store = reactive({
  15. // 项目属性
  16. changeItemType: [],
  17. // 手术分类
  18. ssType: [],
  19. currentOrderChange: {
  20. orderCode: null,
  21. },
  22. orderItem: [],
  23. searchValue: "",
  24. flag: "0",
  25. mainTableLoading: false,
  26. // 这个费用的子项
  27. changeItem: [],
  28. // 搜索到的数据
  29. searchChangeData: [],
  30. });
  31. const tableRef = shallowRef();
  32. const dataTmp = computed(() => {
  33. if (store.searchValue === "") {
  34. return store.orderItem;
  35. }
  36. return listFilter(store.orderItem, store.searchValue, [
  37. "orderName",
  38. "orderCode",
  39. "pyCode",
  40. "wCode",
  41. ]);
  42. });
  43. async function handleRadioChange() {
  44. store.mainTableLoading = true;
  45. store.orderItem = await api
  46. .getOrderItem(store.flag)
  47. .finally(() => (store.mainTableLoading = false));
  48. }
  49. function checkBoxValue(value) {
  50. return value === "1";
  51. }
  52. function getChangeItem({ row }) {
  53. api.getChangeItem(row.orderCode).then(data => {
  54. store.changeItem = data;
  55. store.currentOrderChange = row;
  56. });
  57. }
  58. async function searchChangeItemMethod(value) {
  59. store.searchChangeData = await api.searchChangeItem(value);
  60. }
  61. function openAddEditorDialog() {
  62. openEditorDialog({
  63. orderCode: null,
  64. orderName: "",
  65. orderClass: null,
  66. operation: null,
  67. delFlag: "0",
  68. excluGroupType: "0",
  69. qjFlag: "0",
  70. frequType: "0",
  71. ypFlag: "0",
  72. jyType: "0",
  73. execDept: "",
  74. ssType: null,
  75. discription: "",
  76. ybComment: "",
  77. nCode: "",
  78. }).then(res => {
  79. store.orderItem.push(res);
  80. });
  81. }
  82. function openEditorDialog(data) {
  83. return useDialog(EditorDialog, {
  84. dialogProps: {
  85. title: "医嘱编辑",
  86. },
  87. params: {
  88. data: data,
  89. changeType: store.changeItemType,
  90. ssType: store.ssType,
  91. operations,
  92. },
  93. confirmText: "保存",
  94. })
  95. .then(res => {
  96. Object.assign(data, res);
  97. return res;
  98. })
  99. .catch(() => {});
  100. }
  101. function findOperationName(value) {
  102. const find = operations.find(v => v.code === value);
  103. return find ? find.name : "";
  104. }
  105. async function handleDelFlag(data, value) {
  106. const delFlag = value ? "1" : "0";
  107. await api.setDelFlag({
  108. orderCode: data.orderCode,
  109. delFlag: delFlag,
  110. });
  111. data.delFlag = delFlag;
  112. }
  113. async function saveChangeItemDetails() {
  114. if (store.currentOrderChange.orderCode == null) return 0;
  115. const tmp = store.changeItem.filter(item => {
  116. return item.occCode !== null;
  117. });
  118. await api.saveOrderOccurence({
  119. orderCode: store.currentOrderChange.orderCode,
  120. orderItem: tmp,
  121. });
  122. }
  123. function addChangeItemDetails() {
  124. if (store.currentOrderChange.orderCode == null) {
  125. xcMessage.error("请先选着医嘱项目");
  126. return 0;
  127. }
  128. store.changeItem.push({
  129. occCode: null,
  130. name: "",
  131. amount: 1,
  132. price: 0,
  133. orderCode: "",
  134. isAdd: true,
  135. });
  136. }
  137. function handleChangeItemRowClick(row, data) {
  138. data.isUpdate = true;
  139. data.occCode = row.code;
  140. data.name = row.name;
  141. data.amount = 1;
  142. data.price = row.price;
  143. data.orderCode = store.currentOrderChange.orderCode;
  144. }
  145. onMounted(async () => {
  146. store.changeItemType = await api.getChangeItemType();
  147. store.ssType = await api.getSsType();
  148. handleRadioChange();
  149. });
  150. </script>
  151. <template>
  152. <div class="layout_container">
  153. <header>
  154. <el-input v-model="store.searchValue" style="width: 220px" clearable />
  155. <el-radio-group v-model="store.flag" @change="handleRadioChange">
  156. <el-radio value="0">在用</el-radio>
  157. <el-radio value="1">停用</el-radio>
  158. <el-radio value="all">全部</el-radio>
  159. </el-radio-group>
  160. </header>
  161. <div class="layout_main">
  162. <vxe-table
  163. border
  164. ref="tableRef"
  165. :row-config="{
  166. keyField: 'orderCode',
  167. isCurrent: true,
  168. }"
  169. show-overflow
  170. @cellClick="getChangeItem"
  171. height="60%"
  172. :edit-config="{ mode: 'row', trigger: 'manual', autoClear: false }"
  173. :data="dataTmp"
  174. :scroll-y="{ enabled: true, gt: 0 }"
  175. >
  176. <vxe-column field="delFlag" title="停用" width="60">
  177. <template #default="{ row }">
  178. <el-checkbox
  179. :modelValue="checkBoxValue(row.delFlag)"
  180. @update:modelValue="
  181. value => {
  182. handleDelFlag(row, value);
  183. }
  184. "
  185. />
  186. </template>
  187. </vxe-column>
  188. <vxe-column field="orderClassName" title="属性" width="120">
  189. </vxe-column>
  190. <vxe-column field="orderCode" title="编码" width="120" />
  191. <vxe-column field="orderName" title="名称" width="190" />
  192. <vxe-column field="excluGroupType" title="排斥" width="60">
  193. <template #default="{ row }">
  194. {{ row.excluGroupType === "1" ? "是" : "否" }}
  195. </template>
  196. </vxe-column>
  197. <vxe-column title="描述" width="220" field="discription"></vxe-column>
  198. <vxe-column title="医嘱类型" width="90" field="operation">
  199. <template #default="{ row }">
  200. {{ findOperationName(row.operation) }}
  201. </template>
  202. </vxe-column>
  203. <vxe-column field="qjFlag" title="抢救" width="60">
  204. <template #default="{ row }">
  205. {{ row.qjFlag === "1" ? "是" : "否" }}
  206. </template>
  207. </vxe-column>
  208. <vxe-column field="frequType" title="长期" width="60">
  209. <template #default="{ row }">
  210. {{ row.frequType === "1" ? "是" : "否" }}
  211. </template>
  212. </vxe-column>
  213. <vxe-column field="ypFlag" title="药品" width="60">
  214. <template #default="{ row }">
  215. {{ row.ypFlag === "1" ? "是" : "否" }}
  216. </template>
  217. </vxe-column>
  218. <vxe-column field="jyType" title="检验" width="60">
  219. <template #default="{ row }">
  220. {{ row.jyType === "1" ? "是" : "否" }}
  221. </template>
  222. </vxe-column>
  223. <vxe-column field="jyTypeName" title="检验" width="90" />
  224. <vxe-column title="执行科室" width="150" field="execDeptName" />
  225. <vxe-column title="医保备注" field="ybComment" width="220" />
  226. <vxe-column title="操作" width="90" fixed="right">
  227. <template #header>
  228. <el-button @click="openAddEditorDialog"> 新增</el-button>
  229. </template>
  230. <template #default="{ row }">
  231. <el-button @click.stop.prevent="openEditorDialog(row)"
  232. >编辑
  233. </el-button>
  234. </template>
  235. </vxe-column>
  236. </vxe-table>
  237. <vxe-table height="40%" :data="store.changeItem">
  238. <vxe-column title="名称" field="occCode" width="120"></vxe-column>
  239. <vxe-column title="项目编码" field="name" width="250">
  240. <template #default="scope">
  241. <CyComboGrid
  242. style="width: 100%"
  243. v-model="scope.row"
  244. placement="top-start"
  245. @rowClick="
  246. ({ row }) => {
  247. handleChangeItemRowClick(row, scope.row);
  248. }
  249. "
  250. label="name"
  251. :data="store.searchChangeData"
  252. value="occCode"
  253. :remote-method="searchChangeItemMethod"
  254. :table-header="[
  255. { name: '项目编码', code: 'code', width: '90px' },
  256. { name: '名字', code: 'name', width: '250px' },
  257. { name: '单价', code: 'price', width: '120px' },
  258. { name: '执行科室', code: 'execDeptName', width: '90px' },
  259. ]"
  260. />
  261. </template>
  262. </vxe-column>
  263. <vxe-column title="数量" field="amount">
  264. <template #default="{ row }">
  265. <el-input-number
  266. v-model="row.amount"
  267. @change="
  268. () => {
  269. row.isUpdate = true;
  270. }
  271. "
  272. />
  273. </template>
  274. </vxe-column>
  275. <vxe-column title="金额" field="price" />
  276. <vxe-column title="医嘱码" field="orderCode" />
  277. <vxe-column>
  278. <template #header>
  279. <el-button v-el-btn="saveChangeItemDetails">保存</el-button>
  280. <el-button @click="addChangeItemDetails">新增子项</el-button>
  281. </template>
  282. <template #default="{ rowIndex }">
  283. <el-button
  284. @click="store.changeItem.splice(rowIndex, 1)"
  285. type="danger"
  286. >删除
  287. </el-button>
  288. </template>
  289. </vxe-column>
  290. </vxe-table>
  291. </div>
  292. </div>
  293. </template>