rui.jiang 11 miesięcy temu
rodzic
commit
7c23aad82f

+ 1 - 1
src/styles/base.css

@@ -251,7 +251,7 @@ body {
 
 /* 外边框 */
 .global-variable {
-  margin: 20px;
+  margin: 18px;
   padding: 20px;
   background: #ffffff;
   min-height: 89vh;

+ 3 - 3
src/views/ledger/anemometer.vue

@@ -79,19 +79,19 @@
           width="200"
         >
         </el-table-column>
-        <el-table-column prop="state" align="center" label="状态" width="100">
+        <el-table-column prop="state" align="center" label="状态" width="80">
           <template slot-scope="{ row }">
             {{ row.state == 1 ? "启用" : "停用" }}
           </template>
         </el-table-column>
-        <el-table-column prop="createTime" align="center" label="创建时间">
+        <el-table-column prop="createTime" align="center" label="创建时间"      width="160">
         </el-table-column>
         <el-table-column
           prop="transition"
           align="center"
           fixed="right"
           label="操作"
-          width="200"
+          width="150"
         >
           <template slot-scope="scope">
             <el-button @click="compile(scope.row)" type="text" size="small"

+ 4 - 4
src/views/ledger/draught.vue

@@ -89,18 +89,18 @@
           prop="sightcing"
           align="center"
           label="是否标杆"
-          width="100"
+          width="80"
         >
           <template slot-scope="{ row }">
             {{ row.sightcing == 1 ? "是" : "否" }}
           </template>
         </el-table-column>
-        <el-table-column prop="state" align="center" label="状态" width="100">
+        <el-table-column prop="state" align="center" label="状态" width="80">
           <template slot-scope="{ row }">
             {{ row.state == 1 ? "启用" : "停用" }}
           </template>
         </el-table-column>
-        <el-table-column prop="createTime" align="center" label="创建时间">
+        <el-table-column prop="createTime" align="center" label="创建时间" width="140">
         </el-table-column>
 
         <el-table-column
@@ -108,7 +108,7 @@
           align="center"
           fixed="right"
           label="操作"
-          width="200"
+          width="160"
         >
           <template slot-scope="scope">
             <el-button @click="compile(scope.row)" type="text" size="small"

+ 171 - 36
src/views/ledger/enterprise.vue

@@ -3,37 +3,64 @@
     <div class="condition">
       <el-form :inline="true" :model="formInline" class="demo-form-inline">
         <el-form-item label="单位名称:">
-          <el-input v-model="formInline.companyName" placeholder="请输入单位名称" size="small"></el-input>
+          <el-input
+            v-model="formInline.companyName"
+            placeholder="请输入单位名称"
+            size="small"
+          ></el-input>
         </el-form-item>
         <el-form-item label="状态:">
-          <el-select v-model="formInline.state" placeholder="选择状态" size="small ">
+          <el-select
+            v-model="formInline.state"
+            placeholder="选择状态"
+            size="small "
+          >
             <el-option label="启用" value="1"></el-option>
             <el-option label="停用" value="0"></el-option>
           </el-select>
         </el-form-item>
         <el-form-item>
-          <el-button type="primary" @click="getTableList" size="small">查询</el-button>
+          <el-button type="primary" @click="getTableList" size="small"
+            >查询</el-button
+          >
           <el-button @click="reset" size="small">重置</el-button>
         </el-form-item>
       </el-form>
     </div>
     <div class="list-page">
       <div class="newly">
-        <el-button type="primary" @click="newnuedialog" size="small">新增</el-button>
+        <el-button type="primary" @click="newnuedialog" size="small"
+          >新增</el-button
+        >
         <el-button type="primary" @click="toggleExpandAll" size="small">{{
           defaultExpandAll ? "收起" : "展开"
         }}</el-button>
       </div>
 
-      <el-table class="center-align-table" ref="table" :data="tableData" border :cell-style="rowStyle" stripe
-        row-key="id" default-expand-all :tree-props="{ children: 'children', hasChildren: 'hasChildren' }">
+      <el-table
+        class="center-align-table"
+        ref="table"
+        :data="tableData"
+        border
+        :cell-style="rowStyle"
+        stripe
+        row-key="id"
+        default-expand-all
+        :tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
+         
+      >
         <!-- Table Columns -->
         <el-table-column fixed prop="codeName" align="center" label="单位名称">
         </el-table-column>
         <el-table-column prop="companyCode" align="center" label="单位ID">
         </el-table-column>
 
-        <el-table-column prop="fieldCount" align="center" label="风场数量" width="200">
+        <el-table-column
+          prop="fieldCount"
+          align="center"
+          label="风场数量"
+          width="200"
+        >
           <template slot-scope="scope">
             <el-button @click="particulars(scope.row)" type="text" size="small">
               {{ scope.row.fieldCount }}
@@ -51,13 +78,45 @@
             {{ $formatDate(row.createTime) }}
           </template>
         </el-table-column>
-        <el-table-column prop="state" align="center" fixed="right" label="操作" width="200">
+        <el-table-column
+          prop="state"
+          align="center"
+          fixed="right"
+          label="操作"
+          width="200"
+        >
           <template slot-scope="scope">
-            <el-button @click="compile(scope.row)" type="text" size="small">编辑</el-button>
-            <el-button @click="newcomer(scope.row, 'addChild')" type="text" size="small">新增</el-button>
-            <el-button v-if="scope.row.state == 0" @click="start(scope.row, 1)" type="text" size="small">启用</el-button>
-            <el-button v-else style="color: #666" @click="start(scope.row, 0)" type="text" size="small">停用</el-button>
-            <el-button style="color: #f00" @click="deleted(scope.row)" type="text" size="small">删除</el-button>
+            <el-button @click="compile(scope.row)" type="text" size="small"
+              >编辑</el-button
+            >
+            <el-button
+              @click="newcomer(scope.row, 'addChild')"
+              type="text"
+              size="small"
+              >新增</el-button
+            >
+            <el-button
+              v-if="scope.row.state == 0"
+              @click="start(scope.row, 1)"
+              type="text"
+              size="small"
+              >启用</el-button
+            >
+            <el-button
+              v-else
+              style="color: #666"
+              @click="start(scope.row, 0)"
+              type="text"
+              size="small"
+              >停用</el-button
+            >
+            <el-button
+              style="color: #f00"
+              @click="deleted(scope.row)"
+              type="text"
+              size="small"
+              >删除</el-button
+            >
           </template>
         </el-table-column>
       </el-table>
@@ -65,34 +124,80 @@
 
     <!-- 弹出层 -->
     <!-- 新增 -->
-    <el-dialog :title="title" :visible.sync="nuedialog" width="380px" @close="handleClose">
-      <el-form ref="newform" :rules="rules" :model="newform" label-width="90px" class="form-margin">
+    <el-dialog
+      :title="title"
+      :visible.sync="nuedialog"
+      width="380px"
+      @close="handleClose"
+    >
+      <el-form
+        ref="newform"
+        :rules="rules"
+        :model="newform"
+        label-width="90px"
+        class="form-margin"
+      >
         <el-form-item label="单位名称:" prop="companyName">
           <el-input v-model="newform.companyName" size="small"></el-input>
         </el-form-item>
         <el-form-item label="所属省:" prop="province">
-          <el-select v-model="newform.province" placeholder="请选择" size="small" value-key="areaId" @change="fetchCities">
-            <el-option v-for="item in shengdata" :key="item.areaId" :label="item.province" :value="item"></el-option>
+          <el-select
+            v-model="newform.province"
+            placeholder="请选择"
+            size="small"
+            value-key="areaId"
+            @change="fetchCities"
+          >
+            <el-option
+              v-for="item in shengdata"
+              :key="item.areaId"
+              :label="item.province"
+              :value="item"
+            ></el-option>
           </el-select>
         </el-form-item>
         <el-form-item label="所属市:" prop="city">
-          <el-select v-model="newform.city" placeholder="请选择" size="small" value-key="areaId" @change="$forceUpdate()">
-            <el-option v-for="item in shidata" :key="item.areaId" :label="item.city" :value="item"></el-option>
+          <el-select
+            v-model="newform.city"
+            placeholder="请选择"
+            size="small"
+            value-key="areaId"
+            @change="$forceUpdate()"
+          >
+            <el-option
+              v-for="item in shidata"
+              :key="item.areaId"
+              :label="item.city"
+              :value="item"
+            ></el-option>
           </el-select>
         </el-form-item>
         <el-form-item label="备注:">
-          <el-input v-model="newform.described" size="small" type="textarea"></el-input>
+          <el-input
+            v-model="newform.described"
+            size="small"
+            type="textarea"
+          ></el-input>
         </el-form-item>
       </el-form>
       <span slot="footer" class="dialog-footer">
         <el-button @click="nuedialog = false" size="small">取 消</el-button>
-        <el-button type="primary" @click="newly('newform')" size="small">确 定</el-button>
+        <el-button type="primary" @click="newly('newform')" size="small"
+          >确 定</el-button
+        >
       </span>
     </el-dialog>
 
     <!-- 风场数量 -->
     <el-dialog title="风场数量" :visible.sync="unusualdialog" width="1000px">
-      <el-table class="center-align-table" :data="FCtableData" border :cell-style="rowStyle" stripe max-height="500">
+      <el-table
+        class="center-align-table"
+        :data="FCtableData"
+        border
+        :cell-style="rowStyle"
+        stripe
+        max-height="500"
+      >
         <!-- Table Columns -->
         <el-table-column fixed prop="fieldName" align="center" label="风场名称">
         </el-table-column>
@@ -100,13 +205,27 @@
         </el-table-column>
         <el-table-column prop="cityName" align="center" label="所在市">
         </el-table-column>
-        <el-table-column prop="elevationHeight" align="center" label="海拔高度" width="80">
+        <el-table-column
+          prop="elevationHeight"
+          align="center"
+          label="海拔高度"
+          width="80"
+        >
         </el-table-column>
-        <el-table-column prop="longitude" align="center" label="经度" width="80">
+        <el-table-column
+          prop="longitude"
+          align="center"
+          label="经度"
+          width="80"
+        >
         </el-table-column>
         <el-table-column prop="latitude" align="center" label="纬度" width="80">
         </el-table-column>
-        <el-table-column prop="ratedCapacityNumber" align="center" label="额定容量">
+        <el-table-column
+          prop="ratedCapacityNumber"
+          align="center"
+          label="额定容量"
+        >
         </el-table-column>
       </el-table>
 
@@ -196,10 +315,14 @@ export default {
     },
   },
   methods: {
-    handleClose() {
-      this.newform.province = "";
-      this.newform.city = "";
-      Object.assign(this.$data.newform, this.$options.data().newform);
+    
+     handleClose() {
+      Object.assign(this.newform, {
+        companyName: "",
+        province: null,
+        city: null,
+        described: "",
+      });
     },
 
     rowStyle() {
@@ -355,14 +478,26 @@ export default {
         type: "warning",
       })
         .then(() => {
-          delCompany({ companyCode: row.companyCode }).then((res) => {
-            this.getTableList();
-            // 执行删除操作
-            this.$message({
-              type: "success",
-              message: "删除成功!",
+          delCompany({ companyCode: row.companyCode })
+            .then((res) => {
+              if (res.code === -1) {
+                // Adjust based on your API response for a successful delete
+                this.$message({
+                  type: "error",
+                  message: "删除失败!",
+                });
+  
+              } else {
+                this.$message({
+                  type: "success",
+                  message: "删除成功!",
+                });
+                this.getTableList();
+              }
+            })
+            .catch((error) => {
+              console.error(error);
             });
-          });
         })
         .catch(() => {
           // 取消删除

+ 54 - 40
src/views/ledger/windsite.vue

@@ -72,7 +72,7 @@
           align="center"
           prop="abnormal"
           label="测风塔"
-          width="80"
+          width="70"
         >
           <template slot-scope="scope">
             <el-button
@@ -88,21 +88,21 @@
           prop="provinceName"
           align="center"
           label="所在省"
-          width="100"
+     
         >
         </el-table-column>
         <el-table-column
           prop="cityName"
           align="center"
           label="所在市"
-          width="100"
+    
         >
         </el-table-column>
 
-        <el-table-column prop="createTime" align="center" label="创建时间">
+        <el-table-column prop="createTime" align="center" label="创建时间" width="160">
         </el-table-column>
 
-        <el-table-column prop="state" align="center" label="状态" width="100">
+        <el-table-column prop="state" align="center" label="状态" width="80">
           <template slot-scope="{ row }">
             {{ row.state == 1 ? "启用" : "停用" }}
           </template>
@@ -586,35 +586,40 @@ export default {
       console.log(this.form.anemometerTowerRelationDtos);
       this.processData(this.form.anemometerTowerRelationDtos);
       this.$refs[formName].validate((valid) => {
-        if (valid) {
-          // 提交逻辑
-          const params = JSON.parse(JSON.stringify(this.form));
-          params.anemometerTowerRelationDtos = this.processData(
-            this.form.anemometerTowerRelationDtos
-          );
-          params.cityName = this.form.cityName.city;
-          params.cityId = this.form.cityName.areaId;
-          params.provinceName = this.form.provinceName.province;
-          params.provinceId = this.form.provinceName.areaId;
-          params.areaCode = this.form.cityName.areaCode;
-          if (this.isEdit) {
-            params.fieldCode = this.detail.fieldCode;
-          }
-          console.log(this.form, params);
-          const API = this.isEdit
-            ? windFieldDto(params)
-            : createWindField(params);
-          API.then((res) => {
-            this.nuedialog = false;
-            this.onSubmit();
-            this.isEdit = false;
-          });
-
-          // 在这里添加提交逻辑,例如发送表单数据到服务器
-        } else {
-          console.log("表单验证失败!");
+        if (!valid) {
+          this.$message.error("表单验证失败!");
           return false;
         }
+
+        // Prepare the params object
+        const params = JSON.parse(JSON.stringify(this.form));
+        params.anemometerTowerRelationDtos = this.processData(
+          this.form.anemometerTowerRelationDtos
+        );
+        params.cityName = this.form.cityName.city;
+        params.cityId = this.form.cityName.areaId;
+        params.provinceName = this.form.provinceName.province;
+        params.provinceId = this.form.provinceName.areaId;
+        params.areaCode = this.form.cityName.areaCode;
+        if (this.isEdit) {
+          params.fieldCode = this.detail.fieldCode;
+        }
+        console.log(this.form, params);
+
+        // Determine which API to call
+        const API = this.isEdit
+          ? windFieldDto(params)
+          : createWindField(params);
+
+        // Execute the API call
+        API.then((res) => {
+          // Adjust based on your API response
+          this.$message.success(this.isEdit ? "编辑成功" : "新增成功");
+          this.onSubmit();
+          this.isEdit = false;
+          this.nuedialog = false;
+        
+        }).catch((error) => {});
       });
     },
     // 重置
@@ -712,14 +717,23 @@ export default {
         type: "warning",
       })
         .then(() => {
-          delWindFieldById({ fieldCode: row.fieldCode }).then((res) => {
-            this.onSubmit();
-            // 执行删除操作
-            this.$message({
-              type: "success",
-              message: "删除成功!",
-            });
-          });
+          delWindFieldById({ fieldCode: row.fieldCode })
+            .then((res) => {
+              if (res.code === -1) {
+                // Assuming -1 indicates success, adjust according to actual API response
+                this.$message({
+                  type: "error",
+                  message: "删除失败!",
+                });
+              } else {
+                this.$message({
+                  type: "success",
+                  message: "删除成功!",
+                });
+                this.onSubmit();
+              }
+            })
+            .catch((error) => {});
         })
         .catch(() => {
           // 取消删除

+ 2 - 2
vue.config.js

@@ -64,8 +64,8 @@ module.exports = {
     // contentBase: path.join(__dirname, "public"),
     proxy: {
       "/api": {
-        // target: "http://192.168.5.4:16200", // 石月
-        target: "http://192.168.50.235:16200", //内网
+        target: "http://192.168.5.4:16200", // 石月
+        // target: "http://192.168.50.235:16200", //内网
         // target: "http://192.168.5.15:16200",
         // target: "http://106.120.102.238:16600", //外网
         changeOrigin: true,