|
@@ -1,44 +1,113 @@
|
|
|
<template>
|
|
<template>
|
|
|
<popup
|
|
<popup
|
|
|
class="active-upload-popup"
|
|
class="active-upload-popup"
|
|
|
|
|
+ :class="{ 'interact-mode': mode === 'interact' }"
|
|
|
v-model:show="show"
|
|
v-model:show="show"
|
|
|
closeable
|
|
closeable
|
|
|
:close-on-click-overlay="false"
|
|
:close-on-click-overlay="false"
|
|
|
@closed="handleClosed"
|
|
@closed="handleClosed"
|
|
|
>
|
|
>
|
|
|
- <div class="header">
|
|
|
|
|
- <div class="title">
|
|
|
|
|
- <span class="required">*</span>
|
|
|
|
|
- {{ problemTitle }}
|
|
|
|
|
|
|
+ <!-- 互动设置模式 -->
|
|
|
|
|
+ <template v-if="mode === 'interact'">
|
|
|
|
|
+ <div class="interact-header">
|
|
|
|
|
+ <div class="interact-title">{{ interactTitle }}</div>
|
|
|
</div>
|
|
</div>
|
|
|
- <div class="date-input">
|
|
|
|
|
- <el-date-picker
|
|
|
|
|
- v-model="uploadDate"
|
|
|
|
|
- size="large"
|
|
|
|
|
- style="width: 100%"
|
|
|
|
|
- type="date"
|
|
|
|
|
- placeholder="请选择日期"
|
|
|
|
|
- :editable="false"
|
|
|
|
|
- />
|
|
|
|
|
|
|
+ <div class="interact-form">
|
|
|
|
|
+ <div class="form-item">
|
|
|
|
|
+ <div class="form-label">
|
|
|
|
|
+ <span class="required">*</span>
|
|
|
|
|
+ 请选择互动时间
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="form-input-wrapper">
|
|
|
|
|
+ <el-date-picker
|
|
|
|
|
+ v-model="interactTime"
|
|
|
|
|
+ size="large"
|
|
|
|
|
+ style="width: 100%"
|
|
|
|
|
+ type="date"
|
|
|
|
|
+ placeholder="请选择日期"
|
|
|
|
|
+ :editable="false"
|
|
|
|
|
+ />
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="form-item">
|
|
|
|
|
+ <div class="form-label">
|
|
|
|
|
+ <span class="required">*</span>
|
|
|
|
|
+ 请选择强制触发互动时间
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="form-input-wrapper">
|
|
|
|
|
+ <el-date-picker
|
|
|
|
|
+ v-model="forceTriggerTime"
|
|
|
|
|
+ size="large"
|
|
|
|
|
+ style="width: 100%"
|
|
|
|
|
+ type="date"
|
|
|
|
|
+ placeholder="请选择日期"
|
|
|
|
|
+ :editable="false"
|
|
|
|
|
+ />
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="form-item">
|
|
|
|
|
+ <div class="form-label">
|
|
|
|
|
+ <span class="required">*</span>
|
|
|
|
|
+ 请设置互动问题
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <el-input
|
|
|
|
|
+ v-model="interactQuestion"
|
|
|
|
|
+ type="textarea"
|
|
|
|
|
+ :rows="4"
|
|
|
|
|
+ placeholder="请设置互动问题"
|
|
|
|
|
+ class="question-textarea"
|
|
|
|
|
+ />
|
|
|
|
|
+ </div>
|
|
|
</div>
|
|
</div>
|
|
|
- </div>
|
|
|
|
|
- <div class="header" v-if="needExecutor">
|
|
|
|
|
- <div class="title">
|
|
|
|
|
- <span class="required">*</span>
|
|
|
|
|
- 请确认执行人
|
|
|
|
|
|
|
+ <div class="interact-buttons">
|
|
|
|
|
+ <div class="btn-delete" @click="handleDeleteInteract">删除互动</div>
|
|
|
|
|
+ <div class="btn-save" :class="{ disabled: isUploading }" @click="handleSaveInteract">
|
|
|
|
|
+ {{ saveButtonText }}
|
|
|
|
|
+ </div>
|
|
|
</div>
|
|
</div>
|
|
|
- <div class="date-input">
|
|
|
|
|
- <el-select v-model="executorId" placeholder="请选择执行人">
|
|
|
|
|
- <el-option v-for="item in executorList" :key="item.id" :label="item.name" :value="item.id"></el-option>
|
|
|
|
|
- </el-select>
|
|
|
|
|
|
|
+ </template>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 原有上传模式 -->
|
|
|
|
|
+ <template v-else>
|
|
|
|
|
+ <div class="header">
|
|
|
|
|
+ <div class="title">
|
|
|
|
|
+ <span class="required">*</span>
|
|
|
|
|
+ {{ problemTitle }}
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="date-input">
|
|
|
|
|
+ <el-date-picker
|
|
|
|
|
+ v-model="uploadDate"
|
|
|
|
|
+ size="large"
|
|
|
|
|
+ style="width: 100%"
|
|
|
|
|
+ type="date"
|
|
|
|
|
+ placeholder="请选择日期"
|
|
|
|
|
+ :editable="false"
|
|
|
|
|
+ />
|
|
|
|
|
+ </div>
|
|
|
</div>
|
|
</div>
|
|
|
- </div>
|
|
|
|
|
- <div class="tips-text">上传照片,诊断更准确哦~</div>
|
|
|
|
|
- <upload :textShow="true" class="upload-wrap" exampleImg>
|
|
|
|
|
- <img class="example" src="@/assets/img/home/example-4.png" alt="" />
|
|
|
|
|
- <img class="example" src="@/assets/img/home/plus.png" alt="" />
|
|
|
|
|
- </upload>
|
|
|
|
|
- <div class="btn" :class="{ 'disabled': isUploading }" @click="handleUpload">{{ isUploading ? '提交中...' : '确认' }}</div>
|
|
|
|
|
|
|
+ <div class="header" v-if="needExecutor">
|
|
|
|
|
+ <div class="title">
|
|
|
|
|
+ <span class="required">*</span>
|
|
|
|
|
+ 请确认执行人
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="date-input">
|
|
|
|
|
+ <el-select v-model="executorId" placeholder="请选择执行人">
|
|
|
|
|
+ <el-option
|
|
|
|
|
+ v-for="item in executorList"
|
|
|
|
|
+ :key="item.id"
|
|
|
|
|
+ :label="item.name"
|
|
|
|
|
+ :value="item.id"
|
|
|
|
|
+ ></el-option>
|
|
|
|
|
+ </el-select>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="tips-text">上传照片,诊断更准确哦~</div>
|
|
|
|
|
+ <upload :textShow="true" class="upload-wrap" exampleImg>
|
|
|
|
|
+ <img class="example" src="@/assets/img/home/example-4.png" alt="" />
|
|
|
|
|
+ <img class="example" src="@/assets/img/home/plus.png" alt="" />
|
|
|
|
|
+ </upload>
|
|
|
|
|
+ <div class="btn" :class="{ disabled: isUploading }" @click="handleUpload">{{ uploadButtonText }}</div>
|
|
|
|
|
+ </template>
|
|
|
</popup>
|
|
</popup>
|
|
|
|
|
|
|
|
<!-- 上传成功提示弹窗 -->
|
|
<!-- 上传成功提示弹窗 -->
|
|
@@ -54,10 +123,18 @@
|
|
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
|
import { Popup } from "vant";
|
|
import { Popup } from "vant";
|
|
|
-import { onMounted, onUnmounted, ref } from "vue";
|
|
|
|
|
|
|
+import { onMounted, onUnmounted, ref, computed } from "vue";
|
|
|
import upload from "@/components/upload";
|
|
import upload from "@/components/upload";
|
|
|
import eventBus from "@/api/eventBus";
|
|
import eventBus from "@/api/eventBus";
|
|
|
-import { ElMessage } from "element-plus";
|
|
|
|
|
|
|
+import { ElMessage, ElMessageBox } from "element-plus";
|
|
|
|
|
+
|
|
|
|
|
+// 常量定义
|
|
|
|
|
+const MODE = {
|
|
|
|
|
+ UPLOAD: "upload",
|
|
|
|
|
+ INTERACT: "interact",
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+// Props
|
|
|
const props = defineProps({
|
|
const props = defineProps({
|
|
|
needExecutor: {
|
|
needExecutor: {
|
|
|
type: Boolean,
|
|
type: Boolean,
|
|
@@ -65,103 +142,241 @@ const props = defineProps({
|
|
|
},
|
|
},
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
+// Emits
|
|
|
|
|
+const emit = defineEmits(["handleUploadSuccess", "handleDeleteInteract"]);
|
|
|
|
|
+
|
|
|
|
|
+// 响应式数据
|
|
|
const show = ref(false);
|
|
const show = ref(false);
|
|
|
const gardenId = ref(null);
|
|
const gardenId = ref(null);
|
|
|
const images = ref([]);
|
|
const images = ref([]);
|
|
|
const uploadDate = ref("");
|
|
const uploadDate = ref("");
|
|
|
const problemTitle = ref("请选择问题");
|
|
const problemTitle = ref("请选择问题");
|
|
|
const successShow = ref(false);
|
|
const successShow = ref(false);
|
|
|
-const isUploading = ref(false); // 标记是否正在上传中
|
|
|
|
|
-onMounted(() => {
|
|
|
|
|
- eventBus.off("upload:changeArr", uploadChange);
|
|
|
|
|
- eventBus.on("upload:changeArr", uploadChange);
|
|
|
|
|
- eventBus.on("activeUpload:show", handleShow);
|
|
|
|
|
- eventBus.on("activeUpload:success", handleSuccess);
|
|
|
|
|
-});
|
|
|
|
|
-
|
|
|
|
|
-function uploadChange(arr) {
|
|
|
|
|
- images.value = arr;
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-function formatDate(date) {
|
|
|
|
|
- let year = date.getFullYear();
|
|
|
|
|
- let month = String(date.getMonth() + 1).padStart(2, "0");
|
|
|
|
|
- let day = String(date.getDate()).padStart(2, "0");
|
|
|
|
|
- return `${year}-${month}-${day}`;
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
|
|
+const isUploading = ref(false);
|
|
|
const type = ref(null);
|
|
const type = ref(null);
|
|
|
const arrangeId = ref(null);
|
|
const arrangeId = ref(null);
|
|
|
const executorId = ref(null);
|
|
const executorId = ref(null);
|
|
|
const executorList = ref([]);
|
|
const executorList = ref([]);
|
|
|
-function handleShow({ gardenIdVal, problemTitleVal, typeVal ,arrangeIdVal, executorListVal}) {
|
|
|
|
|
|
|
+
|
|
|
|
|
+// 互动设置模式相关数据
|
|
|
|
|
+const mode = ref(MODE.UPLOAD);
|
|
|
|
|
+const interactTitle = ref("梢期杀虫");
|
|
|
|
|
+const interactTime = ref("");
|
|
|
|
|
+const forceTriggerTime = ref("");
|
|
|
|
|
+const interactQuestion = ref("");
|
|
|
|
|
+
|
|
|
|
|
+// 计算属性
|
|
|
|
|
+const isInteractMode = computed(() => mode.value === MODE.INTERACT);
|
|
|
|
|
+const isUploadMode = computed(() => mode.value === MODE.UPLOAD);
|
|
|
|
|
+const uploadButtonText = computed(() => (isUploading.value ? "提交中..." : "确认"));
|
|
|
|
|
+const saveButtonText = computed(() => (isUploading.value ? "保存中..." : "保存修改"));
|
|
|
|
|
+
|
|
|
|
|
+// 工具函数
|
|
|
|
|
+const formatDate = (date) => {
|
|
|
|
|
+ if (!date) return "";
|
|
|
|
|
+ const d = date instanceof Date ? date : new Date(date);
|
|
|
|
|
+ const year = d.getFullYear();
|
|
|
|
|
+ const month = String(d.getMonth() + 1).padStart(2, "0");
|
|
|
|
|
+ const day = String(d.getDate()).padStart(2, "0");
|
|
|
|
|
+ return `${year}-${month}-${day}`;
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+const resetInteractData = () => {
|
|
|
|
|
+ interactTime.value = "";
|
|
|
|
|
+ forceTriggerTime.value = "";
|
|
|
|
|
+ interactQuestion.value = "";
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+const resetUploadData = () => {
|
|
|
images.value = [];
|
|
images.value = [];
|
|
|
|
|
+ uploadDate.value = new Date();
|
|
|
|
|
+ executorId.value = null;
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+// 验证函数
|
|
|
|
|
+const validateInteractForm = () => {
|
|
|
|
|
+ if (!interactTime.value) {
|
|
|
|
|
+ ElMessage.warning("请选择互动时间");
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!forceTriggerTime.value) {
|
|
|
|
|
+ ElMessage.warning("请选择强制触发互动时间");
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!interactQuestion.value?.trim()) {
|
|
|
|
|
+ ElMessage.warning("请设置互动问题");
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ return true;
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+const validateUploadForm = () => {
|
|
|
|
|
+ if (images.value.length === 0) {
|
|
|
|
|
+ ElMessage.warning("请上传图片");
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ return true;
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+// 事件处理函数
|
|
|
|
|
+const uploadChange = (arr) => {
|
|
|
|
|
+ images.value = arr;
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+const handleShow = ({
|
|
|
|
|
+ gardenIdVal,
|
|
|
|
|
+ problemTitleVal,
|
|
|
|
|
+ typeVal,
|
|
|
|
|
+ arrangeIdVal,
|
|
|
|
|
+ executorListVal,
|
|
|
|
|
+ modeVal,
|
|
|
|
|
+ interactTitleVal,
|
|
|
|
|
+ interactTimeVal,
|
|
|
|
|
+ forceTriggerTimeVal,
|
|
|
|
|
+ interactQuestionVal,
|
|
|
|
|
+}) => {
|
|
|
|
|
+ // 重置数据
|
|
|
|
|
+ resetUploadData();
|
|
|
|
|
+ if (modeVal === MODE.INTERACT) {
|
|
|
|
|
+ resetInteractData();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 设置基础数据
|
|
|
gardenId.value = gardenIdVal;
|
|
gardenId.value = gardenIdVal;
|
|
|
problemTitle.value = problemTitleVal || "请选择问题";
|
|
problemTitle.value = problemTitleVal || "请选择问题";
|
|
|
- uploadDate.value = (new Date());
|
|
|
|
|
- show.value = true;
|
|
|
|
|
type.value = typeVal;
|
|
type.value = typeVal;
|
|
|
arrangeId.value = arrangeIdVal;
|
|
arrangeId.value = arrangeIdVal;
|
|
|
- executorList.value = executorListVal;
|
|
|
|
|
- // 重置上传状态
|
|
|
|
|
|
|
+ executorList.value = executorListVal || [];
|
|
|
|
|
+ mode.value = modeVal || MODE.UPLOAD;
|
|
|
isUploading.value = false;
|
|
isUploading.value = false;
|
|
|
-}
|
|
|
|
|
|
|
|
|
|
-function handleSuccess() {
|
|
|
|
|
- successShow.value = true;
|
|
|
|
|
-}
|
|
|
|
|
|
|
+ // 设置互动模式数据
|
|
|
|
|
+ if (mode.value === MODE.INTERACT) {
|
|
|
|
|
+ interactTitle.value = interactTitleVal || "梢期杀虫";
|
|
|
|
|
+ interactTime.value = interactTimeVal || "";
|
|
|
|
|
+ forceTriggerTime.value = forceTriggerTimeVal || "";
|
|
|
|
|
+ interactQuestion.value = interactQuestionVal || "";
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
-const emit = defineEmits(["handleUploadSuccess"]);
|
|
|
|
|
|
|
+ show.value = true;
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+const handleSuccess = () => {
|
|
|
|
|
+ successShow.value = true;
|
|
|
|
|
+};
|
|
|
|
|
|
|
|
const handleUpload = () => {
|
|
const handleUpload = () => {
|
|
|
- // 如果正在上传中,直接返回,防止重复调用
|
|
|
|
|
- if (isUploading.value) return;
|
|
|
|
|
-
|
|
|
|
|
- if (images.value.length === 0) return ElMessage.warning("请上传图片");
|
|
|
|
|
|
|
+ if (isUploading.value || !validateUploadForm()) return;
|
|
|
|
|
+
|
|
|
const paramsObj = {
|
|
const paramsObj = {
|
|
|
farmId: gardenId.value,
|
|
farmId: gardenId.value,
|
|
|
arrangeId: arrangeId.value,
|
|
arrangeId: arrangeId.value,
|
|
|
executeDate: formatDate(uploadDate.value),
|
|
executeDate: formatDate(uploadDate.value),
|
|
|
imagePaths: images.value,
|
|
imagePaths: images.value,
|
|
|
};
|
|
};
|
|
|
- if(type.value === "question"){
|
|
|
|
|
|
|
+
|
|
|
|
|
+ if (type.value === "question") {
|
|
|
show.value = false;
|
|
show.value = false;
|
|
|
emit("handleUploadSuccess", paramsObj);
|
|
emit("handleUploadSuccess", paramsObj);
|
|
|
- return
|
|
|
|
|
|
|
+ return;
|
|
|
}
|
|
}
|
|
|
- triggerFarmWork(paramsObj,true)
|
|
|
|
|
|
|
+
|
|
|
|
|
+ triggerFarmWork(paramsObj, true);
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
-function triggerFarmWork(paramsObj,showSuccess) {
|
|
|
|
|
- // 如果正在上传中,直接返回,防止重复调用
|
|
|
|
|
|
|
+const triggerFarmWork = (paramsObj, showSuccess = false) => {
|
|
|
if (isUploading.value) return;
|
|
if (isUploading.value) return;
|
|
|
-
|
|
|
|
|
- // 设置上传状态为 true
|
|
|
|
|
|
|
+
|
|
|
isUploading.value = true;
|
|
isUploading.value = true;
|
|
|
-
|
|
|
|
|
- VE_API.monitor.triggerFarmWork(paramsObj).then((res) => {
|
|
|
|
|
- if (res.code === 0) {
|
|
|
|
|
- if(showSuccess){
|
|
|
|
|
|
|
+
|
|
|
|
|
+ VE_API.monitor
|
|
|
|
|
+ .triggerFarmWork(paramsObj)
|
|
|
|
|
+ .then((res) => {
|
|
|
|
|
+ if (res.code === 0 && showSuccess) {
|
|
|
show.value = false;
|
|
show.value = false;
|
|
|
successShow.value = true;
|
|
successShow.value = true;
|
|
|
emit("handleUploadSuccess", paramsObj);
|
|
emit("handleUploadSuccess", paramsObj);
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
- }).catch((error) => {
|
|
|
|
|
- console.error("触发农事失败:", error);
|
|
|
|
|
- }).finally(() => {
|
|
|
|
|
- // 无论成功或失败,都重置上传状态
|
|
|
|
|
- isUploading.value = false;
|
|
|
|
|
- });
|
|
|
|
|
-}
|
|
|
|
|
|
|
+ })
|
|
|
|
|
+ .catch((error) => {
|
|
|
|
|
+ console.error("触发农事失败:", error);
|
|
|
|
|
+ ElMessage.error("操作失败,请重试");
|
|
|
|
|
+ })
|
|
|
|
|
+ .finally(() => {
|
|
|
|
|
+ isUploading.value = false;
|
|
|
|
|
+ });
|
|
|
|
|
+};
|
|
|
|
|
|
|
|
-defineExpose({
|
|
|
|
|
- triggerFarmWork
|
|
|
|
|
-})
|
|
|
|
|
|
|
+const handleDeleteInteract = () => {
|
|
|
|
|
+ ElMessageBox.confirm("确定要删除该互动设置吗?", "提示", {
|
|
|
|
|
+ confirmButtonText: "确定",
|
|
|
|
|
+ cancelButtonText: "取消",
|
|
|
|
|
+ type: "warning",
|
|
|
|
|
+ })
|
|
|
|
|
+ .then(() => {
|
|
|
|
|
+ emit("handleDeleteInteract", { arrangeId: arrangeId.value });
|
|
|
|
|
+ show.value = false;
|
|
|
|
|
+ ElMessage.success("删除成功");
|
|
|
|
|
+ })
|
|
|
|
|
+ .catch(() => {
|
|
|
|
|
+ // 用户取消,不做任何操作
|
|
|
|
|
+ });
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+const handleSaveInteract = () => {
|
|
|
|
|
+ if (isUploading.value || !validateInteractForm()) return;
|
|
|
|
|
+
|
|
|
|
|
+ isUploading.value = true;
|
|
|
|
|
+
|
|
|
|
|
+ const paramsObj = {
|
|
|
|
|
+ arrangeId: arrangeId.value,
|
|
|
|
|
+ interactTime: interactTime.value,
|
|
|
|
|
+ forceTriggerTime: forceTriggerTime.value,
|
|
|
|
|
+ interactQuestion: interactQuestion.value.trim(),
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ // TODO: 调用保存互动设置的API
|
|
|
|
|
+ // VE_API.monitor.saveInteractSetting(paramsObj)
|
|
|
|
|
+ // .then((res) => {
|
|
|
|
|
+ // if (res.code === 0) {
|
|
|
|
|
+ // ElMessage.success("保存成功");
|
|
|
|
|
+ // show.value = false;
|
|
|
|
|
+ // emit("handleUploadSuccess", paramsObj);
|
|
|
|
|
+ // } else {
|
|
|
|
|
+ // ElMessage.error(res.message || "保存失败");
|
|
|
|
|
+ // }
|
|
|
|
|
+ // })
|
|
|
|
|
+ // .catch((error) => {
|
|
|
|
|
+ // console.error("保存互动设置失败:", error);
|
|
|
|
|
+ // ElMessage.error("保存失败,请重试");
|
|
|
|
|
+ // })
|
|
|
|
|
+ // .finally(() => {
|
|
|
|
|
+ // isUploading.value = false;
|
|
|
|
|
+ // });
|
|
|
|
|
+
|
|
|
|
|
+ // 临时模拟保存成功
|
|
|
|
|
+ setTimeout(() => {
|
|
|
|
|
+ ElMessage.success("保存成功");
|
|
|
|
|
+ show.value = false;
|
|
|
|
|
+ emit("handleUploadSuccess", paramsObj);
|
|
|
|
|
+ isUploading.value = false;
|
|
|
|
|
+ }, 500);
|
|
|
|
|
+};
|
|
|
|
|
|
|
|
-function handleClosed() {
|
|
|
|
|
|
|
+const handleClosed = () => {
|
|
|
eventBus.emit("upload:reset");
|
|
eventBus.emit("upload:reset");
|
|
|
-}
|
|
|
|
|
|
|
+ if (mode.value === MODE.INTERACT) {
|
|
|
|
|
+ resetInteractData();
|
|
|
|
|
+ }
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+// 生命周期
|
|
|
|
|
+onMounted(() => {
|
|
|
|
|
+ eventBus.off("upload:changeArr", uploadChange);
|
|
|
|
|
+ eventBus.on("upload:changeArr", uploadChange);
|
|
|
|
|
+ eventBus.on("activeUpload:show", handleShow);
|
|
|
|
|
+ eventBus.on("activeUpload:success", handleSuccess);
|
|
|
|
|
+});
|
|
|
|
|
|
|
|
onUnmounted(() => {
|
|
onUnmounted(() => {
|
|
|
eventBus.off("activeUpload:show", handleShow);
|
|
eventBus.off("activeUpload:show", handleShow);
|
|
@@ -169,6 +384,11 @@ onUnmounted(() => {
|
|
|
eventBus.off("upload:changeArr", uploadChange);
|
|
eventBus.off("upload:changeArr", uploadChange);
|
|
|
show.value = false;
|
|
show.value = false;
|
|
|
});
|
|
});
|
|
|
|
|
+
|
|
|
|
|
+// 暴露方法
|
|
|
|
|
+defineExpose({
|
|
|
|
|
+ triggerFarmWork,
|
|
|
|
|
+});
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
<style lang="scss" scoped>
|
|
@@ -183,6 +403,141 @@ onUnmounted(() => {
|
|
|
color: #000;
|
|
color: #000;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ // 互动设置模式样式
|
|
|
|
|
+ &.interact-mode {
|
|
|
|
|
+ background: #ffffff;
|
|
|
|
|
+ padding: 0;
|
|
|
|
|
+
|
|
|
|
|
+ .interact-header {
|
|
|
|
|
+ background: linear-gradient(180deg, #d1ebff 0%, #ffffff 100%);
|
|
|
|
|
+ padding: 20px 18px;
|
|
|
|
|
+ text-align: center;
|
|
|
|
|
+ border-radius: 10px 10px 0 0;
|
|
|
|
|
+
|
|
|
|
|
+ .interact-title {
|
|
|
|
|
+ font-size: 18px;
|
|
|
|
|
+ font-weight: 600;
|
|
|
|
|
+ color: #000;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .interact-form {
|
|
|
|
|
+ padding: 0 18px 20px;
|
|
|
|
|
+
|
|
|
|
|
+ .form-item {
|
|
|
|
|
+ margin-bottom: 20px;
|
|
|
|
|
+
|
|
|
|
|
+ &:last-child {
|
|
|
|
|
+ margin-bottom: 0;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .form-label {
|
|
|
|
|
+ font-size: 14px;
|
|
|
|
|
+ color: #000;
|
|
|
|
|
+ margin-bottom: 12px;
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+
|
|
|
|
|
+ .required {
|
|
|
|
|
+ color: #ff4d4f;
|
|
|
|
|
+ margin-right: 4px;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .form-input-wrapper {
|
|
|
|
|
+ position: relative;
|
|
|
|
|
+
|
|
|
|
|
+ ::v-deep {
|
|
|
|
|
+ .el-input__inner {
|
|
|
|
|
+ caret-color: transparent;
|
|
|
|
|
+ padding-right: 40px;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .el-input__suffix {
|
|
|
|
|
+ display: none;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .time-icon {
|
|
|
|
|
+ position: absolute;
|
|
|
|
|
+ right: 12px;
|
|
|
|
|
+ top: 50%;
|
|
|
|
|
+ transform: translateY(-50%);
|
|
|
|
|
+ color: #909399;
|
|
|
|
|
+ pointer-events: none;
|
|
|
|
|
+ z-index: 1;
|
|
|
|
|
+ font-size: 16px;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .question-textarea {
|
|
|
|
|
+ ::v-deep {
|
|
|
|
|
+ .el-textarea__inner {
|
|
|
|
|
+ resize: none;
|
|
|
|
|
+ line-height: 1.5;
|
|
|
|
|
+ min-height: 80px;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .interact-buttons {
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ gap: 12px;
|
|
|
|
|
+ padding: 0 18px 20px;
|
|
|
|
|
+
|
|
|
|
|
+ .btn-delete,
|
|
|
|
|
+ .btn-save {
|
|
|
|
|
+ flex: 1;
|
|
|
|
|
+ padding: 8px;
|
|
|
|
|
+ border-radius: 25px;
|
|
|
|
|
+ font-size: 16px;
|
|
|
|
|
+ text-align: center;
|
|
|
|
|
+ cursor: pointer;
|
|
|
|
|
+ transition: all 0.3s;
|
|
|
|
|
+ user-select: none;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .btn-delete {
|
|
|
|
|
+ background: #ffffff;
|
|
|
|
|
+ border: 1px solid #ff4d4f;
|
|
|
|
|
+ color: #ff4d4f;
|
|
|
|
|
+
|
|
|
|
|
+ &:hover {
|
|
|
|
|
+ background: #fff5f5;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ &:active {
|
|
|
|
|
+ opacity: 0.8;
|
|
|
|
|
+ transform: scale(0.98);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .btn-save {
|
|
|
|
|
+ background: #2199f8;
|
|
|
|
|
+ color: #fff;
|
|
|
|
|
+ border: none;
|
|
|
|
|
+
|
|
|
|
|
+ &:hover:not(.disabled) {
|
|
|
|
|
+ background: #1a8ae6;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ &:active:not(.disabled) {
|
|
|
|
|
+ opacity: 0.9;
|
|
|
|
|
+ transform: scale(0.98);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ &.disabled {
|
|
|
|
|
+ opacity: 0.6;
|
|
|
|
|
+ cursor: not-allowed;
|
|
|
|
|
+ pointer-events: none;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
.header {
|
|
.header {
|
|
|
.title {
|
|
.title {
|
|
|
font-size: 16px;
|
|
font-size: 16px;
|
|
@@ -226,7 +581,18 @@ onUnmounted(() => {
|
|
|
font-size: 16px;
|
|
font-size: 16px;
|
|
|
text-align: center;
|
|
text-align: center;
|
|
|
cursor: pointer;
|
|
cursor: pointer;
|
|
|
- transition: opacity 0.3s;
|
|
|
|
|
|
|
+ transition: all 0.3s;
|
|
|
|
|
+ user-select: none;
|
|
|
|
|
+
|
|
|
|
|
+ &:hover:not(.disabled) {
|
|
|
|
|
+ background: #1a8ae6;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ &:active:not(.disabled) {
|
|
|
|
|
+ opacity: 0.9;
|
|
|
|
|
+ transform: scale(0.98);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
&.disabled {
|
|
&.disabled {
|
|
|
opacity: 0.6;
|
|
opacity: 0.6;
|
|
|
cursor: not-allowed;
|
|
cursor: not-allowed;
|