Merge branch 'main' into shen

bak
Dragon 1 year ago
commit 7535771c45

3
components.d.ts vendored

@ -20,7 +20,6 @@ declare module 'vue' {
NDialogProvider: typeof import('naive-ui')['NDialogProvider'] NDialogProvider: typeof import('naive-ui')['NDialogProvider']
NDivider: typeof import('naive-ui')['NDivider'] NDivider: typeof import('naive-ui')['NDivider']
NDropdown: typeof import('naive-ui')['NDropdown'] NDropdown: typeof import('naive-ui')['NDropdown']
NEmpty: typeof import('naive-ui')['NEmpty']
NForm: typeof import('naive-ui')['NForm'] NForm: typeof import('naive-ui')['NForm']
NFormItem: typeof import('naive-ui')['NFormItem'] NFormItem: typeof import('naive-ui')['NFormItem']
NGi: typeof import('naive-ui')['NGi'] NGi: typeof import('naive-ui')['NGi']
@ -39,8 +38,6 @@ declare module 'vue' {
NSpace: typeof import('naive-ui')['NSpace'] NSpace: typeof import('naive-ui')['NSpace']
NSpin: typeof import('naive-ui')['NSpin'] NSpin: typeof import('naive-ui')['NSpin']
NSwitch: typeof import('naive-ui')['NSwitch'] NSwitch: typeof import('naive-ui')['NSwitch']
NTabPane: typeof import('naive-ui')['NTabPane']
NTabs: typeof import('naive-ui')['NTabs']
NTag: typeof import('naive-ui')['NTag'] NTag: typeof import('naive-ui')['NTag']
NTooltip: typeof import('naive-ui')['NTooltip'] NTooltip: typeof import('naive-ui')['NTooltip']
NUpload: typeof import('naive-ui')['NUpload'] NUpload: typeof import('naive-ui')['NUpload']

@ -1,5 +1,5 @@
import type { AsideEntity } from './aside' import type { AsideEntity } from './aside'
import { IzProjectVue, IztaskrromVue, PictureDownloadVue, PlanVue, ReportUserVue, TimeVue } from '@/views/home/aside/comp/items' import { IzProjectVue, IzStatus, IztaskrromVue, PictureDownloadVue, PlanVue, ReportUserVue, TimeVue } from '@/views/home/aside/comp/items'
export interface RowData { export interface RowData {
id: string id: string
@ -104,7 +104,7 @@ export const asideMap: Recordable<AsideEntity> = {
defaultValue: null, defaultValue: null,
isDefaultFilter: false, isDefaultFilter: false,
key: 'izstatus', key: 'izstatus',
component: PlanVue, // todo component: IzStatus, // todo
}, },
izuptime: { izuptime: {
label: '提报时间', label: '提报时间',

@ -229,7 +229,7 @@ export const useDictionaryStore = defineStore({
async fetchizstatusListt() { async fetchizstatusListt() {
const list = await getizstatusList() const list = await getizstatusList()
this.izstatusList = generateOptions2(list, 'codeno', 'name') this.izstatusList = generateOptions2(list, 'codeno', 'name')
return this.backList return this.izstatusList
}, },
}, },
}) })

@ -17,10 +17,10 @@ const props = defineProps({
}) })
const actionConfig = { const actionConfig = {
3: [{ label: '查看', key: 'view' }, { label: '重置审批', key: 'reset' }], 3: [{ label: '查看', key: 'view' }],
4: [{ label: '查看', key: 'view' }, { label: '重置审批', key: 'reset' }], 4: [{ label: '查看', key: 'view' }],
2: [{ label: '通过', key: 'approval' }, { label: '不通过', key: 'reject' }, { label: '重置审批', key: 'reset' }], 2: [{ label: '通过', key: 'approval' }, { label: '不通过', key: 'reject' }],
5: [{ label: '通过', key: 'approval' }, { label: '不通过', key: 'reject' }, { label: '重置审批', key: 'reset' }], 5: [{ label: '通过', key: 'approval' }, { label: '不通过', key: 'reject' }],
} }
const actions = computed(() => { const actions = computed(() => {

@ -45,7 +45,7 @@ onMounted(async()=>{
fix: v.isrequired == 2, fix: v.isrequired == 2,
checked: checked:
v.isrequired == 2 || v.isrequired == 2 ||
Boolean(useList.userFieldFixed?.toLowerCase().indexOf(v.name)>-1) || Boolean(useList.userFieldUnFixed?.toLowerCase().indexOf(v.name)>-1), Boolean(useList.userFieldFixed?.indexOf(v.name)>-1) || Boolean(useList.userFieldUnFixed?.indexOf(v.name)>-1),
}; };
offList.value.push(item) offList.value.push(item)
}); });

