You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

467 lines
12 KiB

<template>
<div class="app-container">
<!-- 面包屑 -->
<el-breadcrumb separator="/" style="margin-bottom: 20px">
<el-breadcrumb-item
v-for="(item, index) in routeList"
:key="item + index"
:to="{ path: item.path }"
>{{ item.routeName }}</el-breadcrumb-item
>
</el-breadcrumb>
<el-row :gutter="20" v-show="showSearch">
<el-col :span="22">
<!-- 搜索条件 -->
<el-form
:model="queryParams"
ref="queryForm"
:inline="true"
label-width="68px"
>
<el-form-item label="项目名称" prop="projectName">
<el-input
v-model="queryParams.cv.value"
placeholder="请输入专题项目名称"
clearable
size="small"
@keyup.enter.native="handleQuery"
>
<el-button
type="primary"
slot="append"
icon="el-icon-search"
size="small"
@click="handleQuery"
></el-button>
</el-input>
</el-form-item>
<el-form-item label="规划类型" prop="projectType">
<el-select
v-model="queryParams.data.projectType"
placeholder="请选择规划类型"
clearable
size="small"
@change="handleQuery"
>
<el-option
v-for="dict in projectTypeOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue"
/>
</el-select>
</el-form-item>
<el-form-item label="规划所属区域" prop="adcd" label-width="120px">
<el-cascader
ref="qyCascader"
:options="areasOptions"
v-model="queryParams.data.adcd"
:props="areasOptionProps"
placeholder="请输入规划所属区域"
clearable
size="small"
style="width: 100%"
@change="handleQuery"
>
</el-cascader>
</el-form-item>
<el-form-item>
<!-- <el-button
type="cyan"
icon="el-icon-search"
size="mini"
@click="handleQuery"
>搜索</el-button
> -->
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
>重置</el-button
>
</el-form-item>
</el-form>
</el-col>
</el-row>
<!-- 操作 -->
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
icon="el-icon-plus"
size="mini"
@click="openOptions"
v-hasPermi="['earlyStage:projectinfo:add']"
>新增</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['earlyStage:projectinfo:edit']"
>修改</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['earlyStage:projectinfo:remove']"
>删除</el-button
>
</el-col>
<right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</el-row>
<!-- 表格 -->
<el-table
v-loading="loading"
:data="projectinfoList"
@selection-change="handleSelectionChange"
>
<el-table-column
type="selection"
width="55"
align="center"
fixed="left"
/>
<el-table-column
label="序号"
type="index"
width="50"
align="center"
fixed="left"
/>
<el-table-column
label="专题项目名称"
align="center"
prop="projectName"
min-width="180"
/>
<el-table-column
label="项目编号"
align="center"
prop="proNo"
min-width="180"
/>
<!-- <el-table-column label="项目编码" align="center" prop="projectName" /> -->
<el-table-column
label="规划类型"
align="center"
prop="projectType"
:formatter="projectTypeFormat"
min-width="120"
/>
<el-table-column
label="规划编制单位"
align="center"
prop="compilingUnit"
min-width="120"
/>
<el-table-column
label="规划水平年"
align="center"
prop="startYear"
min-width="120"
/>
<el-table-column
label="规划目标年"
align="center"
prop="endYear"
min-width="120"
/>
<el-table-column
label="规划金额(万元)"
align="center"
prop="amount"
min-width="150"
/>
<el-table-column
label="创建时间"
align="center"
prop="createTime"
width="120"
>
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime, "{y}-{m}-{d}") }}</span>
</template>
</el-table-column>
<el-table-column
label="操作"
align="center"
class-name="small-padding fixed-width"
width="180"
fixed="right"
>
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['system:projectinfo:edit']"
>修改</el-button
>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['system:projectinfo:remove']"
>删除</el-button
>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</div>
</template>
<script>
import {
listProjectinfo,
getProjectinfo,
delProjectinfo,
addProjectinfo,
updateProjectinfo,
exportProjectinfo,
} from "@/api/earlyStage/projectinfo";
import { getAreasData } from "@/api/areas/index";
// import { listProjectinfo, getProjectinfo, delProjectinfo, addProjectinfo, updateProjectinfo, exportProjectinfo } from "@/api/earlyStage/projectinfo";
export default {
data() {
return {
areasOptionProps: {
emitPath: false,
checkStrictly: true, //选择任意一级
// lazy: true,
// lazyLoad: function qylazyLoad(node) {
// // node.level = 5;
// console.log("node", node.level);
// },
},
areasOptions: [],
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 表格数据总条数
total: 0,
// 加载状态
loading: true,
// 专题项目前期背景信息表格数据
projectinfoList: [],
// 规划类型字典
projectTypeOptions: [],
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
ids: null,
data: {
projectName: null,
projectType: null,
},
// 排序方式
params: {
// 按哪个字段排序
orderBy: "create_time",
// desc降序,升序asc
sort: "desc",
},
cv: {},
},
// 面包屑,路由信息
routeList: [
{
path: "/project/special",
routeName: "专题管理",
},
],
};
},
created() {
this.getTreeData();
this.getList();
this.getDicts("plan_type").then((response) => {
this.projectTypeOptions = response.data;
});
},
methods: {
getTreeData() {
getAreasData().then((items) => {
// console.log("getAreasData", items.data);
let res = [];
let getChildren = (res, pid) => {
for (const i of items.data) {
if (i.parentid === pid) {
const newItem = {
label: i.name,
value: i.id,
layer: i.layer,
};
if (i.layer != 3) newItem.children = [];
res.push(newItem);
getChildren(newItem.children, newItem.value);
}
}
};
getChildren(res, items.data[0].parentid);
console.log("areasOptions", res);
this.areasOptions = res;
// return res;
});
},
onSubmit() {
console.log("submit!");
},
openOptions() {
this.routeList.push({
path: "/project/special/options",
routeName: "专题基础信息",
isEdit: false,
});
// 存储面包屑信息
this.$store.commit("setRouteList", JSON.stringify(this.routeList));
this.$router.push({
path: "/project/special/options",
});
},
/** 查询专题项目前期背景信息列表 */
getList() {
this.loading = true;
listProjectinfo(this.queryParams).then((response) => {
this.projectinfoList = response.records;
this.total = response.total;
this.loading = false;
});
},
// 规划类型字典翻译
projectTypeFormat(row, column) {
return this.selectDictLabel(this.projectTypeOptions, row.projectType);
},
// 查询表单重置
resetQueryForm() {
this.queryParams = {
pageNum: 1,
pageSize: 10,
data: {
id: null,
projectName: null,
projectType: null,
overview: null,
compilingUnit: null,
startYear: null,
endYear: null,
amount: null,
compilingUnitNature: null,
compilingUnitAddress: null,
compilingUnitLegalPerson: null,
projectReport: null,
proNo: null,
createUid: null,
createTime: null,
updateUid: null,
updateTime: null,
owerDept: null,
},
cv: {
name: null,
type: null,
},
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.cv.name = "projectName";
this.queryParams.cv.type = "like";
this.queryParams.pageNum = 1;
this.getList();
},
// handleAreasQuery(value, a) {
// // console.log(value, a);
// const obj = this.$refs["qyCascader"].getCheckedNodes();
// console.log("obj", obj);
// // this.queryParams.layer=
// // this.getList();
// },
/** 重置按钮操作 */
resetQuery() {
this.resetQueryForm();
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map((item) => item.id);
this.single = selection.length !== 1;
this.multiple = !selection.length;
},
/** 修改按钮操作 */
handleUpdate(row) {
// this.reset();
const id = row.id || this.ids;
getProjectinfo(id).then((response) => {
this.routeList.push({
path: "/project/special/options",
routeName: "专题基础信息",
isEdit: true,
});
// 存储面包屑信息
this.$store.commit("setRouteList", JSON.stringify(this.routeList));
// 存储专题项目基础信息
// this.$store.commit("setBaseFormData", JSON.stringify(response.data));
// 跳转到选项卡页面
this.$router.push({
// path: "/project/special/options",
path: "/project/special/options?baseDataId=" + response.data.id,
});
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
if (ids) {
this.$confirm("是否删除选中的数据", "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(function () {
return delProjectinfo(ids);
})
.then(() => {
this.getList();
this.msgSuccess("删除成功");
})
.catch(function () {});
} else {
this.$message.warning("请选择要删除的数据");
}
},
},
};
</script>