Kaynağa Gözat

fix:测点生成

chenxinlei 2 yıl önce
ebeveyn
işleme
99ad92eccc

+ 18 - 0
src/api/realtimeDatabaseConfiguration.js

@@ -191,6 +191,22 @@ const deleteTesting = (data) => {
     method: 'delete',
   })
 }
+// 设备or场站测点生成
+const generatePoint = (pairs) => {
+  return request({
+    url: `/pro-econ-testing-point/generatePoint`,
+    method: 'post',
+    data: pairs,
+  })
+}
+// http://192.168.11.133:7020/pro-econ-testing-point/type-point-list?type=fc
+const pointList = (pairs) => {
+  return request({
+    url: `/pro-econ-testing-point/type-point-list?type=${pairs.type}`,
+    method: 'post',
+  })
+}
+
 // GET
 // /pro-basic-equipment-point/{id}
 // 设备测点-列表
@@ -443,6 +459,8 @@ const deleteWeatherStation = (data) => {
   })
 }
 export default {
+  pointList,
+  generatePoint,
   weatherStationList,
   addWeatherStation,
   deleteWeatherStation,

+ 98 - 6
src/views/stationConfiguration/logicPoint/index.vue

@@ -12,15 +12,12 @@
 					</el-button>
 				</div>
 				<div class="right">
-					<el-button icon="el-icon-plus" type="primary" @click="handleAdd">
-						添加
-					</el-button>
-					<el-button icon="el-icon-delete" type="danger" @click="handleDelete">
-						删除
-					</el-button>
+					<el-button icon="el-icon-plus" type="primary" @click="handleAdd">添加</el-button>
+					<el-button icon="el-icon-delete" type="danger" @click="handleDelete">删除</el-button>
 					<UploadExcel style="margin-left: 10px;" @getResult="getMyExcelData"></UploadExcel>
 					<ExportExcel :exportList="exportExcel" :useType="'export'" partsName="逻辑测点"></ExportExcel>
 					<ExportExcel :exportList="templateExcel" :useType="'template'" partsName="逻辑测点模板"></ExportExcel>
+					<el-button type="primary" @click="testGenerate">测点生成</el-button>
 				</div>
 			</div>
 			<el-table header-cell-class-name="table_header_style" border ref="tableSort" v-loading="listLoading" :data="list"
@@ -50,6 +47,37 @@
 				@size-change="handleSizeChange"></el-pagination>
 			<table-edit ref="edit" :options="options" :stationList="stationList" @save-success="fetchData"></table-edit>
 		</vab-query-form>
+    <el-dialog title="测点生成" :visible.sync="dialogVisible" width="500px" :before-close="handleClose">
+      <el-form ref="dialogForm" :model="dialogForm" :rules="dialogRules" label-width="150px" v-loading="dialogLoading" element-loading-text="测点数据加载中">
+        <el-row>
+          <el-col :span="24">
+            <el-form-item label="场站" prop="station">
+              <el-select v-model="dialogForm.station" placeholder="请选择">
+                <el-option v-for="item in stationOptions" :key="item.id" :label="item.name" :value="item.id"></el-option>
+              </el-select>
+            </el-form-item>
+          </el-col>
+          <el-col :span="24">
+            <el-form-item label="测点类型 " prop="type">
+              <el-select v-model="dialogForm.type" placeholder="请选择" @change="typeChange">
+                <el-option v-for="item in typeOptions" :key="item.value" :label="item.label" :value="item.value"></el-option>
+              </el-select>
+            </el-form-item>
+          </el-col>
+          <el-col :span="24">
+            <el-form-item label="测点" prop="points">
+              <el-select v-model="dialogForm.points" placeholder="请选择">
+                <el-option v-for="item in pointsOptions" :key="item.id" :label="item.name" :value="item.id"></el-option>
+              </el-select>
+            </el-form-item>
+          </el-col>
+        </el-row>
+		  </el-form>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="handleClose">取 消</el-button>
+        <el-button type="primary" @click="generateOK">生成测点</el-button>
+      </span>
+    </el-dialog>
 	</div>
 </template>
 <script>
@@ -66,6 +94,28 @@ export default {
 	},
 	data() {
 		return {
+      dialogLoading: false,
+      pointsOptions: [],
+      stationOptions: [],
+      typeOptions: [
+        {value:"fj", label:"风机测点"},
+        {value:"fc", label:"风场测点"},
+        {value:"sbs", label:"变电所测点"},
+        {value:"ws", label:"气象站测点"},
+        {value:"sq", label:"方正测"},
+        {value:"", label:"全部"},
+      ],
+      dialogForm: {
+        points: "",
+        station: "",
+        type: "",
+      },
+      dialogRules: {
+				station: [{ required: true, trigger: 'change', message: '请选择' }],
+				type: [{ required: true, trigger: 'change', message: '请选择' }],
+				points: [{ required: true, trigger: 'change', message: '请选择' }],
+      },
+      dialogVisible: false,
 			fuzzyQuery_name: '',
 			listLoading: true,
 			list: [],
@@ -96,6 +146,48 @@ export default {
 		this.fetchData()
 	},
 	methods: {
+    typeChange(data){
+      this.dialogForm.points = ""
+      this.dialogLoading = true
+      api.pointList({type: data}).then(res=>{
+        this.pointsOptions = res.data
+        this.dialogLoading = false
+      })
+    },
+    generateOK(){
+			this.$refs['dialogForm'].validate(async (valid) => {
+				if (valid) {
+					api.generatePoint(this.dialogForm).then(res => {
+						if (res.data) {
+							this.$message({
+								type: 'success',
+								message: '添加成功!'
+							});
+							this.dialogVisible = false
+		          this.fetchData()
+						}
+					})
+				} else {
+					return false
+				}
+			})
+    },
+    handleClose(){
+      this.dialogVisible = false
+    },
+    testGenerate(){
+      this.dialogForm.points = ""
+      this.dialogForm.station = ""
+      this.dialogForm.type = ""
+      this.dialogVisible = true
+      stationApi.windpowerstationList({id:"", name:"", companyId:"", groupId:"", pageNum:1, pageSize: 1000}).then(res=>{
+        this.stationOptions = res.data.records
+      })
+      api.pointList({type: ""}).then(res=>{
+        this.pointsOptions = res.data
+        this.dialogLoading = false
+      })
+    },
 		getMyExcelData(val) {
 			val.forEach(item => {
 				api.addTesting(item).then(res => {