123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152 |
- <template>
- <div class="home-container">
- <dv-border-box1 ref="borderRef" style="width: 100%; height: 100%; margin: 0 auto">
- <div class="table-box">
- <ProTable ref="proTable" :columns="columns" row-key="id" :request-api="listITaskNewApi" :tool-button="false">
- <template #tableHeader="scope">
- <!-- <el-button type="primary" v-auth="['system:user:add']" :icon="CirclePlus" @click="createTask()"> 创建任务 </el-button>-->
- <el-button type="primary" v-auth="['system:user:add']" :icon="CirclePlus" @click="createTaskNew()"> 创建任务 </el-button>
- <el-button type="danger" icon="Delete" plain :disabled="!scope.isSelected" @click="batchDelete(scope.selectedListIds)">
- 批量删除
- </el-button>
- </template>
- <!-- 表格操作 -->
- <template #operation="scope">
- <el-button type="primary" link icon="View" v-auth="['task:task:query']" @click="viewDetails(scope.row)"> 查看详情 </el-button>
- <!-- <el-button type="primary" link :icon="View" @click="openDialog(3, '任务查看', scope.row)">查看</el-button>-->
- </template>
- </ProTable>
- <!-- <ProTable
- ref="proTable"
- row-key="id"
- :columns="columns"
- :request-api="listTaskApi"
- :request-auto="false"
- :tool-button="false"
- >
- <template #tableHeader="">
- <el-button type="primary" v-auth="['system:user:add']" :icon="CirclePlus" @click="createTask()"> 创建任务 </el-button>
- </template>
- <template #operation="scope">
- <el-button type="primary" link :icon="View" @click="openDialog(3, '任务查看', scope.row)">查看</el-button>
- </template>
- </ProTable> -->
- </div>
- </dv-border-box1>
- </div>
- </template>
- <script setup lang="tsx" name="homePage">
- import { onMounted, reactive, ref } from 'vue'
- import { User } from '@/api/interface'
- import ProTable from '@/components/ProTable/index.vue'
- import FormDialog from '@/components/DialogOld/form.vue'
- import { CirclePlus, View } from '@element-plus/icons-vue'
- import { useRouter } from 'vue-router'
- import { ColumnProps, ProTableInstance } from '@/components/ProTable/interface'
- import { addUserApi, updateUserApi, deptTreeSelectApi } from '@/api/modules/system/user'
- // import { getTaskApi } from '@/api/modules/taais/task'
- // import { listTaskApi, getTaskApi } from '@/api/modules/task/task'
- import { listITaskNewApi, getITaskNewApi, delTaskApi } from '@/api/modules/task/task'
- import { getDictsApi } from '@/api/modules/system/dictData'
- import { useHandleData } from '@/hooks/useHandleData'
- // import taskDataList from '@/assets/mock/taskData.json'
- // import { getDictsApi } from '@/api/modules/system/dictData'
- onMounted(() => {
- getTreeFilter()
- })
- // ProTable 实例
- const proTable = ref<ProTableInstance>()
- // 如果表格需要初始化请求参数,直接定义传给 ProTable(之后每次请求都会自动带上该参数,此参数更改之后也会一直带上,改变此参数会自动刷新表格数据)
- const initParam = reactive({ deptId: '' })
- // 获取 treeFilter 数据
- // 当 proTable 的 requestAuto 属性为 false,不会自动请求表格数据,等待 treeFilter 数据回来之后,更改 initParam.departmentId 的值,才会触发请求 proTable 数据
- const treeFilterData = ref<any>([])
- const getTreeFilter = async () => {
- const { data } = await deptTreeSelectApi()
- treeFilterData.value = data
- initParam.deptId = treeFilterData.value[0].id
- }
- // 批量删除多物体融合轨迹识别信息
- const batchDelete = async (ids: string[]) => {
- await useHandleData(delTaskApi, ids, '删除所选任务')
- proTable.value?.clearSelection()
- proTable.value?.getTableList()
- }
- // 查看详情
- const viewDetails = row => {
- console.log(row)
- router.push({ path: `/task/subtask/`, query: { id: row.id } })
- }
- // 批量添加用户
- const formDialogRef = ref<InstanceType<typeof FormDialog> | null>(null)
- // 打开弹框的功能
- const openDialog = async (type: number, title: string, row?: any) => {
- console.log(row)
- let res = getITaskNewApi(row?.id || null)
- // 表单项配置
- const fieldList: Form.FieldItem[] = [
- {
- label: '任务名称',
- placeholder: '请输入任务名称',
- span: 12,
- field: 'taskName',
- rules: [{ required: true, message: '任务名称不能为空' }]
- }
- ]
- const params = {
- title,
- width: 680,
- isEdit: type !== 3,
- fieldList: fieldList,
- model: res,
- api: type == 1 ? addUserApi : updateUserApi,
- getTableList: proTable.value?.getTableList
- }
- formDialogRef.value?.openDialog(params)
- }
- const router = useRouter()
- // // 增加任务
- // const createTask = () => {
- // router.push(`/createTask`)
- // }
- const createTaskNew = () => {
- router.push(`/createTaskNew`)
- }
- // 表格配置项
- const columns = reactive<ColumnProps<User.ResUserList>[]>([
- { type: 'selection', width: 70 },
- { prop: 'name', label: '任务名称' },
- // {
- // prop: 'status',
- // label: '任务状态',
- // tag: true,
- // enum: () => getDictsApi('biz_task_status'),
- // fieldNames: { label: 'dictLabel', value: 'dictValue' }
- // },
- {
- prop: 'createTime',
- label: '创建时间'
- // search: {
- // el: 'input'
- // }
- },
- {
- prop: 'updateTime',
- label: '更新时间'
- // search: {
- // el: 'input'
- // }
- },
- { prop: 'operation', label: '操作', width: 230 }
- ])
- </script>
- <style scoped lang="scss">
- @import './index.scss';
- </style>
|