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 | 61 ++++++++++++++++++++----------
1 files changed, 41 insertions(+), 20 deletions(-)
diff --git a/src/views/fysp/task/components/CompSubTaskList.vue b/src/views/fysp/task/components/CompSubTaskList.vue
index b678652..ef20ca8 100644
--- a/src/views/fysp/task/components/CompSubTaskList.vue
+++ b/src/views/fysp/task/components/CompSubTaskList.vue
@@ -2,7 +2,7 @@
<el-row justify="space-between">
<el-text>鍗曟棩璁″垝</el-text>
<el-button
- v-show="create && modelValue && modelValue.length > 0"
+ v-show="create && data && data.length > 0"
type="success"
size="small"
@click="add"
@@ -13,16 +13,21 @@
<div>
<el-scrollbar v-loading="loading" :height="height">
<el-space
- v-if="modelValue && modelValue.length > 0"
+ v-if="data && data.length > 0"
fill
:fill-ratio="100"
direction="vertical"
style="width: 100%"
>
- <ItemSubTask v-for="s in modelValue" :key="s.guid" :item="s">
+ <ItemSubTask v-for="s in data" :key="s.guid" :item="s">
<template #default="{ item }">
<el-space direction="vertical">
- <el-button plain type="primary" size="small" @click="edit(item)"
+ <el-button
+ :disabled="item.status != '鏈墽琛�'"
+ plain
+ type="primary"
+ size="small"
+ @click="edit(item)"
>缂栬緫</el-button
>
<el-button
@@ -38,7 +43,7 @@
</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
>
@@ -49,7 +54,7 @@
<el-dialog
v-model="dialogVisible"
width="600"
- title="涓�閿垱寤烘�讳换鍔�"
+ title="宸℃煡浠诲姟缂栬緫"
destroy-on-close
:close-on-click-modal="false"
:close-on-press-escape="false"
@@ -57,7 +62,7 @@
>
<CompSubTaskEdit
v-model="activeItem"
- @submit="dialogVisible = false"
+ @submit="onEditSubmit"
@cancel="dialogVisible = false"
></CompSubTaskEdit>
</el-dialog>
@@ -66,6 +71,7 @@
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({
modelValue: Array,
@@ -78,11 +84,11 @@
loading: Boolean
});
-const dialogVisible = ref(false)
-const activeItem = ref(null)
+const dialogVisible = ref(false);
+const activeItem = ref(null);
const data = computed(() => props.modelValue);
-const emit = defineEmits(['edit', 'add', 'remove', 'update:modelValue']);
+const emit = defineEmits(['submit', 'add', 'remove', 'update:modelValue']);
function remove(item) {
if (item.status == '鏈墽琛�') {
@@ -91,26 +97,41 @@
cancelButtonText: '鍙栨秷',
type: 'warning'
}).then(() => {
- const index = data.value.indexOf(item);
- data.value.splice(index, 1);
+ 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);
+ emit('update:modelValue', data.value);
+ emit('remove', item);
+ } else {
+ Promise.reject('鍒犻櫎宸℃煡浠诲姟澶辫触')
+ }
+ })
});
}
}
function edit(item) {
- activeItem.value = item
- dialogVisible.value = true
- emit('edit');
+ 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
-})
+onUnmounted(() => {
+ dialogVisible.value = false;
+});
</script>
--
Gitblit v1.9.3