pc-master #178

Merged
xiaomeng merged 5 commits from pc-master into portal 2024-10-11 05:54:32 +00:00
6 changed files with 5981 additions and 3042 deletions

8736
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -912,7 +912,7 @@ textarea {
} }
.formula .page-content { .formula .page-content {
width: calc(100% - 300px); width: calc(100% - 250px);
height: 100%; height: 100%;
background: rgba(0, 92, 178, 0.15); background: rgba(0, 92, 178, 0.15);
border: 2px solid rgba(0, 186, 255, 0.2); border: 2px solid rgba(0, 186, 255, 0.2);

View File

@ -955,7 +955,7 @@ textarea{
justify-content: space-between; justify-content: space-between;
.page-content { .page-content {
width: calc(100% - 300px); width: calc(100% - 250px);
height: 100%; height: 100%;
background: rgba(0, 92, 178, 0.15); background: rgba(0, 92, 178, 0.15);
border: 2px solid rgba(0, 186, 255, 0.20); border: 2px solid rgba(0, 186, 255, 0.20);

View File

@ -157,7 +157,7 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.set-params { .set-params {
width: 280px; width: 230px;
height: 100%; height: 100%;
background: rgba(0, 92, 178, 0.15); background: rgba(0, 92, 178, 0.15);
border: 2px solid rgba(0, 186, 255, 0.20); border: 2px solid rgba(0, 186, 255, 0.20);

View File

@ -491,7 +491,7 @@ if (el.child.length) {
<style lang="scss" scoped> <style lang="scss" scoped>
.set-params { .set-params {
width: 280px; width: 230px;
height: 100%; height: 100%;
background: rgba(0, 92, 178, 0.15); background: rgba(0, 92, 178, 0.15);
border: 2px solid rgba(0, 186, 255, 0.2); border: 2px solid rgba(0, 186, 255, 0.2);

View File

@ -8,16 +8,16 @@
<div class="flex-view"> <div class="flex-view">
<div class="input-btn"> <div class="input-btn">
<span>控制模式选择</span> <span>控制模式选择</span>
<div class="btn" @click="change00(3)" <div class="btn" @click="change00(3)" :class="inputData['1' + (10 + (indexs - 1)) + '00'] == 3 ? 'blue' : 'green'
:class="inputData['1' + (10 + (indexs - 1)) + '00'] == 3 ? 'blue' : 'green'"> ">
<img src="../../assets/image/irrigateSet1.png" alt="" />停止 <img src="../../assets/image/irrigateSet1.png" alt="" />停止
</div> </div>
<div class="btn" @click="change00(2)" <div class="btn" @click="change00(2)" :class="inputData['1' + (10 + (indexs - 1)) + '00'] == 2 ? 'blue' : 'green'
:class="inputData['1' + (10 + (indexs - 1)) + '00'] == 2 ? 'blue' : 'green'"> ">
<img src="../../assets/image/irrigateSet3.png" alt="" />手动启动 <img src="../../assets/image/irrigateSet3.png" alt="" />手动启动
</div> </div>
<div class="btn" @click="change00(1)" <div class="btn" @click="change00(1)" :class="inputData['1' + (10 + (indexs - 1)) + '00'] == 1 ? 'blue' : 'green'
:class="inputData['1' + (10 + (indexs - 1)) + '00'] == 1 ? 'blue' : 'green'"> ">
<img src="../../assets/image/irrigateSet2.png" alt="" />自动 <img src="../../assets/image/irrigateSet2.png" alt="" />自动
</div> </div>
</div> </div>
@ -50,6 +50,31 @@
v-model="inputData['1' + (10 + (indexs - 1)) + '05']" v-model="inputData['1' + (10 + (indexs - 1)) + '05']"
@input="change('1' + (10 + (indexs - 1)) + '05', $event)" type="number" placeholder="0" /> @input="change('1' + (10 + (indexs - 1)) + '05', $event)" type="number" placeholder="0" />
</div> </div>
</div>
<div class="flex-view">
<div class="flex-view border-none padding-none">
<div class="input-main input-main-w120">
<span>下雨禁止灌溉功能</span>
</div>
<div class="input-btn">
<div class="btn btn-w80" @click="change71()"
:class="inputData['1' + (10 + (indexs - 1)) + '71'] == '1' ? 'blue' : 'green'">
{{ inputData['1' + (10 + (indexs - 1)) + '71'] == '1' ? '开启' : '关闭' }}
</div>
</div>
<div class="input-main input-main-w120">
<span>(自动模式下生效)</span>
</div>
</div>
<div class="input-main-80">
<span>雨量达到</span>
<input @blur="blurChange('1' + (10 + (indexs - 1)) + '72', $event)"
v-model="inputData['1' + (10 + (indexs - 1)) + '72']"
@input="change('1' + (10 + (indexs - 1)) + '72', $event)" type="number" placeholder="0" />
<span>mm,本灌溉组停止灌溉</span>
</div>
</div> </div>
<!-- <div class="flex-view"> <!-- <div class="flex-view">
<div class="input-main-80"> <div class="input-main-80">
@ -107,14 +132,12 @@
<input @blur="blurChange('1' + (10 + (indexs - 1)) + '61', $event)" <input @blur="blurChange('1' + (10 + (indexs - 1)) + '61', $event)"
v-model="inputData['1' + (10 + (indexs - 1)) + '61']" v-model="inputData['1' + (10 + (indexs - 1)) + '61']"
@input="change('1' + (10 + (indexs - 1)) + '61', $event)" type="text" placeholder="0" /> @input="change('1' + (10 + (indexs - 1)) + '61', $event)" type="text" placeholder="0" />
</div> </div>
<!-- <div class="btn green"> <!-- <div class="btn green">
<img src="../../assets/image/rotate.png" alt="" />轮模式启用 <img src="../../assets/image/rotate.png" alt="" />轮模式启用
</div> --> </div> -->
</div> </div>
<div class="flex-view"> <div class="flex-view">
<!-- <div @click="(open1 = !open1), change59()" class="open-btn" :class="open1 ? 'active' : ''"> <!-- <div @click="(open1 = !open1), change59()" class="open-btn" :class="open1 ? 'active' : ''">
<img v-if="!open1" src="../../assets/image/irrigateSet-icon1.png" alt="" /> <img v-if="!open1" src="../../assets/image/irrigateSet-icon1.png" alt="" />
<img v-else src="../../assets/image/irrigateSet-icon1-act.png" alt="" /> <img v-else src="../../assets/image/irrigateSet-icon1-act.png" alt="" />
@ -473,7 +496,7 @@
<el-dialog :modal-append-to-body="false" :show-close="false" :close-on-click-modal="true" :visible.sync="model4" <el-dialog :modal-append-to-body="false" :show-close="false" :close-on-click-modal="true" :visible.sync="model4"
width="700px" :before-close="handleClose4"> width="700px" :before-close="handleClose4">
<div class="page-title title-302">{{ indexs }}#灌溉组控制参数配置</div> <div class="page-title title-302">{{ indexs }}#灌溉组控制参数配置</div>
<div style="display: flex;align-items: center;"> <div style="display: flex; align-items: center">
<div class="btn blue"> <div class="btn blue">
<img src="../../assets/image/model4-icon.png" alt="" />外控模式 <img src="../../assets/image/model4-icon.png" alt="" />外控模式
</div> </div>
@ -505,9 +528,13 @@
<div class="model1-top model4-top"> <div class="model1-top model4-top">
<div class="model-left"> <div class="model-left">
<div class="btn btn-w80" @click="blurChange('1' + (10 + (indexs - 1)) + '71', { target: { value: 1 } }), model4Sel = 1" <div class="btn btn-w80" @click="
:class="model4Sel == 1 ? 'blue' : 'off'"> blurChange('1' + (10 + (indexs - 1)) + '71', {
{{ model4Sel == 1 ? '有效' : '无效' }} target: { value: 1 },
}),
(model4Sel = 1)
" :class="model4Sel == 1 ? 'blue' : 'off'">
{{ model4Sel == 1 ? "有效" : "无效" }}
</div> </div>
<span>外部数字量控制方式:</span> <span>外部数字量控制方式:</span>
</div> </div>
@ -535,10 +562,13 @@
</div> </div>
<div class="model1-top model4-top"> <div class="model1-top model4-top">
<div class="model-left"> <div class="model-left">
<div class="btn btn-w80 " <div class="btn btn-w80" @click="
@click="blurChange('1' + (10 + (indexs - 1)) + '71', { target: { value: 2 } }), model4Sel = 2" blurChange('1' + (10 + (indexs - 1)) + '71', {
:class="model4Sel == 2 ? 'blue' : 'off'"> target: { value: 2 },
{{ model4Sel == 2 ? '有效' : '无效' }} }),
(model4Sel = 2)
" :class="model4Sel == 2 ? 'blue' : 'off'">
{{ model4Sel == 2 ? "有效" : "无效" }}
</div> </div>
<span>液位传感器控制方式:</span> <span>液位传感器控制方式:</span>
</div> </div>
@ -560,7 +590,6 @@
@input="change('1' + (10 + (indexs - 1)) + '69', $event)" type="number" placeholder="0" /> @input="change('1' + (10 + (indexs - 1)) + '69', $event)" type="number" placeholder="0" />
<span>cm</span> <span>cm</span>
</div> </div>
</div> </div>
<div> <div>
<div class="input-main-80"> <div class="input-main-80">
@ -583,7 +612,6 @@
</template> </template>
<script> <script>
export default { export default {
data() { data() {
return { return {
topActive: 1, topActive: 1,
@ -602,17 +630,17 @@ export default {
data53: "", data53: "",
inputData: {}, inputData: {},
loading: null, loading: null,
pageName:'', pageName: "",
}; };
}, },
watch: { watch: {
'$store.state.equipmentIndex': function (newValue, oldValue) { "$store.state.equipmentIndex": function (newValue, oldValue) {
const that = this; const that = this;
this.loading = this.$loading({ this.loading = this.$loading({
lock: true, lock: true,
text: '加载中', text: "加载中",
spinner: 'el-icon-loading', spinner: "el-icon-loading",
background: 'rgba(0, 0, 0, 0.7)' background: "rgba(0, 0, 0, 0.7)",
}); });
setTimeout(() => { setTimeout(() => {
that.dataInit(); that.dataInit();
@ -621,12 +649,14 @@ export default {
$route(newVal, oldVal) { $route(newVal, oldVal) {
const that = this; const that = this;
this.indexs = this.$route.query.id ? this.$route.query.id : 1; this.indexs = this.$route.query.id ? this.$route.query.id : 1;
this.pageName=this.$route.query.name?this.$route.query.name:(this.indexs+'#智能灌溉组') this.pageName = this.$route.query.name
? this.$route.query.name
: this.indexs + "#智能灌溉组";
this.loading = this.$loading({ this.loading = this.$loading({
lock: true, lock: true,
text: '加载中', text: "加载中",
spinner: 'el-icon-loading', spinner: "el-icon-loading",
background: 'rgba(0, 0, 0, 0.7)' background: "rgba(0, 0, 0, 0.7)",
}); });
setTimeout(() => { setTimeout(() => {
that.dataInit(); that.dataInit();
@ -638,38 +668,40 @@ export default {
this.indexs = this.$route.query.id ? this.$route.query.id : 1; this.indexs = this.$route.query.id ? this.$route.query.id : 1;
console.log(this.$route); console.log(this.$route);
this.pageName=this.$route.query.name?this.$route.query.name:(this.indexs+'#智能灌溉组') this.pageName = this.$route.query.name
? this.$route.query.name
: this.indexs + "#智能灌溉组";
this.loading = this.$loading({ this.loading = this.$loading({
lock: true, lock: true,
text: '加载中', text: "加载中",
spinner: 'el-icon-loading', spinner: "el-icon-loading",
background: 'rgba(0, 0, 0, 0.7)' background: "rgba(0, 0, 0, 0.7)",
}); });
setTimeout(() => { setTimeout(() => {
that.dataInit(); that.dataInit();
}, 0); }, 0);
//input //input
let inputList = document.querySelectorAll('input'); let inputList = document.querySelectorAll("input");
for (let index = 0; index < inputList.length; index++) { for (let index = 0; index < inputList.length; index++) {
inputList[index].onfocus = this.selectValue;//input inputList[index].onfocus = this.selectValue; //input
} }
}, },
methods: { methods: {
countData10(data) { countData10(data) {
if (data) { if (data) {
return data / 10 return data / 10;
} else { } else {
return 0 return 0;
} }
}, },
changeData10(code, el) { changeData10(code, el) {
var data = el.target.value * 10 var data = el.target.value * 10;
var sendData = { var sendData = {
target: { target: {
value: data value: data,
} },
} };
this.change(code, sendData) this.change(code, sendData);
}, },
handleCommand(command) { handleCommand(command) {
if (command == "1") { if (command == "1") {
@ -683,15 +715,14 @@ export default {
} else if (command == "5") { } else if (command == "5") {
this.model4 = true; this.model4 = true;
} }
this.inputData['1' + (10 + (this.indexs - 1)) + "51"] = command; this.inputData["1" + (10 + (this.indexs - 1)) + "51"] = command;
this.get53data(command) this.get53data(command);
var data53 = { var data53 = {
target: { target: {
value: this.inputData['1' + (10 + (this.indexs - 1)) + "51"], value: this.inputData["1" + (10 + (this.indexs - 1)) + "51"],
}, },
} };
this.changeBtn('1' + (10 + (this.indexs - 1)) + "51", data53); this.changeBtn("1" + (10 + (this.indexs - 1)) + "51", data53);
}, },
get53data(index) { get53data(index) {
var data = index; var data = index;
@ -710,7 +741,7 @@ export default {
this.data53 = text53; this.data53 = text53;
}, },
change00(index) { change00(index) {
this.topActive = index this.topActive = index;
// var list = ["0", "0", "0"]; // var list = ["0", "0", "0"];
// if (index == 1) { // if (index == 1) {
// list[0] = "1"; // list[0] = "1";
@ -727,32 +758,52 @@ export default {
// } else { // } else {
// list[2] = "0"; // list[2] = "0";
// } // }
this.inputData['1' + (10 + (this.indexs - 1)) + '00'] = index this.inputData["1" + (10 + (this.indexs - 1)) + "00"] = index;
// var num = list.join(""); // var num = list.join("");
var dataNum = { var dataNum = {
target: { target: {
value: index, value: index,
}, },
}; };
this.changeBtn('1' + (10 + (this.indexs - 1)) + "00", dataNum); this.changeBtn("1" + (10 + (this.indexs - 1)) + "00", dataNum);
}, },
padString(str, length) { padString(str, length) {
return str.padStart(length, '0'); return str.padStart(length, "0");
}, },
getType00() { getType00() {
var number = this.padString(this.inputData['1' + (10 + (this.indexs - 1)) + "00"].toString(2), 3) var number = this.padString(
this.inputData["1" + (10 + (this.indexs - 1)) + "00"].toString(2),
3
);
if (Number(number[0])) { if (Number(number[0])) {
this.topActive = 1 this.topActive = 1;
} else if (Number(number[1])) { } else if (Number(number[1])) {
this.topActive = 2 this.topActive = 2;
} else if (Number(number[2])) { } else if (Number(number[2])) {
this.topActive = 3 this.topActive = 3;
} else { } else {
this.topActive = 0 this.topActive = 0;
} }
console.log(this.topActive, 11); console.log(this.topActive, 11);
}, },
change71() {
var num = 0;
if (this.inputData["1" + (10 + (this.indexs - 1)) + "71"] == 1) {
this.inputData["1" + (10 + (this.indexs - 1)) + "71"] = 0;
num = 0;
} else {
this.inputData["1" + (10 + (this.indexs - 1)) + "71"] = 1;
num = 1;
}
var dataNum = {
target: {
value: num,
},
};
this.changeBtn("1" + (10 + (this.indexs - 1)) + "71", dataNum);
},
change59() { change59() {
// var list = ["0", "0", "0", "0"]; // var list = ["0", "0", "0", "0"];
// if (this.open1) { // if (this.open1) {
@ -775,13 +826,13 @@ export default {
// } else { // } else {
// list[0] = "0"; // list[0] = "0";
// } // }
var num = 0 var num = 0;
if (this.inputData['1' + (10 + (this.indexs - 1)) + '62'] == 1) { if (this.inputData["1" + (10 + (this.indexs - 1)) + "62"] == 1) {
this.inputData['1' + (10 + (this.indexs - 1)) + '62'] = 0 this.inputData["1" + (10 + (this.indexs - 1)) + "62"] = 0;
num = 0 num = 0;
} else { } else {
this.inputData['1' + (10 + (this.indexs - 1)) + '62'] = 1 this.inputData["1" + (10 + (this.indexs - 1)) + "62"] = 1;
num = 1 num = 1;
} }
var dataNum = { var dataNum = {
@ -789,10 +840,13 @@ export default {
value: num, value: num,
}, },
}; };
this.changeBtn('1' + (10 + (this.indexs - 1)) + "62", dataNum); this.changeBtn("1" + (10 + (this.indexs - 1)) + "62", dataNum);
}, },
getType() { getType() {
var number = this.padString(this.inputData['1' + (10 + (this.indexs - 1)) + "59"].toString(2), 4) var number = this.padString(
this.inputData["1" + (10 + (this.indexs - 1)) + "59"].toString(2),
4
);
console.log(number); console.log(number);
if (Number(number[3])) { if (Number(number[3])) {
this.open1 = true; this.open1 = true;
@ -818,44 +872,66 @@ export default {
} }
}, },
dataInit() { dataInit() {
var indexs = this.indexs var indexs = this.indexs;
var store = this.$store.state var store = this.$store.state;
var data = { var data = {
deviceId: store.equipmentList[store.equipmentIndex - 1].deviceId, deviceId: store.equipmentList[store.equipmentIndex - 1].deviceId,
}; };
// this.api.readFi_irrigate() // this.api.readFi_irrigate()
this.api.readFi_irrigate(`/readFi/irrigate${indexs}`, data).then((res) => { this.api
this.loading.close() .readFi_irrigate(`/readFi/irrigate${indexs}`, data)
if (res.data.code == 200) { .then((res) => {
this.inputData = res.data.data; this.loading.close();
// this.getType(); if (res.data.code == 200) {
// this.getType00(); this.inputData = res.data.data;
this.get53data(this.inputData['1' + (10 + (this.indexs - 1)) + "51"]); // this.getType();
this.inputData['1' + (10 + (indexs - 1)) + '01'] = this.countData10(this.inputData['1' + (10 + (indexs - 1)) + '01']) // this.getType00();
this.inputData['1' + (10 + (indexs - 1)) + '06'] = this.countData10(this.inputData['1' + (10 + (indexs - 1)) + '06']) this.get53data(
this.inputData['1' + (10 + (indexs - 1)) + '17'] = this.countData10(this.inputData['1' + (10 + (indexs - 1)) + '17']) this.inputData["1" + (10 + (this.indexs - 1)) + "51"]
this.inputData['1' + (10 + (indexs - 1)) + '39'] = this.countData10(this.inputData['1' + (10 + (indexs - 1)) + '39']) );
this.inputData['1' + (10 + (indexs - 1)) + '40'] = this.countData10(this.inputData['1' + (10 + (indexs - 1)) + '40']) this.inputData["1" + (10 + (indexs - 1)) + "01"] = this.countData10(
this.inputData['1' + (10 + (indexs - 1)) + '43'] = this.countData10(this.inputData['1' + (10 + (indexs - 1)) + '43']) this.inputData["1" + (10 + (indexs - 1)) + "01"]
this.inputData['1' + (10 + (indexs - 1)) + '44'] = this.countData10(this.inputData['1' + (10 + (indexs - 1)) + '44']) );
this.inputData['1' + (10 + (indexs - 1)) + '37'] = this.countData10(this.inputData['1' + (10 + (indexs - 1)) + '37']) this.inputData["1" + (10 + (indexs - 1)) + "06"] = this.countData10(
this.inputData['1' + (10 + (indexs - 1)) + '38'] = this.countData10(this.inputData['1' + (10 + (indexs - 1)) + '38']) this.inputData["1" + (10 + (indexs - 1)) + "06"]
);
this.inputData["1" + (10 + (indexs - 1)) + "17"] = this.countData10(
this.inputData["1" + (10 + (indexs - 1)) + "17"]
);
this.inputData["1" + (10 + (indexs - 1)) + "39"] = this.countData10(
this.inputData["1" + (10 + (indexs - 1)) + "39"]
);
this.inputData["1" + (10 + (indexs - 1)) + "40"] = this.countData10(
this.inputData["1" + (10 + (indexs - 1)) + "40"]
);
this.inputData["1" + (10 + (indexs - 1)) + "43"] = this.countData10(
this.inputData["1" + (10 + (indexs - 1)) + "43"]
);
this.inputData["1" + (10 + (indexs - 1)) + "44"] = this.countData10(
this.inputData["1" + (10 + (indexs - 1)) + "44"]
);
this.inputData["1" + (10 + (indexs - 1)) + "37"] = this.countData10(
this.inputData["1" + (10 + (indexs - 1)) + "37"]
);
this.inputData["1" + (10 + (indexs - 1)) + "38"] = this.countData10(
this.inputData["1" + (10 + (indexs - 1)) + "38"]
);
this.model4Sel = this.inputData['1' + (10 + (indexs - 1)) + '71'] this.model4Sel = this.inputData["1" + (10 + (indexs - 1)) + "71"];
} else { } else {
this.$message.error(res.data.msg); this.$message.error(res.data.msg);
} }
}); });
}, },
// //
selectValue(e) { selectValue(e) {
var store = this.$store.state var store = this.$store.state;
store.nowInput = e.target.value store.nowInput = e.target.value;
e.currentTarget.select(); e.currentTarget.select();
}, },
// //
blurChange10(code, el) { blurChange10(code, el) {
var store = this.$store.state var store = this.$store.state;
var data = { var data = {
equipmentId: store.equipmentList[store.equipmentIndex - 1].deviceId, equipmentId: store.equipmentList[store.equipmentIndex - 1].deviceId,
regAddress: code, regAddress: code,
@ -868,11 +944,10 @@ export default {
// this.timer && clearInterval(this.timer); // this.timer && clearInterval(this.timer);
// this.changeData(data); // this.changeData(data);
// } // }
}, },
// //
blurChange(code, el) { blurChange(code, el) {
var store = this.$store.state var store = this.$store.state;
var data = { var data = {
equipmentId: store.equipmentList[store.equipmentIndex - 1].deviceId, equipmentId: store.equipmentList[store.equipmentIndex - 1].deviceId,
regAddress: code, regAddress: code,
@ -885,10 +960,9 @@ export default {
// this.timer && clearInterval(this.timer); // this.timer && clearInterval(this.timer);
// this.changeData(data); // this.changeData(data);
// } // }
}, },
changeBtn(code, el) { changeBtn(code, el) {
var store = this.$store.state var store = this.$store.state;
var data = { var data = {
equipmentId: store.equipmentList[store.equipmentIndex - 1].deviceId, equipmentId: store.equipmentList[store.equipmentIndex - 1].deviceId,
regAddress: code, regAddress: code,
@ -912,12 +986,10 @@ export default {
} }
}, 100); }, 100);
}, },
changeModel4() { changeModel4() { },
},
// //
change(code, el) { change(code, el) {
var store = this.$store.state var store = this.$store.state;
var data = { var data = {
equipmentId: store.equipmentList[store.equipmentIndex - 1].deviceId, equipmentId: store.equipmentList[store.equipmentIndex - 1].deviceId,
regAddress: code, regAddress: code,
@ -932,7 +1004,6 @@ export default {
// let j = this.$store.state.lateSend; // let j = this.$store.state.lateSend;
// // // //
// this.timer && clearInterval(this.timer); // this.timer && clearInterval(this.timer);
// this.timer = setInterval(() => { // this.timer = setInterval(() => {
// ++i; // ++i;
// if (i == j) { // if (i == j) {
@ -942,20 +1013,20 @@ export default {
// }, 100); // }, 100);
}, },
changeData(data) { changeData(data) {
var store = this.$store.state var store = this.$store.state;
this.api.postwriteFi_write(data).then((res) => { this.api.postwriteFi_write(data).then((res) => {
if (res.data.code == 200) { if (res.data.code == 200) {
this.$message({ this.$message({
message: res.data.msg, message: res.data.msg,
type: "success", type: "success",
}); });
store.nowInput = '' store.nowInput = "";
// this.dataInit(); // this.dataInit();
} else { } else {
this.inputData[data.regAddress] = store.nowInput this.inputData[data.regAddress] = store.nowInput;
this.$message.error(res.data.msg); this.$message.error(res.data.msg);
} }
this.timer = null this.timer = null;
}); });
}, },
handleClose1(done) { handleClose1(done) {