Newer
Older
KaiFengPC / src / views / spongePerformance / waterlogging / permeableGroundArea / tableDalgo.vue
@zhangdeliang zhangdeliang on 23 May 5 KB 初始化项目
  1. <template>
  2. <div class="water-analysis-page">
  3. <div class="top">
  4. <el-form label-width="auto" :rules="projectEstimateRules" inline ref="ruleForm" :model="FormList" :disabled="typeList.type == 1">
  5. <div v-for="i in typeList.monitorDynamicTableTitleList" style="display: flex; flex-direction: column">
  6. <el-form-item :label="i.value + ':'" :prop="i.key" :disabled="typeList.type == 1 || typeList.type == 2">
  7. <!-- <el-input-number
  8. v-if="i.key == 'kstdmTargetArea'"
  9. :placeholder="i.value"
  10. :min="0"
  11. :precision="2"
  12. :step="0.1"
  13. :max="typeList.allRealValue"
  14. @change="trsyAreaChange"
  15. v-model="FormList[i.key]"
  16. style="width: 300px"
  17. >
  18. <template #append> k㎡ </template>
  19. </el-input-number> -->
  20. <!-- <div v-if="i.key == 'kstdmTargetArea'"></div> -->
  21. <div v-if="i.key == 'kstdmArea'">{{ typeList.data.kstdmArea }}</div>
  22. <div v-else-if="i.key == 'attachFileList'">{{ typeList.data.kstdmArea }} k㎡</div>
  23. <!-- <ImageFileUpload
  24. v-else-if="i.key == 'attachFileList'"
  25. v-model:saveFileArr="fileSaveRequestList"
  26. :listType="'text'"
  27. :refType="'KSSDMMJBL'"
  28. /> -->
  29. <div v-else-if="i.key == 'allRealValue'">
  30. {{ typeList.allRealValue }}
  31. </div>
  32. <div v-else-if="i.key == 'kstdmTargetArea'">{{ typeList.data.itemTargetval }} k㎡</div>
  33. <div v-else-if="i.key == 'itemTarget'">
  34. {{ itemTarget }}
  35. </div>
  36. <div v-else-if="i.key == 'standardFlag'">
  37. <el-tag v-if="typeList.data.standardFlag === ''" type="warning">未填报</el-tag>
  38. <el-tag v-else-if="typeList.data.standardFlag === '102'" type="warning">无法评价</el-tag>
  39. <el-tag v-else :type="typeList.data.standardFlag === '1' ? 'success' : 'error'">{{
  40. typeList.data.standardFlag === '1' ? '达标' : '未达标'
  41. }}</el-tag>
  42. </div>
  43. <div v-else>
  44. {{ FormList[i.key] }}
  45. </div>
  46. </el-form-item>
  47. </div>
  48. </el-form>
  49. <el-table :data="tableData" v-loading="tableLoading" max-height="300">
  50. <el-table-column label="项目名称" prop="projectName" />
  51. <el-table-column label="占地面积(k㎡)" prop="projectArea" />
  52. <el-table-column label="透水铺装面积(k㎡)" prop="projectKstmjArea" />
  53. </el-table>
  54. </div>
  55. </div>
  56. </template>
  57. <script setup>
  58. import { projectInfoEdit, kstdmAreaByYear } from '@/api/spongePerformance/naturalWaterArea';
  59. import { projectEstimateRules } from '@/utils/rules';
  60. import { getConfigKey } from '@/api/system/config'; //获取参数值
  61.  
  62. const { proxy } = getCurrentInstance();
  63. const tableData = ref([]);
  64. const tableLoading = ref(true);
  65. const { typeList } = defineProps(['typeList']);
  66. const emits = defineEmits();
  67. defineExpose({ submit, closed, resetFiled });
  68. const IsStandFlag1 = ref(0);
  69. const fileSaveRequestList = ref([]);
  70. let FormList = ref({ projectNo: '', fileSaveRequestList: [] });
  71. const itemTarget = computed(() => {
  72. return typeList.data?.itemDataTypePerformanceEvaluateItemList[0]?.itemTarget;
  73. });
  74.  
  75. function submit() {
  76. proxy.$refs.ruleForm.validate(valid => {
  77. if (valid) {
  78. let flay = null;
  79. if (IsStandFlag1.value > 0) flay = 1;
  80. else flay = 0;
  81. let ar = typeList.data.itemDataTypePerformanceEvaluateItemList;
  82. let arr1 = typeList.data;
  83. if (ar.length > 0) {
  84. ar[0].standardFlag = flay;
  85. ar[0].realValue = arr1.kstdmAreaRate;
  86. if (typeList.iSstandardFlag || flay == 1) {
  87. ar[0].realScore = ar[0].itemScore;
  88. } else {
  89. ar[0].realScore = 0;
  90. }
  91. } else {
  92. ar.push({
  93. standardFlag: flay,
  94. realValue: typeList.data.kstdmAreaRate,
  95. realScore: IsStandFlag1.value > 0 ? arr1.kstdmTargetArea || 0 : 0,
  96. });
  97. }
  98.  
  99. typeList.data.itemDataTypePerformanceEvaluateItemList = ar;
  100. FormList.value = {
  101. fileSaveRequestList: fileSaveRequestList.value,
  102. ...typeList.data,
  103. itemDataType: 'KSSDMMJBL',
  104. };
  105. projectInfoEdit(FormList.value).then(({ code }) => {
  106. if (code == 200) {
  107. emits('onModalClose');
  108. }
  109. });
  110. }
  111. });
  112. }
  113. function loadProjerctListData() {
  114. FormList.value = typeList.data;
  115. fileSaveRequestList.value = typeList.fileList1;
  116. IsStandFlag1.value = typeList.data.kstdmArea * 1 - (((itemTarget.value * typeList.allRealValue) / 100).toFixed(3) || 0);
  117. proxy.$refs.ruleForm.resetFields();
  118. }
  119. function resetFiled() {
  120. proxy.$refs.ruleForm.resetFields();
  121. fileSaveRequestList.value = [];
  122. }
  123. function closed() {
  124. emits('onModalClose');
  125. }
  126. function trsyAreaChange(v) {
  127. let st = v * 1 - (((itemTarget.value * typeList.allRealValue) / 100).toFixed(3) || 0);
  128. if (st >= 0) {
  129. IsStandFlag1.value = 1;
  130. typeList.data.standardFlag = '1';
  131. } else {
  132. IsStandFlag1.value = 0;
  133. typeList.data.standardFlag = '0';
  134. }
  135. FormList.value.kstdmAreaRate = ((v / typeList.allRealValue) * 100).toFixed(2) || 0;
  136. }
  137. // 获取现状天然水域面积
  138. function getAreaData() {
  139. getConfigKey(`water_kst_${typeList.data.year}`).then(res => {
  140. typeList.data.kstdmArea = res.data;
  141. });
  142. }
  143. // 获取具体项目列表
  144. async function getProjectList() {
  145. let res = await kstdmAreaByYear({ year: typeList.data.year });
  146. if (res && res.code == 200) {
  147. tableData.value = res.data;
  148. }
  149. tableLoading.value = false;
  150. }
  151. onMounted(() => {
  152. // getAreaData();
  153. loadProjerctListData();
  154. getProjectList();
  155. });
  156. </script>
  157. <style lang="scss" scoped>
  158. .water-analysis-page {
  159. padding: 20px;
  160. }
  161. </style>