From 59dd5c96e8bca3341d1166a9a350f0731436817b Mon Sep 17 00:00:00 2001 From: qx <1084500556@qq.com> Date: 星期四, 24 七月 2025 10:27:41 +0800 Subject: [PATCH] Merge branch 'master' of http://101.42.27.146:5001/r/ltkj_peisweb --- src/views/reservation/reservations/index.vue | 14 /dev/null | 142 ------- vue.config.js | 4 src/views/doctor/inspectCheck/index.vue | 508 +++++++++---------------- src/main.js | 146 ++++++ src/111.js | 97 ++++ src/api/system/config.js | 9 src/utils/websocket.js | 45 + src/views/hosp/project/index.vue | 187 +++++++-- 9 files changed, 608 insertions(+), 544 deletions(-) diff --git a/src/111.js b/src/111.js new file mode 100644 index 0000000..9ebec6f --- /dev/null +++ b/src/111.js @@ -0,0 +1,97 @@ +// src/main.js +import Vue from "vue"; +import Cookies from "js-cookie"; +import "babel-polyfill"; +import Element from "element-ui"; +import "./assets/styles/element-variables.scss"; +import "@/assets/styles/index.scss"; +import "@/assets/styles/ruoyi.scss"; +import App from "./App"; +import store from "./store"; +import router from "./router"; +import directive from "./directive"; +import plugins from "./plugins"; +import { download } from "@/utils/request"; +import Print from "vue-print-nb"; +import JsonExcel from "vue-json-excel"; +import "./assets/icons"; +import "./permission"; +import { getDicts } from "@/api/system/dict/data"; +import { getConfigKey } from "@/api/system/config"; +import { + parseTime, + resetForm, + addDateRange, + selectDictLabel, + selectDictLabels, + handleTree, +} from "@/utils/ruoyi"; +import Pagination from "@/components/Pagination"; +import Editor from "@/components/Editor"; +import FileUpload from "@/components/FileUpload"; +import ImageUpload from "@/components/ImageUpload"; +import ImagePreview from "@/components/ImagePreview"; +import DictTag from "@/components/DictTag"; +import VueMeta from "vue-meta"; +import DictData from "@/components/DictData"; +import * as echarts from "echarts"; +import VueBarcode from "vue-barcode"; + +Vue.component("downloadExcel", JsonExcel); +Vue.component("barcode", VueBarcode); +Vue.component("DictTag", DictTag); +Vue.component("Pagination", Pagination); +Vue.component("Editor", Editor); +Vue.component("FileUpload", FileUpload); +Vue.component("ImageUpload", ImageUpload); +Vue.component("ImagePreview", ImagePreview); + +Vue.prototype.getDicts = getDicts; +Vue.prototype.getConfigKey = getConfigKey; +Vue.prototype.parseTime = parseTime; +Vue.prototype.resetForm = resetForm; +Vue.prototype.addDateRange = addDateRange; +Vue.prototype.selectDictLabel = selectDictLabel; +Vue.prototype.selectDictLabels = selectDictLabels; +Vue.prototype.download = download; +Vue.prototype.handleTree = handleTree; +Vue.prototype.$echarts = echarts; + +// 淇濈暀 $showNotification锛屾敮鎸佹墜鍔ㄨЕ鍙戦�氱煡 +Vue.prototype.$showNotification = function (type, title, message, onClick) { + console.log('瑙﹀彂閫氱煡:', { type, title, message }, new Date().toLocaleString()); + Vue.prototype.$notify({ + title, + message, + type, + duration: 5000, + position: 'top-right', + offset: 50, + onClick, + customClass: 'global-notification', + appendTo: document.body + }); +}; + +// 鐩戝惉璺敱鍙樺寲 +router.afterEach(() => { + console.log('璺敱鍒囨崲瀹屾垚锛屽綋鍓嶈矾寰�:', router.currentRoute.path); +}); + +const app = new Vue({ + el: "#app", + router, + store, + render: (h) => h(App) +}); + +Vue.use(directive); +Vue.use(plugins); +Vue.use(VueMeta); +Vue.use(Print); +Vue.use(Element, { + size: Cookies.get("size") || "medium", +}); +DictData.install(); + +Vue.config.productionTip = false; \ No newline at end of file diff --git a/src/api/system/config.js b/src/api/system/config.js index a404d82..6a60353 100644 --- a/src/api/system/config.js +++ b/src/api/system/config.js @@ -33,7 +33,14 @@ data: data }) } - +// 鏂板鍙傛暟閰嶇疆 +export function yidu(data) { + return request({ + url: '/system/notice/readNotice ', + method: 'post', + data: data + }) +} // 淇敼鍙傛暟閰嶇疆 export function updateConfig(data) { return request({ diff --git a/src/main copy.js b/src/main copy.js deleted file mode 100644 index 30d4cab..0000000 --- a/src/main copy.js +++ /dev/null @@ -1,142 +0,0 @@ -// src/main.js -import Vue from "vue"; -import Cookies from "js-cookie"; -import "babel-polyfill"; -import Element from "element-ui"; -import "./assets/styles/element-variables.scss"; -import "@/assets/styles/index.scss"; -import "@/assets/styles/ruoyi.scss"; -import App from "./App"; -import store from "./store"; -import router from "./router"; -import directive from "./directive"; -import plugins from "./plugins"; -import { download } from "@/utils/request"; -import Print from "vue-print-nb"; -import JsonExcel from "vue-json-excel"; -import "./assets/icons"; -import "./permission"; -import { getDicts } from "@/api/system/dict/data"; -import { getConfigKey } from "@/api/system/config"; -import { - parseTime, - resetForm, - addDateRange, - selectDictLabel, - selectDictLabels, - handleTree, -} from "@/utils/ruoyi"; -import Pagination from "@/components/Pagination"; -import Editor from "@/components/Editor"; -import FileUpload from "@/components/FileUpload"; -import ImageUpload from "@/components/ImageUpload"; -import ImagePreview from "@/components/ImagePreview"; -import DictTag from "@/components/DictTag"; -import VueMeta from "vue-meta"; -import DictData from "@/components/DictData"; -import * as echarts from "echarts"; -import VueBarcode from "vue-barcode"; -import { initWebSocket, closeWebSocket } from "@/utils/websocket"; - -Vue.component("downloadExcel", JsonExcel); -Vue.component("barcode", VueBarcode); -Vue.component("DictTag", DictTag); -Vue.component("Pagination", Pagination); -Vue.component("Editor", Editor); -Vue.component("FileUpload", FileUpload); -Vue.component("ImageUpload", ImageUpload); -Vue.component("ImagePreview", ImagePreview); - -Vue.prototype.getDicts = getDicts; -Vue.prototype.getConfigKey = getConfigKey; -Vue.prototype.parseTime = parseTime; -Vue.prototype.resetForm = resetForm; -Vue.prototype.addDateRange = addDateRange; -Vue.prototype.selectDictLabel = selectDictLabel; -Vue.prototype.selectDictLabels = selectDictLabels; -Vue.prototype.download = download; -Vue.prototype.handleTree = handleTree; -Vue.prototype.$echarts = echarts; - -Vue.prototype.$showNotification = function (type, title, message, onClick) { - console.log('瑙﹀彂閫氱煡:', { type, title, message }); - Vue.prototype.$notify({ - title, - message, - type, - duration: 5000, - position: 'top-right', - offset: 50, - onClick, - customClass: 'global-notification', - appendTo: document.body - }); -}; - -// 鐩戝惉璺敱鍙樺寲 -router.afterEach(() => { - console.log('璺敱鍒囨崲瀹屾垚锛屽綋鍓嶈矾寰�:', router.currentRoute.path); -}); - -const app = new Vue({ - el: "#app", - router, - store, - render: (h) => h(App), - mounted() { - const token = store.state.user.token || Cookies.get('token') || ''; - if (token) { - console.log('Token:', token); - initWebSocket(token, (type, data) => { - if (type === 'error') { - Vue.prototype.$showNotification('error', '閿欒', data); - return; - } - try { - const message = JSON.parse(data); - console.log('WebSocket 瑙f瀽鍚庢秷鎭�:', message); - if (message.noticeId && message.noticeTitle) { - const noticeTypeLabel = message.noticeType === '1' ? '閫氱煡' : '鍏憡'; - const contentPreview = message.noticeContent - ? message.noticeContent.replace(/<[^>]+>/g, '').substring(0, 20) + '...' - : '鏃犲唴瀹�'; - Vue.prototype.$showNotification( - 'success', - `鏂�${noticeTypeLabel}`, - `${message.noticeTitle} - ${contentPreview}`, - () => { - - router.push({ - path: '/redirect/notice', - query: { noticeId: message.noticeId } - }); - } - ); - } else { - console.log('鏈煡娑堟伅绫诲瀷:', message); - Vue.prototype.$showNotification('info', '娑堟伅', '鏀跺埌鏈煡鏍煎紡鐨勬秷鎭�'); - } - } catch (error) { - console.error('娑堟伅瑙f瀽澶辫触:', error, '鍘熷鏁版嵁:', data); - Vue.prototype.$showNotification('info', '娑堟伅', `鏈嶅姟鍣ㄥ洖搴斿瓧绗︿覆: ${data}`); - } - }); - } else { - console.error('鏈壘鍒� token锛屾棤娉曞垵濮嬪寲 WebSocket'); - } - }, - beforeDestroy() { - closeWebSocket(); // 娓呯悊 WebSocket - } -}); - -Vue.use(directive); -Vue.use(plugins); -Vue.use(VueMeta); -Vue.use(Print); -Vue.use(Element, { - size: Cookies.get("size") || "medium", -}); -DictData.install(); - -Vue.config.productionTip = false; \ No newline at end of file diff --git a/src/main.js b/src/main.js index 9ebec6f..37508ae 100644 --- a/src/main.js +++ b/src/main.js @@ -17,7 +17,7 @@ import "./assets/icons"; import "./permission"; import { getDicts } from "@/api/system/dict/data"; -import { getConfigKey } from "@/api/system/config"; +import { getConfigKey, yidu } from "@/api/system/config"; import { parseTime, resetForm, @@ -36,7 +36,10 @@ import DictData from "@/components/DictData"; import * as echarts from "echarts"; import VueBarcode from "vue-barcode"; +import { initWebSocket, closeWebSocket } from "@/utils/websocket"; +import RightToolbar from "@/components/RightToolbar" +// 娉ㄥ唽鍏ㄥ眬缁勪欢 Vue.component("downloadExcel", JsonExcel); Vue.component("barcode", VueBarcode); Vue.component("DictTag", DictTag); @@ -45,7 +48,9 @@ Vue.component("FileUpload", FileUpload); Vue.component("ImageUpload", ImageUpload); Vue.component("ImagePreview", ImagePreview); +Vue.component("RightToolbar", RightToolbar); +// 娉ㄥ唽鍏ㄥ眬鏂规硶 Vue.prototype.getDicts = getDicts; Vue.prototype.getConfigKey = getConfigKey; Vue.prototype.parseTime = parseTime; @@ -57,20 +62,78 @@ Vue.prototype.handleTree = handleTree; Vue.prototype.$echarts = echarts; -// 淇濈暀 $showNotification锛屾敮鎸佹墜鍔ㄨЕ鍙戦�氱煡 -Vue.prototype.$showNotification = function (type, title, message, onClick) { - console.log('瑙﹀彂閫氱煡:', { type, title, message }, new Date().toLocaleString()); - Vue.prototype.$notify({ - title, - message, +// 閫氱煡绠$悊锛氳窡韪綋鍓嶉�氱煡鍜屽亸绉婚噺 +const notificationManager = { + notifications: [], // 瀛樺偍褰撳墠鏄剧ず鐨勯�氱煡瀹炰緥 + baseOffset: 50, // 鍩虹鍋忕Щ閲� + notificationHeight: 80, // 姣忎釜閫氱煡鐨勪及璁¢珮搴︼紙鍖呮嫭闂磋窛锛� + maxNotifications: 5, // 鏈�澶у悓鏃舵樉绀虹殑閫氱煡鏁伴噺 + addNotification(notification) { + if (this.notifications.length >= this.maxNotifications) { + // 鍏抽棴鏈�鏃╃殑閫氱煡 + const oldest = this.notifications.shift(); + oldest.close(); + } + this.notifications.push(notification); + // 璁剧疆鍔ㄦ�� offset 鍜� z-index + notification.offset = this.baseOffset + this.notifications.length * this.notificationHeight; + notification.customClass += ` notification-${this.notifications.length}`; // 涓� z-index 娣诲姞鍞竴绫� + // 鐩戝惉閫氱煡鍏抽棴 + notification.onClose = () => { + const index = this.notifications.indexOf(notification); + if (index > -1) { + this.notifications.splice(index, 1); + // 鏇存柊鍚庣画閫氱煡鐨� offset + this.updateOffsets(); + } + }; + }, + updateOffsets() { + this.notifications.forEach((notification, index) => { + notification.offset = this.baseOffset + (index + 1) * this.notificationHeight; + notification.customClass = notification.customClass.replace(/notification-\d+/, `notification-${index + 1}`); + }); + } +}; + +// 鍏ㄥ眬閫氱煡鏂规硶锛屾坊鍔犫�滃凡璇烩�濇寜閽� +Vue.prototype.$showNotification = function (type, title, message, onClick, noticeId) { + console.log('瑙﹀彂閫氱煡:', { type, title, message, noticeId, noticeIdType: typeof noticeId }); // 璋冭瘯锛氳褰� noticeId 鍜岀被鍨� + const h = this.$createElement; + const notification = this.$notify({ + title: title, + message: h('div', { class: 'notification-content' }, [ + h('div', { class: 'notification-message' }, message), + noticeId ? h('el-button', { + class: 'read-button', + style: { marginLeft: '10px', float: 'right', cursor: 'pointer' }, + props: { type: 'primary', size: 'mini' }, + on: { + click: async () => { + console.log('鐐瑰嚮鈥滃凡璇烩�濇寜閽紝noticeId:', noticeId, 'type:', typeof noticeId); // 璋冭瘯锛氳褰曠偣鍑绘椂鐨� noticeId + try { + await yidu({ noticeId: String(noticeId) }); + console.log(`閫氱煡 ${noticeId} 宸叉爣璁颁负宸茶`); + this.$message.success('鏍囪涓哄凡璇绘垚鍔�'); + notification.close(); + } catch (error) { + console.error('鏍囪宸茶澶辫触:', error, 'noticeId:', noticeId); + this.$message.error('鏍囪宸茶澶辫触'); + } + } + } + }, '宸茶') : null + ]), type, duration: 5000, position: 'top-right', - offset: 50, - onClick, + offset: notificationManager.baseOffset, // 鍒濆 offset + onClick: null, // 涓嶈烦杞� customClass: 'global-notification', + dangerouslyUseHTMLString: false, appendTo: document.body }); + notificationManager.addNotification(notification); // 娣诲姞鍒伴�氱煡绠$悊 }; // 鐩戝惉璺敱鍙樺寲 @@ -78,13 +141,76 @@ console.log('璺敱鍒囨崲瀹屾垚锛屽綋鍓嶈矾寰�:', router.currentRoute.path); }); +// 瀹氫箟 WebSocket 鍒濆鍖栨爣蹇楋紝闃叉閲嶅杩炴帴 +let isWebSocketInitialized = false; + const app = new Vue({ el: "#app", router, store, - render: (h) => h(App) + render: (h) => h(App), + mounted() { + const token = store.state.user.token || Cookies.get('token') || ''; + if (token && !isWebSocketInitialized) { + console.log('鍒濆鍖� WebSocket锛孴oken:', token); + isWebSocketInitialized = true; + initWebSocket(token, (type, data) => { + console.log('WebSocket 鏀跺埌娑堟伅:', { type, data }); // 璋冭瘯锛氳褰曞師濮嬫暟鎹� + if (type === 'error') { + Vue.prototype.$showNotification.call(this, 'error', '閿欒', data); + return; + } + try { + if (typeof data === 'string' && data.trim().startsWith('{')) { + // 鏇挎崲澶ф暣鏁板瓧娈碉紝闃叉绮惧害涓㈠け + const normalizedData = data.replace(/"(noticeId|notice_id|id)":\s*(\d+)/g, '"$1":"$2"'); + const message = JSON.parse(normalizedData); + console.log('WebSocket 瑙f瀽鍚庢秷鎭�:', message); // 璋冭瘯锛氳褰曡В鏋愬悗鐨勬秷鎭� + if (message.noticeId || message.notice_id || message.id) { + const noticeTypeLabel = message.noticeType === '1' ? '閫氱煡' : '鍏憡'; + const noticeTitle = message.noticeTitle ? message.noticeTitle.replace(/<[^>]+>/g, '') : '鏃犳爣棰�'; + const contentPreview = message.noticeContent + ? message.noticeContent.replace(/<[^>]+>/g, '').substring(0, 20) + '...' + : '鏃犲唴瀹�'; + const noticeId = String(message.noticeId || message.notice_id || message.id); + console.log('鍑嗗瑙﹀彂閫氱煡锛宯oticeId:', noticeId, 'type:', typeof noticeId); // 璋冭瘯锛氳褰曚紶閫掔殑 noticeId + Vue.prototype.$showNotification.call( + this, + 'success', + `鏂�${noticeTypeLabel}`, + `${noticeTitle} - ${contentPreview}`, + null, + noticeId + ); + } else { + console.log('鏈煡娑堟伅绫诲瀷:', message); + Vue.prototype.$showNotification.call(this, 'info', '娑堟伅', '鏀跺埌鏈煡鏍煎紡鐨勬秷鎭�'); + } + } else { + console.log('WebSocket 闈� JSON 娑堟伅:', data); + + } + } catch (error) { + console.error('娑堟伅瑙f瀽澶辫触:', error, '鍘熷鏁版嵁:', data); + Vue.prototype.$showNotification.call(this, 'error', '娑堟伅瑙f瀽澶辫触', `鏈嶅姟鍣ㄥ洖搴斿瓧绗︿覆: ${data}`); + } + }); + } else if (!token) { + console.error('鏈壘鍒� token锛屾棤娉曞垵濮嬪寲 WebSocket'); + } else { + console.log('WebSocket 宸插垵濮嬪寲锛岃烦杩囬噸澶嶈繛鎺�'); + } + }, + beforeDestroy() { + if (isWebSocketInitialized) { + closeWebSocket(); + isWebSocketInitialized = false; + console.log('Vue 瀹炰緥閿�姣侊紝WebSocket 宸叉竻鐞�'); + } + } }); +// 娉ㄥ唽鎻掍欢 Vue.use(directive); Vue.use(plugins); Vue.use(VueMeta); diff --git a/src/utils/websocket.js b/src/utils/websocket.js index 40529b1..9d956c5 100644 --- a/src/utils/websocket.js +++ b/src/utils/websocket.js @@ -1,6 +1,7 @@ // src/utils/websocket.js let ws = null; let reconnectAttempts = 0; +let pingTimer = null; // 鐢ㄤ簬绠$悊蹇冭烦瀹氭椂鍣� const maxReconnectAttempts = 5; const reconnectInterval = 5000; // 5绉掗噸杩為棿闅� const pingInterval = 5000; // 5绉掑彂閫乸ing @@ -11,21 +12,33 @@ return; } - const wsUrl = `ws://192.168.1.2:5011/ws?token=${token}`; + // 濡傛灉 ws 宸插瓨鍦ㄤ笖杩炴帴娲昏穬锛屽垯璺宠繃鍒濆鍖� + if (ws && ws.readyState === WebSocket.OPEN) { + console.log('WebSocket 宸茶繛鎺ワ紝璺宠繃閲嶅鍒濆鍖�'); + return; + } + + // 濡傛灉 ws 瀛樺湪浣嗘湭鍏抽棴锛屽厛鍏抽棴鏃ц繛鎺� + if (ws) { + console.warn('鍙戠幇鏃� WebSocket 杩炴帴锛屾鍦ㄥ叧闂�...'); + closeWebSocket(); + } + + const wsUrl = `ws://192.168.1.244:5011/ws?token=${token}`; ws = new WebSocket(wsUrl); ws.onopen = () => { - console.log('WebSocket 杩炴帴鎴愬姛'); - reconnectAttempts = 0; + reconnectAttempts = 0; // 閲嶇疆閲嶈繛璁℃暟 // 鍚姩蹇冭烦鏈哄埗 - const pingTimer = setInterval(() => { - if (ws.readyState === WebSocket.OPEN) { - console.log('鍙戦�� ping 娑堟伅'); + if (pingTimer) clearInterval(pingTimer); // 娓呯悊鏃у畾鏃跺櫒 + pingTimer = setInterval(() => { + if (ws && ws.readyState === WebSocket.OPEN) { ws.send('ping'); } else { console.warn('WebSocket 鏈繛鎺ワ紝鍋滄 ping'); clearInterval(pingTimer); + pingTimer = null; } }, pingInterval); }; @@ -35,6 +48,7 @@ console.log('WebSocket 鏀跺埌鍘熷娑堟伅:', data); if (data === 'pong') { console.log('鏀跺埌 pong 鍝嶅簲锛岃繛鎺ユ椿璺�'); + reconnectAttempts = 0; // 閲嶇疆閲嶈繛璁℃暟锛岀‘淇濇椿璺冭繛鎺ヤ笉瑙﹀彂閲嶈繛 return; } onMessage('message', data); @@ -42,11 +56,14 @@ ws.onerror = (error) => { console.error('WebSocket 閿欒:', error); - onMessage('error', 'WebSocket 杩炴帴閿欒'); }; ws.onclose = () => { - console.warn('WebSocket 杩炴帴鍏抽棴'); + console.warn('WebSocket 杩炴帴鍏抽棴锛屾椂闂�:', new Date()); + if (pingTimer) { + clearInterval(pingTimer); + pingTimer = null; + } if (reconnectAttempts < maxReconnectAttempts) { reconnectAttempts++; console.log(`灏濊瘯閲嶈繛 (${reconnectAttempts}/${maxReconnectAttempts})...`); @@ -61,18 +78,18 @@ // 娓呯悊 WebSocket window.addEventListener('beforeunload', () => { - if (ws) { - ws.close(); - ws = null; - console.log('WebSocket 宸叉竻鐞�'); - } - }); + closeWebSocket(); + }, { once: true }); // 纭繚浜嬩欢鐩戝惉鍙坊鍔犱竴娆� } export function closeWebSocket() { if (ws) { ws.close(); ws = null; + if (pingTimer) { + clearInterval(pingTimer); + pingTimer = null; + } console.log('WebSocket 宸插叧闂�'); } } \ No newline at end of file diff --git a/src/views/doctor/inspectCheck/index.vue b/src/views/doctor/inspectCheck/index.vue index 51c2dd6..baac4c6 100644 --- a/src/views/doctor/inspectCheck/index.vue +++ b/src/views/doctor/inspectCheck/index.vue @@ -1,35 +1,77 @@ <template> <div class="app-container"> - <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="68px" @submit.native.prevent> + <el-form + :model="queryParams" + ref="queryForm" + size="small" + :inline="true" + label-width="68px" + @submit.native.prevent + > <el-form-item label="浣撴鍙�" prop="reportDoctorCode"> - <el-input ref="inputName" v-model="queryParams.tjNum" placeholder="璇疯緭鍏ヤ綋妫�鍙�" clearable - @keyup.enter.native="handleQuery" style="width: 170px" /> + <el-input + ref="inputName" + v-model="queryParams.tjNum" + placeholder="璇疯緭鍏ヤ綋妫�鍙�" + clearable + @keyup.enter.native="handleQuery" + style="width: 170px" + /> </el-form-item> <el-form-item> - <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery" style="margin-right: 15px"> + <el-button + type="primary" + icon="el-icon-search" + size="mini" + @click="handleQuery" + style="margin-right: 15px" + > 鏌ヨ </el-button> - <el-button icon="el-icon-refresh" type="primary" size="mini" @click="resetQuery"> + <el-button + icon="el-icon-refresh" + type="primary" + size="mini" + @click="resetQuery" + > 閲嶇疆 </el-button> - <el-button icon="el-icon-check" type="primary" size="mini" style="margin-right: 15px" @click="tongbu"> + <el-button + icon="el-icon-check" + type="primary" + size="mini" + style="margin-right: 15px" + @click="tongbu" + > 鍚屾 </el-button> </el-form-item> </el-form> + <div class="box"> - <div class="table-header"> - 妫�楠岃褰� - </div> + <div class="table-header">妫�楠岃褰�</div> <div> - <el-table :data="exaLists" border style="width: 100%" @selection-change="handleSelectionChange" - :header-cell-style="{ background: '#aad8df', fontSize: '14px', color: '#333' }" height="350" ref="firstTable"> + <el-table + :data="exaLists" + border + style="width: 100%" + @selection-change="handleSelectionChange" + :header-cell-style="{ background: '#aad8df', fontSize: '14px', color: '#333' }" + height="350" + ref="firstTable" + > <el-table-column fixed type="selection" align="center" label="閫夋嫨" width="50" /> <el-table-column label="濮撳悕" align="center" prop="name" width="80" /> <el-table-column label="鎬у埆" align="center" prop="gender" width="80" /> <el-table-column label="骞撮緞" align="center" prop="patientAge" width="80" /> <el-table-column label="閫佹绉戝" align="center" prop="deptName" width="100" /> - <el-table-column label="妫�楠岄」鐩�" align="center" prop="checkParts" width="350" :show-overflow-tooltip="true" /> + <el-table-column + label="妫�楠岄」鐩�" + align="center" + prop="checkParts" + width="350" + :show-overflow-tooltip="true" + /> <el-table-column label="椤圭洰缂栧彿" align="center" prop="jcxmid" width="150" /> <el-table-column label="瀹℃牳鍖诲笀" align="center" prop="shys" width="150" /> <el-table-column label="鎶ュ憡鏃堕棿" align="center" prop="examinationDate" width="150" /> @@ -49,20 +91,44 @@ </el-table> </div> </div> + <div class="table-title"> - <h3> - 浣撴璁板綍锛� - <span class="highlight">濮撳悕锛歿{ infoList.tjCustomerName || "鏆傛棤" }}</span> - <span class="highlight">鎬у埆锛歿{ infoList.tjCustomerSex == 0 ? "鐢�" : infoList.tjCustomerSex == 1 ? "濂�" : "鏆傛棤" }}</span> - <span class="highlight">骞撮緞锛歿{ infoList.tjCustomerAge || "鏆傛棤" }}</span> - <span class="highlight">闂ㄨ瘖鍙凤細{{ infoList.cardId || "鏆傛棤" }}</span> - </h3> -</div> - <el-table border height="350" ref="tab1" :data="checkList" v-loading="loading" style="width: 100%" + <h3> + 浣撴璁板綍锛� + <span class="highlight">濮撳悕锛歿{ infoList.tjCustomerName || "鏆傛棤" }}</span> + <span class="highlight"> + 鎬у埆锛� + {{ + infoList.tjCustomerSex == 0 + ? "鐢�" + : infoList.tjCustomerSex == 1 + ? "濂�" + : "鏆傛棤" + }} + </span> + <span class="highlight">骞撮緞锛歿{ infoList.tjCustomerAge || "鏆傛棤" }}</span> + <span class="highlight">闂ㄨ瘖鍙凤細{{ infoList.cardId || "鏆傛棤" }}</span> + </h3> + </div> + + <el-table + border + height="350" + ref="tab1" + :data="checkList" + v-loading="loading" + style="width: 100%" @selection-change="handleSelectionChangeSecond" - :header-cell-style="{ background: '#aad8df', fontSize: '14px', color: '#333' }"> + :header-cell-style="{ background: '#aad8df', fontSize: '14px', color: '#333' }" + > <el-table-column type="selection" width="60" /> - <el-table-column label="鐘舵��" align="center" prop="type" :show-overflow-tooltip="true" min-width="60"> + <el-table-column + label="鐘舵��" + align="center" + prop="type" + :show-overflow-tooltip="true" + min-width="60" + > <template slot-scope="scope"> <span v-if="scope.row.type == '0'">鏈</span> <span v-if="scope.row.type == '1'">宸叉</span> @@ -79,347 +145,152 @@ </el-table> </div> </template> + <script> import { getlisList, getJyTjList, asyncPacs } from "@/api/doctor/pacsCheck"; import { getOrderList } from "@/api/hosp/order"; -import moment from "moment"; export default { - dicts: ["dict_tj_status"], data() { return { - isProcessing: false, // 闃叉姝诲惊鐜� - isDeselection: false, // 鏍囪鏄惁涓哄彇娑堥�変腑 - infoList: {}, - dis: false, - code: null, - createTimeList: "", - total: 0, - loading: false, - isSyncing: false, - isFetchingRightTableData: false, queryParams: { - name: null, - start: null, - end: null, tjNum: null, }, - checkStatus: "0", exaLists: [], - selectedFirstTable: null, - selectedSecondTable: [], - form: {}, - clearTimeSet: null, - tjNumbers: "", - multipleSelection: "", - tjnum: "", - xiangmuList: [], checkList: [], - tg: true, - bh: true, - pickerOptions: { - shortcuts: [ - { - text: "鏈�杩戜竴鍛�", - onClick(picker) { - const end = new Date(); - const start = new Date(); - start.setTime(start.getTime() - 3600 * 1000 * 24 * 7); - picker.$emit("pick", [start, end]); - }, - }, - { - text: "鏈�杩戜竴涓湀", - onClick(picker) { - const end = new Date(); - const start = new Date(); - start.setTime(start.getTime() - 3600 * 1000 * 24 * 30); - picker.$emit("pick", [start, end]); - }, - }, - { - text: "鏈�杩戜笁涓湀", - onClick(picker) { - const end = new Date(); - const start = new Date(); - start.setTime(start.getTime() - 3600 * 1000 * 24 * 90); - picker.$emit("pick", [start, end]); - }, - }, - ], - }, + infoList: {}, + selectedFirstTable: [], + selectedSecondTable: [], + loading: false, + isProcessingSelection: false, }; }, - mounted() { this.$nextTick(() => { this.$refs.inputName.focus(); }); }, - methods: { - handleDateChange(val) { - if (val && val.length === 2) { - this.queryParams.start = val[0]; - this.queryParams.end = val[1]; - } else { - this.queryParams.start = null; - this.queryParams.end = null; - } - console.log("Query Params:", this.queryParams); - }, - - tableRowClassName({ row }) { - return !row.brid ? "row-disabled" : ""; - }, - -handleSelectionChange(val) { - // 闃叉閲嶅瑙﹀彂 - if (this.isProcessingSelection) { - console.log('姝e湪澶勭悊閫夋嫨锛岃烦杩囬噸澶嶈Е鍙�'); - return; - } - this.isProcessingSelection = true; - - // 濡傛灉娌℃湁閫変腑琛岋紝娓呯┖鎵�鏈夐�夋嫨骞惰烦杩囨帴鍙h皟鐢� - if (val.length === 0) { - console.log('妫�娴嬪埌鍙栨秷閫変腑锛屾竻绌烘墍鏈夐�夋嫨'); - this.$refs.firstTable.clearSelection(); - this.selectedFirstTable = null; - this.checkList = []; - this.isDeselection = true; - this.$nextTick(() => { - this.isProcessingSelection = false; - this.$refs.firstTable.$forceUpdate(); // 寮哄埗鍒锋柊琛ㄦ牸 - }); - return; - } - - // 妫�鏌ユ槸鍚︾偣鍑讳簡鍏ㄩ�夋寜閽紙val 闀垮害绛変簬琛ㄦ牸鎬昏鏁帮級 - if (val.length === this.exaLists.length) { - console.log('妫�娴嬪埌鍏ㄩ�夛紝閫変腑鎵�鏈夎'); - this.selectedFirstTable = [...this.exaLists]; // 閫変腑鎵�鏈夎 - this.$refs.firstTable.clearSelection(); - this.exaLists.forEach(row => { - if (!row.brid) { - console.warn(`鍚嶇О涓� ${row.name} 鐨勮娌℃湁鐢宠鍗曞彿锛岃烦杩囬�夋嫨`); - return; - } - this.$refs.firstTable.toggleRowSelection(row, true, false); - }); - } else { - // 鑾峰彇鏈�鏂伴�変腑鐨勮 - const latestSelectedRow = val[val.length - 1]; - - // 妫�鏌ユ槸鍚︾偣鍑讳簡宸查�変腑鐨勮锛堝彇娑堟墍鏈夐�変腑锛� - const isTogglingSelectedRow = this.selectedFirstTable && this.selectedFirstTable.some(row => row.tempId === latestSelectedRow.tempId); - if (isTogglingSelectedRow) { - console.log('鐐瑰嚮宸查�変腑琛岋紝鍙栨秷鎵�鏈夐�変腑'); - this.$refs.firstTable.clearSelection(); - this.selectedFirstTable = null; - this.checkList = []; - this.isDeselection = true; - this.$nextTick(() => { - this.isProcessingSelection = false; - this.$refs.firstTable.$forceUpdate(); // 寮哄埗鍒锋柊琛ㄦ牸 - }); - return; - } - - // 姝e父閫変腑閫昏緫锛氭牴鎹� brid 绛涢�� - const filterKey = 'brid'; - const filterValue = latestSelectedRow.brid; - console.log(`鎸� ${filterKey} 绛涢��: ${filterValue}`); - - // 娓呯┖鎵�鏈夐�変腑鐘舵�� - this.$refs.firstTable.clearSelection(); - - // 閫変腑涓� brid 鍖归厤鐨勮 - const rowsToSelect = this.exaLists.filter(row => row.brid === filterValue); - rowsToSelect.forEach(row => { - if (!row.brid) { - console.warn(`鍚嶇О涓� ${row.name} 鐨勮娌℃湁鐢宠鍗曞彿锛岃烦杩囬�夋嫨`); - return; - } - this.$refs.firstTable.toggleRowSelection(row, true, false); - }); - - // 鏇存柊 selectedFirstTable 涓� brid 鍖归厤鐨勮 - this.selectedFirstTable = rowsToSelect; - } - - // 璋冪敤鍙充晶琛ㄦ牸鏁版嵁 - if (!this.isFetchingRightTableData && this.selectedFirstTable.length > 0) { - this.isFetchingRightTableData = true; - this.fetchRightTableData().finally(() => { - this.isFetchingRightTableData = false; - this.$nextTick(() => { - // 浠呮洿鏂版牱寮忥紝涓嶈Е鍙戞柊浜嬩欢 - this.$refs.firstTable.$forceUpdate(); - this.isProcessingSelection = false; - }); - }); - } else { - this.isProcessingSelection = false; - } - - // 閲嶇疆 isDeselection 鐘舵�� - this.isDeselection = false; -}, - fetchRightTableData() { - const code = this.queryParams.tjNum; - if (!code) { - console.warn('鏈彁渚涗綋妫�鍙凤紝璺宠繃 fetchRightTableData'); - this.checkList = []; - this.loading = false; - return Promise.resolve(); - } - this.loading = true; - return getJyTjList(code) - .then((response) => { - this.checkList = response.data || []; - this.loading = false; - }) - .catch((error) => { - console.error('鑾峰彇 checkList 澶辫触:', error); - this.checkList = []; - this.loading = false; - throw error; - }); - }, - - handleSelectionChangeSecond(selectedRows) { - this.selectedSecondTable = selectedRows; - if (selectedRows.length > 1) { - let del_row = selectedRows.shift(); - this.$refs.tab1.toggleRowSelection(del_row, false); - } - console.log("褰撳墠閫変腑鐨勮鏁版嵁:", this.selectedSecondTable); - }, - async handleQuery() { if (!this.queryParams.tjNum) { this.$message.error("浣撴鍙蜂笉鑳戒负绌�"); return; } - this.loading = true; try { - // 骞惰鎵ц涓や釜鏌ヨ const [orderResponse, lisResponse] = await Promise.all([ - getOrderList(this.queryParams).catch((error) => { - console.error('鑾峰彇 orderList 澶辫触:', error); - return { data: { list: [] } }; // 杩斿洖绌烘暟鎹互缁х画鎵ц - }), + getOrderList(this.queryParams).catch(() => ({ data: { list: [] } })), getlisList(this.queryParams), ]); - - // 澶勭悊 getOrderList 缁撴灉 - if (orderResponse.data?.list?.length > 0) { - this.infoList = orderResponse.data.list[0]; - } else { - this.infoList = {}; - console.warn('getOrderList 杩斿洖绌哄垪琛�'); - } - - // 澶勭悊 getlisList 缁撴灉 - if (lisResponse.code === 200) { - this.exaLists = lisResponse.data.map((item, index) => ({ - ...item, - brid: item.brid?.trim(), // 娓呯悊绌烘牸 - mzh: item.mzh?.trim(), - tempId: index, - })); - console.log('Loaded exaLists:', this.exaLists); - - // 鑾峰彇鍙充晶琛ㄦ牸鏁版嵁 - await this.fetchRightTableData(); - } else { - this.exaLists = []; - this.$message.error(lisResponse.msg || "鏌ヨ妫�楠岃褰曞け璐�"); - } - } catch (error) { - console.error('鏌ヨ澶辫触:', error); - this.$message.error(error?.msg || "鏌ヨ澶辫触锛岃绋嶅悗閲嶈瘯"); - this.exaLists = []; - this.checkList = []; - this.infoList = {}; + this.infoList = orderResponse.data.list?.[0] || {}; + this.exaLists = lisResponse.data.map((item, index) => ({ + ...item, + brid: item.brid?.trim(), + tempId: index, + })); + await this.fetchRightTableData(); + } catch (e) { + console.error(e); } finally { this.loading = false; - } - - // 澶勭悊鏃堕棿鑼冨洿 - if (this.createTimeList) { - this.queryParams.start = this.createTimeList[0]; - this.queryParams.end = this.createTimeList[1]; - } else { - this.queryParams.start = null; - this.queryParams.end = null; } }, resetQuery() { - this.createTimeList = []; - this.resetForm("queryForm"); - this.queryParams = { - name: null, - start: null, - end: null, - tjNum: null, - }; - this.checkList = []; + this.queryParams.tjNum = null; this.exaLists = []; + this.checkList = []; this.infoList = {}; }, +handleSelectionChange(selected) { + if (this.isProcessingSelection) return; + this.isProcessingSelection = true; - handleCurrentChange(row) { - this.currentRow = row; + // 鎵惧埌鐢ㄦ埛鍒氭搷浣滅殑閭d竴鏉★紙瀵规瘮涔嬪墠鍜岀幇鍦ㄧ殑宸紓锛� + const old = this.selectedFirstTable; + let changedRow = null; + + if (selected.length > old.length) { + // 鏂板锛氭壘鍑烘柊澧炵殑 + changedRow = selected.find(row => !old.includes(row)); + } else { + // 鍒犻櫎锛氭壘鍑哄垹闄ょ殑 + changedRow = old.find(row => !selected.includes(row)); + } + + if (changedRow) { + const group = this.exaLists.filter(r => r.brid === changedRow.brid); + const isAdding = selected.length > old.length; + + this.$refs.firstTable.clearSelection(); + if (isAdding) { + // 娣诲姞锛屾暣涓粍閫変笂 + 鍘熸湁閫夌殑 brid 涔熼�変笂 + const allBrids = new Set(); + selected.forEach(row => allBrids.add(row.brid)); + allBrids.add(changedRow.brid); + const newSelection = this.exaLists.filter(row => allBrids.has(row.brid)); + newSelection.forEach(row => { + this.$refs.firstTable.toggleRowSelection(row, true); + }); + this.selectedFirstTable = newSelection; + } else { + // 鍒犻櫎锛屾暣涓粍鍙栨秷锛屽啀鎶婂墿涓� brid 鍒嗙粍琛ュ洖鍘� + const remaining = old.filter(row => row.brid !== changedRow.brid); + const remainBrids = [...new Set(remaining.map(r => r.brid))]; + const newSelection = this.exaLists.filter(row => remainBrids.includes(row.brid)); + newSelection.forEach(row => { + this.$refs.firstTable.toggleRowSelection(row, true); + }); + this.selectedFirstTable = newSelection; + } + } else { + this.selectedFirstTable = selected; + } + + this.fetchRightTableData(); + this.isProcessingSelection = false; +}, + + + handleSelectionChangeSecond(selected) { + this.selectedSecondTable = selected.slice(0, 1); }, - setTime() { - this.clearTimeSet = setInterval(() => { - this.$modal.closeLoading(); - }, 300000); + fetchRightTableData() { + if (!this.queryParams.tjNum) return; + this.loading = true; + return getJyTjList(this.queryParams.tjNum) + .then(res => { + this.checkList = res.data || []; + }) + .finally(() => { + this.loading = false; + }); }, tongbu() { - this.$modal.loading("姝e湪鍚屾锛岃绋嶅��..."); - this.setTime(); const requestData = { - lis: this.selectedFirstTable ? this.selectedFirstTable.map((item) => ({ - ...item, - tjNum: this.queryParams.tjNum, - })) : [], - jcxmid: this.selectedFirstTable && this.selectedFirstTable.length > 0 ? this.selectedFirstTable[0].jcxmid : null, - shys: this.selectedFirstTable && this.selectedFirstTable.length > 0 ? this.selectedFirstTable[0].shys : null, + lis: this.selectedFirstTable, tj: this.selectedSecondTable[0], }; - asyncPacs(requestData) - .then((res) => { - if (res.code === 200) { - this.fetchRightTableData(); - clearInterval(this.clearTimeSet); - this.clearTimeSet = null; - this.$modal.closeLoading(); - this.$modal.msgSuccess("鍚屾鎴愬姛锛�"); - } else { - this.$message.error(res.message || "鍚屾澶辫触锛岃绋嶅悗閲嶈瘯"); - } - }) - .catch((error) => { - clearInterval(this.clearTimeSet); - this.clearTimeSet = null; - this.$modal.closeLoading(); - }); + asyncPacs(requestData).then(res => { + if (res.code === 200) { + this.$message.success("鍚屾鎴愬姛锛�"); + this.fetchRightTableData(); + } else { + this.$message.error(res.message || "鍚屾澶辫触"); + } + }); }, }, -};</script> +}; +</script> + <style lang="scss" scoped> .app-container { padding: 20px; background: #f5f7fa; } - .table-header { text-align: center; background-color: #aad8df; @@ -430,13 +301,11 @@ margin-top: 10px; border-radius: 4px 4px 0 0; } - .table-title { text-align: left; margin: 20px 0; padding: 10px 0; } - .table-title h3 { font-size: 16px; color: #333; @@ -447,27 +316,12 @@ flex-wrap: wrap; gap: 20px; } - .table-title .highlight { font-weight: bold; color: #2c3e50; } - .el-table { border-radius: 4px; font-size: 14px; } - -.el-table .warning-row { - background: #e5f3ff !important; -} - -::v-deep .el-table__body tr.current-row > td { - background: #edf2fa !important; -} - -.row-disabled { - color: #999; - background-color: #f5f5f5; -} -</style> \ No newline at end of file +</style> diff --git a/src/views/hosp/project/index.vue b/src/views/hosp/project/index.vue index c97fa3f..f9a55f2 100644 --- a/src/views/hosp/project/index.vue +++ b/src/views/hosp/project/index.vue @@ -1,5 +1,5 @@ <template> - <div class="app-container"> + <div class="app-container" v-loading="pageLoading"> <el-row :gutter="20"> <el-col :span="4" :xs="24"> <div class="head-container"> @@ -12,7 +12,7 @@ style="margin-bottom: 15px" /> </div> - <div class="scrollable-container"> + <div class="scrollable-container" v-loading="loadings"> <div class="content"> <el-tree :data="deptOptions" @@ -25,7 +25,6 @@ highlight-current @node-click="handleNodeClick" :render-content="renderContent" - v-loading="loadings" /> </div> </div> @@ -87,6 +86,7 @@ icon="el-icon-plus" size="mini" @click="handleUpdate1" + :loading="updateLoading" v-hasPermi="['hosp:project:add']" >淇敼</el-button > @@ -128,6 +128,7 @@ <el-table v-if="refreshTable" v-loading="loading" + style="width: 100%" :data="projectList" ref="tableRef" height="580" @@ -308,6 +309,7 @@ width="1200px" append-to-body :before-close="handleClose" + v-loading="loading" :close-on-click-modal="false" > <el-form @@ -636,10 +638,18 @@ ></el-option> </el-select> </el-form-item> - <el-form-item label="鏄惁澶栭��" prop="proDelivery"> - <el-select v-model="form.proDelivery" placeholder="璇烽�夋嫨鏄惁澶栭��" style="width: 200px"> - <el-option v-for="dict in wsTypesy" :key="dict.value" :label="dict.label" - :value="dict.value"></el-option> + <el-form-item label="鏄惁澶栭��" prop="proDelivery"> + <el-select + v-model="form.proDelivery" + placeholder="璇烽�夋嫨鏄惁澶栭��" + style="width: 200px" + > + <el-option + v-for="dict in wsTypesy" + :key="dict.value" + :label="dict.label" + :value="dict.value" + ></el-option> </el-select> </el-form-item> </el-form> @@ -1012,6 +1022,7 @@ deptOptions: [], dialogTableVisible: false, isPriceDisabled: false, + pageLoading: true, sfxmList: [], deptOptionstree: [], defaultPropstree: { @@ -1028,15 +1039,15 @@ label: "鍚�", }, ], - wsTypesy: [ + wsTypesy: [ { - value:"1", - label:"鏄�" + value: "1", + label: "鏄�", }, { - value:"0", - label:"鍚�" - } + value: "0", + label: "鍚�", + }, ], xmmc: "", chargeId: [], @@ -1046,6 +1057,8 @@ ChangeList: [], loading: true, loadings: false, + addLoading: false, + updateLoading: false, key: "", ids: [], single: true, @@ -1149,6 +1162,8 @@ this.$nextTick(() => { const lastId = newVal[newVal.length - 1] || "532"; const node = this.findNodeById(this.deptOptions, lastId); + this.queryParams.proId = lastId + this.getList() if (node) { this.$refs.tree1.setCurrentKey(lastId); const nodeElement = document.querySelector( @@ -1177,16 +1192,18 @@ }, }, created() { - this.getConsumables(); - this.getDeptList(); + // this.getConsumables(); + // this.getDeptList(); // this.getDeptTree().then(() => { // this.precomputePinyin(); // }); }, mounted() { - this.getDeptTree().then(() => { - this.precomputePinyin(); - }); + // this.getDeptTree().then(() => { + // this.precomputePinyin(); + // }); + // this.precomputePinyin(); + this.loadPage(); }, methods: { debounceFilter: debounce(function (val) { @@ -1209,6 +1226,59 @@ }; traverse(this.deptOptions); }, + + async loadPage() { + this.pageLoading = true; + try { + await Promise.all([ + this.getDeptTree(), // 鑾峰彇宸︿晶鏍� + //this.getList(), 鑾峰彇鍙充晶琛ㄦ牸 + ]); + } catch (error) { + console.error("鍔犺浇椤甸潰鍑洪敊", error); + } finally { + this.pageLoading = false; // 涓や釜閮藉姞杞藉畬鍐嶅叧闂� loading + } + }, + + async getDeptTree() { + this.loadings = true; + try { + const response = await deptTree111(); + this.deptOptions = response.data; + + // 淇濊瘉 treeId 鏄暟缁勬牸寮� + this.treeId = []; + + if (this.treeDate?.id) { + this.treeId.push(this.treeDate.id); + + } else { + this.treeId.push("532"); + } + } catch (error) { + console.error("鍔犺浇閮ㄩ棬鏍戝け璐ワ細", error); + } finally { + this.loadings = false; // loading 鐘舵�佺粨鏉� + } + }, + + async getList() { + this.loading = true; + let data = { + proName: this.queryParams.proName, + checkType: this.queryParams.checkType, + deptId: this.queryParams.deptId, + proId: this.queryParams.proId, + }; + try { + const res = await getAllChildListById(data); // 鏇挎崲鎴愪綘瀹為檯鐨勬帴鍙� + this.projectList = res.data.list; + } finally { + this.loading = false; + } + }, + filterNode(value, data) { if (!value) return true; const cached = this.pinyinCache.get(data.id); @@ -1478,15 +1548,23 @@ }); }, getDeptTree() { - return deptTree111().then((response) => { - this.deptOptions = response.data; - this.treeId = []; - if (this.treeDate.id) { - this.treeId.push(this.treeDate.id); - } else { - this.treeId.push("532"); - } - }); + this.loadings = true; + return deptTree111() + .then((response) => { + this.deptOptions = response.data; + this.treeId = []; + if (this.treeDate.id) { + this.treeId.push(this.treeDate.id); + } else { + this.treeId.push("532"); + } + }) + .catch((err) => { + console.error("鍔犺浇閮ㄩ棬鏍戝け璐ワ細", err); + }) + .finally(() => { + this.loadings = false; // 鏃犺鎴愬姛鎴栧け璐ワ紝缁撴潫鍔犺浇 + }); }, handleNodeClick(date) { this.treeDate = date; @@ -1645,22 +1723,27 @@ } }, handleUpdate1() { + this.updateLoading = true; this.form = {}; this.form = this.xiugaiList; this.form.proStatus = this.form.proStatus.toString(); this.form.sfcyyc = this.form.sfcyyc.toString(); this.proParent = true; this.isPriceDisabled = true; - getlist().then((response) => { - if (response.code == 200) { - this.loading = false; - this.projectOptions = []; - const project = { proId: 0, proName: "涓荤被鐩�", children: [] }; - project.children = this.handleTree(response.data.list, "proId"); - this.key = response.data.key; - this.projectOptions.push(project); - } - }); + getlist() + .then((response) => { + if (response.code == 200) { + this.loading = false; + this.projectOptions = []; + const project = { proId: 0, proName: "涓荤被鐩�", children: [] }; + project.children = this.handleTree(response.data.list, "proId"); + this.key = response.data.key; + this.projectOptions.push(project); + } + }) + .finally(() => { + this.updateLoading = false; + }); this.open = true; }, handleUpdate(row) { @@ -1697,9 +1780,9 @@ }[item.tjType] || item.tjType; }); } - getlist().then((response) => { + getlist().then((response) => { if (response.code == 200) { - this.loading = false; + // this.loading = false; this.projectOptions = []; const project = { proId: 0, proName: "涓荤被鐩�", children: [] }; project.children = this.handleTree(response.data.list, "proId"); @@ -1707,6 +1790,7 @@ this.projectOptions.push(project); } }); + // this.loadPage(); this.open = true; this.title = "浣撴椤圭洰淇℃伅缁存姢"; }); @@ -1726,6 +1810,7 @@ }, submitForm() { this.noclick = true; + this.pageLoading = true; this.$refs["form"].validate((valid) => { if (valid) { const isUpdate = this.form.proId != null; @@ -1752,9 +1837,13 @@ this.form.lisXmbm = this.form.lisXmbm; if (this.key === "N") { this.processSubmission(isUpdate, false); + this.open = false; + // this.pageLoading = false; } else if (this.key === "Y") { this.form.sfxmId = this.sfxmId; this.processSubmission(isUpdate, true); + this.open = false; + // this.pageLoading = false; } } }); @@ -1787,16 +1876,30 @@ } } }, - handleSuccess(isY) { + /* handleSuccess(isY) { this.cancel(); - this.getList(); + // this.getList(); if (this.proParent || isY) { this.getDeptTree().then(() => { this.precomputePinyin(); }); } console.log(this.treeId); - }, + }, */ + async handleSuccess(isY) { + this.cancel(); + + if (this.proParent || isY) { + // 绛夊緟宸︿晶鏍戝姞杞藉拰鎷奸煶澶勭悊 + await this.getDeptTree(); + this.precomputePinyin(); + } + + // 绛夊緟鍙充晶琛ㄦ牸鍒锋柊 + await this.getList(); + + this.pageLoading = false; // 鉁� 缁熶竴鍔犺浇鐘舵�佹帶鍒� +}, submit() { this.ChangeList.forEach((item) => { this.form.proPrice = item.ckdj; diff --git a/src/views/reservation/reservations/index.vue b/src/views/reservation/reservations/index.vue index 5864b46..b99dc91 100644 --- a/src/views/reservation/reservations/index.vue +++ b/src/views/reservation/reservations/index.vue @@ -1389,10 +1389,10 @@ style="width: 160px" /> </el-form-item> - <el-form-item label="鍗曚綅鍚嶇О" prop="company"> + <el-form-item label="鍗曚綅鍚嶇О" prop="companyId"> <el-select :remote-method="getRemoteData" - v-model="formIn.company" + v-model="formIn.companyId" remote default-first-option allow-create @@ -2121,7 +2121,7 @@ cusSex: null, cusBrithday: null, cusAddr: null, - cusPhone: null, + phone: null, yykssj: "", // 棰勭害寮�濮嬫椂闂� yyjssj: "", // 棰勭害缁撴潫鏃堕棿 cusPostcode: null, @@ -2235,7 +2235,7 @@ // cusAddr: [ // { required: true, message: "鐜板眳浣忓湴鍧�涓嶈兘涓虹┖", trigger: "blur" }, // ], - cusPhone: [ + phone: [ { required: true, validator: checkPhoneNum, trigger: "blur" }, ], reservationTime: [ @@ -2575,7 +2575,7 @@ cusSex: null, cusBrithday: null, cusAddr: null, - cusPhone: null, + phone: null, yykssj: "", // 棰勭害寮�濮嬫椂闂� yyjssj: "", // 棰勭害缁撴潫鏃堕棿 cusPostcode: null, @@ -3169,7 +3169,7 @@ name: this.formIn.name, nation: this.formIn.nation, pacId, - phoe: this.formIn.cusPhone, + phoe: this.formIn.phoe, reservationTime: this.formIn.reservationTime, sex: this.formIn.sex, timeRegion: this.formIn.timeRegion, @@ -3210,8 +3210,10 @@ }; } tjReappoint(data).then((res) => { + console.log("鎺ュ彛鍝嶅簲", res); if (res.code === 200) { this.$modal.msgSuccess("棰勭害鎴愬姛"); + Object.assign(this.formIn, data); this.getList(); this.$tab.refreshPage(); _this.drawer = false; diff --git a/vue.config.js b/vue.config.js index 1759202..20a8dd3 100644 --- a/vue.config.js +++ b/vue.config.js @@ -54,8 +54,8 @@ [process.env.VUE_APP_BASE_API]: { // target: `https://ltpeis.xaltjdkj.cn:5801/`, // target: `http://192.168.1.99:5012`, - target: `http://192.168.1.113:5011`, - // target: `http://192.168.1.244:5011`, + // target: `http://192.168.1.113:5011`, + target: `http://192.168.1.244:5011`, // // target: `http://192.168.0.99:8080/ltkj-admin`, // target: `https://ltpeis.xaltjdkj.cn:5011/ltkj-admin`, // target: `http://10.168.0.9:5011`, -- Gitblit v1.8.0