From 2f8a257efd2b64dc40666b0d332edb7824a9768d Mon Sep 17 00:00:00 2001 From: RuoYi <yzz_ivy@163.com> Date: 星期日, 27 四月 2025 09:58:29 +0800 Subject: [PATCH] remove all semicolons --- src/views/tool/gen/createTable.vue | 26 src/views/system/user/profile/userAvatar.vue | 68 src/layout/index.vue | 20 src/components/Screenfull/index.vue | 2 src/views/system/user/authRole.vue | 76 src/views/monitor/logininfor/index.vue | 94 src/views/monitor/operlog/index.vue | 92 src/views/tool/build/DraggableItem.vue | 2 src/views/register.vue | 52 src/layout/components/InnerLink/index.vue | 4 src/layout/components/Sidebar/Logo.vue | 18 src/views/system/role/authUser.vue | 74 src/views/monitor/job/log.vue | 94 vite.config.js | 3 src/components/ImageUpload/index.vue | 128 src/views/monitor/cache/index.vue | 32 src/views/system/post/index.vue | 110 src/components/SvgIcon/svgicon.js | 14 src/views/system/user/profile/index.vue | 24 src/views/tool/gen/basicInfoForm.vue | 4 src/components/SizeSelect/index.vue | 20 src/router/index.js | 4 src/components/Pagination/index.vue | 5 src/plugins/modal.js | 6 src/components/Hamburger/index.vue | 2 src/views/tool/gen/index.vue | 136 src/layout/components/TagsView/ScrollPane.vue | 18 src/components/TopNav/index.vue | 89 src/directive/permission/hasPermi.js | 2 src/views/system/notice/index.vue | 106 src/utils/index.js | 2 src/components/FileUpload/index.vue | 114 src/components/ImagePreview/index.vue | 34 src/layout/components/Settings/index.vue | 36 src/views/system/dict/index.vue | 120 src/views/system/config/index.vue | 118 src/views/system/role/index.vue | 276 +- src/directive/common/copyText.js | 56 src/views/monitor/druid/index.vue | 4 src/components/Crontab/hour.vue | 4 src/views/monitor/cache/list.vue | 74 src/layout/components/Navbar.vue | 16 src/utils/ruoyi.js | 110 src/components/Crontab/result.vue | 374 ++-- src/components/Editor/index.vue | 94 src/components/RuoYi/Git/index.vue | 2 src/views/monitor/server/index.vue | 14 src/views/system/menu/index.vue | 128 src/utils/dynamicTitle.js | 6 src/views/redirect/index.vue | 4 src/views/error/401.vue | 10 src/plugins/tab.js | 28 src/views/system/dict/data.vue | 148 +- src/views/system/role/selectUser.vue | 62 src/views/tool/gen/editTable.vue | 72 src/layout/components/Sidebar/index.vue | 32 src/views/tool/gen/importTable.vue | 54 src/store/modules/app.js | 4 src/layout/components/Sidebar/SidebarItem.vue | 12 src/utils/dict.js | 12 src/views/monitor/job/index.vue | 164 +- src/components/DictTag/index.vue | 20 src/views/system/dept/index.vue | 110 src/store/modules/permission.js | 6 src/layout/components/TagsView/index.vue | 40 src/views/monitor/online/index.vue | 44 src/utils/permission.js | 4 src/utils/request.js | 60 src/components/IconSelect/index.vue | 8 src/views/system/user/index.vue | 282 +- src/plugins/cache.js | 4 src/store/modules/dict.js | 20 src/views/login.vue | 86 src/views/tool/gen/genInfoForm.vue | 39 src/layout/components/IframeToggle/index.vue | 14 src/views/system/user/profile/userInfo.vue | 30 src/components/iFrame/index.vue | 8 src/views/system/user/profile/resetPwd.vue | 26 src/directive/permission/hasRole.js | 2 src/plugins/download.js | 28 src/components/RuoYi/Doc/index.vue | 2 src/components/IconSelect/requireIcons.js | 6 src/plugins/auth.js | 8 83 files changed, 2,178 insertions(+), 2,178 deletions(-) diff --git a/src/components/Crontab/hour.vue b/src/components/Crontab/hour.vue index 23e6d50..d05779e 100644 --- a/src/components/Crontab/hour.vue +++ b/src/components/Crontab/hour.vue @@ -78,10 +78,10 @@ watch([radioValue, cycleTotal, averageTotal, checkboxString], () => onRadioChange()) function changeRadioValue(value) { if (props.cron.min === '*') { - emit('update', 'min', '0', 'hour'); + emit('update', 'min', '0', 'hour') } if (props.cron.second === '*') { - emit('update', 'second', '0', 'hour'); + emit('update', 'second', '0', 'hour') } if (value === '*') { radioValue.value = 1 diff --git a/src/components/Crontab/result.vue b/src/components/Crontab/result.vue index 271577e..b260d59 100644 --- a/src/components/Crontab/result.vue +++ b/src/components/Crontab/result.vue @@ -26,289 +26,289 @@ // 琛ㄨ揪寮忓�煎彉鍖栨椂锛屽紑濮嬪幓璁$畻缁撴灉 function expressionChange() { // 璁$畻寮�濮�-闅愯棌缁撴灉 - isShow.value = false; + isShow.value = false // 鑾峰彇瑙勫垯鏁扮粍[0绉掋��1鍒嗐��2鏃躲��3鏃ャ��4鏈堛��5鏄熸湡銆�6骞碷 - let ruleArr = props.ex.split(' '); + let ruleArr = props.ex.split(' ') // 鐢ㄤ簬璁板綍杩涘叆寰幆鐨勬鏁� - let nums = 0; + let nums = 0 // 鐢ㄤ簬鏆傛椂瀛樼鍙锋椂闂磋鍒欑粨鏋滅殑鏁扮粍 - let resultArr = []; + let resultArr = [] // 鑾峰彇褰撳墠鏃堕棿绮剧‘鑷砙骞淬�佹湀銆佹棩銆佹椂銆佸垎銆佺] - let nTime = new Date(); - let nYear = nTime.getFullYear(); - let nMonth = nTime.getMonth() + 1; - let nDay = nTime.getDate(); - let nHour = nTime.getHours(); - let nMin = nTime.getMinutes(); - let nSecond = nTime.getSeconds(); + let nTime = new Date() + let nYear = nTime.getFullYear() + let nMonth = nTime.getMonth() + 1 + let nDay = nTime.getDate() + let nHour = nTime.getHours() + let nMin = nTime.getMinutes() + let nSecond = nTime.getSeconds() // 鏍规嵁瑙勫垯鑾峰彇鍒拌繎100骞村彲鑳藉勾鏁扮粍銆佹湀鏁扮粍绛夌瓑 - getSecondArr(ruleArr[0]); - getMinArr(ruleArr[1]); - getHourArr(ruleArr[2]); - getDayArr(ruleArr[3]); - getMonthArr(ruleArr[4]); - getWeekArr(ruleArr[5]); - getYearArr(ruleArr[6], nYear); + getSecondArr(ruleArr[0]) + getMinArr(ruleArr[1]) + getHourArr(ruleArr[2]) + getDayArr(ruleArr[3]) + getMonthArr(ruleArr[4]) + getWeekArr(ruleArr[5]) + getYearArr(ruleArr[6], nYear) // 灏嗚幏鍙栧埌鐨勬暟缁勮祴鍊�-鏂逛究浣跨敤 - let sDate = dateArr.value[0]; - let mDate = dateArr.value[1]; - let hDate = dateArr.value[2]; - let DDate = dateArr.value[3]; - let MDate = dateArr.value[4]; - let YDate = dateArr.value[5]; + let sDate = dateArr.value[0] + let mDate = dateArr.value[1] + let hDate = dateArr.value[2] + let DDate = dateArr.value[3] + let MDate = dateArr.value[4] + let YDate = dateArr.value[5] // 鑾峰彇褰撳墠鏃堕棿鍦ㄦ暟缁勪腑鐨勭储寮� - let sIdx = getIndex(sDate, nSecond); - let mIdx = getIndex(mDate, nMin); - let hIdx = getIndex(hDate, nHour); - let DIdx = getIndex(DDate, nDay); - let MIdx = getIndex(MDate, nMonth); - let YIdx = getIndex(YDate, nYear); + let sIdx = getIndex(sDate, nSecond) + let mIdx = getIndex(mDate, nMin) + let hIdx = getIndex(hDate, nHour) + let DIdx = getIndex(DDate, nDay) + let MIdx = getIndex(MDate, nMonth) + let YIdx = getIndex(YDate, nYear) // 閲嶇疆鏈堟棩鏃跺垎绉掔殑鍑芥暟(鍚庨潰鐢ㄧ殑姣旇緝澶�) const resetSecond = function () { - sIdx = 0; + sIdx = 0 nSecond = sDate[sIdx] } const resetMin = function () { - mIdx = 0; + mIdx = 0 nMin = mDate[mIdx] - resetSecond(); + resetSecond() } const resetHour = function () { - hIdx = 0; + hIdx = 0 nHour = hDate[hIdx] - resetMin(); + resetMin() } const resetDay = function () { - DIdx = 0; + DIdx = 0 nDay = DDate[DIdx] - resetHour(); + resetHour() } const resetMonth = function () { - MIdx = 0; + MIdx = 0 nMonth = MDate[MIdx] - resetDay(); + resetDay() } // 濡傛灉褰撳墠骞翠唤涓嶄负鏁扮粍涓綋鍓嶅�� if (nYear !== YDate[YIdx]) { - resetMonth(); + resetMonth() } // 濡傛灉褰撳墠鏈堜唤涓嶄负鏁扮粍涓綋鍓嶅�� if (nMonth !== MDate[MIdx]) { - resetDay(); + resetDay() } // 濡傛灉褰撳墠鈥滄棩鈥濅笉涓烘暟缁勪腑褰撳墠鍊� if (nDay !== DDate[DIdx]) { - resetHour(); + resetHour() } // 濡傛灉褰撳墠鈥滄椂鈥濅笉涓烘暟缁勪腑褰撳墠鍊� if (nHour !== hDate[hIdx]) { - resetMin(); + resetMin() } // 濡傛灉褰撳墠鈥滃垎鈥濅笉涓烘暟缁勪腑褰撳墠鍊� if (nMin !== mDate[mIdx]) { - resetSecond(); + resetSecond() } // 寰幆骞翠唤鏁扮粍 goYear: for (let Yi = YIdx; Yi < YDate.length; Yi++) { - let YY = YDate[Yi]; + let YY = YDate[Yi] // 濡傛灉鍒拌揪鏈�澶у�兼椂 if (nMonth > MDate[MDate.length - 1]) { - resetMonth(); - continue; + resetMonth() + continue } // 寰幆鏈堜唤鏁扮粍 goMonth: for (let Mi = MIdx; Mi < MDate.length; Mi++) { // 璧嬪�笺�佹柟渚垮悗闈㈣繍绠� let MM = MDate[Mi]; - MM = MM < 10 ? '0' + MM : MM; + MM = MM < 10 ? '0' + MM : MM // 濡傛灉鍒拌揪鏈�澶у�兼椂 if (nDay > DDate[DDate.length - 1]) { - resetDay(); + resetDay() if (Mi === MDate.length - 1) { - resetMonth(); - continue goYear; + resetMonth() + continue goYear } - continue; + continue } // 寰幆鏃ユ湡鏁扮粍 goDay: for (let Di = DIdx; Di < DDate.length; Di++) { // 璧嬪�笺�佹柟渚垮悗闈㈣繍绠� - let DD = DDate[Di]; - let thisDD = DD < 10 ? '0' + DD : DD; + let DD = DDate[Di] + let thisDD = DD < 10 ? '0' + DD : DD // 濡傛灉鍒拌揪鏈�澶у�兼椂 if (nHour > hDate[hDate.length - 1]) { - resetHour(); + resetHour() if (Di === DDate.length - 1) { - resetDay(); + resetDay() if (Mi === MDate.length - 1) { - resetMonth(); - continue goYear; + resetMonth() + continue goYear } - continue goMonth; + continue goMonth } - continue; + continue } // 鍒ゆ柇鏃ユ湡鐨勫悎娉曟�э紝涓嶅悎娉曠殑璇濅篃鏄烦鍑哄綋鍓嶅惊鐜� if (checkDate(YY + '-' + MM + '-' + thisDD + ' 00:00:00') !== true && dayRule.value !== 'workDay' && dayRule.value !== 'lastWeek' && dayRule.value !== 'lastDay') { - resetDay(); - continue goMonth; + resetDay() + continue goMonth } // 濡傛灉鏃ユ湡瑙勫垯涓湁鍊兼椂 if (dayRule.value === 'lastDay') { // 濡傛灉涓嶆槸鍚堟硶鏃ユ湡鍒欓渶瑕佸皢鍓嶅皢鏃ユ湡璋冨埌鍚堟硶鏃ユ湡鍗虫湀鏈渶鍚庝竴澶� if (checkDate(YY + '-' + MM + '-' + thisDD + ' 00:00:00') !== true) { while (DD > 0 && checkDate(YY + '-' + MM + '-' + thisDD + ' 00:00:00') !== true) { - DD--; - thisDD = DD < 10 ? '0' + DD : DD; + DD-- + thisDD = DD < 10 ? '0' + DD : DD } } } else if (dayRule.value === 'workDay') { // 鏍¢獙骞惰皟鏁村鏋滄槸2鏈�30鍙疯繖绉嶆棩鏈熶紶杩涙潵鏃堕渶璋冩暣鑷虫甯告湀搴� if (checkDate(YY + '-' + MM + '-' + thisDD + ' 00:00:00') !== true) { while (DD > 0 && checkDate(YY + '-' + MM + '-' + thisDD + ' 00:00:00') !== true) { - DD--; - thisDD = DD < 10 ? '0' + DD : DD; + DD-- + thisDD = DD < 10 ? '0' + DD : DD } } // 鑾峰彇杈惧埌鏉′欢鐨勬棩鏈熸槸鏄熸湡X - let thisWeek = formatDate(new Date(YY + '-' + MM + '-' + thisDD + ' 00:00:00'), 'week'); + let thisWeek = formatDate(new Date(YY + '-' + MM + '-' + thisDD + ' 00:00:00'), 'week') // 褰撴槦鏈熸棩鏃� if (thisWeek === 1) { // 鍏堟壘涓嬩竴涓棩锛屽苟鍒ゆ柇鏄惁涓烘湀搴� - DD++; - thisDD = DD < 10 ? '0' + DD : DD; + DD++ + thisDD = DD < 10 ? '0' + DD : DD // 鍒ゆ柇涓嬩竴鏃ュ凡缁忎笉鏄悎娉曟棩鏈� if (checkDate(YY + '-' + MM + '-' + thisDD + ' 00:00:00') !== true) { - DD -= 3; + DD -= 3 } } else if (thisWeek === 7) { // 褰撴槦鏈�6鏃跺彧闇�鍒ゆ柇涓嶆槸1鍙峰氨鍙繘琛屾搷浣� if (dayRuleSup.value !== 1) { - DD--; + DD-- } else { - DD += 2; + DD += 2 } } } else if (dayRule.value === 'weekDay') { // 濡傛灉鎸囧畾浜嗘槸鏄熸湡鍑� // 鑾峰彇褰撳墠鏃ユ湡鏄睘浜庢槦鏈熷嚑 - let thisWeek = formatDate(new Date(YY + '-' + MM + '-' + DD + ' 00:00:00'), 'week'); + let thisWeek = formatDate(new Date(YY + '-' + MM + '-' + DD + ' 00:00:00'), 'week') // 鏍¢獙褰撳墠鏄熸湡鏄惁鍦ㄦ槦鏈熸睜锛坉ayRuleSup锛変腑 if (dayRuleSup.value.indexOf(thisWeek) < 0) { // 濡傛灉鍒拌揪鏈�澶у�兼椂 if (Di === DDate.length - 1) { - resetDay(); + resetDay() if (Mi === MDate.length - 1) { - resetMonth(); - continue goYear; + resetMonth() + continue goYear } - continue goMonth; + continue goMonth } - continue; + continue } } else if (dayRule.value === 'assWeek') { // 濡傛灉鎸囧畾浜嗘槸绗嚑鍛ㄧ殑鏄熸湡鍑� // 鑾峰彇姣忔湀1鍙锋槸灞炰簬鏄熸湡鍑� - let thisWeek = formatDate(new Date(YY + '-' + MM + '-' + DD + ' 00:00:00'), 'week'); + let thisWeek = formatDate(new Date(YY + '-' + MM + '-' + DD + ' 00:00:00'), 'week') if (dayRuleSup.value[1] >= thisWeek) { - DD = (dayRuleSup.value[0] - 1) * 7 + dayRuleSup.value[1] - thisWeek + 1; + DD = (dayRuleSup.value[0] - 1) * 7 + dayRuleSup.value[1] - thisWeek + 1 } else { - DD = dayRuleSup.value[0] * 7 + dayRuleSup.value[1] - thisWeek + 1; + DD = dayRuleSup.value[0] * 7 + dayRuleSup.value[1] - thisWeek + 1 } } else if (dayRule.value === 'lastWeek') { // 濡傛灉鎸囧畾浜嗘瘡鏈堟渶鍚庝竴涓槦鏈熷嚑 // 鏍¢獙骞惰皟鏁村鏋滄槸2鏈�30鍙疯繖绉嶆棩鏈熶紶杩涙潵鏃堕渶璋冩暣鑷虫甯告湀搴� if (checkDate(YY + '-' + MM + '-' + thisDD + ' 00:00:00') !== true) { while (DD > 0 && checkDate(YY + '-' + MM + '-' + thisDD + ' 00:00:00') !== true) { - DD--; - thisDD = DD < 10 ? '0' + DD : DD; + DD-- + thisDD = DD < 10 ? '0' + DD : DD } } // 鑾峰彇鏈堟湯鏈�鍚庝竴澶╂槸鏄熸湡鍑� - let thisWeek = formatDate(new Date(YY + '-' + MM + '-' + thisDD + ' 00:00:00'), 'week'); + let thisWeek = formatDate(new Date(YY + '-' + MM + '-' + thisDD + ' 00:00:00'), 'week') // 鎵惧埌瑕佹眰涓渶杩戠殑閭d釜鏄熸湡鍑� if (dayRuleSup.value < thisWeek) { - DD -= thisWeek - dayRuleSup.value; + DD -= thisWeek - dayRuleSup.value } else if (dayRuleSup.value > thisWeek) { DD -= 7 - (dayRuleSup.value - thisWeek) } } // 鍒ゆ柇鏃堕棿鍊兼槸鍚﹀皬浜�10缃崲鎴愨��05鈥濊繖绉嶆牸寮� - DD = DD < 10 ? '0' + DD : DD; + DD = DD < 10 ? '0' + DD : DD // 寰幆鈥滄椂鈥濇暟缁� goHour: for (let hi = hIdx; hi < hDate.length; hi++) { let hh = hDate[hi] < 10 ? '0' + hDate[hi] : hDate[hi] // 濡傛灉鍒拌揪鏈�澶у�兼椂 if (nMin > mDate[mDate.length - 1]) { - resetMin(); + resetMin() if (hi === hDate.length - 1) { - resetHour(); + resetHour() if (Di === DDate.length - 1) { - resetDay(); + resetDay() if (Mi === MDate.length - 1) { - resetMonth(); - continue goYear; + resetMonth() + continue goYear } - continue goMonth; + continue goMonth } - continue goDay; + continue goDay } - continue; + continue } // 寰幆"鍒�"鏁扮粍 goMin: for (let mi = mIdx; mi < mDate.length; mi++) { - let mm = mDate[mi] < 10 ? '0' + mDate[mi] : mDate[mi]; + let mm = mDate[mi] < 10 ? '0' + mDate[mi] : mDate[mi] // 濡傛灉鍒拌揪鏈�澶у�兼椂 if (nSecond > sDate[sDate.length - 1]) { - resetSecond(); + resetSecond() if (mi === mDate.length - 1) { - resetMin(); + resetMin() if (hi === hDate.length - 1) { - resetHour(); + resetHour() if (Di === DDate.length - 1) { - resetDay(); + resetDay() if (Mi === MDate.length - 1) { - resetMonth(); - continue goYear; + resetMonth() + continue goYear } - continue goMonth; + continue goMonth } - continue goDay; + continue goDay } - continue goHour; + continue goHour } - continue; + continue } // 寰幆"绉�"鏁扮粍 goSecond: for (let si = sIdx; si <= sDate.length - 1; si++) { - let ss = sDate[si] < 10 ? '0' + sDate[si] : sDate[si]; + let ss = sDate[si] < 10 ? '0' + sDate[si] : sDate[si] // 娣诲姞褰撳墠鏃堕棿锛堟椂闂村悎娉曟�у湪鏃ユ湡寰幆鏃跺凡缁忓垽鏂級 if (MM !== '00' && DD !== '00') { resultArr.push(YY + '-' + MM + '-' + DD + ' ' + hh + ':' + mm + ':' + ss) - nums++; + nums++ } // 濡傛灉鏉℃暟婊′簡灏遍��鍑哄惊鐜� - if (nums === 5) break goYear; + if (nums === 5) break goYear // 濡傛灉鍒拌揪鏈�澶у�兼椂 if (si === sDate.length - 1) { - resetSecond(); + resetSecond() if (mi === mDate.length - 1) { - resetMin(); + resetMin() if (hi === hDate.length - 1) { - resetHour(); + resetHour() if (Di === DDate.length - 1) { - resetDay(); + resetDay() if (Mi === MDate.length - 1) { - resetMonth(); - continue goYear; + resetMonth() + continue goYear } - continue goMonth; + continue goMonth } - continue goDay; + continue goDay } - continue goHour; + continue goHour } - continue goMin; + continue goMin } } //goSecond } //goMin @@ -318,31 +318,31 @@ } // 鍒ゆ柇100骞村唴鐨勭粨鏋滄潯鏁� if (resultArr.length === 0) { - resultList.value = ['娌℃湁杈惧埌鏉′欢鐨勭粨鏋滐紒']; + resultList.value = ['娌℃湁杈惧埌鏉′欢鐨勭粨鏋滐紒'] } else { - resultList.value = resultArr; + resultList.value = resultArr if (resultArr.length !== 5) { resultList.value.push('鏈�杩�100骞村唴鍙湁涓婇潰' + resultArr.length + '鏉$粨鏋滐紒') } } // 璁$畻瀹屾垚-鏄剧ず缁撴灉 - isShow.value = true; + isShow.value = true } // 鐢ㄤ簬璁$畻鏌愪綅鏁板瓧鍦ㄦ暟缁勪腑鐨勭储寮� function getIndex(arr, value) { if (value <= arr[0] || value > arr[arr.length - 1]) { - return 0; + return 0 } else { for (let i = 0; i < arr.length - 1; i++) { if (value > arr[i] && value <= arr[i + 1]) { - return i + 1; + return i + 1 } } } } // 鑾峰彇"骞�"鏁扮粍 function getYearArr(rule, year) { - dateArr.value[5] = getOrderArr(year, year + 100); + dateArr.value[5] = getOrderArr(year, year + 100) if (rule !== undefined) { if (rule.indexOf('-') >= 0) { dateArr.value[5] = getCycleArr(rule, year + 100, false) @@ -355,7 +355,7 @@ } // 鑾峰彇"鏈�"鏁扮粍 function getMonthArr(rule) { - dateArr.value[4] = getOrderArr(1, 12); + dateArr.value[4] = getOrderArr(1, 12) if (rule.indexOf('-') >= 0) { dateArr.value[4] = getCycleArr(rule, 12, false) } else if (rule.indexOf('/') >= 0) { @@ -369,58 +369,58 @@ // 鍙湁褰撴棩鏈熻鍒欑殑涓や釜鍊煎潎涓衡�溾�濇椂鍒欒〃杈炬棩鏈熸槸鏈夐�夐」鐨� if (dayRule.value === '' && dayRuleSup.value === '') { if (rule.indexOf('-') >= 0) { - dayRule.value = 'weekDay'; + dayRule.value = 'weekDay' dayRuleSup.value = getCycleArr(rule, 7, false) } else if (rule.indexOf('#') >= 0) { - dayRule.value = 'assWeek'; - let matchRule = rule.match(/[0-9]{1}/g); - dayRuleSup.value = [Number(matchRule[1]), Number(matchRule[0])]; - dateArr.value[3] = [1]; + dayRule.value = 'assWeek' + let matchRule = rule.match(/[0-9]{1}/g) + dayRuleSup.value = [Number(matchRule[1]), Number(matchRule[0])] + dateArr.value[3] = [1] if (dayRuleSup.value[1] === 7) { - dayRuleSup.value[1] = 0; + dayRuleSup.value[1] = 0 } } else if (rule.indexOf('L') >= 0) { - dayRule.value = 'lastWeek'; - dayRuleSup.value = Number(rule.match(/[0-9]{1,2}/g)[0]); - dateArr.value[3] = [31]; + dayRule.value = 'lastWeek' + dayRuleSup.value = Number(rule.match(/[0-9]{1,2}/g)[0]) + dateArr.value[3] = [31] if (dayRuleSup.value === 7) { - dayRuleSup.value = 0; + dayRuleSup.value = 0 } } else if (rule !== '*' && rule !== '?') { - dayRule.value = 'weekDay'; + dayRule.value = 'weekDay' dayRuleSup.value = getAssignArr(rule) } } } // 鑾峰彇"鏃�"鏁扮粍-灏戦噺涓烘棩鏈熻鍒� function getDayArr(rule) { - dateArr.value[3] = getOrderArr(1, 31); - dayRule.value = ''; - dayRuleSup.value = ''; + dateArr.value[3] = getOrderArr(1, 31) + dayRule.value = '' + dayRuleSup.value = '' if (rule.indexOf('-') >= 0) { dateArr.value[3] = getCycleArr(rule, 31, false) - dayRuleSup.value = 'null'; + dayRuleSup.value = 'null' } else if (rule.indexOf('/') >= 0) { dateArr.value[3] = getAverageArr(rule, 31) - dayRuleSup.value = 'null'; + dayRuleSup.value = 'null' } else if (rule.indexOf('W') >= 0) { - dayRule.value = 'workDay'; - dayRuleSup.value = Number(rule.match(/[0-9]{1,2}/g)[0]); - dateArr.value[3] = [dayRuleSup.value]; + dayRule.value = 'workDay' + dayRuleSup.value = Number(rule.match(/[0-9]{1,2}/g)[0]) + dateArr.value[3] = [dayRuleSup.value] } else if (rule.indexOf('L') >= 0) { - dayRule.value = 'lastDay'; - dayRuleSup.value = 'null'; - dateArr.value[3] = [31]; + dayRule.value = 'lastDay' + dayRuleSup.value = 'null' + dateArr.value[3] = [31] } else if (rule !== '*' && rule !== '?') { dateArr.value[3] = getAssignArr(rule) - dayRuleSup.value = 'null'; + dayRuleSup.value = 'null' } else if (rule === '*') { - dayRuleSup.value = 'null'; + dayRuleSup.value = 'null' } } // 鑾峰彇"鏃�"鏁扮粍 function getHourArr(rule) { - dateArr.value[2] = getOrderArr(0, 23); + dateArr.value[2] = getOrderArr(0, 23) if (rule.indexOf('-') >= 0) { dateArr.value[2] = getCycleArr(rule, 24, true) } else if (rule.indexOf('/') >= 0) { @@ -431,7 +431,7 @@ } // 鑾峰彇"鍒�"鏁扮粍 function getMinArr(rule) { - dateArr.value[1] = getOrderArr(0, 59); + dateArr.value[1] = getOrderArr(0, 59) if (rule.indexOf('-') >= 0) { dateArr.value[1] = getCycleArr(rule, 60, true) } else if (rule.indexOf('/') >= 0) { @@ -442,7 +442,7 @@ } // 鑾峰彇"绉�"鏁扮粍 function getSecondArr(rule) { - dateArr.value[0] = getOrderArr(0, 59); + dateArr.value[0] = getOrderArr(0, 59) if (rule.indexOf('-') >= 0) { dateArr.value[0] = getCycleArr(rule, 60, true) } else if (rule.indexOf('/') >= 0) { @@ -453,86 +453,86 @@ } // 鏍规嵁浼犺繘鏉ョ殑min-max杩斿洖涓�涓『搴忕殑鏁扮粍 function getOrderArr(min, max) { - let arr = []; + let arr = [] for (let i = min; i <= max; i++) { - arr.push(i); + arr.push(i) } - return arr; + return arr } // 鏍规嵁瑙勫垯涓寚瀹氱殑闆舵暎鍊艰繑鍥炰竴涓暟缁� function getAssignArr(rule) { - let arr = []; - let assiginArr = rule.split(','); + let arr = [] + let assiginArr = rule.split(',') for (let i = 0; i < assiginArr.length; i++) { arr[i] = Number(assiginArr[i]) } arr.sort(compare) - return arr; + return arr } // 鏍规嵁涓�瀹氱畻鏈鍒欒绠楄繑鍥炰竴涓暟缁� function getAverageArr(rule, limit) { - let arr = []; - let agArr = rule.split('/'); - let min = Number(agArr[0]); - let step = Number(agArr[1]); + let arr = [] + let agArr = rule.split('/') + let min = Number(agArr[0]) + let step = Number(agArr[1]) while (min <= limit) { - arr.push(min); - min += step; + arr.push(min) + min += step } - return arr; + return arr } // 鏍规嵁瑙勫垯杩斿洖涓�涓叿鏈夊懆鏈熸�х殑鏁扮粍 function getCycleArr(rule, limit, status) { // status--琛ㄧず鏄惁浠�0寮�濮嬶紙鍒欎粠1寮�濮嬶級 - let arr = []; - let cycleArr = rule.split('-'); - let min = Number(cycleArr[0]); - let max = Number(cycleArr[1]); + let arr = [] + let cycleArr = rule.split('-') + let min = Number(cycleArr[0]) + let max = Number(cycleArr[1]) if (min > max) { - max += limit; + max += limit } for (let i = min; i <= max; i++) { - let add = 0; + let add = 0 if (status === false && i % limit === 0) { - add = limit; + add = limit } arr.push(Math.round(i % limit + add)) } arr.sort(compare) - return arr; + return arr } // 姣旇緝鏁板瓧澶у皬锛堢敤浜嶢rray.sort锛� function compare(value1, value2) { if (value2 - value1 > 0) { - return -1; + return -1 } else { - return 1; + return 1 } } // 鏍煎紡鍖栨棩鏈熸牸寮忓锛�2017-9-19 18:04:33 function formatDate(value, type) { // 璁$畻鏃ユ湡鐩稿叧鍊� - let time = typeof value == 'number' ? new Date(value) : value; - let Y = time.getFullYear(); - let M = time.getMonth() + 1; - let D = time.getDate(); - let h = time.getHours(); - let m = time.getMinutes(); - let s = time.getSeconds(); - let week = time.getDay(); + let time = typeof value == 'number' ? new Date(value) : value + let Y = time.getFullYear() + let M = time.getMonth() + 1 + let D = time.getDate() + let h = time.getHours() + let m = time.getMinutes() + let s = time.getSeconds() + let week = time.getDay() // 濡傛灉浼犻�掍簡type鐨勮瘽 if (type === undefined) { - return Y + '-' + (M < 10 ? '0' + M : M) + '-' + (D < 10 ? '0' + D : D) + ' ' + (h < 10 ? '0' + h : h) + ':' + (m < 10 ? '0' + m : m) + ':' + (s < 10 ? '0' + s : s); + return Y + '-' + (M < 10 ? '0' + M : M) + '-' + (D < 10 ? '0' + D : D) + ' ' + (h < 10 ? '0' + h : h) + ':' + (m < 10 ? '0' + m : m) + ':' + (s < 10 ? '0' + s : s) } else if (type === 'week') { // 鍦╭uartz涓� 1涓烘槦鏈熸棩 - return week + 1; + return week + 1 } } // 妫�鏌ユ棩鏈熸槸鍚﹀瓨鍦� function checkDate(value) { - let time = new Date(value); + let time = new Date(value) let format = formatDate(time) - return value === format; + return value === format } onMounted(() => { expressionChange() diff --git a/src/components/DictTag/index.vue b/src/components/DictTag/index.vue index 3884e46..5e70502 100644 --- a/src/components/DictTag/index.vue +++ b/src/components/DictTag/index.vue @@ -26,7 +26,7 @@ <script setup> // 璁板綍鏈尮閰嶇殑椤� -const unmatchArray = ref([]); +const unmatchArray = ref([]) const props = defineProps({ // 鏁版嵁 @@ -45,15 +45,15 @@ type: String, default: ",", } -}); +}) const values = computed(() => { - if (props.value === null || typeof props.value === 'undefined' || props.value === '') return []; - return Array.isArray(props.value) ? props.value.map(item => '' + item) : String(props.value).split(props.separator); -}); + if (props.value === null || typeof props.value === 'undefined' || props.value === '') return [] + return Array.isArray(props.value) ? props.value.map(item => '' + item) : String(props.value).split(props.separator) +}) const unmatch = computed(() => { - unmatchArray.value = []; + unmatchArray.value = [] // 娌℃湁value涓嶆樉绀� if (props.value === null || typeof props.value === 'undefined' || props.value === '' || !Array.isArray(props.options) || props.options.length === 0) return false // 浼犲叆鍊间负鏁扮粍 @@ -65,13 +65,13 @@ } }) return unmatch // 杩斿洖鏍囧織鐨勫�� -}); +}) function handleArray(array) { - if (array.length === 0) return ""; + if (array.length === 0) return "" return array.reduce((pre, cur) => { - return pre + " " + cur; - }); + return pre + " " + cur + }) } </script> diff --git a/src/components/Editor/index.vue b/src/components/Editor/index.vue index c5e2185..efd0edc 100644 --- a/src/components/Editor/index.vue +++ b/src/components/Editor/index.vue @@ -27,18 +27,18 @@ </template> <script setup> -import axios from 'axios'; -import { QuillEditor } from "@vueup/vue-quill"; -import "@vueup/vue-quill/dist/vue-quill.snow.css"; -import { getToken } from "@/utils/auth"; +import axios from 'axios' +import { QuillEditor } from "@vueup/vue-quill" +import "@vueup/vue-quill/dist/vue-quill.snow.css" +import { getToken } from "@/utils/auth" -const { proxy } = getCurrentInstance(); +const { proxy } = getCurrentInstance() -const quillEditorRef = ref(); -const uploadUrl = ref(import.meta.env.VITE_APP_BASE_API + "/common/upload"); // 涓婁紶鐨勫浘鐗囨湇鍔″櫒鍦板潃 +const quillEditorRef = ref() +const uploadUrl = ref(import.meta.env.VITE_APP_BASE_API + "/common/upload") // 涓婁紶鐨勫浘鐗囨湇鍔″櫒鍦板潃 const headers = ref({ Authorization: "Bearer " + getToken() -}); +}) const props = defineProps({ /* 缂栬緫鍣ㄧ殑鍐呭 */ @@ -70,7 +70,7 @@ type: String, default: "url", } -}); +}) const options = ref({ theme: "snow", @@ -93,60 +93,60 @@ }, placeholder: "璇疯緭鍏ュ唴瀹�", readOnly: props.readOnly -}); +}) const styles = computed(() => { - let style = {}; + let style = {} if (props.minHeight) { - style.minHeight = `${props.minHeight}px`; + style.minHeight = `${props.minHeight}px` } if (props.height) { - style.height = `${props.height}px`; + style.height = `${props.height}px` } - return style; -}); + return style +}) -const content = ref(""); +const content = ref("") watch(() => props.modelValue, (v) => { if (v !== content.value) { - content.value = v == undefined ? "<p></p>" : v; + content.value = v == undefined ? "<p></p>" : v } -}, { immediate: true }); +}, { immediate: true }) // 濡傛灉璁剧疆浜嗕笂浼犲湴鍧�鍒欒嚜瀹氫箟鍥剧墖涓婁紶浜嬩欢 onMounted(() => { if (props.type == 'url') { - let quill = quillEditorRef.value.getQuill(); - let toolbar = quill.getModule("toolbar"); + let quill = quillEditorRef.value.getQuill() + let toolbar = quill.getModule("toolbar") toolbar.addHandler("image", (value) => { if (value) { - proxy.$refs.uploadRef.click(); + proxy.$refs.uploadRef.click() } else { - quill.format("image", false); + quill.format("image", false) } - }); - quill.root.addEventListener('paste', handlePasteCapture, true); + }) + quill.root.addEventListener('paste', handlePasteCapture, true) } -}); +}) // 涓婁紶鍓嶆牎妫�鏍煎紡鍜屽ぇ灏� function handleBeforeUpload(file) { - const type = ["image/jpeg", "image/jpg", "image/png", "image/svg"]; - const isJPG = type.includes(file.type); + const type = ["image/jpeg", "image/jpg", "image/png", "image/svg"] + const isJPG = type.includes(file.type) //妫�楠屾枃浠舵牸寮� if (!isJPG) { - proxy.$modal.msgError(`鍥剧墖鏍煎紡閿欒!`); - return false; + proxy.$modal.msgError(`鍥剧墖鏍煎紡閿欒!`) + return false } // 鏍℃鏂囦欢澶у皬 if (props.fileSize) { - const isLt = file.size / 1024 / 1024 < props.fileSize; + const isLt = file.size / 1024 / 1024 < props.fileSize if (!isLt) { - proxy.$modal.msgError(`涓婁紶鏂囦欢澶у皬涓嶈兘瓒呰繃 ${props.fileSize} MB!`); - return false; + proxy.$modal.msgError(`涓婁紶鏂囦欢澶у皬涓嶈兘瓒呰繃 ${props.fileSize} MB!`) + return false } } - return true; + return true } // 涓婁紶鎴愬姛澶勭悊 @@ -154,43 +154,43 @@ // 濡傛灉涓婁紶鎴愬姛 if (res.code == 200) { // 鑾峰彇瀵屾枃鏈疄渚� - let quill = toRaw(quillEditorRef.value).getQuill(); + let quill = toRaw(quillEditorRef.value).getQuill() // 鑾峰彇鍏夋爣浣嶇疆 - let length = quill.selection.savedRange.index; + let length = quill.selection.savedRange.index // 鎻掑叆鍥剧墖锛宺es.url涓烘湇鍔″櫒杩斿洖鐨勫浘鐗囬摼鎺ュ湴鍧� - quill.insertEmbed(length, "image", import.meta.env.VITE_APP_BASE_API + res.fileName); + quill.insertEmbed(length, "image", import.meta.env.VITE_APP_BASE_API + res.fileName) // 璋冩暣鍏夋爣鍒版渶鍚� - quill.setSelection(length + 1); + quill.setSelection(length + 1) } else { - proxy.$modal.msgError("鍥剧墖鎻掑叆澶辫触"); + proxy.$modal.msgError("鍥剧墖鎻掑叆澶辫触") } } // 涓婁紶澶辫触澶勭悊 function handleUploadError() { - proxy.$modal.msgError("鍥剧墖鎻掑叆澶辫触"); + proxy.$modal.msgError("鍥剧墖鎻掑叆澶辫触") } // 澶嶅埗绮樿创鍥剧墖澶勭悊 function handlePasteCapture(e) { - const clipboard = e.clipboardData || window.clipboardData; + const clipboard = e.clipboardData || window.clipboardData if (clipboard && clipboard.items) { for (let i = 0; i < clipboard.items.length; i++) { - const item = clipboard.items[i]; + const item = clipboard.items[i] if (item.type.indexOf('image') !== -1) { - e.preventDefault(); - const file = item.getAsFile(); - insertImage(file); + e.preventDefault() + const file = item.getAsFile() + insertImage(file) } } } } function insertImage(file) { - const formData = new FormData(); - formData.append("file", file); + const formData = new FormData() + formData.append("file", file) axios.post(uploadUrl.value, formData, { headers: { "Content-Type": "multipart/form-data", Authorization: headers.value.Authorization } }).then(res => { - handleUploadSuccess(res.data); + handleUploadSuccess(res.data) }) } </script> diff --git a/src/components/FileUpload/index.vue b/src/components/FileUpload/index.vue index 3a83b3a..49ead36 100644 --- a/src/components/FileUpload/index.vue +++ b/src/components/FileUpload/index.vue @@ -33,7 +33,7 @@ <span class="el-icon-document"> {{ getFileName(file.name) }} </span> </el-link> <div class="ele-upload-list__item-content-action"> - <el-link :underline="false" @click="handleDelete(index)" type="danger" v-if="!disabled">鍒犻櫎</el-link> + <el-link :underline="false" @click="handleDelete(index)" type="danger" v-if="!disabled"> 鍒犻櫎</el-link> </div> </li> </transition-group> @@ -41,7 +41,7 @@ </template> <script setup> -import { getToken } from "@/utils/auth"; +import { getToken } from "@/utils/auth" const props = defineProps({ modelValue: [String, Object, Array], @@ -79,108 +79,108 @@ type: Boolean, default: false } -}); +}) -const { proxy } = getCurrentInstance(); -const emit = defineEmits(); -const number = ref(0); -const uploadList = ref([]); -const baseUrl = import.meta.env.VITE_APP_BASE_API; -const uploadFileUrl = ref(import.meta.env.VITE_APP_BASE_API + props.action); // 涓婁紶鏂囦欢鏈嶅姟鍣ㄥ湴鍧� -const headers = ref({ Authorization: "Bearer " + getToken() }); -const fileList = ref([]); +const { proxy } = getCurrentInstance() +const emit = defineEmits() +const number = ref(0) +const uploadList = ref([]) +const baseUrl = import.meta.env.VITE_APP_BASE_API +const uploadFileUrl = ref(import.meta.env.VITE_APP_BASE_API + props.action) // 涓婁紶鏂囦欢鏈嶅姟鍣ㄥ湴鍧� +const headers = ref({ Authorization: "Bearer " + getToken() }) +const fileList = ref([]) const showTip = computed( () => props.isShowTip && (props.fileType || props.fileSize) -); +) watch(() => props.modelValue, val => { if (val) { - let temp = 1; + let temp = 1 // 棣栧厛灏嗗�艰浆涓烘暟缁� - const list = Array.isArray(val) ? val : props.modelValue.split(','); + const list = Array.isArray(val) ? val : props.modelValue.split(',') // 鐒跺悗灏嗘暟缁勮浆涓哄璞℃暟缁� fileList.value = list.map(item => { if (typeof item === "string") { - item = { name: item, url: item }; + item = { name: item, url: item } } - item.uid = item.uid || new Date().getTime() + temp++; - return item; - }); + item.uid = item.uid || new Date().getTime() + temp++ + return item + }) } else { - fileList.value = []; - return []; + fileList.value = [] + return [] } -},{ deep: true, immediate: true }); +},{ deep: true, immediate: true }) // 涓婁紶鍓嶆牎妫�鏍煎紡鍜屽ぇ灏� function handleBeforeUpload(file) { // 鏍℃鏂囦欢绫诲瀷 if (props.fileType.length) { - const fileName = file.name.split('.'); - const fileExt = fileName[fileName.length - 1]; - const isTypeOk = props.fileType.indexOf(fileExt) >= 0; + const fileName = file.name.split('.') + const fileExt = fileName[fileName.length - 1] + const isTypeOk = props.fileType.indexOf(fileExt) >= 0 if (!isTypeOk) { - proxy.$modal.msgError(`鏂囦欢鏍煎紡涓嶆纭紝璇蜂笂浼�${props.fileType.join("/")}鏍煎紡鏂囦欢!`); - return false; + proxy.$modal.msgError(`鏂囦欢鏍煎紡涓嶆纭紝璇蜂笂浼�${props.fileType.join("/")}鏍煎紡鏂囦欢!`) + return false } } // 鏍℃鏂囦欢鍚嶆槸鍚﹀寘鍚壒娈婂瓧绗� if (file.name.includes(',')) { - proxy.$modal.msgError('鏂囦欢鍚嶄笉姝g‘锛屼笉鑳藉寘鍚嫳鏂囬�楀彿!'); - return false; + proxy.$modal.msgError('鏂囦欢鍚嶄笉姝g‘锛屼笉鑳藉寘鍚嫳鏂囬�楀彿!') + return false } // 鏍℃鏂囦欢澶у皬 if (props.fileSize) { - const isLt = file.size / 1024 / 1024 < props.fileSize; + const isLt = file.size / 1024 / 1024 < props.fileSize if (!isLt) { - proxy.$modal.msgError(`涓婁紶鏂囦欢澶у皬涓嶈兘瓒呰繃 ${props.fileSize} MB!`); - return false; + proxy.$modal.msgError(`涓婁紶鏂囦欢澶у皬涓嶈兘瓒呰繃 ${props.fileSize} MB!`) + return false } } - proxy.$modal.loading("姝e湪涓婁紶鏂囦欢锛岃绋嶅��..."); - number.value++; - return true; + proxy.$modal.loading("姝e湪涓婁紶鏂囦欢锛岃绋嶅��...") + number.value++ + return true } // 鏂囦欢涓暟瓒呭嚭 function handleExceed() { - proxy.$modal.msgError(`涓婁紶鏂囦欢鏁伴噺涓嶈兘瓒呰繃 ${props.limit} 涓�!`); + proxy.$modal.msgError(`涓婁紶鏂囦欢鏁伴噺涓嶈兘瓒呰繃 ${props.limit} 涓�!`) } // 涓婁紶澶辫触 function handleUploadError(err) { - proxy.$modal.msgError("涓婁紶鏂囦欢澶辫触"); - proxy.$modal.closeLoading(); + proxy.$modal.msgError("涓婁紶鏂囦欢澶辫触") + proxy.$modal.closeLoading() } // 涓婁紶鎴愬姛鍥炶皟 function handleUploadSuccess(res, file) { if (res.code === 200) { - uploadList.value.push({ name: res.fileName, url: res.fileName }); - uploadedSuccessfully(); + uploadList.value.push({ name: res.fileName, url: res.fileName }) + uploadedSuccessfully() } else { - number.value--; - proxy.$modal.closeLoading(); - proxy.$modal.msgError(res.msg); - proxy.$refs.fileUpload.handleRemove(file); - uploadedSuccessfully(); + number.value-- + proxy.$modal.closeLoading() + proxy.$modal.msgError(res.msg) + proxy.$refs.fileUpload.handleRemove(file) + uploadedSuccessfully() } } // 鍒犻櫎鏂囦欢 function handleDelete(index) { - fileList.value.splice(index, 1); - emit("update:modelValue", listToString(fileList.value)); + fileList.value.splice(index, 1) + emit("update:modelValue", listToString(fileList.value)) } // 涓婁紶缁撴潫澶勭悊 function uploadedSuccessfully() { if (number.value > 0 && uploadList.value.length === number.value) { - fileList.value = fileList.value.filter(f => f.url !== undefined).concat(uploadList.value); - uploadList.value = []; - number.value = 0; - emit("update:modelValue", listToString(fileList.value)); - proxy.$modal.closeLoading(); + fileList.value = fileList.value.filter(f => f.url !== undefined).concat(uploadList.value) + uploadList.value = [] + number.value = 0 + emit("update:modelValue", listToString(fileList.value)) + proxy.$modal.closeLoading() } } @@ -188,22 +188,22 @@ function getFileName(name) { // 濡傛灉鏄痷rl閭d箞鍙栨渶鍚庣殑鍚嶅瓧 濡傛灉涓嶆槸鐩存帴杩斿洖 if (name.lastIndexOf("/") > -1) { - return name.slice(name.lastIndexOf("/") + 1); + return name.slice(name.lastIndexOf("/") + 1) } else { - return name; + return name } } // 瀵硅薄杞垚鎸囧畾瀛楃涓插垎闅� function listToString(list, separator) { - let strs = ""; - separator = separator || ","; + let strs = "" + separator = separator || "," for (let i in list) { if (list[i].url) { - strs += list[i].url + separator; + strs += list[i].url + separator } } - return strs != '' ? strs.substr(0, strs.length - 1) : ''; + return strs != '' ? strs.substr(0, strs.length - 1) : '' } </script> diff --git a/src/components/Hamburger/index.vue b/src/components/Hamburger/index.vue index ab1dc36..3ea9388 100644 --- a/src/components/Hamburger/index.vue +++ b/src/components/Hamburger/index.vue @@ -24,7 +24,7 @@ const emit = defineEmits() const toggleClick = () => { - emit('toggleClick'); + emit('toggleClick') } </script> diff --git a/src/components/IconSelect/index.vue b/src/components/IconSelect/index.vue index 26172fc..3bb177f 100644 --- a/src/components/IconSelect/index.vue +++ b/src/components/IconSelect/index.vue @@ -30,11 +30,11 @@ activeIcon: { type: String } -}); +}) -const iconName = ref(''); -const iconList = ref(icons); -const emit = defineEmits(['selected']); +const iconName = ref('') +const iconList = ref(icons) +const emit = defineEmits(['selected']) function filterIcons() { iconList.value = icons diff --git a/src/components/IconSelect/requireIcons.js b/src/components/IconSelect/requireIcons.js index 158b536..ccdfaa4 100644 --- a/src/components/IconSelect/requireIcons.js +++ b/src/components/IconSelect/requireIcons.js @@ -1,8 +1,8 @@ let icons = [] -const modules = import.meta.glob('./../../assets/icons/svg/*.svg'); +const modules = import.meta.glob('./../../assets/icons/svg/*.svg') for (const path in modules) { - const p = path.split('assets/icons/svg/')[1].split('.svg')[0]; - icons.push(p); + const p = path.split('assets/icons/svg/')[1].split('.svg')[0] + icons.push(p) } export default icons \ No newline at end of file diff --git a/src/components/ImagePreview/index.vue b/src/components/ImagePreview/index.vue index 5222925..00212c5 100644 --- a/src/components/ImagePreview/index.vue +++ b/src/components/ImagePreview/index.vue @@ -15,7 +15,7 @@ </template> <script setup> -import { isExternal } from "@/utils/validate"; +import { isExternal } from "@/utils/validate" const props = defineProps({ src: { @@ -30,41 +30,41 @@ type: [Number, String], default: "" } -}); +}) const realSrc = computed(() => { if (!props.src) { - return; + return } - let real_src = props.src.split(",")[0]; + let real_src = props.src.split(",")[0] if (isExternal(real_src)) { - return real_src; + return real_src } - return import.meta.env.VITE_APP_BASE_API + real_src; -}); + return import.meta.env.VITE_APP_BASE_API + real_src +}) const realSrcList = computed(() => { if (!props.src) { - return; + return } - let real_src_list = props.src.split(","); - let srcList = []; + let real_src_list = props.src.split(",") + let srcList = [] real_src_list.forEach(item => { if (isExternal(item)) { - return srcList.push(item); + return srcList.push(item) } - return srcList.push(import.meta.env.VITE_APP_BASE_API + item); - }); - return srcList; -}); + return srcList.push(import.meta.env.VITE_APP_BASE_API + item) + }) + return srcList +}) const realWidth = computed(() => typeof props.width == "string" ? props.width : `${props.width}px` -); +) const realHeight = computed(() => typeof props.height == "string" ? props.height : `${props.height}px` -); +) </script> <style lang="scss" scoped> diff --git a/src/components/ImageUpload/index.vue b/src/components/ImageUpload/index.vue index 2bedc33..04e3f43 100644 --- a/src/components/ImageUpload/index.vue +++ b/src/components/ImageUpload/index.vue @@ -47,8 +47,8 @@ </template> <script setup> -import { getToken } from "@/utils/auth"; -import { isExternal } from "@/utils/validate"; +import { getToken } from "@/utils/auth" +import { isExternal } from "@/utils/validate" const props = defineProps({ modelValue: [String, Object, Array], @@ -81,140 +81,140 @@ type: Boolean, default: true }, -}); +}) -const { proxy } = getCurrentInstance(); -const emit = defineEmits(); -const number = ref(0); -const uploadList = ref([]); -const dialogImageUrl = ref(""); -const dialogVisible = ref(false); -const baseUrl = import.meta.env.VITE_APP_BASE_API; -const uploadImgUrl = ref(import.meta.env.VITE_APP_BASE_API + props.action); // 涓婁紶鐨勫浘鐗囨湇鍔″櫒鍦板潃 -const headers = ref({ Authorization: "Bearer " + getToken() }); -const fileList = ref([]); +const { proxy } = getCurrentInstance() +const emit = defineEmits() +const number = ref(0) +const uploadList = ref([]) +const dialogImageUrl = ref("") +const dialogVisible = ref(false) +const baseUrl = import.meta.env.VITE_APP_BASE_API +const uploadImgUrl = ref(import.meta.env.VITE_APP_BASE_API + props.action) // 涓婁紶鐨勫浘鐗囨湇鍔″櫒鍦板潃 +const headers = ref({ Authorization: "Bearer " + getToken() }) +const fileList = ref([]) const showTip = computed( () => props.isShowTip && (props.fileType || props.fileSize) -); +) watch(() => props.modelValue, val => { if (val) { // 棣栧厛灏嗗�艰浆涓烘暟缁� - const list = Array.isArray(val) ? val : props.modelValue.split(","); + const list = Array.isArray(val) ? val : props.modelValue.split(",") // 鐒跺悗灏嗘暟缁勮浆涓哄璞℃暟缁� fileList.value = list.map(item => { if (typeof item === "string") { if (item.indexOf(baseUrl) === -1 && !isExternal(item)) { - item = { name: baseUrl + item, url: baseUrl + item }; + item = { name: baseUrl + item, url: baseUrl + item } } else { - item = { name: item, url: item }; + item = { name: item, url: item } } } - return item; - }); + return item + }) } else { - fileList.value = []; - return []; + fileList.value = [] + return [] } -},{ deep: true, immediate: true }); +},{ deep: true, immediate: true }) // 涓婁紶鍓峫oading鍔犺浇 function handleBeforeUpload(file) { - let isImg = false; + let isImg = false if (props.fileType.length) { - let fileExtension = ""; + let fileExtension = "" if (file.name.lastIndexOf(".") > -1) { - fileExtension = file.name.slice(file.name.lastIndexOf(".") + 1); + fileExtension = file.name.slice(file.name.lastIndexOf(".") + 1) } isImg = props.fileType.some(type => { - if (file.type.indexOf(type) > -1) return true; - if (fileExtension && fileExtension.indexOf(type) > -1) return true; - return false; - }); + if (file.type.indexOf(type) > -1) return true + if (fileExtension && fileExtension.indexOf(type) > -1) return true + return false + }) } else { - isImg = file.type.indexOf("image") > -1; + isImg = file.type.indexOf("image") > -1 } if (!isImg) { - proxy.$modal.msgError(`鏂囦欢鏍煎紡涓嶆纭紝璇蜂笂浼�${props.fileType.join("/")}鍥剧墖鏍煎紡鏂囦欢!`); - return false; + proxy.$modal.msgError(`鏂囦欢鏍煎紡涓嶆纭紝璇蜂笂浼�${props.fileType.join("/")}鍥剧墖鏍煎紡鏂囦欢!`) + return false } if (file.name.includes(',')) { - proxy.$modal.msgError('鏂囦欢鍚嶄笉姝g‘锛屼笉鑳藉寘鍚嫳鏂囬�楀彿!'); - return false; + proxy.$modal.msgError('鏂囦欢鍚嶄笉姝g‘锛屼笉鑳藉寘鍚嫳鏂囬�楀彿!') + return false } if (props.fileSize) { - const isLt = file.size / 1024 / 1024 < props.fileSize; + const isLt = file.size / 1024 / 1024 < props.fileSize if (!isLt) { - proxy.$modal.msgError(`涓婁紶澶村儚鍥剧墖澶у皬涓嶈兘瓒呰繃 ${props.fileSize} MB!`); - return false; + proxy.$modal.msgError(`涓婁紶澶村儚鍥剧墖澶у皬涓嶈兘瓒呰繃 ${props.fileSize} MB!`) + return false } } - proxy.$modal.loading("姝e湪涓婁紶鍥剧墖锛岃绋嶅��..."); - number.value++; + proxy.$modal.loading("姝e湪涓婁紶鍥剧墖锛岃绋嶅��...") + number.value++ } // 鏂囦欢涓暟瓒呭嚭 function handleExceed() { - proxy.$modal.msgError(`涓婁紶鏂囦欢鏁伴噺涓嶈兘瓒呰繃 ${props.limit} 涓�!`); + proxy.$modal.msgError(`涓婁紶鏂囦欢鏁伴噺涓嶈兘瓒呰繃 ${props.limit} 涓�!`) } // 涓婁紶鎴愬姛鍥炶皟 function handleUploadSuccess(res, file) { if (res.code === 200) { - uploadList.value.push({ name: res.fileName, url: res.fileName }); - uploadedSuccessfully(); + uploadList.value.push({ name: res.fileName, url: res.fileName }) + uploadedSuccessfully() } else { - number.value--; - proxy.$modal.closeLoading(); - proxy.$modal.msgError(res.msg); - proxy.$refs.imageUpload.handleRemove(file); - uploadedSuccessfully(); + number.value-- + proxy.$modal.closeLoading() + proxy.$modal.msgError(res.msg) + proxy.$refs.imageUpload.handleRemove(file) + uploadedSuccessfully() } } // 鍒犻櫎鍥剧墖 function handleDelete(file) { - const findex = fileList.value.map(f => f.name).indexOf(file.name); + const findex = fileList.value.map(f => f.name).indexOf(file.name) if (findex > -1 && uploadList.value.length === number.value) { - fileList.value.splice(findex, 1); - emit("update:modelValue", listToString(fileList.value)); - return false; + fileList.value.splice(findex, 1) + emit("update:modelValue", listToString(fileList.value)) + return false } } // 涓婁紶缁撴潫澶勭悊 function uploadedSuccessfully() { if (number.value > 0 && uploadList.value.length === number.value) { - fileList.value = fileList.value.filter(f => f.url !== undefined).concat(uploadList.value); - uploadList.value = []; - number.value = 0; - emit("update:modelValue", listToString(fileList.value)); - proxy.$modal.closeLoading(); + fileList.value = fileList.value.filter(f => f.url !== undefined).concat(uploadList.value) + uploadList.value = [] + number.value = 0 + emit("update:modelValue", listToString(fileList.value)) + proxy.$modal.closeLoading() } } // 涓婁紶澶辫触 function handleUploadError() { - proxy.$modal.msgError("涓婁紶鍥剧墖澶辫触"); - proxy.$modal.closeLoading(); + proxy.$modal.msgError("涓婁紶鍥剧墖澶辫触") + proxy.$modal.closeLoading() } // 棰勮 function handlePictureCardPreview(file) { - dialogImageUrl.value = file.url; - dialogVisible.value = true; + dialogImageUrl.value = file.url + dialogVisible.value = true } // 瀵硅薄杞垚鎸囧畾瀛楃涓插垎闅� function listToString(list, separator) { - let strs = ""; - separator = separator || ","; + let strs = "" + separator = separator || "," for (let i in list) { if (undefined !== list[i].url && list[i].url.indexOf("blob:") !== 0) { - strs += list[i].url.replace(baseUrl, "") + separator; + strs += list[i].url.replace(baseUrl, "") + separator } } - return strs != "" ? strs.substr(0, strs.length - 1) : ""; + return strs != "" ? strs.substr(0, strs.length - 1) : "" } </script> diff --git a/src/components/Pagination/index.vue b/src/components/Pagination/index.vue index 5b81b11..53fbec2 100644 --- a/src/components/Pagination/index.vue +++ b/src/components/Pagination/index.vue @@ -59,7 +59,7 @@ } }) -const emit = defineEmits(); +const emit = defineEmits() const currentPage = computed({ get() { return props.page @@ -76,6 +76,7 @@ emit('update:limit', val) } }) + function handleSizeChange(val) { if (currentPage.value * val > props.total) { currentPage.value = 1 @@ -85,13 +86,13 @@ scrollTo(0, 800) } } + function handleCurrentChange(val) { emit('pagination', { page: val, limit: pageSize.value }) if (props.autoScroll) { scrollTo(0, 800) } } - </script> <style scoped> diff --git a/src/components/RuoYi/Doc/index.vue b/src/components/RuoYi/Doc/index.vue index ace6d47..91aebe0 100644 --- a/src/components/RuoYi/Doc/index.vue +++ b/src/components/RuoYi/Doc/index.vue @@ -5,7 +5,7 @@ </template> <script setup> -const url = ref('http://doc.ruoyi.vip/ruoyi-vue'); +const url = ref('http://doc.ruoyi.vip/ruoyi-vue') function goto() { window.open(url.value) diff --git a/src/components/RuoYi/Git/index.vue b/src/components/RuoYi/Git/index.vue index 3fe77d0..96fdea7 100644 --- a/src/components/RuoYi/Git/index.vue +++ b/src/components/RuoYi/Git/index.vue @@ -5,7 +5,7 @@ </template> <script setup> -const url = ref('https://gitee.com/y_project/RuoYi-Vue'); +const url = ref('https://gitee.com/y_project/RuoYi-Vue') function goto() { window.open(url.value) diff --git a/src/components/Screenfull/index.vue b/src/components/Screenfull/index.vue index c3b9b94..cf23223 100644 --- a/src/components/Screenfull/index.vue +++ b/src/components/Screenfull/index.vue @@ -7,7 +7,7 @@ <script setup> import { useFullscreen } from '@vueuse/core' -const { isFullscreen, enter, exit, toggle } = useFullscreen(); +const { isFullscreen, enter, exit, toggle } = useFullscreen() </script> <style lang='scss' scoped> diff --git a/src/components/SizeSelect/index.vue b/src/components/SizeSelect/index.vue index f3cf567..dddb58a 100644 --- a/src/components/SizeSelect/index.vue +++ b/src/components/SizeSelect/index.vue @@ -16,23 +16,23 @@ </template> <script setup> -import useAppStore from "@/store/modules/app"; +import useAppStore from "@/store/modules/app" -const appStore = useAppStore(); -const size = computed(() => appStore.size); -const route = useRoute(); -const router = useRouter(); -const { proxy } = getCurrentInstance(); +const appStore = useAppStore() +const size = computed(() => appStore.size) +const route = useRoute() +const router = useRouter() +const { proxy } = getCurrentInstance() const sizeOptions = ref([ { label: "杈冨ぇ", value: "large" }, { label: "榛樿", value: "default" }, { label: "绋嶅皬", value: "small" }, -]); +]) function handleSetSize(size) { - proxy.$modal.loading("姝e湪璁剧疆甯冨眬澶у皬锛岃绋嶅��..."); - appStore.setSize(size); - setTimeout("window.location.reload()", 1000); + proxy.$modal.loading("姝e湪璁剧疆甯冨眬澶у皬锛岃绋嶅��...") + appStore.setSize(size) + setTimeout("window.location.reload()", 1000) } </script> diff --git a/src/components/SvgIcon/svgicon.js b/src/components/SvgIcon/svgicon.js index b7c1907..05284e3 100644 --- a/src/components/SvgIcon/svgicon.js +++ b/src/components/SvgIcon/svgicon.js @@ -1,10 +1,10 @@ import * as components from '@element-plus/icons-vue' export default { - install: (app) => { - for (const key in components) { - const componentConfig = components[key]; - app.component(componentConfig.name, componentConfig); - } - }, -}; + install: (app) => { + for (const key in components) { + const componentConfig = components[key] + app.component(componentConfig.name, componentConfig) + } + } +} diff --git a/src/components/TopNav/index.vue b/src/components/TopNav/index.vue index 15dee7e..56e2803 100644 --- a/src/components/TopNav/index.vue +++ b/src/components/TopNav/index.vue @@ -40,126 +40,127 @@ import usePermissionStore from '@/store/modules/permission' // 椤堕儴鏍忓垵濮嬫暟 -const visibleNumber = ref(null); +const visibleNumber = ref(null) // 褰撳墠婵�娲昏彍鍗曠殑 index -const currentIndex = ref(null); +const currentIndex = ref(null) // 闅愯棌渚ц竟鏍忚矾鐢� -const hideList = ['/index', '/user/profile']; +const hideList = ['/index', '/user/profile'] const appStore = useAppStore() const settingsStore = useSettingsStore() const permissionStore = usePermissionStore() -const route = useRoute(); -const router = useRouter(); +const route = useRoute() +const router = useRouter() // 涓婚棰滆壊 -const theme = computed(() => settingsStore.theme); +const theme = computed(() => settingsStore.theme) // 鎵�鏈夌殑璺敱淇℃伅 -const routers = computed(() => permissionStore.topbarRouters); +const routers = computed(() => permissionStore.topbarRouters) // 椤堕儴鏄剧ず鑿滃崟 const topMenus = computed(() => { - let topMenus = []; + let topMenus = [] routers.value.map((menu) => { if (menu.hidden !== true) { // 鍏煎椤堕儴鏍忎竴绾ц彍鍗曞唴閮ㄨ烦杞� if (menu.path === '/' && menu.children) { - topMenus.push(menu.children[0]); + topMenus.push(menu.children[0]) } else { - topMenus.push(menu); + topMenus.push(menu) } } }) - return topMenus; + return topMenus }) // 璁剧疆瀛愯矾鐢� const childrenMenus = computed(() => { - let childrenMenus = []; + let childrenMenus = [] routers.value.map((router) => { for (let item in router.children) { if (router.children[item].parentPath === undefined) { if(router.path === "/") { - router.children[item].path = "/" + router.children[item].path; + router.children[item].path = "/" + router.children[item].path } else { if(!isHttp(router.children[item].path)) { - router.children[item].path = router.path + "/" + router.children[item].path; + router.children[item].path = router.path + "/" + router.children[item].path } } - router.children[item].parentPath = router.path; + router.children[item].parentPath = router.path } - childrenMenus.push(router.children[item]); + childrenMenus.push(router.children[item]) } }) - return constantRoutes.concat(childrenMenus); + return constantRoutes.concat(childrenMenus) }) // 榛樿婵�娲荤殑鑿滃崟 const activeMenu = computed(() => { - const path = route.path; - let activePath = path; + const path = route.path + let activePath = path if (path !== undefined && path.lastIndexOf("/") > 0 && hideList.indexOf(path) === -1) { - const tmpPath = path.substring(1, path.length); + const tmpPath = path.substring(1, path.length) if (!route.meta.link) { - activePath = "/" + tmpPath.substring(0, tmpPath.indexOf("/")); - appStore.toggleSideBarHide(false); + activePath = "/" + tmpPath.substring(0, tmpPath.indexOf("/")) + appStore.toggleSideBarHide(false) } } else if(!route.children) { - activePath = path; - appStore.toggleSideBarHide(true); + activePath = path + appStore.toggleSideBarHide(true) } - activeRoutes(activePath); - return activePath; + activeRoutes(activePath) + return activePath }) function setVisibleNumber() { - const width = document.body.getBoundingClientRect().width / 3; - visibleNumber.value = parseInt(width / 85); + const width = document.body.getBoundingClientRect().width / 3 + visibleNumber.value = parseInt(width / 85) } function handleSelect(key, keyPath) { - currentIndex.value = key; - const route = routers.value.find(item => item.path === key); + currentIndex.value = key + const route = routers.value.find(item => item.path === key) if (isHttp(key)) { // http(s):// 璺緞鏂扮獥鍙f墦寮� - window.open(key, "_blank"); + window.open(key, "_blank") } else if (!route || !route.children) { // 娌℃湁瀛愯矾鐢辫矾寰勫唴閮ㄦ墦寮� - const routeMenu = childrenMenus.value.find(item => item.path === key); + const routeMenu = childrenMenus.value.find(item => item.path === key) if (routeMenu && routeMenu.query) { - let query = JSON.parse(routeMenu.query); - router.push({ path: key, query: query }); + let query = JSON.parse(routeMenu.query) + router.push({ path: key, query: query }) } else { - router.push({ path: key }); + router.push({ path: key }) } - appStore.toggleSideBarHide(true); + appStore.toggleSideBarHide(true) } else { // 鏄剧ず宸︿晶鑱斿姩鑿滃崟 - activeRoutes(key); - appStore.toggleSideBarHide(false); + activeRoutes(key) + appStore.toggleSideBarHide(false) } } function activeRoutes(key) { - let routes = []; + let routes = [] if (childrenMenus.value && childrenMenus.value.length > 0) { childrenMenus.value.map((item) => { if (key == item.parentPath || (key == "index" && "" == item.path)) { - routes.push(item); + routes.push(item) } - }); + }) } if(routes.length > 0) { - permissionStore.setSidebarRouters(routes); + permissionStore.setSidebarRouters(routes) } else { - appStore.toggleSideBarHide(true); + appStore.toggleSideBarHide(true) } - return routes; + return routes } onMounted(() => { window.addEventListener('resize', setVisibleNumber) }) + onBeforeUnmount(() => { window.removeEventListener('resize', setVisibleNumber) }) diff --git a/src/components/iFrame/index.vue b/src/components/iFrame/index.vue index 2e88332..fe98b2d 100644 --- a/src/components/iFrame/index.vue +++ b/src/components/iFrame/index.vue @@ -22,10 +22,10 @@ onMounted(() => { setTimeout(() => { - loading.value = false; - }, 300); + loading.value = false + }, 300) window.onresize = function temp() { - height.value = document.documentElement.clientHeight - 94.5 + "px;"; - }; + height.value = document.documentElement.clientHeight - 94.5 + "px;" + } }) </script> diff --git a/src/directive/common/copyText.js b/src/directive/common/copyText.js index f1316ce..169c068 100644 --- a/src/directive/common/copyText.js +++ b/src/directive/common/copyText.js @@ -6,61 +6,61 @@ export default { beforeMount(el, { value, arg }) { if (arg === "callback") { - el.$copyCallback = value; + el.$copyCallback = value } else { - el.$copyValue = value; + el.$copyValue = value const handler = () => { - copyTextToClipboard(el.$copyValue); + copyTextToClipboard(el.$copyValue) if (el.$copyCallback) { - el.$copyCallback(el.$copyValue); + el.$copyCallback(el.$copyValue) } - }; - el.addEventListener("click", handler); - el.$destroyCopy = () => el.removeEventListener("click", handler); + } + el.addEventListener("click", handler) + el.$destroyCopy = () => el.removeEventListener("click", handler) } } } function copyTextToClipboard(input, { target = document.body } = {}) { - const element = document.createElement('textarea'); - const previouslyFocusedElement = document.activeElement; + const element = document.createElement('textarea') + const previouslyFocusedElement = document.activeElement - element.value = input; + element.value = input // Prevent keyboard from showing on mobile - element.setAttribute('readonly', ''); + element.setAttribute('readonly', '') - element.style.contain = 'strict'; - element.style.position = 'absolute'; - element.style.left = '-9999px'; - element.style.fontSize = '12pt'; // Prevent zooming on iOS + element.style.contain = 'strict' + element.style.position = 'absolute' + element.style.left = '-9999px' + element.style.fontSize = '12pt' // Prevent zooming on iOS - const selection = document.getSelection(); - const originalRange = selection.rangeCount > 0 && selection.getRangeAt(0); + const selection = document.getSelection() + const originalRange = selection.rangeCount > 0 && selection.getRangeAt(0) - target.append(element); - element.select(); + target.append(element) + element.select() // Explicit selection workaround for iOS - element.selectionStart = 0; - element.selectionEnd = input.length; + element.selectionStart = 0 + element.selectionEnd = input.length - let isSuccess = false; + let isSuccess = false try { - isSuccess = document.execCommand('copy'); + isSuccess = document.execCommand('copy') } catch { } - element.remove(); + element.remove() if (originalRange) { - selection.removeAllRanges(); - selection.addRange(originalRange); + selection.removeAllRanges() + selection.addRange(originalRange) } // Get the focus back on the previously focused element, if any if (previouslyFocusedElement) { - previouslyFocusedElement.focus(); + previouslyFocusedElement.focus() } - return isSuccess; + return isSuccess } diff --git a/src/directive/permission/hasPermi.js b/src/directive/permission/hasPermi.js index 4581e01..e381ea9 100644 --- a/src/directive/permission/hasPermi.js +++ b/src/directive/permission/hasPermi.js @@ -8,7 +8,7 @@ export default { mounted(el, binding, vnode) { const { value } = binding - const all_permission = "*:*:*"; + const all_permission = "*:*:*" const permissions = useUserStore().permissions if (value && value instanceof Array && value.length > 0) { diff --git a/src/directive/permission/hasRole.js b/src/directive/permission/hasRole.js index 0c34791..2f1bb90 100644 --- a/src/directive/permission/hasRole.js +++ b/src/directive/permission/hasRole.js @@ -8,7 +8,7 @@ export default { mounted(el, binding, vnode) { const { value } = binding - const super_admin = "admin"; + const super_admin = "admin" const roles = useUserStore().roles if (value && value instanceof Array && value.length > 0) { diff --git a/src/layout/components/IframeToggle/index.vue b/src/layout/components/IframeToggle/index.vue index 4f43904..992b59d 100644 --- a/src/layout/components/IframeToggle/index.vue +++ b/src/layout/components/IframeToggle/index.vue @@ -9,17 +9,17 @@ </template> <script setup> -import InnerLink from "../InnerLink/index"; -import useTagsViewStore from "@/store/modules/tagsView"; +import InnerLink from "../InnerLink/index" +import useTagsViewStore from "@/store/modules/tagsView" -const route = useRoute(); -const tagsViewStore = useTagsViewStore(); +const route = useRoute() +const tagsViewStore = useTagsViewStore() function iframeUrl(url, query) { if (Object.keys(query).length > 0) { - let params = Object.keys(query).map((key) => key + "=" + query[key]).join("&"); - return url + "?" + params; + let params = Object.keys(query).map((key) => key + "=" + query[key]).join("&") + return url + "?" + params } - return url; + return url } </script> diff --git a/src/layout/components/InnerLink/index.vue b/src/layout/components/InnerLink/index.vue index 6d77d3a..6839730 100644 --- a/src/layout/components/InnerLink/index.vue +++ b/src/layout/components/InnerLink/index.vue @@ -18,7 +18,7 @@ iframeId: { type: String } -}); +}) -const height = ref(document.documentElement.clientHeight - 94.5 + "px"); +const height = ref(document.documentElement.clientHeight - 94.5 + "px") </script> diff --git a/src/layout/components/Navbar.vue b/src/layout/components/Navbar.vue index 35a6ee6..a7b467a 100644 --- a/src/layout/components/Navbar.vue +++ b/src/layout/components/Navbar.vue @@ -79,13 +79,13 @@ function handleCommand(command) { switch (command) { case "setLayout": - setLayout(); - break; + setLayout() + break case "logout": - logout(); - break; + logout() + break default: - break; + break } } @@ -96,14 +96,14 @@ type: 'warning' }).then(() => { userStore.logOut().then(() => { - location.href = '/index'; + location.href = '/index' }) - }).catch(() => { }); + }).catch(() => { }) } const emits = defineEmits(['setLayout']) function setLayout() { - emits('setLayout'); + emits('setLayout') } function toggleTheme() { diff --git a/src/layout/components/Settings/index.vue b/src/layout/components/Settings/index.vue index 7f2bcb7..679e4d9 100644 --- a/src/layout/components/Settings/index.vue +++ b/src/layout/components/Settings/index.vue @@ -88,36 +88,36 @@ import usePermissionStore from '@/store/modules/permission' import { handleThemeStyle } from '@/utils/theme' -const { proxy } = getCurrentInstance(); +const { proxy } = getCurrentInstance() const appStore = useAppStore() const settingsStore = useSettingsStore() const permissionStore = usePermissionStore() -const showSettings = ref(false); -const theme = ref(settingsStore.theme); -const sideTheme = ref(settingsStore.sideTheme); -const storeSettings = computed(() => settingsStore); -const predefineColors = ref(["#409EFF", "#ff4500", "#ff8c00", "#ffd700", "#90ee90", "#00ced1", "#1e90ff", "#c71585"]); +const showSettings = ref(false) +const theme = ref(settingsStore.theme) +const sideTheme = ref(settingsStore.sideTheme) +const storeSettings = computed(() => settingsStore) +const predefineColors = ref(["#409EFF", "#ff4500", "#ff8c00", "#ffd700", "#90ee90", "#00ced1", "#1e90ff", "#c71585"]) /** 鏄惁闇�瑕乼opnav */ function topNavChange(val) { if (!val) { - appStore.toggleSideBarHide(false); - permissionStore.setSidebarRouters(permissionStore.defaultRoutes); + appStore.toggleSideBarHide(false) + permissionStore.setSidebarRouters(permissionStore.defaultRoutes) } } function themeChange(val) { - settingsStore.theme = val; - handleThemeStyle(val); + settingsStore.theme = val + handleThemeStyle(val) } function handleTheme(val) { - settingsStore.sideTheme = val; - sideTheme.value = val; + settingsStore.sideTheme = val + sideTheme.value = val } function saveSetting() { - proxy.$modal.loading("姝e湪淇濆瓨鍒版湰鍦帮紝璇风◢鍊�..."); + proxy.$modal.loading("姝e湪淇濆瓨鍒版湰鍦帮紝璇风◢鍊�...") let layoutSetting = { "topNav": storeSettings.value.topNav, "tagsView": storeSettings.value.tagsView, @@ -126,23 +126,23 @@ "dynamicTitle": storeSettings.value.dynamicTitle, "sideTheme": storeSettings.value.sideTheme, "theme": storeSettings.value.theme - }; - localStorage.setItem("layout-setting", JSON.stringify(layoutSetting)); + } + localStorage.setItem("layout-setting", JSON.stringify(layoutSetting)) setTimeout(proxy.$modal.closeLoading(), 1000) } function resetSetting() { - proxy.$modal.loading("姝e湪娓呴櫎璁剧疆缂撳瓨骞跺埛鏂帮紝璇风◢鍊�..."); + proxy.$modal.loading("姝e湪娓呴櫎璁剧疆缂撳瓨骞跺埛鏂帮紝璇风◢鍊�...") localStorage.removeItem("layout-setting") setTimeout("window.location.reload()", 1000) } function openSetting() { - showSettings.value = true; + showSettings.value = true } defineExpose({ - openSetting, + openSetting }) </script> diff --git a/src/layout/components/Sidebar/Logo.vue b/src/layout/components/Sidebar/Logo.vue index 751b56e..90146ae 100644 --- a/src/layout/components/Sidebar/Logo.vue +++ b/src/layout/components/Sidebar/Logo.vue @@ -25,25 +25,25 @@ } }) -const title = import.meta.env.VITE_APP_TITLE; -const settingsStore = useSettingsStore(); -const sideTheme = computed(() => settingsStore.sideTheme); +const title = import.meta.env.VITE_APP_TITLE +const settingsStore = useSettingsStore() +const sideTheme = computed(() => settingsStore.sideTheme) // 鑾峰彇Logo鑳屾櫙鑹� const getLogoBackground = computed(() => { if (settingsStore.isDark) { - return 'var(--sidebar-bg)'; + return 'var(--sidebar-bg)' } - return sideTheme.value === 'theme-dark' ? variables.menuBg : variables.menuLightBg; -}); + return sideTheme.value === 'theme-dark' ? variables.menuBg : variables.menuLightBg +}) // 鑾峰彇Logo鏂囧瓧棰滆壊 const getLogoTextColor = computed(() => { if (settingsStore.isDark) { - return 'var(--sidebar-text)'; + return 'var(--sidebar-text)' } - return sideTheme.value === 'theme-dark' ? '#fff' : variables.menuLightText; -}); + return sideTheme.value === 'theme-dark' ? '#fff' : variables.menuLightText +}) </script> <style lang="scss" scoped> diff --git a/src/layout/components/Sidebar/SidebarItem.vue b/src/layout/components/Sidebar/SidebarItem.vue index 7d292fa..f395d95 100644 --- a/src/layout/components/Sidebar/SidebarItem.vue +++ b/src/layout/components/Sidebar/SidebarItem.vue @@ -48,11 +48,11 @@ } }) -const onlyOneChild = ref({}); +const onlyOneChild = ref({}) function hasOneShowingChild(children = [], parent) { if (!children) { - children = []; + children = [] } const showingChildren = children.filter(item => { if (item.hidden) { @@ -74,7 +74,7 @@ } return false -}; +} function resolvePath(routePath, routeQuery) { if (isExternal(routePath)) { @@ -84,7 +84,7 @@ return props.basePath } if (routeQuery) { - let query = JSON.parse(routeQuery); + let query = JSON.parse(routeQuery) return { path: getNormalPath(props.basePath + '/' + routePath), query: query } } return getNormalPath(props.basePath + '/' + routePath) @@ -92,9 +92,9 @@ function hasTitle(title){ if (title.length > 5) { - return title; + return title } else { - return ""; + return "" } } </script> diff --git a/src/layout/components/Sidebar/index.vue b/src/layout/components/Sidebar/index.vue index fd78773..f746f2d 100644 --- a/src/layout/components/Sidebar/index.vue +++ b/src/layout/components/Sidebar/index.vue @@ -32,40 +32,40 @@ import useSettingsStore from '@/store/modules/settings' import usePermissionStore from '@/store/modules/permission' -const route = useRoute(); +const route = useRoute() const appStore = useAppStore() const settingsStore = useSettingsStore() const permissionStore = usePermissionStore() -const sidebarRouters = computed(() => permissionStore.sidebarRouters); -const showLogo = computed(() => settingsStore.sidebarLogo); -const sideTheme = computed(() => settingsStore.sideTheme); -const theme = computed(() => settingsStore.theme); -const isCollapse = computed(() => !appStore.sidebar.opened); +const sidebarRouters = computed(() => permissionStore.sidebarRouters) +const showLogo = computed(() => settingsStore.sidebarLogo) +const sideTheme = computed(() => settingsStore.sideTheme) +const theme = computed(() => settingsStore.theme) +const isCollapse = computed(() => !appStore.sidebar.opened) // 鑾峰彇鑿滃崟鑳屾櫙鑹� const getMenuBackground = computed(() => { if (settingsStore.isDark) { - return 'var(--sidebar-bg)'; + return 'var(--sidebar-bg)' } - return sideTheme.value === 'theme-dark' ? variables.menuBg : variables.menuLightBg; -}); + return sideTheme.value === 'theme-dark' ? variables.menuBg : variables.menuLightBg +}) // 鑾峰彇鑿滃崟鏂囧瓧棰滆壊 const getMenuTextColor = computed(() => { if (settingsStore.isDark) { - return 'var(--sidebar-text)'; + return 'var(--sidebar-text)' } - return sideTheme.value === 'theme-dark' ? variables.menuText : variables.menuLightText; -}); + return sideTheme.value === 'theme-dark' ? variables.menuText : variables.menuLightText +}) const activeMenu = computed(() => { - const { meta, path } = route; + const { meta, path } = route if (meta.activeMenu) { - return meta.activeMenu; + return meta.activeMenu } - return path; -}); + return path +}) </script> <style lang="scss" scoped> diff --git a/src/layout/components/TagsView/ScrollPane.vue b/src/layout/components/TagsView/ScrollPane.vue index 7b6216e..0189a17 100644 --- a/src/layout/components/TagsView/ScrollPane.vue +++ b/src/layout/components/TagsView/ScrollPane.vue @@ -12,10 +12,10 @@ <script setup> import useTagsViewStore from '@/store/modules/tagsView' -const tagAndTagSpacing = ref(4); -const { proxy } = getCurrentInstance(); +const tagAndTagSpacing = ref(4) +const { proxy } = getCurrentInstance() -const scrollWrapper = computed(() => proxy.$refs.scrollContainer.$refs.wrapRef); +const scrollWrapper = computed(() => proxy.$refs.scrollContainer.$refs.wrapRef) onMounted(() => { scrollWrapper.value.addEventListener('scroll', emitScroll, true) @@ -27,7 +27,7 @@ function handleScroll(e) { const eventDelta = e.wheelDelta || -e.deltaY * 40 - const $scrollWrapper = scrollWrapper.value; + const $scrollWrapper = scrollWrapper.value $scrollWrapper.scrollLeft = $scrollWrapper.scrollLeft + eventDelta / 4 } @@ -37,12 +37,12 @@ } const tagsViewStore = useTagsViewStore() -const visitedViews = computed(() => tagsViewStore.visitedViews); +const visitedViews = computed(() => tagsViewStore.visitedViews) function moveToTarget(currentTag) { const $container = proxy.$refs.scrollContainer.$el const $containerWidth = $container.offsetWidth - const $scrollWrapper = scrollWrapper.value; + const $scrollWrapper = scrollWrapper.value let firstTag = null let lastTag = null @@ -58,17 +58,17 @@ } else if (lastTag === currentTag) { $scrollWrapper.scrollLeft = $scrollWrapper.scrollWidth - $containerWidth } else { - const tagListDom = document.getElementsByClassName('tags-view-item'); + const tagListDom = document.getElementsByClassName('tags-view-item') const currentIndex = visitedViews.value.findIndex(item => item === currentTag) let prevTag = null let nextTag = null for (const k in tagListDom) { if (k !== 'length' && Object.hasOwnProperty.call(tagListDom, k)) { if (tagListDom[k].dataset.path === visitedViews.value[currentIndex - 1].path) { - prevTag = tagListDom[k]; + prevTag = tagListDom[k] } if (tagListDom[k].dataset.path === visitedViews.value[currentIndex + 1].path) { - nextTag = tagListDom[k]; + nextTag = tagListDom[k] } } } diff --git a/src/layout/components/TagsView/index.vue b/src/layout/components/TagsView/index.vue index b8460a5..8aac500 100644 --- a/src/layout/components/TagsView/index.vue +++ b/src/layout/components/TagsView/index.vue @@ -48,20 +48,20 @@ import useSettingsStore from '@/store/modules/settings' import usePermissionStore from '@/store/modules/permission' -const visible = ref(false); -const top = ref(0); -const left = ref(0); -const selectedTag = ref({}); -const affixTags = ref([]); -const scrollPaneRef = ref(null); +const visible = ref(false) +const top = ref(0) +const left = ref(0) +const selectedTag = ref({}) +const affixTags = ref([]) +const scrollPaneRef = ref(null) -const { proxy } = getCurrentInstance(); -const route = useRoute(); -const router = useRouter(); +const { proxy } = getCurrentInstance() +const route = useRoute() +const router = useRouter() -const visitedViews = computed(() => useTagsViewStore().visitedViews); -const routes = computed(() => usePermissionStore().routes); -const theme = computed(() => useSettingsStore().theme); +const visitedViews = computed(() => useTagsViewStore().visitedViews) +const routes = computed(() => usePermissionStore().routes) +const theme = computed(() => useSettingsStore().theme) watch(route, () => { addTags() @@ -86,11 +86,11 @@ } function activeStyle(tag) { - if (!isActive(tag)) return {}; + if (!isActive(tag)) return {} return { "background-color": theme.value, "border-color": theme.value - }; + } } function isAffix(tag) { @@ -136,8 +136,8 @@ } function initTags() { - const res = filterAffixTags(routes.value); - affixTags.value = res; + const res = filterAffixTags(routes.value) + affixTags.value = res for (const tag of res) { // Must have tag name if (tag.name) { @@ -157,7 +157,7 @@ nextTick(() => { for (const r of visitedViews.value) { if (r.path === route.path) { - scrollPaneRef.value.moveToTarget(r); + scrollPaneRef.value.moveToTarget(r) // when query is different then update if (r.fullPath !== route.fullPath) { useTagsViewStore().updateVisitedView(route) @@ -168,9 +168,9 @@ } function refreshSelectedTag(view) { - proxy.$tab.refreshPage(view); + proxy.$tab.refreshPage(view) if (route.meta.link) { - useTagsViewStore().delIframeView(route); + useTagsViewStore().delIframeView(route) } } @@ -199,7 +199,7 @@ } function closeOthersTags() { - router.push(selectedTag.value).catch(() => { }); + router.push(selectedTag.value).catch(() => { }) proxy.$tab.closeOtherPage(selectedTag.value).then(() => { moveToCurrentTag() }) diff --git a/src/layout/index.vue b/src/layout/index.vue index 04c7ef2..67ac803 100644 --- a/src/layout/index.vue +++ b/src/layout/index.vue @@ -23,12 +23,12 @@ import useSettingsStore from '@/store/modules/settings' const settingsStore = useSettingsStore() -const theme = computed(() => settingsStore.theme); -const sideTheme = computed(() => settingsStore.sideTheme); -const sidebar = computed(() => useAppStore().sidebar); -const device = computed(() => useAppStore().device); -const needTagsView = computed(() => settingsStore.tagsView); -const fixedHeader = computed(() => settingsStore.fixedHeader); +const theme = computed(() => settingsStore.theme) +const sideTheme = computed(() => settingsStore.sideTheme) +const sidebar = computed(() => useAppStore().sidebar) +const device = computed(() => useAppStore().device) +const needTagsView = computed(() => settingsStore.tagsView) +const fixedHeader = computed(() => settingsStore.fixedHeader) const classObj = computed(() => ({ hideSidebar: !sidebar.value.opened, @@ -37,8 +37,8 @@ mobile: device.value === 'mobile' })) -const { width, height } = useWindowSize(); -const WIDTH = 992; // refer to Bootstrap's responsive design +const { width, height } = useWindowSize() +const WIDTH = 992 // refer to Bootstrap's responsive design watch(() => device.value, () => { if (device.value === 'mobile' && sidebar.value.opened) { @@ -59,9 +59,9 @@ useAppStore().closeSideBar({ withoutAnimation: false }) } -const settingRef = ref(null); +const settingRef = ref(null) function setLayout() { - settingRef.value.openSetting(); + settingRef.value.openSetting() } </script> diff --git a/src/plugins/auth.js b/src/plugins/auth.js index 5f38cfa..9b6ed1f 100644 --- a/src/plugins/auth.js +++ b/src/plugins/auth.js @@ -1,7 +1,7 @@ import useUserStore from '@/store/modules/user' function authPermission(permission) { - const all_permission = "*:*:*"; + const all_permission = "*:*:*" const permissions = useUserStore().permissions if (permission && permission.length > 0) { return permissions.some(v => { @@ -13,7 +13,7 @@ } function authRole(role) { - const super_admin = "admin"; + const super_admin = "admin" const roles = useUserStore().roles if (role && role.length > 0) { return roles.some(v => { @@ -27,7 +27,7 @@ export default { // 楠岃瘉鐢ㄦ埛鏄惁鍏峰鏌愭潈闄� hasPermi(permission) { - return authPermission(permission); + return authPermission(permission) }, // 楠岃瘉鐢ㄦ埛鏄惁鍚湁鎸囧畾鏉冮檺锛屽彧闇�鍖呭惈鍏朵腑涓�涓� hasPermiOr(permissions) { @@ -43,7 +43,7 @@ }, // 楠岃瘉鐢ㄦ埛鏄惁鍏峰鏌愯鑹� hasRole(role) { - return authRole(role); + return authRole(role) }, // 楠岃瘉鐢ㄦ埛鏄惁鍚湁鎸囧畾瑙掕壊锛屽彧闇�鍖呭惈鍏朵腑涓�涓� hasRoleOr(roles) { diff --git a/src/plugins/cache.js b/src/plugins/cache.js index e912c9a..4d29dfe 100644 --- a/src/plugins/cache.js +++ b/src/plugins/cache.js @@ -29,7 +29,7 @@ return null }, remove (key) { - sessionStorage.removeItem(key); + sessionStorage.removeItem(key) } } const localCache = { @@ -63,7 +63,7 @@ return null }, remove (key) { - localStorage.removeItem(key); + localStorage.removeItem(key) } } diff --git a/src/plugins/download.js b/src/plugins/download.js index d0f6b56..82e26ed 100644 --- a/src/plugins/download.js +++ b/src/plugins/download.js @@ -6,7 +6,7 @@ import { blobValidate } from '@/utils/ruoyi' const baseURL = import.meta.env.VITE_APP_BASE_API -let downloadLoadingInstance; +let downloadLoadingInstance export default { name(name, isDelete = true) { @@ -17,29 +17,29 @@ responseType: 'blob', headers: { 'Authorization': 'Bearer ' + getToken() } }).then((res) => { - const isBlob = blobValidate(res.data); + const isBlob = blobValidate(res.data) if (isBlob) { const blob = new Blob([res.data]) this.saveAs(blob, decodeURIComponent(res.headers['download-filename'])) } else { - this.printErrMsg(res.data); + this.printErrMsg(res.data) } }) }, resource(resource) { - var url = baseURL + "/common/download/resource?resource=" + encodeURIComponent(resource); + var url = baseURL + "/common/download/resource?resource=" + encodeURIComponent(resource) axios({ method: 'get', url: url, responseType: 'blob', headers: { 'Authorization': 'Bearer ' + getToken() } }).then((res) => { - const isBlob = blobValidate(res.data); + const isBlob = blobValidate(res.data) if (isBlob) { const blob = new Blob([res.data]) this.saveAs(blob, decodeURIComponent(res.headers['download-filename'])) } else { - this.printErrMsg(res.data); + this.printErrMsg(res.data) } }) }, @@ -52,28 +52,28 @@ responseType: 'blob', headers: { 'Authorization': 'Bearer ' + getToken() } }).then((res) => { - const isBlob = blobValidate(res.data); + const isBlob = blobValidate(res.data) if (isBlob) { const blob = new Blob([res.data], { type: 'application/zip' }) this.saveAs(blob, name) } else { - this.printErrMsg(res.data); + this.printErrMsg(res.data) } - downloadLoadingInstance.close(); + downloadLoadingInstance.close() }).catch((r) => { console.error(r) ElMessage.error('涓嬭浇鏂囦欢鍑虹幇閿欒锛岃鑱旂郴绠$悊鍛橈紒') - downloadLoadingInstance.close(); + downloadLoadingInstance.close() }) }, saveAs(text, name, opts) { - saveAs(text, name, opts); + saveAs(text, name, opts) }, async printErrMsg(data) { - const resText = await data.text(); - const rspObj = JSON.parse(resText); + const resText = await data.text() + const rspObj = JSON.parse(resText) const errMsg = errorCode[rspObj.code] || rspObj.msg || errorCode['default'] - ElMessage.error(errMsg); + ElMessage.error(errMsg) } } diff --git a/src/plugins/modal.js b/src/plugins/modal.js index 005b92e..8695360 100644 --- a/src/plugins/modal.js +++ b/src/plugins/modal.js @@ -1,6 +1,6 @@ import { ElMessage, ElMessageBox, ElNotification, ElLoading } from 'element-plus' -let loadingInstance; +let loadingInstance export default { // 娑堟伅鎻愮ず @@ -41,7 +41,7 @@ }, // 閿欒閫氱煡 notifyError(content) { - ElNotification.error(content); + ElNotification.error(content) }, // 鎴愬姛閫氱煡 notifySuccess(content) { @@ -77,6 +77,6 @@ }, // 鍏抽棴閬僵灞� closeLoading() { - loadingInstance.close(); + loadingInstance.close() } } diff --git a/src/plugins/tab.js b/src/plugins/tab.js index 004aa86..440271e 100644 --- a/src/plugins/tab.js +++ b/src/plugins/tab.js @@ -4,15 +4,15 @@ export default { // 鍒锋柊褰撳墠tab椤电 refreshPage(obj) { - const { path, query, matched } = router.currentRoute.value; + const { path, query, matched } = router.currentRoute.value if (obj === undefined) { matched.forEach((m) => { if (m.components && m.components.default && m.components.default.name) { if (!['Layout', 'ParentView'].includes(m.components.default.name)) { - obj = { name: m.components.default.name, path: path, query: query }; + obj = { name: m.components.default.name, path: path, query: query } } } - }); + }) } return useTagsViewStore().delCachedView(obj).then(() => { const { path, query } = obj @@ -24,9 +24,9 @@ }, // 鍏抽棴褰撳墠tab椤电锛屾墦寮�鏂伴〉绛� closeOpenPage(obj) { - useTagsViewStore().delView(router.currentRoute.value); + useTagsViewStore().delView(router.currentRoute.value) if (obj !== undefined) { - return router.push(obj); + return router.push(obj) } }, // 鍏抽棴鎸囧畾tab椤电 @@ -37,33 +37,33 @@ if (latestView) { return router.push(latestView.fullPath) } - return router.push('/'); - }); + return router.push('/') + }) } - return useTagsViewStore().delView(obj); + return useTagsViewStore().delView(obj) }, // 鍏抽棴鎵�鏈塼ab椤电 closeAllPage() { - return useTagsViewStore().delAllViews(); + return useTagsViewStore().delAllViews() }, // 鍏抽棴宸︿晶tab椤电 closeLeftPage(obj) { - return useTagsViewStore().delLeftTags(obj || router.currentRoute.value); + return useTagsViewStore().delLeftTags(obj || router.currentRoute.value) }, // 鍏抽棴鍙充晶tab椤电 closeRightPage(obj) { - return useTagsViewStore().delRightTags(obj || router.currentRoute.value); + return useTagsViewStore().delRightTags(obj || router.currentRoute.value) }, // 鍏抽棴鍏朵粬tab椤电 closeOtherPage(obj) { - return useTagsViewStore().delOthersViews(obj || router.currentRoute.value); + return useTagsViewStore().delOthersViews(obj || router.currentRoute.value) }, // 鎵撳紑tab椤电 openPage(url) { - return router.push(url); + return router.push(url) }, // 淇敼tab椤电 updatePage(obj) { - return useTagsViewStore().updateVisitedView(obj); + return useTagsViewStore().updateVisitedView(obj) } } diff --git a/src/router/index.js b/src/router/index.js index 80a843f..3c69a74 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -169,6 +169,6 @@ } return { top: 0 } }, -}); +}) -export default router; +export default router diff --git a/src/store/modules/app.js b/src/store/modules/app.js index 3b26cfe..71414be 100644 --- a/src/store/modules/app.js +++ b/src/store/modules/app.js @@ -15,7 +15,7 @@ actions: { toggleSideBar(withoutAnimation) { if (this.sidebar.hide) { - return false; + return false } this.sidebar.opened = !this.sidebar.opened this.sidebar.withoutAnimation = withoutAnimation @@ -34,7 +34,7 @@ this.device = device }, setSize(size) { - this.size = size; + this.size = size Cookies.set('size', size) }, toggleSideBarHide(status) { diff --git a/src/store/modules/dict.js b/src/store/modules/dict.js index 7e62a67..af1a3fa 100644 --- a/src/store/modules/dict.js +++ b/src/store/modules/dict.js @@ -8,16 +8,16 @@ // 鑾峰彇瀛楀吀 getDict(_key) { if (_key == null && _key == "") { - return null; + return null } try { for (let i = 0; i < this.dict.length; i++) { if (this.dict[i].key == _key) { - return this.dict[i].value; + return this.dict[i].value } } } catch (e) { - return null; + return null } }, // 璁剧疆瀛楀吀 @@ -26,27 +26,27 @@ this.dict.push({ key: _key, value: value - }); + }) } }, // 鍒犻櫎瀛楀吀 removeDict(_key) { - var bln = false; + var bln = false try { for (let i = 0; i < this.dict.length; i++) { if (this.dict[i].key == _key) { - this.dict.splice(i, 1); - return true; + this.dict.splice(i, 1) + return true } } } catch (e) { - bln = false; + bln = false } - return bln; + return bln }, // 娓呯┖瀛楀吀 cleanDict() { - this.dict = new Array(); + this.dict = new Array() }, // 鍒濆瀛楀吀 initDict() { diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index e1ef717..6a16d9d 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -114,11 +114,11 @@ } export const loadView = (view) => { - let res; + let res for (const path in modules) { - const dir = path.split('views/')[1].split('.vue')[0]; + const dir = path.split('views/')[1].split('.vue')[0] if (dir === view) { - res = () => modules[path](); + res = () => modules[path]() } } return res diff --git a/src/utils/dict.js b/src/utils/dict.js index 40d0691..a6db068 100644 --- a/src/utils/dict.js +++ b/src/utils/dict.js @@ -5,20 +5,20 @@ * 鑾峰彇瀛楀吀鏁版嵁 */ export function useDict(...args) { - const res = ref({}); + const res = ref({}) return (() => { args.forEach((dictType, index) => { - res.value[dictType] = []; - const dicts = useDictStore().getDict(dictType); + res.value[dictType] = [] + const dicts = useDictStore().getDict(dictType) if (dicts) { - res.value[dictType] = dicts; + res.value[dictType] = dicts } else { getDicts(dictType).then(resp => { res.value[dictType] = resp.data.map(p => ({ label: p.dictLabel, value: p.dictValue, elTagType: p.listClass, elTagClass: p.cssClass })) - useDictStore().setDict(dictType, res.value[dictType]); + useDictStore().setDict(dictType, res.value[dictType]) }) } }) - return toRefs(res.value); + return toRefs(res.value) })() } \ No newline at end of file diff --git a/src/utils/dynamicTitle.js b/src/utils/dynamicTitle.js index b55d6a1..2005758 100644 --- a/src/utils/dynamicTitle.js +++ b/src/utils/dynamicTitle.js @@ -6,10 +6,10 @@ * 鍔ㄦ�佷慨鏀规爣棰� */ export function useDynamicTitle() { - const settingsStore = useSettingsStore(); + const settingsStore = useSettingsStore() if (settingsStore.dynamicTitle) { - document.title = settingsStore.title + ' - ' + defaultSettings.title; + document.title = settingsStore.title + ' - ' + defaultSettings.title } else { - document.title = defaultSettings.title; + document.title = defaultSettings.title } } \ No newline at end of file diff --git a/src/utils/index.js b/src/utils/index.js index 9679e75..da79665 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -4,7 +4,7 @@ * 琛ㄦ牸鏃堕棿鏍煎紡鍖� */ export function formatDate(cellValue) { - if (cellValue == null || cellValue == "") return ""; + if (cellValue == null || cellValue == "") return "" var date = new Date(cellValue) var year = date.getFullYear() var month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1 diff --git a/src/utils/permission.js b/src/utils/permission.js index 93b772d..c736c0c 100644 --- a/src/utils/permission.js +++ b/src/utils/permission.js @@ -9,7 +9,7 @@ if (value && value instanceof Array && value.length > 0) { const permissions = useUserStore().permissions const permissionDatas = value - const all_permission = "*:*:*"; + const all_permission = "*:*:*" const hasPermission = permissions.some(permission => { return all_permission === permission || permissionDatas.includes(permission) @@ -34,7 +34,7 @@ if (value && value instanceof Array && value.length > 0) { const roles = useUserStore().roles const permissionRoles = value - const super_admin = "admin"; + const super_admin = "admin" const hasRole = roles.some(role => { return super_admin === role || permissionRoles.includes(role) diff --git a/src/utils/request.js b/src/utils/request.js index ce6382b..fe926f6 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -7,9 +7,9 @@ import { saveAs } from 'file-saver' import useUserStore from '@/store/modules/user' -let downloadLoadingInstance; +let downloadLoadingInstance // 鏄惁鏄剧ず閲嶆柊鐧诲綍 -export let isRelogin = { show: false }; +export let isRelogin = { show: false } axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8' // 鍒涘缓axios瀹炰緥 @@ -31,10 +31,10 @@ } // get璇锋眰鏄犲皠params鍙傛暟 if (config.method === 'get' && config.params) { - let url = config.url + '?' + tansParams(config.params); - url = url.slice(0, -1); - config.params = {}; - config.url = url; + let url = config.url + '?' + tansParams(config.params) + url = url.slice(0, -1) + config.params = {} + config.url = url } if (!isRepeatSubmit && (config.method === 'post' || config.method === 'put')) { const requestObj = { @@ -42,22 +42,22 @@ data: typeof config.data === 'object' ? JSON.stringify(config.data) : config.data, time: new Date().getTime() } - const requestSize = Object.keys(JSON.stringify(requestObj)).length; // 璇锋眰鏁版嵁澶у皬 - const limitSize = 5 * 1024 * 1024; // 闄愬埗瀛樻斁鏁版嵁5M + const requestSize = Object.keys(JSON.stringify(requestObj)).length // 璇锋眰鏁版嵁澶у皬 + const limitSize = 5 * 1024 * 1024 // 闄愬埗瀛樻斁鏁版嵁5M if (requestSize >= limitSize) { console.warn(`[${config.url}]: ` + '璇锋眰鏁版嵁澶у皬瓒呭嚭鍏佽鐨�5M闄愬埗锛屾棤娉曡繘琛岄槻閲嶅鎻愪氦楠岃瘉銆�') - return config; + return config } const sessionObj = cache.session.getJSON('sessionObj') if (sessionObj === undefined || sessionObj === null || sessionObj === '') { cache.session.setJSON('sessionObj', requestObj) } else { - const s_url = sessionObj.url; // 璇锋眰鍦板潃 - const s_data = sessionObj.data; // 璇锋眰鏁版嵁 - const s_time = sessionObj.time; // 璇锋眰鏃堕棿 - const interval = 1000; // 闂撮殧鏃堕棿(ms)锛屽皬浜庢鏃堕棿瑙嗕负閲嶅鎻愪氦 + const s_url = sessionObj.url // 璇锋眰鍦板潃 + const s_data = sessionObj.data // 璇锋眰鏁版嵁 + const s_time = sessionObj.time // 璇锋眰鏃堕棿 + const interval = 1000 // 闂撮殧鏃堕棿(ms)锛屽皬浜庢鏃堕棿瑙嗕负閲嶅鎻愪氦 if (s_data === requestObj.data && requestObj.time - s_time < interval && s_url === requestObj.url) { - const message = '鏁版嵁姝e湪澶勭悊锛岃鍕块噸澶嶆彁浜�'; + const message = '鏁版嵁姝e湪澶勭悊锛岃鍕块噸澶嶆彁浜�' console.warn(`[${s_url}]: ` + message) return Promise.reject(new Error(message)) } else { @@ -74,7 +74,7 @@ // 鍝嶅簲鎷︽埅鍣� service.interceptors.response.use(res => { // 鏈缃姸鎬佺爜鍒欓粯璁ゆ垚鍔熺姸鎬� - const code = res.data.code || 200; + const code = res.data.code || 200 // 鑾峰彇閿欒淇℃伅 const msg = errorCode[code] || res.data.msg || errorCode['default'] // 浜岃繘鍒舵暟鎹垯鐩存帴杩斿洖 @@ -83,15 +83,15 @@ } if (code === 401) { if (!isRelogin.show) { - isRelogin.show = true; + isRelogin.show = true ElMessageBox.confirm('鐧诲綍鐘舵�佸凡杩囨湡锛屾偍鍙互缁х画鐣欏湪璇ラ〉闈紝鎴栬�呴噸鏂扮櫥褰�', '绯荤粺鎻愮ず', { confirmButtonText: '閲嶆柊鐧诲綍', cancelButtonText: '鍙栨秷', type: 'warning' }).then(() => { - isRelogin.show = false; + isRelogin.show = false useUserStore().logOut().then(() => { - location.href = '/index'; + location.href = '/index' }) }).catch(() => { - isRelogin.show = false; - }); + isRelogin.show = false + }) } return Promise.reject('鏃犳晥鐨勪細璇濓紝鎴栬�呬細璇濆凡杩囨湡锛岃閲嶆柊鐧诲綍銆�') } else if (code === 500) { @@ -109,13 +109,13 @@ }, error => { console.log('err' + error) - let { message } = error; + let { message } = error if (message == "Network Error") { - message = "鍚庣鎺ュ彛杩炴帴寮傚父"; + message = "鍚庣鎺ュ彛杩炴帴寮傚父" } else if (message.includes("timeout")) { - message = "绯荤粺鎺ュ彛璇锋眰瓒呮椂"; + message = "绯荤粺鎺ュ彛璇锋眰瓒呮椂" } else if (message.includes("Request failed with status code")) { - message = "绯荤粺鎺ュ彛" + message.substr(message.length - 3) + "寮傚父"; + message = "绯荤粺鎺ュ彛" + message.substr(message.length - 3) + "寮傚父" } ElMessage({ message: message, type: 'error', duration: 5 * 1000 }) return Promise.reject(error) @@ -131,21 +131,21 @@ responseType: 'blob', ...config }).then(async (data) => { - const isBlob = blobValidate(data); + const isBlob = blobValidate(data) if (isBlob) { const blob = new Blob([data]) saveAs(blob, filename) } else { - const resText = await data.text(); - const rspObj = JSON.parse(resText); + const resText = await data.text() + const rspObj = JSON.parse(resText) const errMsg = errorCode[rspObj.code] || rspObj.msg || errorCode['default'] - ElMessage.error(errMsg); + ElMessage.error(errMsg) } - downloadLoadingInstance.close(); + downloadLoadingInstance.close() }).catch((r) => { console.error(r) ElMessage.error('涓嬭浇鏂囦欢鍑虹幇閿欒锛岃鑱旂郴绠$悊鍛橈紒') - downloadLoadingInstance.close(); + downloadLoadingInstance.close() }) } diff --git a/src/utils/ruoyi.js b/src/utils/ruoyi.js index 7aa9ab6..0d72c1a 100644 --- a/src/utils/ruoyi.js +++ b/src/utils/ruoyi.js @@ -16,7 +16,7 @@ if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) { time = parseInt(time) } else if (typeof time === 'string') { - time = time.replace(new RegExp(/-/gm), '/').replace('T', ' ').replace(new RegExp(/\.[\d]{3}/gm), ''); + time = time.replace(new RegExp(/-/gm), '/').replace('T', ' ').replace(new RegExp(/\.[\d]{3}/gm), '') } if ((typeof time === 'number') && (time.toString().length === 10)) { time = time * 1000 @@ -47,89 +47,89 @@ // 琛ㄥ崟閲嶇疆 export function resetForm(refName) { if (this.$refs[refName]) { - this.$refs[refName].resetFields(); + this.$refs[refName].resetFields() } } // 娣诲姞鏃ユ湡鑼冨洿 export function addDateRange(params, dateRange, propName) { - let search = params; - search.params = typeof (search.params) === 'object' && search.params !== null && !Array.isArray(search.params) ? search.params : {}; - dateRange = Array.isArray(dateRange) ? dateRange : []; + let search = params + search.params = typeof (search.params) === 'object' && search.params !== null && !Array.isArray(search.params) ? search.params : {} + dateRange = Array.isArray(dateRange) ? dateRange : [] if (typeof (propName) === 'undefined') { - search.params['beginTime'] = dateRange[0]; - search.params['endTime'] = dateRange[1]; + search.params['beginTime'] = dateRange[0] + search.params['endTime'] = dateRange[1] } else { - search.params['begin' + propName] = dateRange[0]; - search.params['end' + propName] = dateRange[1]; + search.params['begin' + propName] = dateRange[0] + search.params['end' + propName] = dateRange[1] } - return search; + return search } // 鍥炴樉鏁版嵁瀛楀吀 export function selectDictLabel(datas, value) { if (value === undefined) { - return ""; + return "" } - var actions = []; + var actions = [] Object.keys(datas).some((key) => { if (datas[key].value == ('' + value)) { - actions.push(datas[key].label); - return true; + actions.push(datas[key].label) + return true } }) if (actions.length === 0) { - actions.push(value); + actions.push(value) } - return actions.join(''); + return actions.join('') } // 鍥炴樉鏁版嵁瀛楀吀锛堝瓧绗︿覆銆佹暟缁勶級 export function selectDictLabels(datas, value, separator) { if (value === undefined || value.length ===0) { - return ""; + return "" } if (Array.isArray(value)) { - value = value.join(","); + value = value.join(",") } - var actions = []; - var currentSeparator = undefined === separator ? "," : separator; - var temp = value.split(currentSeparator); + var actions = [] + var currentSeparator = undefined === separator ? "," : separator + var temp = value.split(currentSeparator) Object.keys(value.split(currentSeparator)).some((val) => { - var match = false; + var match = false Object.keys(datas).some((key) => { if (datas[key].value == ('' + temp[val])) { - actions.push(datas[key].label + currentSeparator); - match = true; + actions.push(datas[key].label + currentSeparator) + match = true } }) if (!match) { - actions.push(temp[val] + currentSeparator); + actions.push(temp[val] + currentSeparator) } }) - return actions.join('').substring(0, actions.join('').length - 1); + return actions.join('').substring(0, actions.join('').length - 1) } // 瀛楃涓叉牸寮忓寲(%s ) export function sprintf(str) { - var args = arguments, flag = true, i = 1; + var args = arguments, flag = true, i = 1 str = str.replace(/%s/g, function () { - var arg = args[i++]; + var arg = args[i++] if (typeof arg === 'undefined') { - flag = false; - return ''; + flag = false + return '' } - return arg; - }); - return flag ? str : ''; + return arg + }) + return flag ? str : '' } // 杞崲瀛楃涓诧紝undefined,null绛夎浆鍖栦负"" export function parseStrEmpty(str) { if (!str || str == "undefined" || str == "null") { - return ""; + return "" } - return str; + return str } // 鏁版嵁鍚堝苟 @@ -137,16 +137,16 @@ for (var p in target) { try { if (target[p].constructor == Object) { - source[p] = mergeRecursive(source[p], target[p]); + source[p] = mergeRecursive(source[p], target[p]) } else { - source[p] = target[p]; + source[p] = target[p] } } catch (e) { - source[p] = target[p]; + source[p] = target[p] } } - return source; -}; + return source +} /** * 鏋勯�犳爲鍨嬬粨鏋勬暟鎹� @@ -160,15 +160,15 @@ id: id || 'id', parentId: parentId || 'parentId', childrenList: children || 'children' - }; + } - var childrenListMap = {}; - var tree = []; + var childrenListMap = {} + var tree = [] for (let d of data) { - let id = d[config.id]; - childrenListMap[id] = d; + let id = d[config.id] + childrenListMap[id] = d if (!d[config.childrenList]) { - d[config.childrenList] = []; + d[config.childrenList] = [] } } @@ -176,12 +176,12 @@ let parentId = d[config.parentId] let parentObj = childrenListMap[parentId] if (!parentObj) { - tree.push(d); + tree.push(d) } else { parentObj[config.childrenList].push(d) } } - return tree; + return tree } /** @@ -191,19 +191,19 @@ export function tansParams(params) { let result = '' for (const propName of Object.keys(params)) { - const value = params[propName]; - var part = encodeURIComponent(propName) + "="; + const value = params[propName] + var part = encodeURIComponent(propName) + "=" if (value !== null && value !== "" && typeof (value) !== "undefined") { if (typeof value === 'object') { for (const key of Object.keys(value)) { if (value[key] !== null && value[key] !== "" && typeof (value[key]) !== 'undefined') { - let params = propName + '[' + key + ']'; - var subPart = encodeURIComponent(params) + "="; - result += subPart + encodeURIComponent(value[key]) + "&"; + let params = propName + '[' + key + ']' + var subPart = encodeURIComponent(params) + "=" + result += subPart + encodeURIComponent(value[key]) + "&" } } } else { - result += part + encodeURIComponent(value) + "&"; + result += part + encodeURIComponent(value) + "&" } } } @@ -214,7 +214,7 @@ export function getNormalPath(p) { if (p.length === 0 || !p || p == 'undefined') { return p - }; + } let res = p.replace('//', '/') if (res[res.length - 1] === '/') { return res.slice(0, res.length - 1) diff --git a/src/views/error/401.vue b/src/views/error/401.vue index c656dee..2bc8922 100644 --- a/src/views/error/401.vue +++ b/src/views/error/401.vue @@ -26,17 +26,17 @@ </template> <script setup> -import errImage from "@/assets/401_images/401.gif"; +import errImage from "@/assets/401_images/401.gif" -let { proxy } = getCurrentInstance(); +let { proxy } = getCurrentInstance() -const errGif = ref(errImage + "?" + +new Date()); +const errGif = ref(errImage + "?" + +new Date()) function back() { if (proxy.$route.query.noGoBack) { - proxy.$router.push({ path: "/" }); + proxy.$router.push({ path: "/" }) } else { - proxy.$router.go(-1); + proxy.$router.go(-1) } } </script> diff --git a/src/views/login.vue b/src/views/login.vue index e6856a0..4ac6e3e 100644 --- a/src/views/login.vue +++ b/src/views/login.vue @@ -65,16 +65,16 @@ </template> <script setup> -import { getCodeImg } from "@/api/login"; -import Cookies from "js-cookie"; -import { encrypt, decrypt } from "@/utils/jsencrypt"; +import { getCodeImg } from "@/api/login" +import Cookies from "js-cookie" +import { encrypt, decrypt } from "@/utils/jsencrypt" import useUserStore from '@/store/modules/user' -const title = import.meta.env.VITE_APP_TITLE; -const userStore = useUserStore(); -const route = useRoute(); -const router = useRouter(); -const { proxy } = getCurrentInstance(); +const title = import.meta.env.VITE_APP_TITLE +const userStore = useUserStore() +const route = useRoute() +const router = useRouter() +const { proxy } = getCurrentInstance() const loginForm = ref({ username: "admin", @@ -82,85 +82,85 @@ rememberMe: false, code: "", uuid: "" -}); +}) const loginRules = { username: [{ required: true, trigger: "blur", message: "璇疯緭鍏ユ偍鐨勮处鍙�" }], password: [{ required: true, trigger: "blur", message: "璇疯緭鍏ユ偍鐨勫瘑鐮�" }], code: [{ required: true, trigger: "change", message: "璇疯緭鍏ラ獙璇佺爜" }] -}; +} -const codeUrl = ref(""); -const loading = ref(false); +const codeUrl = ref("") +const loading = ref(false) // 楠岃瘉鐮佸紑鍏� -const captchaEnabled = ref(true); +const captchaEnabled = ref(true) // 娉ㄥ唽寮�鍏� -const register = ref(false); -const redirect = ref(undefined); +const register = ref(false) +const redirect = ref(undefined) watch(route, (newRoute) => { - redirect.value = newRoute.query && newRoute.query.redirect; -}, { immediate: true }); + redirect.value = newRoute.query && newRoute.query.redirect +}, { immediate: true }) function handleLogin() { proxy.$refs.loginRef.validate(valid => { if (valid) { - loading.value = true; + loading.value = true // 鍕鹃�変簡闇�瑕佽浣忓瘑鐮佽缃湪 cookie 涓缃浣忕敤鎴峰悕鍜屽瘑鐮� if (loginForm.value.rememberMe) { - Cookies.set("username", loginForm.value.username, { expires: 30 }); - Cookies.set("password", encrypt(loginForm.value.password), { expires: 30 }); - Cookies.set("rememberMe", loginForm.value.rememberMe, { expires: 30 }); + Cookies.set("username", loginForm.value.username, { expires: 30 }) + Cookies.set("password", encrypt(loginForm.value.password), { expires: 30 }) + Cookies.set("rememberMe", loginForm.value.rememberMe, { expires: 30 }) } else { // 鍚﹀垯绉婚櫎 - Cookies.remove("username"); - Cookies.remove("password"); - Cookies.remove("rememberMe"); + Cookies.remove("username") + Cookies.remove("password") + Cookies.remove("rememberMe") } // 璋冪敤action鐨勭櫥褰曟柟娉� userStore.login(loginForm.value).then(() => { - const query = route.query; + const query = route.query const otherQueryParams = Object.keys(query).reduce((acc, cur) => { if (cur !== "redirect") { - acc[cur] = query[cur]; + acc[cur] = query[cur] } - return acc; - }, {}); - router.push({ path: redirect.value || "/", query: otherQueryParams }); + return acc + }, {}) + router.push({ path: redirect.value || "/", query: otherQueryParams }) }).catch(() => { - loading.value = false; + loading.value = false // 閲嶆柊鑾峰彇楠岃瘉鐮� if (captchaEnabled.value) { - getCode(); + getCode() } - }); + }) } - }); + }) } function getCode() { getCodeImg().then(res => { - captchaEnabled.value = res.captchaEnabled === undefined ? true : res.captchaEnabled; + captchaEnabled.value = res.captchaEnabled === undefined ? true : res.captchaEnabled if (captchaEnabled.value) { - codeUrl.value = "data:image/gif;base64," + res.img; - loginForm.value.uuid = res.uuid; + codeUrl.value = "data:image/gif;base64," + res.img + loginForm.value.uuid = res.uuid } - }); + }) } function getCookie() { - const username = Cookies.get("username"); - const password = Cookies.get("password"); - const rememberMe = Cookies.get("rememberMe"); + const username = Cookies.get("username") + const password = Cookies.get("password") + const rememberMe = Cookies.get("rememberMe") loginForm.value = { username: username === undefined ? loginForm.value.username : username, password: password === undefined ? loginForm.value.password : decrypt(password), rememberMe: rememberMe === undefined ? false : Boolean(rememberMe) - }; + } } -getCode(); -getCookie(); +getCode() +getCookie() </script> <style lang='scss' scoped> diff --git a/src/views/monitor/cache/index.vue b/src/views/monitor/cache/index.vue index d00fb2f..b351fa9 100644 --- a/src/views/monitor/cache/index.vue +++ b/src/views/monitor/cache/index.vue @@ -65,21 +65,21 @@ </template> <script setup name="Cache"> -import { getCache } from '@/api/monitor/cache'; -import * as echarts from 'echarts'; +import { getCache } from '@/api/monitor/cache' +import * as echarts from 'echarts' -const cache = ref([]); -const commandstats = ref(null); -const usedmemory = ref(null); -const { proxy } = getCurrentInstance(); +const cache = ref([]) +const commandstats = ref(null) +const usedmemory = ref(null) +const { proxy } = getCurrentInstance() function getList() { - proxy.$modal.loading("姝e湪鍔犺浇缂撳瓨鐩戞帶鏁版嵁锛岃绋嶅�欙紒"); + proxy.$modal.loading("姝e湪鍔犺浇缂撳瓨鐩戞帶鏁版嵁锛岃绋嶅�欙紒") getCache().then(response => { - proxy.$modal.closeLoading(); - cache.value = response.data; + proxy.$modal.closeLoading() + cache.value = response.data - const commandstatsIntance = echarts.init(commandstats.value, "macarons"); + const commandstatsIntance = echarts.init(commandstats.value, "macarons") commandstatsIntance.setOption({ tooltip: { trigger: "item", @@ -97,8 +97,8 @@ animationDuration: 1000 } ] - }); - const usedmemoryInstance = echarts.init(usedmemory.value, "macarons"); + }) + const usedmemoryInstance = echarts.init(usedmemory.value, "macarons") usedmemoryInstance.setOption({ tooltip: { formatter: "{b} <br/>{a} : " + cache.value.info.used_memory_human @@ -122,11 +122,11 @@ ] }) window.addEventListener("resize", () => { - commandstatsIntance.resize(); - usedmemoryInstance.resize(); - }); + commandstatsIntance.resize() + usedmemoryInstance.resize() + }) }) } -getList(); +getList() </script> diff --git a/src/views/monitor/cache/list.vue b/src/views/monitor/cache/list.vue index c508129..77baec4 100644 --- a/src/views/monitor/cache/list.vue +++ b/src/views/monitor/cache/list.vue @@ -155,92 +155,92 @@ </template> <script setup name="CacheList"> -import { listCacheName, listCacheKey, getCacheValue, clearCacheName, clearCacheKey, clearCacheAll } from "@/api/monitor/cache"; +import { listCacheName, listCacheKey, getCacheValue, clearCacheName, clearCacheKey, clearCacheAll } from "@/api/monitor/cache" -const { proxy } = getCurrentInstance(); +const { proxy } = getCurrentInstance() -const cacheNames = ref([]); -const cacheKeys = ref([]); -const cacheForm = ref({}); -const loading = ref(true); -const subLoading = ref(false); -const nowCacheName = ref(""); -const tableHeight = ref(window.innerHeight - 200); +const cacheNames = ref([]) +const cacheKeys = ref([]) +const cacheForm = ref({}) +const loading = ref(true) +const subLoading = ref(false) +const nowCacheName = ref("") +const tableHeight = ref(window.innerHeight - 200) /** 鏌ヨ缂撳瓨鍚嶇О鍒楄〃 */ function getCacheNames() { - loading.value = true; + loading.value = true listCacheName().then(response => { - cacheNames.value = response.data; - loading.value = false; - }); + cacheNames.value = response.data + loading.value = false + }) } /** 鍒锋柊缂撳瓨鍚嶇О鍒楄〃 */ function refreshCacheNames() { - getCacheNames(); - proxy.$modal.msgSuccess("鍒锋柊缂撳瓨鍒楄〃鎴愬姛"); + getCacheNames() + proxy.$modal.msgSuccess("鍒锋柊缂撳瓨鍒楄〃鎴愬姛") } /** 娓呯悊鎸囧畾鍚嶇О缂撳瓨 */ function handleClearCacheName(row) { clearCacheName(row.cacheName).then(response => { - proxy.$modal.msgSuccess("娓呯悊缂撳瓨鍚嶇О[" + row.cacheName + "]鎴愬姛"); - getCacheKeys(); - }); + proxy.$modal.msgSuccess("娓呯悊缂撳瓨鍚嶇О[" + row.cacheName + "]鎴愬姛") + getCacheKeys() + }) } /** 鏌ヨ缂撳瓨閿悕鍒楄〃 */ function getCacheKeys(row) { - const cacheName = row !== undefined ? row.cacheName : nowCacheName.value; + const cacheName = row !== undefined ? row.cacheName : nowCacheName.value if (cacheName === "") { - return; + return } - subLoading.value = true; + subLoading.value = true listCacheKey(cacheName).then(response => { - cacheKeys.value = response.data; - subLoading.value = false; - nowCacheName.value = cacheName; - }); + cacheKeys.value = response.data + subLoading.value = false + nowCacheName.value = cacheName + }) } /** 鍒锋柊缂撳瓨閿悕鍒楄〃 */ function refreshCacheKeys() { - getCacheKeys(); - proxy.$modal.msgSuccess("鍒锋柊閿悕鍒楄〃鎴愬姛"); + getCacheKeys() + proxy.$modal.msgSuccess("鍒锋柊閿悕鍒楄〃鎴愬姛") } /** 娓呯悊鎸囧畾閿悕缂撳瓨 */ function handleClearCacheKey(cacheKey) { clearCacheKey(cacheKey).then(response => { - proxy.$modal.msgSuccess("娓呯悊缂撳瓨閿悕[" + cacheKey + "]鎴愬姛"); - getCacheKeys(); - }); + proxy.$modal.msgSuccess("娓呯悊缂撳瓨閿悕[" + cacheKey + "]鎴愬姛") + getCacheKeys() + }) } /** 鍒楄〃鍓嶇紑鍘婚櫎 */ function nameFormatter(row) { - return row.cacheName.replace(":", ""); + return row.cacheName.replace(":", "") } /** 閿悕鍓嶇紑鍘婚櫎 */ function keyFormatter(cacheKey) { - return cacheKey.replace(nowCacheName.value, ""); + return cacheKey.replace(nowCacheName.value, "") } /** 鏌ヨ缂撳瓨鍐呭璇︾粏 */ function handleCacheValue(cacheKey) { getCacheValue(nowCacheName.value, cacheKey).then(response => { - cacheForm.value = response.data; - }); + cacheForm.value = response.data + }) } /** 娓呯悊鍏ㄩ儴缂撳瓨 */ function handleClearCacheAll() { clearCacheAll().then(response => { - proxy.$modal.msgSuccess("娓呯悊鍏ㄩ儴缂撳瓨鎴愬姛"); - }); + proxy.$modal.msgSuccess("娓呯悊鍏ㄩ儴缂撳瓨鎴愬姛") + }) } -getCacheNames(); +getCacheNames() </script> diff --git a/src/views/monitor/druid/index.vue b/src/views/monitor/druid/index.vue index 124a92d..1faaead 100644 --- a/src/views/monitor/druid/index.vue +++ b/src/views/monitor/druid/index.vue @@ -7,7 +7,7 @@ <script setup> import iFrame from '@/components/iFrame' -import { ref } from 'vue'; +import { ref } from 'vue' -const url = ref(import.meta.env.VITE_APP_BASE_API + '/druid/login.html'); +const url = ref(import.meta.env.VITE_APP_BASE_API + '/druid/login.html') </script> diff --git a/src/views/monitor/job/index.vue b/src/views/monitor/job/index.vue index 77a472a..ee291a4 100644 --- a/src/views/monitor/job/index.vue +++ b/src/views/monitor/job/index.vue @@ -285,24 +285,24 @@ </template> <script setup name="Job"> -import { listJob, getJob, delJob, addJob, updateJob, runJob, changeJobStatus } from "@/api/monitor/job"; +import { listJob, getJob, delJob, addJob, updateJob, runJob, changeJobStatus } from "@/api/monitor/job" import Crontab from '@/components/Crontab' -const router = useRouter(); -const { proxy } = getCurrentInstance(); -const { sys_job_group, sys_job_status } = proxy.useDict("sys_job_group", "sys_job_status"); +const router = useRouter() +const { proxy } = getCurrentInstance() +const { sys_job_group, sys_job_status } = proxy.useDict("sys_job_group", "sys_job_status") -const jobList = ref([]); -const open = ref(false); -const loading = ref(true); -const showSearch = ref(true); -const ids = ref([]); -const single = ref(true); -const multiple = ref(true); -const total = ref(0); -const title = ref(""); -const openView = ref(false); -const openCron = ref(false); -const expression = ref(""); +const jobList = ref([]) +const open = ref(false) +const loading = ref(true) +const showSearch = ref(true) +const ids = ref([]) +const single = ref(true) +const multiple = ref(true) +const total = ref(0) +const title = ref("") +const openView = ref(false) +const openCron = ref(false) +const expression = ref("") const data = reactive({ form: {}, @@ -318,29 +318,29 @@ invokeTarget: [{ required: true, message: "璋冪敤鐩爣瀛楃涓蹭笉鑳戒负绌�", trigger: "blur" }], cronExpression: [{ required: true, message: "cron鎵ц琛ㄨ揪寮忎笉鑳戒负绌�", trigger: "change" }] } -}); +}) -const { queryParams, form, rules } = toRefs(data); +const { queryParams, form, rules } = toRefs(data) /** 鏌ヨ瀹氭椂浠诲姟鍒楄〃 */ function getList() { - loading.value = true; + loading.value = true listJob(queryParams.value).then(response => { - jobList.value = response.rows; - total.value = response.total; - loading.value = false; - }); + jobList.value = response.rows + total.value = response.total + loading.value = false + }) } /** 浠诲姟缁勫悕瀛楀吀缈昏瘧 */ function jobGroupFormat(row, column) { - return proxy.selectDictLabel(sys_job_group.value, row.jobGroup); + return proxy.selectDictLabel(sys_job_group.value, row.jobGroup) } /** 鍙栨秷鎸夐挳 */ function cancel() { - open.value = false; - reset(); + open.value = false + reset() } /** 琛ㄥ崟閲嶇疆 */ @@ -354,108 +354,108 @@ misfirePolicy: 1, concurrent: 1, status: "0" - }; - proxy.resetForm("jobRef"); + } + proxy.resetForm("jobRef") } /** 鎼滅储鎸夐挳鎿嶄綔 */ function handleQuery() { - queryParams.value.pageNum = 1; - getList(); + queryParams.value.pageNum = 1 + getList() } /** 閲嶇疆鎸夐挳鎿嶄綔 */ function resetQuery() { - proxy.resetForm("queryRef"); - handleQuery(); + proxy.resetForm("queryRef") + handleQuery() } // 澶氶�夋閫変腑鏁版嵁 function handleSelectionChange(selection) { - ids.value = selection.map(item => item.jobId); - single.value = selection.length != 1; - multiple.value = !selection.length; + ids.value = selection.map(item => item.jobId) + single.value = selection.length != 1 + multiple.value = !selection.length } // 鏇村鎿嶄綔瑙﹀彂 function handleCommand(command, row) { switch (command) { case "handleRun": - handleRun(row); - break; + handleRun(row) + break case "handleView": - handleView(row); - break; + handleView(row) + break case "handleJobLog": - handleJobLog(row); - break; + handleJobLog(row) + break default: - break; + break } } // 浠诲姟鐘舵�佷慨鏀� function handleStatusChange(row) { - let text = row.status === "0" ? "鍚敤" : "鍋滅敤"; + let text = row.status === "0" ? "鍚敤" : "鍋滅敤" proxy.$modal.confirm('纭瑕�"' + text + '""' + row.jobName + '"浠诲姟鍚�?').then(function () { - return changeJobStatus(row.jobId, row.status); + return changeJobStatus(row.jobId, row.status) }).then(() => { - proxy.$modal.msgSuccess(text + "鎴愬姛"); + proxy.$modal.msgSuccess(text + "鎴愬姛") }).catch(function () { - row.status = row.status === "0" ? "1" : "0"; - }); + row.status = row.status === "0" ? "1" : "0" + }) } /* 绔嬪嵆鎵ц涓�娆� */ function handleRun(row) { proxy.$modal.confirm('纭瑕佺珛鍗虫墽琛屼竴娆�"' + row.jobName + '"浠诲姟鍚�?').then(function () { - return runJob(row.jobId, row.jobGroup); + return runJob(row.jobId, row.jobGroup) }).then(() => { - proxy.$modal.msgSuccess("鎵ц鎴愬姛");}) - .catch(() => {}); + proxy.$modal.msgSuccess("鎵ц鎴愬姛")}) + .catch(() => {}) } /** 浠诲姟璇︾粏淇℃伅 */ function handleView(row) { getJob(row.jobId).then(response => { - form.value = response.data; - openView.value = true; - }); + form.value = response.data + openView.value = true + }) } /** cron琛ㄨ揪寮忔寜閽搷浣� */ function handleShowCron() { - expression.value = form.value.cronExpression; - openCron.value = true; + expression.value = form.value.cronExpression + openCron.value = true } /** 纭畾鍚庡洖浼犲�� */ function crontabFill(value) { - form.value.cronExpression = value; + form.value.cronExpression = value } /** 浠诲姟鏃ュ織鍒楄〃鏌ヨ */ function handleJobLog(row) { - const jobId = row.jobId || 0; + const jobId = row.jobId || 0 router.push('/monitor/job-log/index/' + jobId) } /** 鏂板鎸夐挳鎿嶄綔 */ function handleAdd() { - reset(); - open.value = true; - title.value = "娣诲姞浠诲姟"; + reset() + open.value = true + title.value = "娣诲姞浠诲姟" } /** 淇敼鎸夐挳鎿嶄綔 */ function handleUpdate(row) { - reset(); - const jobId = row.jobId || ids.value; + reset() + const jobId = row.jobId || ids.value getJob(jobId).then(response => { - form.value = response.data; - open.value = true; - title.value = "淇敼浠诲姟"; - }); + form.value = response.data + open.value = true + title.value = "淇敼浠诲姟" + }) } /** 鎻愪氦鎸夐挳 */ @@ -464,38 +464,38 @@ if (valid) { if (form.value.jobId != undefined) { updateJob(form.value).then(response => { - proxy.$modal.msgSuccess("淇敼鎴愬姛"); - open.value = false; - getList(); - }); + proxy.$modal.msgSuccess("淇敼鎴愬姛") + open.value = false + getList() + }) } else { addJob(form.value).then(response => { - proxy.$modal.msgSuccess("鏂板鎴愬姛"); - open.value = false; - getList(); - }); + proxy.$modal.msgSuccess("鏂板鎴愬姛") + open.value = false + getList() + }) } } - }); + }) } /** 鍒犻櫎鎸夐挳鎿嶄綔 */ function handleDelete(row) { - const jobIds = row.jobId || ids.value; + const jobIds = row.jobId || ids.value proxy.$modal.confirm('鏄惁纭鍒犻櫎瀹氭椂浠诲姟缂栧彿涓�"' + jobIds + '"鐨勬暟鎹」?').then(function () { - return delJob(jobIds); + return delJob(jobIds) }).then(() => { - getList(); - proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛"); - }).catch(() => {}); + getList() + proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛") + }).catch(() => {}) } /** 瀵煎嚭鎸夐挳鎿嶄綔 */ function handleExport() { proxy.download("monitor/job/export", { ...queryParams.value, - }, `job_${new Date().getTime()}.xlsx`); + }, `job_${new Date().getTime()}.xlsx`) } -getList(); +getList() </script> diff --git a/src/views/monitor/job/log.vue b/src/views/monitor/job/log.vue index b6b3aca..b425e45 100644 --- a/src/views/monitor/job/log.vue +++ b/src/views/monitor/job/log.vue @@ -171,21 +171,21 @@ </template> <script setup name="JobLog"> -import { getJob } from "@/api/monitor/job"; -import { listJobLog, delJobLog, cleanJobLog } from "@/api/monitor/jobLog"; +import { getJob } from "@/api/monitor/job" +import { listJobLog, delJobLog, cleanJobLog } from "@/api/monitor/jobLog" -const { proxy } = getCurrentInstance(); -const { sys_common_status, sys_job_group } = proxy.useDict("sys_common_status", "sys_job_group"); +const { proxy } = getCurrentInstance() +const { sys_common_status, sys_job_group } = proxy.useDict("sys_common_status", "sys_job_group") -const jobLogList = ref([]); -const open = ref(false); -const loading = ref(true); -const showSearch = ref(true); -const ids = ref([]); -const multiple = ref(true); -const total = ref(0); -const dateRange = ref([]); -const route = useRoute(); +const jobLogList = ref([]) +const open = ref(false) +const loading = ref(true) +const showSearch = ref(true) +const ids = ref([]) +const multiple = ref(true) +const total = ref(0) +const dateRange = ref([]) +const route = useRoute() const data = reactive({ form: {}, @@ -196,88 +196,88 @@ dictType: undefined, status: undefined } -}); +}) -const { queryParams, form, rules } = toRefs(data); +const { queryParams, form, rules } = toRefs(data) /** 鏌ヨ璋冨害鏃ュ織鍒楄〃 */ function getList() { - loading.value = true; + loading.value = true listJobLog(proxy.addDateRange(queryParams.value, dateRange.value)).then(response => { - jobLogList.value = response.rows; - total.value = response.total; - loading.value = false; - }); + jobLogList.value = response.rows + total.value = response.total + loading.value = false + }) } // 杩斿洖鎸夐挳 function handleClose() { - const obj = { path: "/monitor/job" }; - proxy.$tab.closeOpenPage(obj); + const obj = { path: "/monitor/job" } + proxy.$tab.closeOpenPage(obj) } /** 鎼滅储鎸夐挳鎿嶄綔 */ function handleQuery() { - queryParams.value.pageNum = 1; - getList(); + queryParams.value.pageNum = 1 + getList() } /** 閲嶇疆鎸夐挳鎿嶄綔 */ function resetQuery() { - dateRange.value = []; - proxy.resetForm("queryRef"); - handleQuery(); + dateRange.value = [] + proxy.resetForm("queryRef") + handleQuery() } // 澶氶�夋閫変腑鏁版嵁 function handleSelectionChange(selection) { - ids.value = selection.map(item => item.jobLogId); - multiple.value = !selection.length; + ids.value = selection.map(item => item.jobLogId) + multiple.value = !selection.length } /** 璇︾粏鎸夐挳鎿嶄綔 */ function handleView(row) { - open.value = true; - form.value = row; + open.value = true + form.value = row } /** 鍒犻櫎鎸夐挳鎿嶄綔 */ function handleDelete(row) { proxy.$modal.confirm('鏄惁纭鍒犻櫎璋冨害鏃ュ織缂栧彿涓�"' + ids.value + '"鐨勬暟鎹」?').then(function () { - return delJobLog(ids.value); + return delJobLog(ids.value) }).then(() => { - getList(); - proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛"); - }).catch(() => {}); + getList() + proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛") + }).catch(() => {}) } /** 娓呯┖鎸夐挳鎿嶄綔 */ function handleClean() { proxy.$modal.confirm("鏄惁纭娓呯┖鎵�鏈夎皟搴︽棩蹇楁暟鎹」?").then(function () { - return cleanJobLog(); + return cleanJobLog() }).then(() => { - getList(); - proxy.$modal.msgSuccess("娓呯┖鎴愬姛"); - }).catch(() => {}); + getList() + proxy.$modal.msgSuccess("娓呯┖鎴愬姛") + }).catch(() => {}) } /** 瀵煎嚭鎸夐挳鎿嶄綔 */ function handleExport() { proxy.download("monitor/jobLog/export", { ...queryParams.value, - }, `job_log_${new Date().getTime()}.xlsx`); + }, `job_log_${new Date().getTime()}.xlsx`) } (() => { - const jobId = route.params && route.params.jobId; + const jobId = route.params && route.params.jobId if (jobId !== undefined && jobId != 0) { getJob(jobId).then(response => { - queryParams.value.jobName = response.data.jobName; - queryParams.value.jobGroup = response.data.jobGroup; - getList(); - }); + queryParams.value.jobName = response.data.jobName + queryParams.value.jobGroup = response.data.jobGroup + getList() + }) } else { - getList(); + getList() } -})(); +})() </script> diff --git a/src/views/monitor/logininfor/index.vue b/src/views/monitor/logininfor/index.vue index c5101a2..aa42b52 100644 --- a/src/views/monitor/logininfor/index.vue +++ b/src/views/monitor/logininfor/index.vue @@ -125,21 +125,21 @@ </template> <script setup name="Logininfor"> -import { list, delLogininfor, cleanLogininfor, unlockLogininfor } from "@/api/monitor/logininfor"; +import { list, delLogininfor, cleanLogininfor, unlockLogininfor } from "@/api/monitor/logininfor" -const { proxy } = getCurrentInstance(); -const { sys_common_status } = proxy.useDict("sys_common_status"); +const { proxy } = getCurrentInstance() +const { sys_common_status } = proxy.useDict("sys_common_status") -const logininforList = ref([]); -const loading = ref(true); -const showSearch = ref(true); -const ids = ref([]); -const single = ref(true); -const multiple = ref(true); -const selectName = ref(""); -const total = ref(0); -const dateRange = ref([]); -const defaultSort = ref({ prop: "loginTime", order: "descending" }); +const logininforList = ref([]) +const loading = ref(true) +const showSearch = ref(true) +const ids = ref([]) +const single = ref(true) +const multiple = ref(true) +const selectName = ref("") +const total = ref(0) +const dateRange = ref([]) +const defaultSort = ref({ prop: "loginTime", order: "descending" }) // 鏌ヨ鍙傛暟 const queryParams = ref({ @@ -150,84 +150,84 @@ status: undefined, orderByColumn: undefined, isAsc: undefined -}); +}) /** 鏌ヨ鐧诲綍鏃ュ織鍒楄〃 */ function getList() { - loading.value = true; + loading.value = true list(proxy.addDateRange(queryParams.value, dateRange.value)).then(response => { - logininforList.value = response.rows; - total.value = response.total; - loading.value = false; - }); + logininforList.value = response.rows + total.value = response.total + loading.value = false + }) } /** 鎼滅储鎸夐挳鎿嶄綔 */ function handleQuery() { - queryParams.value.pageNum = 1; - getList(); + queryParams.value.pageNum = 1 + getList() } /** 閲嶇疆鎸夐挳鎿嶄綔 */ function resetQuery() { - dateRange.value = []; - proxy.resetForm("queryRef"); - queryParams.value.pageNum = 1; - proxy.$refs["logininforRef"].sort(defaultSort.value.prop, defaultSort.value.order); + dateRange.value = [] + proxy.resetForm("queryRef") + queryParams.value.pageNum = 1 + proxy.$refs["logininforRef"].sort(defaultSort.value.prop, defaultSort.value.order) } /** 澶氶�夋閫変腑鏁版嵁 */ function handleSelectionChange(selection) { - ids.value = selection.map(item => item.infoId); - multiple.value = !selection.length; - single.value = selection.length != 1; - selectName.value = selection.map(item => item.userName); + ids.value = selection.map(item => item.infoId) + multiple.value = !selection.length + single.value = selection.length != 1 + selectName.value = selection.map(item => item.userName) } /** 鎺掑簭瑙﹀彂浜嬩欢 */ function handleSortChange(column, prop, order) { - queryParams.value.orderByColumn = column.prop; - queryParams.value.isAsc = column.order; - getList(); + queryParams.value.orderByColumn = column.prop + queryParams.value.isAsc = column.order + getList() } /** 鍒犻櫎鎸夐挳鎿嶄綔 */ function handleDelete(row) { - const infoIds = row.infoId || ids.value; + const infoIds = row.infoId || ids.value proxy.$modal.confirm('鏄惁纭鍒犻櫎璁块棶缂栧彿涓�"' + infoIds + '"鐨勬暟鎹」?').then(function () { - return delLogininfor(infoIds); + return delLogininfor(infoIds) }).then(() => { - getList(); - proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛"); - }).catch(() => {}); + getList() + proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛") + }).catch(() => {}) } /** 娓呯┖鎸夐挳鎿嶄綔 */ function handleClean() { proxy.$modal.confirm("鏄惁纭娓呯┖鎵�鏈夌櫥褰曟棩蹇楁暟鎹」?").then(function () { - return cleanLogininfor(); + return cleanLogininfor() }).then(() => { - getList(); - proxy.$modal.msgSuccess("娓呯┖鎴愬姛"); - }).catch(() => {}); + getList() + proxy.$modal.msgSuccess("娓呯┖鎴愬姛") + }).catch(() => {}) } /** 瑙i攣鎸夐挳鎿嶄綔 */ function handleUnlock() { - const username = selectName.value; + const username = selectName.value proxy.$modal.confirm('鏄惁纭瑙i攣鐢ㄦ埛"' + username + '"鏁版嵁椤�?').then(function () { - return unlockLogininfor(username); + return unlockLogininfor(username) }).then(() => { - proxy.$modal.msgSuccess("鐢ㄦ埛" + username + "瑙i攣鎴愬姛"); - }).catch(() => {}); + proxy.$modal.msgSuccess("鐢ㄦ埛" + username + "瑙i攣鎴愬姛") + }).catch(() => {}) } /** 瀵煎嚭鎸夐挳鎿嶄綔 */ function handleExport() { proxy.download("monitor/logininfor/export", { ...queryParams.value, - }, `logininfor_${new Date().getTime()}.xlsx`); + }, `logininfor_${new Date().getTime()}.xlsx`) } -getList(); +getList() </script> diff --git a/src/views/monitor/online/index.vue b/src/views/monitor/online/index.vue index 5f4b268..21f6463 100644 --- a/src/views/monitor/online/index.vue +++ b/src/views/monitor/online/index.vue @@ -58,52 +58,52 @@ </template> <script setup name="Online"> -import { forceLogout, list as initData } from "@/api/monitor/online"; +import { forceLogout, list as initData } from "@/api/monitor/online" -const { proxy } = getCurrentInstance(); +const { proxy } = getCurrentInstance() -const onlineList = ref([]); -const loading = ref(true); -const total = ref(0); -const pageNum = ref(1); -const pageSize = ref(10); +const onlineList = ref([]) +const loading = ref(true) +const total = ref(0) +const pageNum = ref(1) +const pageSize = ref(10) const queryParams = ref({ ipaddr: undefined, userName: undefined -}); +}) /** 鏌ヨ鐧诲綍鏃ュ織鍒楄〃 */ function getList() { - loading.value = true; + loading.value = true initData(queryParams.value).then(response => { - onlineList.value = response.rows; - total.value = response.total; - loading.value = false; - }); + onlineList.value = response.rows + total.value = response.total + loading.value = false + }) } /** 鎼滅储鎸夐挳鎿嶄綔 */ function handleQuery() { - pageNum.value = 1; - getList(); + pageNum.value = 1 + getList() } /** 閲嶇疆鎸夐挳鎿嶄綔 */ function resetQuery() { - proxy.resetForm("queryRef"); - handleQuery(); + proxy.resetForm("queryRef") + handleQuery() } /** 寮洪��鎸夐挳鎿嶄綔 */ function handleForceLogout(row) { proxy.$modal.confirm('鏄惁纭寮洪��鍚嶇О涓�"' + row.userName + '"鐨勭敤鎴�?').then(function () { - return forceLogout(row.tokenId); + return forceLogout(row.tokenId) }).then(() => { - getList(); - proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛"); - }).catch(() => {}); + getList() + proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛") + }).catch(() => {}) } -getList(); +getList() </script> diff --git a/src/views/monitor/operlog/index.vue b/src/views/monitor/operlog/index.vue index 5405f4c..dedc9c9 100644 --- a/src/views/monitor/operlog/index.vue +++ b/src/views/monitor/operlog/index.vue @@ -198,22 +198,22 @@ </template> <script setup name="Operlog"> -import { list, delOperlog, cleanOperlog } from "@/api/monitor/operlog"; +import { list, delOperlog, cleanOperlog } from "@/api/monitor/operlog" -const { proxy } = getCurrentInstance(); -const { sys_oper_type, sys_common_status } = proxy.useDict("sys_oper_type","sys_common_status"); +const { proxy } = getCurrentInstance() +const { sys_oper_type, sys_common_status } = proxy.useDict("sys_oper_type","sys_common_status") -const operlogList = ref([]); -const open = ref(false); -const loading = ref(true); -const showSearch = ref(true); -const ids = ref([]); -const single = ref(true); -const multiple = ref(true); -const total = ref(0); -const title = ref(""); -const dateRange = ref([]); -const defaultSort = ref({ prop: "operTime", order: "descending" }); +const operlogList = ref([]) +const open = ref(false) +const loading = ref(true) +const showSearch = ref(true) +const ids = ref([]) +const single = ref(true) +const multiple = ref(true) +const total = ref(0) +const title = ref("") +const dateRange = ref([]) +const defaultSort = ref({ prop: "operTime", order: "descending" }) const data = reactive({ form: {}, @@ -226,85 +226,85 @@ businessType: undefined, status: undefined } -}); +}) -const { queryParams, form } = toRefs(data); +const { queryParams, form } = toRefs(data) /** 鏌ヨ鐧诲綍鏃ュ織 */ function getList() { - loading.value = true; + loading.value = true list(proxy.addDateRange(queryParams.value, dateRange.value)).then(response => { - operlogList.value = response.rows; - total.value = response.total; - loading.value = false; - }); + operlogList.value = response.rows + total.value = response.total + loading.value = false + }) } /** 鎿嶄綔鏃ュ織绫诲瀷瀛楀吀缈昏瘧 */ function typeFormat(row, column) { - return proxy.selectDictLabel(sys_oper_type.value, row.businessType); + return proxy.selectDictLabel(sys_oper_type.value, row.businessType) } /** 鎼滅储鎸夐挳鎿嶄綔 */ function handleQuery() { - queryParams.value.pageNum = 1; - getList(); + queryParams.value.pageNum = 1 + getList() } /** 閲嶇疆鎸夐挳鎿嶄綔 */ function resetQuery() { - dateRange.value = []; - proxy.resetForm("queryRef"); - queryParams.value.pageNum = 1; - proxy.$refs["operlogRef"].sort(defaultSort.value.prop, defaultSort.value.order); + dateRange.value = [] + proxy.resetForm("queryRef") + queryParams.value.pageNum = 1 + proxy.$refs["operlogRef"].sort(defaultSort.value.prop, defaultSort.value.order) } /** 澶氶�夋閫変腑鏁版嵁 */ function handleSelectionChange(selection) { - ids.value = selection.map(item => item.operId); - multiple.value = !selection.length; + ids.value = selection.map(item => item.operId) + multiple.value = !selection.length } /** 鎺掑簭瑙﹀彂浜嬩欢 */ function handleSortChange(column, prop, order) { - queryParams.value.orderByColumn = column.prop; - queryParams.value.isAsc = column.order; - getList(); + queryParams.value.orderByColumn = column.prop + queryParams.value.isAsc = column.order + getList() } /** 璇︾粏鎸夐挳鎿嶄綔 */ function handleView(row) { - open.value = true; - form.value = row; + open.value = true + form.value = row } /** 鍒犻櫎鎸夐挳鎿嶄綔 */ function handleDelete(row) { - const operIds = row.operId || ids.value; + const operIds = row.operId || ids.value proxy.$modal.confirm('鏄惁纭鍒犻櫎鏃ュ織缂栧彿涓�"' + operIds + '"鐨勬暟鎹」?').then(function () { - return delOperlog(operIds); + return delOperlog(operIds) }).then(() => { - getList(); - proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛"); - }).catch(() => {}); + getList() + proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛") + }).catch(() => {}) } /** 娓呯┖鎸夐挳鎿嶄綔 */ function handleClean() { proxy.$modal.confirm("鏄惁纭娓呯┖鎵�鏈夋搷浣滄棩蹇楁暟鎹」?").then(function () { - return cleanOperlog(); + return cleanOperlog() }).then(() => { - getList(); - proxy.$modal.msgSuccess("娓呯┖鎴愬姛"); - }).catch(() => {}); + getList() + proxy.$modal.msgSuccess("娓呯┖鎴愬姛") + }).catch(() => {}) } /** 瀵煎嚭鎸夐挳鎿嶄綔 */ function handleExport() { proxy.download("monitor/operlog/export",{ ...queryParams.value, - }, `config_${new Date().getTime()}.xlsx`); + }, `config_${new Date().getTime()}.xlsx`) } -getList(); +getList() </script> diff --git a/src/views/monitor/server/index.vue b/src/views/monitor/server/index.vue index 3c96657..5eb7945 100644 --- a/src/views/monitor/server/index.vue +++ b/src/views/monitor/server/index.vue @@ -172,16 +172,16 @@ <script setup> import { getServer } from '@/api/monitor/server' -const server = ref([]); -const { proxy } = getCurrentInstance(); +const server = ref([]) +const { proxy } = getCurrentInstance() function getList() { - proxy.$modal.loading("姝e湪鍔犺浇鏈嶅姟鐩戞帶鏁版嵁锛岃绋嶅�欙紒"); + proxy.$modal.loading("姝e湪鍔犺浇鏈嶅姟鐩戞帶鏁版嵁锛岃绋嶅�欙紒") getServer().then(response => { - server.value = response.data; - proxy.$modal.closeLoading(); - }); + server.value = response.data + proxy.$modal.closeLoading() + }) } -getList(); +getList() </script> diff --git a/src/views/redirect/index.vue b/src/views/redirect/index.vue index e51beed..d932b25 100644 --- a/src/views/redirect/index.vue +++ b/src/views/redirect/index.vue @@ -5,8 +5,8 @@ <script setup> import { useRoute, useRouter } from 'vue-router' -const route = useRoute(); -const router = useRouter(); +const route = useRoute() +const router = useRouter() const { params, query } = route const { path } = params diff --git a/src/views/register.vue b/src/views/register.vue index e920ad4..e711967 100644 --- a/src/views/register.vue +++ b/src/views/register.vue @@ -76,12 +76,12 @@ </template> <script setup> -import { ElMessageBox } from "element-plus"; -import { getCodeImg, register } from "@/api/login"; +import { ElMessageBox } from "element-plus" +import { getCodeImg, register } from "@/api/login" -const title = import.meta.env.VITE_APP_TITLE; -const router = useRouter(); -const { proxy } = getCurrentInstance(); +const title = import.meta.env.VITE_APP_TITLE +const router = useRouter() +const { proxy } = getCurrentInstance() const registerForm = ref({ username: "", @@ -89,15 +89,15 @@ confirmPassword: "", code: "", uuid: "" -}); +}) const equalToPassword = (rule, value, callback) => { if (registerForm.value.password !== value) { - callback(new Error("涓ゆ杈撳叆鐨勫瘑鐮佷笉涓�鑷�")); + callback(new Error("涓ゆ杈撳叆鐨勫瘑鐮佷笉涓�鑷�")) } else { - callback(); + callback() } -}; +} const registerRules = { username: [ @@ -114,45 +114,45 @@ { required: true, validator: equalToPassword, trigger: "blur" } ], code: [{ required: true, trigger: "change", message: "璇疯緭鍏ラ獙璇佺爜" }] -}; +} -const codeUrl = ref(""); -const loading = ref(false); -const captchaEnabled = ref(true); +const codeUrl = ref("") +const loading = ref(false) +const captchaEnabled = ref(true) function handleRegister() { proxy.$refs.registerRef.validate(valid => { if (valid) { - loading.value = true; + loading.value = true register(registerForm.value).then(res => { - const username = registerForm.value.username; + const username = registerForm.value.username ElMessageBox.alert("<font color='red'>鎭枩浣狅紝鎮ㄧ殑璐﹀彿 " + username + " 娉ㄥ唽鎴愬姛锛�</font>", "绯荤粺鎻愮ず", { dangerouslyUseHTMLString: true, type: "success", }).then(() => { - router.push("/login"); - }).catch(() => {}); + router.push("/login") + }).catch(() => {}) }).catch(() => { - loading.value = false; + loading.value = false if (captchaEnabled) { - getCode(); + getCode() } - }); + }) } - }); + }) } function getCode() { getCodeImg().then(res => { - captchaEnabled.value = res.captchaEnabled === undefined ? true : res.captchaEnabled; + captchaEnabled.value = res.captchaEnabled === undefined ? true : res.captchaEnabled if (captchaEnabled.value) { - codeUrl.value = "data:image/gif;base64," + res.img; - registerForm.value.uuid = res.uuid; + codeUrl.value = "data:image/gif;base64," + res.img + registerForm.value.uuid = res.uuid } - }); + }) } -getCode(); +getCode() </script> <style lang='scss' scoped> diff --git a/src/views/system/config/index.vue b/src/views/system/config/index.vue index 653af8a..77d9f5a 100644 --- a/src/views/system/config/index.vue +++ b/src/views/system/config/index.vue @@ -165,21 +165,21 @@ </template> <script setup name="Config"> -import { listConfig, getConfig, delConfig, addConfig, updateConfig, refreshCache } from "@/api/system/config"; +import { listConfig, getConfig, delConfig, addConfig, updateConfig, refreshCache } from "@/api/system/config" -const { proxy } = getCurrentInstance(); -const { sys_yes_no } = proxy.useDict("sys_yes_no"); +const { proxy } = getCurrentInstance() +const { sys_yes_no } = proxy.useDict("sys_yes_no") -const configList = ref([]); -const open = ref(false); -const loading = ref(true); -const showSearch = ref(true); -const ids = ref([]); -const single = ref(true); -const multiple = ref(true); -const total = ref(0); -const title = ref(""); -const dateRange = ref([]); +const configList = ref([]) +const open = ref(false) +const loading = ref(true) +const showSearch = ref(true) +const ids = ref([]) +const single = ref(true) +const multiple = ref(true) +const total = ref(0) +const title = ref("") +const dateRange = ref([]) const data = reactive({ form: {}, @@ -195,24 +195,24 @@ configKey: [{ required: true, message: "鍙傛暟閿悕涓嶈兘涓虹┖", trigger: "blur" }], configValue: [{ required: true, message: "鍙傛暟閿�间笉鑳戒负绌�", trigger: "blur" }] } -}); +}) -const { queryParams, form, rules } = toRefs(data); +const { queryParams, form, rules } = toRefs(data) /** 鏌ヨ鍙傛暟鍒楄〃 */ function getList() { - loading.value = true; + loading.value = true listConfig(proxy.addDateRange(queryParams.value, dateRange.value)).then(response => { - configList.value = response.rows; - total.value = response.total; - loading.value = false; - }); + configList.value = response.rows + total.value = response.total + loading.value = false + }) } /** 鍙栨秷鎸夐挳 */ function cancel() { - open.value = false; - reset(); + open.value = false + reset() } /** 琛ㄥ崟閲嶇疆 */ @@ -224,46 +224,46 @@ configValue: undefined, configType: "Y", remark: undefined - }; - proxy.resetForm("configRef"); + } + proxy.resetForm("configRef") } /** 鎼滅储鎸夐挳鎿嶄綔 */ function handleQuery() { - queryParams.value.pageNum = 1; - getList(); + queryParams.value.pageNum = 1 + getList() } /** 閲嶇疆鎸夐挳鎿嶄綔 */ function resetQuery() { - dateRange.value = []; - proxy.resetForm("queryRef"); - handleQuery(); + dateRange.value = [] + proxy.resetForm("queryRef") + handleQuery() } /** 澶氶�夋閫変腑鏁版嵁 */ function handleSelectionChange(selection) { - ids.value = selection.map(item => item.configId); - single.value = selection.length != 1; - multiple.value = !selection.length; + ids.value = selection.map(item => item.configId) + single.value = selection.length != 1 + multiple.value = !selection.length } /** 鏂板鎸夐挳鎿嶄綔 */ function handleAdd() { - reset(); - open.value = true; - title.value = "娣诲姞鍙傛暟"; + reset() + open.value = true + title.value = "娣诲姞鍙傛暟" } /** 淇敼鎸夐挳鎿嶄綔 */ function handleUpdate(row) { - reset(); - const configId = row.configId || ids.value; + reset() + const configId = row.configId || ids.value getConfig(configId).then(response => { - form.value = response.data; - open.value = true; - title.value = "淇敼鍙傛暟"; - }); + form.value = response.data + open.value = true + title.value = "淇敼鍙傛暟" + }) } /** 鎻愪氦鎸夐挳 */ @@ -272,45 +272,45 @@ if (valid) { if (form.value.configId != undefined) { updateConfig(form.value).then(response => { - proxy.$modal.msgSuccess("淇敼鎴愬姛"); - open.value = false; - getList(); - }); + proxy.$modal.msgSuccess("淇敼鎴愬姛") + open.value = false + getList() + }) } else { addConfig(form.value).then(response => { - proxy.$modal.msgSuccess("鏂板鎴愬姛"); - open.value = false; - getList(); - }); + proxy.$modal.msgSuccess("鏂板鎴愬姛") + open.value = false + getList() + }) } } - }); + }) } /** 鍒犻櫎鎸夐挳鎿嶄綔 */ function handleDelete(row) { - const configIds = row.configId || ids.value; + const configIds = row.configId || ids.value proxy.$modal.confirm('鏄惁纭鍒犻櫎鍙傛暟缂栧彿涓�"' + configIds + '"鐨勬暟鎹」锛�').then(function () { - return delConfig(configIds); + return delConfig(configIds) }).then(() => { - getList(); - proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛"); - }).catch(() => {}); + getList() + proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛") + }).catch(() => {}) } /** 瀵煎嚭鎸夐挳鎿嶄綔 */ function handleExport() { proxy.download("system/config/export", { ...queryParams.value - }, `config_${new Date().getTime()}.xlsx`); + }, `config_${new Date().getTime()}.xlsx`) } /** 鍒锋柊缂撳瓨鎸夐挳鎿嶄綔 */ function handleRefreshCache() { refreshCache().then(() => { - proxy.$modal.msgSuccess("鍒锋柊缂撳瓨鎴愬姛"); - }); + proxy.$modal.msgSuccess("鍒锋柊缂撳瓨鎴愬姛") + }) } -getList(); +getList() </script> diff --git a/src/views/system/dept/index.vue b/src/views/system/dept/index.vue index a25e204..5eb99cd 100644 --- a/src/views/system/dept/index.vue +++ b/src/views/system/dept/index.vue @@ -141,19 +141,19 @@ </template> <script setup name="Dept"> -import { listDept, getDept, delDept, addDept, updateDept, listDeptExcludeChild } from "@/api/system/dept"; +import { listDept, getDept, delDept, addDept, updateDept, listDeptExcludeChild } from "@/api/system/dept" -const { proxy } = getCurrentInstance(); -const { sys_normal_disable } = proxy.useDict("sys_normal_disable"); +const { proxy } = getCurrentInstance() +const { sys_normal_disable } = proxy.useDict("sys_normal_disable") -const deptList = ref([]); -const open = ref(false); -const loading = ref(true); -const showSearch = ref(true); -const title = ref(""); -const deptOptions = ref([]); -const isExpandAll = ref(true); -const refreshTable = ref(true); +const deptList = ref([]) +const open = ref(false) +const loading = ref(true) +const showSearch = ref(true) +const title = ref("") +const deptOptions = ref([]) +const isExpandAll = ref(true) +const refreshTable = ref(true) const data = reactive({ form: {}, @@ -168,23 +168,23 @@ email: [{ type: "email", message: "璇疯緭鍏ユ纭殑閭鍦板潃", trigger: ["blur", "change"] }], phone: [{ pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, message: "璇疯緭鍏ユ纭殑鎵嬫満鍙风爜", trigger: "blur" }] }, -}); +}) -const { queryParams, form, rules } = toRefs(data); +const { queryParams, form, rules } = toRefs(data) /** 鏌ヨ閮ㄩ棬鍒楄〃 */ function getList() { - loading.value = true; + loading.value = true listDept(queryParams.value).then(response => { - deptList.value = proxy.handleTree(response.data, "deptId"); - loading.value = false; - }); + deptList.value = proxy.handleTree(response.data, "deptId") + loading.value = false + }) } /** 鍙栨秷鎸夐挳 */ function cancel() { - open.value = false; - reset(); + open.value = false + reset() } /** 琛ㄥ崟閲嶇疆 */ @@ -198,54 +198,54 @@ phone: undefined, email: undefined, status: "0" - }; - proxy.resetForm("deptRef"); + } + proxy.resetForm("deptRef") } /** 鎼滅储鎸夐挳鎿嶄綔 */ function handleQuery() { - getList(); + getList() } /** 閲嶇疆鎸夐挳鎿嶄綔 */ function resetQuery() { - proxy.resetForm("queryRef"); - handleQuery(); + proxy.resetForm("queryRef") + handleQuery() } /** 鏂板鎸夐挳鎿嶄綔 */ function handleAdd(row) { - reset(); + reset() listDept().then(response => { - deptOptions.value = proxy.handleTree(response.data, "deptId"); - }); + deptOptions.value = proxy.handleTree(response.data, "deptId") + }) if (row != undefined) { - form.value.parentId = row.deptId; + form.value.parentId = row.deptId } - open.value = true; - title.value = "娣诲姞閮ㄩ棬"; + open.value = true + title.value = "娣诲姞閮ㄩ棬" } /** 灞曞紑/鎶樺彔鎿嶄綔 */ function toggleExpandAll() { - refreshTable.value = false; - isExpandAll.value = !isExpandAll.value; + refreshTable.value = false + isExpandAll.value = !isExpandAll.value nextTick(() => { - refreshTable.value = true; - }); + refreshTable.value = true + }) } /** 淇敼鎸夐挳鎿嶄綔 */ function handleUpdate(row) { - reset(); + reset() listDeptExcludeChild(row.deptId).then(response => { - deptOptions.value = proxy.handleTree(response.data, "deptId"); - }); + deptOptions.value = proxy.handleTree(response.data, "deptId") + }) getDept(row.deptId).then(response => { - form.value = response.data; - open.value = true; - title.value = "淇敼閮ㄩ棬"; - }); + form.value = response.data + open.value = true + title.value = "淇敼閮ㄩ棬" + }) } /** 鎻愪氦鎸夐挳 */ @@ -254,30 +254,30 @@ if (valid) { if (form.value.deptId != undefined) { updateDept(form.value).then(response => { - proxy.$modal.msgSuccess("淇敼鎴愬姛"); - open.value = false; - getList(); - }); + proxy.$modal.msgSuccess("淇敼鎴愬姛") + open.value = false + getList() + }) } else { addDept(form.value).then(response => { - proxy.$modal.msgSuccess("鏂板鎴愬姛"); - open.value = false; - getList(); - }); + proxy.$modal.msgSuccess("鏂板鎴愬姛") + open.value = false + getList() + }) } } - }); + }) } /** 鍒犻櫎鎸夐挳鎿嶄綔 */ function handleDelete(row) { proxy.$modal.confirm('鏄惁纭鍒犻櫎鍚嶇О涓�"' + row.deptName + '"鐨勬暟鎹」?').then(function() { - return delDept(row.deptId); + return delDept(row.deptId) }).then(() => { - getList(); - proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛"); - }).catch(() => {}); + getList() + proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛") + }).catch(() => {}) } -getList(); +getList() </script> diff --git a/src/views/system/dict/data.vue b/src/views/system/dict/data.vue index eff8acc..f4e2c6f 100644 --- a/src/views/system/dict/data.vue +++ b/src/views/system/dict/data.vue @@ -177,24 +177,24 @@ <script setup name="Data"> import useDictStore from '@/store/modules/dict' -import { optionselect as getDictOptionselect, getType } from "@/api/system/dict/type"; -import { listData, getData, delData, addData, updateData } from "@/api/system/dict/data"; +import { optionselect as getDictOptionselect, getType } from "@/api/system/dict/type" +import { listData, getData, delData, addData, updateData } from "@/api/system/dict/data" -const { proxy } = getCurrentInstance(); -const { sys_normal_disable } = proxy.useDict("sys_normal_disable"); +const { proxy } = getCurrentInstance() +const { sys_normal_disable } = proxy.useDict("sys_normal_disable") -const dataList = ref([]); -const open = ref(false); -const loading = ref(true); -const showSearch = ref(true); -const ids = ref([]); -const single = ref(true); -const multiple = ref(true); -const total = ref(0); -const title = ref(""); -const defaultDictType = ref(""); -const typeOptions = ref([]); -const route = useRoute(); +const dataList = ref([]) +const open = ref(false) +const loading = ref(true) +const showSearch = ref(true) +const ids = ref([]) +const single = ref(true) +const multiple = ref(true) +const total = ref(0) +const title = ref("") +const defaultDictType = ref("") +const typeOptions = ref([]) +const route = useRoute() // 鏁版嵁鏍囩鍥炴樉鏍峰紡 const listClassOptions = ref([ { value: "default", label: "榛樿" }, @@ -203,7 +203,7 @@ { value: "info", label: "淇℃伅" }, { value: "warning", label: "璀﹀憡" }, { value: "danger", label: "鍗遍櫓" } -]); +]) const data = reactive({ form: {}, @@ -219,40 +219,40 @@ dictValue: [{ required: true, message: "鏁版嵁閿�间笉鑳戒负绌�", trigger: "blur" }], dictSort: [{ required: true, message: "鏁版嵁椤哄簭涓嶈兘涓虹┖", trigger: "blur" }] } -}); +}) -const { queryParams, form, rules } = toRefs(data); +const { queryParams, form, rules } = toRefs(data) /** 鏌ヨ瀛楀吀绫诲瀷璇︾粏 */ function getTypes(dictId) { getType(dictId).then(response => { - queryParams.value.dictType = response.data.dictType; - defaultDictType.value = response.data.dictType; - getList(); - }); + queryParams.value.dictType = response.data.dictType + defaultDictType.value = response.data.dictType + getList() + }) } /** 鏌ヨ瀛楀吀绫诲瀷鍒楄〃 */ function getTypeList() { getDictOptionselect().then(response => { - typeOptions.value = response.data; - }); + typeOptions.value = response.data + }) } /** 鏌ヨ瀛楀吀鏁版嵁鍒楄〃 */ function getList() { - loading.value = true; + loading.value = true listData(queryParams.value).then(response => { - dataList.value = response.rows; - total.value = response.total; - loading.value = false; - }); + dataList.value = response.rows + total.value = response.total + loading.value = false + }) } /** 鍙栨秷鎸夐挳 */ function cancel() { - open.value = false; - reset(); + open.value = false + reset() } /** 琛ㄥ崟閲嶇疆 */ @@ -266,53 +266,53 @@ dictSort: 0, status: "0", remark: undefined - }; - proxy.resetForm("dataRef"); + } + proxy.resetForm("dataRef") } /** 鎼滅储鎸夐挳鎿嶄綔 */ function handleQuery() { - queryParams.value.pageNum = 1; - getList(); + queryParams.value.pageNum = 1 + getList() } /** 杩斿洖鎸夐挳鎿嶄綔 */ function handleClose() { - const obj = { path: "/system/dict" }; - proxy.$tab.closeOpenPage(obj); + const obj = { path: "/system/dict" } + proxy.$tab.closeOpenPage(obj) } /** 閲嶇疆鎸夐挳鎿嶄綔 */ function resetQuery() { - proxy.resetForm("queryRef"); - queryParams.value.dictType = defaultDictType.value; - handleQuery(); + proxy.resetForm("queryRef") + queryParams.value.dictType = defaultDictType.value + handleQuery() } /** 鏂板鎸夐挳鎿嶄綔 */ function handleAdd() { - reset(); - open.value = true; - title.value = "娣诲姞瀛楀吀鏁版嵁"; - form.value.dictType = queryParams.value.dictType; + reset() + open.value = true + title.value = "娣诲姞瀛楀吀鏁版嵁" + form.value.dictType = queryParams.value.dictType } /** 澶氶�夋閫変腑鏁版嵁 */ function handleSelectionChange(selection) { - ids.value = selection.map(item => item.dictCode); - single.value = selection.length != 1; - multiple.value = !selection.length; + ids.value = selection.map(item => item.dictCode) + single.value = selection.length != 1 + multiple.value = !selection.length } /** 淇敼鎸夐挳鎿嶄綔 */ function handleUpdate(row) { - reset(); - const dictCode = row.dictCode || ids.value; + reset() + const dictCode = row.dictCode || ids.value getData(dictCode).then(response => { - form.value = response.data; - open.value = true; - title.value = "淇敼瀛楀吀鏁版嵁"; - }); + form.value = response.data + open.value = true + title.value = "淇敼瀛楀吀鏁版嵁" + }) } /** 鎻愪氦鎸夐挳 */ @@ -321,42 +321,42 @@ if (valid) { if (form.value.dictCode != undefined) { updateData(form.value).then(response => { - useDictStore().removeDict(queryParams.value.dictType); - proxy.$modal.msgSuccess("淇敼鎴愬姛"); - open.value = false; - getList(); - }); + useDictStore().removeDict(queryParams.value.dictType) + proxy.$modal.msgSuccess("淇敼鎴愬姛") + open.value = false + getList() + }) } else { addData(form.value).then(response => { - useDictStore().removeDict(queryParams.value.dictType); - proxy.$modal.msgSuccess("鏂板鎴愬姛"); - open.value = false; - getList(); - }); + useDictStore().removeDict(queryParams.value.dictType) + proxy.$modal.msgSuccess("鏂板鎴愬姛") + open.value = false + getList() + }) } } - }); + }) } /** 鍒犻櫎鎸夐挳鎿嶄綔 */ function handleDelete(row) { - const dictCodes = row.dictCode || ids.value; + const dictCodes = row.dictCode || ids.value proxy.$modal.confirm('鏄惁纭鍒犻櫎瀛楀吀缂栫爜涓�"' + dictCodes + '"鐨勬暟鎹」锛�').then(function() { - return delData(dictCodes); + return delData(dictCodes) }).then(() => { - getList(); - proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛"); - useDictStore().removeDict(queryParams.value.dictType); - }).catch(() => {}); + getList() + proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛") + useDictStore().removeDict(queryParams.value.dictType) + }).catch(() => {}) } /** 瀵煎嚭鎸夐挳鎿嶄綔 */ function handleExport() { proxy.download("system/dict/data/export", { ...queryParams.value - }, `dict_data_${new Date().getTime()}.xlsx`); + }, `dict_data_${new Date().getTime()}.xlsx`) } -getTypes(route.params && route.params.dictId); -getTypeList(); +getTypes(route.params && route.params.dictId) +getTypeList() </script> diff --git a/src/views/system/dict/index.vue b/src/views/system/dict/index.vue index ead773b..bd6ab65 100644 --- a/src/views/system/dict/index.vue +++ b/src/views/system/dict/index.vue @@ -173,21 +173,21 @@ <script setup name="Dict"> import useDictStore from '@/store/modules/dict' -import { listType, getType, delType, addType, updateType, refreshCache } from "@/api/system/dict/type"; +import { listType, getType, delType, addType, updateType, refreshCache } from "@/api/system/dict/type" -const { proxy } = getCurrentInstance(); -const { sys_normal_disable } = proxy.useDict("sys_normal_disable"); +const { proxy } = getCurrentInstance() +const { sys_normal_disable } = proxy.useDict("sys_normal_disable") -const typeList = ref([]); -const open = ref(false); -const loading = ref(true); -const showSearch = ref(true); -const ids = ref([]); -const single = ref(true); -const multiple = ref(true); -const total = ref(0); -const title = ref(""); -const dateRange = ref([]); +const typeList = ref([]) +const open = ref(false) +const loading = ref(true) +const showSearch = ref(true) +const ids = ref([]) +const single = ref(true) +const multiple = ref(true) +const total = ref(0) +const title = ref("") +const dateRange = ref([]) const data = reactive({ form: {}, @@ -202,24 +202,24 @@ dictName: [{ required: true, message: "瀛楀吀鍚嶇О涓嶈兘涓虹┖", trigger: "blur" }], dictType: [{ required: true, message: "瀛楀吀绫诲瀷涓嶈兘涓虹┖", trigger: "blur" }] }, -}); +}) -const { queryParams, form, rules } = toRefs(data); +const { queryParams, form, rules } = toRefs(data) /** 鏌ヨ瀛楀吀绫诲瀷鍒楄〃 */ function getList() { - loading.value = true; + loading.value = true listType(proxy.addDateRange(queryParams.value, dateRange.value)).then(response => { - typeList.value = response.rows; - total.value = response.total; - loading.value = false; - }); + typeList.value = response.rows + total.value = response.total + loading.value = false + }) } /** 鍙栨秷鎸夐挳 */ function cancel() { - open.value = false; - reset(); + open.value = false + reset() } /** 琛ㄥ崟閲嶇疆 */ @@ -230,46 +230,46 @@ dictType: undefined, status: "0", remark: undefined - }; - proxy.resetForm("dictRef"); + } + proxy.resetForm("dictRef") } /** 鎼滅储鎸夐挳鎿嶄綔 */ function handleQuery() { - queryParams.value.pageNum = 1; - getList(); + queryParams.value.pageNum = 1 + getList() } /** 閲嶇疆鎸夐挳鎿嶄綔 */ function resetQuery() { - dateRange.value = []; - proxy.resetForm("queryRef"); - handleQuery(); + dateRange.value = [] + proxy.resetForm("queryRef") + handleQuery() } /** 鏂板鎸夐挳鎿嶄綔 */ function handleAdd() { - reset(); - open.value = true; - title.value = "娣诲姞瀛楀吀绫诲瀷"; + reset() + open.value = true + title.value = "娣诲姞瀛楀吀绫诲瀷" } /** 澶氶�夋閫変腑鏁版嵁 */ function handleSelectionChange(selection) { - ids.value = selection.map(item => item.dictId); - single.value = selection.length != 1; - multiple.value = !selection.length; + ids.value = selection.map(item => item.dictId) + single.value = selection.length != 1 + multiple.value = !selection.length } /** 淇敼鎸夐挳鎿嶄綔 */ function handleUpdate(row) { - reset(); - const dictId = row.dictId || ids.value; + reset() + const dictId = row.dictId || ids.value getType(dictId).then(response => { - form.value = response.data; - open.value = true; - title.value = "淇敼瀛楀吀绫诲瀷"; - }); + form.value = response.data + open.value = true + title.value = "淇敼瀛楀吀绫诲瀷" + }) } /** 鎻愪氦鎸夐挳 */ @@ -278,46 +278,46 @@ if (valid) { if (form.value.dictId != undefined) { updateType(form.value).then(response => { - proxy.$modal.msgSuccess("淇敼鎴愬姛"); - open.value = false; - getList(); - }); + proxy.$modal.msgSuccess("淇敼鎴愬姛") + open.value = false + getList() + }) } else { addType(form.value).then(response => { - proxy.$modal.msgSuccess("鏂板鎴愬姛"); - open.value = false; - getList(); - }); + proxy.$modal.msgSuccess("鏂板鎴愬姛") + open.value = false + getList() + }) } } - }); + }) } /** 鍒犻櫎鎸夐挳鎿嶄綔 */ function handleDelete(row) { - const dictIds = row.dictId || ids.value; + const dictIds = row.dictId || ids.value proxy.$modal.confirm('鏄惁纭鍒犻櫎瀛楀吀缂栧彿涓�"' + dictIds + '"鐨勬暟鎹」锛�').then(function() { - return delType(dictIds); + return delType(dictIds) }).then(() => { - getList(); - proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛"); - }).catch(() => {}); + getList() + proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛") + }).catch(() => {}) } /** 瀵煎嚭鎸夐挳鎿嶄綔 */ function handleExport() { proxy.download("system/dict/type/export", { ...queryParams.value - }, `dict_${new Date().getTime()}.xlsx`); + }, `dict_${new Date().getTime()}.xlsx`) } /** 鍒锋柊缂撳瓨鎸夐挳鎿嶄綔 */ function handleRefreshCache() { refreshCache().then(() => { - proxy.$modal.msgSuccess("鍒锋柊鎴愬姛"); - useDictStore().cleanDict(); - }); + proxy.$modal.msgSuccess("鍒锋柊鎴愬姛") + useDictStore().cleanDict() + }) } -getList(); +getList() </script> diff --git a/src/views/system/menu/index.vue b/src/views/system/menu/index.vue index 2d15eec..78c49cf 100644 --- a/src/views/system/menu/index.vue +++ b/src/views/system/menu/index.vue @@ -289,22 +289,22 @@ </template> <script setup name="Menu"> -import { addMenu, delMenu, getMenu, listMenu, updateMenu } from "@/api/system/menu"; -import SvgIcon from "@/components/SvgIcon"; -import IconSelect from "@/components/IconSelect"; +import { addMenu, delMenu, getMenu, listMenu, updateMenu } from "@/api/system/menu" +import SvgIcon from "@/components/SvgIcon" +import IconSelect from "@/components/IconSelect" -const { proxy } = getCurrentInstance(); -const { sys_show_hide, sys_normal_disable } = proxy.useDict("sys_show_hide", "sys_normal_disable"); +const { proxy } = getCurrentInstance() +const { sys_show_hide, sys_normal_disable } = proxy.useDict("sys_show_hide", "sys_normal_disable") -const menuList = ref([]); -const open = ref(false); -const loading = ref(true); -const showSearch = ref(true); -const title = ref(""); -const menuOptions = ref([]); -const isExpandAll = ref(false); -const refreshTable = ref(true); -const iconSelectRef = ref(null); +const menuList = ref([]) +const open = ref(false) +const loading = ref(true) +const showSearch = ref(true) +const title = ref("") +const menuOptions = ref([]) +const isExpandAll = ref(false) +const refreshTable = ref(true) +const iconSelectRef = ref(null) const data = reactive({ form: {}, @@ -317,33 +317,33 @@ orderNum: [{ required: true, message: "鑿滃崟椤哄簭涓嶈兘涓虹┖", trigger: "blur" }], path: [{ required: true, message: "璺敱鍦板潃涓嶈兘涓虹┖", trigger: "blur" }] }, -}); +}) -const { queryParams, form, rules } = toRefs(data); +const { queryParams, form, rules } = toRefs(data) /** 鏌ヨ鑿滃崟鍒楄〃 */ function getList() { - loading.value = true; + loading.value = true listMenu(queryParams.value).then(response => { - menuList.value = proxy.handleTree(response.data, "menuId"); - loading.value = false; - }); + menuList.value = proxy.handleTree(response.data, "menuId") + loading.value = false + }) } /** 鏌ヨ鑿滃崟涓嬫媺鏍戠粨鏋� */ function getTreeselect() { - menuOptions.value = []; + menuOptions.value = [] listMenu().then(response => { - const menu = { menuId: 0, menuName: "涓荤被鐩�", children: [] }; - menu.children = proxy.handleTree(response.data, "menuId"); - menuOptions.value.push(menu); - }); + const menu = { menuId: 0, menuName: "涓荤被鐩�", children: [] } + menu.children = proxy.handleTree(response.data, "menuId") + menuOptions.value.push(menu) + }) } /** 鍙栨秷鎸夐挳 */ function cancel() { - open.value = false; - reset(); + open.value = false + reset() } /** 琛ㄥ崟閲嶇疆 */ @@ -359,62 +359,62 @@ isCache: "0", visible: "0", status: "0" - }; - proxy.resetForm("menuRef"); + } + proxy.resetForm("menuRef") } /** 灞曠ず涓嬫媺鍥炬爣 */ function showSelectIcon() { - iconSelectRef.value.reset(); + iconSelectRef.value.reset() } /** 閫夋嫨鍥炬爣 */ function selected(name) { - form.value.icon = name; + form.value.icon = name } /** 鎼滅储鎸夐挳鎿嶄綔 */ function handleQuery() { - getList(); + getList() } /** 閲嶇疆鎸夐挳鎿嶄綔 */ function resetQuery() { - proxy.resetForm("queryRef"); - handleQuery(); + proxy.resetForm("queryRef") + handleQuery() } /** 鏂板鎸夐挳鎿嶄綔 */ function handleAdd(row) { - reset(); - getTreeselect(); + reset() + getTreeselect() if (row != null && row.menuId) { - form.value.parentId = row.menuId; + form.value.parentId = row.menuId } else { - form.value.parentId = 0; + form.value.parentId = 0 } - open.value = true; - title.value = "娣诲姞鑿滃崟"; + open.value = true + title.value = "娣诲姞鑿滃崟" } /** 灞曞紑/鎶樺彔鎿嶄綔 */ function toggleExpandAll() { - refreshTable.value = false; - isExpandAll.value = !isExpandAll.value; + refreshTable.value = false + isExpandAll.value = !isExpandAll.value nextTick(() => { - refreshTable.value = true; - }); + refreshTable.value = true + }) } /** 淇敼鎸夐挳鎿嶄綔 */ async function handleUpdate(row) { - reset(); - await getTreeselect(); + reset() + await getTreeselect() getMenu(row.menuId).then(response => { - form.value = response.data; - open.value = true; - title.value = "淇敼鑿滃崟"; - }); + form.value = response.data + open.value = true + title.value = "淇敼鑿滃崟" + }) } /** 鎻愪氦鎸夐挳 */ @@ -423,30 +423,30 @@ if (valid) { if (form.value.menuId != undefined) { updateMenu(form.value).then(response => { - proxy.$modal.msgSuccess("淇敼鎴愬姛"); - open.value = false; - getList(); - }); + proxy.$modal.msgSuccess("淇敼鎴愬姛") + open.value = false + getList() + }) } else { addMenu(form.value).then(response => { - proxy.$modal.msgSuccess("鏂板鎴愬姛"); - open.value = false; - getList(); - }); + proxy.$modal.msgSuccess("鏂板鎴愬姛") + open.value = false + getList() + }) } } - }); + }) } /** 鍒犻櫎鎸夐挳鎿嶄綔 */ function handleDelete(row) { proxy.$modal.confirm('鏄惁纭鍒犻櫎鍚嶇О涓�"' + row.menuName + '"鐨勬暟鎹」?').then(function() { - return delMenu(row.menuId); + return delMenu(row.menuId) }).then(() => { - getList(); - proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛"); - }).catch(() => {}); + getList() + proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛") + }).catch(() => {}) } -getList(); +getList() </script> diff --git a/src/views/system/notice/index.vue b/src/views/system/notice/index.vue index a0ea694..96dadcc 100644 --- a/src/views/system/notice/index.vue +++ b/src/views/system/notice/index.vue @@ -159,20 +159,20 @@ </template> <script setup name="Notice"> -import { listNotice, getNotice, delNotice, addNotice, updateNotice } from "@/api/system/notice"; +import { listNotice, getNotice, delNotice, addNotice, updateNotice } from "@/api/system/notice" -const { proxy } = getCurrentInstance(); -const { sys_notice_status, sys_notice_type } = proxy.useDict("sys_notice_status", "sys_notice_type"); +const { proxy } = getCurrentInstance() +const { sys_notice_status, sys_notice_type } = proxy.useDict("sys_notice_status", "sys_notice_type") -const noticeList = ref([]); -const open = ref(false); -const loading = ref(true); -const showSearch = ref(true); -const ids = ref([]); -const single = ref(true); -const multiple = ref(true); -const total = ref(0); -const title = ref(""); +const noticeList = ref([]) +const open = ref(false) +const loading = ref(true) +const showSearch = ref(true) +const ids = ref([]) +const single = ref(true) +const multiple = ref(true) +const total = ref(0) +const title = ref("") const data = reactive({ form: {}, @@ -187,24 +187,24 @@ noticeTitle: [{ required: true, message: "鍏憡鏍囬涓嶈兘涓虹┖", trigger: "blur" }], noticeType: [{ required: true, message: "鍏憡绫诲瀷涓嶈兘涓虹┖", trigger: "change" }] }, -}); +}) -const { queryParams, form, rules } = toRefs(data); +const { queryParams, form, rules } = toRefs(data) /** 鏌ヨ鍏憡鍒楄〃 */ function getList() { - loading.value = true; + loading.value = true listNotice(queryParams.value).then(response => { - noticeList.value = response.rows; - total.value = response.total; - loading.value = false; - }); + noticeList.value = response.rows + total.value = response.total + loading.value = false + }) } /** 鍙栨秷鎸夐挳 */ function cancel() { - open.value = false; - reset(); + open.value = false + reset() } /** 琛ㄥ崟閲嶇疆 */ @@ -215,45 +215,45 @@ noticeType: undefined, noticeContent: undefined, status: "0" - }; - proxy.resetForm("noticeRef"); + } + proxy.resetForm("noticeRef") } /** 鎼滅储鎸夐挳鎿嶄綔 */ function handleQuery() { - queryParams.value.pageNum = 1; - getList(); + queryParams.value.pageNum = 1 + getList() } /** 閲嶇疆鎸夐挳鎿嶄綔 */ function resetQuery() { - proxy.resetForm("queryRef"); - handleQuery(); + proxy.resetForm("queryRef") + handleQuery() } /** 澶氶�夋閫変腑鏁版嵁 */ function handleSelectionChange(selection) { - ids.value = selection.map(item => item.noticeId); - single.value = selection.length != 1; - multiple.value = !selection.length; + ids.value = selection.map(item => item.noticeId) + single.value = selection.length != 1 + multiple.value = !selection.length } /** 鏂板鎸夐挳鎿嶄綔 */ function handleAdd() { - reset(); - open.value = true; - title.value = "娣诲姞鍏憡"; + reset() + open.value = true + title.value = "娣诲姞鍏憡" } /**淇敼鎸夐挳鎿嶄綔 */ function handleUpdate(row) { - reset(); - const noticeId = row.noticeId || ids.value; + reset() + const noticeId = row.noticeId || ids.value getNotice(noticeId).then(response => { - form.value = response.data; - open.value = true; - title.value = "淇敼鍏憡"; - }); + form.value = response.data + open.value = true + title.value = "淇敼鍏憡" + }) } /** 鎻愪氦鎸夐挳 */ @@ -262,31 +262,31 @@ if (valid) { if (form.value.noticeId != undefined) { updateNotice(form.value).then(response => { - proxy.$modal.msgSuccess("淇敼鎴愬姛"); - open.value = false; - getList(); - }); + proxy.$modal.msgSuccess("淇敼鎴愬姛") + open.value = false + getList() + }) } else { addNotice(form.value).then(response => { - proxy.$modal.msgSuccess("鏂板鎴愬姛"); - open.value = false; - getList(); - }); + proxy.$modal.msgSuccess("鏂板鎴愬姛") + open.value = false + getList() + }) } } - }); + }) } /** 鍒犻櫎鎸夐挳鎿嶄綔 */ function handleDelete(row) { const noticeIds = row.noticeId || ids.value proxy.$modal.confirm('鏄惁纭鍒犻櫎鍏憡缂栧彿涓�"' + noticeIds + '"鐨勬暟鎹」锛�').then(function() { - return delNotice(noticeIds); + return delNotice(noticeIds) }).then(() => { - getList(); - proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛"); - }).catch(() => {}); + getList() + proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛") + }).catch(() => {}) } -getList(); +getList() </script> diff --git a/src/views/system/post/index.vue b/src/views/system/post/index.vue index ce63043..2608669 100644 --- a/src/views/system/post/index.vue +++ b/src/views/system/post/index.vue @@ -145,20 +145,20 @@ </template> <script setup name="Post"> -import { listPost, addPost, delPost, getPost, updatePost } from "@/api/system/post"; +import { listPost, addPost, delPost, getPost, updatePost } from "@/api/system/post" -const { proxy } = getCurrentInstance(); -const { sys_normal_disable } = proxy.useDict("sys_normal_disable"); +const { proxy } = getCurrentInstance() +const { sys_normal_disable } = proxy.useDict("sys_normal_disable") -const postList = ref([]); -const open = ref(false); -const loading = ref(true); -const showSearch = ref(true); -const ids = ref([]); -const single = ref(true); -const multiple = ref(true); -const total = ref(0); -const title = ref(""); +const postList = ref([]) +const open = ref(false) +const loading = ref(true) +const showSearch = ref(true) +const ids = ref([]) +const single = ref(true) +const multiple = ref(true) +const total = ref(0) +const title = ref("") const data = reactive({ form: {}, @@ -174,24 +174,24 @@ postCode: [{ required: true, message: "宀椾綅缂栫爜涓嶈兘涓虹┖", trigger: "blur" }], postSort: [{ required: true, message: "宀椾綅椤哄簭涓嶈兘涓虹┖", trigger: "blur" }], } -}); +}) -const { queryParams, form, rules } = toRefs(data); +const { queryParams, form, rules } = toRefs(data) /** 鏌ヨ宀椾綅鍒楄〃 */ function getList() { - loading.value = true; + loading.value = true listPost(queryParams.value).then(response => { - postList.value = response.rows; - total.value = response.total; - loading.value = false; - }); + postList.value = response.rows + total.value = response.total + loading.value = false + }) } /** 鍙栨秷鎸夐挳 */ function cancel() { - open.value = false; - reset(); + open.value = false + reset() } /** 琛ㄥ崟閲嶇疆 */ @@ -203,45 +203,45 @@ postSort: 0, status: "0", remark: undefined - }; - proxy.resetForm("postRef"); + } + proxy.resetForm("postRef") } /** 鎼滅储鎸夐挳鎿嶄綔 */ function handleQuery() { - queryParams.value.pageNum = 1; - getList(); + queryParams.value.pageNum = 1 + getList() } /** 閲嶇疆鎸夐挳鎿嶄綔 */ function resetQuery() { - proxy.resetForm("queryRef"); - handleQuery(); + proxy.resetForm("queryRef") + handleQuery() } /** 澶氶�夋閫変腑鏁版嵁 */ function handleSelectionChange(selection) { - ids.value = selection.map(item => item.postId); - single.value = selection.length != 1; - multiple.value = !selection.length; + ids.value = selection.map(item => item.postId) + single.value = selection.length != 1 + multiple.value = !selection.length } /** 鏂板鎸夐挳鎿嶄綔 */ function handleAdd() { - reset(); - open.value = true; - title.value = "娣诲姞宀椾綅"; + reset() + open.value = true + title.value = "娣诲姞宀椾綅" } /** 淇敼鎸夐挳鎿嶄綔 */ function handleUpdate(row) { - reset(); - const postId = row.postId || ids.value; + reset() + const postId = row.postId || ids.value getPost(postId).then(response => { - form.value = response.data; - open.value = true; - title.value = "淇敼宀椾綅"; - }); + form.value = response.data + open.value = true + title.value = "淇敼宀椾綅" + }) } /** 鎻愪氦鎸夐挳 */ @@ -250,38 +250,38 @@ if (valid) { if (form.value.postId != undefined) { updatePost(form.value).then(response => { - proxy.$modal.msgSuccess("淇敼鎴愬姛"); - open.value = false; - getList(); - }); + proxy.$modal.msgSuccess("淇敼鎴愬姛") + open.value = false + getList() + }) } else { addPost(form.value).then(response => { - proxy.$modal.msgSuccess("鏂板鎴愬姛"); - open.value = false; - getList(); - }); + proxy.$modal.msgSuccess("鏂板鎴愬姛") + open.value = false + getList() + }) } } - }); + }) } /** 鍒犻櫎鎸夐挳鎿嶄綔 */ function handleDelete(row) { - const postIds = row.postId || ids.value; + const postIds = row.postId || ids.value proxy.$modal.confirm('鏄惁纭鍒犻櫎宀椾綅缂栧彿涓�"' + postIds + '"鐨勬暟鎹」锛�').then(function() { - return delPost(postIds); + return delPost(postIds) }).then(() => { - getList(); - proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛"); - }).catch(() => {}); + getList() + proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛") + }).catch(() => {}) } /** 瀵煎嚭鎸夐挳鎿嶄綔 */ function handleExport() { proxy.download("system/post/export", { ...queryParams.value - }, `post_${new Date().getTime()}.xlsx`); + }, `post_${new Date().getTime()}.xlsx`) } -getList(); +getList() </script> diff --git a/src/views/system/role/authUser.vue b/src/views/system/role/authUser.vue index 49bbd04..20be11c 100644 --- a/src/views/system/role/authUser.vue +++ b/src/views/system/role/authUser.vue @@ -92,19 +92,19 @@ </template> <script setup name="AuthUser"> -import selectUser from "./selectUser"; -import { allocatedUserList, authUserCancel, authUserCancelAll } from "@/api/system/role"; +import selectUser from "./selectUser" +import { allocatedUserList, authUserCancel, authUserCancelAll } from "@/api/system/role" -const route = useRoute(); -const { proxy } = getCurrentInstance(); -const { sys_normal_disable } = proxy.useDict("sys_normal_disable"); +const route = useRoute() +const { proxy } = getCurrentInstance() +const { sys_normal_disable } = proxy.useDict("sys_normal_disable") -const userList = ref([]); -const loading = ref(true); -const showSearch = ref(true); -const multiple = ref(true); -const total = ref(0); -const userIds = ref([]); +const userList = ref([]) +const loading = ref(true) +const showSearch = ref(true) +const multiple = ref(true) +const total = ref(0) +const userIds = ref([]) const queryParams = reactive({ pageNum: 1, @@ -112,68 +112,68 @@ roleId: route.params.roleId, userName: undefined, phonenumber: undefined, -}); +}) /** 鏌ヨ鎺堟潈鐢ㄦ埛鍒楄〃 */ function getList() { - loading.value = true; + loading.value = true allocatedUserList(queryParams).then(response => { - userList.value = response.rows; - total.value = response.total; - loading.value = false; - }); + userList.value = response.rows + total.value = response.total + loading.value = false + }) } /** 杩斿洖鎸夐挳 */ function handleClose() { - const obj = { path: "/system/role" }; - proxy.$tab.closeOpenPage(obj); + const obj = { path: "/system/role" } + proxy.$tab.closeOpenPage(obj) } /** 鎼滅储鎸夐挳鎿嶄綔 */ function handleQuery() { - queryParams.pageNum = 1; - getList(); + queryParams.pageNum = 1 + getList() } /** 閲嶇疆鎸夐挳鎿嶄綔 */ function resetQuery() { - proxy.resetForm("queryRef"); - handleQuery(); + proxy.resetForm("queryRef") + handleQuery() } /** 澶氶�夋閫変腑鏁版嵁 */ function handleSelectionChange(selection) { - userIds.value = selection.map(item => item.userId); - multiple.value = !selection.length; + userIds.value = selection.map(item => item.userId) + multiple.value = !selection.length } /** 鎵撳紑鎺堟潈鐢ㄦ埛琛ㄥ脊绐� */ function openSelectUser() { - proxy.$refs["selectRef"].show(); + proxy.$refs["selectRef"].show() } /** 鍙栨秷鎺堟潈鎸夐挳鎿嶄綔 */ function cancelAuthUser(row) { proxy.$modal.confirm('纭瑕佸彇娑堣鐢ㄦ埛"' + row.userName + '"瑙掕壊鍚楋紵').then(function () { - return authUserCancel({ userId: row.userId, roleId: queryParams.roleId }); + return authUserCancel({ userId: row.userId, roleId: queryParams.roleId }) }).then(() => { - getList(); - proxy.$modal.msgSuccess("鍙栨秷鎺堟潈鎴愬姛"); - }).catch(() => {}); + getList() + proxy.$modal.msgSuccess("鍙栨秷鎺堟潈鎴愬姛") + }).catch(() => {}) } /** 鎵归噺鍙栨秷鎺堟潈鎸夐挳鎿嶄綔 */ function cancelAuthUserAll(row) { - const roleId = queryParams.roleId; - const uIds = userIds.value.join(","); + const roleId = queryParams.roleId + const uIds = userIds.value.join(",") proxy.$modal.confirm("鏄惁鍙栨秷閫変腑鐢ㄦ埛鎺堟潈鏁版嵁椤�?").then(function () { - return authUserCancelAll({ roleId: roleId, userIds: uIds }); + return authUserCancelAll({ roleId: roleId, userIds: uIds }) }).then(() => { - getList(); - proxy.$modal.msgSuccess("鍙栨秷鎺堟潈鎴愬姛"); - }).catch(() => {}); + getList() + proxy.$modal.msgSuccess("鍙栨秷鎺堟潈鎴愬姛") + }).catch(() => {}) } -getList(); +getList() </script> diff --git a/src/views/system/role/index.vue b/src/views/system/role/index.vue index 5bdb7e7..0a52f44 100644 --- a/src/views/system/role/index.vue +++ b/src/views/system/role/index.vue @@ -242,32 +242,32 @@ </template> <script setup name="Role"> -import { addRole, changeRoleStatus, dataScope, delRole, getRole, listRole, updateRole, deptTreeSelect } from "@/api/system/role"; -import { roleMenuTreeselect, treeselect as menuTreeselect } from "@/api/system/menu"; +import { addRole, changeRoleStatus, dataScope, delRole, getRole, listRole, updateRole, deptTreeSelect } from "@/api/system/role" +import { roleMenuTreeselect, treeselect as menuTreeselect } from "@/api/system/menu" -const router = useRouter(); -const { proxy } = getCurrentInstance(); -const { sys_normal_disable } = proxy.useDict("sys_normal_disable"); +const router = useRouter() +const { proxy } = getCurrentInstance() +const { sys_normal_disable } = proxy.useDict("sys_normal_disable") -const roleList = ref([]); -const open = ref(false); -const loading = ref(true); -const showSearch = ref(true); -const ids = ref([]); -const single = ref(true); -const multiple = ref(true); -const total = ref(0); -const title = ref(""); -const dateRange = ref([]); -const menuOptions = ref([]); -const menuExpand = ref(false); -const menuNodeAll = ref(false); -const deptExpand = ref(true); -const deptNodeAll = ref(false); -const deptOptions = ref([]); -const openDataScope = ref(false); -const menuRef = ref(null); -const deptRef = ref(null); +const roleList = ref([]) +const open = ref(false) +const loading = ref(true) +const showSearch = ref(true) +const ids = ref([]) +const single = ref(true) +const multiple = ref(true) +const total = ref(0) +const title = ref("") +const dateRange = ref([]) +const menuOptions = ref([]) +const menuExpand = ref(false) +const menuNodeAll = ref(false) +const deptExpand = ref(true) +const deptNodeAll = ref(false) +const deptOptions = ref([]) +const openDataScope = ref(false) +const menuRef = ref(null) +const deptRef = ref(null) /** 鏁版嵁鑼冨洿閫夐」*/ const dataScopeOptions = ref([ @@ -276,7 +276,7 @@ { value: "3", label: "鏈儴闂ㄦ暟鎹潈闄�" }, { value: "4", label: "鏈儴闂ㄥ強浠ヤ笅鏁版嵁鏉冮檺" }, { value: "5", label: "浠呮湰浜烘暟鎹潈闄�" } -]); +]) const data = reactive({ form: {}, @@ -292,115 +292,115 @@ roleKey: [{ required: true, message: "鏉冮檺瀛楃涓嶈兘涓虹┖", trigger: "blur" }], roleSort: [{ required: true, message: "瑙掕壊椤哄簭涓嶈兘涓虹┖", trigger: "blur" }] }, -}); +}) -const { queryParams, form, rules } = toRefs(data); +const { queryParams, form, rules } = toRefs(data) /** 鏌ヨ瑙掕壊鍒楄〃 */ function getList() { - loading.value = true; + loading.value = true listRole(proxy.addDateRange(queryParams.value, dateRange.value)).then(response => { - roleList.value = response.rows; - total.value = response.total; - loading.value = false; - }); + roleList.value = response.rows + total.value = response.total + loading.value = false + }) } /** 鎼滅储鎸夐挳鎿嶄綔 */ function handleQuery() { - queryParams.value.pageNum = 1; - getList(); + queryParams.value.pageNum = 1 + getList() } /** 閲嶇疆鎸夐挳鎿嶄綔 */ function resetQuery() { - dateRange.value = []; - proxy.resetForm("queryRef"); - handleQuery(); + dateRange.value = [] + proxy.resetForm("queryRef") + handleQuery() } /** 鍒犻櫎鎸夐挳鎿嶄綔 */ function handleDelete(row) { - const roleIds = row.roleId || ids.value; + const roleIds = row.roleId || ids.value proxy.$modal.confirm('鏄惁纭鍒犻櫎瑙掕壊缂栧彿涓�"' + roleIds + '"鐨勬暟鎹」?').then(function () { - return delRole(roleIds); + return delRole(roleIds) }).then(() => { - getList(); - proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛"); - }).catch(() => {}); + getList() + proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛") + }).catch(() => {}) } /** 瀵煎嚭鎸夐挳鎿嶄綔 */ function handleExport() { proxy.download("system/role/export", { ...queryParams.value, - }, `role_${new Date().getTime()}.xlsx`); + }, `role_${new Date().getTime()}.xlsx`) } /** 澶氶�夋閫変腑鏁版嵁 */ function handleSelectionChange(selection) { - ids.value = selection.map(item => item.roleId); - single.value = selection.length != 1; - multiple.value = !selection.length; + ids.value = selection.map(item => item.roleId) + single.value = selection.length != 1 + multiple.value = !selection.length } /** 瑙掕壊鐘舵�佷慨鏀� */ function handleStatusChange(row) { - let text = row.status === "0" ? "鍚敤" : "鍋滅敤"; + let text = row.status === "0" ? "鍚敤" : "鍋滅敤" proxy.$modal.confirm('纭瑕�"' + text + '""' + row.roleName + '"瑙掕壊鍚�?').then(function () { - return changeRoleStatus(row.roleId, row.status); + return changeRoleStatus(row.roleId, row.status) }).then(() => { - proxy.$modal.msgSuccess(text + "鎴愬姛"); + proxy.$modal.msgSuccess(text + "鎴愬姛") }).catch(function () { - row.status = row.status === "0" ? "1" : "0"; - }); + row.status = row.status === "0" ? "1" : "0" + }) } /** 鏇村鎿嶄綔 */ function handleCommand(command, row) { switch (command) { case "handleDataScope": - handleDataScope(row); - break; + handleDataScope(row) + break case "handleAuthUser": - handleAuthUser(row); - break; + handleAuthUser(row) + break default: - break; + break } } /** 鍒嗛厤鐢ㄦ埛 */ function handleAuthUser(row) { - router.push("/system/role-auth/user/" + row.roleId); + router.push("/system/role-auth/user/" + row.roleId) } /** 鏌ヨ鑿滃崟鏍戠粨鏋� */ function getMenuTreeselect() { menuTreeselect().then(response => { - menuOptions.value = response.data; - }); + menuOptions.value = response.data + }) } /** 鎵�鏈夐儴闂ㄨ妭鐐规暟鎹� */ function getDeptAllCheckedKeys() { // 鐩墠琚�変腑鐨勯儴闂ㄨ妭鐐� - let checkedKeys = deptRef.value.getCheckedKeys(); + let checkedKeys = deptRef.value.getCheckedKeys() // 鍗婇�変腑鐨勯儴闂ㄨ妭鐐� - let halfCheckedKeys = deptRef.value.getHalfCheckedKeys(); - checkedKeys.unshift.apply(checkedKeys, halfCheckedKeys); - return checkedKeys; + let halfCheckedKeys = deptRef.value.getHalfCheckedKeys() + checkedKeys.unshift.apply(checkedKeys, halfCheckedKeys) + return checkedKeys } /** 閲嶇疆鏂板鐨勮〃鍗曚互鍙婂叾浠栨暟鎹� */ function reset() { if (menuRef.value != undefined) { - menuRef.value.setCheckedKeys([]); + menuRef.value.setCheckedKeys([]) } - menuExpand.value = false; - menuNodeAll.value = false; - deptExpand.value = true; - deptNodeAll.value = false; + menuExpand.value = false + menuNodeAll.value = false + deptExpand.value = true + deptNodeAll.value = false form.value = { roleId: undefined, roleName: undefined, @@ -412,68 +412,68 @@ menuCheckStrictly: true, deptCheckStrictly: true, remark: undefined - }; - proxy.resetForm("roleRef"); + } + proxy.resetForm("roleRef") } /** 娣诲姞瑙掕壊 */ function handleAdd() { - reset(); - getMenuTreeselect(); - open.value = true; - title.value = "娣诲姞瑙掕壊"; + reset() + getMenuTreeselect() + open.value = true + title.value = "娣诲姞瑙掕壊" } /** 淇敼瑙掕壊 */ function handleUpdate(row) { - reset(); - const roleId = row.roleId || ids.value; - const roleMenu = getRoleMenuTreeselect(roleId); + reset() + const roleId = row.roleId || ids.value + const roleMenu = getRoleMenuTreeselect(roleId) getRole(roleId).then(response => { - form.value = response.data; - form.value.roleSort = Number(form.value.roleSort); - open.value = true; + form.value = response.data + form.value.roleSort = Number(form.value.roleSort) + open.value = true nextTick(() => { roleMenu.then((res) => { - let checkedKeys = res.checkedKeys; + let checkedKeys = res.checkedKeys checkedKeys.forEach((v) => { nextTick(() => { - menuRef.value.setChecked(v, true, false); - }); - }); - }); - }); - }); - title.value = "淇敼瑙掕壊"; + menuRef.value.setChecked(v, true, false) + }) + }) + }) + }) + }) + title.value = "淇敼瑙掕壊" } /** 鏍规嵁瑙掕壊ID鏌ヨ鑿滃崟鏍戠粨鏋� */ function getRoleMenuTreeselect(roleId) { return roleMenuTreeselect(roleId).then(response => { - menuOptions.value = response.menus; - return response; - }); + menuOptions.value = response.menus + return response + }) } /** 鏍规嵁瑙掕壊ID鏌ヨ閮ㄩ棬鏍戠粨鏋� */ function getDeptTree(roleId) { return deptTreeSelect(roleId).then(response => { - deptOptions.value = response.depts; - return response; - }); + deptOptions.value = response.depts + return response + }) } /** 鏍戞潈闄愶紙灞曞紑/鎶樺彔锛�*/ function handleCheckedTreeExpand(value, type) { if (type == "menu") { - let treeList = menuOptions.value; + let treeList = menuOptions.value for (let i = 0; i < treeList.length; i++) { - menuRef.value.store.nodesMap[treeList[i].id].expanded = value; + menuRef.value.store.nodesMap[treeList[i].id].expanded = value } } else if (type == "dept") { - let treeList = deptOptions.value; + let treeList = deptOptions.value for (let i = 0; i < treeList.length; i++) { - deptRef.value.store.nodesMap[treeList[i].id].expanded = value; + deptRef.value.store.nodesMap[treeList[i].id].expanded = value } } } @@ -481,29 +481,29 @@ /** 鏍戞潈闄愶紙鍏ㄩ��/鍏ㄤ笉閫夛級 */ function handleCheckedTreeNodeAll(value, type) { if (type == "menu") { - menuRef.value.setCheckedNodes(value ? menuOptions.value : []); + menuRef.value.setCheckedNodes(value ? menuOptions.value : []) } else if (type == "dept") { - deptRef.value.setCheckedNodes(value ? deptOptions.value : []); + deptRef.value.setCheckedNodes(value ? deptOptions.value : []) } } /** 鏍戞潈闄愶紙鐖跺瓙鑱斿姩锛� */ function handleCheckedTreeConnect(value, type) { if (type == "menu") { - form.value.menuCheckStrictly = value ? true : false; + form.value.menuCheckStrictly = value ? true : false } else if (type == "dept") { - form.value.deptCheckStrictly = value ? true : false; + form.value.deptCheckStrictly = value ? true : false } } /** 鎵�鏈夎彍鍗曡妭鐐规暟鎹� */ function getMenuAllCheckedKeys() { // 鐩墠琚�変腑鐨勮彍鍗曡妭鐐� - let checkedKeys = menuRef.value.getCheckedKeys(); + let checkedKeys = menuRef.value.getCheckedKeys() // 鍗婇�変腑鐨勮彍鍗曡妭鐐� - let halfCheckedKeys = menuRef.value.getHalfCheckedKeys(); - checkedKeys.unshift.apply(checkedKeys, halfCheckedKeys); - return checkedKeys; + let halfCheckedKeys = menuRef.value.getHalfCheckedKeys() + checkedKeys.unshift.apply(checkedKeys, halfCheckedKeys) + return checkedKeys } /** 鎻愪氦鎸夐挳 */ @@ -511,74 +511,74 @@ proxy.$refs["roleRef"].validate(valid => { if (valid) { if (form.value.roleId != undefined) { - form.value.menuIds = getMenuAllCheckedKeys(); + form.value.menuIds = getMenuAllCheckedKeys() updateRole(form.value).then(response => { - proxy.$modal.msgSuccess("淇敼鎴愬姛"); - open.value = false; - getList(); - }); + proxy.$modal.msgSuccess("淇敼鎴愬姛") + open.value = false + getList() + }) } else { - form.value.menuIds = getMenuAllCheckedKeys(); + form.value.menuIds = getMenuAllCheckedKeys() addRole(form.value).then(response => { - proxy.$modal.msgSuccess("鏂板鎴愬姛"); - open.value = false; - getList(); - }); + proxy.$modal.msgSuccess("鏂板鎴愬姛") + open.value = false + getList() + }) } } - }); + }) } /** 鍙栨秷鎸夐挳 */ function cancel() { - open.value = false; - reset(); + open.value = false + reset() } /** 閫夋嫨瑙掕壊鏉冮檺鑼冨洿瑙﹀彂 */ function dataScopeSelectChange(value) { if (value !== "2") { - deptRef.value.setCheckedKeys([]); + deptRef.value.setCheckedKeys([]) } } /** 鍒嗛厤鏁版嵁鏉冮檺鎿嶄綔 */ function handleDataScope(row) { - reset(); - const deptTreeSelect = getDeptTree(row.roleId); + reset() + const deptTreeSelect = getDeptTree(row.roleId) getRole(row.roleId).then(response => { - form.value = response.data; - openDataScope.value = true; + form.value = response.data + openDataScope.value = true nextTick(() => { deptTreeSelect.then(res => { nextTick(() => { if (deptRef.value) { - deptRef.value.setCheckedKeys(res.checkedKeys); + deptRef.value.setCheckedKeys(res.checkedKeys) } - }); - }); - }); - }); - title.value = "鍒嗛厤鏁版嵁鏉冮檺"; + }) + }) + }) + }) + title.value = "鍒嗛厤鏁版嵁鏉冮檺" } /** 鎻愪氦鎸夐挳锛堟暟鎹潈闄愶級 */ function submitDataScope() { if (form.value.roleId != undefined) { - form.value.deptIds = getDeptAllCheckedKeys(); + form.value.deptIds = getDeptAllCheckedKeys() dataScope(form.value).then(response => { - proxy.$modal.msgSuccess("淇敼鎴愬姛"); - openDataScope.value = false; - getList(); - }); + proxy.$modal.msgSuccess("淇敼鎴愬姛") + openDataScope.value = false + getList() + }) } } /** 鍙栨秷鎸夐挳锛堟暟鎹潈闄愶級*/ function cancelDataScope() { - openDataScope.value = false; - reset(); + openDataScope.value = false + reset() } -getList(); +getList() </script> diff --git a/src/views/system/role/selectUser.vue b/src/views/system/role/selectUser.vue index dd4158c..3e3d8aa 100644 --- a/src/views/system/role/selectUser.vue +++ b/src/views/system/role/selectUser.vue @@ -61,21 +61,21 @@ </template> <script setup name="SelectUser"> -import { authUserSelectAll, unallocatedUserList } from "@/api/system/role"; +import { authUserSelectAll, unallocatedUserList } from "@/api/system/role" const props = defineProps({ roleId: { type: [Number, String] } -}); +}) -const { proxy } = getCurrentInstance(); -const { sys_normal_disable } = proxy.useDict("sys_normal_disable"); +const { proxy } = getCurrentInstance() +const { sys_normal_disable } = proxy.useDict("sys_normal_disable") -const userList = ref([]); -const visible = ref(false); -const total = ref(0); -const userIds = ref([]); +const userList = ref([]) +const visible = ref(false) +const total = ref(0) +const userIds = ref([]) const queryParams = reactive({ pageNum: 1, @@ -83,62 +83,62 @@ roleId: undefined, userName: undefined, phonenumber: undefined -}); +}) // 鏄剧ず寮规 function show() { - queryParams.roleId = props.roleId; - getList(); - visible.value = true; + queryParams.roleId = props.roleId + getList() + visible.value = true } /**閫夋嫨琛� */ function clickRow(row) { - proxy.$refs["refTable"].toggleRowSelection(row); + proxy.$refs["refTable"].toggleRowSelection(row) } // 澶氶�夋閫変腑鏁版嵁 function handleSelectionChange(selection) { - userIds.value = selection.map(item => item.userId); + userIds.value = selection.map(item => item.userId) } // 鏌ヨ琛ㄦ暟鎹� function getList() { unallocatedUserList(queryParams).then(res => { - userList.value = res.rows; - total.value = res.total; - }); + userList.value = res.rows + total.value = res.total + }) } /** 鎼滅储鎸夐挳鎿嶄綔 */ function handleQuery() { - queryParams.pageNum = 1; - getList(); + queryParams.pageNum = 1 + getList() } /** 閲嶇疆鎸夐挳鎿嶄綔 */ function resetQuery() { - proxy.resetForm("queryRef"); - handleQuery(); + proxy.resetForm("queryRef") + handleQuery() } -const emit = defineEmits(["ok"]); +const emit = defineEmits(["ok"]) /** 閫夋嫨鎺堟潈鐢ㄦ埛鎿嶄綔 */ function handleSelectUser() { - const roleId = queryParams.roleId; - const uIds = userIds.value.join(","); + const roleId = queryParams.roleId + const uIds = userIds.value.join(",") if (uIds == "") { - proxy.$modal.msgError("璇烽�夋嫨瑕佸垎閰嶇殑鐢ㄦ埛"); - return; + proxy.$modal.msgError("璇烽�夋嫨瑕佸垎閰嶇殑鐢ㄦ埛") + return } authUserSelectAll({ roleId: roleId, userIds: uIds }).then(res => { - proxy.$modal.msgSuccess(res.msg); - visible.value = false; - emit("ok"); - }); + proxy.$modal.msgSuccess(res.msg) + visible.value = false + emit("ok") + }) } defineExpose({ show, -}); +}) </script> diff --git a/src/views/system/user/authRole.vue b/src/views/system/user/authRole.vue index 121b96a..3935ab1 100644 --- a/src/views/system/user/authRole.vue +++ b/src/views/system/user/authRole.vue @@ -46,78 +46,78 @@ </template> <script setup name="AuthRole"> -import { getAuthRole, updateAuthRole } from "@/api/system/user"; +import { getAuthRole, updateAuthRole } from "@/api/system/user" -const route = useRoute(); -const { proxy } = getCurrentInstance(); +const route = useRoute() +const { proxy } = getCurrentInstance() -const loading = ref(true); -const total = ref(0); -const pageNum = ref(1); -const pageSize = ref(10); -const roleIds = ref([]); -const roles = ref([]); +const loading = ref(true) +const total = ref(0) +const pageNum = ref(1) +const pageSize = ref(10) +const roleIds = ref([]) +const roles = ref([]) const form = ref({ nickName: undefined, userName: undefined, userId: undefined -}); +}) /** 鍗曞嚮閫変腑琛屾暟鎹� */ function clickRow(row) { if (checkSelectable(row)) { - proxy.$refs["roleRef"].toggleRowSelection(row); + proxy.$refs["roleRef"].toggleRowSelection(row) } -}; +} /** 澶氶�夋閫変腑鏁版嵁 */ function handleSelectionChange(selection) { - roleIds.value = selection.map(item => item.roleId); -}; + roleIds.value = selection.map(item => item.roleId) +} /** 淇濆瓨閫変腑鐨勬暟鎹紪鍙� */ function getRowKey(row) { - return row.roleId; -}; + return row.roleId +} // 妫�鏌ヨ鑹茬姸鎬� function checkSelectable(row) { - return row.status === "0" ? true : false; -}; + return row.status === "0" ? true : false +} /** 鍏抽棴鎸夐挳 */ function close() { - const obj = { path: "/system/user" }; - proxy.$tab.closeOpenPage(obj); -}; + const obj = { path: "/system/user" } + proxy.$tab.closeOpenPage(obj) +} /** 鎻愪氦鎸夐挳 */ function submitForm() { - const userId = form.value.userId; - const rIds = roleIds.value.join(","); + const userId = form.value.userId + const rIds = roleIds.value.join(",") updateAuthRole({ userId: userId, roleIds: rIds }).then(response => { - proxy.$modal.msgSuccess("鎺堟潈鎴愬姛"); - close(); - }); -}; + proxy.$modal.msgSuccess("鎺堟潈鎴愬姛") + close() + }) +} (() => { - const userId = route.params && route.params.userId; + const userId = route.params && route.params.userId if (userId) { - loading.value = true; + loading.value = true getAuthRole(userId).then(response => { - form.value = response.user; - roles.value = response.roles; - total.value = roles.value.length; + form.value = response.user + roles.value = response.roles + total.value = roles.value.length nextTick(() => { roles.value.forEach(row => { if (row.flag) { - proxy.$refs["roleRef"].toggleRowSelection(row); + proxy.$refs["roleRef"].toggleRowSelection(row) } - }); - }); - loading.value = false; - }); + }) + }) + loading.value = false + }) } -})(); +})() </script> diff --git a/src/views/system/user/index.vue b/src/views/system/user/index.vue index 4144812..86de9e1 100644 --- a/src/views/system/user/index.vue +++ b/src/views/system/user/index.vue @@ -214,33 +214,33 @@ </template> <script setup name="User"> -import { getToken } from "@/utils/auth"; +import { getToken } from "@/utils/auth" import useAppStore from '@/store/modules/app' -import { changeUserStatus, listUser, resetUserPwd, delUser, getUser, updateUser, addUser, deptTreeSelect } from "@/api/system/user"; +import { changeUserStatus, listUser, resetUserPwd, delUser, getUser, updateUser, addUser, deptTreeSelect } from "@/api/system/user" import { Splitpanes, Pane } from "splitpanes" import "splitpanes/dist/splitpanes.css" -const router = useRouter(); +const router = useRouter() const appStore = useAppStore() -const { proxy } = getCurrentInstance(); -const { sys_normal_disable, sys_user_sex } = proxy.useDict("sys_normal_disable", "sys_user_sex"); +const { proxy } = getCurrentInstance() +const { sys_normal_disable, sys_user_sex } = proxy.useDict("sys_normal_disable", "sys_user_sex") -const userList = ref([]); -const open = ref(false); -const loading = ref(true); -const showSearch = ref(true); -const ids = ref([]); -const single = ref(true); -const multiple = ref(true); -const total = ref(0); -const title = ref(""); -const dateRange = ref([]); -const deptName = ref(""); -const deptOptions = ref(undefined); -const enabledDeptOptions = ref(undefined); -const initPassword = ref(undefined); -const postOptions = ref([]); -const roleOptions = ref([]); +const userList = ref([]) +const open = ref(false) +const loading = ref(true) +const showSearch = ref(true) +const ids = ref([]) +const single = ref(true) +const multiple = ref(true) +const total = ref(0) +const title = ref("") +const dateRange = ref([]) +const deptName = ref("") +const deptOptions = ref(undefined) +const enabledDeptOptions = ref(undefined) +const initPassword = ref(undefined) +const postOptions = ref([]) +const roleOptions = ref([]) /*** 鐢ㄦ埛瀵煎叆鍙傛暟 */ const upload = reactive({ // 鏄惁鏄剧ず寮瑰嚭灞傦紙鐢ㄦ埛瀵煎叆锛� @@ -255,7 +255,7 @@ headers: { Authorization: "Bearer " + getToken() }, // 涓婁紶鐨勫湴鍧� url: import.meta.env.VITE_APP_BASE_API + "/system/user/importData" -}); +}) // 鍒楁樉闅愪俊鎭� const columns = ref([ { key: 0, label: `鐢ㄦ埛缂栧彿`, visible: true }, @@ -265,7 +265,7 @@ { key: 4, label: `鎵嬫満鍙风爜`, visible: true }, { key: 5, label: `鐘舵�乣, visible: true }, { key: 6, label: `鍒涘缓鏃堕棿`, visible: true } -]); +]) const data = reactive({ form: {}, @@ -284,122 +284,122 @@ email: [{ type: "email", message: "璇疯緭鍏ユ纭殑閭鍦板潃", trigger: ["blur", "change"] }], phonenumber: [{ pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, message: "璇疯緭鍏ユ纭殑鎵嬫満鍙风爜", trigger: "blur" }] } -}); +}) -const { queryParams, form, rules } = toRefs(data); +const { queryParams, form, rules } = toRefs(data) /** 閫氳繃鏉′欢杩囨护鑺傜偣 */ const filterNode = (value, data) => { - if (!value) return true; - return data.label.indexOf(value) !== -1; -}; + if (!value) return true + return data.label.indexOf(value) !== -1 +} /** 鏍规嵁鍚嶇О绛涢�夐儴闂ㄦ爲 */ watch(deptName, val => { - proxy.$refs["deptTreeRef"].filter(val); -}); + proxy.$refs["deptTreeRef"].filter(val) +}) /** 鏌ヨ鐢ㄦ埛鍒楄〃 */ function getList() { - loading.value = true; + loading.value = true listUser(proxy.addDateRange(queryParams.value, dateRange.value)).then(res => { - loading.value = false; - userList.value = res.rows; - total.value = res.total; - }); -}; + loading.value = false + userList.value = res.rows + total.value = res.total + }) +} /** 鏌ヨ閮ㄩ棬涓嬫媺鏍戠粨鏋� */ function getDeptTree() { deptTreeSelect().then(response => { - deptOptions.value = response.data; - enabledDeptOptions.value = filterDisabledDept(JSON.parse(JSON.stringify(response.data))); - }); -}; + deptOptions.value = response.data + enabledDeptOptions.value = filterDisabledDept(JSON.parse(JSON.stringify(response.data))) + }) +} /** 杩囨护绂佺敤鐨勯儴闂� */ function filterDisabledDept(deptList) { return deptList.filter(dept => { if (dept.disabled) { - return false; + return false } if (dept.children && dept.children.length) { - dept.children = filterDisabledDept(dept.children); + dept.children = filterDisabledDept(dept.children) } - return true; - }); -}; + return true + }) +} /** 鑺傜偣鍗曞嚮浜嬩欢 */ function handleNodeClick(data) { - queryParams.value.deptId = data.id; - handleQuery(); -}; + queryParams.value.deptId = data.id + handleQuery() +} /** 鎼滅储鎸夐挳鎿嶄綔 */ function handleQuery() { - queryParams.value.pageNum = 1; - getList(); -}; + queryParams.value.pageNum = 1 + getList() +} /** 閲嶇疆鎸夐挳鎿嶄綔 */ function resetQuery() { - dateRange.value = []; - proxy.resetForm("queryRef"); - queryParams.value.deptId = undefined; - proxy.$refs.deptTreeRef.setCurrentKey(null); - handleQuery(); -}; + dateRange.value = [] + proxy.resetForm("queryRef") + queryParams.value.deptId = undefined + proxy.$refs.deptTreeRef.setCurrentKey(null) + handleQuery() +} /** 鍒犻櫎鎸夐挳鎿嶄綔 */ function handleDelete(row) { - const userIds = row.userId || ids.value; + const userIds = row.userId || ids.value proxy.$modal.confirm('鏄惁纭鍒犻櫎鐢ㄦ埛缂栧彿涓�"' + userIds + '"鐨勬暟鎹」锛�').then(function () { - return delUser(userIds); + return delUser(userIds) }).then(() => { - getList(); - proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛"); - }).catch(() => {}); -}; + getList() + proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛") + }).catch(() => {}) +} /** 瀵煎嚭鎸夐挳鎿嶄綔 */ function handleExport() { proxy.download("system/user/export", { ...queryParams.value, - },`user_${new Date().getTime()}.xlsx`); -}; + },`user_${new Date().getTime()}.xlsx`) +} /** 鐢ㄦ埛鐘舵�佷慨鏀� */ function handleStatusChange(row) { - let text = row.status === "0" ? "鍚敤" : "鍋滅敤"; + let text = row.status === "0" ? "鍚敤" : "鍋滅敤" proxy.$modal.confirm('纭瑕�"' + text + '""' + row.userName + '"鐢ㄦ埛鍚�?').then(function () { - return changeUserStatus(row.userId, row.status); + return changeUserStatus(row.userId, row.status) }).then(() => { - proxy.$modal.msgSuccess(text + "鎴愬姛"); + proxy.$modal.msgSuccess(text + "鎴愬姛") }).catch(function () { - row.status = row.status === "0" ? "1" : "0"; - }); -}; + row.status = row.status === "0" ? "1" : "0" + }) +} /** 鏇村鎿嶄綔 */ function handleCommand(command, row) { switch (command) { case "handleResetPwd": - handleResetPwd(row); - break; + handleResetPwd(row) + break case "handleAuthRole": - handleAuthRole(row); - break; + handleAuthRole(row) + break default: - break; + break } -}; +} /** 璺宠浆瑙掕壊鍒嗛厤 */ function handleAuthRole(row) { - const userId = row.userId; - router.push("/system/user-auth/role/" + userId); -}; + const userId = row.userId + router.push("/system/user-auth/role/" + userId) +} /** 閲嶇疆瀵嗙爜鎸夐挳鎿嶄綔 */ function handleResetPwd(row) { @@ -416,48 +416,48 @@ }, }).then(({ value }) => { resetUserPwd(row.userId, value).then(response => { - proxy.$modal.msgSuccess("淇敼鎴愬姛锛屾柊瀵嗙爜鏄細" + value); - }); - }).catch(() => {}); -}; + proxy.$modal.msgSuccess("淇敼鎴愬姛锛屾柊瀵嗙爜鏄細" + value) + }) + }).catch(() => {}) +} /** 閫夋嫨鏉℃暟 */ function handleSelectionChange(selection) { - ids.value = selection.map(item => item.userId); - single.value = selection.length != 1; - multiple.value = !selection.length; -}; + ids.value = selection.map(item => item.userId) + single.value = selection.length != 1 + multiple.value = !selection.length +} /** 瀵煎叆鎸夐挳鎿嶄綔 */ function handleImport() { - upload.title = "鐢ㄦ埛瀵煎叆"; - upload.open = true; -}; + upload.title = "鐢ㄦ埛瀵煎叆" + upload.open = true +} /** 涓嬭浇妯℃澘鎿嶄綔 */ function importTemplate() { proxy.download("system/user/importTemplate", { - }, `user_template_${new Date().getTime()}.xlsx`); -}; + }, `user_template_${new Date().getTime()}.xlsx`) +} /**鏂囦欢涓婁紶涓鐞� */ const handleFileUploadProgress = (event, file, fileList) => { - upload.isUploading = true; -}; + upload.isUploading = true +} /** 鏂囦欢涓婁紶鎴愬姛澶勭悊 */ const handleFileSuccess = (response, file, fileList) => { - upload.open = false; - upload.isUploading = false; - proxy.$refs["uploadRef"].handleRemove(file); - proxy.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "瀵煎叆缁撴灉", { dangerouslyUseHTMLString: true }); - getList(); -}; + upload.open = false + upload.isUploading = false + proxy.$refs["uploadRef"].handleRemove(file) + proxy.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "瀵煎叆缁撴灉", { dangerouslyUseHTMLString: true }) + getList() +} /** 鎻愪氦涓婁紶鏂囦欢 */ function submitFileForm() { - proxy.$refs["uploadRef"].submit(); -}; + proxy.$refs["uploadRef"].submit() +} /** 閲嶇疆鎿嶄綔琛ㄥ崟 */ function reset() { @@ -474,43 +474,43 @@ remark: undefined, postIds: [], roleIds: [] - }; - proxy.resetForm("userRef"); -}; + } + proxy.resetForm("userRef") +} /** 鍙栨秷鎸夐挳 */ function cancel() { - open.value = false; - reset(); -}; + open.value = false + reset() +} /** 鏂板鎸夐挳鎿嶄綔 */ function handleAdd() { - reset(); + reset() getUser().then(response => { - postOptions.value = response.posts; - roleOptions.value = response.roles; - open.value = true; - title.value = "娣诲姞鐢ㄦ埛"; - form.value.password = initPassword.value; - }); -}; + postOptions.value = response.posts + roleOptions.value = response.roles + open.value = true + title.value = "娣诲姞鐢ㄦ埛" + form.value.password = initPassword.value + }) +} /** 淇敼鎸夐挳鎿嶄綔 */ function handleUpdate(row) { - reset(); - const userId = row.userId || ids.value; + reset() + const userId = row.userId || ids.value getUser(userId).then(response => { - form.value = response.data; - postOptions.value = response.posts; - roleOptions.value = response.roles; - form.value.postIds = response.postIds; - form.value.roleIds = response.roleIds; - open.value = true; - title.value = "淇敼鐢ㄦ埛"; - form.password = ""; - }); -}; + form.value = response.data + postOptions.value = response.posts + roleOptions.value = response.roles + form.value.postIds = response.postIds + form.value.roleIds = response.roleIds + open.value = true + title.value = "淇敼鐢ㄦ埛" + form.password = "" + }) +} /** 鎻愪氦鎸夐挳 */ function submitForm() { @@ -518,21 +518,21 @@ if (valid) { if (form.value.userId != undefined) { updateUser(form.value).then(response => { - proxy.$modal.msgSuccess("淇敼鎴愬姛"); - open.value = false; - getList(); - }); + proxy.$modal.msgSuccess("淇敼鎴愬姛") + open.value = false + getList() + }) } else { addUser(form.value).then(response => { - proxy.$modal.msgSuccess("鏂板鎴愬姛"); - open.value = false; - getList(); - }); + proxy.$modal.msgSuccess("鏂板鎴愬姛") + open.value = false + getList() + }) } } - }); -}; + }) +} -getDeptTree(); -getList(); +getDeptTree() +getList() </script> diff --git a/src/views/system/user/profile/index.vue b/src/views/system/user/profile/index.vue index a9cc7e3..d27c25b 100644 --- a/src/views/system/user/profile/index.vue +++ b/src/views/system/user/profile/index.vue @@ -63,25 +63,25 @@ </template> <script setup name="Profile"> -import userAvatar from "./userAvatar"; -import userInfo from "./userInfo"; -import resetPwd from "./resetPwd"; -import { getUserProfile } from "@/api/system/user"; +import userAvatar from "./userAvatar" +import userInfo from "./userInfo" +import resetPwd from "./resetPwd" +import { getUserProfile } from "@/api/system/user" -const activeTab = ref("userinfo"); +const activeTab = ref("userinfo") const state = reactive({ user: {}, roleGroup: {}, postGroup: {} -}); +}) function getUser() { getUserProfile().then(response => { - state.user = response.data; - state.roleGroup = response.roleGroup; - state.postGroup = response.postGroup; - }); -}; + state.user = response.data + state.roleGroup = response.roleGroup + state.postGroup = response.postGroup + }) +} -getUser(); +getUser() </script> diff --git a/src/views/system/user/profile/resetPwd.vue b/src/views/system/user/profile/resetPwd.vue index a70e634..308229a 100644 --- a/src/views/system/user/profile/resetPwd.vue +++ b/src/views/system/user/profile/resetPwd.vue @@ -17,43 +17,43 @@ </template> <script setup> -import { updateUserPwd } from "@/api/system/user"; +import { updateUserPwd } from "@/api/system/user" -const { proxy } = getCurrentInstance(); +const { proxy } = getCurrentInstance() const user = reactive({ oldPassword: undefined, newPassword: undefined, confirmPassword: undefined -}); +}) const equalToPassword = (rule, value, callback) => { if (user.newPassword !== value) { - callback(new Error("涓ゆ杈撳叆鐨勫瘑鐮佷笉涓�鑷�")); + callback(new Error("涓ゆ杈撳叆鐨勫瘑鐮佷笉涓�鑷�")) } else { - callback(); + callback() } -}; +} const rules = ref({ oldPassword: [{ required: true, message: "鏃у瘑鐮佷笉鑳戒负绌�", trigger: "blur" }], newPassword: [{ required: true, message: "鏂板瘑鐮佷笉鑳戒负绌�", trigger: "blur" }, { min: 6, max: 20, message: "闀垮害鍦� 6 鍒� 20 涓瓧绗�", trigger: "blur" }, { pattern: /^[^<>"'|\\]+$/, message: "涓嶈兘鍖呭惈闈炴硶瀛楃锛�< > \" ' \\\ |", trigger: "blur" }], confirmPassword: [{ required: true, message: "纭瀵嗙爜涓嶈兘涓虹┖", trigger: "blur" }, { required: true, validator: equalToPassword, trigger: "blur" }] -}); +}) /** 鎻愪氦鎸夐挳 */ function submit() { proxy.$refs.pwdRef.validate(valid => { if (valid) { updateUserPwd(user.oldPassword, user.newPassword).then(response => { - proxy.$modal.msgSuccess("淇敼鎴愬姛"); - }); + proxy.$modal.msgSuccess("淇敼鎴愬姛") + }) } - }); -}; + }) +} /** 鍏抽棴鎸夐挳 */ function close() { - proxy.$tab.closePage(); -}; + proxy.$tab.closePage() +} </script> diff --git a/src/views/system/user/profile/userAvatar.vue b/src/views/system/user/profile/userAvatar.vue index b99f58d..ae36e39 100644 --- a/src/views/system/user/profile/userAvatar.vue +++ b/src/views/system/user/profile/userAvatar.vue @@ -59,17 +59,17 @@ </template> <script setup> -import "vue-cropper/dist/index.css"; -import { VueCropper } from "vue-cropper"; -import { uploadAvatar } from "@/api/system/user"; -import useUserStore from "@/store/modules/user"; +import "vue-cropper/dist/index.css" +import { VueCropper } from "vue-cropper" +import { uploadAvatar } from "@/api/system/user" +import useUserStore from "@/store/modules/user" -const userStore = useUserStore(); -const { proxy } = getCurrentInstance(); +const userStore = useUserStore() +const { proxy } = getCurrentInstance() -const open = ref(false); -const visible = ref(false); -const title = ref("淇敼澶村儚"); +const open = ref(false) +const visible = ref(false) +const title = ref("淇敼澶村儚") //鍥剧墖瑁佸壀鏁版嵁 const options = reactive({ @@ -81,16 +81,16 @@ outputType: "png", // 榛樿鐢熸垚鎴浘涓篜NG鏍煎紡 filename: 'avatar', // 鏂囦欢鍚嶇О previews: {} //棰勮鏁版嵁 -}); +}) /** 缂栬緫澶村儚 */ function editCropper() { - open.value = true; + open.value = true } /** 鎵撳紑寮瑰嚭灞傜粨鏉熸椂鐨勫洖璋� */ function modalOpened() { - visible.value = true; + visible.value = true } /** 瑕嗙洊榛樿涓婁紶琛屼负 */ @@ -98,58 +98,58 @@ /** 鍚戝乏鏃嬭浆 */ function rotateLeft() { - proxy.$refs.cropper.rotateLeft(); + proxy.$refs.cropper.rotateLeft() } /** 鍚戝彸鏃嬭浆 */ function rotateRight() { - proxy.$refs.cropper.rotateRight(); + proxy.$refs.cropper.rotateRight() } /** 鍥剧墖缂╂斁 */ function changeScale(num) { - num = num || 1; - proxy.$refs.cropper.changeScale(num); + num = num || 1 + proxy.$refs.cropper.changeScale(num) } /** 涓婁紶棰勫鐞� */ function beforeUpload(file) { if (file.type.indexOf("image/") == -1) { - proxy.$modal.msgError("鏂囦欢鏍煎紡閿欒锛岃涓婁紶鍥剧墖绫诲瀷,濡傦細JPG锛孭NG鍚庣紑鐨勬枃浠躲��"); + proxy.$modal.msgError("鏂囦欢鏍煎紡閿欒锛岃涓婁紶鍥剧墖绫诲瀷,濡傦細JPG锛孭NG鍚庣紑鐨勬枃浠躲��") } else { - const reader = new FileReader(); - reader.readAsDataURL(file); + const reader = new FileReader() + reader.readAsDataURL(file) reader.onload = () => { - options.img = reader.result; - options.filename = file.name; - }; + options.img = reader.result + options.filename = file.name + } } } /** 涓婁紶鍥剧墖 */ function uploadImg() { proxy.$refs.cropper.getCropBlob(data => { - let formData = new FormData(); - formData.append("avatarfile", data, options.filename); + let formData = new FormData() + formData.append("avatarfile", data, options.filename) uploadAvatar(formData).then(response => { - open.value = false; - options.img = import.meta.env.VITE_APP_BASE_API + response.imgUrl; - userStore.avatar = options.img; - proxy.$modal.msgSuccess("淇敼鎴愬姛"); - visible.value = false; - }); - }); + open.value = false + options.img = import.meta.env.VITE_APP_BASE_API + response.imgUrl + userStore.avatar = options.img + proxy.$modal.msgSuccess("淇敼鎴愬姛") + visible.value = false + }) + }) } /** 瀹炴椂棰勮 */ function realTime(data) { - options.previews = data; + options.previews = data } /** 鍏抽棴绐楀彛 */ function closeDialog() { - options.img = userStore.avatar; - options.visible = false; + options.img = userStore.avatar + options.visible = false } </script> diff --git a/src/views/system/user/profile/userInfo.vue b/src/views/system/user/profile/userInfo.vue index 2c15e86..77f6924 100644 --- a/src/views/system/user/profile/userInfo.vue +++ b/src/views/system/user/profile/userInfo.vue @@ -23,45 +23,45 @@ </template> <script setup> -import { updateUserProfile } from "@/api/system/user"; +import { updateUserProfile } from "@/api/system/user" const props = defineProps({ user: { type: Object } -}); +}) -const { proxy } = getCurrentInstance(); +const { proxy } = getCurrentInstance() -const form = ref({}); +const form = ref({}) const rules = ref({ nickName: [{ required: true, message: "鐢ㄦ埛鏄电О涓嶈兘涓虹┖", trigger: "blur" }], email: [{ required: true, message: "閭鍦板潃涓嶈兘涓虹┖", trigger: "blur" }, { type: "email", message: "璇疯緭鍏ユ纭殑閭鍦板潃", trigger: ["blur", "change"] }], phonenumber: [{ required: true, message: "鎵嬫満鍙风爜涓嶈兘涓虹┖", trigger: "blur" }, { pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, message: "璇疯緭鍏ユ纭殑鎵嬫満鍙风爜", trigger: "blur" }], -}); +}) /** 鎻愪氦鎸夐挳 */ function submit() { proxy.$refs.userRef.validate(valid => { if (valid) { updateUserProfile(form.value).then(response => { - proxy.$modal.msgSuccess("淇敼鎴愬姛"); - props.user.phonenumber = form.value.phonenumber; - props.user.email = form.value.email; - }); + proxy.$modal.msgSuccess("淇敼鎴愬姛") + props.user.phonenumber = form.value.phonenumber + props.user.email = form.value.email + }) } - }); -}; + }) +} /** 鍏抽棴鎸夐挳 */ function close() { - proxy.$tab.closePage(); -}; + proxy.$tab.closePage() +} // 鍥炴樉褰撳墠鐧诲綍鐢ㄦ埛淇℃伅 watch(() => props.user, user => { if (user) { - form.value = { nickName: user.nickName, phonenumber: user.phonenumber, email: user.email, sex: user.sex }; + form.value = { nickName: user.nickName, phonenumber: user.phonenumber, email: user.email, sex: user.sex } } -},{ immediate: true }); +},{ immediate: true }) </script> diff --git a/src/views/tool/build/DraggableItem.vue b/src/views/tool/build/DraggableItem.vue index 927aafb..9ae2354 100644 --- a/src/views/tool/build/DraggableItem.vue +++ b/src/views/tool/build/DraggableItem.vue @@ -25,7 +25,7 @@ </el-col> </template> <script setup name="DraggableItem"> -import draggable from "vuedraggable/dist/vuedraggable.common"; +import draggable from "vuedraggable/dist/vuedraggable.common" import render from '@/utils/generator/render' const props = defineProps({ diff --git a/src/views/tool/gen/basicInfoForm.vue b/src/views/tool/gen/basicInfoForm.vue index 025ae42..8bfc373 100644 --- a/src/views/tool/gen/basicInfoForm.vue +++ b/src/views/tool/gen/basicInfoForm.vue @@ -36,7 +36,7 @@ type: Object, default: null } -}); +}) // 琛ㄥ崟鏍¢獙 const rules = ref({ @@ -44,5 +44,5 @@ tableComment: [{ required: true, message: "璇疯緭鍏ヨ〃鎻忚堪", trigger: "blur" }], className: [{ required: true, message: "璇疯緭鍏ュ疄浣撶被鍚嶇О", trigger: "blur" }], functionAuthor: [{ required: true, message: "璇疯緭鍏ヤ綔鑰�", trigger: "blur" }] -}); +}) </script> diff --git a/src/views/tool/gen/createTable.vue b/src/views/tool/gen/createTable.vue index 00fdfdb..ef6f8f3 100644 --- a/src/views/tool/gen/createTable.vue +++ b/src/views/tool/gen/createTable.vue @@ -13,34 +13,34 @@ </template> <script setup> -import { createTable } from "@/api/tool/gen"; +import { createTable } from "@/api/tool/gen" -const visible = ref(false); -const content = ref(""); -const { proxy } = getCurrentInstance(); -const emit = defineEmits(["ok"]); +const visible = ref(false) +const content = ref("") +const { proxy } = getCurrentInstance() +const emit = defineEmits(["ok"]) /** 鏄剧ず寮规 */ function show() { - visible.value = true; + visible.value = true } /** 瀵煎叆鎸夐挳鎿嶄綔 */ function handleImportTable() { if (content.value === "") { - proxy.$modal.msgError("璇疯緭鍏ュ缓琛ㄨ鍙�"); - return; + proxy.$modal.msgError("璇疯緭鍏ュ缓琛ㄨ鍙�") + return } createTable({ sql: content.value }).then(res => { - proxy.$modal.msgSuccess(res.msg); + proxy.$modal.msgSuccess(res.msg) if (res.code === 200) { - visible.value = false; - emit("ok"); + visible.value = false + emit("ok") } - }); + }) } defineExpose({ show, -}); +}) </script> diff --git a/src/views/tool/gen/editTable.vue b/src/views/tool/gen/editTable.vue index da9bc4a..874fc94 100644 --- a/src/views/tool/gen/editTable.vue +++ b/src/views/tool/gen/editTable.vue @@ -127,74 +127,74 @@ </template> <script setup name="GenEdit"> -import { getGenTable, updateGenTable } from "@/api/tool/gen"; -import { optionselect as getDictOptionselect } from "@/api/system/dict/type"; -import basicInfoForm from "./basicInfoForm"; -import genInfoForm from "./genInfoForm"; +import { getGenTable, updateGenTable } from "@/api/tool/gen" +import { optionselect as getDictOptionselect } from "@/api/system/dict/type" +import basicInfoForm from "./basicInfoForm" +import genInfoForm from "./genInfoForm" -const route = useRoute(); -const { proxy } = getCurrentInstance(); +const route = useRoute() +const { proxy } = getCurrentInstance() -const activeName = ref("columnInfo"); -const tableHeight = ref(document.documentElement.scrollHeight - 245 + "px"); -const tables = ref([]); -const columns = ref([]); -const dictOptions = ref([]); -const info = ref({}); +const activeName = ref("columnInfo") +const tableHeight = ref(document.documentElement.scrollHeight - 245 + "px") +const tables = ref([]) +const columns = ref([]) +const dictOptions = ref([]) +const info = ref({}) /** 鎻愪氦鎸夐挳 */ function submitForm() { - const basicForm = proxy.$refs.basicInfo.$refs.basicInfoForm; - const genForm = proxy.$refs.genInfo.$refs.genInfoForm; + const basicForm = proxy.$refs.basicInfo.$refs.basicInfoForm + const genForm = proxy.$refs.genInfo.$refs.genInfoForm Promise.all([basicForm, genForm].map(getFormPromise)).then(res => { - const validateResult = res.every(item => !!item); + const validateResult = res.every(item => !!item) if (validateResult) { - const genTable = Object.assign({}, info.value); - genTable.columns = columns.value; + const genTable = Object.assign({}, info.value) + genTable.columns = columns.value genTable.params = { treeCode: info.value.treeCode, treeName: info.value.treeName, treeParentCode: info.value.treeParentCode, parentMenuId: info.value.parentMenuId - }; + } updateGenTable(genTable).then(res => { - proxy.$modal.msgSuccess(res.msg); + proxy.$modal.msgSuccess(res.msg) if (res.code === 200) { - close(); + close() } - }); + }) } else { - proxy.$modal.msgError("琛ㄥ崟鏍¢獙鏈�氳繃锛岃閲嶆柊妫�鏌ユ彁浜ゅ唴瀹�"); + proxy.$modal.msgError("琛ㄥ崟鏍¢獙鏈�氳繃锛岃閲嶆柊妫�鏌ユ彁浜ゅ唴瀹�") } - }); + }) } function getFormPromise(form) { return new Promise(resolve => { form.validate(res => { - resolve(res); - }); - }); + resolve(res) + }) + }) } function close() { - const obj = { path: "/tool/gen", query: { t: Date.now(), pageNum: route.query.pageNum } }; - proxy.$tab.closeOpenPage(obj); + const obj = { path: "/tool/gen", query: { t: Date.now(), pageNum: route.query.pageNum } } + proxy.$tab.closeOpenPage(obj) } (() => { - const tableId = route.params && route.params.tableId; + const tableId = route.params && route.params.tableId if (tableId) { // 鑾峰彇琛ㄨ缁嗕俊鎭� getGenTable(tableId).then(res => { - columns.value = res.data.rows; - info.value = res.data.info; - tables.value = res.data.tables; - }); + columns.value = res.data.rows + info.value = res.data.info + tables.value = res.data.tables + }) /** 鏌ヨ瀛楀吀涓嬫媺鍒楄〃 */ getDictOptionselect().then(response => { - dictOptions.value = response.data; - }); + dictOptions.value = response.data + }) } -})(); +})() </script> diff --git a/src/views/tool/gen/genInfoForm.vue b/src/views/tool/gen/genInfoForm.vue index 926d268..b416a89 100644 --- a/src/views/tool/gen/genInfoForm.vue +++ b/src/views/tool/gen/genInfoForm.vue @@ -235,11 +235,11 @@ </template> <script setup> -import { listMenu } from "@/api/system/menu"; +import { listMenu } from "@/api/system/menu" -const subColumns = ref([]); -const menuOptions = ref([]); -const { proxy } = getCurrentInstance(); +const subColumns = ref([]) +const menuOptions = ref([]) +const { proxy } = getCurrentInstance() const props = defineProps({ info: { @@ -250,7 +250,7 @@ type: Array, default: null } -}); +}) // 琛ㄥ崟鏍¢獙 const rules = ref({ @@ -259,25 +259,25 @@ moduleName: [{ required: true, message: "璇疯緭鍏ョ敓鎴愭ā鍧楀悕", trigger: "blur" }], businessName: [{ required: true, message: "璇疯緭鍏ョ敓鎴愪笟鍔″悕", trigger: "blur" }], functionName: [{ required: true, message: "璇疯緭鍏ョ敓鎴愬姛鑳藉悕", trigger: "blur" }] -}); +}) function subSelectChange(value) { - props.info.subTableFkName = ""; + props.info.subTableFkName = "" } function tplSelectChange(value) { if (value !== "sub") { - props.info.subTableName = ""; - props.info.subTableFkName = ""; + props.info.subTableName = "" + props.info.subTableFkName = "" } } function setSubTableColumns(value) { for (var item in props.tables) { - const name = props.tables[item].tableName; + const name = props.tables[item].tableName if (value === name) { - subColumns.value = props.tables[item].columns; - break; + subColumns.value = props.tables[item].columns + break } } } @@ -285,22 +285,21 @@ /** 鏌ヨ鑿滃崟涓嬫媺鏍戠粨鏋� */ function getMenuTreeselect() { listMenu().then(response => { - menuOptions.value = proxy.handleTree(response.data, "menuId"); - }); + menuOptions.value = proxy.handleTree(response.data, "menuId") + }) } onMounted(() => { - getMenuTreeselect(); + getMenuTreeselect() }) watch(() => props.info.subTableName, val => { - setSubTableColumns(val); -}); + setSubTableColumns(val) +}) watch(() => props.info.tplWebType, val => { if (val === '') { - props.info.tplWebType = "element-plus"; + props.info.tplWebType = "element-plus" } -}); - +}) </script> diff --git a/src/views/tool/gen/importTable.vue b/src/views/tool/gen/importTable.vue index 49d96c3..23dbf28 100644 --- a/src/views/tool/gen/importTable.vue +++ b/src/views/tool/gen/importTable.vue @@ -51,76 +51,76 @@ </template> <script setup> -import { listDbTable, importTable } from "@/api/tool/gen"; +import { listDbTable, importTable } from "@/api/tool/gen" -const total = ref(0); -const visible = ref(false); -const tables = ref([]); -const dbTableList = ref([]); -const { proxy } = getCurrentInstance(); +const total = ref(0) +const visible = ref(false) +const tables = ref([]) +const dbTableList = ref([]) +const { proxy } = getCurrentInstance() const queryParams = reactive({ pageNum: 1, pageSize: 10, tableName: undefined, tableComment: undefined -}); +}) -const emit = defineEmits(["ok"]); +const emit = defineEmits(["ok"]) /** 鏌ヨ鍙傛暟鍒楄〃 */ function show() { - getList(); - visible.value = true; + getList() + visible.value = true } /** 鍗曞嚮閫夋嫨琛� */ function clickRow(row) { - proxy.$refs.table.toggleRowSelection(row); + proxy.$refs.table.toggleRowSelection(row) } /** 澶氶�夋閫変腑鏁版嵁 */ function handleSelectionChange(selection) { - tables.value = selection.map(item => item.tableName); + tables.value = selection.map(item => item.tableName) } /** 鏌ヨ琛ㄦ暟鎹� */ function getList() { listDbTable(queryParams).then(res => { - dbTableList.value = res.rows; - total.value = res.total; - }); + dbTableList.value = res.rows + total.value = res.total + }) } /** 鎼滅储鎸夐挳鎿嶄綔 */ function handleQuery() { - queryParams.pageNum = 1; - getList(); + queryParams.pageNum = 1 + getList() } /** 閲嶇疆鎸夐挳鎿嶄綔 */ function resetQuery() { - proxy.resetForm("queryRef"); - handleQuery(); + proxy.resetForm("queryRef") + handleQuery() } /** 瀵煎叆鎸夐挳鎿嶄綔 */ function handleImportTable() { - const tableNames = tables.value.join(","); + const tableNames = tables.value.join(",") if (tableNames == "") { - proxy.$modal.msgError("璇烽�夋嫨瑕佸鍏ョ殑琛�"); - return; + proxy.$modal.msgError("璇烽�夋嫨瑕佸鍏ョ殑琛�") + return } importTable({ tables: tableNames }).then(res => { - proxy.$modal.msgSuccess(res.msg); + proxy.$modal.msgSuccess(res.msg) if (res.code === 200) { - visible.value = false; - emit("ok"); + visible.value = false + emit("ok") } - }); + }) } defineExpose({ show, -}); +}) </script> diff --git a/src/views/tool/gen/index.vue b/src/views/tool/gen/index.vue index 3318784..e83d286 100644 --- a/src/views/tool/gen/index.vue +++ b/src/views/tool/gen/index.vue @@ -146,25 +146,25 @@ </template> <script setup name="Gen"> -import { listTable, previewTable, delTable, genCode, synchDb } from "@/api/tool/gen"; -import router from "@/router"; -import importTable from "./importTable"; -import createTable from "./createTable"; +import { listTable, previewTable, delTable, genCode, synchDb } from "@/api/tool/gen" +import router from "@/router" +import importTable from "./importTable" +import createTable from "./createTable" -const route = useRoute(); -const { proxy } = getCurrentInstance(); +const route = useRoute() +const { proxy } = getCurrentInstance() -const tableList = ref([]); -const loading = ref(true); -const showSearch = ref(true); -const ids = ref([]); -const single = ref(true); -const multiple = ref(true); -const total = ref(0); -const tableNames = ref([]); -const dateRange = ref([]); -const uniqueId = ref(""); -const defaultSort = ref({ prop: "createTime", order: "descending" }); +const tableList = ref([]) +const loading = ref(true) +const showSearch = ref(true) +const ids = ref([]) +const single = ref(true) +const multiple = ref(true) +const total = ref(0) +const tableNames = ref([]) +const dateRange = ref([]) +const uniqueId = ref("") +const defaultSort = ref({ prop: "createTime", order: "descending" }) const data = reactive({ queryParams: { @@ -181,126 +181,126 @@ data: {}, activeName: "domain.java" } -}); +}) -const { queryParams, preview } = toRefs(data); +const { queryParams, preview } = toRefs(data) onActivated(() => { - const time = route.query.t; + const time = route.query.t if (time != null && time != uniqueId.value) { - uniqueId.value = time; - queryParams.value.pageNum = Number(route.query.pageNum); - dateRange.value = []; - proxy.resetForm("queryForm"); - getList(); + uniqueId.value = time + queryParams.value.pageNum = Number(route.query.pageNum) + dateRange.value = [] + proxy.resetForm("queryForm") + getList() } }) /** 鏌ヨ琛ㄩ泦鍚� */ function getList() { - loading.value = true; + loading.value = true listTable(proxy.addDateRange(queryParams.value, dateRange.value)).then(response => { - tableList.value = response.rows; - total.value = response.total; - loading.value = false; - }); + tableList.value = response.rows + total.value = response.total + loading.value = false + }) } /** 鎼滅储鎸夐挳鎿嶄綔 */ function handleQuery() { - queryParams.value.pageNum = 1; - getList(); + queryParams.value.pageNum = 1 + getList() } /** 鐢熸垚浠g爜鎿嶄綔 */ function handleGenTable(row) { - const tbNames = row.tableName || tableNames.value; + const tbNames = row.tableName || tableNames.value if (tbNames == "") { - proxy.$modal.msgError("璇烽�夋嫨瑕佺敓鎴愮殑鏁版嵁"); - return; + proxy.$modal.msgError("璇烽�夋嫨瑕佺敓鎴愮殑鏁版嵁") + return } if (row.genType === "1") { genCode(row.tableName).then(response => { - proxy.$modal.msgSuccess("鎴愬姛鐢熸垚鍒拌嚜瀹氫箟璺緞锛�" + row.genPath); - }); + proxy.$modal.msgSuccess("鎴愬姛鐢熸垚鍒拌嚜瀹氫箟璺緞锛�" + row.genPath) + }) } else { - proxy.$download.zip("/tool/gen/batchGenCode?tables=" + tbNames, "ruoyi.zip"); + proxy.$download.zip("/tool/gen/batchGenCode?tables=" + tbNames, "ruoyi.zip") } } /** 鍚屾鏁版嵁搴撴搷浣� */ function handleSynchDb(row) { - const tableName = row.tableName; + const tableName = row.tableName proxy.$modal.confirm('纭瑕佸己鍒跺悓姝�"' + tableName + '"琛ㄧ粨鏋勫悧锛�').then(function () { - return synchDb(tableName); + return synchDb(tableName) }).then(() => { - proxy.$modal.msgSuccess("鍚屾鎴愬姛"); - }).catch(() => {}); + proxy.$modal.msgSuccess("鍚屾鎴愬姛") + }).catch(() => {}) } /** 鎵撳紑瀵煎叆琛ㄥ脊绐� */ function openImportTable() { - proxy.$refs["importRef"].show(); + proxy.$refs["importRef"].show() } /** 鎵撳紑鍒涘缓琛ㄥ脊绐� */ function openCreateTable() { - proxy.$refs["createRef"].show(); + proxy.$refs["createRef"].show() } /** 閲嶇疆鎸夐挳鎿嶄綔 */ function resetQuery() { - dateRange.value = []; - proxy.resetForm("queryRef"); - queryParams.value.pageNum = 1; - proxy.$refs["genRef"].sort(defaultSort.value.prop, defaultSort.value.order); + dateRange.value = [] + proxy.resetForm("queryRef") + queryParams.value.pageNum = 1 + proxy.$refs["genRef"].sort(defaultSort.value.prop, defaultSort.value.order) } /** 棰勮鎸夐挳 */ function handlePreview(row) { previewTable(row.tableId).then(response => { - preview.value.data = response.data; - preview.value.open = true; - preview.value.activeName = "domain.java"; - }); + preview.value.data = response.data + preview.value.open = true + preview.value.activeName = "domain.java" + }) } /** 澶嶅埗浠g爜鎴愬姛 */ function copyTextSuccess() { - proxy.$modal.msgSuccess("澶嶅埗鎴愬姛"); + proxy.$modal.msgSuccess("澶嶅埗鎴愬姛") } // 澶氶�夋閫変腑鏁版嵁 function handleSelectionChange(selection) { - ids.value = selection.map(item => item.tableId); - tableNames.value = selection.map(item => item.tableName); - single.value = selection.length != 1; - multiple.value = !selection.length; + ids.value = selection.map(item => item.tableId) + tableNames.value = selection.map(item => item.tableName) + single.value = selection.length != 1 + multiple.value = !selection.length } /** 鎺掑簭瑙﹀彂浜嬩欢 */ function handleSortChange(column, prop, order) { - queryParams.value.orderByColumn = column.prop; - queryParams.value.isAsc = column.order; - getList(); + queryParams.value.orderByColumn = column.prop + queryParams.value.isAsc = column.order + getList() } /** 淇敼鎸夐挳鎿嶄綔 */ function handleEditTable(row) { - const tableId = row.tableId || ids.value[0]; - router.push({ path: "/tool/gen-edit/index/" + tableId, query: { pageNum: queryParams.value.pageNum } }); + const tableId = row.tableId || ids.value[0] + router.push({ path: "/tool/gen-edit/index/" + tableId, query: { pageNum: queryParams.value.pageNum } }) } /** 鍒犻櫎鎸夐挳鎿嶄綔 */ function handleDelete(row) { - const tableIds = row.tableId || ids.value; + const tableIds = row.tableId || ids.value proxy.$modal.confirm('鏄惁纭鍒犻櫎琛ㄧ紪鍙蜂负"' + tableIds + '"鐨勬暟鎹」锛�').then(function () { - return delTable(tableIds); + return delTable(tableIds) }).then(() => { - getList(); - proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛"); - }).catch(() => {}); + getList() + proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛") + }).catch(() => {}) } -getList(); +getList() </script> diff --git a/vite.config.js b/vite.config.js index 8a49d01..13d1fcb 100644 --- a/vite.config.js +++ b/vite.config.js @@ -59,7 +59,6 @@ } } }, - //fix:error:stdin>:7356:1: warning: "@charset" must be the first rule in the file css: { postcss: { plugins: [ @@ -68,7 +67,7 @@ AtRule: { charset: (atRule) => { if (atRule.name === 'charset') { - atRule.remove(); + atRule.remove() } } } -- Gitblit v1.9.3