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

+ 14 - 40
package-lock.json

@@ -7538,20 +7538,9 @@
       "dev": true
     },
     "codepage": {
-      "version": "1.14.0",
-      "resolved": "https://registry.npmjs.org/codepage/-/codepage-1.14.0.tgz",
-      "integrity": "sha512-iz3zJLhlrg37/gYRWgEPkaFTtzmnEv1h+r7NgZum2lFElYQPi0/5bnmuDfODHxfp0INEfnRqyfyeIJDbb7ahRw==",
-      "requires": {
-        "commander": "~2.14.1",
-        "exit-on-epipe": "~1.0.1"
-      },
-      "dependencies": {
-        "commander": {
-          "version": "2.14.1",
-          "resolved": "https://registry.npmjs.org/commander/-/commander-2.14.1.tgz",
-          "integrity": "sha512-+YR16o3rK53SmWHU3rEM3tPAh2rwb1yPcQX5irVn7mb0gXbwuCCrnkbV5+PBfETdfg1vui07nM6PCG1zndcjQw=="
-        }
-      }
+      "version": "1.15.0",
+      "resolved": "https://registry.npmmirror.com/codepage/-/codepage-1.15.0.tgz",
+      "integrity": "sha512-3g6NUTPd/YtuuGrhMnOMRjFc+LJw/bnMp3+0r/Wcz3IXUuCosKRJvMphm5+Q+bvTVGcJJuRvVLuYba+WojaFaA=="
     },
     "collection-visit": {
       "version": "1.0.0",
@@ -10885,11 +10874,6 @@
         "pend": "~1.2.0"
       }
     },
