|
|
@ -2,9 +2,7 @@
|
|
|
|
import { cloneDeep, difference } from 'lodash-es'
|
|
|
|
import { cloneDeep, difference } from 'lodash-es'
|
|
|
|
import { computed, defineEmits, defineProps, onMounted, ref, watch } from 'vue'
|
|
|
|
import { computed, defineEmits, defineProps, onMounted, ref, watch } from 'vue'
|
|
|
|
import { VueDraggable } from 'vue-draggable-plus'
|
|
|
|
import { VueDraggable } from 'vue-draggable-plus'
|
|
|
|
import { useMessage } from 'naive-ui'
|
|
|
|
|
|
|
|
import { getAllfieldList, getfieldList, savefield } from '@/api/home/filter'
|
|
|
|
import { getAllfieldList, getfieldList, savefield } from '@/api/home/filter'
|
|
|
|
import { workPackageMap } from '@/config/workorder'
|
|
|
|
|
|
|
|
import { useUser } from '@/store/modules/user'
|
|
|
|
import { useUser } from '@/store/modules/user'
|
|
|
|
|
|
|
|
|
|
|
|
const props = defineProps({
|
|
|
|
const props = defineProps({
|
|
|
@ -17,8 +15,6 @@ const props = defineProps({
|
|
|
|
|
|
|
|
|
|
|
|
const emit = defineEmits(['onOk'])
|
|
|
|
const emit = defineEmits(['onOk'])
|
|
|
|
|
|
|
|
|
|
|
|
const message = useMessage()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 左侧隐藏列表
|
|
|
|
// 左侧隐藏列表
|
|
|
|
const offList = ref<any[]>([])
|
|
|
|
const offList = ref<any[]>([])
|
|
|
|
// 右侧显示列表
|
|
|
|
// 右侧显示列表
|
|
|
@ -38,66 +34,6 @@ const selectCount = computed(() => {
|
|
|
|
return `显示字段(共${onList.value.length}个)`
|
|
|
|
return `显示字段(共${onList.value.length}个)`
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
function generatList() {
|
|
|
|
|
|
|
|
const keys = Object.keys(workPackageMap)
|
|
|
|
|
|
|
|
let showList: object[] = []
|
|
|
|
|
|
|
|
const hideList: object[] = []
|
|
|
|
|
|
|
|
const showStr = 'status'
|
|
|
|
|
|
|
|
const showKeys = showStr.split(',').map((key: string) => key.toLowerCase())
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (const key of keys) {
|
|
|
|
|
|
|
|
const name = workPackageMap[key]?.label
|
|
|
|
|
|
|
|
const isDefault = workPackageMap[key]?.isDefault
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 系统配置为Y且不是默认配置
|
|
|
|
|
|
|
|
if (!isDefault) {
|
|
|
|
|
|
|
|
hideList.push({
|
|
|
|
|
|
|
|
id: key,
|
|
|
|
|
|
|
|
name: name || '未配置',
|
|
|
|
|
|
|
|
fix: isDefault,
|
|
|
|
|
|
|
|
checked: workPackageMap[key].isDefault,
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
showList = showKeys.reduce((acc, key) => {
|
|
|
|
|
|
|
|
const config = {
|
|
|
|
|
|
|
|
id: key,
|
|
|
|
|
|
|
|
name: workPackageMap[key].label || '未配置',
|
|
|
|
|
|
|
|
fix: workPackageMap[key].isDefault,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return [...acc, config]
|
|
|
|
|
|
|
|
}, [])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const fixedList = generateDefaultList()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
hideList.unshift(...fixedList)
|
|
|
|
|
|
|
|
showList.unshift(...fixedList)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
onList.value = showList
|
|
|
|
|
|
|
|
offList.value = hideList
|
|
|
|
|
|
|
|
return { showList, hideList }
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function generateDefaultList() {
|
|
|
|
|
|
|
|
return Object.keys(workPackageMap).reduce((acc, key) => {
|
|
|
|
|
|
|
|
const { label, isDefault } = workPackageMap[key]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (isDefault) {
|
|
|
|
|
|
|
|
const config = {
|
|
|
|
|
|
|
|
id: key,
|
|
|
|
|
|
|
|
name: label || '未配置',
|
|
|
|
|
|
|
|
fix: true,
|
|
|
|
|
|
|
|
checked: true,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return [...acc, config]
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
return acc
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}, [])
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const show = ref(false)
|
|
|
|
const show = ref(false)
|
|
|
|
const checkAll = computed(() => {
|
|
|
|
const checkAll = computed(() => {
|
|
|
|
let baseNum = 0
|
|
|
|
let baseNum = 0
|
|
|
@ -137,8 +73,6 @@ defineExpose({
|
|
|
|
showModal,
|
|
|
|
showModal,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
// generatList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const selectIds = ref<string[]>([])
|
|
|
|
const selectIds = ref<string[]>([])
|
|
|
|
|
|
|
|
|
|
|
|
function onCheckAllChange(value) {
|
|
|
|
function onCheckAllChange(value) {
|
|
|
@ -181,8 +115,7 @@ function onCheckChange(checked: any, item: any) {
|
|
|
|
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(() => {
|
|
|
|