<template>
|
<div class="view">
|
<div class="search-warp">
|
<el-form :inline="true" :model="searchForm" class="demo-form-inline">
|
<el-form-item>
|
<el-button size="small" type="primary" @click="search">查找</el-button>
|
</el-form-item>
|
</el-form>
|
</div>
|
<OperateC
|
:top-level="topLevel"
|
:add="addProjectInfo"
|
:edit="editProjectInfo"
|
:remove="removeProjectInfo"
|
:add-show="this.$getButtonAuth('projectInfo:add')"
|
:remove-show="this.$getButtonAuth('projectInfo:del:batch')"
|
></OperateC>
|
<ProjectInfoTable
|
:top-level="topLevel"
|
ref="ProjectInfoTableRef"
|
:edit-show="this.$getButtonAuth('projectInfo:edit')"
|
:del-show="this.$getButtonAuth('projectInfo:del')"
|
></ProjectInfoTable>
|
<ProjectInfoDialog></ProjectInfoDialog>
|
</div>
|
</template>
|
|
<script>
|
import ProjectInfoDialog from "@/components/dialog/ProjectInfoDialog";
|
import OperateC from "@/components/OperateC";
|
import ProjectInfoTable from "@/components/table/ProjectInfoTable";
|
import {deleteProjectInfoByIds, getProjectInfos} from "@/api/projectInfo";
|
export default {
|
name: "ProjectInfoView",
|
components: {ProjectInfoDialog, OperateC, ProjectInfoTable},
|
data() {
|
return {
|
searchForm: {
|
},
|
topLevel: -1
|
}
|
},
|
methods: {
|
search() {
|
this.$refs.ProjectInfoTableRef.getProjectInfos(this.searchForm)
|
},
|
addProjectInfo() {
|
let params = {
|
dialogFormVisible: true,
|
dialogTitle: "添加项目管理基础信息表"
|
}
|
this.$store.commit("projectInfo/openDialogForm", params);
|
},
|
editProjectInfo() {
|
let selected = this.$store.state.projectInfo.multipleSelection;
|
if (selected.length < 1) {
|
this.$message.warning("你还没有选中数据哦!");
|
return;
|
}
|
if (selected.length > 1) {
|
this.$message.warning("一次只能修改一条数据哦!")
|
return;
|
}
|
this.$store.dispatch("projectInfo/editProjectInfo", selected[0]);
|
},
|
removeProjectInfo() {
|
let selected = this.$store.state.projectInfo.multipleSelection;
|
if (selected.length < 1) {
|
this.$message.warning("请先选择要删除的数据哦!");
|
return;
|
}
|
this.$confirm('确定删除吗?', '提示', {
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
type: 'warning'
|
}).then(() => {
|
deleteProjectInfoByIds(selected).then((res) => {
|
this.$message.success(res.data.msg);
|
// 刷新
|
let params = {
|
"current": this.$store.state.projectInfo.currentPage,
|
"size": this.$store.state.projectInfo.pageSize
|
};
|
getProjectInfos(params).then((res) => {
|
this.$store.state.projectInfo.tableData = res.data.data;
|
this.$store.state.projectInfo.total = res.data.total;
|
})
|
})
|
}).catch(() => {
|
this.$message({
|
type: 'info',
|
message: '已取消删除'
|
});
|
});
|
},
|
}
|
}
|
</script>
|
|
<style scoped>
|
|
</style>
|