|
@@ -1,5 +1,5 @@
|
|
|
<script setup>
|
|
|
-import { ref, onMounted, computed, unref } from 'vue';
|
|
|
+import { ref, onMounted, computed, unref, watch } from 'vue';
|
|
|
import { NScrollbar, useMessage, NTabs, NTabPane, c } from 'naive-ui';
|
|
|
import { TheChatView } from '@/components';
|
|
|
import { controlApi } from "@/api/control";
|
|
@@ -62,6 +62,39 @@ const baseSourceParams = ref({
|
|
|
|
|
|
// 当前Tab选中的key
|
|
|
const tabActiveKey = computed(() => tabKeyEnum[baseSourceParams.value.type]);
|
|
|
+// 计算碳氮比
|
|
|
+const tdbNum = computed(() => {
|
|
|
+ const type = tabActiveKey.value;
|
|
|
+
|
|
|
+ const {
|
|
|
+ jsLlOne, jsLlTwo,
|
|
|
+ jsCodOne, jsCodTwo,
|
|
|
+ jsTnOne, jsTnTwo
|
|
|
+ } = dataSourceParams.value[type];
|
|
|
+
|
|
|
+ const {
|
|
|
+ tydl, zhxs
|
|
|
+ } = baseSourceParams.value
|
|
|
+
|
|
|
+ const { tytjzl } = waterConfigParams.value;
|
|
|
+
|
|
|
+ if ( type === 'auto' || type === 'worker' ) {
|
|
|
+ const jsll = Math.max( jsLlOne, jsLlTwo );
|
|
|
+ const cod = Math.max( jsCodOne, jsCodTwo );
|
|
|
+ const jsTn = Math.max( jsTnOne, jsTnTwo );
|
|
|
+ return Number(((tytjzl*1000/jsll*tydl+cod*zhxs*tydl)/jsTn).toFixed(2));
|
|
|
+ }
|
|
|
+ if ( type === 'onePool' ) {
|
|
|
+ return Number(((tytjzl*1000/jsLlOne*tydl+jsCodOne*zhxs*tydl)/jsTnOne).toFixed(2));
|
|
|
+ }
|
|
|
+ if ( type === 'twoPool' ) {
|
|
|
+ return Number(((tytjzl*1000/jsLlTwo*tydl+jsCodTwo*zhxs*tydl)/jsTnTwo).toFixed(2));
|
|
|
+ }
|
|
|
+})
|
|
|
+
|
|
|
+watch(() => tdbNum.value , tdb => {
|
|
|
+ columnData.value[columnData.value.length - 1].value = tdb;
|
|
|
+})
|
|
|
|
|
|
// 编辑系数 - confirm
|
|
|
const onEditConfirm = () => {
|
|
@@ -152,12 +185,14 @@ const onConfirmUpdate = async () => {
|
|
|
const handleMedicateAmount = () => {
|
|
|
const type = tabActiveKey.value;
|
|
|
const lastNum = unref(updateNum);
|
|
|
+ const tdb = tdbNum.value;
|
|
|
|
|
|
- if ( tabActiveKey.value === 'worker' ) {
|
|
|
+ if ( type === 'worker' ) {
|
|
|
const medicineNum = dataSourceParams.value.worker.medicineAmount;
|
|
|
if ( medicineNum || medicineNum == 0 ) {
|
|
|
updateNum.value = medicineNum;
|
|
|
isVisibleUpdateInfo.value = true;
|
|
|
+ baseSourceParams.value.tdb = tdb;
|
|
|
message.warning("有新投放方案, 请查看")
|
|
|
} else {
|
|
|
updateNum.value = null;
|
|
@@ -172,18 +207,21 @@ const handleMedicateAmount = () => {
|
|
|
if ( type === 'auto' && maxR !== lastNum) {
|
|
|
updateNum.value = maxR;
|
|
|
isVisibleUpdateInfo.value = true;
|
|
|
+ baseSourceParams.value.tdb = tdb;
|
|
|
message.warning("有新的投放方案, 请查看");
|
|
|
}
|
|
|
|
|
|
- if ( type === 'onePool' && r1 != lastNum ) {
|
|
|
+ if ( type === 'onePool' && r1 != lastNum) {
|
|
|
updateNum.value = r1;
|
|
|
isVisibleUpdateInfo.value = true;
|
|
|
+ baseSourceParams.value.tdb = tdb;
|
|
|
message.warning("有新的投放方案, 请查看");
|
|
|
}
|
|
|
|
|
|
if ( type === 'twoPool' && r2 != lastNum ) {
|
|
|
updateNum.value = r2;
|
|
|
isVisibleUpdateInfo.value = true;
|
|
|
+ baseSourceParams.value.tdb = tdb;
|
|
|
message.warning("有新的投放方案, 请查看");
|
|
|
}
|
|
|
|
|
@@ -194,7 +232,7 @@ onMounted(async () => {
|
|
|
await controlApi.getBaseData().then(({ data }) => {
|
|
|
const {
|
|
|
numberBeng = 0, type = 0,
|
|
|
- htfksd, jzxs, xzxs, kzxs, slfpxs, tydl, zhxs, sxps, yymd, zxqdll, tdb,
|
|
|
+ htfksd, jzxs, xzxs, kzxs, slfpxs, tydl, zhxs, sxps, yymd, zxqdll,
|
|
|
medicineAmount,
|
|
|
addType,
|
|
|
tytjTransientLL
|
|
@@ -203,10 +241,10 @@ onMounted(async () => {
|
|
|
baseSourceParams.value = {
|
|
|
...baseSourceParams.value,
|
|
|
numberBeng, type,
|
|
|
- htfksd, jzxs, xzxs, kzxs, slfpxs, tydl, zhxs, sxps, yymd, zxqdll, tdb,
|
|
|
+ htfksd, jzxs, xzxs, kzxs, slfpxs, tydl, zhxs, sxps, yymd, zxqdll,
|
|
|
addType
|
|
|
};
|
|
|
-
|
|
|
+
|
|
|
updateNum.value = medicineAmount;
|
|
|
|
|
|
doseNum.value = medicineAmount;
|
|
@@ -214,22 +252,29 @@ onMounted(async () => {
|
|
|
flowNum.value = tytjTransientLL;
|
|
|
|
|
|
dataSourceParams.value[tabActiveKey.value] = data;
|
|
|
-
|
|
|
- columnData.value = columnData.value.map(item => {
|
|
|
- item.value = data[item.key];
|
|
|
- return item;
|
|
|
- })
|
|
|
+
|
|
|
})
|
|
|
|
|
|
+
|
|
|
// 获取实时数据
|
|
|
controlApi.getNumValue().then(({ data }) => {
|
|
|
|
|
|
Object.entries(data).forEach(([key, val]) => {
|
|
|
data[key] = val;
|
|
|
});
|
|
|
+
|
|
|
// water实时数据
|
|
|
waterConfigParams.value = data;
|
|
|
|
|
|
+ // 重新计算碳氮比
|
|
|
+ const tdb = tdbNum.value;
|
|
|
+ baseSourceParams.value.tdb = tdb;
|
|
|
+
|
|
|
+ columnData.value = columnData.value.map(item => {
|
|
|
+ item.value = item.key === 'tdb' ? tdb : dataSourceParams.value[tabActiveKey.value][item.key];
|
|
|
+ return item;
|
|
|
+ })
|
|
|
+
|
|
|
const params = {
|
|
|
jsLlType: 1,
|
|
|
jsLlOne: data.jslYB,
|