|
|
|
@ -5,10 +5,10 @@ import { getTaskDetailInfo, getTaskDetailPictureList } from '@/api/work/work'
|
|
|
|
|
import { useTask } from '@/store/modules/task'
|
|
|
|
|
import { useUser } from '@/store/modules/user'
|
|
|
|
|
import { isEmpty } from '@/utils'
|
|
|
|
|
import { formatToDateHMS } from '@/utils/dateUtil'
|
|
|
|
|
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,17 +16,7 @@ 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 type { ApprovalParam, PictureSortParam } from '/#/api'
|
|
|
|
|
import { formatToDateHMS } from '@/utils/dateUtil'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const batch = ref(false)
|
|
|
|
|
const selectItems = ref<any[]>([])
|
|
|
|
@ -39,47 +29,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:1未提交,2待审批,3通过,4不通过
|
|
|
|
|
function validate(items: any[]) {
|
|
|
|
|
if (items.length === 0) return "至少选中一个任务";
|
|
|
|
|
if (items.length === 0)
|
|
|
|
|
return '至少选中一个任务'
|
|
|
|
|
|
|
|
|
|
// const useInfo = userStore.getUserInfo
|
|
|
|
|
// const username = useInfo.loginname
|
|
|
|
@ -96,144 +93,152 @@ 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(
|
|
|
|
|
() => [taskStore.activeId],
|
|
|
|
|
async (newValue, oldValue) => {
|
|
|
|
|
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;
|
|
|
|
|
async function getTableData() {
|
|
|
|
|
const useInfo = userStore.getUserInfo
|
|
|
|
|
const listData = []
|
|
|
|
|
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)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
taskTableData.value = chunk(listData, 2)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
watch(
|
|
|
|
|
() => [taskStore.activeId],
|
|
|
|
|
async (newValue, oldValue) => {
|
|
|
|
|
const packageid = taskStore.getPackageid
|
|
|
|
|
const taskId = taskStore.getActiveId
|
|
|
|
|
|
|
|
|
|
if (isEmpty(taskId))
|
|
|
|
|
return
|
|
|
|
|
taskDetailInfo.value = await getTaskDetailInfo(taskId, packageid)
|
|
|
|
|
getTableData()
|
|
|
|
|
// TODO mock备份 确认逻辑无误后删除
|
|
|
|
|
// let showFieldData = taskDetailInfo.value.ocrPicture;
|
|
|
|
|
// let showFieldKeys = Object.keys(showFieldData);
|
|
|
|
@ -254,7 +259,6 @@ watch(
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
taskTableData.value = _.chunk(listData, 2);
|
|
|
|
|
if (!isEmpty(packageid)) {
|
|
|
|
|
const { data, total } = await getTaskDetailPictureList(
|
|
|
|
|
packageid,
|
|
|
|
@ -264,56 +268,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 +506,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 +518,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" />
|
|
|
|
@ -524,7 +531,7 @@ function getPercent(pictureid: string) {
|
|
|
|
|
@reject="rejectHandler"
|
|
|
|
|
@approval="approvalHandler"
|
|
|
|
|
/>
|
|
|
|
|
<CustomSettingModal ref="CustomSettingModalRef" :review-type="3" />
|
|
|
|
|
<CustomSettingModal ref="CustomSettingModalRef" :review-type="3" @on-ok="getTableData" />
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|