ledger.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. <template>
  2. <hc-body>
  3. <hc-new-card>
  4. <template #header>
  5. <div class="ml-4 w-40">
  6. <el-select v-model="searchForm.storageTime" clearable placeholder="标段">
  7. <el-option v-for="item in sectionData" :key="item.value" :label="item.label" :value="item.value" />
  8. </el-select>
  9. </div>
  10. <div class="ml-3 w-40">
  11. <el-select v-model="searchForm.secretLevel" clearable placeholder="移交人">
  12. <el-option v-for="item in transferornData" :key="item.value" :label="item.label" :value="item.value" />
  13. </el-select>
  14. </div>
  15. <div class="ml-3 w-64">
  16. <HcDatePicker :dates="betweenTime" clearable start-placeholder="移交开始时间" end-placeholder="移交结束时间" @change="betweenTimeUpdate" />
  17. </div>
  18. <div class="ml-3 w-56">
  19. <el-input v-model="searchForm.name" clearable block placeholder="请输入登记表/清单名称" @keyup="keyUpEvent" />
  20. </div>
  21. <div class="ml-2">
  22. <el-button type="primary" @click="searchClick">
  23. <HcIcon name="search-2" />
  24. <span>搜索</span>
  25. </el-button>
  26. </div>
  27. </template>
  28. <div class="h-full">
  29. <div class="hc-c-table-box h-full">
  30. <HcTable
  31. ref="tableRef" :check-style="{ width: 29 }" :column="tableColumn" :datas="tableData"
  32. :index-style="{ width: 70 }" :is-arr-index="false" :loading="tableLoading"
  33. is-new is-current-row
  34. >
  35. <template #index="{ index }">
  36. <span>{{ index + 1 }}</span>
  37. </template>
  38. <template #secretLevelValue="{ row }">
  39. <span class="text-link">{{ row.secretLevelValue }}</span>
  40. </template>
  41. <template #pageN="{ row }">
  42. <span class="text-link">{{ row.pageN }}</span>
  43. </template>
  44. </HcTable>
  45. </div>
  46. </div>
  47. <template #action>
  48. <HcPages :pages="searchForm" :sizes="[20, 50, 100, 200, 300, 500]" @change="pageChange" />
  49. </template>
  50. </hc-new-card>
  51. </hc-body>
  52. </template>
  53. <script setup>
  54. import { onMounted, ref, watch } from 'vue'
  55. import { useAppStore } from '~src/store'
  56. import { getArrValue } from 'js-fast-way'
  57. import tuningApi from '~api/archiveConfig/tuning.js'
  58. import { getStoreValue, setStoreValue } from '~src/utils/storage'
  59. //变量
  60. const useAppState = useAppStore()
  61. const projectId = ref(useAppState.getProjectId)
  62. const contractId = ref(useAppState.getContractId)
  63. const projectInfo = ref(useAppState.getProjectInfo)
  64. const isCollapse = ref(useAppState.getCollapse)
  65. const hoverHand = ref(true)
  66. //监听
  67. watch(() => [
  68. useAppState.getCollapse,
  69. ], ([Collapse]) => {
  70. isCollapse.value = Collapse
  71. })
  72. //渲染完成
  73. onMounted(() => {
  74. setTableColumns()
  75. })
  76. //日期时间被选择
  77. const betweenTime = ref(null)
  78. const betweenTimeUpdate = ({ val, arr }) => {
  79. betweenTime.value = arr
  80. searchForm.value.startTimeValue = val['start']
  81. searchForm.value.endTimeValue = val['end']
  82. }
  83. //标段
  84. const sectionData = ref([
  85. { label: 'T.J01标', value: '3' },
  86. { label: 'T.J02标', value: '2' },
  87. { label: 'T.J03标', value: '1' },
  88. ])
  89. const transferornData = ref([
  90. { label: '张三', value: '3' },
  91. { label: '李四', value: '2' },
  92. { label: '王五', value: '1' },
  93. ])
  94. //搜索表单
  95. const searchForm = ref({
  96. contractId: null, storageTime:'', secretLevel:'', name:'', startTimeValue: '', endTimeValue: '',
  97. current: 1, size: 20, total: 0,
  98. })
  99. const searchClick = ()=>{
  100. getTableData()
  101. }
  102. //回车搜索
  103. const keyUpEvent = (e) => {
  104. if (e.key === 'Enter') {
  105. searchForm.value.current = 1
  106. getTableData()
  107. }
  108. }
  109. //分页被点击
  110. const pageChange = ({ current, size }) => {
  111. searchForm.value.current = current
  112. searchForm.value.size = size
  113. getTableData()
  114. }
  115. //表格数据
  116. const tableRef = ref(null)
  117. const tableColumn = ref([])
  118. //设置表头
  119. const setTableColumns = () => {
  120. tableColumn.value = [
  121. { key: 'fileNumber', name: '标段' },
  122. { key: 'name', name: '移交人', width: 300 },
  123. { key: 'storageTimeValue', name: '移交时间' },
  124. { key: 'secretLevelValue', name: '登记表' },
  125. { key: 'pageN', name: '清单' },
  126. ]
  127. }
  128. const tableData = ref([
  129. // { fileNumber: 'T.J01标', name: '张三', storageTimeValue: '2022-06-20 14:52:30', secretLevelValue: '电子档案移交接收登记表(TJ01标)', pageN: '电子档案移交接收登记表(TJ01标)' },
  130. ])
  131. //获取数据
  132. const tableLoading = ref(false)
  133. const getTableData = async () => {
  134. // tableLoading.value = true
  135. // const { error, code, data } = await tuningApi.pageByArchive({
  136. // ...searchForm.value,
  137. // projectId: projectId.value,
  138. // contractId: contractId.value,
  139. // isArchive: 1,
  140. // })
  141. // tableLoading.value = false
  142. // if (!error && code === 200) {
  143. // tableData.value = getArrValue(data?.records)
  144. // searchForm.value.total = data?.total || 0
  145. // } else {
  146. // tableData.value = []
  147. // searchForm.value.total = 0
  148. // }
  149. }
  150. //设置表头
  151. </script>