index.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332
  1. <template>
  2. <div style="display: flex;align-items: center;margin-bottom: 10px;">
  3. <n-input v-model:value="queryData.T_name" type="text" placeholder="请输入报告名称" style="width: 30%;" clearable />
  4. <n-button type="primary" @click="searchFun" style="margin-left: 10px;">搜索</n-button>
  5. </div>
  6. <n-data-table
  7. remote
  8. :columns="columns"
  9. :data="data"
  10. :pagination="pagination"
  11. class=" flex flex-col justify-between"
  12. />
  13. </template>
  14. <script setup>
  15. import { h } from 'vue';
  16. import { NButton, NSpace, NCard, NTag, NIcon, NPopover } from 'naive-ui';
  17. import { getTaskList } from '@/api';
  18. import { ArrowRightOutlined as ArrowRightIcon } from '@vicons/antd';
  19. const router = useRouter();
  20. // 查询参数
  21. const queryData = reactive({
  22. T_uuid: '',
  23. T_name: '',
  24. page: 1,
  25. page_z: 8,
  26. });
  27. // 任务列表
  28. const data = ref([]);
  29. const renderPopover = (trigger, content) => {
  30. return h(
  31. NPopover,
  32. { trigger: 'hover' },
  33. {
  34. trigger: () => trigger,
  35. default: () => h(NSpace, null, { default: () => content }),
  36. }
  37. );
  38. };
  39. // 需要展示的列
  40. const columns = [
  41. {
  42. title: '公司名称',
  43. key: 'T_user_name',
  44. width: 180,
  45. },
  46. {
  47. title: '报告名称',
  48. key: 'T_name',
  49. width: 180,
  50. },
  51. {
  52. title: '截止时间',
  53. key: 'T_deadline',
  54. width: 180,
  55. },
  56. {
  57. title() {
  58. return renderPopover(
  59. '流程(?)',
  60. [0, 1, 2, 3, 4].map((item) =>
  61. h(
  62. NTag,
  63. {
  64. bordered: false,
  65. type:
  66. item === 0
  67. ? 'error'
  68. : item === 1
  69. ? 'info'//已完成
  70. : item === 2
  71. ? 'warning'
  72. : item === 4
  73. ? 'success'
  74. : 'default',
  75. },
  76. {
  77. default: () => {
  78. if (item === 0) {
  79. return '未完成';
  80. } else if (item === 1) {
  81. return '数据来源已完成';
  82. } else if (item === 2) {
  83. return '处理中';
  84. } else if (item === 4) {
  85. return '数据编辑已完成';
  86. } else {
  87. return '已采集-无数据';
  88. }
  89. },
  90. }
  91. )
  92. )
  93. );
  94. },
  95. key: 'T_task_id',
  96. width: 460,
  97. render(row) {
  98. return h(
  99. NSpace,
  100. {
  101. align: 'center',
  102. },
  103. {
  104. default: () => [
  105. h(
  106. NCard,
  107. {
  108. style: {
  109. width: '70px',
  110. height: '50px',
  111. },
  112. contentStyle: {
  113. textAlign: 'center',
  114. padding: 0,
  115. },
  116. },
  117. {
  118. default: () => row.T_scheme_name,
  119. cover: () =>
  120. h(
  121. NTag,
  122. {
  123. class: 'w-full',
  124. type: row.T_scheme_state === 0 ? 'error' : 'success',
  125. bordered: false,
  126. },
  127. {
  128. default: () => '实施方案',
  129. }
  130. ),
  131. }
  132. ),
  133. h(
  134. NIcon,
  135. { size: 25, component: ArrowRightIcon, color: '#0e7a0d' },
  136. {}
  137. ),
  138. h(
  139. NCard,
  140. {
  141. contentStyle: {
  142. textAlign: 'center',
  143. padding: 0,
  144. },
  145. },
  146. {
  147. default: () => row.T_collection_name,
  148. cover: () =>
  149. h(
  150. NTag,
  151. {
  152. class: 'w-full',
  153. type:
  154. row.T_collection_state === 0
  155. ? 'error'
  156. : row.T_collection_state === 1
  157. ? 'info'
  158. : row.T_collection_state === 2
  159. ? 'warning'
  160. : row.T_collection_state === 4
  161. ? 'success'
  162. : 'default',
  163. bordered: false,
  164. },
  165. {
  166. default: () => '数据采集',
  167. }
  168. ),
  169. }
  170. ),
  171. h(
  172. NIcon,
  173. { size: 25, component: ArrowRightIcon, color: '#0e7a0d' },
  174. {}
  175. ),
  176. h(
  177. NCard,
  178. {
  179. contentStyle: {
  180. textAlign: 'center',
  181. padding: 0,
  182. },
  183. },
  184. {
  185. default: () => row.T_reporting_name,
  186. cover: () =>
  187. h(
  188. NTag,
  189. {
  190. class: 'w-full',
  191. type: row.T_reporting_state === 0 ? 'error' : 'success',
  192. bordered: false,
  193. },
  194. {
  195. default: () => '报告编写',
  196. }
  197. ),
  198. }
  199. ),
  200. h(
  201. NIcon,
  202. { size: 25, component: ArrowRightIcon, color: '#0e7a0d' },
  203. {}
  204. ),
  205. h(
  206. NCard,
  207. {
  208. contentStyle: {
  209. textAlign: 'center',
  210. padding: 0,
  211. },
  212. },
  213. {
  214. default: () => row.T_delivery_name,
  215. cover: () =>
  216. h(
  217. NTag,
  218. {
  219. class: 'w-full',
  220. type:
  221. row.T_delivery_state === 0
  222. ? 'error'
  223. : row.T_delivery_state === 1
  224. ? 'success'
  225. : 'warning',
  226. bordered: false,
  227. },
  228. {
  229. default: () => '交付审核',
  230. }
  231. ),
  232. }
  233. ),
  234. ],
  235. }
  236. );
  237. },
  238. },
  239. {
  240. title: '操作',
  241. key: 'actions',
  242. render(row) {
  243. return h(NSpace, null, {
  244. default: () =>
  245. [
  246. '设备管理',
  247. '实施方案',
  248. '数据来源',
  249. '数据编辑',
  250. '数据校验',
  251. '报告生成',
  252. '报告审核',
  253. ].map((item) =>
  254. h(
  255. NButton,
  256. {
  257. type: 'primary',
  258. size: 'small',
  259. onClick: () => {
  260. window.sessionStorage.setItem('task', JSON.stringify(row));
  261. if (item === '实施方案') {
  262. router.push('/scheme');
  263. } else if (item === '校准证书') {
  264. router.push('/certificate');
  265. } else if (item === '设备管理') {
  266. router.push('/equipment');
  267. } else if (item === '数据来源') {
  268. router.push('/data_source');
  269. } else if (item === '数据编辑') {
  270. router.push('/data_edit');
  271. } else if (item === '数据校验') {
  272. router.push('/data_checkout');
  273. } else if (item === '报告生成') {
  274. router.push('/report_create');
  275. } else {
  276. router.push('/report_audit');
  277. }
  278. },
  279. },
  280. { default: () => item }
  281. )
  282. ),
  283. });
  284. },
  285. },
  286. ];
  287. //搜索按钮
  288. const searchFun = ()=>{
  289. queryData.page = 1
  290. getDataList();
  291. }
  292. // 分页数据源
  293. const pagination = reactive({
  294. page: queryData.page,
  295. pageSize: queryData.page_z,
  296. itemCount: 0,
  297. onChange: (page) => {
  298. pagination.page = page;
  299. queryData.page = page;
  300. getDataList();
  301. },
  302. });
  303. // 任务管理(列表)
  304. const getDataList = async () => {
  305. const { data: res } = await getTaskList(queryData);
  306. pagination.itemCount = res.Data.Num;
  307. data.value = res.Data.List || [];
  308. };
  309. getDataList();
  310. let timer = setInterval(() => {
  311. getDataList();
  312. }, 30000);
  313. onBeforeUnmount(() => {
  314. clearInterval(timer);
  315. });
  316. </script>
  317. <style scoped></style>