fix: update

bak
elseif 1 year ago
parent 8979379156
commit d87761a1b5

@ -1,14 +1,5 @@
<script lang="ts" setup>
import { getAllfieldList, getfieldList } from '@/api/home/filter'
import { audit } from '@/api/task/task'
import { getTaskDetailInfo, getTaskDetailPictureList } from '@/api/work/work'
import { useTask } from '@/store/modules/task'
import { useUser } from '@/store/modules/user'
import { isEmpty } from '@/utils'
import { hideDownload } from '@/utils/image'
import emitter from '@/utils/mitt'
import _ from 'lodash'
import { clone } from 'lodash-es'
import { chunk, clone } from 'lodash-es'
import { useDialog, useMessage } from 'naive-ui'
import { computed, onUnmounted, reactive, ref, unref, watch } from 'vue'
import BatchModal from '../modal/BatchModal.vue'
@ -16,18 +7,18 @@ import ConfrimModal from '../modal/ConfrimModal.vue'
import CustomSettingModal from '../modal/CustomSettingModal.vue'
import PictureTable from './PictureTable.vue'
import TaskTable from './TaskTable.vue'
import { getAllfieldList } from '@/api/home/filter'
import { audit } from '@/api/task/task'
import { getTaskDetailInfo, getTaskDetailPictureList } from '@/api/work/work'
import { useTask } from '@/store/modules/task'
import { useUser } from '@/store/modules/user'
import { isEmpty } from '@/utils'
import { hideDownload } from '@/utils/image'
import emitter from '@/utils/mitt'
import { hideDownload } from '@/utils/image'
import { isEmpty } from '@/utils'
import { useUser } from '@/store/modules/user'
import { useTask } from '@/store/modules/task'
import { getTaskDetailInfo, getTaskDetailPictureList } from '@/api/work/work'
import { audit } from '@/api/task/task'
import { getAllfieldList, getfieldList } from '@/api/home/filter'
import type { ApprovalParam, PictureSortParam } from '/#/api'
import { formatToDateHMS } from '@/utils/dateUtil'
const batch = ref(false)
const selectItems = ref<any[]>([])
const message = useMessage()
@ -39,47 +30,54 @@ const CustomSettingModalRef = ref(null)
const taskTableData = ref<any[]>([])
const sortBy: PictureSortParam = {
orderbyname: "asc",
orderbyvalue: "fromuptime",
};
orderbyname: 'desc',
orderbyvalue: 'pictureResult',
}
function setBatch(value: boolean) {
if (totalCount.value === 0) return;
if (totalCount.value === 0)
return
batch.value = value
batch.value = value;
if (value === false) {
selectItems.value.forEach((item) => (item.checked = false));
selectItems.value.length = 0;
selectItems.value.forEach(item => (item.checked = false))
selectItems.value.length = 0
selectItems.value.length = 0
}
}
function onCheckChange(checked: any, item: any) {
const index = selectItems.value.indexOf(item);
item.checked = checked;
const index = selectItems.value.indexOf(item)
item.checked = checked
if (index === -1 && checked) selectItems.value.push(item);
else selectItems.value.splice(index, 1);
if (index === -1 && checked)
selectItems.value.push(item)
else selectItems.value.splice(index, 1)
console.log(selectItems.value.map(item => item.id))
}
const showActions = computed(() => {
return selectItems.value.length > 0 && batch;
});
return selectItems.value.length > 0 && batch
})
const taskpagination = reactive({
pageNo: 1,
pageSize: 10,
});
const taskStore = useTask();
const overTask = ref<any>(null);
const taskDetailInfo = ref<any>({});
const taskDetailPictureList = ref<any[]>([]);
const userStore = useUser();
const imageRef = ref<ComponentElRef | null>();
let processItems: any[] = [];
})
const taskStore = useTask()
const overTask = ref<any>(null)
const taskDetailInfo = ref<any>({})
const taskDetailPictureList = ref<any[]>([])
const userStore = useUser()
const imageRef = ref<ComponentElRef | null>()
let processItems: any[] = []
// states:1234
function validate(items: any[]) {
if (items.length === 0) return "至少选中一个任务";
if (items.length === 0)
return '至少选中一个任务'
// const useInfo = userStore.getUserInfo
// const username = useInfo.loginname
@ -96,115 +94,118 @@ function validate(items: any[]) {
// return ''
// }
return null;
return null
}
function approvalHandler(items?: any) {
let cloneItem: any;
let cloneItem: any
if (batch.value) {
processItems = selectItems.value;
} else if (overTask.value) {
cloneItem = clone(overTask.value);
processItems = [cloneItem];
processItems = selectItems.value
}
else if (overTask.value) {
cloneItem = clone(overTask.value)
processItems = [cloneItem]
}
if (items !== undefined && !(items instanceof PointerEvent))
processItems = items;
processItems = items
const msg = validate(processItems);
const msg = validate(processItems)
if (msg !== null) {
message.error(msg);
return;
message.error(msg)
return
}
dialog.info({
title: "确认提示",
content: "确认给该任务审批为【通过】吗?",
positiveText: "确定",
negativeText: "取消",
title: '确认提示',
content: '确认给该任务审批为【通过】吗?',
positiveText: '确定',
negativeText: '取消',
onPositiveClick: () => {
approval();
approval()
},
onNegativeClick: () => {},
});
})
}
function rejectHandler(items?: any) {
let cloneItem: any;
let cloneItem: any
if (batch.value) {
processItems = selectItems.value;
} else if (overTask.value) {
cloneItem = clone(overTask.value);
processItems = [cloneItem];
processItems = selectItems.value
}
else if (overTask.value) {
cloneItem = clone(overTask.value)
processItems = [cloneItem]
}
if (items !== undefined && !(items instanceof PointerEvent))
processItems = items;
processItems = items
const msg = validate(processItems);
const msg = validate(processItems)
if (msg !== null) {
message.error(msg);
return;
message.error(msg)
return
}
const modal = unref(confrimModalRef)! as any;
modal.showModal();
const modal = unref(confrimModalRef)! as any
modal.showModal()
}
function approval() {
const formIds: string[] = processItems.map((item) => item.id);
const taskIds: string[] = processItems.map((item) => item.taskId);
const tasknames: string[] = processItems.map((item) => item.taskname);
const formIds: string[] = processItems.map(item => item.id)
const taskIds: string[] = processItems.map(item => item.taskId)
const tasknames: string[] = processItems.map(item => item.taskname)
const param: ApprovalParam = {
formid: formIds,
taskId: taskIds,
approvd: true,
taskComment: "approval",
taskComment: 'approval',
taskname: tasknames,
};
}
doAudit(param);
doAudit(param)
}
function doAudit(param: any) {
audit(param).then((res) => {
const { code } = res;
processItems.length = 0;
if (code === "OK") emitter.emit("refresh");
else message.error(res.message);
});
const { code } = res
setBatch(false)
if (code === 'OK')
emitter.emit('refresh')
else message.error(res.message)
})
}
function reject(idOrDesc: string, backId: string, isOther: boolean) {
const formIds: string[] = processItems.map((item) => item.id);
const taskIds: string[] = processItems.map((item) => item.taskId);
const tasknames: string[] = processItems.map((item) => item.taskname);
const formIds: string[] = processItems.map(item => item.id)
const taskIds: string[] = processItems.map(item => item.taskId)
const tasknames: string[] = processItems.map(item => item.taskname)
const param: ApprovalParam = {
formid: formIds,
taskId: taskIds,
approvd: false,
taskComment: idOrDesc,
taskname: isOther ? tasknames : ["其他"],
};
taskname: isOther ? tasknames : ['其他'],
}
doAudit(param);
doAudit(param)
}
function showModal(modalRef: any) {
const modal = unref(modalRef)! as any;
modal.showModal();
const modal = unref(modalRef)! as any
modal.showModal()
}
function forwardHandler() {
taskStore.forward();
taskStore.forward()
}
function backHandler() {
taskStore.back();
taskStore.back()
}
watch(
@ -213,27 +214,28 @@ watch(
const packageid = taskStore.getPackageid
const taskId = taskStore.getActiveId
if (isEmpty(taskId)) return;
const useInfo = userStore.getUserInfo;
let listData = [];
taskDetailInfo.value = await getTaskDetailInfo(taskId, packageid);
const reviewType = 3; //
let res = await getAllfieldList(reviewType);
let fieldList = (res as any)?.data;
res = await getfieldList(reviewType, useInfo.id);
let userFieldList = (res as any)?.data.userFieldFixed;
console.log(userFieldList,'userFieldList')
if (isEmpty(taskId))
return
const useInfo = userStore.getUserInfo
const listData = []
taskDetailInfo.value = await getTaskDetailInfo(taskId, packageid)
const reviewType = 3 //
let res = await getAllfieldList(reviewType)
const fieldList = (res as any)?.data
res = await getfieldList(reviewType, useInfo.id)
const userFieldList = (res as any)?.data.userFieldFixed
console.log(userFieldList, 'userFieldList')
fieldList.map((v) => {
if (userFieldList.indexOf(v.name) > -1) {
let item = {
if (userFieldList.includes(v.name)) {
const item = {
label: v.fieldDesc,
value: taskDetailInfo.value.ocrPicture[v.name],
key: v.name,
};
listData.push(item);
}
listData.push(item)
}
});
})
// TODO mock
// let showFieldData = taskDetailInfo.value.ocrPicture;
// let showFieldKeys = Object.keys(showFieldData);
@ -254,7 +256,7 @@ watch(
// }
// }
// }
taskTableData.value = _.chunk(listData, 2);
taskTableData.value = chunk(listData, 2)
if (!isEmpty(packageid)) {
const { data, total } = await getTaskDetailPictureList(
packageid,
@ -264,56 +266,57 @@ watch(
taskDetailPictureList.value = data
totalCount.value = total
}
}
);
},
)
const currentTaskId = computed(() => {
const index = taskStore.getCurrentIndex;
return taskStore.getApprovalList[index]?.formid || "";
});
const index = taskStore.getCurrentIndex
return taskStore.getApprovalList[index]?.formid || ''
})
function overTaskHandle() {
const item = taskDetailInfo.value;
const item = taskDetailInfo.value
if (validate([item]) == null && batch.value === false) overTask.value = item;
if (validate([item]) == null && batch.value === false)
overTask.value = item
}
function leaveTaskHandler() {
overTask.value = null;
overTask.value = null
}
function showActionsModal() {
const modal = unref(CustomSettingModalRef)! as any;
modal.showModal();
const modal = unref(CustomSettingModalRef)! as any
modal.showModal()
}
onUnmounted(() => {
taskStore.reset();
});
taskStore.reset()
})
const mark = computed(() => {
return taskDetailInfo.value.iztrueorfalse === null ? "未标记" : "已标记";
});
return taskDetailInfo.value.iztrueorfalse === null ? '未标记' : '已标记'
})
function immersionHandler() {
taskStore.updateImmersion();
taskStore.updateImmersion()
}
function previewHandler(event: MouseEvent) {
event.stopImmediatePropagation();
event.stopPropagation();
event.stopImmediatePropagation()
event.stopPropagation()
if (imageRef.value && (imageRef.value as any).src)
(imageRef.value as any).mergedOnClick()
}
function getPercent(pictureid: string) {
const { ocpictureid, pictureresult } = taskDetailInfo.value;
const index = ocpictureid.split(",").indexOf(String(pictureid));
const results = pictureresult.split(",");
const percent = results[index] || "0";
const val = Number.parseFloat(percent);
return `${val}%`;
const { ocpictureid, pictureresult } = taskDetailInfo.value
const index = ocpictureid.split(',').indexOf(String(pictureid))
const results = pictureresult.split(',')
const percent = results[index] || '0'
const val = Number.parseFloat(percent)
return `${val}%`
}
</script>
@ -501,7 +504,9 @@ function getPercent(pictureid: string) {
<div class="info-header">
<div class="left_box">
<div class="title">填报信息</div>
<div class="title">
填报信息
</div>
<SvgIcon size="12" name="collapse" />
</div>
<div class="right_box" @click="showActionsModal">
@ -511,7 +516,7 @@ function getPercent(pictureid: string) {
</div>
<n-tabs type="line" animated>
<n-tab-pane name="task-info" tab="任务信息">
<TaskTable :data="taskDetailInfo" :taskTableData="taskTableData" />
<TaskTable :data="taskDetailInfo" :task-table-data="taskTableData" />
</n-tab-pane>
<n-tab-pane name="picture-info" tab="图片信息">
<PictureTable :data="taskDetailInfo" />

@ -248,7 +248,7 @@ const layout = debounce(() => {
_imagesload.on('done', (instance) => {
if (!el.value)
return
loading.value = false
loading.value = false
})
_imagesload.on('fail', (instance) => {

Loading…
Cancel
Save