|
|
@ -1,365 +1,369 @@
|
|
|
|
<script lang="ts" setup>
|
|
|
|
<script lang="ts" setup>
|
|
|
|
import { getAllfieldList, getfieldList, savefield } from "@/api/home/filter";
|
|
|
|
import { cloneDeep, difference } from 'lodash-es'
|
|
|
|
import { workPackageMap } from "@/config/workorder";
|
|
|
|
import { computed, defineEmits, defineProps, onMounted, ref, watch } from 'vue'
|
|
|
|
import { useUser } from "@/store/modules/user";
|
|
|
|
import { VueDraggable } from 'vue-draggable-plus'
|
|
|
|
import { difference, cloneDeep } from "lodash-es";
|
|
|
|
import { getAllfieldList, getfieldList, savefield } from '@/api/home/filter'
|
|
|
|
import { computed, defineEmits, defineProps, onMounted, ref, watch } from "vue";
|
|
|
|
import { workPackageMap } from '@/config/workorder'
|
|
|
|
import { VueDraggable } from "vue-draggable-plus";
|
|
|
|
import { useUser } from '@/store/modules/user'
|
|
|
|
|
|
|
|
|
|
|
|
const props = defineProps({
|
|
|
|
const props = defineProps({
|
|
|
|
reviewType: {
|
|
|
|
reviewType: {
|
|
|
|
type: Number,
|
|
|
|
type: Number,
|
|
|
|
default: () => 1,
|
|
|
|
default: () => 1,
|
|
|
|
require: true,
|
|
|
|
require: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
const emit = defineEmits(["onOk"]);
|
|
|
|
const emit = defineEmits(['onOk'])
|
|
|
|
|
|
|
|
|
|
|
|
// 左侧隐藏列表
|
|
|
|
// 左侧隐藏列表
|
|
|
|
const offList = ref<any[]>([]);
|
|
|
|
const offList = ref<any[]>([])
|
|
|
|
// 右侧显示列表
|
|
|
|
// 右侧显示列表
|
|
|
|
const onList = ref<any[]>([]);
|
|
|
|
const onList = ref<any[]>([])
|
|
|
|
// 固定默认列表
|
|
|
|
// 固定默认列表
|
|
|
|
const fixList = ref<any[]>([]);
|
|
|
|
const fixList = ref<any[]>([])
|
|
|
|
|
|
|
|
|
|
|
|
const offShowList = ref<any[]>([]);
|
|
|
|
const offShowList = ref<any[]>([])
|
|
|
|
const onShowList = ref<any[]>([]);
|
|
|
|
const onShowList = ref<any[]>([])
|
|
|
|
const fixShowList = ref<any[]>([]);
|
|
|
|
const fixShowList = ref<any[]>([])
|
|
|
|
|
|
|
|
|
|
|
|
const allCount = computed(() => {
|
|
|
|
const allCount = computed(() => {
|
|
|
|
return `全部字段(共${offList.value.length - 1}个)`;
|
|
|
|
return `全部字段(共${offList.value.length - 1}个)`
|
|
|
|
});
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
const selectCount = computed(() => {
|
|
|
|
const selectCount = computed(() => {
|
|
|
|
return `显示字段(共${onList.value.length}个)`;
|
|
|
|
return `显示字段(共${onList.value.length}个)`
|
|
|
|
});
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
function generatList() {
|
|
|
|
function generatList() {
|
|
|
|
const keys = Object.keys(workPackageMap);
|
|
|
|
const keys = Object.keys(workPackageMap)
|
|
|
|
let showList: object[] = [];
|
|
|
|
let showList: object[] = []
|
|
|
|
const hideList: object[] = [];
|
|
|
|
const hideList: object[] = []
|
|
|
|
const showStr = "status";
|
|
|
|
const showStr = 'status'
|
|
|
|
const showKeys = showStr.split(",").map((key: string) => key.toLowerCase());
|
|
|
|
const showKeys = showStr.split(',').map((key: string) => key.toLowerCase())
|
|
|
|
|
|
|
|
|
|
|
|
for (const key of keys) {
|
|
|
|
for (const key of keys) {
|
|
|
|
const name = workPackageMap[key]?.label;
|
|
|
|
const name = workPackageMap[key]?.label
|
|
|
|
const isDefault = workPackageMap[key]?.isDefault;
|
|
|
|
const isDefault = workPackageMap[key]?.isDefault
|
|
|
|
|
|
|
|
|
|
|
|
// 系统配置为Y且不是默认配置
|
|
|
|
// 系统配置为Y且不是默认配置
|
|
|
|
if (!isDefault) {
|
|
|
|
if (!isDefault) {
|
|
|
|
hideList.push({
|
|
|
|
hideList.push({
|
|
|
|
id: key,
|
|
|
|
id: key,
|
|
|
|
name: name || "未配置",
|
|
|
|
name: name || '未配置',
|
|
|
|
fix: isDefault,
|
|
|
|
fix: isDefault,
|
|
|
|
checked: workPackageMap[key].isDefault,
|
|
|
|
checked: workPackageMap[key].isDefault,
|
|
|
|
});
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
showList = showKeys.reduce((acc, key) => {
|
|
|
|
showList = showKeys.reduce((acc, key) => {
|
|
|
|
const config = {
|
|
|
|
const config = {
|
|
|
|
id: key,
|
|
|
|
id: key,
|
|
|
|
name: workPackageMap[key].label || "未配置",
|
|
|
|
name: workPackageMap[key].label || '未配置',
|
|
|
|
fix: workPackageMap[key].isDefault,
|
|
|
|
fix: workPackageMap[key].isDefault,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
return [...acc, config];
|
|
|
|
return [...acc, config]
|
|
|
|
}, []);
|
|
|
|
}, [])
|
|
|
|
|
|
|
|
|
|
|
|
const fixedList = generateDefaultList();
|
|
|
|
const fixedList = generateDefaultList()
|
|
|
|
|
|
|
|
|
|
|
|
hideList.unshift(...fixedList);
|
|
|
|
hideList.unshift(...fixedList)
|
|
|
|
showList.unshift(...fixedList);
|
|
|
|
showList.unshift(...fixedList)
|
|
|
|
|
|
|
|
|
|
|
|
onList.value = showList;
|
|
|
|
onList.value = showList
|
|
|
|
offList.value = hideList;
|
|
|
|
offList.value = hideList
|
|
|
|
return { showList, hideList };
|
|
|
|
return { showList, hideList }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function generateDefaultList() {
|
|
|
|
function generateDefaultList() {
|
|
|
|
return Object.keys(workPackageMap).reduce((acc, key) => {
|
|
|
|
return Object.keys(workPackageMap).reduce((acc, key) => {
|
|
|
|
const { label, isDefault } = workPackageMap[key];
|
|
|
|
const { label, isDefault } = workPackageMap[key]
|
|
|
|
|
|
|
|
|
|
|
|
if (isDefault) {
|
|
|
|
if (isDefault) {
|
|
|
|
const config = {
|
|
|
|
const config = {
|
|
|
|
id: key,
|
|
|
|
id: key,
|
|
|
|
name: label || "未配置",
|
|
|
|
name: label || '未配置',
|
|
|
|
fix: true,
|
|
|
|
fix: true,
|
|
|
|
checked: true,
|
|
|
|
checked: true,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
return [...acc, config];
|
|
|
|
return [...acc, config]
|
|
|
|
} else {
|
|
|
|
}
|
|
|
|
return acc;
|
|
|
|
else {
|
|
|
|
|
|
|
|
return acc
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}, []);
|
|
|
|
}, [])
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const show = ref(false);
|
|
|
|
const show = ref(false)
|
|
|
|
const checkAll = computed(() => {
|
|
|
|
const checkAll = computed(() => {
|
|
|
|
let baseNum = 0;
|
|
|
|
let baseNum = 0
|
|
|
|
offList.value.map((v) => {
|
|
|
|
offList.value.map((v) => {
|
|
|
|
if (v.fix) {
|
|
|
|
if (v.fix)
|
|
|
|
baseNum += 1;
|
|
|
|
baseNum += 1
|
|
|
|
}
|
|
|
|
})
|
|
|
|
});
|
|
|
|
return onList.value.length == offList.value.length - baseNum
|
|
|
|
return onList.value.length == offList.value.length - baseNum;
|
|
|
|
})
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function showModal() {
|
|
|
|
function showModal() {
|
|
|
|
show.value = true;
|
|
|
|
show.value = true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function closeModal() {
|
|
|
|
function closeModal() {
|
|
|
|
show.value = false;
|
|
|
|
show.value = false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
async function handleSumbit(e: MouseEvent) {
|
|
|
|
async function handleSumbit(e: MouseEvent) {
|
|
|
|
const userStore = useUser();
|
|
|
|
const userStore = useUser()
|
|
|
|
const userInfo = userStore.getUserInfo;
|
|
|
|
const userInfo = userStore.getUserInfo
|
|
|
|
let userFieldFixed = "";
|
|
|
|
let userFieldFixed = ''
|
|
|
|
fixList.value.map((v) => {
|
|
|
|
fixList.value.map((v) => {
|
|
|
|
userFieldFixed += `${v.id},`;
|
|
|
|
userFieldFixed += `${v.id},`
|
|
|
|
});
|
|
|
|
})
|
|
|
|
onList.value.map((v) => {
|
|
|
|
onList.value.map((v) => {
|
|
|
|
userFieldFixed += `${v.id},`;
|
|
|
|
userFieldFixed += `${v.id},`
|
|
|
|
});
|
|
|
|
})
|
|
|
|
userFieldFixed = userFieldFixed.slice(0, userFieldFixed.length - 1);
|
|
|
|
userFieldFixed = userFieldFixed.slice(0, userFieldFixed.length - 1)
|
|
|
|
savefield(props.reviewType, userInfo.id, userFieldFixed);
|
|
|
|
savefield(props.reviewType, userInfo.id, userFieldFixed)
|
|
|
|
e.preventDefault();
|
|
|
|
e.preventDefault()
|
|
|
|
closeModal();
|
|
|
|
closeModal()
|
|
|
|
emit("onOk");
|
|
|
|
emit('onOk')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
defineExpose({
|
|
|
|
defineExpose({
|
|
|
|
showModal,
|
|
|
|
showModal,
|
|
|
|
});
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
// generatList();
|
|
|
|
// generatList();
|
|
|
|
|
|
|
|
|
|
|
|
const selectIds = ref<string[]>([]);
|
|
|
|
const selectIds = ref<string[]>([])
|
|
|
|
|
|
|
|
|
|
|
|
function onCheckAllChange(value) {
|
|
|
|
function onCheckAllChange(value) {
|
|
|
|
const ids: string[] = [];
|
|
|
|
const ids: string[] = []
|
|
|
|
for (const item of offList.value) {
|
|
|
|
for (const item of offList.value) {
|
|
|
|
if (!item.fix) {
|
|
|
|
if (!item.fix) {
|
|
|
|
item.checked = value;
|
|
|
|
item.checked = value
|
|
|
|
ids.push(item.id);
|
|
|
|
ids.push(item.id)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (const item of offShowList.value) {
|
|
|
|
for (const item of offShowList.value) {
|
|
|
|
if (!item.fix) {
|
|
|
|
if (!item.fix)
|
|
|
|
item.checked = value;
|
|
|
|
item.checked = value
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
selectIds.value = value ? ids : [];
|
|
|
|
selectIds.value = value ? ids : []
|
|
|
|
if (value) {
|
|
|
|
if (value) {
|
|
|
|
offList.value.map((v) => {
|
|
|
|
offList.value.map((v) => {
|
|
|
|
if (!v.checked) {
|
|
|
|
if (!v.checked)
|
|
|
|
onList.value.push(v);
|
|
|
|
onList.value.push(v)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
});
|
|
|
|
onShowList.value = cloneDeep(onList.value)
|
|
|
|
onShowList.value = cloneDeep(onList.value);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
else {
|
|
|
|
onList.value = [];
|
|
|
|
onList.value = []
|
|
|
|
onShowList.value = [];
|
|
|
|
onShowList.value = []
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function onCheckChange(checked: any, item: any) {
|
|
|
|
function onCheckChange(checked: any, item: any) {
|
|
|
|
const index = selectIds.value.indexOf(item.id);
|
|
|
|
const index = selectIds.value.indexOf(item.id)
|
|
|
|
item.checked = checked;
|
|
|
|
item.checked = checked
|
|
|
|
let currentIndex = offList.value.findIndex((v) => v.id == item.id);
|
|
|
|
const currentIndex = offList.value.findIndex(v => v.id == item.id)
|
|
|
|
offList.value[currentIndex].checked = checked;
|
|
|
|
offList.value[currentIndex].checked = checked
|
|
|
|
if (index === -1 && checked) {
|
|
|
|
if (index === -1 && checked)
|
|
|
|
selectIds.value.push(item.id);
|
|
|
|
selectIds.value.push(item.id)
|
|
|
|
} else {
|
|
|
|
else
|
|
|
|
selectIds.value.splice(index, 1);
|
|
|
|
selectIds.value.splice(index, 1)
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const showIds = computed(() => {
|
|
|
|
const showIds = computed(() => {
|
|
|
|
return onList.value.map((item) => {
|
|
|
|
return onList.value.map((item) => {
|
|
|
|
return item.id;
|
|
|
|
return item.id
|
|
|
|
});
|
|
|
|
})
|
|
|
|
});
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
watch(
|
|
|
|
watch(
|
|
|
|
() => selectIds.value.length,
|
|
|
|
() => selectIds.value.length,
|
|
|
|
(newVal, oldVal) => {
|
|
|
|
(newVal, oldVal) => {
|
|
|
|
if (newVal === oldVal) return;
|
|
|
|
if (newVal === oldVal)
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
const action = newVal > oldVal ? "add" : "remove";
|
|
|
|
const action = newVal > oldVal ? 'add' : 'remove'
|
|
|
|
const diff =
|
|
|
|
const diff
|
|
|
|
action === "add"
|
|
|
|
= action === 'add'
|
|
|
|
? difference(selectIds.value, showIds.value)
|
|
|
|
? difference(selectIds.value, showIds.value)
|
|
|
|
: difference(showIds.value, selectIds.value);
|
|
|
|
: difference(showIds.value, selectIds.value)
|
|
|
|
|
|
|
|
|
|
|
|
if (diff.length === 0) return;
|
|
|
|
if (diff.length === 0)
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
if (action === "add") {
|
|
|
|
if (action === 'add') {
|
|
|
|
for (const item of offList.value) {
|
|
|
|
for (const item of offList.value) {
|
|
|
|
if (!item.fix && diff.includes(item.id)) {
|
|
|
|
if (!item.fix && diff.includes(item.id)) {
|
|
|
|
onList.value.push({
|
|
|
|
onList.value.push({
|
|
|
|
id: item.id,
|
|
|
|
id: item.id,
|
|
|
|
name: item.name || "未配置",
|
|
|
|
name: item.name || '未配置',
|
|
|
|
fix: item.fix || false,
|
|
|
|
fix: item.fix || false,
|
|
|
|
});
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
onShowList.value = cloneDeep(onList.value);
|
|
|
|
onShowList.value = cloneDeep(onList.value)
|
|
|
|
} else {
|
|
|
|
}
|
|
|
|
const list = onList.value;
|
|
|
|
else {
|
|
|
|
|
|
|
|
const list = onList.value
|
|
|
|
for (let index = 0; index < list.length; index++) {
|
|
|
|
for (let index = 0; index < list.length; index++) {
|
|
|
|
const item = list[index];
|
|
|
|
const item = list[index]
|
|
|
|
if (!item.fix && diff.includes(item.id)) {
|
|
|
|
if (!item.fix && diff.includes(item.id)) {
|
|
|
|
list.splice(index, 1);
|
|
|
|
list.splice(index, 1)
|
|
|
|
onShowList.value.splice(index, 1);
|
|
|
|
onShowList.value.splice(index, 1)
|
|
|
|
index--;
|
|
|
|
index--
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
console.log(onShowList.value, list, "onShowList");
|
|
|
|
console.log(onShowList.value, list, 'onShowList')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
);
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
watch(
|
|
|
|
watch(
|
|
|
|
() => showIds.value.length,
|
|
|
|
() => showIds.value.length,
|
|
|
|
(newVal, oldVal) => {
|
|
|
|
(newVal, oldVal) => {
|
|
|
|
if (newVal === oldVal) return;
|
|
|
|
if (newVal === oldVal)
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
const diff = difference(selectIds.value, showIds.value);
|
|
|
|
const diff = difference(selectIds.value, showIds.value)
|
|
|
|
|
|
|
|
|
|
|
|
if (diff.length === 0) return;
|
|
|
|
if (diff.length === 0)
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
for (const item of offList.value) {
|
|
|
|
for (const item of offList.value) {
|
|
|
|
if (!item.fix && diff.includes(item.id)) {
|
|
|
|
if (!item.fix && diff.includes(item.id)) {
|
|
|
|
const index = selectIds.value.indexOf(item.id);
|
|
|
|
const index = selectIds.value.indexOf(item.id)
|
|
|
|
item.checked = false;
|
|
|
|
item.checked = false
|
|
|
|
selectIds.value.splice(index, 1);
|
|
|
|
selectIds.value.splice(index, 1)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
);
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
function clearDragSource() {
|
|
|
|
function clearDragSource() {
|
|
|
|
onList.value = onList.value.filter((item) => {
|
|
|
|
onList.value = onList.value.filter((item) => {
|
|
|
|
return item.fix === true;
|
|
|
|
return item.fix === true
|
|
|
|
});
|
|
|
|
})
|
|
|
|
onShowList.value = cloneDeep(onList.value);
|
|
|
|
onShowList.value = cloneDeep(onList.value)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function removeHandler(id: string) {
|
|
|
|
function removeHandler(id: string) {
|
|
|
|
let index = onList.value.findIndex((item) => {
|
|
|
|
let index = onList.value.findIndex((item) => {
|
|
|
|
return item.id === id;
|
|
|
|
return item.id === id
|
|
|
|
});
|
|
|
|
})
|
|
|
|
if (index !== -1) {
|
|
|
|
if (index !== -1) {
|
|
|
|
onList.value.splice(index, 1);
|
|
|
|
onList.value.splice(index, 1)
|
|
|
|
onShowList.value.splice(index, 1);
|
|
|
|
onShowList.value.splice(index, 1)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
index = offList.value.findIndex((v) => v.id == id);
|
|
|
|
index = offList.value.findIndex(v => v.id == id)
|
|
|
|
offList.value[index].checked = false;
|
|
|
|
offList.value[index].checked = false
|
|
|
|
offShowList.value = cloneDeep(offList.value);
|
|
|
|
offShowList.value = cloneDeep(offList.value)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
const initData = ()=>{
|
|
|
|
function initData() {
|
|
|
|
offList.value = [];
|
|
|
|
offList.value = []
|
|
|
|
onList.value = [];
|
|
|
|
onList.value = []
|
|
|
|
fixList.value = [];
|
|
|
|
fixList.value = []
|
|
|
|
offShowList.value = [];
|
|
|
|
offShowList.value = []
|
|
|
|
onShowList.value = [];
|
|
|
|
onShowList.value = []
|
|
|
|
fixShowList.value = [];
|
|
|
|
fixShowList.value = []
|
|
|
|
selectIds.value = [];
|
|
|
|
selectIds.value = []
|
|
|
|
}
|
|
|
|
}
|
|
|
|
const getData = async (type = "") => {
|
|
|
|
async function getData(type = '') {
|
|
|
|
initData();
|
|
|
|
initData()
|
|
|
|
const userStore = useUser();
|
|
|
|
const userStore = useUser()
|
|
|
|
const userInfo = userStore.getUserInfo;
|
|
|
|
const userInfo = userStore.getUserInfo
|
|
|
|
let res;
|
|
|
|
let res
|
|
|
|
res = await getAllfieldList(props.reviewType); //所有筛选项目
|
|
|
|
res = await getAllfieldList(props.reviewType) // 所有筛选项目
|
|
|
|
const allList = res.data;
|
|
|
|
const allList = res.data
|
|
|
|
res = await getfieldList(props.reviewType, userInfo.id); //当前用户选择的项目
|
|
|
|
res = await getfieldList(props.reviewType, userInfo.id) // 当前用户选择的项目
|
|
|
|
const useList = res.data;
|
|
|
|
const useList = res.data
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* name 标题
|
|
|
|
* name 标题
|
|
|
|
* id 键值
|
|
|
|
* id 键值
|
|
|
|
* fix 是否默认
|
|
|
|
* fix 是否默认
|
|
|
|
* checked 是否选中
|
|
|
|
* checked 是否选中
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
const userFieldFixed = useList?.userFieldFixed?.split(",");
|
|
|
|
const userFieldFixed = useList?.userFieldFixed?.split(',')
|
|
|
|
const userFieldUnFixed = useList?.userFieldUnFixed?.split(",");
|
|
|
|
const userFieldUnFixed = useList?.userFieldUnFixed?.split(',')
|
|
|
|
if (!type || type == "off") {
|
|
|
|
if (!type || type == 'off') {
|
|
|
|
offList.value = [];
|
|
|
|
offList.value = []
|
|
|
|
allList?.map((v) => {
|
|
|
|
allList?.map((v) => {
|
|
|
|
let item = {
|
|
|
|
const item = {
|
|
|
|
name: v.fieldDesc,
|
|
|
|
name: v.fieldDesc,
|
|
|
|
id: v.name,
|
|
|
|
id: v.name,
|
|
|
|
fix: v.isrequired == 2,
|
|
|
|
fix: v.isrequired == 2,
|
|
|
|
checked:
|
|
|
|
checked:
|
|
|
|
v.isrequired == 2 ||
|
|
|
|
v.isrequired == 2
|
|
|
|
Boolean(userFieldFixed?.find((v2) => v2 == v.name)) ||
|
|
|
|
|| Boolean(userFieldFixed?.find(v2 => v2 == v.name))
|
|
|
|
Boolean(userFieldUnFixed?.find((v2) => v2 == v.name)),
|
|
|
|
|| Boolean(userFieldUnFixed?.find(v2 => v2 == v.name)),
|
|
|
|
};
|
|
|
|
|
|
|
|
if (item.fix) {
|
|
|
|
|
|
|
|
fixList.value.push(item);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
offList.value.push(item);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
if (item.fix)
|
|
|
|
offList.value.unshift(...fixList.value);
|
|
|
|
fixList.value.push(item)
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
offList.value.push(item)
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
offList.value.unshift(...fixList.value)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!type || type == "on") {
|
|
|
|
if (!type || type == 'on') {
|
|
|
|
useList?.userFieldFixed?.split(",").map((v) => {
|
|
|
|
useList?.userFieldFixed?.split(',').map((v) => {
|
|
|
|
let item = allList.find((v2) => v2.name == v);
|
|
|
|
let item = allList.find(v2 => v2.name == v)
|
|
|
|
if (item) {
|
|
|
|
if (item) {
|
|
|
|
item = {
|
|
|
|
item = {
|
|
|
|
name: item.fieldDesc,
|
|
|
|
name: item.fieldDesc,
|
|
|
|
id: item.name,
|
|
|
|
id: item.name,
|
|
|
|
fix: item.isrequired == 2,
|
|
|
|
fix: item.isrequired == 2,
|
|
|
|
checked: true,
|
|
|
|
checked: true,
|
|
|
|
};
|
|
|
|
|
|
|
|
selectIds.value.push(item.id);
|
|
|
|
|
|
|
|
if (!item.fix) {
|
|
|
|
|
|
|
|
onList.value.push(item);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
selectIds.value.push(item.id)
|
|
|
|
|
|
|
|
if (!item.fix)
|
|
|
|
|
|
|
|
onList.value.push(item)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
offShowList.value = cloneDeep(offList.value);
|
|
|
|
offShowList.value = cloneDeep(offList.value)
|
|
|
|
fixShowList.value = cloneDeep(fixList.value);
|
|
|
|
fixShowList.value = cloneDeep(fixList.value)
|
|
|
|
onShowList.value = cloneDeep(onList.value);
|
|
|
|
onShowList.value = cloneDeep(onList.value)
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
onMounted(() => getData());
|
|
|
|
onMounted(() => getData())
|
|
|
|
|
|
|
|
|
|
|
|
const indeterminate = computed(() => {
|
|
|
|
const indeterminate = computed(() => {
|
|
|
|
let baseNum = 0;
|
|
|
|
let baseNum = 0
|
|
|
|
offList.value.map((v) => {
|
|
|
|
offList.value.map((v) => {
|
|
|
|
if (v.fix) {
|
|
|
|
if (v.fix)
|
|
|
|
baseNum += 1;
|
|
|
|
baseNum += 1
|
|
|
|
}
|
|
|
|
})
|
|
|
|
});
|
|
|
|
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
onShowList.value.length > 0 &&
|
|
|
|
onShowList.value.length > 0
|
|
|
|
offShowList.value.length - baseNum > onShowList.value.length
|
|
|
|
&& offShowList.value.length - baseNum > onShowList.value.length
|
|
|
|
);
|
|
|
|
)
|
|
|
|
});
|
|
|
|
})
|
|
|
|
const queryData = (value, type) => {
|
|
|
|
function queryData(value, type) {
|
|
|
|
if (value) {
|
|
|
|
if (value) {
|
|
|
|
if (type == "off") {
|
|
|
|
if (type == 'off') {
|
|
|
|
offShowList.value = offList.value.filter((item) => item.name.indexOf(value) > -1);
|
|
|
|
offShowList.value = offList.value.filter(item => item.name.includes(value))
|
|
|
|
} else {
|
|
|
|
|
|
|
|
onShowList.value = onList.value.filter((item) => item.name.indexOf(value) > -1);
|
|
|
|
|
|
|
|
fixShowList.value = fixList.value.filter((item) => item.name.indexOf(value) > -1);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
else {
|
|
|
|
|
|
|
|
onShowList.value = onList.value.filter(item => item.name.includes(value))
|
|
|
|
|
|
|
|
fixShowList.value = fixList.value.filter(item => item.name.includes(value))
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
// getData(type);
|
|
|
|
// getData(type);
|
|
|
|
if (type == "off") {
|
|
|
|
if (type == 'off') {
|
|
|
|
offShowList.value = cloneDeep(offList.value);
|
|
|
|
offShowList.value = cloneDeep(offList.value)
|
|
|
|
} else {
|
|
|
|
}
|
|
|
|
onShowList.value = cloneDeep(onList.value);
|
|
|
|
else {
|
|
|
|
fixShowList.value = cloneDeep(fixList.value);
|
|
|
|
onShowList.value = cloneDeep(onList.value)
|
|
|
|
|
|
|
|
fixShowList.value = cloneDeep(fixList.value)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<template>
|
|
|
@ -401,8 +405,8 @@ const queryData = (value, type) => {
|
|
|
|
<n-checkbox
|
|
|
|
<n-checkbox
|
|
|
|
v-model:checked="checkAll"
|
|
|
|
v-model:checked="checkAll"
|
|
|
|
label="全选"
|
|
|
|
label="全选"
|
|
|
|
@update:checked="onCheckAllChange"
|
|
|
|
|
|
|
|
:indeterminate="indeterminate"
|
|
|
|
:indeterminate="indeterminate"
|
|
|
|
|
|
|
|
@update:checked="onCheckAllChange"
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="content">
|
|
|
|
<div class="content">
|
|
|
@ -445,7 +449,9 @@ const queryData = (value, type) => {
|
|
|
|
<SvgIcon size="14px" name="magnifying-1" />
|
|
|
|
<SvgIcon size="14px" name="magnifying-1" />
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
</n-input>
|
|
|
|
</n-input>
|
|
|
|
<div class="draggable-title">系统默认</div>
|
|
|
|
<div class="draggable-title">
|
|
|
|
|
|
|
|
系统默认
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<div class="draggable-ul" style="border-bottom: none">
|
|
|
|
<div class="draggable-ul" style="border-bottom: none">
|
|
|
|
<div
|
|
|
|
<div
|
|
|
|
v-for="item in fixShowList"
|
|
|
|
v-for="item in fixShowList"
|
|
|
@ -456,7 +462,9 @@ const queryData = (value, type) => {
|
|
|
|
<span class="ml-2">{{ item.name }}</span>
|
|
|
|
<span class="ml-2">{{ item.name }}</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="draggable-title" style="border-top: none">自定义配置</div>
|
|
|
|
<div class="draggable-title" style="border-top: none">
|
|
|
|
|
|
|
|
自定义配置
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<VueDraggable
|
|
|
|
<VueDraggable
|
|
|
|
v-model="onList"
|
|
|
|
v-model="onList"
|
|
|
|
class="draggable-ul"
|
|
|
|
class="draggable-ul"
|
|
|
@ -487,7 +495,9 @@ const queryData = (value, type) => {
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<template #footer>
|
|
|
|
<template #footer>
|
|
|
|
<div class="wrapper-footer">
|
|
|
|
<div class="wrapper-footer">
|
|
|
|
<n-button type="info" @click="handleSumbit"> 确定 </n-button>
|
|
|
|
<n-button type="info" @click="handleSumbit">
|
|
|
|
|
|
|
|
确定
|
|
|
|
|
|
|
|
</n-button>
|
|
|
|
<n-button secondary style="margin-left: 15px" @click="getData();closeModal()">
|
|
|
|
<n-button secondary style="margin-left: 15px" @click="getData();closeModal()">
|
|
|
|
取消
|
|
|
|
取消
|
|
|
|
</n-button>
|
|
|
|
</n-button>
|
|
|
|