CostSurveyTab.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. <template>
  2. <div>
  3. <el-table
  4. style="width: 100%; margin-top: 20px"
  5. :data="paginatedData"
  6. border
  7. size="medium"
  8. >
  9. <!-- 序号列 -->
  10. <el-table-column
  11. prop="index"
  12. label="序号"
  13. width="60"
  14. align="center"
  15. ></el-table-column>
  16. <el-table-column label="成本调查表" min-width="220">
  17. <template slot-scope="scope">
  18. <span
  19. :style="{
  20. color: scope.row.isDisabled ? '#909399' : '#409EFF',
  21. cursor: scope.row.isDisabled ? 'default' : 'pointer',
  22. }"
  23. @click="
  24. !scope.row.isDisabled && $emit('handle-survey-click', scope.row)
  25. "
  26. >
  27. {{ scope.row.name }}
  28. </span>
  29. </template>
  30. </el-table-column>
  31. <!-- 资料类型列 -->
  32. <el-table-column
  33. prop="dataType"
  34. label="资料类型"
  35. width="120"
  36. align="center"
  37. ></el-table-column>
  38. <!-- 表格类型列 -->
  39. <el-table-column
  40. prop="tableType"
  41. label="表格类型"
  42. width="120"
  43. align="center"
  44. ></el-table-column>
  45. <!-- 是否必填列 -->
  46. <el-table-column
  47. prop="isRequired"
  48. label="是否必填"
  49. width="100"
  50. align="center"
  51. ></el-table-column>
  52. <!-- 是否上传列(红色“未上传”、绿色“已上传”) -->
  53. <el-table-column label="是否上传" width="100" align="center">
  54. <template slot-scope="scope">
  55. <span
  56. :style="{
  57. color: scope.row.isUploaded === true ? '#67c23a' : '#f56c6c',
  58. }"
  59. >
  60. {{ scope.row.isUploaded === true ? '已上传' : '未上传' }}
  61. </span>
  62. </template>
  63. </el-table-column>
  64. <!-- 操作列(根据“是否上传”“表格类型”显示不同按钮) -->
  65. <el-table-column label="操作" width="280" align="center">
  66. <template slot-scope="scope">
  67. <template v-if="scope.row.isUploaded">
  68. <el-button
  69. type="text"
  70. size="small"
  71. :disabled="isViewMode"
  72. @click="$emit('handle-modify', scope.row)"
  73. >
  74. 修改
  75. </el-button>
  76. <el-button
  77. type="text"
  78. size="small"
  79. :disabled="isViewMode"
  80. @click="$emit('handle-data-download', scope.row)"
  81. >
  82. 数据下载
  83. </el-button>
  84. <el-button
  85. type="text"
  86. size="small"
  87. :disabled="isViewMode"
  88. @click="$emit('handle-data-upload', scope.row)"
  89. >
  90. 数据上传
  91. </el-button>
  92. </template>
  93. <template v-else>
  94. <el-button
  95. type="text"
  96. size="small"
  97. :disabled="isViewMode"
  98. @click="$emit('handle-online-fill', scope.row)"
  99. >
  100. 在线填报
  101. </el-button>
  102. <el-button
  103. v-if="scope.row.tableType === '动态表'"
  104. type="text"
  105. size="small"
  106. :disabled="isViewMode"
  107. @click="$emit('handle-template-download', scope.row)"
  108. >
  109. 模版下载
  110. </el-button>
  111. <el-button
  112. type="text"
  113. size="small"
  114. :disabled="isViewMode"
  115. @click="$emit('handle-data-upload', scope.row)"
  116. >
  117. 数据上传
  118. </el-button>
  119. </template>
  120. </template>
  121. </el-table-column>
  122. </el-table>
  123. <el-pagination
  124. background
  125. layout="total, sizes, prev, pager, next"
  126. :current-page="pagination.currentPage"
  127. :page-sizes="[10, 20, 30, 50]"
  128. :page-size="pagination.pageSize"
  129. :total="pagination.total"
  130. style="margin-top: 20px; text-align: right"
  131. @current-change="$emit('handle-page-change', $event)"
  132. @size-change="$emit('handle-size-change', $event)"
  133. />
  134. </div>
  135. </template>
  136. <script>
  137. export default {
  138. name: 'CostSurveyTab',
  139. props: {
  140. paginatedData: {
  141. type: Array,
  142. default: () => [],
  143. },
  144. pagination: {
  145. type: Object,
  146. default: () => ({ currentPage: 1, pageSize: 10, total: 0 }),
  147. },
  148. isViewMode: {
  149. type: Boolean,
  150. default: false,
  151. },
  152. },
  153. }
  154. </script>