@ -0,0 +1,57 @@
<script lang="ts" setup>
import { onBeforeMount, ref } from 'vue'
import type { FormRules } from 'naive-ui'
import { useDictionary } from '@/store/modules/dictonary'
const props = defineProps<{
value: string[] | null
label: string
}>()
const emit = defineEmits<{
(e: 'update:value', value: string[]): void
}>()
const formValue = ref({
plans: props.value,
})
const rules: FormRules = {
plans: [
{
required: false,
type: 'array',
trigger: ['blur', 'change'],
},
],
}
const options = ref([])
const configStore = useDictionary()
const labStyle = {
fontWeight: 'bold',
}
onBeforeMount(async () => {
const list = await configStore.fetchizstatusListt()
debugger
options.value = list
})
function onChange(value: Array<string>) {
emit('update:value', value)
}
</script>
<template>
<n-form :model="formValue" style="padding: 0px 10px;" :rules="rules">
<n-form-item :label="label" path="plans" :label-style="labStyle">
<n-select
v-model:value="formValue.plans" :max-tag-count="2" placeholder="请选择审核状态" multiple
:options="options" @update:value="onChange"
/>
</n-form-item>
</n-form>
</template>
<style lang="less" scoped></style>

@ -19,5 +19,6 @@ import IzCustomtype from './IzCustomtype.vue'
import IzProductVue from './IzProduct.vue' import IzProductVue from './IzProduct.vue'
import IzProjecttype from './IzProjecttype.vue' import IzProjecttype from './IzProjecttype.vue'
import IzVisitcity from './IzVisitcity.vue' import IzVisitcity from './IzVisitcity.vue'
import IzStatus from './IzStatus.vue'
export { IzProjecttype, IzVisitcity, IzCustomlevel, IzCustomtype, IzCustomname, IzfirmVue, IzProductVue, IzvisitproVue, IztaskstatusVue, IztaskrromVue, IzProjectVue, IzShowVue, PictureDownloadVue, PictureUploadVue, PlaceHolderVue, RegionVue, SimilarityVue, ReportUserVue, PlanVue, PictureTypeVue, TimeVue } export { IzProjecttype, IzStatus, IzVisitcity, IzCustomlevel, IzCustomtype, IzCustomname, IzfirmVue, IzProductVue, IzvisitproVue, IztaskstatusVue, IztaskrromVue, IzProjectVue, IzShowVue, PictureDownloadVue, PictureUploadVue, PlaceHolderVue, RegionVue, SimilarityVue, ReportUserVue, PlanVue, PictureTypeVue, TimeVue }

