You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

433 lines
15 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. <template>
  2. <div>
  3. <div>
  4. <div class="contenttitle">
  5. 基础资料 /<span class="contenttitleBold">分诊叫号房间设置</span>
  6. </div>
  7. <!--分组信息-->
  8. <div style="display: flex; font-size: 14px">
  9. <div :style="'display: block;width:' + (window.pageWidth - window.pageMarginWidth - 110 - 5) + 'px;'">
  10. <div style="display: flex">
  11. <div>
  12. <span>体检中心</span>
  13. <el-select v-model="medicalCenterId" placeholder="请选择体检中心" default-first-option clearable filterable
  14. style="margin-left: 10px" @change="changeMedicalCenter" size="small">
  15. <el-option v-for="item in dict.medicalCenter" :key="item.id" :label="item.displayName" :value="item.id">
  16. {{ item.displayName }}
  17. </el-option>
  18. </el-select>
  19. </div>
  20. </div>
  21. <div>
  22. <el-table :data="tableData" ref="tableData" style="margin-top: 2px" row-key="id" border height="240px"
  23. size="small" highlight-current-row :row-class-name="handleRowClassName" @row-click="rowClick">
  24. <el-table-column type="index" label="序号" width="50" align="center" />
  25. <el-table-column label="id" prop="id" min-width="200" align="center" />
  26. <el-table-column label="房间号" prop="roomNo" min-width="60" align="center" />
  27. <el-table-column prop="displayName" label="名称" min-width="150" />
  28. <el-table-column prop="medicalCenterId" label="体检中心" min-width="150">
  29. <template slot-scope="scope">
  30. {{ dddw(dict.medicalCenter, "id", scope.row.medicalCenterId, "displayName") }}
  31. </template>
  32. </el-table-column>
  33. <el-table-column prop="itemTypeId" label="项目类别" min-width="80">
  34. <template slot-scope="scope">
  35. {{ dddw(dict.itemTypeTree, "id", scope.row.itemTypeId, "displayName") }}
  36. </template>
  37. </el-table-column>
  38. <el-table-column prop="forSexId" label="适用性别" min-width="80" align="center">
  39. <template slot-scope="scope">
  40. {{ dddw(dict.forSex, "id", scope.row.forSexId, "displayName") }}
  41. </template>
  42. </el-table-column>
  43. <el-table-column prop="roomTypeFlag" label="房间类别" min-width="80" align="center">
  44. <template slot-scope="scope">
  45. {{ dddw(dict.roomType, "id", scope.row.roomTypeFlag, "displayName") }}
  46. </template>
  47. </el-table-column>
  48. <el-table-column prop="queueTime" label="候诊时间" min-width="80" align="center" >
  49. <template slot-scope="scope">
  50. <div>{{ scope.row.queueTime}} 分钟</div>
  51. </template>
  52. </el-table-column>
  53. <el-table-column prop="isActive" label="启用" min-width="40" align="center">
  54. <template slot-scope="scope">
  55. <div style="font-family: 'Microsoft YaHei';">{{ scope.row.isActive == 'Y' ? '√' : '' }}</div>
  56. </template>
  57. </el-table-column>
  58. <el-table-column prop="creatorName" label="创建者" min-width="60" align="center" />
  59. <el-table-column label="创建时间" min-width="150" align="center">
  60. <template slot-scope="scope">
  61. {{ scope.row.creationTime ? moment(scope.row.creationTime).format("yyyy-MM-DD HH:mm:ss") : "" }}
  62. </template>
  63. </el-table-column>
  64. <el-table-column label="操作" min-width="40" align="center">
  65. <template>
  66. <el-tag class="move" style="
  67. cursor: move;
  68. background-color: rgb(245, 245, 245);
  69. border: none;
  70. " draggable="true">
  71. <i class="el-icon-d-caret" style="width: 1rem; height: 1rem; color: rgb(113, 113, 113)"></i>
  72. </el-tag>
  73. </template>
  74. </el-table-column>
  75. </el-table>
  76. </div>
  77. </div>
  78. <!--按钮-->
  79. <div style="display: block; margin-left: 5px">
  80. <div v-show="checkPagePriv(pagePriv.privs, '新增')" style="margin-top: 45px">
  81. <el-button class="commonbutton" @click="btnAdd('')">新增</el-button>
  82. </div>
  83. <div v-show="checkPagePriv(pagePriv.privs, '编辑')" style="margin-top: 5px">
  84. <el-button class="commonbutton" @click="btnEdit">编辑</el-button>
  85. </div>
  86. <div v-show="checkPagePriv(pagePriv.privs, '删除')" style="margin-top: 5px">
  87. <el-button class="deleteButton" @click="btnDel">删除</el-button>
  88. </div>
  89. <div v-show="checkPagePriv(pagePriv.privs, '置顶')" style="margin-top: 5px">
  90. <el-button class="commonbutton" @click="btnSetBottomOrTop(1)">置顶</el-button>
  91. </div>
  92. <div v-show="checkPagePriv(pagePriv.privs, '置底')" style="margin-top: 5px">
  93. <el-button class="commonbutton" @click="btnSetBottomOrTop(2)">置底</el-button>
  94. </div>
  95. <div v-show="checkPagePriv(pagePriv.privs, '保存排序')" style="margin-top: 5px">
  96. <el-button class="commonbutton" @click="btnSort" :disabled="!isDrag">保存排序</el-button>
  97. </div>
  98. </div>
  99. </div>
  100. <!--分组项目信息 -->
  101. <div>
  102. <RoomAsbitem :room="curRoom" />
  103. </div>
  104. </div>
  105. <!-- 新增或者编辑弹框 -->
  106. <el-dialog :title="dataTransOpts.tableS.room.id ? '编辑' : '新增'" :close-on-click-modal="false"
  107. :visible.sync="dialogWin.RoomEdit" width="800px" @close="close_dialogWinRoomEdit">
  108. <RoomEdit :params="RoomEditParams" />
  109. </el-dialog>
  110. <!-- -->
  111. </div>
  112. </template>
  113. <script>
  114. import moment from "moment";
  115. import Sortable from "sortablejs";
  116. import { getapi, postapi, putapi, deletapi } from "@/api/api";
  117. import { mapState } from "vuex";
  118. import {
  119. getPagePriv,
  120. checkPagePriv,
  121. dddw,
  122. deepCopy,
  123. objCopy,
  124. arrayExistObj,
  125. tcdate,
  126. } from "../../utlis/proFunc";
  127. import RoomAsbitem from "./RoomAsbitem.vue";
  128. import RoomEdit from "./RoomEdit.vue";
  129. export default {
  130. components: {
  131. RoomAsbitem, RoomEdit
  132. },
  133. data() {
  134. return {
  135. pagePriv: {
  136. routeUrlorPageName: "customerOrgGroup", //当前页面归属路由或归属页面权限名称
  137. privs: [], // 页面权限
  138. },
  139. tableData: [], //体检单位分组
  140. curRoom: {}, // 当前选中房间
  141. RoomEditParams: {}, //房间 新增时 用到参数
  142. medicalCenterId: "", // 体检中心
  143. isDrag: false,
  144. form: {
  145. id: "",
  146. displayName: "",
  147. itemTypeId: "",
  148. medicalCenterId: "",
  149. forSexId: "A",
  150. roomTypeFlag: "0",
  151. queueTime: 0,
  152. isActive: "Y"
  153. },
  154. formInit: {}, //表单初始值
  155. };
  156. },
  157. computed: {
  158. ...mapState(["personnelUnit", "window", "dict", "dialogWin", "dataTransOpts"]),
  159. },
  160. created() {
  161. //获取用户当前页面的权限
  162. let userPriv = window.sessionStorage.getItem("userPriv");
  163. if (userPriv)
  164. this.pagePriv.privs = deepCopy(getPagePriv(this.pagePriv.routeUrlorPageName));
  165. // 清除当前选中的分组ID
  166. this.dataTransOpts.tableS.customer_org_group.id = ''
  167. this.rowDrop();
  168. this.formInit = deepCopy(this.form);
  169. },
  170. mounted() {
  171. //获取初始数据(单位、适用性别)
  172. this.dictInit();
  173. this.getRoom()
  174. },
  175. methods: {
  176. moment,
  177. checkPagePriv,
  178. dddw,
  179. deepCopy,
  180. //刷新分组价格(供子组件调用)
  181. refreshMoney(formData) {
  182. //console.log('this is parent')
  183. let lfind = arrayExistObj(this.tableData, "id", formData.id);
  184. if (lfind > -1) this.tableData[lfind].price = formData.price;
  185. },
  186. //确定排序
  187. btnSort() {
  188. const result = [];
  189. this.tableData.forEach((item, index) => {
  190. result.push({ id: item.id, displayOrder: index });
  191. });
  192. postapi("/api/app/Room/updatesortmany", {
  193. itemList: result,
  194. }).then((res) => {
  195. console.log("操作成功");
  196. this.isDrag = false;
  197. });
  198. },
  199. //初始化Sortable组件
  200. rowDrop() {
  201. this.$nextTick(() => {
  202. const el = document.querySelector(".el-table__body-wrapper tbody");
  203. //console.log('el0',el)
  204. const that = this;
  205. Sortable.create(el, {
  206. handle: ".move",
  207. animation: 300,
  208. //拖拽结束
  209. onEnd({ newIndex, oldIndex }) {
  210. that.isDrag = true;
  211. const currRow = that.tableData.splice(oldIndex, 1)[0];
  212. that.tableData.splice(newIndex, 0, currRow);
  213. console.log("el", el);
  214. },
  215. });
  216. });
  217. },
  218. // 置底 或 置顶
  219. btnSetBottomOrTop(sortType) {
  220. if (!this.dataTransOpts.tableS.room.id) {
  221. this.$message.warning("请选择操作的数据");
  222. return;
  223. }
  224. let body = {
  225. roomId: this.dataTransOpts.tableS.room.id,
  226. sortType
  227. }
  228. postapi('/api/app/Room/UpdateManySort', body)
  229. .then((res) => {
  230. if (res.code > -1) {
  231. console.log("操作成功");
  232. let lfind = arrayExistObj(this.tableData, "id", body.roomId);
  233. if (lfind > -1) {
  234. let currentRow = {};
  235. currentRow = this.tableData.splice(lfind, 1)[0]; //删除并赋值
  236. if (sortType == 2) {
  237. this.tableData.push(currentRow);
  238. } else {
  239. this.tableData.unshift(currentRow);
  240. }
  241. this.$refs["tableData"].setCurrentRow(currentRow);
  242. }
  243. }
  244. });
  245. },
  246. //选中颜色
  247. handleRowClassName({ row, rowIndex }) {
  248. // highLightBg 为 'selected'的高亮
  249. //console.log(rowIndex, row)
  250. //return row.highLightBg == 'selected' ? 'high-light-bg' : '';
  251. if (row.choosed) {
  252. return "current-row";
  253. } else {
  254. return "";
  255. }
  256. },
  257. //获取初始数据
  258. dictInit() {
  259. //获取体检中心
  260. getapi("/api/app/organization-units/by-code-all").then((res) => {
  261. if (res.code > -1) {
  262. this.dict.medicalCenter = res.data;
  263. }
  264. });
  265. // 项目类别 树结构
  266. getapi("/api/app/item-type/by-code-all").then((res) => {
  267. if (res.code != -1) {
  268. this.dict.itemTypeTree = res.data;
  269. tcdate(this.dict.itemTypeTree);
  270. }
  271. });
  272. //获取适用性别
  273. getapi("/api/app/for-sex").then((res) => {
  274. if (res.code != -1) {
  275. this.dict.forSex = res.data;
  276. }
  277. });
  278. },
  279. //获取房间列表
  280. getRoom(medicalCenterId) {
  281. this.dataTransOpts.tableS.room.id = ""
  282. this.curRoom = {}
  283. this.isDrag = false;
  284. objCopy(this.formInit, this.form);
  285. this.form.medicalCenterId = medicalCenterId;
  286. this.tableData = [];
  287. postapi('/api/app/Room/GetList').then((res) => {
  288. if (res.code > -1) {
  289. this.tableData = res.data.filter(e => {
  290. return medicalCenterId ? (e.medicalCenterId == medicalCenterId) : e
  291. });
  292. }
  293. });
  294. },
  295. //选择体检中心
  296. changeMedicalCenter(v) {
  297. // console.log('changeMedicalCenter', v)
  298. this.getRoom(v)
  299. },
  300. //点击房间
  301. rowClick(row) {
  302. this.curRoom = row
  303. this.dataTransOpts.tableS.room.id = row.id
  304. this.dataTransOpts.refresh.room_detail.M++;
  305. },
  306. // 新增(编辑调用时,传入id值) 弹框
  307. btnAdd(id) {
  308. if (!id) this.dataTransOpts.tableS.room.id = ''
  309. this.dataTransOpts.refresh.room.S++
  310. if (!id) this.dataTransOpts.refresh.room_detail.M++; //新增则清掉已选组合项目
  311. this.RoomEditParams = {
  312. medicalCenterId: this.medicalCenterId
  313. }
  314. this.dialogWin.RoomEdit = true;
  315. },
  316. //编辑弹框
  317. btnEdit() {
  318. if (!this.dataTransOpts.tableS.room.id) {
  319. this.$message.warning("请先选择分诊叫号房间");
  320. return;
  321. }
  322. this.btnAdd(this.dataTransOpts.tableS.room.id)
  323. },
  324. //删除
  325. btnDel() {
  326. if (!this.dataTransOpts.tableS.room.id) {
  327. this.$message.warning("请选择需要操作的数据");
  328. return;
  329. }
  330. this.$confirm("此操作将永久删除该记录, 是否继续?", "提示", {
  331. confirmButtonText: "是",
  332. cancelButtonText: " 否 ",
  333. type: "warning",
  334. })
  335. .then(() => {
  336. return postapi('/api/app/Room/Delete', { roomId: this.dataTransOpts.tableS.room.id });
  337. })
  338. .then((res) => {
  339. if (res.code != -1) {
  340. console.log("删除成功");
  341. let lfind = arrayExistObj(this.tableData, "id", this.dataTransOpts.tableS.room.id);
  342. if (lfind > -1) this.tableData.splice(lfind, 1);
  343. this.dataTransOpts.tableS.room.id = ''
  344. this.dataTransOpts.refresh.room_detail.M++
  345. }
  346. })
  347. .catch((err) => {
  348. if (err == "cancel") {
  349. console.log("已取消删除");
  350. // this.$message.info("已取消删除");
  351. }
  352. });
  353. },
  354. // 关闭 分组 新增/编辑
  355. close_dialogWinRoomEdit() {
  356. let id = this.dataTransOpts.tableS.room.id
  357. if (id) {
  358. // 点编辑 或 新增有提交
  359. postapi('/api/app/Room/Get', { roomId:id })
  360. .then(res => {
  361. if (res.code != -1) {
  362. let lfind = -1
  363. lfind = arrayExistObj(this.tableData, 'id', id)
  364. if (lfind > -1) {
  365. objCopy(res.data, this.tableData[lfind])
  366. } else {
  367. lfind = this.tableData.length
  368. this.tableData.push(res.data)
  369. }
  370. // 选中当前操作的列
  371. this.$refs["tableData"].setCurrentRow(); //清除选择
  372. this.$refs["tableData"].setCurrentRow(this.tableData[lfind]);
  373. // 更新 customer_org_group_detail 参数
  374. this.curRoom = deepCopy(res.data);
  375. this.dataTransOpts.refresh.room_detail.M++;
  376. }
  377. })
  378. } else {
  379. // 点 新增 但未提交
  380. this.dataTransOpts.tableS.room.id = this.curRoom.id || ''
  381. this.dataTransOpts.refresh.room_detail.M++;
  382. }
  383. },
  384. },
  385. };
  386. </script>
  387. <style scoped>
  388. @import "../../assets/css/global_button.css";
  389. @import "../../assets/css/global_dialog.css";
  390. @import "../../assets/css/global_table.css";
  391. @import "../../assets/css/global_form.css";
  392. @import "../../assets/css/global_input.css";
  393. @import "../../assets/css/global.css";
  394. .btnClass {
  395. width: 100px;
  396. margin-bottom: 5px;
  397. }
  398. </style>