Переглянути джерело

增加了没有数据提示和接口初步对接

sujunling 5 місяців тому
батько
коміт
1c52aa87c7

BIN
src/assets/images/jczc/noData.png


BIN
src/assets/images/jczc/noData2.png


+ 9 - 3
src/views/groupPage/districtPageModules/decisionSupport/constructionProgressSimulation/BottomBox.vue

@@ -28,8 +28,8 @@
           <i class="export-file" @click="project">导出project文件</i>
         </div>
       </div>
-      <div class="but_table">
-        <el-table :data="tableData" size="mini" style="width: 100%" height="230">
+      <div class="but_table" :class="{activeNoData2: tableData.length == 0}">
+        <el-table v-if="tableData.length" :data="tableData" size="mini" style="width: 100%" height="230">
           <el-table-column prop="num" label="序号"> </el-table-column>
           <el-table-column prop="date" label="施工工序"> </el-table-column>
           <el-table-column prop="name" label="联合单元" width="200"> </el-table-column>
@@ -162,7 +162,8 @@ export default {
           '2025-04-26': 1,
           '2025-04-27': 1
         }
-      ]
+      ],
+      tableData:[]
     }
   },
   mounted() {
@@ -235,6 +236,11 @@ export default {
 .but_table .el-table--border::after, .but_table .el-table--group::after, .but_table .el-table::before{
     background-color: rgba(14, 167, 255, 0);
 }
+.activeNoData2{
+  height: 100%;
+  background: url('~@/assets/images/jczc/noData2.png') no-repeat center center;
+  background-size: 102px 74px;
+}
 </style>
 <style lang='scss' scoped>
 .export-file {

+ 37 - 28
src/views/groupPage/districtPageModules/decisionSupport/constructionProgressSimulation/LeftBox.vue

@@ -13,13 +13,15 @@
           <div class="addDiv" @click="addStopDate"></div>
         </div>
       </div>
-      <div class="bodyBox">
+      <div class="bodyBox" :class="{activeNoData: stopDateList.length == 0}">
         <div class="inputStopDate" v-if="stopDateList.length > 0">
           <template v-for="(item, index) in stopDateList">
             <div :key="'inputStopDate_' + index" class="dateTimeDiv">
               <el-date-picker
                 v-model="item.value"
                 type="daterange"
+                format="yyyy-MM-dd HH:mm:ss"
+                value-format="yyyy-MM-dd HH:mm:ss"
                 range-separator="至"
                 start-placeholder="开始日期"
                 end-placeholder="结束日期"
@@ -30,7 +32,7 @@
             </div>
           </template>
         </div>
-        <div class="tableBox">
+        <div class="tableBox" v-if="tableData.length">
           <div class="title">【方案1】因停工导致延期的施工工序</div>
           <el-table :data="tableData" size="mini" style="width: 100%" height="250">
             <el-table-column prop="date" label="施工工序" width="88"> </el-table-column>
@@ -56,32 +58,33 @@ export default {
     return {
       //进度模拟方案
       stopDateList: [],
-      tableData: [
-        {
-          date: '第一层土方开挖',
-          name: '区域A,区域B,区域C,区域D',
-          num1: 5,
-          num2: 10
-        },
-        {
-          date: '第一层土方开挖',
-          name: '区域A,区域B,区域C,区域D',
-          num1: 5,
-          num2: 10
-        },
-        {
-          date: '第一层土方开挖',
-          name: '区域A,区域B,区域C,区域D',
-          num1: 5,
-          num2: 10
-        },
-        {
-          date: '第一层土方开挖',
-          name: '区域A,区域B,区域C,区域D',
-          num1: 5,
-          num2: 10
-        }
-      ]
+      tableData:[],
+    //   tableData: [
+    //     {
+    //       date: '第一层土方开挖',
+    //       name: '区域A,区域B,区域C,区域D',
+    //       num1: 5,
+    //       num2: 10
+    //     },
+    //     {
+    //       date: '第一层土方开挖',
+    //       name: '区域A,区域B,区域C,区域D',
+    //       num1: 5,
+    //       num2: 10
+    //     },
+    //     {
+    //       date: '第一层土方开挖',
+    //       name: '区域A,区域B,区域C,区域D',
+    //       num1: 5,
+    //       num2: 10
+    //     },
+    //     {
+    //       date: '第一层土方开挖',
+    //       name: '区域A,区域B,区域C,区域D',
+    //       num1: 5,
+    //       num2: 10
+    //     }
+    //   ]
     }
   },
   mounted() {
@@ -164,6 +167,12 @@ export default {
 .tableBox .el-table .el-table__cell{
     padding: 0px;
 }
+.activeNoData{
+  height: 100%;
+  background: url('~@/assets/images/jczc/noData.png') no-repeat top right;
+  background-size: 202.4px 307.5px;
+  background-position-x: 107px;
+}
 </style>
 <style lang="scss" scoped>
 .bodyBox {

+ 57 - 25
src/views/groupPage/districtPageModules/decisionSupport/constructionProgressSimulation/RightBox.vue

@@ -22,9 +22,16 @@
         <div class="inputStopDate" v-if="planDateList.length">
           <template v-for="(item, index) in planDateList">
             <div :key="'inputStopDate_' + index" class="dateTimeDiv">
-              <div class="itemTitle" @click="changeTab(item)">施工计划开始时间</div>
-              <el-date-picker v-model="item.value" type="date" placeholder="请选择时间"></el-date-picker>
-              <div class="removeDiv" @click="removePlanDate(index)">
+              <div class="itemTitle" v-if="index" @click="changeTab(item)">施工调整开始时间</div>
+              <div class="itemTitle" v-else @click="changeTab(item)">施工计划开始时间</div>
+              <el-date-picker
+                format="yyyy-MM-dd HH:mm:ss"
+                value-format="yyyy-MM-dd HH:mm:ss"
+                v-model="item.value"
+                type="date"
+                placeholder="请选择时间"
+              ></el-date-picker>
+              <div class="removeDiv" @click="removePlanDate(index)" v-if="index">
                 <i class="removeDate el-icon-remove-outline" style="color: #78b6e7"></i>
               </div>
               <div class="addFileDiv">
@@ -59,9 +66,12 @@ export default {
   data() {
     return {
       //施工计划时间段
-      planDateList: [],
-      tableData: [
-      ]
+      planDateList: [
+        {
+          value: ''
+        }
+      ],
+      tableData: []
     }
   },
   mounted() {
@@ -69,11 +79,29 @@ export default {
   },
 
   methods: {
+    updateFile(f,item, k) {
+      const formData = new FormData()
+      formData.append('file', f)
+      formData.append('name', k ? 'construction_data_2' : 'construction_data_1')
+      fetch('http://127.0.0.1:8000/upload-file', {
+        method: 'POST',
+        body: formData
+      })
+        .then((response) => response.json())
+        .then((r) => {
+            if(r && r.code == 1){
+                this.$message.success(k ? '施工调整表格数据上传成功!' : '施工计划表格数据上传成功!')
+                item.file = r.result;
+            }
+        })
+    },
+
     handleFileChange(event, item, index) {
       console.log(event, item)
       this.resetState()
       const file = event.target.files[0]
       if (!file) return
+      this.updateFile(file, item, index);
       this.fileName = file.name
       this.isLoading = true
       const reader = new FileReader()
@@ -117,7 +145,7 @@ export default {
         }
         item.table = data
         if (!index) {
-          this.tableData = this.transformData(data);
+          this.tableData = this.transformData(data)
         }
         console.log('data', data)
       } catch (err) {
@@ -136,10 +164,10 @@ export default {
       })
     },
 
-    changeTab(i){
-        if(i.table){
-            this.tableData = this.transformData(i.table);
-        }
+    changeTab(i) {
+      if (i.table) {
+        this.tableData = this.transformData(i.table)
+      }
     },
 
     resetState() {
@@ -153,20 +181,24 @@ export default {
      *添加时间段
      */
     addPlanDate() {
-      const item = {
-        value: ''
+      if (this.planDateList.length < 2) {
+        const item = {
+          value: ''
+        }
+        this.planDateList.push(item)
       }
-      this.planDateList.push(item)
     },
 
-        /**
+    /**
      *删除时间段
      */
     removePlanDate(index) {
-      if (index == -1) {
-        this.planDateList = []
-      } else {
-        this.planDateList.splice(index, 1)
+      if (this.planDateList.length > 1) {
+        if (index == -1) {
+          this.planDateList = []
+        } else {
+          this.planDateList.splice(index, 1)
+        }
       }
     }
   }
@@ -189,14 +221,14 @@ export default {
 .dateTimeDiv .el-date-editor .el-input__prefix .el-input__icon {
   line-height: 30px;
 }
-.tableBoxRight .el-table th.el-table__cell > .cell{
-    background: rgba(43 ,167 ,255,0.16);;
-    color: #2BA7FF;
+.tableBoxRight .el-table th.el-table__cell > .cell {
+  background: rgba(43, 167, 255, 0.16);
+  color: #2ba7ff;
 }
 </style>
 <style lang='scss' scoped>
-.tableBox{
-    margin-top: 20px;
+.tableBox {
+  margin-top: 20px;
 }
 .removeDiv,
 .addFileDiv {
@@ -270,7 +302,7 @@ export default {
   height: calc(100% - 1.57292rem - 105px);
   width: 2.083333rem /* 400/192 */;
   color: #eee;
-    overflow: hidden;
+  overflow: hidden;
   background: linear-gradient(0deg, rgba(14, 167, 255, 0.24) 0%, rgba(14, 167, 255, 0.05) 100%);
   .head {
     height: 0.166667rem /* 32/192 */;

+ 133 - 13
src/views/groupPage/districtPageModules/decisionSupport/constructionProgressSimulation/index.vue

@@ -5,9 +5,13 @@
 -->
 <template>
   <div class="widget-constructionProgressSimulation">
-    <LeftBox />
-    <RightBox />
-    <BottomBox />
+    <LeftBox ref="LeftBox" />
+    <RightBox ref="RightBox" />
+    <BottomBox ref="BottomBox" />
+    <div class="modelListDiv">
+      <i>大公桥调蓄池施工进度模拟</i>
+      <b @click="start">开始模拟</b>
+    </div>
   </div>
 </template>
 
@@ -22,32 +26,110 @@ export default {
   data() {
     return {
       data: {
-        c_puct: 0,
-        n_playout: 0,
+        c_puct: Math.sqrt(2),
+        n_playout: 2000,
         start_date: '2025-05-21T05:41:33.376Z',
         conversion_date: '2025-05-21T05:41:33.376Z',
+        rain_intervals: []
+      }
+    }
+  },
+  mounted() {
+    window.init = () => {
+      var data = {
+        c_puct: 1.4142135623730951,
+        n_playout: 2000,
+        start_date: '2025-05-01 00:00:00',
+        conversion_date: '2025-05-05 00:00:00',
         rain_intervals: [
-          {
-            start: '2025-05-21T05:41:33.376Z',
-            end: '2025-05-21T05:41:33.376Z'
-          }
+          { start: '2025-05-01 00:00:00', end: '2025-05-02 00:00:00' },
+          { start: '2025-05-07 00:00:00', end: '2025-05-08 00:00:00' }
         ]
       }
+      this.getData(data)
     }
   },
-  mounted() {},
 
   methods: {
-    getData() {
+    start() {
+      var l = this.$refs.LeftBox.stopDateList
+      if (l && l.length) {
+        l.map((i) => {
+          if (i && i.value) {
+            this.data.rain_intervals.push({
+              start: i.value[0],
+              end: i.value[1]
+            })
+          }
+        })
+      } else {
+        return this.$message.error('请填写完整的计划时间!')
+      }
+      var l1 = this.$refs.RightBox.planDateList
+      if (l1 && l1.length && l1.length == 2) {
+        l1.map((i, k) => {
+          if (i && i.value && !k) {
+            if (i.file) {
+              this.data.start_date = i.value
+            } else {
+              return this.$message.error('请上传施工计划表格!')
+            }
+          } else if (i && i.value && k) {
+            if (i.file) {
+              this.data.conversion_date = i.value
+            } else {
+              return this.$message.error('请上传施工调整计划表格!')
+            }
+          }
+        })
+      } else {
+        return this.$message.error('请填写完整的开始计划时间和调整计划时间!')
+      }
+      this.getData(this.data)
+    },
+
+    getData(data, callback) {
+      callback({
+        all_results: [
+          {
+            num_boards: 0,
+            time_score: -355.27702702702703
+          },
+          {
+            num_boards: 1,
+            time_score: -308.80349511213336
+          },
+          {
+            num_boards: 2,
+            time_score: -262.1426045620088
+          },
+          {
+            num_boards: 3,
+            time_score: -226.80023155069966
+          },
+          {
+            num_boards: 4,
+            time_score: -224.421390070922
+          }
+        ],
+        best_num_boards: 4,
+        best_time_score: -224.421390070922,
+        mpp_file: null
+      })
+      return
       fetch('http://127.0.0.1:8000/run', {
         method: 'POST',
-        data: JSON.stringify(this.data)
+        headers: {
+          'Content-Type': 'application/json'
+        },
+        body: JSON.stringify(data)
       })
         .then(function (e) {
           return e.json()
         })
         .then(function (r) {
-          callback(r)
+          console.log('分析结果:', r)
+          callback && callback(r)
         })
     },
 
@@ -68,4 +150,42 @@ export default {
 </script>
 
 <style scoped>
+.modelListDiv b {
+  font-weight: bold;
+  font-size: 16px;
+  color: #feffff;
+  width: 100px;
+  height: 34px;
+  background: #2187d3;
+  border-radius: 4px;
+  opacity: 0.9;
+  line-height: 34px;
+  position: absolute;
+  left: 70px;
+  top: 115px;
+  text-align: center;
+  display: inline-block;
+  cursor: pointer;
+}
+.modelListDiv {
+  position: fixed;
+  top: 100px;
+  left: 42%;
+  z-index: 9;
+}
+.modelListDiv i {
+  font-weight: bold;
+  font-size: 20px;
+  color: #feffff;
+  width: 395px;
+  height: 38px;
+  line-height: 38px;
+  background: url('~@/assets/images/jczc/title.png') no-repeat center;
+  background-size: 395px 38px;
+  position: absolute;
+  left: -72px;
+  top: 60px;
+  text-align: center;
+  display: inline-block;
+}
 </style>

+ 1 - 35
src/views/groupPage/districtPageModules/decisionSupport/index.vue

@@ -16,8 +16,6 @@
           <span>{{ item.title }}</span>
         </div>
       </template>
-      <i>大公桥调蓄池施工进度模拟</i>
-      <b>开始模拟</b>
     </div>
     <div class="componentDiv">
       <component :is="currentModelComponent"></component>
@@ -71,42 +69,10 @@ export default {
 </script>
 
 <style scoped>
-.modelListDiv i {
-  font-weight: bold;
-  font-size: 20px;
-  color: #feffff;
-  width: 395px;
-  height: 38px;
-  line-height: 38px;
-  background: url('~@/assets/images/jczc/title.png') no-repeat center;
-  background-size: 395px 38px;
-  position: absolute;
-  left: -72px;
-  top: 60px;
-  text-align: center;
-  display: inline-block;
-}
-.modelListDiv b {
-  font-weight: bold;
-  font-size: 16px;
-  color: #feffff;
-  width: 100px;
-  height: 34px;
-  background: #2187d3;
-  border-radius: 4px;
-  opacity: 0.9;
-  line-height: 34px;
-  position: absolute;
-  left: 70px;
-  top: 115px;
-  text-align: center;
-  display: inline-block;
-  cursor: pointer;
-}
 .modelListDiv {
   position: fixed;
   top: 100px;
-  left: 46%;
+  left: 42%;
   z-index: 9;
 }
 .modelListDiv .modelItem {