section.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. <!-- -->
  2. <template>
  3. <div class="hc-page-box">
  4. <HcNewCard>
  5. <template #header>
  6. <div class="w-32">
  7. <el-select v-model="searchForm.userName" placeholder="测量人" clearable filterable block @change="getTableData">
  8. <el-option v-for="item in peopleType" :key="item" :label="item" :value="item" />
  9. </el-select>
  10. </div>
  11. <div class="ml-3 w-42">
  12. <el-select v-model="searchForm.backBreak" clearable block placeholder="是否超欠挖 " @change="getTableData">
  13. <el-option v-for="item in tasksStatus" :key="item.value" :label="item.label" :value="item.value" />
  14. </el-select>
  15. </div>
  16. <div class="ml-3 w-64">
  17. <HcDatePicker :dates="betweenTime" clearable @change="betweenTimeUpdate" />
  18. </div>
  19. </template>
  20. <HcTable is-new :column="tableColumn" :datas="tableData">
  21. <template #backBreak="{ row }">
  22. {{ tasksStatus.find(item => item.value == row.backBreak)?.label || row.backBreak }}
  23. </template>
  24. <template #action="{ row }">
  25. <el-link type="primary" @click="viewSubmit(row)">查看详情</el-link>
  26. <el-link type="warning" @click="changeRow(row)">编辑</el-link>
  27. </template>
  28. </HcTable>
  29. <template #action>
  30. <HcPages :pages="searchForm" @change="pageChange" />
  31. </template>
  32. </HcNewCard>
  33. <!-- 编辑 -->
  34. <cross-add v-model="editModal" :form-disabled="formDisabled" :row-id="rowId" @save="getTableData" />
  35. </div>
  36. </template>
  37. <script setup>
  38. import { onMounted, ref, watch } from 'vue'
  39. import crossApi from '~api/cross/cross'
  40. import { useAppStore } from '~src/store'
  41. import { getArrValue } from 'js-fast-way'
  42. import crossAdd from './cross-add.vue'
  43. import { getDictionaryData } from '~uti/tools'
  44. const useAppState = useAppStore()
  45. const projectId = ref(useAppState.getProjectId)
  46. const contractId = ref(useAppState.contractId)
  47. const tableColumn = [
  48. { key: 'deviceCode', name: '设备型号' },
  49. { key: 'createTime', name: '上传时间' },
  50. { key: 'nameOfProject', name: '工程名称' },
  51. { key: 'date', name: '测量时间' },
  52. { key: 'userName', name: '测量人' },
  53. { key: 'mileageNumber', name: '里程号' },
  54. { key: 'backBreak', name: '是否超欠挖' },
  55. { key: 'action', name: '操作', width:150 },
  56. ]
  57. const tableData = ref([
  58. ])
  59. //搜索表单
  60. const searchForm = ref({
  61. current: 1, size: 20, total: 0, userName:'', backBreak:'', startTime:'', endTime:'',
  62. })
  63. onMounted(() => {
  64. getTableData()
  65. getPeopleType()
  66. getTasksStatusOptions()
  67. })
  68. const peopleType = ref([])
  69. const getPeopleType = async () => {
  70. const { error, code, data } = await crossApi.getListUserName()
  71. //判断状态
  72. if (!error && code === 200) {
  73. peopleType.value = getArrValue(data)
  74. } else {
  75. peopleType.value = []
  76. }
  77. }
  78. const getTasksStatusOptions = async () => {
  79. tasksStatus.value = await getDictionaryData('q_profiler_back_break', true)
  80. tasksStatus.value.forEach(item => {
  81. item.value = String(item.value)
  82. })
  83. }
  84. const tasksStatus = ref([
  85. ])
  86. //日期时间被选择
  87. const betweenTime = ref(null)
  88. const betweenTimeUpdate = ({ val, arr }) => {
  89. betweenTime.value = arr
  90. searchForm.value.startTime = val['start']
  91. searchForm.value.endTime = val['end']
  92. getTableData()
  93. }
  94. //分页被点击
  95. const pageChange = ({ current, size }) => {
  96. searchForm.value.current = current
  97. searchForm.value.size = size
  98. getTableData()
  99. }
  100. const tableLoading = ref(false)
  101. const getTableData = async () => {
  102. tableLoading.value = true
  103. const { error, code, data } = await crossApi.queryListData({
  104. ...searchForm.value,
  105. projectId: projectId.value,
  106. contractId:contractId.value,
  107. })
  108. //判断状态
  109. tableLoading.value = false
  110. if (!error && code === 200) {
  111. tableData.value = getArrValue(data['records'])
  112. searchForm.value.total = data['total'] || 0
  113. } else {
  114. tableData.value = []
  115. searchForm.value.total = 0
  116. }
  117. }
  118. const editModal = ref(false)//提交整改
  119. const rowId = ref(null)
  120. const formDisabled = ref(false)
  121. const changeRow = (row)=>{
  122. rowId.value = row['id']
  123. editModal.value = true
  124. formDisabled.value = false
  125. }
  126. //查看详情
  127. const viewSubmit = async (row)=>{
  128. rowId.value = row['id']
  129. formDisabled.value = true
  130. editModal.value = true
  131. }
  132. </script>
  133. <style lang='scss' scoped>
  134. </style>