|
|
@ -1,232 +1,18 @@
|
|
|
|
<script lang="ts" setup>
|
|
|
|
<script lang="ts" setup>
|
|
|
|
import { computed, onUnmounted, reactive, ref, unref, watch } from 'vue'
|
|
|
|
import { onUnmounted, reactive, ref } from 'vue'
|
|
|
|
import { useDialog, useMessage } from 'naive-ui'
|
|
|
|
import { useMessage } from 'naive-ui'
|
|
|
|
import { clone, pickBy } from 'lodash-es'
|
|
|
|
import type { SetTFParam } from '/#/api'
|
|
|
|
import ConfrimModal from '../modal/ConfrimModal.vue'
|
|
|
|
|
|
|
|
import type { PictureSortParam, SetTFParam } from '/#/api'
|
|
|
|
|
|
|
|
import { useWorkOrder } from '@/store/modules/workOrder'
|
|
|
|
import { useWorkOrder } from '@/store/modules/workOrder'
|
|
|
|
import { clearTF, getPackageTaskList, getTaskDetailInfo, getTaskDetailPictureList, setTF } from '@/api/work/work'
|
|
|
|
import { clearTF } from '@/api/work/work'
|
|
|
|
import { fieldMap } from '@/config/workorder'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const batch = ref(false)
|
|
|
|
|
|
|
|
const selectItems = ref<any[]>([])
|
|
|
|
|
|
|
|
const message = useMessage()
|
|
|
|
const message = useMessage()
|
|
|
|
const dialog = useDialog()
|
|
|
|
|
|
|
|
const totalCount = ref(0)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function setBatch(value: boolean) {
|
|
|
|
|
|
|
|
batch.value = value
|
|
|
|
|
|
|
|
if (value === false) {
|
|
|
|
|
|
|
|
selectItems.value.forEach(item => item.checked = false)
|
|
|
|
|
|
|
|
selectItems.value.length = 0
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function onCheckChange(checked: any, item: any) {
|
|
|
|
|
|
|
|
const index = selectItems.value.indexOf(item)
|
|
|
|
|
|
|
|
item.checked = checked
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (index === -1 && checked)
|
|
|
|
|
|
|
|
selectItems.value.push(item)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
selectItems.value.splice(index, 1)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const showActions = computed(() => {
|
|
|
|
|
|
|
|
return selectItems.value.length > 0 && batch
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const packagepagination = reactive({
|
|
|
|
|
|
|
|
pageNo: 1,
|
|
|
|
|
|
|
|
pageSize: 10,
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
const taskpagination = reactive({
|
|
|
|
|
|
|
|
pageNo: 1,
|
|
|
|
|
|
|
|
pageSize: 10,
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
const sortBy: PictureSortParam = {
|
|
|
|
|
|
|
|
orderbyname: 'desc',
|
|
|
|
|
|
|
|
orderbyvalue: 'fromuptime',
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
const workStore = useWorkOrder()
|
|
|
|
const workStore = useWorkOrder()
|
|
|
|
const selectTask = ref<any>(null)
|
|
|
|
const selectTask = ref<any>(null)
|
|
|
|
const overTask = ref<any>(null)
|
|
|
|
|
|
|
|
const taskList = ref<any[]>([])
|
|
|
|
|
|
|
|
const taskDetailInfo = ref<any>({})
|
|
|
|
|
|
|
|
const taskDetailPictureList = ref<any[]>([])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const confrimModalRef = ref(null)
|
|
|
|
|
|
|
|
let processItems: any[] = []
|
|
|
|
|
|
|
|
const tab = ref(0)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function validate(items: any[]) {
|
|
|
|
|
|
|
|
if (items.length === 0)
|
|
|
|
|
|
|
|
return '至少选中一个任务'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (const item of items) {
|
|
|
|
|
|
|
|
const { iztrueorfalse, history, states } = item
|
|
|
|
|
|
|
|
if (iztrueorfalse !== null)
|
|
|
|
|
|
|
|
return '存在已经辨识过的任务'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
else if (history)
|
|
|
|
|
|
|
|
return '包含历史数据'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
else if (states !== 1 && states !== 2)
|
|
|
|
|
|
|
|
return '审批状态不合法'
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return null
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function falseHandler() {
|
|
|
|
|
|
|
|
let cloneItem: any
|
|
|
|
|
|
|
|
if (batch.value) { processItems = selectItems.value }
|
|
|
|
|
|
|
|
else if (overTask.value) {
|
|
|
|
|
|
|
|
cloneItem = clone(overTask.value)
|
|
|
|
|
|
|
|
processItems = [cloneItem]
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
const msg = validate(processItems)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (msg !== null) {
|
|
|
|
|
|
|
|
message.error(msg)
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const modal = unref(confrimModalRef)! as any
|
|
|
|
|
|
|
|
modal.showModal()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function trueHandler() {
|
|
|
|
|
|
|
|
let cloneItem: any
|
|
|
|
|
|
|
|
if (batch.value) { processItems = selectItems.value }
|
|
|
|
|
|
|
|
else if (overTask.value) {
|
|
|
|
|
|
|
|
cloneItem = clone(overTask.value)
|
|
|
|
|
|
|
|
processItems = [cloneItem]
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const msg = validate(processItems)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (msg !== null) {
|
|
|
|
|
|
|
|
message.error(msg)
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dialog.info({
|
|
|
|
|
|
|
|
title: '确认提示',
|
|
|
|
|
|
|
|
content: '确认给该任务图判真吗?',
|
|
|
|
|
|
|
|
positiveText: '确定',
|
|
|
|
|
|
|
|
negativeText: '取消',
|
|
|
|
|
|
|
|
onPositiveClick: () => {
|
|
|
|
|
|
|
|
setTrue()
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
onNegativeClick: () => { },
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function setTrue() {
|
|
|
|
|
|
|
|
const ids: any[] = processItems.map(item => item.id)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const param: SetTFParam = {
|
|
|
|
|
|
|
|
taskchildpictureids: ids.join(','),
|
|
|
|
|
|
|
|
iztrueorfalse: 1,
|
|
|
|
|
|
|
|
packageid: workStore.getActiveId,
|
|
|
|
|
|
|
|
judgeid: '0',
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
doSetTF(param)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function setFalse(id: string, desc: null | string) {
|
|
|
|
|
|
|
|
const ids: any[] = processItems.map(item => item.id)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const param: SetTFParam = {
|
|
|
|
const taskDetailInfo = ref<any>({})
|
|
|
|
taskchildpictureids: ids.join(','),
|
|
|
|
|
|
|
|
iztrueorfalse: 0,
|
|
|
|
|
|
|
|
packageid: workStore.getActiveId,
|
|
|
|
|
|
|
|
judgeid: id,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (desc)
|
|
|
|
|
|
|
|
param.judgedesc = desc
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
doSetTF(param)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function doSetTF(param: SetTFParam) {
|
|
|
|
|
|
|
|
setTF(param).then((res) => {
|
|
|
|
|
|
|
|
const { code } = res
|
|
|
|
|
|
|
|
processItems.length = 0
|
|
|
|
|
|
|
|
if (code === 'OK')
|
|
|
|
|
|
|
|
updateList(param)
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
message.error(res.message)
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function updateList(param: SetTFParam) {
|
|
|
|
|
|
|
|
const list = taskDetailPictureList.value
|
|
|
|
|
|
|
|
const ids = param.taskchildpictureids.split(',')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (const item of list) {
|
|
|
|
|
|
|
|
if (ids.includes(item.id))
|
|
|
|
|
|
|
|
item.iztrueorfalse = param.iztrueorfalse
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function forwardHandler() {
|
|
|
|
|
|
|
|
workStore.forward()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function backHandler() {
|
|
|
|
|
|
|
|
workStore.back()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
watch(() => workStore.activeId, async (newValue, oldValue) => {
|
|
|
|
|
|
|
|
const res = await getPackageTaskList(newValue, packagepagination)
|
|
|
|
|
|
|
|
const { data } = res
|
|
|
|
|
|
|
|
taskList.value = data
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (taskList.value.length > 0)
|
|
|
|
|
|
|
|
handleSelect(taskList.value[0])
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const packageName = computed(() => {
|
|
|
|
|
|
|
|
const index = workStore.getCurrentIndex
|
|
|
|
|
|
|
|
return workStore.getOrderList[index]?.packagename || ''
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function handleSelect(item: any) {
|
|
|
|
|
|
|
|
selectTask.value = item
|
|
|
|
|
|
|
|
const taskId = item.id
|
|
|
|
|
|
|
|
taskDetailInfo.value = await getTaskDetailInfo(taskId, workStore.activeId)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const { data, total } = await getTaskDetailPictureList(workStore.activeId, taskId, { ...taskpagination, ...sortBy })
|
|
|
|
|
|
|
|
taskDetailPictureList.value = data
|
|
|
|
|
|
|
|
totalCount.value = total
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function sortHandler(orderby: 'pictureResult' | 'fromuptime') {
|
|
|
|
|
|
|
|
if (!selectTask.value)
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
taskpagination.pageNo = 1
|
|
|
|
|
|
|
|
taskpagination.pageSize = 10
|
|
|
|
|
|
|
|
sortBy.orderbyvalue = orderby
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const res = await getTaskDetailPictureList(workStore.activeId, selectTask.value.id, { ...taskpagination, ...sortBy })
|
|
|
|
|
|
|
|
taskDetailPictureList.value = res.data
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const propertys = computed(() => {
|
|
|
|
|
|
|
|
const { ocrPicture } = taskDetailInfo.value
|
|
|
|
|
|
|
|
const v = pickBy(ocrPicture, (value, key: string) => {
|
|
|
|
|
|
|
|
return key.startsWith('field') && value !== null
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
return v
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function clearMark() {
|
|
|
|
async function getDetail() {
|
|
|
|
const res = await clearTF(workStore.activeId, selectTask.value.id)
|
|
|
|
const res = await clearTF(workStore.activeId, selectTask.value.id)
|
|
|
|
if (res.code === 'OK') {
|
|
|
|
if (res.code === 'OK') {
|
|
|
|
taskDetailInfo.value.iztrueorfalse = null
|
|
|
|
taskDetailInfo.value.iztrueorfalse = null
|
|
|
@ -234,36 +20,6 @@ async function clearMark() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else { message.error(res.message) }
|
|
|
|
else { message.error(res.message) }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function overTaskHandelr(item: any) {
|
|
|
|
|
|
|
|
if (validate([item]) == null && batch.value === false)
|
|
|
|
|
|
|
|
overTask.value = item
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function leaveTaskHandler() {
|
|
|
|
|
|
|
|
overTask.value = null
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
onUnmounted(() => {
|
|
|
|
|
|
|
|
workStore.reset()
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 mark = computed(() => {
|
|
|
|
|
|
|
|
return taskDetailInfo.value.iztrueorfalse === null ? '未标记' : '已标记'
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function switchTab(type: number) {
|
|
|
|
|
|
|
|
tab.value = type
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
</script>
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<template>
|
|
|
@ -274,13 +30,13 @@ function switchTab(type: number) {
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="right-card">
|
|
|
|
<div class="right-card">
|
|
|
|
<img class="icon-set" src="@/assets/images/login/logo.png" alt="">
|
|
|
|
<img class="icon-set" src="@/assets/images/message/set.png" alt="">
|
|
|
|
<div class="title">
|
|
|
|
<div class="title">
|
|
|
|
系统消息
|
|
|
|
系统消息
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="form">
|
|
|
|
<div class="form">
|
|
|
|
<div class="form-item flex">
|
|
|
|
<div class="form-item flex">
|
|
|
|
<img class="icon" src="@/assets/images/login/logo.png" alt="">
|
|
|
|
<img class="icon" src="@/assets/images/message/user.png" alt="">
|
|
|
|
<div class="label">
|
|
|
|
<div class="label">
|
|
|
|
创建人:
|
|
|
|
创建人:
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
@ -289,7 +45,7 @@ function switchTab(type: number) {
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="form-item flex">
|
|
|
|
<div class="form-item flex">
|
|
|
|
<img class="icon" src="@/assets/images/login/logo.png" alt="">
|
|
|
|
<img class="icon" src="@/assets/images/message/time.png" alt="">
|
|
|
|
<div class="label">
|
|
|
|
<div class="label">
|
|
|
|
发布时间:
|
|
|
|
发布时间:
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
@ -298,7 +54,7 @@ function switchTab(type: number) {
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="form-item flex margin-no">
|
|
|
|
<div class="form-item flex margin-no">
|
|
|
|
<img class="icon" src="@/assets/images/login/logo.png" alt="">
|
|
|
|
<img class="icon" src="@/assets/images/message/time.png" alt="">
|
|
|
|
<div class="label">
|
|
|
|
<div class="label">
|
|
|
|
消息类型:
|
|
|
|
消息类型:
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|