123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332 |
- <template>
- <div style="display: flex;align-items: center;margin-bottom: 10px;">
- <n-input v-model:value="queryData.T_name" type="text" placeholder="请输入报告名称" style="width: 30%;" clearable />
- <n-button type="primary" @click="searchFun" style="margin-left: 10px;">搜索</n-button>
- </div>
- <n-data-table
- remote
- :columns="columns"
- :data="data"
- :pagination="pagination"
-
- class=" flex flex-col justify-between"
- />
- </template>
- <script setup>
- import { h } from 'vue';
- import { NButton, NSpace, NCard, NTag, NIcon, NPopover } from 'naive-ui';
- import { getTaskList } from '@/api';
- import { ArrowRightOutlined as ArrowRightIcon } from '@vicons/antd';
- const router = useRouter();
- // 查询参数
- const queryData = reactive({
- T_uuid: '',
- T_name: '',
- page: 1,
- page_z: 8,
- });
- // 任务列表
- const data = ref([]);
- const renderPopover = (trigger, content) => {
- return h(
- NPopover,
- { trigger: 'hover' },
- {
- trigger: () => trigger,
- default: () => h(NSpace, null, { default: () => content }),
- }
- );
- };
- // 需要展示的列
- const columns = [
- {
- title: '公司名称',
- key: 'T_user_name',
- width: 180,
- },
- {
- title: '报告名称',
- key: 'T_name',
- width: 180,
- },
- {
- title: '截止时间',
- key: 'T_deadline',
- width: 180,
- },
- {
- title() {
- return renderPopover(
- '流程(?)',
- [0, 1, 2, 3, 4].map((item) =>
- h(
- NTag,
- {
- bordered: false,
- type:
- item === 0
- ? 'error'
- : item === 1
- ? 'info'//已完成
- : item === 2
- ? 'warning'
- : item === 4
- ? 'success'
- : 'default',
- },
- {
- default: () => {
- if (item === 0) {
- return '未完成';
- } else if (item === 1) {
- return '数据来源已完成';
- } else if (item === 2) {
- return '处理中';
- } else if (item === 4) {
- return '数据编辑已完成';
- } else {
- return '已采集-无数据';
- }
- },
- }
- )
- )
- );
- },
- key: 'T_task_id',
- width: 460,
- render(row) {
- return h(
- NSpace,
- {
- align: 'center',
- },
- {
- default: () => [
- h(
- NCard,
- {
- style: {
- width: '70px',
- height: '50px',
- },
- contentStyle: {
- textAlign: 'center',
- padding: 0,
- },
- },
- {
- default: () => row.T_scheme_name,
- cover: () =>
- h(
- NTag,
- {
- class: 'w-full',
- type: row.T_scheme_state === 0 ? 'error' : 'success',
- bordered: false,
- },
- {
- default: () => '实施方案',
- }
- ),
- }
- ),
- h(
- NIcon,
- { size: 25, component: ArrowRightIcon, color: '#0e7a0d' },
- {}
- ),
- h(
- NCard,
- {
- contentStyle: {
- textAlign: 'center',
- padding: 0,
- },
- },
- {
- default: () => row.T_collection_name,
- cover: () =>
- h(
- NTag,
- {
- class: 'w-full',
- type:
- row.T_collection_state === 0
- ? 'error'
- : row.T_collection_state === 1
- ? 'info'
- : row.T_collection_state === 2
- ? 'warning'
- : row.T_collection_state === 4
- ? 'success'
- : 'default',
- bordered: false,
- },
- {
- default: () => '数据采集',
- }
- ),
- }
- ),
- h(
- NIcon,
- { size: 25, component: ArrowRightIcon, color: '#0e7a0d' },
- {}
- ),
- h(
- NCard,
- {
- contentStyle: {
- textAlign: 'center',
- padding: 0,
- },
- },
- {
- default: () => row.T_reporting_name,
- cover: () =>
- h(
- NTag,
- {
- class: 'w-full',
- type: row.T_reporting_state === 0 ? 'error' : 'success',
- bordered: false,
- },
- {
- default: () => '报告编写',
- }
- ),
- }
- ),
- h(
- NIcon,
- { size: 25, component: ArrowRightIcon, color: '#0e7a0d' },
- {}
- ),
- h(
- NCard,
- {
- contentStyle: {
- textAlign: 'center',
- padding: 0,
- },
- },
- {
- default: () => row.T_delivery_name,
- cover: () =>
- h(
- NTag,
- {
- class: 'w-full',
- type:
- row.T_delivery_state === 0
- ? 'error'
- : row.T_delivery_state === 1
- ? 'success'
- : 'warning',
- bordered: false,
- },
- {
- default: () => '交付审核',
- }
- ),
- }
- ),
- ],
- }
- );
- },
- },
- {
- title: '操作',
- key: 'actions',
- render(row) {
- return h(NSpace, null, {
- default: () =>
- [
- '设备管理',
- '实施方案',
- '数据来源',
- '数据编辑',
- '数据校验',
- '报告生成',
- '报告审核',
- ].map((item) =>
- h(
- NButton,
- {
- type: 'primary',
- size: 'small',
- onClick: () => {
- window.sessionStorage.setItem('task', JSON.stringify(row));
- if (item === '实施方案') {
- router.push('/scheme');
- } else if (item === '校准证书') {
- router.push('/certificate');
- } else if (item === '设备管理') {
- router.push('/equipment');
- } else if (item === '数据来源') {
- router.push('/data_source');
- } else if (item === '数据编辑') {
- router.push('/data_edit');
- } else if (item === '数据校验') {
- router.push('/data_checkout');
- } else if (item === '报告生成') {
- router.push('/report_create');
- } else {
- router.push('/report_audit');
- }
- },
- },
- { default: () => item }
- )
- ),
- });
- },
- },
- ];
- //搜索按钮
- const searchFun = ()=>{
- queryData.page = 1
- getDataList();
- }
- // 分页数据源
- const pagination = reactive({
- page: queryData.page,
- pageSize: queryData.page_z,
- itemCount: 0,
- onChange: (page) => {
- pagination.page = page;
- queryData.page = page;
- getDataList();
- },
- });
- // 任务管理(列表)
- const getDataList = async () => {
- const { data: res } = await getTaskList(queryData);
- pagination.itemCount = res.Data.Num;
- data.value = res.Data.List || [];
- };
- getDataList();
- let timer = setInterval(() => {
- getDataList();
- }, 30000);
- onBeforeUnmount(() => {
- clearInterval(timer);
- });
- </script>
- <style scoped></style>
|