From f19e5267cc23b1c714dc746239864f33ed715dd9 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期五, 05 十二月 2025 17:55:02 +0800
Subject: [PATCH] 完成地图制作任务功能初版
---
src/views/fysp/task/components/CompSubTaskSelect.vue | 117 +++++++++++++++++++++++++++++++++++++---------------------
1 files changed, 75 insertions(+), 42 deletions(-)
diff --git a/src/views/fysp/task/components/CompSubTaskSelect.vue b/src/views/fysp/task/components/CompSubTaskSelect.vue
index 53a4e03..11a515e 100644
--- a/src/views/fysp/task/components/CompSubTaskSelect.vue
+++ b/src/views/fysp/task/components/CompSubTaskSelect.vue
@@ -17,7 +17,7 @@
collapse-tags
placeholder="閫夋嫨鎵ц浜�"
:max-collapse-tags="1"
- style="width: 240px"
+ style="width: 150px"
>
<template #header>
<el-checkbox
@@ -40,9 +40,13 @@
</FYForm>
</el-row>
<div>
- <el-scrollbar :height="scrollHeight" v-if="data.length > 0">
- <el-space wrap>
- <ItemMonitorObj v-for="obj in data" :key="obj.movid" :item="obj">
+ <el-scrollbar :height="height" v-if="modelValue.length > 0">
+ <el-space wrap :direction="direction">
+ <ItemMonitorObj
+ v-for="obj in modelValue"
+ :key="obj.movid"
+ :item="obj"
+ >
<template #default="{ item }">
<el-button
size="small"
@@ -70,34 +74,43 @@
/**
* 宸℃煡瀛愪换鍔″垱寤�
*/
-import { ref, reactive, watch, computed, onMounted } from 'vue';
+import { ref, reactive, watch, computed, onMounted, inject } from 'vue';
import { ElMessageBox, ElNotification, ElMessage } from 'element-plus';
import taskApi from '@/api/fysp/taskApi';
import TaskProxy from '../TaskProxy';
-onMounted(() => {
- // if (props.height) {
- // scrollHeight.value =
- // }
-});
+// const topTask = inject('topTask');
const props = defineProps({
// 瀛愪换鍔¢泦鍚�
- data: {
+ modelValue: {
type: Array,
default: () => []
},
- height: String,
+ height: {
+ type: String,
+ default: '14vh'
+ },
+ direction: {
+ type: String,
+ default: 'horizontal'
+ },
// 鏃ヤ换鍔�
dayTask: Object
});
-const emit = defineEmits(['submit', 'delete']);
+const emit = defineEmits(['submit', 'delete', 'update:modelValue']);
-const scrollHeight = ref('14vh');
+const data = computed(() => props.modelValue);
// 绉婚櫎浠诲姟鍦烘櫙
function deleteScene(item) {
+ item.select = false;
+ const index = data.value.indexOf(item);
+ if (index > -1) {
+ data.value.splice(index, 1);
+ emit('update:modelValue', data.value);
+ }
emit('delete', item);
}
@@ -113,21 +126,29 @@
]
});
function submit(v, success, fail) {
- if (props.data.length == 0) {
- // ElMessage({
- // message: '鏈�夋嫨鐩戠鍦烘櫙',
- // type: 'warning'
- // });
+ if (props.modelValue.length == 0) {
fail('鏈�夋嫨鐩戠鍦烘櫙');
+ } else if (v.value.executor.length == 0) {
+ fail('鏈�夋嫨鎵ц浜�');
} else {
success();
// 灏嗕换鍔℃墽琛屼汉鏍煎紡鍖栧苟浼犻��
- const param = TaskProxy.getExecutors(v.value.executor, executors.value)
- emit('submit', param)
+ const param = TaskProxy.getExecutors(v.value.executor, executors.value);
+ TaskProxy.createSubtasks(props.dayTask, props.modelValue, param).then(
+ () => {
+ formInfo.value.executor = [];
+ emit('update:modelValue', []);
+ emit('submit');
+ }
+ );
}
}
/************************* 浠诲姟鎵ц浜轰笅鎷夐�夋 *******************************/
+// onMounted(() => {
+// getExecutors(topTask.value);
+// });
+
const executors = ref([]);
// 鏄惁鍏ㄩ��
const checkAll = ref(false);
@@ -142,36 +163,48 @@
formInfo.value.executor = [];
}
}
+
+function getExecutors(t) {
+ const ids = t.executorguids.split('#');
+ const userNames = t.executorusernames.split('#');
+ const realNames = t.executorrealnames.split('#');
+ const list = [];
+ ids.forEach((e, i) => {
+ if (i < userNames.length && i < realNames.length) {
+ list.push({
+ label: realNames[i],
+ value: e,
+ data: {
+ id: e,
+ userName: userNames[i],
+ realName: realNames[i]
+ }
+ });
+ }
+ });
+
+ executors.value = list;
+ formInfo.value.executor = [];
+}
+// watch(topTask, (nV, oV) => {
+// if (nV != oV) {
+// getExecutors(nV);
+// }
+// });
+
watch(
() => props.dayTask,
(nV, oV) => {
if (nV != oV) {
- taskApi.fetchTaskById(nV.guid).then((res) => {
- const ids = res.executorguids.split('#');
- const userNames = res.executorusernames.split('#');
- const realNames = res.executorrealnames.split('#');
- const list = [];
- ids.forEach((e, i) => {
- if (i < userNames.length && i < realNames.length) {
- list.push({
- label: realNames[i],
- value: e,
- data: {
- id: e,
- userName: userNames[i],
- realName: realNames[i]
- }
- });
- }
- });
-
- executors.value = list;
+ // 鏍规嵁鏃ヤ换鍔★紝鑾峰彇瀵瑰簲鐨勬�讳换鍔′俊鎭紝鍐嶈幏鍙栨墽琛屼汉鍛樹俊鎭�
+ taskApi.fetchTaskById(nV.tsGuid).then((res) => {
+ getExecutors(res);
});
}
},
{ immediate: true }
);
-//
+
watch(
() => formInfo.value.executor,
(val) => {
--
Gitblit v1.9.3