130 lines
3.4 KiB
JavaScript
130 lines
3.4 KiB
JavaScript
|
|
import {httppost1, httppost2, httpget} from "../utils/request";
|
||
|
|
import {message} from 'antd';
|
||
|
|
import apiurl from './apiurl';
|
||
|
|
|
||
|
|
//县基本信息 分页查询
|
||
|
|
export async function page(params = {}) {
|
||
|
|
const myParams = {
|
||
|
|
countycode: localStorage.getItem('ADCD6') + '000000',
|
||
|
|
...params
|
||
|
|
};
|
||
|
|
|
||
|
|
const {data, code, msg} = await httppost2(apiurl.reservoirWarnSet.page, myParams) || {};
|
||
|
|
|
||
|
|
if (code !== 200) {
|
||
|
|
message.error(msg || '请求失败');
|
||
|
|
return {list: [], totalRow: 0};
|
||
|
|
}
|
||
|
|
|
||
|
|
data.records.forEach(item => {
|
||
|
|
if (item.warnLevelList.length > 0) {
|
||
|
|
item.warnLevelList.forEach(items => {
|
||
|
|
if (items.warningLevel == 1) {
|
||
|
|
item.threshold1 = items.threshold
|
||
|
|
item.returnPeriod1 = items.returnPeriod
|
||
|
|
item.id1=items.id
|
||
|
|
} else if (items.warningLevel == 2) {
|
||
|
|
item.threshold2 = items.threshold
|
||
|
|
item.returnPeriod2 = items.returnPeriod
|
||
|
|
item.id2=items.id
|
||
|
|
} else if (items.warningLevel == 3) {
|
||
|
|
item.threshold3 = items.threshold
|
||
|
|
item.returnPeriod3 = items.returnPeriod
|
||
|
|
item.id3=items.id
|
||
|
|
} else if (items.warningLevel == 4) {
|
||
|
|
item.threshold4 = items.threshold
|
||
|
|
item.returnPeriod4 = items.returnPeriod
|
||
|
|
item.id4=items.id
|
||
|
|
}
|
||
|
|
})
|
||
|
|
}
|
||
|
|
})
|
||
|
|
|
||
|
|
return {list: data.records, totalRow: data.total};
|
||
|
|
}
|
||
|
|
|
||
|
|
//新增
|
||
|
|
export async function add(params = {}) {
|
||
|
|
console.log(params);
|
||
|
|
params = [{
|
||
|
|
countycode: params.countyCode,
|
||
|
|
stcd: params.stcd,
|
||
|
|
warningLevel: 1,
|
||
|
|
threshold: params.threshold1,
|
||
|
|
returnPeriod: params.returnPeriod1,
|
||
|
|
},
|
||
|
|
{
|
||
|
|
countycode: params.countyCode,
|
||
|
|
stcd: params.stcd,
|
||
|
|
warningLevel: 2,
|
||
|
|
threshold: params.threshold2,
|
||
|
|
returnPeriod: params.returnPeriod2,
|
||
|
|
}, {
|
||
|
|
countycode: params.countyCode,
|
||
|
|
stcd: params.stcd,
|
||
|
|
warningLevel: 3,
|
||
|
|
threshold: params.threshold3,
|
||
|
|
returnPeriod: params.returnPeriod3,
|
||
|
|
}, {
|
||
|
|
countycode: params.countyCode,
|
||
|
|
stcd: params.stcd,
|
||
|
|
warningLevel: 4,
|
||
|
|
threshold: params.threshold4,
|
||
|
|
returnPeriod: params.returnPeriod4,
|
||
|
|
}]
|
||
|
|
const res = await httppost2(apiurl.reservoirWarnSet.add, params) || {};
|
||
|
|
|
||
|
|
return res;
|
||
|
|
}
|
||
|
|
|
||
|
|
//编辑
|
||
|
|
export async function edit(params = {}) {
|
||
|
|
console.log(params);
|
||
|
|
params = [{
|
||
|
|
id:params.id1,
|
||
|
|
countycode: params.countyCode,
|
||
|
|
stcd: params.stcd,
|
||
|
|
warningLevel: 1,
|
||
|
|
threshold: params.threshold1,
|
||
|
|
returnPeriod: params.returnPeriod1,
|
||
|
|
},
|
||
|
|
{
|
||
|
|
id:params.id2,
|
||
|
|
countycode: params.countyCode,
|
||
|
|
stcd: params.stcd,
|
||
|
|
warningLevel: 2,
|
||
|
|
threshold: params.threshold2,
|
||
|
|
returnPeriod: params.returnPeriod2,
|
||
|
|
}, {
|
||
|
|
id:params.id3,
|
||
|
|
countycode: params.countyCode,
|
||
|
|
stcd: params.stcd,
|
||
|
|
warningLevel: 3,
|
||
|
|
threshold: params.threshold3,
|
||
|
|
returnPeriod: params.returnPeriod3,
|
||
|
|
}, {
|
||
|
|
id:params.id4,
|
||
|
|
countycode: params.countyCode,
|
||
|
|
stcd: params.stcd,
|
||
|
|
warningLevel: 4,
|
||
|
|
threshold: params.threshold4,
|
||
|
|
returnPeriod: params.returnPeriod4,
|
||
|
|
}]
|
||
|
|
const res = await httppost2(apiurl.reservoirWarnSet.edit, params) || {};
|
||
|
|
|
||
|
|
return res;
|
||
|
|
}
|
||
|
|
|
||
|
|
//删除
|
||
|
|
export async function del(params = {}) {
|
||
|
|
const res = await httppost2(apiurl.reservoirWarnSet.del, params) || {};
|
||
|
|
|
||
|
|
return res;
|
||
|
|
}
|
||
|
|
|
||
|
|
//获取水库列表
|
||
|
|
export async function getReservoir(params = {}) {
|
||
|
|
const res = await httppost2(apiurl.informationManagement.stcd.page, params) || {};
|
||
|
|
|
||
|
|
return res;
|
||
|
|
}
|