measure.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. <template>
  2. <hc-new-card>
  3. <template #header>
  4. <div class="w-40">
  5. <el-select v-model="searchForm.key1" filterable block placeholder="选择工区" @change="searchClick">
  6. <el-option label="一工区" value="1" />
  7. <el-option label="二工区" value="1" />
  8. </el-select>
  9. </div>
  10. </template>
  11. <template #extra>
  12. <el-button hc-btn type="primary" @click="editModalClick">
  13. <HcIcon name="edit" />
  14. <span>编辑</span>
  15. </el-button>
  16. </template>
  17. <hc-table :column="tableColumn" :datas="tableData" :loading="tableLoading" is-new :index-style="{ width: 60 }">
  18. <template #action="{ row }">
  19. <el-link type="danger">锁定</el-link>
  20. </template>
  21. </hc-table>
  22. <template #action>
  23. <hc-pages :pages="searchForm" @change="pageChange" />
  24. </template>
  25. <!-- 编辑修改 -->
  26. <hc-new-dialog is-table widths="1200px" :show="editModalShow" title="计量期编辑" @save="editModalSave" @close="editModalClose">
  27. <hc-card-item>
  28. <template #header>
  29. <el-tooltip :visible="editVisible" effect="light" placement="bottom-start">
  30. <template #content>
  31. <div class="text-sm text-red">
  32. 1.日期不能为空<br>
  33. 2.同一期的结束日期不能小于开始日期<br>
  34. 3.连续的两期,上一期结束日期和下一期的开始日期必须连续<br>
  35. 如:期号1的结束日期为2018-1-25,则期号2的开始日期必须是2018-1-26 !<br>
  36. 4.已经存在数据的计量周期不能进行删除!<br>
  37. 5.已经存在上报数据的计量周期不能进行数据修改!<br>
  38. </div>
  39. </template>
  40. <el-button type="danger" @mouseenter="editVisible = true" @mouseleave="editVisible = false">
  41. <HcIcon name="question" />
  42. <span>编辑说明</span>
  43. </el-button>
  44. </el-tooltip>
  45. </template>
  46. <template #extra>
  47. <el-button type="primary">
  48. <HcIcon name="page-separator" :line="false" />
  49. <span>插入上一行</span>
  50. </el-button>
  51. <el-button type="primary">
  52. <HcIcon name="page-separator" :line="false" />
  53. <span>插入下一行</span>
  54. </el-button>
  55. </template>
  56. <hc-table :column="tableEditColumn" :datas="tableEditData" is-new :index-style="{ width: 60 }">
  57. <template #key1="{ row }">
  58. <hc-table-input v-model="row.key1" disabled />
  59. </template>
  60. <template #key2="{ row }">
  61. <hc-table-input v-model="row.key2" disabled />
  62. </template>
  63. <template #key3="{ row }">
  64. <el-select v-model="row.key3" placeholder="选择年份" filterable disabled block>
  65. <el-option v-for="item in yearData" :key="item" :label="item" :value="item" />
  66. </el-select>
  67. </template>
  68. <template #key4="{ row }">
  69. <el-select v-model="row.key4" placeholder="选择月份" filterable disabled block>
  70. <el-option v-for="item in monthData" :key="item" :label="item" :value="item" />
  71. </el-select>
  72. </template>
  73. <template #key5="{ row }">
  74. <el-date-picker v-model="row.key5" class="block" format="YYYY-MM-DD" type="date" value-format="YYYY-MM-DD" disabled />
  75. </template>
  76. <template #action="{ row }">
  77. <el-button plain size="small" type="danger">删除</el-button>
  78. </template>
  79. </hc-table>
  80. </hc-card-item>
  81. </hc-new-dialog>
  82. </hc-new-card>
  83. </template>
  84. <script setup>
  85. import { onMounted, ref } from 'vue'
  86. import { getMonthList, getYearList } from 'js-fast-way'
  87. import dayjs from 'dayjs'
  88. defineOptions({
  89. name: 'PeriodsAdminMeasure',
  90. })
  91. //获取年月等相关日期数据
  92. const year = Number(dayjs().format('YYYY')) + 8
  93. const yearData = getYearList(year, 2010)
  94. const monthData = getMonthList()
  95. //渲染完成
  96. onMounted(() => {
  97. })
  98. //搜索表单
  99. const searchForm = ref({
  100. key1: null, current: 1, size: 10, total: 0,
  101. })
  102. const searchClick = () => {
  103. }
  104. //分页
  105. const pageChange = ({ current, size }) => {
  106. searchForm.value.current = current
  107. searchForm.value.size = size
  108. }
  109. //表格数据
  110. const tableLoading = ref(false)
  111. const tableColumn = ref([
  112. { key: 'key1', name: '期号' },
  113. { key: 'key2', name: '期名称' },
  114. { key: 'key3', name: '年份' },
  115. { key: 'key4', name: '月份' },
  116. { key: 'key5', name: '报表打印日期' },
  117. { key: 'action', name: '操作', width: 80 },
  118. ])
  119. const tableData = ref([
  120. { key1: '1111' },
  121. ])
  122. //计量期编辑
  123. const editVisible = ref(false)
  124. const editModalShow = ref(false)
  125. const editModalClick = () => {
  126. editModalShow.value = true
  127. }
  128. //编辑的表格
  129. const tableEditColumn = [
  130. { key: 'key1', name: '期号' },
  131. { key: 'key2', name: '期名称' },
  132. { key: 'key3', name: '年份' },
  133. { key: 'key4', name: '月份' },
  134. { key: 'key5', name: '报表打印日期' },
  135. { key: 'action', name: '操作', width: 80, align: 'center' },
  136. ]
  137. const tableEditData = ref([
  138. { key1: '11' },
  139. { key1: '222' },
  140. ])
  141. const editModalSave = () => {
  142. editModalClose()
  143. }
  144. const editModalClose = () => {
  145. editModalShow.value = false
  146. }
  147. </script>
  148. <style scoped lang="scss">
  149. </style>