From 2527a643d7ac70c7a4742b297972d46c8b1495a4 Mon Sep 17 00:00:00 2001
From: hcong <1050828145@qq.com>
Date: 星期二, 12 十一月 2024 10:50:09 +0800
Subject: [PATCH] 问题审核bug修改
---
src/views/fysp/task/components/CompSubTaskList.vue | 90 ++++++++++++++++++++++++++++++++++++++++----
1 files changed, 81 insertions(+), 9 deletions(-)
diff --git a/src/views/fysp/task/components/CompSubTaskList.vue b/src/views/fysp/task/components/CompSubTaskList.vue
index b84adbd..ef20ca8 100644
--- a/src/views/fysp/task/components/CompSubTaskList.vue
+++ b/src/views/fysp/task/components/CompSubTaskList.vue
@@ -21,15 +21,29 @@
>
<ItemSubTask v-for="s in data" :key="s.guid" :item="s">
<template #default="{ item }">
- <el-button type="danger" size="small" @click="remove(item)"
- >绉婚櫎</el-button
- >
+ <el-space direction="vertical">
+ <el-button
+ :disabled="item.status != '鏈墽琛�'"
+ plain
+ type="primary"
+ size="small"
+ @click="edit(item)"
+ >缂栬緫</el-button
+ >
+ <el-button
+ :disabled="item.status != '鏈墽琛�'"
+ type="default"
+ size="small"
+ @click="remove(item)"
+ >绉婚櫎</el-button
+ >
+ </el-space>
</template>
</ItemSubTask>
</el-space>
<div v-else>
<el-empty description="鏃犱换鍔¤褰�" />
- <el-row justify="center">
+ <el-row v-if="create" justify="center">
<el-button type="success" size="small" @click="add"
>娣诲姞浠诲姟</el-button
>
@@ -37,12 +51,30 @@
</div>
</el-scrollbar>
</div>
+ <el-dialog
+ v-model="dialogVisible"
+ width="600"
+ title="宸℃煡浠诲姟缂栬緫"
+ destroy-on-close
+ :close-on-click-modal="false"
+ :close-on-press-escape="false"
+ :show-close="false"
+ >
+ <CompSubTaskEdit
+ v-model="activeItem"
+ @submit="onEditSubmit"
+ @cancel="dialogVisible = false"
+ ></CompSubTaskEdit>
+ </el-dialog>
</template>
<script setup>
-import { ref, watch, onMounted } from 'vue';
+import { ref, computed, watch, onMounted, onUnmounted } from 'vue';
+import { ElMessageBox, ElNotification, ElMessage } from 'element-plus';
+import CompSubTaskEdit from './CompSubTaskEdit.vue';
+import subtaskApi from '@/api/fysp/subtaskApi';
const props = defineProps({
- data: Array,
+ modelValue: Array,
height: {
type: String,
default: '70vh'
@@ -51,15 +83,55 @@
create: Boolean,
loading: Boolean
});
-const curSubTaskList = ref([]);
-const emit = defineEmits(['add', 'remove']);
+const dialogVisible = ref(false);
+const activeItem = ref(null);
+const data = computed(() => props.modelValue);
+
+const emit = defineEmits(['submit', 'add', 'remove', 'update:modelValue']);
function remove(item) {
- emit('remove', item);
+ if (item.status == '鏈墽琛�') {
+ ElMessageBox.confirm('鏄惁绉婚櫎鐩戠浠诲姟', `绉婚櫎纭`, {
+ confirmButtonText: '纭',
+ cancelButtonText: '鍙栨秷',
+ type: 'warning'
+ }).then(() => {
+ return subtaskApi.deleteSubtask(item.stguid).then(res=>{
+ if (res == 1) {
+ const index = data.value.indexOf(item);
+ data.value.splice(index, 1);
+
+ emit('update:modelValue', data.value);
+ emit('remove', item);
+ } else {
+ Promise.reject('鍒犻櫎宸℃煡浠诲姟澶辫触')
+ }
+ })
+ });
+ }
+}
+
+function edit(item) {
+ activeItem.value = item;
+ dialogVisible.value = true;
+}
+
+function onEditSubmit(item) {
+ dialogVisible.value = false;
+ const index = data.value.findIndex((v) => {
+ return item.stguid == v.stguid;
+ });
+ data.value.splice(index, 1, item);
+ emit('update:modelValue', data.value);
+ emit('submit');
}
function add() {
emit('add');
}
+
+onUnmounted(() => {
+ dialogVisible.value = false;
+});
</script>
--
Gitblit v1.9.3