-    "fflate": {
-      "version": "0.3.11",
-      "resolved": "https://registry.nlark.com/fflate/download/fflate-0.3.11.tgz",
-      "integrity": "sha1-LEQNcYD964GeZImNiFivMnsEKl0="
-    },
     "figgy-pudding": {
       "version": "3.5.2",
       "resolved": "https://registry.npm.taobao.org/figgy-pudding/download/figgy-pudding-3.5.2.tgz",
@@ -11187,8 +11171,8 @@
     },
     "frac": {
       "version": "1.1.2",
-      "resolved": "https://registry.npm.taobao.org/frac/download/frac-1.1.2.tgz",
-      "integrity": "sha1-PXT39keMiKG1AgMG10fcYxPHTQs="
+      "resolved": "https://registry.npmmirror.com/frac/-/frac-1.1.2.tgz",
+      "integrity": "sha512-w/XBfkibaTl3YDqASwfDUqkna4Z2p9cFSr1aHDt0WoMTECnRfBOv2WArlZILlqgWlmdIlALXGpM2AOhEk5W3IA=="
     },
     "fragment-cache": {
       "version": "0.2.1",
@@ -19989,8 +19973,8 @@
     },
     "ssf": {
       "version": "0.11.2",
-      "resolved": "https://registry.npm.taobao.org/ssf/download/ssf-0.11.2.tgz",
-      "integrity": "sha1-C5lpiyN1SNCI/EPN8rcMGnUSwGw=",
+      "resolved": "https://registry.npmmirror.com/ssf/-/ssf-0.11.2.tgz",
+      "integrity": "sha512-+idbmIXoYET47hH+d7dfm2epdOMUDjqcB4648sTZ+t2JwoyBFL/insLfB/racrDmsKB3diwsDA696pZMieAC5g==",
       "requires": {
         "frac": "~1.1.2"
       }
@@ -23681,12 +23665,12 @@
     },
     "wmf": {
       "version": "1.0.2",
-      "resolved": "https://registry.npm.taobao.org/wmf/download/wmf-1.0.2.tgz",
-      "integrity": "sha1-fRnWIQcaCMK9xrfmiKnENSmMwto="
+      "resolved": "https://registry.npmmirror.com/wmf/-/wmf-1.0.2.tgz",
+      "integrity": "sha512-/p9K7bEh0Dj6WbXg4JG0xvLQmIadrner1bi45VMJTfnbVHsc7yIajZyoSoK60/dtVBs12Fm6WkUI5/3WAVsNMw=="
     },
     "word": {
       "version": "0.3.0",
-      "resolved": "https://registry.npmjs.org/word/-/word-0.3.0.tgz",
+      "resolved": "https://registry.npmmirror.com/word/-/word-0.3.0.tgz",
       "integrity": "sha512-OELeY0Q61OXpdUfTp+oweA/vtLVg5VDOXh+3he3PNzLGG/y0oylSOC1xRVj0+l4vQ3tj/bB1HVHv1ocXkQceFA=="
     },
     "word-wrap": {
@@ -23821,27 +23805,17 @@
       }
     },
     "xlsx": {
-      "version": "0.17.0",
-      "resolved": "https://registry.npmjs.org/xlsx/-/xlsx-0.17.0.tgz",
-      "integrity": "sha512-bZ36FSACiAyjoldey1+7it50PMlDp1pcAJrZKcVZHzKd8BC/z6TQ/QAN8onuqcepifqSznR6uKnjPhaGt6ig9A==",
+      "version": "0.17.5",
+      "resolved": "https://registry.npmmirror.com/xlsx/-/xlsx-0.17.5.tgz",
+      "integrity": "sha512-lXNU0TuYsvElzvtI6O7WIVb9Zar1XYw7Xb3VAx2wn8N/n0whBYrCnHMxtFyIiUU1Wjf09WzmLALDfBO5PqTb1g==",
       "requires": {
         "adler-32": "~1.2.0",
         "cfb": "^1.1.4",
-        "codepage": "~1.14.0",
-        "commander": "~2.17.1",
+        "codepage": "~1.15.0",
         "crc-32": "~1.2.0",
-        "exit-on-epipe": "~1.0.1",
-        "fflate": "^0.3.8",
         "ssf": "~0.11.2",
         "wmf": "~1.0.1",
         "word": "~0.3.0"
-      },
-      "dependencies": {
-        "commander": {
-          "version": "2.17.1",
-          "resolved": "https://registry.npmjs.org/commander/-/commander-2.17.1.tgz",
-          "integrity": "sha512-wPMUt6FnH2yzG95SA6mzjQOEKUU3aLaDEmzs1ti+1E9h+CsrZghRlqEM/EJ4KscsQVG8uNN4uVreUeT8+drlgg=="
-        }
       }
     },
     "xlsx-style": {

+ 1 - 1
package.json

@@ -54,7 +54,7 @@
     "vuedraggable": "^2.24.3",
     "vuex": "3.1.0",
     "vuex-persistedstate": "^3.0.1",
-    "xlsx": "^0.17.0",
+    "xlsx": "^0.17.5",
     "xlsx-style": "^0.8.13"
   },
   "devDependencies": {


+ 136 - 10
src/views/groupPage/districtPageModules/decisionSupport/constructionProgressSimulation/RightBox.vue

@@ -19,36 +19,136 @@
         </div>
       </div>
       <div class="bodyBox">
-        <div class="inputStopDate" v-if="planDateList.length > 0">
+        <div class="inputStopDate" v-if="planDateList.length">
           <template v-for="(item, index) in planDateList">
             <div :key="'inputStopDate_' + index" class="dateTimeDiv">
-              <div class="itemTitle">施工计划开始时间</div>
+              <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)">
-                <i class="removeDate el-icon-remove-outline" style="color:#78B6E7;"></i>
+                <i class="removeDate el-icon-remove-outline" style="color: #78b6e7"></i>
               </div>
-              <div class="addFileDiv" @click="addFile">
-                <i class="addFile el-icon-download" style="color:#78B6E7;"></i>
+              <div class="addFileDiv">
+                <input
+                  type="file"
+                  id="excelFile"
+                  accept=".xlsx, .xls"
+                  @change="handleFileChange($event, item, index)"
+                  class="file-input"
+                />
+                <i class="addFile el-icon-download" style="color: #78b6e7"></i>
               </div>
             </div>
           </template>
         </div>
+        <div class="tableBox tableBoxRight" v-if="tableData.length">
+          <el-table :data="tableData" size="mini" height="250">
+            <el-table-column prop="step" label="序号"> </el-table-column>
+            <el-table-column prop="area" label="标识"> </el-table-column>
+            <el-table-column prop="total_volume" label="任务量"> </el-table-column>
+            <el-table-column prop="machine_count" label="机械数量"> </el-table-column>
+          </el-table>
+        </div>
       </div>
     </div>
   </transition>
 </template>
 
 <script>