@ -36,6 +36,7 @@ const loading = ref(false)
const message = useMessage() const message = useMessage()
const totalCount = ref(0) const totalCount = ref(0)
const sortBy = ref<'asc' | 'desc'>('desc') const sortBy = ref<'asc' | 'desc'>('desc')
const imageRef = ref<ComponentElRef | null>()
let canloadMore = true let canloadMore = true
let filterId = null let filterId = null
@ -297,8 +298,8 @@ function sortHandler() {
:src="item.imgUrl" :src="item.imgUrl"
> --> > -->
<n-image <n-image
class="img" :img-props="{ onClick: hideDownload }" :class="{ 'img-fit': viewMode !== 'masonry' }" class="img" :img-props="{ onClick: hideDownload }"
:src="item.thumburl" :class="{ 'img-fit': viewMode !== 'masonry' }" :preview-src="item.imgUrl" :src="item.thumburl"
/> />
<div class="percent"> <div class="percent">
<SvgIcon size="42" name="tag" /> <SvgIcon size="42" name="tag" />

@ -2,7 +2,7 @@
import { useTaskStore } from '@/store/modules/task'; import { useTaskStore } from '@/store/modules/task';
import { debounce } from 'lodash-es'; import { debounce } from 'lodash-es';
import { computed, ref, unref, watch } from 'vue'; import { computed, ref, unref, watch } from 'vue';
import CustomFieldModal from '../../worksheet/modal/CustomFieldModal.vue'; import CustomFieldModal from '../modal/CustomFieldModal.vue';
import TaskList from './TaskList.vue'; import TaskList from './TaskList.vue';

@ -32,7 +32,6 @@ const { isLoading } = useInfiniteScroll(
async function loadMore() { async function loadMore() {
if (isLoading.value || el.value == null) if (isLoading.value || el.value == null)
return return
const more = await fetchList() const more = await fetchList()
data.value.push(...more) data.value.push(...more)
} }

@ -54,7 +54,7 @@ const loading = ref(false)
let _masonry: null | Masonry = null let _masonry: null | Masonry = null
const show = ref(false) const show = ref(false)
const sortBy: PictureSortParam = { const sortBy: PictureSortParam = {
orderbyname: 'asc', orderbyname: 'desc',
orderbyvalue: 'fromuptime', orderbyvalue: 'fromuptime',
} }
const batch = ref(false) const batch = ref(false)

@ -1,212 +1,283 @@
<script lang="ts" setup> <script lang="ts" setup>
import { workPackageMap } from '@/config/workorder'; import { getAllfieldList, getfieldList, savefield } from "@/api/home/filter";
import { difference } from 'lodash-es'; import { workPackageMap } from "@/config/workorder";
import { computed, ref, watch } from 'vue'; import { useUser } from "@/store/modules/user";
import { VueDraggable } from 'vue-draggable-plus'; import { difference } from "lodash-es";
import { computed, defineEmits, defineProps, onMounted, ref, watch } from "vue";
import { VueDraggable } from "vue-draggable-plus";
const props = defineProps({
reviewType: {
type: Number,
default: () => 1,
require: true,
},
});
const emit = defineEmits(["onOk"]);
// //
const offList = ref<any[]>([]) const offList = ref<any[]>([]);
// //
const onList = ref<any[]>([]) const onList = 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];
} else {
return acc;
} }
return [...acc, config] }, []);
}
else {
return acc
}
}, [])
} }
const show = ref(false) const show = ref(false);
const checkAll = ref(false) const checkAll = ref(false);
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) {
e.preventDefault() const userStore = useUser();
closeModal() const userInfo = userStore.getUserInfo;
let userField = "";
onList.value.map((v) => {
userField += `${v.id},`;
});
userField = userField.slice(0, userField.length - 1);
savefield(props.reviewType, userInfo.id, userField);
e.preventDefault();
closeModal();
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);
} }
} }
selectIds.value = value ? ids : [] selectIds.value = value ? ids : [];
} }
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;
if (index === -1 && checked) if (index === -1 && checked) selectIds.value.push(item.id);
selectIds.value.push(item.id) else selectIds.value.splice(index, 1);
else
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) if (newVal === oldVal) return;
return
const action = newVal > oldVal ? 'add' : 'remove' const action = newVal > oldVal ? "add" : "remove";
const diff = action === 'add' ? difference(selectIds.value, showIds.value) : difference(showIds.value, selectIds.value) const diff =
action === "add"
? difference(selectIds.value, showIds.value)
: difference(showIds.value, selectIds.value);
if (diff.length === 0) if (diff.length === 0) return;
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,
}) });
} }
} }
} } else {
else { const list = onList.value;
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);
index-- index--;
} }
} }
} }
}, }
) );
watch( watch(
() => showIds.value.length, () => showIds.value.length,
(newVal, oldVal) => { (newVal, oldVal) => {
if (newVal === oldVal) if (newVal === oldVal) return;
return
const diff = difference(selectIds.value, showIds.value) const diff = difference(selectIds.value, showIds.value);
if (diff.length === 0) if (diff.length === 0) return;
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;
}) });
} }
function removeHandler(id: string) { function removeHandler(id: string) {
const index = onList.value.findIndex((item) => { const 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)
} }
onMounted(async () => {
const userStore = useUser();
const userInfo = userStore.getUserInfo;
let res;
res = await getAllfieldList(props.reviewType); //
const allList = res.data;
res = await getfieldList(props.reviewType, userInfo.id); //
const useList = res.data;
console.log(allList, "getAllfieldList", props.reviewType);
console.log(useList, "getfieldList", props.reviewType);
/**
* name 标题
* id 键值
* fix 是否默认
* checked 是否选中
*/
let fixList = [];
allList.map((v) => {
let item = {
name: v.fieldDesc,
id: v.name,
fix: v.isrequired == 2,
checked:
v.isrequired == 2 ||
Boolean(useList.userFieldFixed?.indexOf(v.name) > -1) ||
Boolean(useList.userFieldUnFixed?.indexOf(v.name) > -1),
};
if (item.fix) {
fixList.push(item);
} else {
offList.value.push(item);
}
});
offList.value.unshift(...fixList);
useList.userFieldFixed?.split(",").map((v) => {
let item = allList.find((v2) => v2.name == v);
if (item) {
item = {
name: item.fieldDesc,
id: item.name,
fix: item.isrequired == 2,
checked: true,
};
onList.value.push(item);
}
});
});
</script> </script>
<template> <template>
<n-modal v-model:show="show" transform-origin="center"> <n-modal v-model:show="show" transform-origin="center">
<n-card class="cardstyle" :bordered="false" size="huge" role="dialog" aria-modal="true"> <n-card
class="cardstyle"
:bordered="false"
size="huge"
role="dialog"
aria-modal="true"
>
<div class="wrapper"> <div class="wrapper">
<span class="wrapper-title">自定义任务包字段</span> <span class="wrapper-title">自定义任务包字段</span>
<div class="wrapper-bar"> <div class="wrapper-bar">
@ -217,7 +288,10 @@ function removeHandler(id: string) {
<n-grid cols="4" class="mt-4 proCard" responsive="screen" :x-gap="24"> <n-grid cols="4" class="mt-4 proCard" responsive="screen" :x-gap="24">
<n-grid-item span="3"> <n-grid-item span="3">
<NCard <NCard
:title="allCount" class="dragcardStyle" :segmented="{ content: true, footer: true }" size="small" :title="allCount"
class="dragcardStyle"
:segmented="{ content: true, footer: true }"
size="small"
:bordered="false" :bordered="false"
> >
<div> <div>
@ -228,15 +302,24 @@ function removeHandler(id: string) {
</n-input> </n-input>
<div class="draggable-ul"> <div class="draggable-ul">
<div class="draggable-li"> <div class="draggable-li">
<n-checkbox v-model:checked="checkAll" label="全部" @update:checked="onCheckAllChange" /> <n-checkbox
v-model:checked="checkAll"
label="全部"
@update:checked="onCheckAllChange"
/>
</div> </div>
<div class="content"> <div class="content">
<div <div
v-for="item in offList" :key="item.id" style="width: 170px;" v-for="item in offList"
:class="{ 'disable-check': item.fix }" class="draggable-li" :key="item.id"
style="width: 170px"
:class="{ 'disable-check': item.fix }"
class="draggable-li"
> >
<n-checkbox <n-checkbox
v-model:checked="item.checked" :label="item.name" :disabled="item.fix" v-model:checked="item.checked"
:label="item.name"
:disabled="item.fix"
@update:checked="onCheckChange($event, item)" @update:checked="onCheckChange($event, item)"
/> />
</div> </div>
@ -247,7 +330,10 @@ function removeHandler(id: string) {
</n-grid-item> </n-grid-item>
<n-grid-item> <n-grid-item>
<NCard <NCard
:title="selectCount" class="dragcardStyle" :segmented="{ content: true, footer: true }" size="small" :title="selectCount"
class="dragcardStyle"
:segmented="{ content: true, footer: true }"
size="small"
:bordered="false" :bordered="false"
> >
<template #header-extra> <template #header-extra>
@ -259,15 +345,25 @@ function removeHandler(id: string) {
<SvgIcon size="14px" name="magnifying-1" /> <SvgIcon size="14px" name="magnifying-1" />
</template> </template>
</n-input> </n-input>
<VueDraggable v-model="onList" class="draggable-ul" :animation="150" group="shared"> <VueDraggable
v-model="onList"
class="draggable-ul"
:animation="150"
group="shared"
>
<div <div
v-for="item in onList" :key="item.id" :class="{ fix: item.fix }" v-for="item in onList"
:key="item.id"
:class="{ fix: item.fix }"
class="cursor-move draggable-item" class="cursor-move draggable-item"
> >
<span class="ml-2">{{ item.name }}</span> <span class="ml-2">{{ item.name }}</span>
<SvgIcon <SvgIcon
v-if="!item.fix" size="16px" style="display: block; margin-left: auto; cursor: pointer" v-if="!item.fix"
name="clear" @click="removeHandler(item.id)" size="16px"
style="display: block; margin-left: auto; cursor: pointer"
name="clear"
@click="removeHandler(item.id)"
/> />
</div> </div>
</VueDraggable> </VueDraggable>
@ -278,10 +374,8 @@ function removeHandler(id: string) {
</div> </div>
<template #footer> <template #footer>
<div class="wrapper-footer"> <div class="wrapper-footer">
<n-button type="info" @click="handleSumbit"> <n-button type="info" @click="handleSumbit"> </n-button>
确认 <n-button secondary style="margin-left: 15px" @click="closeModal">
</n-button>
<n-button secondary style="margin-left:15px" @click="closeModal">
取消 取消
</n-button> </n-button>
</div> </div>
@ -317,7 +411,7 @@ function removeHandler(id: string) {
&:before { &:before {
background-color: #1980ff; background-color: #1980ff;
content: ''; content: "";
width: 5px; width: 5px;
border-radius: 2px; border-radius: 2px;
top: 0; top: 0;
@ -373,7 +467,9 @@ function removeHandler(id: string) {
} }
} }
::v-deep(.n-card.n-card--content-segmented > .n-card__content:not(:first-child)) { ::v-deep(
.n-card.n-card--content-segmented > .n-card__content:not(:first-child)
) {
border: 0px; border: 0px;
} }

@ -33,7 +33,7 @@ onMounted(async () => {
fix: v.isrequired == 2, fix: v.isrequired == 2,
checked: checked:
v.isrequired == 2 || v.isrequired == 2 ||
Boolean(useList.userFieldFixed?.toLowerCase().indexOf(v.name)>-1) || Boolean(useList.userFieldUnFixed?.toLowerCase().indexOf(v.name)>-1), Boolean(useList.userFieldFixed?.indexOf(v.name)>-1) || Boolean(useList.userFieldUnFixed?.indexOf(v.name)>-1),
}; };
offList.value.push(item) offList.value.push(item)

@ -51,7 +51,7 @@ const taskpagination = reactive({
pageSize: 10, pageSize: 10,
}) })
const sortBy: PictureSortParam = { const sortBy: PictureSortParam = {
orderbyname: 'asc', orderbyname: 'desc',
orderbyvalue: 'pictureResult', orderbyvalue: 'pictureResult',
} }
const workStore = useWorkOrder() const workStore = useWorkOrder()

@ -3,7 +3,7 @@ import { getAllfieldList, getfieldList, savefield } from "@/api/home/filter";
import { workPackageMap } from "@/config/workorder"; import { workPackageMap } from "@/config/workorder";
import { useUser } from "@/store/modules/user"; import { useUser } from "@/store/modules/user";
import { difference } from "lodash-es"; import { difference } from "lodash-es";
import { computed, 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";
const props = defineProps({ const props = defineProps({
@ -14,6 +14,8 @@ const props = defineProps({
}, },
}); });
const emit = defineEmits(["onOk"]);
// //
const offList = ref<any[]>([]); const offList = ref<any[]>([]);
// //
@ -104,10 +106,11 @@ async function handleSumbit(e: MouseEvent) {
onList.value.map((v) => { onList.value.map((v) => {
userField += `${v.id},`; userField += `${v.id},`;
}); });
userField = userField.slice(0,userField.length-1); userField = userField.slice(0, userField.length - 1);
savefield(props.reviewType, userInfo.id, userField); savefield(props.reviewType, userInfo.id, userField);
e.preventDefault(); e.preventDefault();
closeModal(); closeModal();
emit("onOk");
} }
defineExpose({ defineExpose({
@ -239,18 +242,28 @@ onMounted(async () => {
fix: v.isrequired == 2, fix: v.isrequired == 2,
checked: checked:
v.isrequired == 2 || v.isrequired == 2 ||
Boolean(useList.userFieldFixed?.toLowerCase().indexOf(v.name)>-1) || Boolean(useList.userFieldUnFixed?.toLowerCase().indexOf(v.name)>-1), Boolean(useList.userFieldFixed?.indexOf(v.name) > -1) ||
Boolean(useList.userFieldUnFixed?.indexOf(v.name) > -1),
}; };
if (item.checked) {
onList.value.push(item);
} else {
offList.value.push(item);
}
if (item.fix) { if (item.fix) {
fixList.push(item); fixList.push(item);
} else {
offList.value.push(item);
} }
}); });
offList.value.unshift(...fixList); offList.value.unshift(...fixList);
useList.userFieldFixed?.split(",").map((v) => {
let item = allList.find((v2) => v2.name == v);
if (item) {
item = {
name: item.fieldDesc,
id: item.name,
fix: item.isrequired == 2,
checked: true,
};
onList.value.push(item);
}
});
}); });
</script> </script>

Loading…
Cancel
Save