Commit 985040b4 authored by 高滢's avatar 高滢

feat(11): 11

parent ca172282
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
<div style="display: flex;align-items: flex-start"> <div style="display: flex;align-items: flex-start">
<el-button type="text" style="color: rgb(0,0,255)" @click="handleMaintain(scope.row)">维护项目</el-button> <el-button type="text" style="color: rgb(0,0,255)" @click="handleMaintain(scope.row)">维护项目</el-button>
<el-button type="text" style="color: rgb(255,153,0)" v-if="scope.row.id === adminId" @click="handleView(scope.row)">复制新增</el-button> <el-button type="text" style="color: rgb(255,153,0)" v-if="scope.row.id === adminId" @click="handleView(scope.row)">复制新增</el-button>
<el-button type="text" v-if="scope.row.id === adminId" @click="addBusiness(scope.row)">添加事业部</el-button> <el-button type="text" v-if="scope.row.id === adminId" @click="handleView(scope.row)">添加事业部</el-button>
<el-button type="text" style="color: rgb(244,93,93)" v-else="scope.row.id === adminId" @click="handleView(scope.row)">删除</el-button> <el-button type="text" style="color: rgb(244,93,93)" v-else="scope.row.id === adminId" @click="handleView(scope.row)">删除</el-button>
</div> </div>
</template> </template>
...@@ -91,11 +91,11 @@ ...@@ -91,11 +91,11 @@
<div class="top-btn"> <div class="top-btn">
<el-button type="primary" plain @click="handleAdd">新增</el-button> <el-button type="primary" plain @click="handleAdd">新增</el-button>
<el-button type="danger" plain @click="piliangDel">批量删除</el-button> <el-button type="danger" plain @click="resetQuery">批量删除</el-button>
</div> </div>
</div> </div>
<el-table border style="margin-top: 10px" :data="drawer2TableList" @selection-change="handleSelectionChange"> <el-table border style="margin-top: 10px" :data="drawer2TableList">
<el-table-column type="selection" width="55" align="center"/> <el-table-column type="selection" width="55" align="center"/>
<el-table-column type="index" width="55" align="center" label="序号"/> <el-table-column type="index" width="55" align="center" label="序号"/>
<el-table-column label="项目" align="center" prop="project" width="300"/> <el-table-column label="项目" align="center" prop="project" width="300"/>
...@@ -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="handleDrawerEdit(scope.row)">编辑</el-button> <el-button type="text" style="color: rgb(0,0,255)" @click="handleView(scope.row)">编辑</el-button>
<el-button type="text" style="color: rgb(244,93,93)" @click="handleDrawerDel(scope.row)">删除</el-button> <el-button type="text" style="color: rgb(244,93,93)" @click="handleView(scope.row)">删除</el-button>
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
...@@ -118,7 +118,7 @@ ...@@ -118,7 +118,7 @@
</template> </template>
</el-drawer> </el-drawer>
<!-- 抽屉里面的 对话框--> <!-- 对话框-->
<el-dialog <el-dialog
top="30" top="30"
v-model="dialogVisible" v-model="dialogVisible"
...@@ -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 :rules="dialogRules" :model="dialogForm" ref="dialogQueryRef" > <el-form v-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,67 +150,25 @@ ...@@ -150,67 +150,25 @@
<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(dialogForm)"> <el-button type="primary" @click="dialogSave">
保存 保存
</el-button> </el-button>
</div> </div>
</template> </template>
</el-dialog> </el-dialog>
<!-- 添加事业部·复制新增的 对话框-->
<el-dialog
top="30"
v-model="tableDialogVisible"
:title="tableDialogTitle"
width="500"
>
<div style="width: 70%;margin-left: 15%;padding: 20px 0">
<el-form :model="tableDialogForm" >
<el-form-item label="事业部:" prop="project" >
<el-select
v-model="dialogForm.business"
placeholder="请选择"
clearable
>
<el-option
v-for="dict in groupList"
:label="dict"
:value="dict"
/>
</el-select>
</el-form-item>
</el-form>
</div>
<template #footer>
<div class="dialog-footer">
<el-button @click="">取消</el-button>
<el-button type="primary" @click="(dialogForm)">
确定
</el-button>
</div>
</template>
</el-dialog>
</div> </div>
</template> </template>
<script setup> <script setup>
import { ElMessage,ElMessageBox } from 'element-plus' import { ElMessage } from 'element-plus'
import { ref, getCurrentInstance } from 'vue'; import { ref, getCurrentInstance } from 'vue';
import { import {
getDataList, getDataList,
getAllBusinessUnitList, getAllBusinessUnitList,
getProjectListById, getProjectListById,
inserTableData, inserTableData
deleteBatch,
updateCcap
} from "@/api/CCAPProjectManagement/list"; } from "@/api/CCAPProjectManagement/list";
const tableDialogForm = ref({
business:null,
id:null
})
const { proxy } = getCurrentInstance(); const { proxy } = getCurrentInstance();
const tableList = ref([]); const tableList = ref([]);
const drawer2 = ref(false) const drawer2 = ref(false)
...@@ -219,13 +177,12 @@ const dialogVisible = ref(false) ...@@ -219,13 +177,12 @@ const dialogVisible = ref(false)
const adminId = '12321' const adminId = '12321'
const businessList = ref([]) const businessList = ref([])
const drawer2TableList = ref([]); const drawer2TableList = ref([]);
const ids = ref([])
const showSearch = ref(true); const showSearch = ref(true);
const dialogQueryRef = ref(null); const dialogQueryRef = ref(null);
const drawerQueryRef = ref(null); const drawerQueryRef = ref(null);
const addTitle = ref('新增'); const addTitle = ref('新增');
const tableDialogVisible = ref(false)
const tableDialogTitle = ref('')
const total = ref(0); const total = ref(0);
const dialogRules = { const dialogRules = {
project: [{ required: true, message: '项目名称不能为空', trigger: 'blur' }], project: [{ required: true, message: '项目名称不能为空', trigger: 'blur' }],
...@@ -235,8 +192,7 @@ const dialogRules = { ...@@ -235,8 +192,7 @@ 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({
...@@ -264,13 +220,6 @@ function getList() { ...@@ -264,13 +220,6 @@ function getList() {
}); });
} }
function handleSelectionChange(arr){
ids.value.length = 0
for(let item of arr){
ids.value.push(item.id)
}
}
//获取抽屉里面的表格数据 //获取抽屉里面的表格数据
function getDataProjectListById() { function getDataProjectListById() {
getProjectListById(drawerQueryParams.value).then(res => { getProjectListById(drawerQueryParams.value).then(res => {
...@@ -278,68 +227,6 @@ function getDataProjectListById() { ...@@ -278,68 +227,6 @@ function getDataProjectListById() {
drawer2TableList.value = res.data; drawer2TableList.value = res.data;
}); });
} }
function piliangDel(){
if(ids.value.length === 0) return ElMessage.warning("请先选择要删除的数据项")
ElMessageBox.confirm(
'是否删除选中数据?',
'提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}
)
.then(() => {
del(ids.value)
})
.catch(() => {
})
}
//添加事业部
function addBusiness(row){
console.log(row)
tableDialogTitle.value = '添加事业部'
tableDialogVisible.value =true
}
//删除
function handleDrawerDel(row){
ElMessageBox.confirm(
'是否删除该数据?',
'提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}
)
.then(() => {
del([row.id])
})
.catch(() => {
})
}
function del(id){
deleteBatch(id).then(res=>{
if(res.code === 200){
ElMessage.success("删除成功")
getDataProjectListById()
dialogVisible.value = false;
}
})
}
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 => {
...@@ -358,33 +245,21 @@ function handleAdd() { ...@@ -358,33 +245,21 @@ function handleAdd() {
//对话框里面的保存 //对话框里面的保存
function dialogSave() { function dialogSave() {
console.log(dialogForm.value); console.log(dialogForm.value);
dialogQueryRef.value.validate((valid)=>{ inserTableData(dialogForm.value).then(res=>{
if (valid) { console.log(res)
//判断是新增还是保存 if(res.code === 200) {
if(addTitle.value === '新增'){ ElMessage.success("新增成功")
inserTableData(dialogForm.value).then(res=>{ dialogCencal()
console.log(res) getDataProjectListById()
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) => {
// if (valid) {
// console.log(dialogForm.value);
// } else {
// return false;
// }
// });
} }
//对话框里面的取消 //对话框里面的取消
......
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