|
|
|
|
@ -27,6 +27,7 @@
|
|
|
|
|
import { uuid } from "@/utils";
|
|
|
|
|
import { index, save } from "@/api/system/baseForm";
|
|
|
|
|
import LxHeader from "@/components/LxHeader";
|
|
|
|
|
import {show} from "@/api/system/customFormField";
|
|
|
|
|
export default {
|
|
|
|
|
components: {
|
|
|
|
|
LxHeader
|
|
|
|
|
@ -36,6 +37,8 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
diaolingleixing: [],
|
|
|
|
|
abilities: [],
|
|
|
|
|
form: {
|
|
|
|
|
no: '',
|
|
|
|
|
equipment_id: '',
|
|
|
|
|
@ -132,6 +135,78 @@ export default {
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '闸门数量',
|
|
|
|
|
width: 120,
|
|
|
|
|
key: 'kaiqishuliang',
|
|
|
|
|
render: (h,{ row }) => {
|
|
|
|
|
return h('Input',{
|
|
|
|
|
props: {
|
|
|
|
|
size: 'small',
|
|
|
|
|
value: row.kaiqishuliang
|
|
|
|
|
},
|
|
|
|
|
on: {
|
|
|
|
|
['input']:e => row.kaiqishuliang = e
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '水泵数量',
|
|
|
|
|
width: 120,
|
|
|
|
|
key: 'kaiqishuliang1',
|
|
|
|
|
render: (h,{ row }) => {
|
|
|
|
|
return h('Input',{
|
|
|
|
|
props: {
|
|
|
|
|
size: 'small',
|
|
|
|
|
value: row.kaiqishuliang1
|
|
|
|
|
},
|
|
|
|
|
on: {
|
|
|
|
|
['input']:e => row.kaiqishuliang1 = e
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '类别',
|
|
|
|
|
width: 140,
|
|
|
|
|
key: 'leibie',
|
|
|
|
|
render: (h,{ row }) => {
|
|
|
|
|
return h('Select',{
|
|
|
|
|
props: {
|
|
|
|
|
size: 'small',
|
|
|
|
|
value: row.leibie
|
|
|
|
|
},
|
|
|
|
|
on: {
|
|
|
|
|
['input']:e => row.leibie = e
|
|
|
|
|
}
|
|
|
|
|
}, this.abilities.map(i => h("Option",{
|
|
|
|
|
props: {
|
|
|
|
|
value: i.value
|
|
|
|
|
}
|
|
|
|
|
},i.key)))
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '调令类型',
|
|
|
|
|
width: 140,
|
|
|
|
|
key: 'diaolingleixing',
|
|
|
|
|
render: (h,{ row }) => {
|
|
|
|
|
return h('Select',{
|
|
|
|
|
props: {
|
|
|
|
|
size: 'small',
|
|
|
|
|
value: row.diaolingleixing
|
|
|
|
|
},
|
|
|
|
|
on: {
|
|
|
|
|
['input']:e => row.diaolingleixing = e
|
|
|
|
|
}
|
|
|
|
|
}, this.diaolingleixing.map(i => h("Option",{
|
|
|
|
|
props: {
|
|
|
|
|
value: i.value
|
|
|
|
|
}
|
|
|
|
|
},i.key)))
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '操作',
|
|
|
|
|
width: 140,
|
|
|
|
|
@ -163,59 +238,72 @@ export default {
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
async getAbility() {
|
|
|
|
|
const obj = (await show({ id: 31 }, false))?.select_item;
|
|
|
|
|
if (obj && typeof obj === "object") {
|
|
|
|
|
let keys = Object.keys(obj);
|
|
|
|
|
if (keys.length > 0) {
|
|
|
|
|
this.abilities = keys.map((key) => {
|
|
|
|
|
return {
|
|
|
|
|
key,
|
|
|
|
|
value: /^\d*$/.test(obj[key]) ? Number(obj[key]) : obj[key],
|
|
|
|
|
};
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
async getDiaolingleixing() {
|
|
|
|
|
const obj = {
|
|
|
|
|
"逻辑调令": "4",
|
|
|
|
|
"防汛调令": "2",
|
|
|
|
|
"水环境调令": "1",
|
|
|
|
|
"船只过闸调令": "3"
|
|
|
|
|
};
|
|
|
|
|
if (obj && typeof obj === "object") {
|
|
|
|
|
let keys = Object.keys(obj);
|
|
|
|
|
if (keys.length > 0) {
|
|
|
|
|
this.diaolingleixing = keys.map((key) => {
|
|
|
|
|
return {
|
|
|
|
|
key,
|
|
|
|
|
value: /^\d*$/.test(obj[key]) ? Number(obj[key]) : obj[key],
|
|
|
|
|
};
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
isTimeFormat (str) {
|
|
|
|
|
let regex = /^([0-1][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])$/;
|
|
|
|
|
return regex.test(str);
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
add () {
|
|
|
|
|
this.$prompt('请输入内容','快速调令',{
|
|
|
|
|
this.$prompt('请输入内容','快速调令', {
|
|
|
|
|
confirmButtonText: '确定',
|
|
|
|
|
cancelButtonText: '取消',
|
|
|
|
|
inputType: 'textarea',
|
|
|
|
|
closeOnClickModal: false,
|
|
|
|
|
inputPlaceholder: '点位 开始时间 结束时间 调令内容,\n点位 开始时间 结束时间 调令内容 \n每个值以空格隔开,每条调令用","分割',
|
|
|
|
|
beforeClose:(action, instance, done) => {
|
|
|
|
|
if (action === 'confirm') {
|
|
|
|
|
let value = instance._data.inputValue;
|
|
|
|
|
try {
|
|
|
|
|
let group = value.split(/,|,/)?.filter(i => i)?.map(i => i.replace(/\n/g,''));
|
|
|
|
|
group.forEach((item,index) => {
|
|
|
|
|
let dataArr = item.split(/\s+/);
|
|
|
|
|
console.log(dataArr[0], this.equipments.find(i => i.name === dataArr[0]))
|
|
|
|
|
if (!this.equipments.find(i => i.name === dataArr[0])) {
|
|
|
|
|
throw new Error('未找到该点位');
|
|
|
|
|
}
|
|
|
|
|
if (!(this.isTimeFormat(dataArr[1]) && this.isTimeFormat(dataArr[2]))) {
|
|
|
|
|
throw new Error('时间格式有误');
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
done();
|
|
|
|
|
} catch (err) {
|
|
|
|
|
this.$message({
|
|
|
|
|
type: 'warning',
|
|
|
|
|
message: /^TypeError./.test(err) ? '数据格式有误' : err
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
done();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
inputPlaceholder: '点位 开始时间 结束时间 调令内容 闸门数量 水泵数量 类别 调令类型,\n点位 开始时间 结束时间 调令内容 闸门数量 水泵数量 类别 调令类型 \n每个值以空格隔开,每条调令用","分割',
|
|
|
|
|
}).then(({ value, action }) => {
|
|
|
|
|
if (action === 'confirm') {
|
|
|
|
|
let uid = uuid();
|
|
|
|
|
let group = value.split(/,|,/)?.filter(i => i)?.map(i => i.replace(/\n/g,''));
|
|
|
|
|
let group = value.split(/;|;/)?.filter(i => i)?.map(i => i.replace(/\n/g,''));
|
|
|
|
|
group.forEach((item,index) => {
|
|
|
|
|
let dataArr = item.split(/\s+/);
|
|
|
|
|
this.data.push({
|
|
|
|
|
no: uid,
|
|
|
|
|
equipment_id: this.equipments.find(i => i.name === dataArr[0])?.id,
|
|
|
|
|
start_time: `${dataArr[1]}`,
|
|
|
|
|
end_time: `${dataArr[2]}`,
|
|
|
|
|
content: dataArr[3] || '',
|
|
|
|
|
level: 1,
|
|
|
|
|
status: 1
|
|
|
|
|
})
|
|
|
|
|
if (dataArr.length === 8 && this.equipments.find(i => i.name === dataArr[0]) && (this.isTimeFormat(dataArr[1]) && this.isTimeFormat(dataArr[2]))) {
|
|
|
|
|
this.data.push({
|
|
|
|
|
no: uid,
|
|
|
|
|
equipment_id: this.equipments.find(i => i.name === dataArr[0])?.id,
|
|
|
|
|
start_time: `${dataArr[1]}`,
|
|
|
|
|
end_time: `${dataArr[2]}`,
|
|
|
|
|
content: dataArr[3] ?? '',
|
|
|
|
|
kaiqishuliang: dataArr[4] ?? 0,
|
|
|
|
|
kaiqishuliang1: dataArr[5] ?? 0,
|
|
|
|
|
leibie: this.abilities.find(j => j.key === dataArr[6])?.value,
|
|
|
|
|
diaolingleixing: this.diaolingleixing.find(j => j.key === dataArr[7])?.value,
|
|
|
|
|
level: 1,
|
|
|
|
|
status: 1
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
console.log(this.data)
|
|
|
|
|
}
|
|
|
|
|
@ -250,6 +338,10 @@ export default {
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
computed: {},
|
|
|
|
|
created() {
|
|
|
|
|
this.getAbility()
|
|
|
|
|
this.getDiaolingleixing()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|