|
|
@@ -9,33 +9,34 @@
|
|
|
<div class="task-list">
|
|
|
<div class="list-filter">
|
|
|
<div class="filter-item" :class="{ active: activeIndex === 0 }" @click="handleActiveFilter(0)">
|
|
|
- 待接受({{ taskCounts[0] || 0 }})
|
|
|
+ {{ t("workExecute.pending") }}({{ taskCounts[0] || 0 }})
|
|
|
</div>
|
|
|
<div class="filter-item" :class="{ active: activeIndex === 2 }" @click="handleActiveFilter(2)">
|
|
|
- 已接受({{ taskCounts[2] || 0 }})
|
|
|
+ {{ t("workExecute.accepted") }}({{ taskCounts[2] || 0 }})
|
|
|
</div>
|
|
|
<div class="filter-item" :class="{ active: activeIndex === 3 }" @click="handleActiveFilter(3)">
|
|
|
- 执行中({{ taskCounts[3] || 0 }})
|
|
|
+ {{ t("workExecute.executing") }}({{ taskCounts[3] || 0 }})
|
|
|
</div>
|
|
|
<div class="filter-item" :class="{ active: activeIndex === 4 }" @click="handleActiveFilter(3)">
|
|
|
- 已完成({{ taskCounts[4] || 0 }})
|
|
|
+ {{ t("workExecute.completed") }}({{ taskCounts[4] || 0 }})
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="list-box">
|
|
|
<div class="list-header">
|
|
|
<div class="select-group">
|
|
|
- <el-select class="select-item" v-model="selectParma.farmWorkTypeId" placeholder="农事类型"
|
|
|
+ <el-select class="select-item" v-model="selectParma.farmWorkTypeId" :placeholder="t('workExecute.farmWorkType')"
|
|
|
@change="getSimpleList">
|
|
|
- <el-option v-for="item in farmWorkTypeList" :key="item.id" :label="item.name"
|
|
|
+ <el-option v-for="item in farmWorkTypeList" :key="item.id"
|
|
|
+ :label="item.id === 0 ? t('workExecute.all') : item.name"
|
|
|
:value="item.id" />
|
|
|
</el-select>
|
|
|
- <el-select class="select-item" v-model="selectParma.districtCode" placeholder="农场筛选"
|
|
|
+ <el-select class="select-item" v-model="selectParma.districtCode" :placeholder="t('workExecute.farmFilter')"
|
|
|
@change="getSimpleList">
|
|
|
<el-option v-for="item in districtList" :key="item.code" :label="item.name"
|
|
|
:value="item.code" />
|
|
|
</el-select>
|
|
|
</div>
|
|
|
- <div class="action-btn">批量接受</div>
|
|
|
+ <!-- <div class="action-btn">{{ t("workExecute.batchAccept") }}</div> -->
|
|
|
</div>
|
|
|
<!-- 任务列表 -->
|
|
|
<div class="work-task-list" v-loading="loading" element-loading-background="rgba(0, 0, 0, 0.3)">
|
|
|
@@ -54,20 +55,20 @@
|
|
|
{{ getTimeoutText() }}
|
|
|
</span>
|
|
|
<span class="task-tag" v-else>
|
|
|
- {{ activeStatus }}
|
|
|
+ {{ getStatusLabel(activeStatus) }}
|
|
|
</span>
|
|
|
<div class="item-content">
|
|
|
<div class="item-info">
|
|
|
<div class="info-item">
|
|
|
- <div class="info-name">负责人:</div><span class="val-text">
|
|
|
+ <div class="info-name">{{ t("workExecute.responsible") }}</div><span class="val-text">
|
|
|
某某某、某某某</span>
|
|
|
</div>
|
|
|
<div class="info-item" v-if="mode !== 'review'">
|
|
|
- <div class="info-name">农事详情:</div><span class="val-text">
|
|
|
+ <div class="info-name">{{ t("workExecute.farmWorkDetail") }}</div><span class="val-text">
|
|
|
{{ item.operation?.drug }}</span>
|
|
|
</div>
|
|
|
<div class="info-item">
|
|
|
- <div class="info-name">农情研判:</div><span class="val-text">
|
|
|
+ <div class="info-name">{{ t("workExecute.farmSituation") }}</div><span class="val-text">
|
|
|
{{ item.operation?.work_reason }}</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -77,30 +78,30 @@
|
|
|
<div class="stat-value">
|
|
|
{{ item.time ? formatGMTToYMD(item.time) : "--" }}
|
|
|
</div>
|
|
|
- <div class="stat-label">执行时间</div>
|
|
|
+ <div class="stat-label">{{ t("workExecute.executeTime") }}</div>
|
|
|
</div>
|
|
|
<div class="cell-line"></div>
|
|
|
<div class="stat-cell">
|
|
|
<div class="stat-value">{{ item.geohash_sample || "--" }}</div>
|
|
|
- <div class="stat-label">执行区域</div>
|
|
|
+ <div class="stat-label">{{ t("workExecute.executeArea") }}</div>
|
|
|
</div>
|
|
|
<div class="cell-line"></div>
|
|
|
<div class="stat-cell">
|
|
|
<div class="stat-value">{{ item.operation?.machine_code || "--" }}</div>
|
|
|
- <div class="stat-label">执行农机</div>
|
|
|
+ <div class="stat-label">{{ t("workExecute.executeMachine") }}</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
<div class="unqualified-reason" v-if="activeStatus === '未达标'">
|
|
|
- 未达标原因:{{ item.operation?.reason || "未在合适时间执行,药液未充分喷撒吸收" }}
|
|
|
+ {{ t("workExecute.unqualifiedReason") }}{{ item.operation?.reason || t("workExecute.defaultUnqualifiedReason") }}
|
|
|
</div>
|
|
|
|
|
|
<div class="compare-imgs" v-if="activeStatus === '未达标' && (item.beforeImage || item.afterImage)"
|
|
|
@click.stop>
|
|
|
- <div class="img-tag">前</div>
|
|
|
- <div class="img-tag right-tag">后</div>
|
|
|
+ <div class="img-tag">{{ t("workExecute.before") }}</div>
|
|
|
+ <div class="img-tag right-tag">{{ t("workExecute.after") }}</div>
|
|
|
<div class="img-item" v-if="item.beforeImage">
|
|
|
<img :src="getWorkImageUrl(item.beforeImage)" alt="" />
|
|
|
</div>
|
|
|
@@ -110,7 +111,7 @@
|
|
|
</div>
|
|
|
|
|
|
<div class="task-footer">
|
|
|
- <div class="farm-info">来自某某农场农场</div>
|
|
|
+ <div class="farm-info">{{ t("workExecute.fromFarm") }}</div>
|
|
|
<div class="btn-group" v-if="getItemStatusButtons(index).length">
|
|
|
<div v-for="btn in getItemStatusButtons(index)" :key="btn.label" class="edit-btn"
|
|
|
:class="btn.type" @click.stop="handleStatusBtn(btn, item, index)">
|
|
|
@@ -121,7 +122,7 @@
|
|
|
|
|
|
</div>
|
|
|
|
|
|
- <div class="empty-tip" v-if="!loading && taskList.length === 0">暂无数据</div>
|
|
|
+ <div class="empty-tip" v-if="!loading && taskList.length === 0">{{ t("workExecute.noData") }}</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -143,7 +144,9 @@ import { WarningFilled } from "@element-plus/icons-vue";
|
|
|
import { ElMessage } from "element-plus";
|
|
|
import config from "@/api/config.js";
|
|
|
import customCalendar from "./components/calendar.vue";
|
|
|
+import { useI18n } from "@/i18n";
|
|
|
|
|
|
+const { t } = useI18n();
|
|
|
const store = useStore();
|
|
|
const router = useRouter();
|
|
|
const route = useRoute();
|
|
|
@@ -233,31 +236,49 @@ const activeStatus = ref("待接受");
|
|
|
|
|
|
const STATUS_BTN_MAP = {
|
|
|
待接受: [
|
|
|
- { label: "重新派发", type: "normal", action: "redispatch" },
|
|
|
- { label: "提醒接受", type: "primary", action: "remindAccept" },
|
|
|
+ { labelKey: "workExecute.redispatch", type: "normal", action: "redispatch" },
|
|
|
+ { labelKey: "workExecute.remindAccept", type: "primary", action: "remindAccept" },
|
|
|
],
|
|
|
- 已接受: [{ label: "提醒执行", type: "primary", action: "remindExecute" }],
|
|
|
- 执行中: [{ label: "提醒完成", type: "primary", action: "remindComplete" }],
|
|
|
+ 已接受: [{ labelKey: "workExecute.remindExecute", type: "primary", action: "remindExecute" }],
|
|
|
+ 执行中: [{ labelKey: "workExecute.remindComplete", type: "primary", action: "remindComplete" }],
|
|
|
已超时: [
|
|
|
- { label: "重新派发", type: "normal", action: "redispatch" },
|
|
|
- { label: "提醒接受", type: "primary", action: "remindAccept" },
|
|
|
+ { labelKey: "workExecute.redispatch", type: "normal", action: "redispatch" },
|
|
|
+ { labelKey: "workExecute.remindAccept", type: "primary", action: "remindAccept" },
|
|
|
],
|
|
|
- 未达标: [{ label: "重新下发", type: "primary", action: "redispatch" }],
|
|
|
+ 未达标: [{ labelKey: "workExecute.redispatchAgain", type: "primary", action: "redispatch" }],
|
|
|
};
|
|
|
|
|
|
+const STATUS_LABEL_MAP = {
|
|
|
+ 待接受: "workExecute.pending",
|
|
|
+ 已接受: "workExecute.accepted",
|
|
|
+ 执行中: "workExecute.executing",
|
|
|
+ 已完成: "workExecute.completed",
|
|
|
+ 已超时: "workExecute.timeout",
|
|
|
+ 未达标: "workExecute.unqualified",
|
|
|
+};
|
|
|
+
|
|
|
+const getStatusLabel = (status) => t(STATUS_LABEL_MAP[status] || status);
|
|
|
+
|
|
|
const isTimeoutItem = (index) => index === 0;
|
|
|
|
|
|
const getTimeoutRemindBtn = () => {
|
|
|
const map = {
|
|
|
- 待接受: { label: "提醒接受", type: "primary", action: "remindAccept" },
|
|
|
- 已接受: { label: "提醒执行", type: "primary", action: "remindExecute" },
|
|
|
- 执行中: { label: "提醒完成", type: "primary", action: "remindComplete" },
|
|
|
+ 待接受: { labelKey: "workExecute.remindAccept", type: "primary", action: "remindAccept" },
|
|
|
+ 已接受: { labelKey: "workExecute.remindExecute", type: "primary", action: "remindExecute" },
|
|
|
+ 执行中: { labelKey: "workExecute.remindComplete", type: "primary", action: "remindComplete" },
|
|
|
};
|
|
|
- return map[activeStatus.value];
|
|
|
+ const btn = map[activeStatus.value];
|
|
|
+ return btn ? { ...btn, label: t(btn.labelKey) } : null;
|
|
|
};
|
|
|
|
|
|
+const mapStatusButtons = (buttons) =>
|
|
|
+ buttons.map((btn) => ({
|
|
|
+ ...btn,
|
|
|
+ label: t(btn.labelKey),
|
|
|
+ }));
|
|
|
+
|
|
|
const getItemStatusButtons = (index) => {
|
|
|
- const baseButtons = STATUS_BTN_MAP[activeStatus.value] || [];
|
|
|
+ const baseButtons = mapStatusButtons(STATUS_BTN_MAP[activeStatus.value] || []);
|
|
|
if (!isTimeoutItem(index)) {
|
|
|
return baseButtons;
|
|
|
}
|
|
|
@@ -267,24 +288,23 @@ const getItemStatusButtons = (index) => {
|
|
|
const remindBtn = getTimeoutRemindBtn();
|
|
|
if (remindBtn) {
|
|
|
return [
|
|
|
- { label: "重新派发", type: "normal", action: "redispatch" },
|
|
|
+ { label: t("workExecute.redispatch"), type: "normal", action: "redispatch" },
|
|
|
remindBtn,
|
|
|
];
|
|
|
}
|
|
|
- return [{ label: "重新派发", type: "normal", action: "redispatch" }, ...baseButtons];
|
|
|
+ return [
|
|
|
+ { label: t("workExecute.redispatch"), type: "normal", action: "redispatch" },
|
|
|
+ ...baseButtons,
|
|
|
+ ];
|
|
|
};
|
|
|
|
|
|
const getTimeoutText = () => {
|
|
|
- switch (activeStatus.value) {
|
|
|
- case "待接受":
|
|
|
- return "接受超时";
|
|
|
- case "已接受":
|
|
|
- return "执行超时";
|
|
|
- case "执行中":
|
|
|
- return "完成超时";
|
|
|
- default:
|
|
|
- return "已超时";
|
|
|
- }
|
|
|
+ const map = {
|
|
|
+ 待接受: "workExecute.acceptTimeout",
|
|
|
+ 已接受: "workExecute.executeTimeout",
|
|
|
+ 执行中: "workExecute.completeTimeout",
|
|
|
+ };
|
|
|
+ return t(map[activeStatus.value] || "workExecute.timeout");
|
|
|
};
|
|
|
|
|
|
const formatGMTToYMD = (gmtString) => {
|
|
|
@@ -299,14 +319,11 @@ const getWorkImageUrl = (image) => {
|
|
|
|
|
|
const handleItem = (item, index) => {
|
|
|
router.push({
|
|
|
- path: "/work_detail",
|
|
|
+ path: "/agri_record_detail",
|
|
|
query: {
|
|
|
miniJson: JSON.stringify({
|
|
|
id: item.operation?.work_id,
|
|
|
status: activeStatus.value,
|
|
|
- time: item.time,
|
|
|
- geohash_sample: item.geohash_sample,
|
|
|
- machine_code: item.operation?.machine_code,
|
|
|
}),
|
|
|
},
|
|
|
});
|
|
|
@@ -314,9 +331,9 @@ const handleItem = (item, index) => {
|
|
|
|
|
|
const handleStatusBtn = (btn, item, index) => {
|
|
|
if (btn.action === "redispatch") {
|
|
|
- ElMessage.info(`重新派发:${item.operation?.name}`);
|
|
|
+ ElMessage.info(t("workExecute.redispatchMsg", { name: item.operation?.name }));
|
|
|
} else {
|
|
|
- ElMessage.success("提醒成功!");
|
|
|
+ ElMessage.success(t("workExecute.remindSuccess"));
|
|
|
}
|
|
|
};
|
|
|
|
|
|
@@ -675,7 +692,7 @@ function handleRemindCustomer(item) {
|
|
|
margin-top: 10px;
|
|
|
|
|
|
.filter-item {
|
|
|
- padding: 0 12px;
|
|
|
+ padding: 0 6px;
|
|
|
height: 32px;
|
|
|
color: #1D2129;
|
|
|
font-size: 14px;
|