+import XLSX from 'xlsx'
 export default {
   data() {
     return {
       //施工计划时间段
-      planDateList: []
+      planDateList: [],
+      tableData: [
+      ]
     }
   },
-  mounted() {},
+  mounted() {
+    window.l = this.planDateList
+  },
 
   methods: {
+    handleFileChange(event, item, index) {
+      console.log(event, item)
+      this.resetState()
+      const file = event.target.files[0]
+      if (!file) return
+      this.fileName = file.name
+      this.isLoading = true
+      const reader = new FileReader()
+      reader.onload = (e) => {
+        try {
+          const data = new Uint8Array(e.target.result)
+          this.processExcelData(data, item, index)
+        } catch (err) {
+          this.error = '文件处理失败: ' + err.message
+          console.error(err)
+        } finally {
+          this.isLoading = false
+        }
+      }
+      reader.onerror = () => {
+        this.error = '文件读取失败'
+        this.isLoading = false
+      }
+      reader.readAsArrayBuffer(file)
+    },
+
+    processExcelData(data, item, index) {
+      try {
+        const workbook = XLSX.read(data, { type: 'array' })
+        const firstSheetName = workbook.SheetNames[0]
+        const worksheet = workbook.Sheets[firstSheetName]
+        const jsonData = XLSX.utils.sheet_to_json(worksheet, { header: 1 })
+        if (jsonData.length === 0) {
+          this.error = 'Excel文件中没有数据'
+          return
+        }
+        this.headers = jsonData[0]
+        this.data = jsonData.slice(1).filter((row) => row.length > 0)
+        if (this.data.length === 0) {
+          this.error = 'Excel文件中没有有效数据'
+        }
+        var data = {
+          headers: this.headers,
+          data: this.data,
+          fileName: this.fileName
+        }
+        item.table = data
+        if (!index) {
+          this.tableData = this.transformData(data);
+        }
+        console.log('data', data)
+      } catch (err) {
+        this.error = 'Excel文件解析失败: ' + err.message
+      }
+    },
+
+    transformData(originalData) {
+      const { headers, data } = originalData
+      return data.map((row) => {
+        const obj = {}
+        headers.forEach((header, index) => {
+          obj[header] = row[index]
+        })
+        return obj
+      })
+    },
+
+    changeTab(i){
+        if(i.table){
+            this.tableData = this.transformData(i.table);
+        }
+    },
+
+    resetState() {
+      this.headers = []
+      this.data = []
+      this.error = ''
+      this.isLoading = false
+    },
+
     /**
      *添加时间段
      */
@@ -59,7 +159,16 @@ export default {
       this.planDateList.push(item)
     },
 
-    addFile() {}
+        /**
+     *删除时间段
+     */
+    removePlanDate(index) {
+      if (index == -1) {
+        this.planDateList = []
+      } else {
+        this.planDateList.splice(index, 1)
+      }
+    }
   }
 }
 </script>
@@ -80,10 +189,25 @@ 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;
+}
 </style>
 <style lang='scss' scoped>
