|
@@ -3,7 +3,7 @@
|
|
|
<custom-header :name="pageType === 'plant' ? '种植方案' : '农事规划'"></custom-header>
|
|
<custom-header :name="pageType === 'plant' ? '种植方案' : '农事规划'"></custom-header>
|
|
|
<div class="plan-content">
|
|
<div class="plan-content">
|
|
|
<div class="plan-content-header" v-if="pageType === 'plant'">
|
|
<div class="plan-content-header" v-if="pageType === 'plant'">
|
|
|
- <el-select class="select-item" v-model="specieValue" placeholder="选择品类" @change="getListMySchemes">
|
|
|
|
|
|
|
+ <el-select class="select-item" v-model="specieValue" placeholder="选择品类" @change="() => getListMySchemes('left')">
|
|
|
<el-option
|
|
<el-option
|
|
|
v-for="item in options"
|
|
v-for="item in options"
|
|
|
:key="item.id"
|
|
:key="item.id"
|
|
@@ -11,7 +11,14 @@
|
|
|
:value="item.defaultContainerId"
|
|
:value="item.defaultContainerId"
|
|
|
/>
|
|
/>
|
|
|
</el-select>
|
|
</el-select>
|
|
|
- <tab-list type="light" v-model="active" :tabs="tabs" @change="handleTabChange" />
|
|
|
|
|
|
|
+ <tab-list
|
|
|
|
|
+ class="tabs-list"
|
|
|
|
|
+ type="light"
|
|
|
|
|
+ v-model="active"
|
|
|
|
|
+ :tabs="tabs"
|
|
|
|
|
+ :scrollType="scrollType"
|
|
|
|
|
+ @change="handleTabChange"
|
|
|
|
|
+ />
|
|
|
</div>
|
|
</div>
|
|
|
<farm-work-plan-timeline
|
|
<farm-work-plan-timeline
|
|
|
class="timeline-container"
|
|
class="timeline-container"
|
|
@@ -20,7 +27,8 @@
|
|
|
'timeline-container-no-permission': !hasPlanPermission,
|
|
'timeline-container-no-permission': !hasPlanPermission,
|
|
|
}"
|
|
}"
|
|
|
:pageType="pageType"
|
|
:pageType="pageType"
|
|
|
- :containerId="specieValue"
|
|
|
|
|
|
|
+ :farmId="route.query.farmId"
|
|
|
|
|
+ :containerId="containerIdData"
|
|
|
@row-click="handleRowClick"
|
|
@row-click="handleRowClick"
|
|
|
@edit="handleEdit"
|
|
@edit="handleEdit"
|
|
|
:disableClick="!hasPlanPermission"
|
|
:disableClick="!hasPlanPermission"
|
|
@@ -30,7 +38,7 @@
|
|
|
<div class="bottom-btn-group">
|
|
<div class="bottom-btn-group">
|
|
|
<div class="bottom-btn secondary-btn" @click="handlePhenologySetting">物候期设置</div>
|
|
<div class="bottom-btn secondary-btn" @click="handlePhenologySetting">物候期设置</div>
|
|
|
<div class="bottom-btn secondary-btn" v-if="pageType === 'plant'" @click="openCopyPlanPopup">
|
|
<div class="bottom-btn secondary-btn" v-if="pageType === 'plant'" @click="openCopyPlanPopup">
|
|
|
- {{ defaultContainerId === specieValue ? "复制方案" : "方案设置" }}
|
|
|
|
|
|
|
+ {{ active === tabs[0]?.id ? "复制方案" : "方案设置" }}
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
<div class="bottom-btn primary-btn" @click="addNewTask">新增农事</div>
|
|
<div class="bottom-btn primary-btn" @click="addNewTask">新增农事</div>
|
|
@@ -48,13 +56,15 @@
|
|
|
<!-- 复制方案弹窗 -->
|
|
<!-- 复制方案弹窗 -->
|
|
|
<Popup v-model:show="showCopyPlan" class="copy-plan-popup" round closeable :close-on-click-overlay="false">
|
|
<Popup v-model:show="showCopyPlan" class="copy-plan-popup" round closeable :close-on-click-overlay="false">
|
|
|
<div class="copy-plan-content">
|
|
<div class="copy-plan-content">
|
|
|
- <div class="label">{{ defaultContainerId === specieValue ? "复制为" : "方案名称" }}</div>
|
|
|
|
|
|
|
+ <div class="label">{{ active === tabs[0]?.id ? "复制为" : "方案名称" }}</div>
|
|
|
<el-input v-model="copyPlanName" size="large" placeholder="请输入方案名称" class="copy-plan-input" />
|
|
<el-input v-model="copyPlanName" size="large" placeholder="请输入方案名称" class="copy-plan-input" />
|
|
|
</div>
|
|
</div>
|
|
|
<div class="copy-plan-footer">
|
|
<div class="copy-plan-footer">
|
|
|
- <div class="btn btn-cancel" @click="handleCancelCopyPlan">{{ defaultContainerId === specieValue ? "取消复制" : "删除方案" }}</div>
|
|
|
|
|
|
|
+ <div class="btn btn-cancel" @click="handleCancelCopyPlan">
|
|
|
|
|
+ {{ active === tabs[0]?.id ? "取消复制" : "删除方案" }}
|
|
|
|
|
+ </div>
|
|
|
<div class="btn btn-confirm" @click="handleConfirmCopyPlan">
|
|
<div class="btn btn-confirm" @click="handleConfirmCopyPlan">
|
|
|
- {{ active === 1 ? "确定复制" : "确定设置" }}
|
|
|
|
|
|
|
+ {{ active === tabs[0]?.id ? "确定复制" : "确定设置" }}
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
</Popup>
|
|
</Popup>
|
|
@@ -100,7 +110,7 @@ import { useRouter, useRoute } from "vue-router";
|
|
|
import detailDialog from "@/components/detailDialog.vue";
|
|
import detailDialog from "@/components/detailDialog.vue";
|
|
|
import eventBus from "@/api/eventBus";
|
|
import eventBus from "@/api/eventBus";
|
|
|
import interactPopup from "@/components/popup/interactPopup.vue";
|
|
import interactPopup from "@/components/popup/interactPopup.vue";
|
|
|
-import { ElMessage } from "element-plus";
|
|
|
|
|
|
|
+import { ElMessage,ElMessageBox } from "element-plus";
|
|
|
const router = useRouter();
|
|
const router = useRouter();
|
|
|
const route = useRoute();
|
|
const route = useRoute();
|
|
|
|
|
|
|
@@ -122,49 +132,61 @@ const pageType = ref("");
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
|
pageType.value = route.query.pageType || "";
|
|
pageType.value = route.query.pageType || "";
|
|
|
- if (pageType.value === "plant") {
|
|
|
|
|
- getSpecieList();
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ getSpecieList();
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
// 获取品类列表
|
|
// 获取品类列表
|
|
|
const specieValue = ref(null);
|
|
const specieValue = ref(null);
|
|
|
-const defaultContainerId = ref(null);
|
|
|
|
|
const options = ref([]);
|
|
const options = ref([]);
|
|
|
const userInfo = JSON.parse(localStorage.getItem("localUserInfo"));
|
|
const userInfo = JSON.parse(localStorage.getItem("localUserInfo"));
|
|
|
const getSpecieList = () => {
|
|
const getSpecieList = () => {
|
|
|
VE_API.farm.fetchSpecieList({ agriculturalId: userInfo.agriculturalId }).then(({ data }) => {
|
|
VE_API.farm.fetchSpecieList({ agriculturalId: userInfo.agriculturalId }).then(({ data }) => {
|
|
|
options.value = data || [];
|
|
options.value = data || [];
|
|
|
specieValue.value = data[0].defaultContainerId;
|
|
specieValue.value = data[0].defaultContainerId;
|
|
|
- defaultContainerId.value = data[0].defaultContainerId;
|
|
|
|
|
- getListMySchemes();
|
|
|
|
|
|
|
+ getListMySchemes('left');
|
|
|
});
|
|
});
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
// 获取方案列表
|
|
// 获取方案列表
|
|
|
const active = ref(null);
|
|
const active = ref(null);
|
|
|
const tabs = ref([]);
|
|
const tabs = ref([]);
|
|
|
-const getListMySchemes = () => {
|
|
|
|
|
|
|
+// 控制标签滚动方向:'left' | 'right' | 'auto' | ''
|
|
|
|
|
+const scrollType = ref("auto");
|
|
|
|
|
+const containerIdData = ref(null);
|
|
|
|
|
+const getListMySchemes = (type = "auto") => {
|
|
|
VE_API.home.listMySchemes({ containerId: specieValue.value }).then(({ data }) => {
|
|
VE_API.home.listMySchemes({ containerId: specieValue.value }).then(({ data }) => {
|
|
|
tabs.value = data || [];
|
|
tabs.value = data || [];
|
|
|
- active.value = data[0].id;
|
|
|
|
|
- defaultContainerId.value = data[0].containerId;
|
|
|
|
|
|
|
+ containerIdData.value = data[0]?.containerId;
|
|
|
|
|
+ if (type === "right") {
|
|
|
|
|
+ active.value = data[data.length - 1].id;
|
|
|
|
|
+ } else if (type === "left") {
|
|
|
|
|
+ active.value = data[0].id;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ currentTab.value = data.filter((item) => item.id === currentTab.value.id)[0];
|
|
|
|
|
+ copyPlanName.value = currentTab.value.name;
|
|
|
|
|
+ }
|
|
|
|
|
+ scrollType.value = type;
|
|
|
getFarmWorkPlanForPhenology();
|
|
getFarmWorkPlanForPhenology();
|
|
|
});
|
|
});
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+const currentTab = ref(null);
|
|
|
const handleTabChange = (id, item) => {
|
|
const handleTabChange = (id, item) => {
|
|
|
active.value = id;
|
|
active.value = id;
|
|
|
- console.log(id, item);
|
|
|
|
|
|
|
+ currentTab.value = item;
|
|
|
|
|
+ getFarmWorkPlanForPhenology();
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
const mergedReproductiveList = ref([]);
|
|
const mergedReproductiveList = ref([]);
|
|
|
const containerSpaceTimeId = ref(null);
|
|
const containerSpaceTimeId = ref(null);
|
|
|
|
|
|
|
|
const getPhenologyList = async () => {
|
|
const getPhenologyList = async () => {
|
|
|
- const res = await VE_API.monitor.listPhenology({
|
|
|
|
|
|
|
+ const params = {
|
|
|
containerSpaceTimeId: containerSpaceTimeId.value,
|
|
containerSpaceTimeId: containerSpaceTimeId.value,
|
|
|
- });
|
|
|
|
|
|
|
+ agriculturalId: userInfo.agriculturalId,
|
|
|
|
|
+ farmId: route.query.farmId,
|
|
|
|
|
+ }
|
|
|
|
|
+ const res = await VE_API.monitor.listPhenology(params);
|
|
|
if (res.code === 0) {
|
|
if (res.code === 0) {
|
|
|
mergedReproductiveList.value = res.data || [];
|
|
mergedReproductiveList.value = res.data || [];
|
|
|
}
|
|
}
|
|
@@ -192,6 +214,9 @@ const copyPlanName = ref("");
|
|
|
const openCopyPlanPopup = () => {
|
|
const openCopyPlanPopup = () => {
|
|
|
copyPlanName.value = "";
|
|
copyPlanName.value = "";
|
|
|
showCopyPlan.value = true;
|
|
showCopyPlan.value = true;
|
|
|
|
|
+ if (active.value !== tabs.value[0]?.id) {
|
|
|
|
|
+ copyPlanName.value = currentTab.value.name;
|
|
|
|
|
+ }
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
// 物候期设置弹窗
|
|
// 物候期设置弹窗
|
|
@@ -205,6 +230,7 @@ const handlePhenologySetting = () => {
|
|
|
const handleConfirmPhenologySetting = async () => {
|
|
const handleConfirmPhenologySetting = async () => {
|
|
|
const params = {
|
|
const params = {
|
|
|
farmId: route.query.farmId,
|
|
farmId: route.query.farmId,
|
|
|
|
|
+ agriculturalId: userInfo.agriculturalId,
|
|
|
items: mergedReproductiveList.value.map((item) => ({
|
|
items: mergedReproductiveList.value.map((item) => ({
|
|
|
phenologyId: item.id,
|
|
phenologyId: item.id,
|
|
|
startDate: item.startDate,
|
|
startDate: item.startDate,
|
|
@@ -219,7 +245,27 @@ const handleConfirmPhenologySetting = async () => {
|
|
|
};
|
|
};
|
|
|
// 取消复制方案
|
|
// 取消复制方案
|
|
|
const handleCancelCopyPlan = () => {
|
|
const handleCancelCopyPlan = () => {
|
|
|
- showCopyPlan.value = false;
|
|
|
|
|
|
|
+ if (active.value === tabs.value[0]?.id) {
|
|
|
|
|
+ showCopyPlan.value = false;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ ElMessageBox.confirm("确定要删除该方案吗?", "提示", {
|
|
|
|
|
+ confirmButtonText: "确定",
|
|
|
|
|
+ cancelButtonText: "取消",
|
|
|
|
|
+ type: "warning",
|
|
|
|
|
+ }).then(() => {
|
|
|
|
|
+ VE_API.monitor
|
|
|
|
|
+ .deleteScheme({
|
|
|
|
|
+ schemeId: active.value,
|
|
|
|
|
+ })
|
|
|
|
|
+ .then(({ code }) => {
|
|
|
|
|
+ if (code === 0) {
|
|
|
|
|
+ showCopyPlan.value = false;
|
|
|
|
|
+ ElMessage.success("删除成功");
|
|
|
|
|
+ getListMySchemes('left');
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
// 确定复制方案
|
|
// 确定复制方案
|
|
@@ -228,15 +274,30 @@ const handleConfirmCopyPlan = () => {
|
|
|
ElMessage.warning("请输入方案名称");
|
|
ElMessage.warning("请输入方案名称");
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- if (defaultContainerId.value === specieValue.value) {
|
|
|
|
|
- VE_API.monitor.copyScheme({
|
|
|
|
|
- containerId: specieValue.value,
|
|
|
|
|
- sourceSchemeId: active.value,
|
|
|
|
|
|
|
+ if (active.value === tabs.value[0]?.id) {
|
|
|
|
|
+ VE_API.monitor
|
|
|
|
|
+ .copyScheme({
|
|
|
|
|
+ containerId: specieValue.value,
|
|
|
|
|
+ sourceSchemeId: active.value,
|
|
|
|
|
+ schemeName: copyPlanName.value,
|
|
|
|
|
+ })
|
|
|
|
|
+ .then(({ code,data }) => {
|
|
|
|
|
+ if (code === 0) {
|
|
|
|
|
+ showCopyPlan.value = false;
|
|
|
|
|
+ ElMessage.success("复制成功");
|
|
|
|
|
+ getListMySchemes('right');
|
|
|
|
|
+ currentTab.value = data
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }else{
|
|
|
|
|
+ VE_API.monitor.renameScheme({
|
|
|
|
|
+ schemeId: active.value,
|
|
|
|
|
+ name: copyPlanName.value,
|
|
|
}).then(({ code }) => {
|
|
}).then(({ code }) => {
|
|
|
if (code === 0) {
|
|
if (code === 0) {
|
|
|
showCopyPlan.value = false;
|
|
showCopyPlan.value = false;
|
|
|
- ElMessage.success("复制成功");
|
|
|
|
|
- getListMySchemes();
|
|
|
|
|
|
|
+ ElMessage.success("修改成功");
|
|
|
|
|
+ getListMySchemes('auto');
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
@@ -274,7 +335,6 @@ const handleRowClick = (item) => {
|
|
|
const interactPopupRef = ref(null);
|
|
const interactPopupRef = ref(null);
|
|
|
|
|
|
|
|
const handleEdit = (item) => {
|
|
const handleEdit = (item) => {
|
|
|
- console.log(item);
|
|
|
|
|
if (interactPopupRef.value) {
|
|
if (interactPopupRef.value) {
|
|
|
interactPopupRef.value.showPopup(item);
|
|
interactPopupRef.value.showPopup(item);
|
|
|
}
|
|
}
|
|
@@ -308,6 +368,10 @@ const handleDeleteInteract = (params) => {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ .tabs-list {
|
|
|
|
|
+ width: calc(100% - 94px);
|
|
|
|
|
+ margin-right: 8px;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
.timeline-container {
|
|
.timeline-container {
|
|
@@ -340,6 +404,7 @@ const handleDeleteInteract = (params) => {
|
|
|
left: 0;
|
|
left: 0;
|
|
|
width: 100%;
|
|
width: 100%;
|
|
|
height: 136px;
|
|
height: 136px;
|
|
|
|
|
+ pointer-events: none;
|
|
|
background: url("@/assets/img/monitor/popup-header-bg.png") no-repeat center center / 100% 100%;
|
|
background: url("@/assets/img/monitor/popup-header-bg.png") no-repeat center center / 100% 100%;
|
|
|
}
|
|
}
|
|
|
.copy-plan-content {
|
|
.copy-plan-content {
|