index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518
  1. <template>
  2. <div>
  3. <!-- :useOnlineHeader="true"
  4. :showSettingTools="true" -->
  5. <!-- 进度查询 -->
  6. <SmartTable
  7. ref="smartTableRef"
  8. v-model:pageNo="pagination.pageNo"
  9. v-model:pagesize="pagination.pageSize"
  10. v-model:total="pagination.total"
  11. :columns="columns"
  12. :data="dataSource"
  13. :showRefresh="false"
  14. :tableHeaderSetting="'进度查询'"
  15. :tableProps="{
  16. emptyText: '暂无数据',
  17. rowClassName: getRowClassName
  18. }"
  19. :buttons="buttons"
  20. :loading="tableLoading"
  21. @on-page-no-change="() => getList()"
  22. @on-page-size-change="() => getList()"
  23. @on-search="getList"
  24. @on-reset="getList"
  25. v-model:formData="searchInfo"
  26. @row-dblclick="(row) => showNoticeDetail(row)"
  27. >
  28. <template #expandSlot="{ row }">
  29. <div class="children-item" v-if="row.taskList && row.taskList.length > 0">
  30. <el-table :data="row.taskList" class="table-children" border>
  31. <el-table-column prop="progressStatusName" label="当前状态" align="center">
  32. <template #default="scoped">
  33. <div>
  34. <el-tag type="success" size="mini">
  35. {{ scoped.row.progressStatusName }}
  36. </el-tag>
  37. </div>
  38. </template>
  39. </el-table-column>
  40. <el-table-column prop="contractNo" label="合同/协议编号" align="center">
  41. <template #default>
  42. <div>
  43. {{ row.contractNo || row.acceptanceNo }}
  44. </div>
  45. </template>
  46. </el-table-column>
  47. <el-table-column prop="taskNo" label="任务编号" align="center" />
  48. <el-table-column prop="entrustUnitName" label="委托单位" align="center" />
  49. <el-table-column prop="sampleName" label="样品名称" align="center">
  50. <template #default="scoped">
  51. <div v-for="(item, index) in scoped.row.sampleInfoList" :key="index">
  52. <span>{{ item.sampleName }}</span>
  53. <span v-if="index < scoped.row.sampleInfoList.length - 1">,</span>
  54. </div>
  55. </template>
  56. </el-table-column>
  57. <el-table-column prop="sampleReportNo" label="样品编号" align="center">
  58. <template #default="scoped">
  59. <div v-for="(item, index) in scoped.row.sampleInfoList" :key="index">
  60. <span>{{ item.sampleReportNo }}</span>
  61. <span v-if="index < scoped.row.sampleInfoList.length - 1">,</span>
  62. </div>
  63. </template>
  64. </el-table-column>
  65. <el-table-column prop="productBatchNo" label="产品批号" align="center">
  66. <template #default="scoped">
  67. <div v-for="(item, index) in scoped.row.sampleInfoList" :key="index">
  68. <span>{{ item.productBatchNo }}</span>
  69. <span v-if="index < scoped.row.sampleInfoList.length - 1">,</span>
  70. </div>
  71. </template>
  72. </el-table-column>
  73. <el-table-column prop="checkType" label="检验类别" align="center">
  74. <template #default="scoped">
  75. <div>
  76. {{ getCheckTypes.find((x) => x.value == scoped.row.checkType)?.label}}
  77. </div>
  78. </template>
  79. </el-table-column>
  80. <el-table-column prop="productionUnit" label="生产单位" align="center">
  81. <template #default="scoped">
  82. <div v-for="(item, index) in scoped.row.sampleInfoList" :key="index">
  83. <span>{{ item.productionUnit }}</span>
  84. <span v-if="index < scoped.row.sampleInfoList.length - 1">,</span>
  85. </div>
  86. </template>
  87. </el-table-column>
  88. <el-table-column prop="inspectionCompletedDate" label="检验完成日期" align="center">
  89. <template #default="scoped">
  90. <div>
  91. {{
  92. scoped.row.inspectionCompletedDate
  93. ? dayjs(scoped.row.inspectionCompletedDate).format('YYYY-MM-DD')
  94. : '-'
  95. }}
  96. </div>
  97. </template>
  98. </el-table-column>
  99. </el-table>
  100. </div>
  101. </template>
  102. </SmartTable>
  103. <!-- 流转记录 -->
  104. <FunctionalHistory v-if="isShowHistory" v-model="isShowHistory" :id="historyId" />
  105. </div>
  106. </template>
  107. <script setup lang="tsx">
  108. import { ref, reactive, defineAsyncComponent } from 'vue'
  109. import SmartTable from '@/components/SmartTable/SmartTable'
  110. import { Tickets } from '@element-plus/icons-vue'
  111. import { ElMessage, ElMessageBox } from 'element-plus'
  112. import { getFunctionalList } from '@/api/laboratory/functional'
  113. const FunctionalHistory = defineAsyncComponent(
  114. () => import('@/views/Functional/components/FunctionalHistory.vue')
  115. )
  116. import dayjs from 'dayjs'
  117. import { useDictStore } from '@/store/modules/dict'
  118. const dictStore = useDictStore()
  119. import { listToTree } from '@/utils/tree'
  120. import { getStandardClassList } from '@/api/laboratory/standard/category'
  121. import { progressInquiryApi } from '@/api/laboratory/progressInquiryService'
  122. import dayJs from 'dayjs'
  123. import download from '@/utils/download'
  124. import { useRouter } from 'vue-router'
  125. const router = useRouter()
  126. import noticeDrawer from './noticeDrawer.vue'
  127. const tableLoading = ref(false)
  128. const dataSource = ref([])
  129. const pagination = reactive({
  130. pageNo: 1,
  131. pageSize: 10,
  132. total: 0
  133. })
  134. const noticeDrawerRef = ref<any>(null)
  135. const showDrawer = ref(false) // 打开公告新增、修改弹窗
  136. const searchInfo = ref({})
  137. /** 查询列表 */
  138. const getList = async () => {
  139. tableLoading.value = true
  140. try {
  141. const { pageNo, pageSize } = pagination
  142. const res = await progressInquiryApi.getBusinessAcceptanceProgressPageList({
  143. ...searchInfo.value,
  144. pageNo,
  145. pageSize
  146. })
  147. let { list = [], total } = res
  148. dataSource.value = list
  149. pagination.total = total
  150. } finally {
  151. tableLoading.value = false
  152. }
  153. }
  154. // 检验类别
  155. const getCheckTypes = computed(() => dictStore.getDictMap['laboratory_inspection_category'])
  156. const getStatusType = (value) => {
  157. switch (value) {
  158. case '15':
  159. return 'danger'
  160. case '14':
  161. case '13':
  162. case '12':
  163. return 'warning'
  164. case '11':
  165. return 'primary'
  166. case '10':
  167. return 'warning'
  168. default:
  169. return 'info' // 默认类型
  170. }
  171. }
  172. const getFunctionalStatusTypes = ref<Array<Record<string, any>>>([
  173. {
  174. label: '业务受理',
  175. value: '业务受理'
  176. },
  177. {
  178. label: '业务审核',
  179. value: '业务审核'
  180. },
  181. {
  182. label: '技术审核',
  183. value: '技术审核'
  184. },
  185. {
  186. label: '检验中',
  187. value: '检验中'
  188. },
  189. {
  190. label: '已办结',
  191. value: '已办结'
  192. }
  193. ])
  194. const columns = ref([
  195. {
  196. type: 'selection',
  197. width: 55,
  198. align: 'center',
  199. label: '',
  200. prop: ''
  201. },
  202. {
  203. label: '',
  204. prop: 'expandProp',
  205. type: 'expand',
  206. width: 60,
  207. align: 'center',
  208. slot: 'expandSlot'
  209. },
  210. {
  211. label: '序号',
  212. prop: '',
  213. type: 'index',
  214. width: 60,
  215. align: 'center'
  216. },
  217. {
  218. label: '当前状态',
  219. prop: 'businessStatusList',
  220. align: 'center',
  221. search: {
  222. type: 'select',
  223. options: getFunctionalStatusTypes.value,
  224. fieldProps: {
  225. multiple: true
  226. }
  227. },
  228. render: (row, value) => {
  229. return row.businessStatus ? (
  230. <div>
  231. <el-tag key={row.id} type={getStatusType(row.businessStatus)}>
  232. {
  233. (getFunctionalStatusTypes.value || []).find((x) => x.value == row.businessStatus)
  234. ?.label
  235. }
  236. </el-tag>
  237. </div>
  238. ) : (
  239. '-'
  240. )
  241. }
  242. },
  243. {
  244. label: '合同/服务单/受理单编号',
  245. prop: 'contractNo',
  246. search: {
  247. type: 'input'
  248. },
  249. render: (row, value) => row.contractNo || row.acceptanceNo || '-'
  250. },
  251. {
  252. label: '委托单位',
  253. prop: 'entrustUnitName',
  254. search: {
  255. type: 'input'
  256. }
  257. },
  258. {
  259. label: '检验类别',
  260. prop: 'checkType',
  261. search: {
  262. type: 'select',
  263. options: getCheckTypes.value
  264. },
  265. render(row, value) {
  266. return !value
  267. ? '-'
  268. : value
  269. .split(',')
  270. .map((y) => <div>{getCheckTypes.value.find((x) => x.value === y)?.label}</div>)
  271. }
  272. },
  273. {
  274. label: '业务类型',
  275. prop: 'applicationForm',
  276. search: {
  277. type: 'treeSelect',
  278. options: [],
  279. fieldProps: {
  280. props: {
  281. children: 'children',
  282. label: 'name',
  283. value: 'id',
  284. isLeaf: 'leaf',
  285. emitPath: false
  286. }
  287. }
  288. },
  289. render(row, value) {
  290. return row.applicationFormName ? row.applicationFormName : '-'
  291. }
  292. },
  293. {
  294. label: '受理人',
  295. prop: 'acceptedByName'
  296. },
  297. {
  298. label: '受理日期',
  299. prop: 'acceptanceTime',
  300. search: {
  301. type: 'daterange'
  302. },
  303. render(row, value) {
  304. return !value ? '-' : dayjs(value).format('YYYY-MM-DD')
  305. }
  306. },
  307. {
  308. label: '费用',
  309. prop: 'totalFess',
  310. width: 130,
  311. render(row, value) {
  312. return <span style="color: red;">{value}</span>
  313. }
  314. },
  315. {
  316. label: '加急',
  317. prop: 'isUrgent',
  318. width: 80,
  319. render(row, value) {
  320. return (
  321. <el-tag key={row.id} type={value === '1' ? 'danger' : 'info'}>
  322. {value === '1' ? '是' : '否'}
  323. </el-tag>
  324. )
  325. }
  326. }
  327. ])
  328. const buttons = ref([
  329. {
  330. render() {
  331. return (
  332. <el-button type="primary" onClick={() => handleShowHistory()}>
  333. <el-icon>
  334. <Tickets />
  335. </el-icon>
  336. 流转记录
  337. </el-button>
  338. )
  339. }
  340. }
  341. ])
  342. const smartTableRef = ref<any>(null)
  343. const taskListTableRef = ref<any>(null)
  344. /**
  345. * 查看详情
  346. */
  347. const showNoticeDetail = async (row: any = {}) => {
  348. if (row.contractNo || row.acceptanceNo) {
  349. const result = await getFunctionalList({
  350. contractNo: row.contractNo ? row.contractNo : row.acceptanceNo
  351. })
  352. if (result.list.length) {
  353. const id = result.list[0].id
  354. router.push({
  355. name: 'FunctionalDetail',
  356. query: {
  357. id
  358. }
  359. })
  360. } else {
  361. return ElMessage.warning('暂无相关业务受理信息')
  362. }
  363. } else {
  364. return ElMessage.warning('暂无相关业务受理信息')
  365. }
  366. }
  367. const historyId = ref('')
  368. const isShowHistory = ref(false)
  369. /**
  370. * 查看流转记录
  371. */
  372. const handleShowHistory = () => {
  373. const selectedRows = smartTableRef.value?.getTableRef().getSelectionRows() || []
  374. if (!selectedRows.length) {
  375. ElMessage.warning('请选择数据')
  376. return
  377. }
  378. if (selectedRows.length > 1) {
  379. ElMessage.warning('只能选择一条数据')
  380. return
  381. }
  382. historyId.value = selectedRows[0].id
  383. isShowHistory.value = true
  384. }
  385. // 获取标准分类列表
  386. const fetchStandardClassList = async () => {
  387. const res = await getStandardClassList({})
  388. columns.value.forEach((item) => {
  389. if (item.prop === 'applicationForm' && item.search) {
  390. item.search.options =
  391. listToTree((res || [])?.map((item) => ({ ...item, pid: item.parentId }))) || []
  392. }
  393. })
  394. }
  395. // 为行添加自定义类名
  396. const getRowClassName = ({ row }) => {
  397. // 如果没有子项目,添加特殊类名
  398. if (!row.taskList || row.taskList.length === 0) {
  399. return 'row-no-children'
  400. }
  401. return ''
  402. }
  403. onMounted(() => {
  404. getList()
  405. fetchStandardClassList()
  406. })
  407. </script>
  408. <style lang="scss" scoped>
  409. // 隐藏没有子项目行的展开图标
  410. :deep(.row-no-children .el-table__expand-column .el-table__expand-icon) {
  411. visibility: hidden;
  412. }
  413. // 或者完全移除展开列的点击功能
  414. :deep(.row-no-children .el-table__expand-column) {
  415. cursor: default;
  416. pointer-events: none;
  417. }
  418. // 确保没有子项目的行不能展开
  419. :deep(.row-no-children .el-table__expand-column .cell) {
  420. opacity: 0.3;
  421. }
  422. ::v-deep(.el-descriptions__label) {
  423. width: 160px !important;
  424. }
  425. .usuallyContent {
  426. .mainTitle {
  427. margin-bottom: 16px;
  428. }
  429. &-item {
  430. margin-bottom: 16px;
  431. display: flex;
  432. justify-content: flex-start;
  433. align-items: center;
  434. position: relative;
  435. .title {
  436. margin-bottom: 10px;
  437. width: 100px;
  438. }
  439. .title::before {
  440. position: absolute;
  441. left: 0;
  442. content: '*';
  443. color: red;
  444. }
  445. }
  446. }
  447. .mr10 {
  448. margin-right: 10px;
  449. }
  450. .card {
  451. padding: 20px;
  452. display: flex;
  453. flex-wrap: wrap;
  454. width: 100%;
  455. &-item {
  456. width: 24%;
  457. display: flex;
  458. align-items: center;
  459. justify-content: center;
  460. height: 100px;
  461. background-color: #dbe8f2;
  462. margin-right: 10px;
  463. margin-bottom: 10px;
  464. border-radius: 8px;
  465. cursor: pointer;
  466. .icons {
  467. background: #4081f1;
  468. width: 80px;
  469. height: 80px;
  470. border-radius: 50%;
  471. margin-right: 4px;
  472. }
  473. .title {
  474. width: 160px;
  475. }
  476. }
  477. }
  478. :deep(.el-table) {
  479. .el-table__row {
  480. cursor: pointer;
  481. }
  482. .el-table__cell {
  483. padding: 30px 0 !important;
  484. }
  485. }
  486. ::v-deep .table-children {
  487. // padding-left: 385px;
  488. // display: flex;
  489. // justify-content: center;
  490. // align-items: center;
  491. th.el-table__cell {
  492. background-color: #f0f9eb;
  493. color: #333; /* 文字颜色 */
  494. }
  495. }
  496. </style>