Commit 7a1daeb2 authored by 祁正's avatar 祁正

ccap项目管理-抽屉列表修改删除

parent 134265bf
...@@ -103,8 +103,8 @@ ...@@ -103,8 +103,8 @@
<el-table-column label="操作" align="center"> <el-table-column label="操作" align="center">
<template #default="scope" align="center"> <template #default="scope" align="center">
<div > <div >
<el-button type="text" style="color: rgb(0,0,255)" @click="handleView(scope.row)">编辑</el-button> <el-button type="text" style="color: rgb(0,0,255)" @click="handleDrawerEdit(scope.row)">编辑</el-button>
<el-button type="text" style="color: rgb(244,93,93)" @click="handleView(scope.row)">删除</el-button> <el-button type="text" style="color: rgb(244,93,93)" @click="handleDrawerDel(scope.row)">删除</el-button>
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
...@@ -126,7 +126,7 @@ ...@@ -126,7 +126,7 @@
width="500" width="500"
> >
<div style="width: 85%;margin-left: 7.5%"> <div style="width: 85%;margin-left: 7.5%">
<el-form v-model="dialogForm" ref="dialogQueryRef" > <el-form :rules="dialogRules" :model="dialogForm" ref="dialogQueryRef" >
<el-form-item label="项目:" prop="project" > <el-form-item label="项目:" prop="project" >
<el-input v-model="dialogForm.project" placeholder="请输入"/> <el-input v-model="dialogForm.project" placeholder="请输入"/>
</el-form-item> </el-form-item>
...@@ -150,7 +150,7 @@ ...@@ -150,7 +150,7 @@
<template #footer> <template #footer>
<div class="dialog-footer"> <div class="dialog-footer">
<el-button @click="dialogCencal">取消</el-button> <el-button @click="dialogCencal">取消</el-button>
<el-button type="primary" @click="dialogSave"> <el-button type="primary" @click="dialogSave(dialogForm)">
保存 保存
</el-button> </el-button>
</div> </div>
...@@ -166,7 +166,9 @@ import { ...@@ -166,7 +166,9 @@ import {
getDataList, getDataList,
getAllBusinessUnitList, getAllBusinessUnitList,
getProjectListById, getProjectListById,
inserTableData inserTableData,
deleteBatch,
updateCcap
} from "@/api/CCAPProjectManagement/list"; } from "@/api/CCAPProjectManagement/list";
const { proxy } = getCurrentInstance(); const { proxy } = getCurrentInstance();
...@@ -192,7 +194,8 @@ const dialogRules = { ...@@ -192,7 +194,8 @@ const dialogRules = {
const dialogForm = ref({ const dialogForm = ref({
projectStatusId: null, projectStatusId: null,
project: null, project: null,
groupName: null groupName: null,
id:null
}); });
const queryParams = ref({ const queryParams = ref({
...@@ -228,6 +231,15 @@ function getDataProjectListById() { ...@@ -228,6 +231,15 @@ function getDataProjectListById() {
}); });
} }
function handleDrawerEdit(row){
dialogVisible.value = true;
addTitle.value = '编辑';
dialogForm.value.projectStatusId = drawerQueryParams.value.id;
dialogForm.value.id = row.id
dialogForm.value.groupName = row.groupName
dialogForm.value.project = row.project
}
function getBusinessList() { function getBusinessList() {
getAllBusinessUnitList().then(res => { getAllBusinessUnitList().then(res => {
console.log(res); console.log(res);
...@@ -245,14 +257,32 @@ function handleAdd() { ...@@ -245,14 +257,32 @@ function handleAdd() {
//对话框里面的保存 //对话框里面的保存
function dialogSave() { function dialogSave() {
console.log(dialogForm.value); console.log(dialogForm.value);
inserTableData(dialogForm.value).then(res=>{ dialogQueryRef.value.validate((valid)=>{
console.log(res) if (valid) {
if(res.code === 200) { //判断是新增还是保存
ElMessage.success("新增成功") if(addTitle.value === '新增'){
dialogCencal() inserTableData(dialogForm.value).then(res=>{
getDataProjectListById() console.log(res)
if(res.code === 200) {
ElMessage.success("新增成功")
dialogCencal()
getDataProjectListById()
}
})
}else{
updateCcap(dialogForm.value).then(res=>{
console.log(res)
if(res.code === 200) {
ElMessage.success("修改成功")
dialogCencal()
getDataProjectListById()
}
})
}
} }
}) })
// dialogQueryRef.value.validate((valid) => { // dialogQueryRef.value.validate((valid) => {
// if (valid) { // if (valid) {
// console.log(dialogForm.value); // console.log(dialogForm.value);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment