bak
Dragon 2 years ago
parent 1a3466072e
commit cd57b90103

@ -2,6 +2,7 @@
import type { DataTableColumns, DataTableRowKey, PaginationProps } from 'naive-ui'
import { NDataTable, useDialog, useMessage } from 'naive-ui'
import { computed, h, nextTick, onMounted, onUnmounted, reactive, ref, unref, watch } from 'vue'
import { rowPropKeys } from 'naive-ui/es/legacy-grid/src/Row'
import { Action, CustomTabelModal, ImportExcelModal, RepeatModal, RepeatTaskTableModal } from '../comp'
import { getFinalList } from '@/api/final'
import { audit } from '@/api/task/task'
@ -16,6 +17,7 @@ import { isBoolean } from '@/utils/is'
import ConfrimModal from '@/views/task/modal/ConfrimModal.vue'
import type { ApprovalParam } from '/#/api'
import emitter from '@/utils/mitt'
import { formatToDateHMS } from '@/utils/dateUtil'
const columns: DataTableColumns<RowData> = [
{
@ -27,17 +29,20 @@ const columns: DataTableColumns<RowData> = [
title: '任务Id',
key: 'id',
fixed: 'left',
width: 100,
width: 190,
},
{
title: '任务名称',
key: 'fromtaskname',
fixed: 'left',
width: 150,
width: 200,
ellipsis: {
tooltip: true,
},
},
{
title: '审批节点',
key: 'approvalnode',
key: 'taskname',
width: 100,
},
{
@ -53,10 +58,13 @@ const columns: DataTableColumns<RowData> = [
if (order === 'descend')
return h(SvgIcon, { name: 'sort-3' })
},
render(row: any) {
return row.states
},
},
{
title: '图片相似度',
key: 'similarity',
key: 'similarityscore',
width: 150,
sorter: 'default',
renderSorterIcon: ({ order }) => {
@ -67,10 +75,13 @@ const columns: DataTableColumns<RowData> = [
if (order === 'descend')
return h(SvgIcon, { name: 'sort-3' })
},
render(row: any) {
return row.similarityscore ? `${row.similarityscore}%` : ''
},
},
{
title: '提报时间',
key: 'fromuptime',
key: 'createdate',
width: 200,
sorter: 'default',
renderSorterIcon: ({ order }) => {
@ -81,11 +92,17 @@ const columns: DataTableColumns<RowData> = [
if (order === 'descend')
return h(SvgIcon, { name: 'sort-3' })
},
render(row: any) {
return formatToDateHMS(row.createdate || 0)
},
},
{
title: '更新时间',
key: 'updatetime',
width: 200,
render(row: any) {
return row.updatetime ? formatToDateHMS(row.updatetime) : ''
},
},
{
title: '操作',
@ -98,7 +115,9 @@ const columns: DataTableColumns<RowData> = [
{
id: row.id,
status: row.states,
trigger: actionHandler,
trigger: (action) => {
actionHandler(action, row)
},
},
)
},
@ -252,7 +271,7 @@ function commitHandler(columns) {
columnsRef.value = columns
}
function actionHandler(action: any) {
function actionHandler(action: any, row: any) {
const { key } = action
switch (key) {
case 'view':
@ -261,10 +280,10 @@ function actionHandler(action: any) {
resetHandler()
break
case 'approval':
approvalHandler()
approvalHandler(row)
break
case 'reject':
rejectHandler()
rejectHandler(row)
break
default:
break
@ -312,8 +331,9 @@ function getSelectItems() {
return tableData.value.filter(item => selectionIds.value.includes(item.id))
}
function approvalHandler() {
const items = getSelectItems()
function approvalHandler(row) {
// const items = getSelectItems()
const items = [row]
const msg = validate(items)
if (msg !== null) {
@ -349,8 +369,9 @@ function approval(items) {
doAudit(param)
}
function rejectHandler() {
const items = getSelectItems()
function rejectHandler(row) {
// const items = getSelectItems()
const items = [row]
const msg = validate(items)
if (msg !== null) {

@ -0,0 +1,62 @@
<script>
export default {
methods: {
handleDragStart(event) {
event.dataTransfer.setData('text/plain', event.target.innerText)
},
handleDragEnd(event) {
//
},
handleDragOver(event) {
event.dataTransfer.dropEffect = 'move'
},
handleDrop(event) {
const text = event.dataTransfer.getData('text/plain')
event.target.appendChild(document.getElementById(text))
},
},
}
</script>
<template>
<div>
<div
class="draggable-item"
draggable="true"
@dragstart="handleDragStart"
@dragend="handleDragEnd"
>
拖拽我到购物车
</div>
<div
class="shopping-cart"
@dragover.prevent="handleDragOver"
@drop="handleDrop"
>
购物车
</div>
</div>
</template>
<style>
.draggable-item {
width: 200px;
height: 50px;
background-color: #f0f0f0;
border: 1px solid #ccc;
text-align: center;
line-height: 50px;
margin-bottom: 10px;
cursor: move;
}
.shopping-cart {
width: 200px;
height: 100px;
background-color: #ffcc00;
border: 1px solid #ccc;
text-align: center;
line-height: 100px;
margin-top: 10px;
}
</style>
Loading…
Cancel
Save