| | |
| | | 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
|
| | |
| | | // 表达式值变化时,开始去计算结果
|
| | | 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')
|
| | | // 校验当前星期是否在星期池(dayRuleSup)中
|
| | | 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')
|
| | | // 找到要求中最近的那个星期几
|
| | | 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
|
| | |
| | | }
|
| | | // 判断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)
|
| | |
| | | }
|
| | | // 获取"月"数组
|
| | | 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) {
|
| | |
| | | // 只有当日期规则的两个值均为“”时则表达日期是有选项的
|
| | | 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) {
|
| | |
| | | }
|
| | | // 获取"分"数组
|
| | | 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) {
|
| | |
| | | }
|
| | | // 获取"秒"数组
|
| | | 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) {
|
| | |
| | | }
|
| | | // 根据传进来的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
|
| | | }
|
| | | // 比较数字大小(用于Array.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') {
|
| | | // 在quartz中 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()
|
| | |
| | |
|
| | | <script setup>
|
| | | // 记录未匹配的项
|
| | | const unmatchArray = ref([]);
|
| | | const unmatchArray = ref([])
|
| | |
|
| | | const props = defineProps({
|
| | | // 数据
|
| | |
| | | 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
|
| | | // 传入值为数组
|
| | |
| | | }
|
| | | })
|
| | | 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>
|
| | |
|
| | |
| | | </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({ |
| | | /* 编辑器的内容 */ |
| | |
| | | type: String, |
| | | default: "url", |
| | | } |
| | | }); |
| | | }) |
| | | |
| | | const options = ref({ |
| | | theme: "snow", |
| | |
| | | }, |
| | | 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 |
| | | } |
| | | |
| | | // 上传成功处理 |
| | |
| | | // 如果上传成功 |
| | | 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 |
| | | // 插入图片,res.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> |
| | |
| | | <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>
|
| | |
| | | </template>
|
| | |
|
| | | <script setup>
|
| | | import { getToken } from "@/utils/auth";
|
| | | import { getToken } from "@/utils/auth"
|
| | |
|
| | | const props = defineProps({
|
| | | modelValue: [String, Object, Array],
|
| | |
| | | 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('文件名不正确,不能包含英文逗号!');
|
| | | 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
|
| | | }
|
| | | }
|
| | | proxy.$modal.loading("正在上传文件,请稍候...");
|
| | | number.value++;
|
| | | return true;
|
| | | proxy.$modal.loading("正在上传文件,请稍候...")
|
| | | 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()
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | function getFileName(name) {
|
| | | // 如果是url那么取最后的名字 如果不是直接返回
|
| | | 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>
|
| | |
|
| | |
| | |
|
| | | const emit = defineEmits()
|
| | | const toggleClick = () => {
|
| | | emit('toggleClick');
|
| | | emit('toggleClick')
|
| | | }
|
| | | </script>
|
| | |
|
| | |
| | | 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
|
| | |
| | | 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 |
| | |
| | | </template>
|
| | |
|
| | | <script setup>
|
| | | import { isExternal } from "@/utils/validate";
|
| | | import { isExternal } from "@/utils/validate"
|
| | |
|
| | | const props = defineProps({
|
| | | src: {
|
| | |
| | | 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>
|
| | |
| | | </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],
|
| | |
| | | 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 })
|
| | |
|
| | | // 上传前loading加载
|
| | | 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('文件名不正确,不能包含英文逗号!');
|
| | | 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
|
| | | }
|
| | | }
|
| | | proxy.$modal.loading("正在上传图片,请稍候...");
|
| | | number.value++;
|
| | | proxy.$modal.loading("正在上传图片,请稍候...")
|
| | | 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>
|
| | |
|
| | |
| | | }
|
| | | })
|
| | |
|
| | | const emit = defineEmits();
|
| | | const emit = defineEmits()
|
| | | const currentPage = computed({
|
| | | get() {
|
| | | return props.page
|
| | |
| | | emit('update:limit', val)
|
| | | }
|
| | | })
|
| | |
|
| | | function handleSizeChange(val) {
|
| | | if (currentPage.value * val > props.total) {
|
| | | currentPage.value = 1
|
| | |
| | | scrollTo(0, 800)
|
| | | }
|
| | | }
|
| | |
|
| | | function handleCurrentChange(val) {
|
| | | emit('pagination', { page: val, limit: pageSize.value })
|
| | | if (props.autoScroll) {
|
| | | scrollTo(0, 800)
|
| | | }
|
| | | }
|
| | |
|
| | | </script>
|
| | |
|
| | | <style scoped>
|
| | |
| | | </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)
|
| | |
| | | </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)
|
| | |
| | | <script setup>
|
| | | import { useFullscreen } from '@vueuse/core'
|
| | |
|
| | | const { isFullscreen, enter, exit, toggle } = useFullscreen();
|
| | | const { isFullscreen, enter, exit, toggle } = useFullscreen()
|
| | | </script>
|
| | |
|
| | | <style lang='scss' scoped>
|
| | |
| | | </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("正在设置布局大小,请稍候...");
|
| | | appStore.setSize(size);
|
| | | setTimeout("window.location.reload()", 1000);
|
| | | proxy.$modal.loading("正在设置布局大小,请稍候...")
|
| | | appStore.setSize(size)
|
| | | setTimeout("window.location.reload()", 1000)
|
| | | }
|
| | | </script>
|
| | |
|
| | |
| | | export default {
|
| | | install: (app) => {
|
| | | for (const key in components) {
|
| | | const componentConfig = components[key];
|
| | | app.component(componentConfig.name, componentConfig);
|
| | | const componentConfig = components[key]
|
| | | app.component(componentConfig.name, componentConfig)
|
| | | }
|
| | | },
|
| | | };
|
| | | }
|
| | | }
|
| | |
| | | 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):// 路径新窗口打开
|
| | | 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)
|
| | | })
|
| | |
| | |
|
| | | 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>
|
| | |
| | | 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
|
| | | }
|
| | |
| | | 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) {
|
| | |
| | | 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) {
|
| | |
| | | </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>
|
| | |
| | | iframeId: {
|
| | | type: String
|
| | | }
|
| | | });
|
| | | })
|
| | |
|
| | | const height = ref(document.documentElement.clientHeight - 94.5 + "px");
|
| | | const height = ref(document.documentElement.clientHeight - 94.5 + "px")
|
| | | </script>
|
| | |
| | | function handleCommand(command) {
|
| | | switch (command) {
|
| | | case "setLayout":
|
| | | setLayout();
|
| | | break;
|
| | | setLayout()
|
| | | break
|
| | | case "logout":
|
| | | logout();
|
| | | break;
|
| | | logout()
|
| | | break
|
| | | default:
|
| | | break;
|
| | | break
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | 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() {
|
| | |
| | | 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"])
|
| | |
|
| | | /** 是否需要topnav */
|
| | | 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("正在保存到本地,请稍候...");
|
| | | proxy.$modal.loading("正在保存到本地,请稍候...")
|
| | | let layoutSetting = {
|
| | | "topNav": storeSettings.value.topNav,
|
| | | "tagsView": storeSettings.value.tagsView,
|
| | |
| | | "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("正在清除设置缓存并刷新,请稍候...");
|
| | | proxy.$modal.loading("正在清除设置缓存并刷新,请稍候...")
|
| | | localStorage.removeItem("layout-setting")
|
| | | setTimeout("window.location.reload()", 1000)
|
| | | }
|
| | |
|
| | | function openSetting() {
|
| | | showSettings.value = true;
|
| | | showSettings.value = true
|
| | | }
|
| | |
|
| | | defineExpose({
|
| | | openSetting,
|
| | | openSetting
|
| | | })
|
| | | </script>
|
| | |
|
| | |
| | | }
|
| | | })
|
| | |
|
| | | 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>
|
| | |
| | | }
|
| | | })
|
| | |
|
| | | const onlyOneChild = ref({});
|
| | | const onlyOneChild = ref({})
|
| | |
|
| | | function hasOneShowingChild(children = [], parent) {
|
| | | if (!children) {
|
| | | children = [];
|
| | | children = []
|
| | | }
|
| | | const showingChildren = children.filter(item => {
|
| | | if (item.hidden) {
|
| | |
| | | }
|
| | |
|
| | | return false
|
| | | };
|
| | | }
|
| | |
|
| | | function resolvePath(routePath, routeQuery) {
|
| | | if (isExternal(routePath)) {
|
| | |
| | | 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)
|
| | |
| | |
|
| | | function hasTitle(title){
|
| | | if (title.length > 5) {
|
| | | return title;
|
| | | return title
|
| | | } else {
|
| | | return "";
|
| | | return ""
|
| | | }
|
| | | }
|
| | | </script>
|
| | |
| | | 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>
|
| | |
| | | <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)
|
| | |
| | |
|
| | | function handleScroll(e) {
|
| | | const eventDelta = e.wheelDelta || -e.deltaY * 40
|
| | | const $scrollWrapper = scrollWrapper.value;
|
| | | const $scrollWrapper = scrollWrapper.value
|
| | | $scrollWrapper.scrollLeft = $scrollWrapper.scrollLeft + eventDelta / 4
|
| | | }
|
| | |
|
| | |
| | | }
|
| | |
|
| | | 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
|
| | |
| | | } 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]
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | 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()
|
| | |
| | | }
|
| | |
|
| | | function activeStyle(tag) {
|
| | | if (!isActive(tag)) return {};
|
| | | if (!isActive(tag)) return {}
|
| | | return {
|
| | | "background-color": theme.value,
|
| | | "border-color": theme.value
|
| | | };
|
| | | }
|
| | | }
|
| | |
|
| | | function isAffix(tag) {
|
| | |
| | | }
|
| | |
|
| | | 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) {
|
| | |
| | | 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)
|
| | |
| | | }
|
| | |
|
| | | function refreshSelectedTag(view) {
|
| | | proxy.$tab.refreshPage(view);
|
| | | proxy.$tab.refreshPage(view)
|
| | | if (route.meta.link) {
|
| | | useTagsViewStore().delIframeView(route);
|
| | | useTagsViewStore().delIframeView(route)
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | }
|
| | |
|
| | | function closeOthersTags() {
|
| | | router.push(selectedTag.value).catch(() => { });
|
| | | router.push(selectedTag.value).catch(() => { })
|
| | | proxy.$tab.closeOtherPage(selectedTag.value).then(() => {
|
| | | moveToCurrentTag()
|
| | | })
|
| | |
| | | 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,
|
| | |
| | | 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) {
|
| | |
| | | useAppStore().closeSideBar({ withoutAnimation: false })
|
| | | }
|
| | |
|
| | | const settingRef = ref(null);
|
| | | const settingRef = ref(null)
|
| | | function setLayout() {
|
| | | settingRef.value.openSetting();
|
| | | settingRef.value.openSetting()
|
| | | }
|
| | | </script>
|
| | |
|
| | |
| | | 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 => {
|
| | |
| | | }
|
| | |
|
| | | function authRole(role) {
|
| | | const super_admin = "admin";
|
| | | const super_admin = "admin"
|
| | | const roles = useUserStore().roles
|
| | | if (role && role.length > 0) {
|
| | | return roles.some(v => {
|
| | |
| | | export default {
|
| | | // 验证用户是否具备某权限
|
| | | hasPermi(permission) {
|
| | | return authPermission(permission);
|
| | | return authPermission(permission)
|
| | | },
|
| | | // 验证用户是否含有指定权限,只需包含其中一个
|
| | | hasPermiOr(permissions) {
|
| | |
| | | },
|
| | | // 验证用户是否具备某角色
|
| | | hasRole(role) {
|
| | | return authRole(role);
|
| | | return authRole(role)
|
| | | },
|
| | | // 验证用户是否含有指定角色,只需包含其中一个
|
| | | hasRoleOr(roles) {
|
| | |
| | | return null
|
| | | },
|
| | | remove (key) {
|
| | | sessionStorage.removeItem(key);
|
| | | sessionStorage.removeItem(key)
|
| | | }
|
| | | }
|
| | | const localCache = {
|
| | |
| | | return null
|
| | | },
|
| | | remove (key) {
|
| | | localStorage.removeItem(key);
|
| | | localStorage.removeItem(key)
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | import { blobValidate } from '@/utils/ruoyi'
|
| | |
|
| | | const baseURL = import.meta.env.VITE_APP_BASE_API
|
| | | let downloadLoadingInstance;
|
| | | let downloadLoadingInstance
|
| | |
|
| | | export default {
|
| | | name(name, isDelete = true) {
|
| | |
| | | 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)
|
| | | }
|
| | | })
|
| | | },
|
| | |
| | | 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)
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | import { ElMessage, ElMessageBox, ElNotification, ElLoading } from 'element-plus'
|
| | |
|
| | | let loadingInstance;
|
| | | let loadingInstance
|
| | |
|
| | | export default {
|
| | | // 消息提示
|
| | |
| | | },
|
| | | // 错误通知
|
| | | notifyError(content) {
|
| | | ElNotification.error(content);
|
| | | ElNotification.error(content)
|
| | | },
|
| | | // 成功通知
|
| | | notifySuccess(content) {
|
| | |
| | | },
|
| | | // 关闭遮罩层
|
| | | closeLoading() {
|
| | | loadingInstance.close();
|
| | | loadingInstance.close()
|
| | | }
|
| | | }
|
| | |
| | | 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
|
| | |
| | | },
|
| | | // 关闭当前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页签
|
| | |
| | | if (latestView) {
|
| | | return router.push(latestView.fullPath)
|
| | | }
|
| | | return router.push('/');
|
| | | });
|
| | | return router.push('/')
|
| | | })
|
| | | }
|
| | | return useTagsViewStore().delView(obj);
|
| | | return useTagsViewStore().delView(obj)
|
| | | },
|
| | | // 关闭所有tab页签
|
| | | 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)
|
| | | }
|
| | | }
|
| | |
| | | }
|
| | | return { top: 0 }
|
| | | },
|
| | | });
|
| | | })
|
| | |
|
| | | export default router;
|
| | | export default router
|
| | |
| | | actions: {
|
| | | toggleSideBar(withoutAnimation) {
|
| | | if (this.sidebar.hide) {
|
| | | return false;
|
| | | return false
|
| | | }
|
| | | this.sidebar.opened = !this.sidebar.opened
|
| | | this.sidebar.withoutAnimation = withoutAnimation
|
| | |
| | | this.device = device
|
| | | },
|
| | | setSize(size) {
|
| | | this.size = size;
|
| | | this.size = size
|
| | | Cookies.set('size', size)
|
| | | },
|
| | | toggleSideBarHide(status) {
|
| | |
| | | // 获取字典
|
| | | 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
|
| | | }
|
| | | },
|
| | | // 设置字典
|
| | |
| | | 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() {
|
| | |
| | | }
|
| | |
|
| | | 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
|
| | |
| | | * 获取字典数据
|
| | | */
|
| | | 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)
|
| | | })()
|
| | | } |
| | |
| | | * 动态修改标题
|
| | | */
|
| | | 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
|
| | | }
|
| | | } |
| | |
| | | * 表格时间格式化
|
| | | */
|
| | | 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
|
| | |
| | | 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)
|
| | |
| | | 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)
|
| | |
| | | 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实例
|
| | |
| | | }
|
| | | // 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 = {
|
| | |
| | | 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 = '数据正在处理,请勿重复提交';
|
| | | const message = '数据正在处理,请勿重复提交'
|
| | | console.warn(`[${s_url}]: ` + message)
|
| | | return Promise.reject(new Error(message))
|
| | | } else {
|
| | |
| | | // 响应拦截器
|
| | | 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']
|
| | | // 二进制数据则直接返回
|
| | |
| | | }
|
| | | 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) {
|
| | |
| | | },
|
| | | 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)
|
| | |
| | | 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()
|
| | | })
|
| | | }
|
| | |
|
| | |
| | | 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
|
| | |
| | | // 表单重置
|
| | | 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
|
| | | }
|
| | |
|
| | | // 数据合并
|
| | |
| | | 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
|
| | | }
|
| | |
|
| | | /**
|
| | | * 构造树型结构数据
|
| | |
| | | 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] = []
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | 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
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | 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) + "&"
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | 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)
|
| | |
| | | </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>
|
| | |
| | | </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",
|
| | |
| | | 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>
|
| | |
| | | </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("正在加载缓存监控数据,请稍候!");
|
| | | proxy.$modal.loading("正在加载缓存监控数据,请稍候!")
|
| | | 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",
|
| | |
| | | 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
|
| | |
| | | ]
|
| | | })
|
| | | window.addEventListener("resize", () => {
|
| | | commandstatsIntance.resize();
|
| | | usedmemoryInstance.resize();
|
| | | });
|
| | | commandstatsIntance.resize()
|
| | | usedmemoryInstance.resize()
|
| | | })
|
| | | })
|
| | | }
|
| | |
|
| | | getList();
|
| | | getList()
|
| | | </script>
|
| | |
| | | </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>
|
| | |
| | | <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>
|
| | |
| | | </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: {},
|
| | |
| | | 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()
|
| | | }
|
| | |
|
| | | /** 表单重置 */
|
| | |
| | | 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 = "修改任务"
|
| | | })
|
| | | }
|
| | |
|
| | | /** 提交按钮 */
|
| | |
| | | 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>
|
| | |
| | | </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: {},
|
| | |
| | | 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>
|
| | |
| | | </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({
|
| | |
| | | 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(() => {})
|
| | | }
|
| | |
|
| | | /** 解锁按钮操作 */
|
| | | function handleUnlock() {
|
| | | const username = selectName.value;
|
| | | const username = selectName.value
|
| | | proxy.$modal.confirm('是否确认解锁用户"' + username + '"数据项?').then(function () {
|
| | | return unlockLogininfor(username);
|
| | | return unlockLogininfor(username)
|
| | | }).then(() => {
|
| | | proxy.$modal.msgSuccess("用户" + username + "解锁成功");
|
| | | }).catch(() => {});
|
| | | proxy.$modal.msgSuccess("用户" + username + "解锁成功")
|
| | | }).catch(() => {})
|
| | | }
|
| | |
|
| | | /** 导出按钮操作 */
|
| | | function handleExport() {
|
| | | proxy.download("monitor/logininfor/export", {
|
| | | ...queryParams.value,
|
| | | }, `logininfor_${new Date().getTime()}.xlsx`);
|
| | | }, `logininfor_${new Date().getTime()}.xlsx`)
|
| | | }
|
| | |
|
| | | getList();
|
| | | getList()
|
| | | </script>
|
| | |
| | | </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>
|
| | |
| | | </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: {},
|
| | |
| | | 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>
|
| | |
| | | <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("正在加载服务监控数据,请稍候!");
|
| | | proxy.$modal.loading("正在加载服务监控数据,请稍候!")
|
| | | getServer().then(response => {
|
| | | server.value = response.data;
|
| | | proxy.$modal.closeLoading();
|
| | | });
|
| | | server.value = response.data
|
| | | proxy.$modal.closeLoading()
|
| | | })
|
| | | }
|
| | |
|
| | | getList();
|
| | | getList()
|
| | | </script>
|
| | |
| | | <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
|
| | |
|
| | |
| | | </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: "",
|
| | |
| | | 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: [
|
| | |
| | | { 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>
|
| | |
| | | </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: {},
|
| | |
| | | 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()
|
| | | }
|
| | |
|
| | | /** 表单重置 */
|
| | |
| | | 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 = "修改参数"
|
| | | })
|
| | | }
|
| | |
|
| | | /** 提交按钮 */
|
| | |
| | | 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>
|
| | |
| | | </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: {},
|
| | |
| | | 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()
|
| | | }
|
| | |
|
| | | /** 表单重置 */
|
| | |
| | | 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 = "修改部门"
|
| | | })
|
| | | }
|
| | |
|
| | | /** 提交按钮 */
|
| | |
| | | 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>
|
| | |
| | |
|
| | | <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: "默认" },
|
| | |
| | | { value: "info", label: "信息" },
|
| | | { value: "warning", label: "警告" },
|
| | | { value: "danger", label: "危险" }
|
| | | ]);
|
| | | ])
|
| | |
|
| | | const data = reactive({
|
| | | form: {},
|
| | |
| | | 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()
|
| | | }
|
| | |
|
| | | /** 表单重置 */
|
| | |
| | | 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 = "修改字典数据"
|
| | | })
|
| | | }
|
| | |
|
| | | /** 提交按钮 */
|
| | |
| | | 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>
|
| | |
| | |
|
| | | <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: {},
|
| | |
| | | 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()
|
| | | }
|
| | |
|
| | | /** 表单重置 */
|
| | |
| | | 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 = "修改字典类型"
|
| | | })
|
| | | }
|
| | |
|
| | | /** 提交按钮 */
|
| | |
| | | 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>
|
| | |
| | | </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: {},
|
| | |
| | | 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()
|
| | | }
|
| | |
|
| | | /** 表单重置 */
|
| | |
| | | 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 = "修改菜单"
|
| | | })
|
| | | }
|
| | |
|
| | | /** 提交按钮 */
|
| | |
| | | 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>
|
| | |
| | | </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: {},
|
| | |
| | | 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()
|
| | | }
|
| | |
|
| | | /** 表单重置 */
|
| | |
| | | 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 = "修改公告"
|
| | | })
|
| | | }
|
| | |
|
| | | /** 提交按钮 */
|
| | |
| | | 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>
|
| | |
| | | </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: {},
|
| | |
| | | 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()
|
| | | }
|
| | |
|
| | | /** 表单重置 */
|
| | |
| | | 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 = "修改岗位"
|
| | | })
|
| | | }
|
| | |
|
| | | /** 提交按钮 */
|
| | |
| | | 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>
|
| | |
| | | </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,
|
| | |
| | | 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>
|
| | |
| | | </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([
|
| | |
| | | { value: "3", label: "本部门数据权限" },
|
| | | { value: "4", label: "本部门及以下数据权限" },
|
| | | { value: "5", label: "仅本人数据权限" }
|
| | | ]);
|
| | | ])
|
| | |
|
| | | const data = reactive({
|
| | | form: {},
|
| | |
| | | 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,
|
| | |
| | | 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
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | /** 树权限(全选/全不选) */
|
| | | 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
|
| | | }
|
| | |
|
| | | /** 提交按钮 */
|
| | |
| | | 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>
|
| | |
| | | </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,
|
| | |
| | | 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>
|
| | |
| | | </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>
|
| | |
| | | </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({
|
| | | // 是否显示弹出层(用户导入)
|
| | |
| | | headers: { Authorization: "Bearer " + getToken() },
|
| | | // 上传的地址
|
| | | url: import.meta.env.VITE_APP_BASE_API + "/system/user/importData"
|
| | | });
|
| | | })
|
| | | // 列显隐信息
|
| | | const columns = ref([
|
| | | { key: 0, label: `用户编号`, visible: true },
|
| | |
| | | { key: 4, label: `手机号码`, visible: true },
|
| | | { key: 5, label: `状态`, visible: true },
|
| | | { key: 6, label: `创建时间`, visible: true }
|
| | | ]);
|
| | | ])
|
| | |
|
| | | const data = reactive({
|
| | | form: {},
|
| | |
| | | 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) {
|
| | |
| | | },
|
| | | }).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() {
|
| | |
| | | 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() {
|
| | |
| | | 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>
|
| | |
| | | </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>
|
| | |
| | | </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>
|
| | |
| | | </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({
|
| | |
| | | outputType: "png", // 默认生成截图为PNG格式
|
| | | filename: 'avatar', // 文件名称
|
| | | previews: {} //预览数据
|
| | | });
|
| | | })
|
| | |
|
| | | /** 编辑头像 */
|
| | | function editCropper() {
|
| | | open.value = true;
|
| | | open.value = true
|
| | | }
|
| | |
|
| | | /** 打开弹出层结束时的回调 */
|
| | | function modalOpened() {
|
| | | visible.value = true;
|
| | | visible.value = true
|
| | | }
|
| | |
|
| | | /** 覆盖默认上传行为 */
|
| | |
| | |
|
| | | /** 向左旋转 */
|
| | | 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,PNG后缀的文件。");
|
| | | proxy.$modal.msgError("文件格式错误,请上传图片类型,如:JPG,PNG后缀的文件。")
|
| | | } 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>
|
| | |
|
| | |
| | | </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>
|
| | |
| | | </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({ |
| | |
| | | type: Object,
|
| | | default: null
|
| | | }
|
| | | });
|
| | | })
|
| | |
|
| | | // 表单校验
|
| | | const rules = ref({
|
| | |
| | | tableComment: [{ required: true, message: "请输入表描述", trigger: "blur" }],
|
| | | className: [{ required: true, message: "请输入实体类名称", trigger: "blur" }],
|
| | | functionAuthor: [{ required: true, message: "请输入作者", trigger: "blur" }]
|
| | | });
|
| | | })
|
| | | </script>
|
| | |
| | | </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> |
| | |
| | | </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>
|
| | |
| | | </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: {
|
| | |
| | | type: Array,
|
| | | default: null
|
| | | }
|
| | | });
|
| | | })
|
| | |
|
| | | // 表单校验
|
| | | const rules = ref({
|
| | |
| | | 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
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | /** 查询菜单下拉树结构 */
|
| | | 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>
|
| | |
| | | </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>
|
| | |
| | | </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: {
|
| | |
| | | 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()
|
| | | }
|
| | |
|
| | | /** 生成代码操作 */
|
| | | 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"
|
| | | })
|
| | | }
|
| | |
|
| | | /** 复制代码成功 */
|
| | | 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>
|
| | |
| | | }
|
| | | }
|
| | | },
|
| | | //fix:error:stdin>:7356:1: warning: "@charset" must be the first rule in the file
|
| | | css: {
|
| | | postcss: {
|
| | | plugins: [
|
| | |
| | | AtRule: {
|
| | | charset: (atRule) => {
|
| | | if (atRule.name === 'charset') {
|
| | | atRule.remove();
|
| | | atRule.remove()
|
| | | }
|
| | | }
|
| | | }
|