|
|
@@ -10,27 +10,31 @@
|
|
|
<div class="date">
|
|
|
<span class="work-name">{{ timelineItem.farmWorkName }}</span>
|
|
|
<span v-show="timelineItem.expectedRisk">({{ timelineItem.expectedRisk }})</span>
|
|
|
- <span class="ignore-btn" @click="$emit('ignore', { timelineItem, farmId: item.farmId })">
|
|
|
+ <span class="ignore-btn" @click="handleIgnore(timelineItem, item.farmId)">
|
|
|
忽略
|
|
|
</span>
|
|
|
</div>
|
|
|
<div class="text">
|
|
|
预计报价<span class="price">{{ timelineItem.estimatedCost }}元</span>
|
|
|
- <span class="action-detail" @click="$emit('show-price-sheet', timelineItem)">查看报价单</span>
|
|
|
+ <span class="action-detail" @click="showPriceSheetPopup(timelineItem)">查看报价单</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div
|
|
|
- v-has-permission="'转入农事'"
|
|
|
- class="timeline-action"
|
|
|
- @click="$emit('timeline-action', { timelineItem, farmId: item.farmId })"
|
|
|
- >
|
|
|
- 转入农事任务
|
|
|
- </div>
|
|
|
+ <div class="timeline-action" @click="handleTimelineAction(timelineItem, item.farmId)">转入农事任务</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
+ <!-- 新增:激活上传弹窗 -->
|
|
|
+ <active-upload-popup ref="activeUploadPopupRef" @handleUploadSuccess="handleUploadSuccess"></active-upload-popup>
|
|
|
+
|
|
|
+ <!-- 服务报价单 -->
|
|
|
+ <price-sheet-popup ref="priceSheetPopupRef"></price-sheet-popup>
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
+import activeUploadPopup from "@/components/popup/activeUploadPopup.vue";
|
|
|
+import priceSheetPopup from "@/components/popup/priceSheetPopup.vue";
|
|
|
+import { computed, onMounted, ref } from "vue";
|
|
|
+import { ElMessage } from "element-plus";
|
|
|
+
|
|
|
const props = defineProps({
|
|
|
item: {
|
|
|
type: Object,
|
|
|
@@ -39,7 +43,69 @@ const props = defineProps({
|
|
|
},
|
|
|
});
|
|
|
|
|
|
-defineEmits(["timeline-action", "show-price-sheet", "ignore"]);
|
|
|
+// 检查是否有"转入农事"权限
|
|
|
+const hasPlanPermission = computed(() => {
|
|
|
+ try {
|
|
|
+ const userInfoStr = localStorage.getItem("localUserInfo");
|
|
|
+ if (!userInfoStr) return false;
|
|
|
+ const userInfo = JSON.parse(userInfoStr);
|
|
|
+ const permissions = userInfo.agriculturalPermissions || [];
|
|
|
+ return permissions.includes("转入农事");
|
|
|
+ } catch (error) {
|
|
|
+ console.error("解析用户信息失败:", error);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+});
|
|
|
+
|
|
|
+onMounted(() => {
|
|
|
+ getManagerList();
|
|
|
+});
|
|
|
+
|
|
|
+
|
|
|
+// 查询当前农资店的成员列表(只保留有“任务接单”权限的成员)
|
|
|
+const getManagerList = async () => {
|
|
|
+ const { data } = await VE_API.mine.listManagerList({onlyExecutor: true});
|
|
|
+ if (data && data.length > 0) {
|
|
|
+ // 过滤 permissionList 中包含“任务接单”的成员
|
|
|
+ executorList.value = data;
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+const executorList = ref([]);
|
|
|
+const activeUploadPopupRef = ref(null);
|
|
|
+const handleTimelineAction = (timelineItem, farmId) => {
|
|
|
+ if (hasPlanPermission.value) {
|
|
|
+ activeUploadPopupRef.value.showPopup({
|
|
|
+ gardenIdVal: farmId,
|
|
|
+ needExecutorVal: true,
|
|
|
+ problemTitleVal: "请选择 " + timelineItem.farmWorkName + " 执行截止时间",
|
|
|
+ imgDescVal: "请上传凭证(转入农事任务凭证)",
|
|
|
+ arrangeIdVal: timelineItem.arrangeId,
|
|
|
+ executorListVal: executorList.value,
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+ ElMessage.warning("您暂无权限操作");
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+const handleUploadSuccess = async () => {
|
|
|
+ emit('handleUploadSuccess');
|
|
|
+};
|
|
|
+
|
|
|
+const handleIgnore = (timelineItem, farmId) => {
|
|
|
+ console.log('timelineItem', timelineItem);
|
|
|
+ console.log('farmId', farmId);
|
|
|
+};
|
|
|
+
|
|
|
+const priceSheetPopupRef = ref(null);
|
|
|
+const showPriceSheetPopup = (item) => {
|
|
|
+ VE_API.z_farm_work_record.getDetail({ id: item.farmWorkId }).then(({ data }) => {
|
|
|
+ const res = data[0];
|
|
|
+ priceSheetPopupRef.value.handleShowPopup(res);
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
+const emit = defineEmits(["handleUploadSuccess"]);
|
|
|
</script>
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
@@ -117,5 +183,3 @@ defineEmits(["timeline-action", "show-price-sheet", "ignore"]);
|
|
|
}
|
|
|
}
|
|
|
</style>
|
|
|
-
|
|
|
-
|