|
@@ -16,6 +16,14 @@
|
|
|
<el-button
|
|
|
type="primary"
|
|
|
plain
|
|
|
+ icon="el-icon-search"
|
|
|
+ size="mini"
|
|
|
+ @click="getInverterInfo"
|
|
|
+ >查询
|
|
|
+ </el-button>
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ plain
|
|
|
icon="el-icon-plus"
|
|
|
size="mini"
|
|
|
@click="handleAdd"
|
|
@@ -79,7 +87,7 @@
|
|
|
v-for="item in stationOption"
|
|
|
:key="item.id"
|
|
|
:label="item.name"
|
|
|
- :value="item.id">
|
|
|
+ :value="item.name">
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
@@ -146,34 +154,37 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import {getPvModuleModel,getStationInfo} from "@/api/biz/dataQuery/inverterInfo";
|
|
|
+import {getPvModuleModel,getStationInfo,getInverterInfo,addInverterInfo,updateInverterInfo,deleteInverterInfo} from "@/api/biz/dataQuery/inverterInfo";
|
|
|
export default {
|
|
|
name: "index",
|
|
|
data() {
|
|
|
const checkName = (rule, value, callback) => {
|
|
|
- var s6 = this.tableData
|
|
|
+ var s6 = this.tableData.filter(w=>w.id === this.form.id)
|
|
|
if (value == null || value === '') {
|
|
|
callback(new Error('请填写逆变器名称'))
|
|
|
}
|
|
|
- for (let i = 0; i < s6.length; i++) {
|
|
|
- if (this.modId == '') {
|
|
|
- // 新增
|
|
|
- if ((value == s6[i].name)) {
|
|
|
- callback(new Error('名称不能重复'))
|
|
|
- }
|
|
|
- } else {
|
|
|
- // 修改
|
|
|
- if (this.modId != s6[i].id) {
|
|
|
+ if(s6.length>0){
|
|
|
+ for (let i = 0; i < s6.length; i++) {
|
|
|
+ if (this.modId == '') {
|
|
|
+ // 新增
|
|
|
if ((value == s6[i].name)) {
|
|
|
callback(new Error('名称不能重复'))
|
|
|
}
|
|
|
+ } else {
|
|
|
+ // 修改
|
|
|
+ if (this.modId != s6[i].id) {
|
|
|
+ if ((value == s6[i].name)) {
|
|
|
+ callback(new Error('名称不能重复'))
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
callback()
|
|
|
}
|
|
|
- const reg = /^[\-\+]?(0?\d{1,2}(\.\d{1,5})*|1[0-7]?\d{1}(\.\d{1,5})*|180(\.0{1,5})*)$/
|
|
|
- const reg1 = /^[\-\+]?([0-8]?\d{1}(\.\d{1,5})*|90(\.0{1,5})*)$/
|
|
|
+ const reg = /^[\-\+]?(0?\d{1,2}(\.\d{1,9})*|1[0-7]?\d{1}(\.\d{1,9})*|180(\.0{1,9})*)$/
|
|
|
+ const reg1 = /^[\-\+]?([0-8]?\d{1}(\.\d{1,9})*|90(\.0{1,9})*)$/
|
|
|
const checkLongitude = (rule, value, callback) => {
|
|
|
if (!value) {
|
|
|
callback(new Error('不许为空'))
|
|
@@ -202,6 +213,7 @@ export default {
|
|
|
loading: false,
|
|
|
open:false,
|
|
|
title:'新增&保存',
|
|
|
+ saveFlag:'add',
|
|
|
modId:'',
|
|
|
form: {},
|
|
|
// 表单校验
|
|
@@ -222,8 +234,22 @@ export default {
|
|
|
mounted() {
|
|
|
this.getStationInfo()
|
|
|
this.getPvModuleModel()
|
|
|
+ this.getInverterInfo()
|
|
|
},
|
|
|
methods: {
|
|
|
+ /*获取逆变器信息*/
|
|
|
+ getInverterInfo(){
|
|
|
+ this.loading = true
|
|
|
+ let id = this.stationId
|
|
|
+ getInverterInfo({id:id}).then(res=>{
|
|
|
+ this.tableData = res.data
|
|
|
+ this.page.total = this.tableData.length
|
|
|
+ this.loading = false
|
|
|
+ }).catch(err=>{
|
|
|
+ this.loading = false
|
|
|
+ console.log('获取逆变器信息异常:'+err)
|
|
|
+ })
|
|
|
+ },
|
|
|
/*获取场站信息*/
|
|
|
getStationInfo(){
|
|
|
getStationInfo().then(res=>{
|
|
@@ -240,30 +266,22 @@ export default {
|
|
|
console.log('获取光伏组件的信息异常:'+err)
|
|
|
})
|
|
|
},
|
|
|
- getList(){
|
|
|
- this.loading = true
|
|
|
- list().then(res=>{
|
|
|
- this.tableData = res.rows
|
|
|
- this.page.total = res.total
|
|
|
- this.loading = false
|
|
|
- }).catch(err=>{
|
|
|
- this.loading = false
|
|
|
- console.log('获取环境监测仪异常:'+err)
|
|
|
- })
|
|
|
- },
|
|
|
/*新增按钮*/
|
|
|
handleAdd() {
|
|
|
this.reset()
|
|
|
this.title = "新增&保存";
|
|
|
+ this.saveFlag = 'add'
|
|
|
this.open = true;
|
|
|
},
|
|
|
/** 修改按钮操作 */
|
|
|
handleUpdate(row) {
|
|
|
this.reset();
|
|
|
this.modId = row.id
|
|
|
+ this.saveFlag = 'edit'
|
|
|
this.form = {
|
|
|
stationName:row.stationName,
|
|
|
id: row.id,
|
|
|
+ inverterInfoId:row.inverterInfoId,
|
|
|
name: row.name,
|
|
|
modelNumber: row.modelNumber,
|
|
|
longitude: row.longitude,
|
|
@@ -277,11 +295,10 @@ export default {
|
|
|
},
|
|
|
/** 删除按钮操作 */
|
|
|
handleDelete(row) {
|
|
|
- const ids = row.id;
|
|
|
- this.$modal.confirm('是否确认删除环境监测仪信息名称为"' + row.name + '"信息及所有数据?').then(function () {
|
|
|
- // return delWeatherStationInfo(ids);
|
|
|
+ this.$modal.confirm('是否确认删除逆变器信息名称为"' + row.name + '"信息及所有数据?').then(function () {
|
|
|
+ return deleteInverterInfo(row);
|
|
|
}).then(() => {
|
|
|
- this.getList();
|
|
|
+ this.getInverterInfo();
|
|
|
this.$modal.msgSuccess("删除成功");
|
|
|
}).catch(() => {
|
|
|
});
|
|
@@ -292,19 +309,20 @@ export default {
|
|
|
this.$refs["form"].validate(valid => {
|
|
|
if (valid) {
|
|
|
console.log(this.form)
|
|
|
- // if (this.form.id != null) {
|
|
|
- // updateWeatherStationInfo(this.form).then(response => {
|
|
|
- // this.$modal.msgSuccess("修改成功");
|
|
|
- // this.open = false;
|
|
|
- // this.getList();
|
|
|
- // });
|
|
|
- // } else {
|
|
|
- // addWeatherStationInfo(this.form).then(response => {
|
|
|
- // this.$modal.msgSuccess("新增成功");
|
|
|
- // this.open = false;
|
|
|
- // this.getList();
|
|
|
- // });
|
|
|
- // }
|
|
|
+ if (this.saveFlag !== 'add') {
|
|
|
+ updateInverterInfo(this.form).then(response => {
|
|
|
+ this.$modal.msgSuccess("修改成功");
|
|
|
+ this.open = false;
|
|
|
+ this.getInverterInfo();
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.form.id = this.stationOption.find(w=>w.name === this.form.stationName).id
|
|
|
+ addInverterInfo(this.form).then(response => {
|
|
|
+ this.$modal.msgSuccess("新增成功");
|
|
|
+ this.open = false;
|
|
|
+ this.getInverterInfo();
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
},
|
|
@@ -317,6 +335,7 @@ export default {
|
|
|
this.form = {
|
|
|
stationName:null,
|
|
|
id:null,
|
|
|
+ inverterInfoId:null,
|
|
|
name:null,
|
|
|
modelNumber: null,
|
|
|
longitude: null,
|