-.removeDiv,.addFileDiv{
-    cursor: pointer;
+.tableBox{
+    margin-top: 20px;
+}
+.removeDiv,
+.addFileDiv {
+  cursor: pointer;
+}
+.addFileDiv input {
+  position: absolute;
+  width: 24px;
+  height: 24px;
+  opacity: 0.01;
+  cursor: pointer;
 }
 .dateTimeDiv {
   .el-date-editor {
@@ -110,6 +234,7 @@ export default {
   font-size: 14px;
   letter-spacing: -1px;
   color: #ffffff;
+  cursor: pointer;
 }
 .dateTimeDiv {
   display: flex;
@@ -145,6 +270,7 @@ export default {
   height: calc(100% - 1.57292rem - 105px);
   width: 2.083333rem /* 400/192 */;
   color: #eee;
+    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 */;

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

@@ -1,157 +1,71 @@
+<!--
+ * @Descripttion: 地球-浙江
+ * @Author: sujunling
+ * @Date: 2025-05-19 09:10:25
+-->
 <template>
   <div class="widget-constructionProgressSimulation">
     <LeftBox />
     <RightBox />
     <BottomBox />
-    <!-- <div class="leftDiv">
-      <div class="modelHeader">
-        <div class="remarkDiv"></div>
-        <div class="titleDiv">{{leftTitle}}</div>
-        <div class="addDiv" @click="addStopDate">添加</div>
-      </div>
-      <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" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
-            <div class="removeDiv" @click="removeStopDate(index)">
-              <i  class="removeDate el-icon-remove-outline"></i>
-            </div>
-          </div>
-        </template>
-      </div>
-      <div class="bottonListDiv">
-        <el-button type="primary" @click="removeStopDate(-1)">重置</el-button>
-        <el-button type="primary" @click="saveStopDate">确认</el-button>
-      </div>
-    </div> -->
-    <div class="rightDiv">
-      <div class="parameterHeader">
-        <div class="remarkDiv"></div>
-        <div class="titleDiv">{{rightTitle}}</div>
-        <div class="addDiv" @click="addPlanDate">添加</div>
-      </div>
-      <div class="inputStopDate" v-if="planDateList.length>0">
-        <template v-for="(item,index) in planDateList">
-          <div :key="'inputStopDate_'+index" class="dateTimeDiv">
-            <div class="itemTitle">施工计划开始时间</div>
-            <el-date-picker v-model="item.value" type="date" placeholder="请选择时间"></el-date-picker>
-            <div class="removeDiv" @click="removePlanDate(index)">
-              <i  class="removeDate el-icon-remove-outline"></i>
-            </div>
-            <div class="addFileDiv" @click="addFile">
-              <i  class="addFile el-icon-download"></i>
-            </div>
-          </div>
-        </template>
-      </div>
-    </div>
-    <div class="bottomDiv">
-      <div class="bottomHeader">
-        <div class="headerInfo">
-          <div class="remarkDiv"></div>
-          <div class="titleDiv">{{bottomTitle}}</div>
-        </div>
-        <div class="projectList" v-if="projectList.length>0">
-          <template v-for="(item,index) in projectList">
-            <div :key="'projectDiv_'+index" class="projectDiv">
-              
-            </div>
-          </template>
-        </div>
-      </div>  
-    </div>
   </div>
 </template>
 
-<script lang="ts">
-import { Vue, Component, Prop } from 'vue-property-decorator'
+<script>
 import LeftBox from './LeftBox.vue'
 import RightBox from './RightBox.vue'
 import BottomBox from './BottomBox.vue'
 
-
-//智慧预警模块
-@Component({
+export default {
   name: 'constructionProgressSimulation',
-  components: { constructionProgressSimulation, LeftBox, RightBox, BottomBox }
-})
-export default class constructionProgressSimulation extends Vue {
-  leftTitle = '停工日期设置';
-  rightTitle = '施工进度控制模拟参数';
-  bottomTitle='进度模拟方案';
-  //停工时间段
-  stopDateList=[];
-  //施工计划时间段
-  planDateList=[];
-  //方案列表
-  projectList=[];
-  mounted() {
-  }
-
-  /**
-   *添加时间段
-  */
-  addStopDate(){
-    const item={
-      value:""
-    }
-    this.stopDateList.push(item)
-  };
-
-  /**
-   *删除时间段
-  */
-  removeStopDate(index){
-    if(index==-1){
-      this.stopDateList=[];
-    }else{
-      this.stopDateList.splice(index,1)
+  components: { LeftBox, RightBox, BottomBox },
+  data() {
+    return {
+      data: {
+        c_puct: 0,
+        n_playout: 0,
+        start_date: '2025-05-21T05:41:33.376Z',
+        conversion_date: '2025-05-21T05:41:33.376Z',
+        rain_intervals: [
+          {
+            start: '2025-05-21T05:41:33.376Z',
+            end: '2025-05-21T05:41:33.376Z'
+          }
+        ]
+      }
     }
-  }
-
-  /**保存停工日期**/
-  saveStopDate(){
+  },
+  mounted() {},
 
-  }
+  methods: {
+    getData() {
+      fetch('http://127.0.0.1:8000/run', {
+        method: 'POST',
+        data: JSON.stringify(this.data)
+      })
+        .then(function (e) {
+          return e.json()
+        })
+        .then(function (r) {
+          callback(r)
+        })
+    },
 
     /**
-   *添加时间段
-  */
-  addPlanDate(){
-    const item={
-      value:""
-    }
-    this.planDateList.push(item)
-  };
+     *添加时间段
+     */
+    addPlanDate() {
+      const item = {
+        value: ''
+      }
+      this.planDateList.push(item)
+    },
 
-  /**
-   *删除时间段
-  */
-  removePlanDate(index){
-    if(index==-1){
-      this.planDateList=[];
-    }else{
-      this.planDateList.splice(index,1)
-    }
+    addFile() {}
   }
-
-  /**
-   * 保存施工计划
-   **/
-  addFile(){
-
-  }
-
 }
 </script>
+</script>
 
 <style scoped>
-.removeDate{
-  color:aqua
-}
-.widget-constructionProgressSimulation{
-}
-.leftDiv{
-
-}
 </style>