review代码调整代码
This commit is contained in:
@@ -107,6 +107,8 @@ class RequestHttp {
|
|||||||
download(url: string, params?: object, _object = {}): Promise<BlobPart> {
|
download(url: string, params?: object, _object = {}): Promise<BlobPart> {
|
||||||
return this.service.post(url, params, { ..._object, responseType: "blob" });
|
return this.service.post(url, params, { ..._object, responseType: "blob" });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default new RequestHttp(config);
|
export default new RequestHttp(config);
|
||||||
|
|||||||
@@ -306,8 +306,6 @@
|
|||||||
// font-family:;
|
// font-family:;
|
||||||
|
|
||||||
.el-dialog__headerbtn {
|
.el-dialog__headerbtn {
|
||||||
top: 5px;
|
|
||||||
|
|
||||||
.el-icon {
|
.el-icon {
|
||||||
color: var(--el-color-white);
|
color: var(--el-color-white);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
export const dialogSmall = {
|
export const dialogSmall = {
|
||||||
width:'400px',
|
width:'500px',
|
||||||
closeOnClickModal:false,
|
closeOnClickModal:false,
|
||||||
draggable:true,
|
draggable:true,
|
||||||
class:'dialog-small'
|
class:'dialog-small'
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { isArray } from "@/utils/is";
|
import { isArray } from '@/utils/is'
|
||||||
import { FieldNamesProps } from "@/components/ProTable/interface";
|
import { FieldNamesProps } from '@/components/ProTable/interface'
|
||||||
|
|
||||||
const mode = import.meta.env.VITE_ROUTER_MODE;
|
const mode = import.meta.env.VITE_ROUTER_MODE
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 获取localStorage
|
* @description 获取localStorage
|
||||||
@@ -9,11 +9,11 @@ const mode = import.meta.env.VITE_ROUTER_MODE;
|
|||||||
* @returns {String}
|
* @returns {String}
|
||||||
*/
|
*/
|
||||||
export function localGet(key: string) {
|
export function localGet(key: string) {
|
||||||
const value = window.localStorage.getItem(key);
|
const value = window.localStorage.getItem(key)
|
||||||
try {
|
try {
|
||||||
return JSON.parse(window.localStorage.getItem(key) as string);
|
return JSON.parse(window.localStorage.getItem(key) as string)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
return value;
|
return value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -24,7 +24,7 @@ export function localGet(key: string) {
|
|||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
export function localSet(key: string, value: any) {
|
export function localSet(key: string, value: any) {
|
||||||
window.localStorage.setItem(key, JSON.stringify(value));
|
window.localStorage.setItem(key, JSON.stringify(value))
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -33,7 +33,7 @@ export function localSet(key: string, value: any) {
|
|||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
export function localRemove(key: string) {
|
export function localRemove(key: string) {
|
||||||
window.localStorage.removeItem(key);
|
window.localStorage.removeItem(key)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -41,7 +41,7 @@ export function localRemove(key: string) {
|
|||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
export function localClear() {
|
export function localClear() {
|
||||||
window.localStorage.clear();
|
window.localStorage.clear()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -50,9 +50,9 @@ export function localClear() {
|
|||||||
* @returns {String}
|
* @returns {String}
|
||||||
*/
|
*/
|
||||||
export function isType(val: any) {
|
export function isType(val: any) {
|
||||||
if (val === null) return "null";
|
if (val === null) return 'null'
|
||||||
if (typeof val !== "object") return typeof val;
|
if (typeof val !== 'object') return typeof val
|
||||||
else return Object.prototype.toString.call(val).slice(8, -1).toLocaleLowerCase();
|
else return Object.prototype.toString.call(val).slice(8, -1).toLocaleLowerCase()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -60,13 +60,13 @@ export function isType(val: any) {
|
|||||||
* @returns {String}
|
* @returns {String}
|
||||||
*/
|
*/
|
||||||
export function generateUUID() {
|
export function generateUUID() {
|
||||||
let uuid = "";
|
let uuid = ''
|
||||||
for (let i = 0; i < 32; i++) {
|
for (let i = 0; i < 32; i++) {
|
||||||
let random = (Math.random() * 16) | 0;
|
let random = (Math.random() * 16) | 0
|
||||||
if (i === 8 || i === 12 || i === 16 || i === 20) uuid += "-";
|
if (i === 8 || i === 12 || i === 16 || i === 20) uuid += '-'
|
||||||
uuid += (i === 12 ? 4 : i === 16 ? (random & 3) | 8 : random).toString(16);
|
uuid += (i === 12 ? 4 : i === 16 ? (random & 3) | 8 : random).toString(16)
|
||||||
}
|
}
|
||||||
return uuid;
|
return uuid
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -76,22 +76,22 @@ export function generateUUID() {
|
|||||||
* @returns {Boolean} 相同返回 true,反之 false
|
* @returns {Boolean} 相同返回 true,反之 false
|
||||||
*/
|
*/
|
||||||
export function isObjectValueEqual(a: { [key: string]: any }, b: { [key: string]: any }) {
|
export function isObjectValueEqual(a: { [key: string]: any }, b: { [key: string]: any }) {
|
||||||
if (!a || !b) return false;
|
if (!a || !b) return false
|
||||||
let aProps = Object.getOwnPropertyNames(a);
|
let aProps = Object.getOwnPropertyNames(a)
|
||||||
let bProps = Object.getOwnPropertyNames(b);
|
let bProps = Object.getOwnPropertyNames(b)
|
||||||
if (aProps.length != bProps.length) return false;
|
if (aProps.length != bProps.length) return false
|
||||||
for (let i = 0; i < aProps.length; i++) {
|
for (let i = 0; i < aProps.length; i++) {
|
||||||
let propName = aProps[i];
|
let propName = aProps[i]
|
||||||
let propA = a[propName];
|
let propA = a[propName]
|
||||||
let propB = b[propName];
|
let propB = b[propName]
|
||||||
if (!b.hasOwnProperty(propName)) return false;
|
if (!b.hasOwnProperty(propName)) return false
|
||||||
if (propA instanceof Object) {
|
if (propA instanceof Object) {
|
||||||
if (!isObjectValueEqual(propA, propB)) return false;
|
if (!isObjectValueEqual(propA, propB)) return false
|
||||||
} else if (propA !== propB) {
|
} else if (propA !== propB) {
|
||||||
return false;
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -101,8 +101,8 @@ export function isObjectValueEqual(a: { [key: string]: any }, b: { [key: string]
|
|||||||
* @returns {Number}
|
* @returns {Number}
|
||||||
*/
|
*/
|
||||||
export function randomNum(min: number, max: number): number {
|
export function randomNum(min: number, max: number): number {
|
||||||
let num = Math.floor(Math.random() * (min - max) + max);
|
let num = Math.floor(Math.random() * (min - max) + max)
|
||||||
return num;
|
return num
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -110,13 +110,13 @@ export function randomNum(min: number, max: number): number {
|
|||||||
* @returns {String}
|
* @returns {String}
|
||||||
*/
|
*/
|
||||||
export function getTimeState() {
|
export function getTimeState() {
|
||||||
let timeNow = new Date();
|
let timeNow = new Date()
|
||||||
let hours = timeNow.getHours();
|
let hours = timeNow.getHours()
|
||||||
if (hours >= 6 && hours <= 10) return `早上好 ⛅`;
|
if (hours >= 6 && hours <= 10) return `早上好 ⛅`
|
||||||
if (hours >= 10 && hours <= 14) return `中午好 🌞`;
|
if (hours >= 10 && hours <= 14) return `中午好 🌞`
|
||||||
if (hours >= 14 && hours <= 18) return `下午好 🌞`;
|
if (hours >= 14 && hours <= 18) return `下午好 🌞`
|
||||||
if (hours >= 18 && hours <= 24) return `晚上好 🌛`;
|
if (hours >= 18 && hours <= 24) return `晚上好 🌛`
|
||||||
if (hours >= 0 && hours <= 6) return `凌晨好 🌛`;
|
if (hours >= 0 && hours <= 6) return `凌晨好 🌛`
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -124,14 +124,14 @@ export function getTimeState() {
|
|||||||
* @returns {String}
|
* @returns {String}
|
||||||
*/
|
*/
|
||||||
export function getBrowserLang() {
|
export function getBrowserLang() {
|
||||||
let browserLang = navigator.language ? navigator.language : navigator.browserLanguage;
|
let browserLang = navigator.language ? navigator.language : navigator.browserLanguage
|
||||||
let defaultBrowserLang = "";
|
let defaultBrowserLang = ''
|
||||||
if (["cn", "zh", "zh-cn"].includes(browserLang.toLowerCase())) {
|
if (['cn', 'zh', 'zh-cn'].includes(browserLang.toLowerCase())) {
|
||||||
defaultBrowserLang = "zh";
|
defaultBrowserLang = 'zh'
|
||||||
} else {
|
} else {
|
||||||
defaultBrowserLang = "en";
|
defaultBrowserLang = 'en'
|
||||||
}
|
}
|
||||||
return defaultBrowserLang;
|
return defaultBrowserLang
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -141,9 +141,9 @@ export function getBrowserLang() {
|
|||||||
export function getUrlWithParams() {
|
export function getUrlWithParams() {
|
||||||
const url = {
|
const url = {
|
||||||
hash: location.hash.substring(1),
|
hash: location.hash.substring(1),
|
||||||
history: location.pathname + location.search
|
history: location.pathname + location.search,
|
||||||
};
|
}
|
||||||
return url[mode];
|
return url[mode]
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -152,8 +152,8 @@ export function getUrlWithParams() {
|
|||||||
* @returns {Array}
|
* @returns {Array}
|
||||||
*/
|
*/
|
||||||
export function getFlatMenuList(menuList: Menu.MenuOptions[]): Menu.MenuOptions[] {
|
export function getFlatMenuList(menuList: Menu.MenuOptions[]): Menu.MenuOptions[] {
|
||||||
let newMenuList: Menu.MenuOptions[] = JSON.parse(JSON.stringify(menuList));
|
let newMenuList: Menu.MenuOptions[] = JSON.parse(JSON.stringify(menuList))
|
||||||
return newMenuList.flatMap(item => [item, ...(item.children ? getFlatMenuList(item.children) : [])]);
|
return newMenuList.flatMap(item => [item, ...(item.children ? getFlatMenuList(item.children) : [])])
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -162,11 +162,11 @@ export function getFlatMenuList(menuList: Menu.MenuOptions[]): Menu.MenuOptions[
|
|||||||
* @returns {Array}
|
* @returns {Array}
|
||||||
* */
|
* */
|
||||||
export function getShowMenuList(menuList: Menu.MenuOptions[]) {
|
export function getShowMenuList(menuList: Menu.MenuOptions[]) {
|
||||||
let newMenuList: Menu.MenuOptions[] = JSON.parse(JSON.stringify(menuList));
|
let newMenuList: Menu.MenuOptions[] = JSON.parse(JSON.stringify(menuList))
|
||||||
return newMenuList.filter(item => {
|
return newMenuList.filter(item => {
|
||||||
item.children?.length && (item.children = getShowMenuList(item.children));
|
item.children?.length && (item.children = getShowMenuList(item.children))
|
||||||
return !item.meta?.isHide;
|
return !item.meta?.isHide
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -178,11 +178,11 @@ export function getShowMenuList(menuList: Menu.MenuOptions[]) {
|
|||||||
*/
|
*/
|
||||||
export const getAllBreadcrumbList = (menuList: Menu.MenuOptions[], parent = [], result: { [key: string]: any } = {}) => {
|
export const getAllBreadcrumbList = (menuList: Menu.MenuOptions[], parent = [], result: { [key: string]: any } = {}) => {
|
||||||
for (const item of menuList) {
|
for (const item of menuList) {
|
||||||
result[item.path] = [...parent, item];
|
result[item.path] = [...parent, item]
|
||||||
if (item.children) getAllBreadcrumbList(item.children, result[item.path], result);
|
if (item.children) getAllBreadcrumbList(item.children, result[item.path], result)
|
||||||
|
}
|
||||||
|
return result
|
||||||
}
|
}
|
||||||
return result;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 使用递归处理路由菜单 path,生成一维数组 (第一版本地路由鉴权会用到,该函数暂未使用)
|
* @description 使用递归处理路由菜单 path,生成一维数组 (第一版本地路由鉴权会用到,该函数暂未使用)
|
||||||
@@ -192,10 +192,10 @@ export const getAllBreadcrumbList = (menuList: Menu.MenuOptions[], parent = [],
|
|||||||
*/
|
*/
|
||||||
export function getMenuListPath(menuList: Menu.MenuOptions[], menuPathArr: string[] = []): string[] {
|
export function getMenuListPath(menuList: Menu.MenuOptions[], menuPathArr: string[] = []): string[] {
|
||||||
for (const item of menuList) {
|
for (const item of menuList) {
|
||||||
if (typeof item === "object" && item.path) menuPathArr.push(item.path);
|
if (typeof item === 'object' && item.path) menuPathArr.push(item.path)
|
||||||
if (item.children?.length) getMenuListPath(item.children, menuPathArr);
|
if (item.children?.length) getMenuListPath(item.children, menuPathArr)
|
||||||
}
|
}
|
||||||
return menuPathArr;
|
return menuPathArr
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -206,13 +206,13 @@ export function getMenuListPath(menuList: Menu.MenuOptions[], menuPathArr: strin
|
|||||||
*/
|
*/
|
||||||
export function findMenuByPath(menuList: Menu.MenuOptions[], path: string): Menu.MenuOptions | null {
|
export function findMenuByPath(menuList: Menu.MenuOptions[], path: string): Menu.MenuOptions | null {
|
||||||
for (const item of menuList) {
|
for (const item of menuList) {
|
||||||
if (item.path === path) return item;
|
if (item.path === path) return item
|
||||||
if (item.children) {
|
if (item.children) {
|
||||||
const res = findMenuByPath(item.children, path);
|
const res = findMenuByPath(item.children, path)
|
||||||
if (res) return res;
|
if (res) return res
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -223,10 +223,10 @@ export function findMenuByPath(menuList: Menu.MenuOptions[], path: string): Menu
|
|||||||
* */
|
* */
|
||||||
export function getKeepAliveRouterName(menuList: Menu.MenuOptions[], keepAliveNameArr: string[] = []) {
|
export function getKeepAliveRouterName(menuList: Menu.MenuOptions[], keepAliveNameArr: string[] = []) {
|
||||||
menuList.forEach(item => {
|
menuList.forEach(item => {
|
||||||
item.meta.isKeepAlive && item.name && keepAliveNameArr.push(item.name);
|
item.meta.isKeepAlive && item.name && keepAliveNameArr.push(item.name)
|
||||||
item.children?.length && getKeepAliveRouterName(item.children, keepAliveNameArr);
|
item.children?.length && getKeepAliveRouterName(item.children, keepAliveNameArr)
|
||||||
});
|
})
|
||||||
return keepAliveNameArr;
|
return keepAliveNameArr
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -238,8 +238,8 @@ export function getKeepAliveRouterName(menuList: Menu.MenuOptions[], keepAliveNa
|
|||||||
* */
|
* */
|
||||||
export function formatTableColumn(row: number, col: number, callValue: any) {
|
export function formatTableColumn(row: number, col: number, callValue: any) {
|
||||||
// 如果当前值为数组,使用 / 拼接(根据需求自定义)
|
// 如果当前值为数组,使用 / 拼接(根据需求自定义)
|
||||||
if (isArray(callValue)) return callValue.length ? callValue.join(" / ") : "--";
|
if (isArray(callValue)) return callValue.length ? callValue.join(' / ') : '/'
|
||||||
return callValue ?? "--";
|
return (callValue && callValue.length > 0) ? callValue : '/'
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -249,8 +249,8 @@ export function formatTableColumn(row: number, col: number, callValue: any) {
|
|||||||
* */
|
* */
|
||||||
export function formatValue(callValue: any) {
|
export function formatValue(callValue: any) {
|
||||||
// 如果当前值为数组,使用 / 拼接(根据需求自定义)
|
// 如果当前值为数组,使用 / 拼接(根据需求自定义)
|
||||||
if (isArray(callValue)) return callValue.length ? callValue.join(" / ") : "--";
|
if (isArray(callValue)) return callValue.length ? callValue.join(' / ') : '/'
|
||||||
return callValue ?? "--";
|
return (callValue && callValue.length > 0) ? callValue : '/'
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -260,9 +260,9 @@ export function formatValue(callValue: any) {
|
|||||||
* @returns {*}
|
* @returns {*}
|
||||||
* */
|
* */
|
||||||
export function handleRowAccordingToProp(row: { [key: string]: any }, prop: string) {
|
export function handleRowAccordingToProp(row: { [key: string]: any }, prop: string) {
|
||||||
if (!prop.includes(".")) return row[prop] ?? "--";
|
if (!prop.includes('.')) return row[prop] ?? '/'
|
||||||
prop.split(".").forEach(item => (row = row[item] ?? "--"));
|
prop.split('.').forEach(item => (row = row[item] ?? '/'))
|
||||||
return row;
|
return row
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -271,9 +271,9 @@ export function handleRowAccordingToProp(row: { [key: string]: any }, prop: stri
|
|||||||
* @returns {String}
|
* @returns {String}
|
||||||
* */
|
* */
|
||||||
export function handleProp(prop: string) {
|
export function handleProp(prop: string) {
|
||||||
const propArr = prop.split(".");
|
const propArr = prop.split('.')
|
||||||
if (propArr.length == 1) return prop;
|
if (propArr.length == 1) return prop
|
||||||
return propArr[propArr.length - 1];
|
return propArr[propArr.length - 1]
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -284,18 +284,18 @@ export function handleProp(prop: string) {
|
|||||||
* @param {String} type 过滤类型(目前只有 tag)
|
* @param {String} type 过滤类型(目前只有 tag)
|
||||||
* @returns {String}
|
* @returns {String}
|
||||||
* */
|
* */
|
||||||
export function filterEnum(callValue: any, enumData?: any, fieldNames?: FieldNamesProps, type?: "tag") {
|
export function filterEnum(callValue: any, enumData?: any, fieldNames?: FieldNamesProps, type?: 'tag') {
|
||||||
const value = fieldNames?.value ?? "value";
|
const value = fieldNames?.value ?? 'value'
|
||||||
const label = fieldNames?.label ?? "label";
|
const label = fieldNames?.label ?? 'label'
|
||||||
const children = fieldNames?.children ?? "children";
|
const children = fieldNames?.children ?? 'children'
|
||||||
let filterData: { [key: string]: any } = {};
|
let filterData: { [key: string]: any } = {}
|
||||||
// 判断 enumData 是否为数组
|
// 判断 enumData 是否为数组
|
||||||
if (Array.isArray(enumData)) filterData = findItemNested(enumData, callValue, value, children);
|
if (Array.isArray(enumData)) filterData = findItemNested(enumData, callValue, value, children)
|
||||||
// 判断是否输出的结果为 tag 类型
|
// 判断是否输出的结果为 tag 类型
|
||||||
if (type == "tag") {
|
if (type == 'tag') {
|
||||||
return filterData?.tagType ? filterData.tagType : "";
|
return filterData?.tagType ? filterData.tagType : ''
|
||||||
} else {
|
} else {
|
||||||
return filterData ? filterData[label] : "--";
|
return filterData ? filterData[label] : '/'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -304,8 +304,8 @@ export function filterEnum(callValue: any, enumData?: any, fieldNames?: FieldNam
|
|||||||
* */
|
* */
|
||||||
export function findItemNested(enumData: any, callValue: any, value: string, children: string) {
|
export function findItemNested(enumData: any, callValue: any, value: string, children: string) {
|
||||||
return enumData.reduce((accumulator: any, current: any) => {
|
return enumData.reduce((accumulator: any, current: any) => {
|
||||||
if (accumulator) return accumulator;
|
if (accumulator) return accumulator
|
||||||
if (current[value] === callValue) return current;
|
if (current[value] === callValue) return current
|
||||||
if (current[children]) return findItemNested(current[children], callValue, value, children);
|
if (current[children]) return findItemNested(current[children], callValue, value, children)
|
||||||
}, null);
|
}, null)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog v-model='dialogVisible' :title='dialogTitle' v-bind='dialogMiddle' @close="close">
|
<el-dialog v-model='dialogVisible' :title='dialogTitle' v-bind='dialogMiddle' @close="close">
|
||||||
|
|
||||||
<el-form :model='formContent' ref='dialogFormRef' :rules='rules' class='form-two'>
|
<el-form :model='formContent' ref='dialogFormRef' :rules='rules' class='form-two'>
|
||||||
<el-divider >基础数据</el-divider>
|
<el-divider >基础数据</el-divider>
|
||||||
<el-form-item label='数据模型' :label-width='140' prop='dataType'>
|
<el-form-item label='数据模型' :label-width='140' prop='dataType'>
|
||||||
@@ -167,7 +166,6 @@
|
|||||||
import { addDictPq, updateDictPq } from '@/api/system/dictionary/dictPq'
|
import { addDictPq, updateDictPq } from '@/api/system/dictionary/dictPq'
|
||||||
import { computed, type Ref, ref } from 'vue';
|
import { computed, type Ref, ref } from 'vue';
|
||||||
import { useDictStore } from '@/stores/modules/dict'
|
import { useDictStore } from '@/stores/modules/dict'
|
||||||
import { el } from 'element-plus/es/locale';
|
|
||||||
const dictStore = useDictStore()
|
const dictStore = useDictStore()
|
||||||
const selectedStatMethods = ref<string[]>([])
|
const selectedStatMethods = ref<string[]>([])
|
||||||
// 定义弹出组件元信息
|
// 定义弹出组件元信息
|
||||||
@@ -230,26 +228,13 @@ import { el } from 'element-plus/es/locale';
|
|||||||
if (valid) {
|
if (valid) {
|
||||||
formContent.value.statMethod = selectedStatMethods.value.join(',')
|
formContent.value.statMethod = selectedStatMethods.value.join(',')
|
||||||
if (formContent.value.id) {
|
if (formContent.value.id) {
|
||||||
const result = await updateDictPq(formContent.value);
|
await updateDictPq(formContent.value);
|
||||||
|
|
||||||
if(result.code != 'A0000'){
|
|
||||||
ElMessage.error({ message: result.message})
|
|
||||||
}else{
|
|
||||||
ElMessage.success({ message: `${dialogTitle.value}成功!` })
|
ElMessage.success({ message: `${dialogTitle.value}成功!` })
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
const result = await addDictPq(formContent.value);
|
const result = await addDictPq(formContent.value);
|
||||||
|
|
||||||
if(result.code != 'A0000'){
|
|
||||||
ElMessage.error({ message: result.message})
|
|
||||||
}else{
|
|
||||||
ElMessage.success({ message: `${dialogTitle.value}成功!` })
|
ElMessage.success({ message: `${dialogTitle.value}成功!` })
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
//ElMessage.success({ message: `${dialogTitle.value}成功!` })
|
|
||||||
|
|
||||||
close()
|
close()
|
||||||
// 刷新表格
|
// 刷新表格
|
||||||
await props.refreshTable!()
|
await props.refreshTable!()
|
||||||
@@ -264,7 +249,6 @@ import { el } from 'element-plus/es/locale';
|
|||||||
const open = (sign: string, data: Dict.ResDictPq) => {
|
const open = (sign: string, data: Dict.ResDictPq) => {
|
||||||
titleType.value = sign
|
titleType.value = sign
|
||||||
dialogVisible.value = true
|
dialogVisible.value = true
|
||||||
//console.log(dictStore)
|
|
||||||
selectedStatMethods.value = data.statMethod ? data.statMethod.split(',') : []
|
selectedStatMethods.value = data.statMethod ? data.statMethod.split(',') : []
|
||||||
if (data.id) {
|
if (data.id) {
|
||||||
formContent.value = { ...data }
|
formContent.value = { ...data }
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang='tsx' name='dict'>
|
<script setup lang='tsx' name='dict'>
|
||||||
import {CirclePlus, Delete, EditPen, Download, View} from '@element-plus/icons-vue'
|
import { CirclePlus, Delete, EditPen } from '@element-plus/icons-vue'
|
||||||
import { type Dict } from '@/api/system/dictionary/interface'
|
import { type Dict } from '@/api/system/dictionary/interface'
|
||||||
import { ProTableInstance, ColumnProps } from '@/components/ProTable/interface'
|
import { ProTableInstance, ColumnProps } from '@/components/ProTable/interface'
|
||||||
import PqPopup from '@/views/system/dictionary/dictPq/components/pqPopup.vue'
|
import PqPopup from '@/views/system/dictionary/dictPq/components/pqPopup.vue'
|
||||||
@@ -36,13 +36,9 @@
|
|||||||
import { reactive, ref } from 'vue'
|
import { reactive, ref } from 'vue'
|
||||||
|
|
||||||
const dictStore = useDictStore()
|
const dictStore = useDictStore()
|
||||||
|
|
||||||
const proTable = ref<ProTableInstance>()
|
const proTable = ref<ProTableInstance>()
|
||||||
const pqPopup = ref()
|
const pqPopup = ref()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const columns = reactive<ColumnProps<Dict.ResDictPq>[]>([
|
const columns = reactive<ColumnProps<Dict.ResDictPq>[]>([
|
||||||
{ type: 'selection', fixed: 'left', width: 70 },
|
{ type: 'selection', fixed: 'left', width: 70 },
|
||||||
{ type: 'index', fixed: 'left', width: 70, label: '序号' },
|
{ type: 'index', fixed: 'left', width: 70, label: '序号' },
|
||||||
@@ -68,10 +64,6 @@
|
|||||||
minWidth: 300,
|
minWidth: 300,
|
||||||
search: {
|
search: {
|
||||||
el: 'input',
|
el: 'input',
|
||||||
},
|
|
||||||
render: (scope) => {
|
|
||||||
const codes = scope.row.otherName;
|
|
||||||
return codes || '/';
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -80,10 +72,6 @@
|
|||||||
width: 180,
|
width: 180,
|
||||||
search: {
|
search: {
|
||||||
el: 'input',
|
el: 'input',
|
||||||
},
|
|
||||||
render: (scope) => {
|
|
||||||
const codes = scope.row.showName;
|
|
||||||
return codes || '/';
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -96,20 +84,12 @@
|
|||||||
{
|
{
|
||||||
prop: 'unit',
|
prop: 'unit',
|
||||||
label: '单位',
|
label: '单位',
|
||||||
width: 180,
|
width: 180
|
||||||
render: (scope) => {
|
|
||||||
const codes = scope.row.unit;
|
|
||||||
return codes || '/';
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'type',
|
prop: 'type',
|
||||||
label: '指标数据类型',
|
label: '指标数据类型',
|
||||||
width: 180,
|
width: 180
|
||||||
render: (scope) => {
|
|
||||||
const codes = scope.row.type;
|
|
||||||
return codes || '/';
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'harmStart',
|
prop: 'harmStart',
|
||||||
@@ -118,7 +98,7 @@
|
|||||||
render: (scope) => {
|
render: (scope) => {
|
||||||
return (scope.row.harmStart && scope.row.harmEnd)
|
return (scope.row.harmStart && scope.row.harmEnd)
|
||||||
? `${scope.row.harmStart}-${scope.row.harmEnd}`
|
? `${scope.row.harmStart}-${scope.row.harmEnd}`
|
||||||
: '/'; // 如果 harmStart 或 harmEnd 为空,返回 '/'
|
: '/' // 如果 harmStart 或 harmEnd 为空,返回 '/'
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -129,27 +109,25 @@
|
|||||||
fieldNames: { label: 'name', value: 'code' },
|
fieldNames: { label: 'name', value: 'code' },
|
||||||
render: (scope) => {
|
render: (scope) => {
|
||||||
// 假设 statMethod 是一个数组,包含多个 'code' 值
|
// 假设 statMethod 是一个数组,包含多个 'code' 值
|
||||||
const codes = scope.row.statMethod; // 获取当前行的 statMethod 字段
|
const codes = scope.row.statMethod // 获取当前行的 statMethod 字段
|
||||||
//console.log('codes',codes)
|
|
||||||
if (!codes) {
|
if (!codes) {
|
||||||
return '/'; // 如果 statMethod 为 undefined 或 null,返回 '/'
|
return '/'
|
||||||
}
|
}
|
||||||
// 确保 codes 是一个字符串
|
// 确保 codes 是一个字符串
|
||||||
const codeString = Array.isArray(codes) ? codes.join(',') : codes;
|
const codeString = Array.isArray(codes) ? codes.join(',') : codes
|
||||||
const codeArray = codeString.split(',');
|
const codeArray = codeString.split(',')
|
||||||
if (codeArray.length > 1) {
|
if (codeArray.length > 1) {
|
||||||
|
console.log('多个 code', codeString)
|
||||||
// 查找与每个 code 值匹配的 name,然后拼接成逗号分割的字符串
|
// 查找与每个 code 值匹配的 name,然后拼接成逗号分割的字符串
|
||||||
//console.log('codeArray',codeArray)
|
|
||||||
const names = codeArray.map(code => {
|
const names = codeArray.map(code => {
|
||||||
const dictItem = dictStore.getDictData('Stat_Method').find(item => item.code === code);
|
const dictItem = dictStore.getDictData('Stat_Method').find(item => item.code === code)
|
||||||
return dictItem ? dictItem.name : ''; // 如果找到匹配的项,返回对应的 name
|
return dictItem ? dictItem.name : '' // 如果找到匹配的项,返回对应的 name
|
||||||
});
|
})
|
||||||
//console.log('names',names)
|
return names.join(', ') // 用逗号连接所有的 name
|
||||||
return names.join(', '); // 用逗号连接所有的 name
|
|
||||||
}
|
}
|
||||||
// 查找单个 code 对应的 name
|
// 查找单个 code 对应的 name
|
||||||
const dictItem = dictStore.getDictData('Stat_Method').find(item => item.code === codeArray[0]);
|
const dictItem = dictStore.getDictData('Stat_Method').find(item => item.code === codeArray[0])
|
||||||
return dictItem ? dictItem.name : ''; // 如果找到匹配的项,返回对应的 name
|
return dictItem ? dictItem.name : '' // 如果找到匹配的项,返回对应的 name
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -165,11 +143,7 @@
|
|||||||
label: '报表数据来源',
|
label: '报表数据来源',
|
||||||
width: 180,
|
width: 180,
|
||||||
enum: dictStore.getDictData('Data_Day'),
|
enum: dictStore.getDictData('Data_Day'),
|
||||||
fieldNames: { label: 'name', value: 'code' },
|
fieldNames: { label: 'name', value: 'code' }
|
||||||
render: (scope) => {
|
|
||||||
const codes = scope.row.resourcesId;
|
|
||||||
return codes || '/';
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'operation',
|
prop: 'operation',
|
||||||
@@ -186,8 +160,6 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 批量删除字典类型
|
// 批量删除字典类型
|
||||||
const batchDelete = async (id: string[]) => {
|
const batchDelete = async (id: string[]) => {
|
||||||
await useHandleData(deleteDictPq, id, '删除所选字典类型')
|
await useHandleData(deleteDictPq, id, '删除所选字典类型')
|
||||||
@@ -202,6 +174,5 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -9,13 +9,13 @@
|
|||||||
<el-input v-model='formContent.code' placeholder='请输入' autocomplete='off' />
|
<el-input v-model='formContent.code' placeholder='请输入' autocomplete='off' />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="开启等级" :label-width="100">
|
<el-form-item label="开启等级" :label-width="100">
|
||||||
<el-radio-group v-model="formContent.openLevel" size="medium">
|
<el-radio-group v-model="formContent.openLevel" >
|
||||||
<el-radio-button label="开启" :value="1"></el-radio-button>
|
<el-radio-button label="开启" :value="1"></el-radio-button>
|
||||||
<el-radio-button label="关闭" :value="0"></el-radio-button>
|
<el-radio-button label="关闭" :value="0"></el-radio-button>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="开启描述" :label-width="100">
|
<el-form-item label="开启描述" :label-width="100">
|
||||||
<el-radio-group v-model="formContent.openDescribe" size="medium">
|
<el-radio-group v-model="formContent.openDescribe" >
|
||||||
<el-radio-button label="开启" :value="1"></el-radio-button>
|
<el-radio-button label="开启" :value="1"></el-radio-button>
|
||||||
<el-radio-button label="关闭" :value="0"></el-radio-button>
|
<el-radio-button label="关闭" :value="0"></el-radio-button>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
|
|||||||
@@ -30,13 +30,11 @@ import { CirclePlus, Delete, Download, EditPen, View } from '@element-plus/icons
|
|||||||
import { Dict } from '@/api/system/dictionary/interface'
|
import { Dict } from '@/api/system/dictionary/interface'
|
||||||
import { ColumnProps, ProTableInstance } from '@/components/ProTable/interface'
|
import { ColumnProps, ProTableInstance } from '@/components/ProTable/interface'
|
||||||
import DictData from '@/views/system/dictionary/dictData/index.vue'
|
import DictData from '@/views/system/dictionary/dictData/index.vue'
|
||||||
import { useDictStore } from '@/stores/modules/dict'
|
|
||||||
import { useHandleData } from '@/hooks/useHandleData'
|
import { useHandleData } from '@/hooks/useHandleData'
|
||||||
import { useViewSize } from '@/hooks/useViewSize'
|
import { useViewSize } from '@/hooks/useViewSize'
|
||||||
import { useDownload } from '@/hooks/useDownload'
|
import { useDownload } from '@/hooks/useDownload'
|
||||||
import { deleteDictType, getDictTypeList, exportDictType } from '@/api/system/dictionary/dictType'
|
import { deleteDictType, getDictTypeList, exportDictType } from '@/api/system/dictionary/dictType'
|
||||||
|
|
||||||
const dictStore = useDictStore()
|
|
||||||
const { popupBaseView, viewWidth, viewHeight } = useViewSize()
|
const { popupBaseView, viewWidth, viewHeight } = useViewSize()
|
||||||
|
|
||||||
const proTable = ref<ProTableInstance>()
|
const proTable = ref<ProTableInstance>()
|
||||||
@@ -57,7 +55,7 @@ const columns = reactive<ColumnProps<Dict.ResDictType>[]>([
|
|||||||
{
|
{
|
||||||
prop: 'code',
|
prop: 'code',
|
||||||
label: '类型编码',
|
label: '类型编码',
|
||||||
minWidth: 200,
|
minWidth: 220,
|
||||||
search: {
|
search: {
|
||||||
el: 'input',
|
el: 'input',
|
||||||
},
|
},
|
||||||
@@ -65,7 +63,7 @@ const columns = reactive<ColumnProps<Dict.ResDictType>[]>([
|
|||||||
{
|
{
|
||||||
prop: 'remark',
|
prop: 'remark',
|
||||||
label: '描述',
|
label: '描述',
|
||||||
minWidth: 300,
|
minWidth: 250,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'sort',
|
prop: 'sort',
|
||||||
@@ -81,7 +79,7 @@ const columns = reactive<ColumnProps<Dict.ResDictType>[]>([
|
|||||||
prop: 'operation',
|
prop: 'operation',
|
||||||
label: '操作',
|
label: '操作',
|
||||||
fixed: 'right',
|
fixed: 'right',
|
||||||
minWidth: 300,
|
minWidth: 250,
|
||||||
},
|
},
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user