Newer
Older
KaiFengPC / src / views / spongePerformance / rainwaterResourceUtilization / tableDalgo.vue
@zhangdeliang zhangdeliang on 23 May 6 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. <el-form-item label="考核年份" prop="year">
  6. <el-input v-model="FormList.year" disabled="true" />
  7. </el-form-item>
  8. <el-form-item label="目标雨水资源化利用(万吨/年)" prop="itemTarget">
  9. <el-input v-model="FormList.itemTarget" disabled="true" />
  10. </el-form-item>
  11. <el-form-item label="建筑小区雨水资源利用量(万吨/年)" prop="realValue">
  12. <el-input-number
  13. v-model="FormList.buildingYszyly"
  14. controls-position="right"
  15. :min="0"
  16. :precision="2"
  17. :step="0.1"
  18. style="width: 300px"
  19. />
  20. </el-form-item>
  21. <el-table :data="tableData1" max-height="300">
  22. <el-table-column label="序号" type="index" width="55" />
  23. <el-table-column label="项目名称" prop="yslyName" />
  24. <el-table-column label="占地面积(公顷)" prop="area" />
  25. <el-table-column label="年雨水资源化利用量(万吨)" prop="yslyAmount" />
  26. </el-table>
  27. <el-divider></el-divider>
  28. <el-form-item label="景观水体雨水资源利用量(万吨/年)" prop="realValue">
  29. <el-input-number
  30. v-model="FormList.waterYszyly"
  31. controls-position="right"
  32. :min="0"
  33. :precision="2"
  34. :step="0.1"
  35. style="width: 300px"
  36. />
  37. </el-form-item>
  38. <el-table :data="tableData2" max-height="300">
  39. <el-table-column label="序号" type="index" width="55" />
  40. <el-table-column label="景观水体名称" prop="yslyName" />
  41. <el-table-column label="占地面积(公顷)" prop="area" />
  42. <el-table-column label="年雨水资源化利用量(万吨)" prop="yslyAmount" />
  43. </el-table>
  44. <!-- <div v-for="i in typeList.monitorDynamicTableTitleList" style="display: flex; flex-direction: column">
  45. <el-form-item :label="i.value + ':'" :prop="i.key" :disabled="typeList.type == 1 || typeList.type == 2">
  46. <el-input-number
  47. v-if="i.key == 'realValue'"
  48. :placeholder="i.value"
  49. :min="0"
  50. :precision="2"
  51. :step="0.1"
  52. style="width: 300px"
  53. @change="trsyAreaChange"
  54. v-model="FormList[i.key]"
  55. >
  56. </el-input-number>
  57.  
  58. <div v-else-if="i.key == 'itemTarget'">
  59. {{ itemTarget }}
  60. </div>
  61. <div v-else>
  62. {{ FormList[i.key] }}
  63. </div>
  64. </el-form-item>
  65. </div> -->
  66. </el-form>
  67. </div>
  68. </div>
  69. </template>
  70. <script setup>
  71. import { projectInfoEdit, yszylyDetailList } from '@/api/spongePerformance/naturalWaterArea';
  72. import { projectEstimateRules } from '@/utils/rules';
  73. import { ref } from 'vue';
  74. const { proxy } = getCurrentInstance();
  75.  
  76. const { typeList } = defineProps(['typeList']);
  77. const tableData1 = ref([]);
  78. const tableData2 = ref([]);
  79. const configId = ref('');
  80. const emits = defineEmits();
  81. defineExpose({ submit, closed, resetFiled });
  82. const IsStandFlag1 = ref(0);
  83. const fileSaveRequestList = ref([]);
  84. let FormList = ref({});
  85. const itemTarget = computed(() => {
  86. return typeList.data?.itemDataTypePerformanceEvaluateItemList[0]?.itemTarget || 0;
  87. });
  88. const realScore = computed(() => {
  89. return typeList.data?.itemDataTypePerformanceEvaluateItemList[0]?.realScore || 0;
  90. });
  91.  
  92. function submit() {
  93. proxy.$refs.ruleForm.validate(valid => {
  94. if (valid) {
  95. let arr = typeList.data.itemDataTypePerformanceEvaluateItemList;
  96. let flay = null;
  97. if (IsStandFlag1.value > 0) flay = 1;
  98. else flay = 0;
  99. if (arr.length == 0) {
  100. arr.push({
  101. standardFlag: IsStandFlag1.value || 0,
  102. realValue: FormList.value.realValue,
  103. realScore: FormList.value.realScore,
  104. });
  105. } else {
  106. arr[0].standardFlag = typeList.data.standardFlag;
  107. arr[0].realValue = FormList.value.realValue;
  108. if (typeList.data.standardFlag == '0') arr[0].realScore = 0;
  109. else arr[0].realScore = arr[0].itemScore;
  110. }
  111. // arr[0].realValue =FormList.value.realScore;
  112. typeList.data.itemDataTypePerformanceEvaluateItemList = arr;
  113. FormList.value = {
  114. fileSaveRequestList: fileSaveRequestList.value,
  115. ...typeList.data,
  116. itemDataType: 'YSZYHLY',
  117. };
  118. projectInfoEdit(FormList.value).then(({ code }) => {
  119. if (code == 200) {
  120. emits('onModalClose');
  121. }
  122. });
  123. }
  124. });
  125. }
  126. // function loadProjerctListData() {
  127. // FormList.value = typeList.data;
  128.  
  129. // configId.value = typeList.data.id;
  130. // console.log(configId.value, ' `````````typeList`````````');
  131. // console.log(typeList.data, ' typeList');
  132. // FormList.value.itemTarget = typeList.data.itemDataTypePerformanceEvaluateItemList[0]?.itemTarget || 0;
  133. // FormList.value.realValue = typeList.data.itemDataTypePerformanceEvaluateItemList[0]?.realValue || 0;
  134. // fileSaveRequestList.value = typeList.fileList1;
  135. // FormList.value.realScore = realScore.value;
  136.  
  137. // proxy.$refs.ruleForm.resetFields();
  138. // }
  139. //业务分页查询海绵考核评估项数据类型
  140. const loadProjerctListData = async id => {
  141. FormList.value = typeList.data;
  142. configId.value = typeList.data.id;
  143. FormList.value.itemTarget = typeList.data.itemDataTypePerformanceEvaluateItemList[0]?.itemTarget || 0;
  144. FormList.value.realValue = typeList.data.itemDataTypePerformanceEvaluateItemList[0]?.realValue || 0;
  145.  
  146. fileSaveRequestList.value = typeList.fileList1;
  147. FormList.value.realScore = realScore.value;
  148. proxy.$refs.ruleForm.resetFields();
  149. let res = await yszylyDetailList({
  150. configId: configId.value,
  151. });
  152. if (res && res.code == 200) {
  153. console.log(res, 9999999999999999999);
  154. let dats = res.data;
  155. FormList.value.buildingYszyly = dats.buildingYszyly;
  156. FormList.value.waterYszyly = dats.waterYszyly;
  157. tableData1.value = dats.buildingList;
  158. tableData2.value = dats.waterList;
  159. }
  160. };
  161.  
  162. function resetFiled() {
  163. proxy.$refs.ruleForm.resetFields();
  164. fileSaveRequestList.value = [];
  165. }
  166. function closed() {
  167. emits('onModalClose');
  168. }
  169. function trsyAreaChange(v) {
  170. typeList.iSstandardFlag = 0;
  171. let st = v * 1 - (itemTarget.value || 0);
  172. if (st >= 0) {
  173. IsStandFlag1.value = 1;
  174. typeList.data.standardFlag = '1';
  175. } else {
  176. IsStandFlag1.value = 0;
  177. typeList.data.standardFlag = '0';
  178. }
  179. }
  180. onMounted(() => {
  181. loadProjerctListData();
  182. });
  183. </script>
  184. <style lang="scss" scoped>
  185. .water-analysis-page {
  186. padding: 20px;
  187. }
  188. </style>