Commit 80cd3d9e authored by p-wanping.song's avatar p-wanping.song

修改筛选所属区域类型

parent 4d8ee4ad
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form
:model="queryParams"
ref="queryForm"
size="small"
:inline="true"
v-show="showSearch"
label-width="68px"
>
<el-form-item label="项目名称" prop="projectName">
<el-input
v-model="queryParams.projectName"
......@@ -9,7 +16,7 @@
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="楼宇名称" prop="name">
<el-input
v-model="queryParams.name"
......@@ -19,11 +26,12 @@
/>
</el-form-item>
<el-form-item label="所属区域" prop="deptId">
<el-input
<treeselect
v-model="queryParams.deptId"
placeholder="请输入所属区域"
clearable
@keyup.enter.native="handleQuery"
:options="deptOptions"
:show-count="true"
placeholder="请选择所属区域"
style="width: 250px"
/>
</el-form-item>
<el-form-item label="用途" prop="useto">
......@@ -43,7 +51,11 @@
/>
</el-form-item>
<el-form-item label="状态" prop="status">
<el-select v-model="queryParams.status" placeholder="请选择状态" clearable>
<el-select
v-model="queryParams.status"
placeholder="请选择状态"
clearable
>
<el-option
v-for="dict in dict.type.sys_normal_disable"
:key="dict.value"
......@@ -53,8 +65,16 @@
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
<el-button
type="primary"
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>
......@@ -67,7 +87,8 @@
size="mini"
@click="handleAdd"
v-hasPermi="['system:ledgerBuilding:add']"
>新增</el-button>
>新增</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
......@@ -78,7 +99,8 @@
:disabled="single"
@click="handleUpdate"
v-hasPermi="['system:ledgerBuilding:edit']"
>修改</el-button>
>修改</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
......@@ -89,7 +111,8 @@
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['system:ledgerBuilding:remove']"
>删除</el-button>
>删除</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
......@@ -99,12 +122,20 @@
size="mini"
@click="handleExport"
v-hasPermi="['system:ledgerBuilding:export']"
>导出</el-button>
>导出</el-button
>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
<right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="buildingList" @selection-change="handleSelectionChange">
<el-table
v-loading="loading"
:data="buildingList"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="序号" align="center">
<template slot-scope="scope">
......@@ -121,10 +152,17 @@
<el-table-column label="详细地址" align="center" prop="address" />
<el-table-column label="状态" align="center" prop="status">
<template slot-scope="scope">
<dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/>
<dict-tag
:options="dict.type.sys_normal_disable"
:value="scope.row.status"
/>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<el-table-column
label="操作"
align="center"
class-name="small-padding fixed-width"
>
<template slot-scope="scope">
<el-button
size="mini"
......@@ -132,20 +170,22 @@
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['system:ledgerBuilding:edit']"
>修改</el-button>
>修改</el-button
>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['system:ledgerBuilding:remove']"
>删除</el-button>
>删除</el-button
>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
......@@ -168,7 +208,10 @@
<el-input v-model="form.groundFloor" placeholder="请输入地上楼层数" />
</el-form-item>
<el-form-item label="地下楼层数(层)" prop="undergroundFloor">
<el-input v-model="form.undergroundFloor" placeholder="请输入地下楼层数" />
<el-input
v-model="form.undergroundFloor"
placeholder="请输入地下楼层数"
/>
</el-form-item>
<el-form-item label="用途" prop="useto">
<el-input v-model="form.useto" placeholder="请输入用途" />
......@@ -186,7 +229,6 @@
></el-option>
</el-select>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm">确 定</el-button>
......@@ -197,11 +239,22 @@
</template>
<script>
import { listBuilding, getBuilding, delBuilding, addBuilding, updateBuilding } from "@/api/ledger/building";
import {
listBuilding,
getBuilding,
delBuilding,
addBuilding,
updateBuilding,
} from "@/api/ledger/building";
import { deptTreeSelect } from "@/api/system/user";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
export default {
name: "Building",
dicts: ['sys_normal_disable', 'data_source'],
dicts: ["sys_normal_disable", "data_source"],
components: {
Treeselect,
},
data() {
return {
// 遮罩层
......@@ -240,18 +293,25 @@ export default {
// 表单参数
form: {},
// 表单校验
rules: {
}
rules: {},
deptOptions: [],
};
},
created() {
this.getList();
this.getDeptTree();
},
methods: {
/** 查询部门下拉树结构 */
getDeptTree() {
deptTreeSelect().then((response) => {
this.deptOptions = response.data;
});
},
/** 查询基础数据-楼宇列表 */
getList() {
this.loading = true;
listBuilding(this.queryParams).then(response => {
listBuilding(this.queryParams).then((response) => {
this.buildingList = response.rows;
this.total = response.total;
this.loading = false;
......@@ -280,7 +340,7 @@ export default {
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
updateTime: null,
};
this.resetForm("form");
},
......@@ -296,9 +356,9 @@ export default {
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
this.ids = selection.map((item) => item.id);
this.single = selection.length !== 1;
this.multiple = !selection.length;
},
/** 新增按钮操作 */
handleAdd() {
......@@ -309,8 +369,8 @@ export default {
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getBuilding(id).then(response => {
const id = row.id || this.ids;
getBuilding(id).then((response) => {
this.form = response.data;
this.open = true;
this.title = "修改基础数据-楼宇";
......@@ -318,16 +378,16 @@ export default {
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
this.$refs["form"].validate((valid) => {
if (valid) {
if (this.form.id != null) {
updateBuilding(this.form).then(response => {
updateBuilding(this.form).then((response) => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addBuilding(this.form).then(response => {
addBuilding(this.form).then((response) => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
......@@ -339,19 +399,27 @@ export default {
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除基础数据-楼宇编号为"' + ids + '"的数据项?').then(function() {
return delBuilding(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
this.$modal
.confirm('是否确认删除基础数据-楼宇编号为"' + ids + '"的数据项?')
.then(function () {
return delBuilding(ids);
})
.then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
})
.catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('/system/ledger/building/export', {
...this.queryParams
}, `building_${new Date().getTime()}.xlsx`)
}
}
this.download(
"/system/ledger/building/export",
{
...this.queryParams,
},
`building_${new Date().getTime()}.xlsx`
);
},
},
};
</script>
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form
:model="queryParams"
ref="queryForm"
size="small"
:inline="true"
v-show="showSearch"
label-width="68px"
>
<el-form-item label="项目名称" prop="name">
<el-input
v-model="queryParams.name"
......@@ -18,7 +25,11 @@
/>
</el-form-item>
<el-form-item label="项目业态" prop="business">
<el-select v-model="queryParams.business" placeholder="请选择项目业态" clearable>
<el-select
v-model="queryParams.business"
placeholder="请选择项目业态"
clearable
>
<el-option
v-for="dict in dict.type.risk_project_business"
:key="dict.value"
......@@ -29,11 +40,12 @@
</el-form-item>
<el-form-item label="所属区域" prop="deptId">
<el-input
<treeselect
v-model="queryParams.deptId"
placeholder="请输入所属区域"
clearable
@keyup.enter.native="handleQuery"
:options="deptOptions"
:show-count="true"
placeholder="请选择所属区域"
style="width: 250px"
/>
</el-form-item>
<el-form-item label="所在城市" prop="city">
......@@ -53,7 +65,11 @@
/>
</el-form-item>
<el-form-item label="状态" prop="status">
<el-select v-model="queryParams.status" placeholder="请选择状态" clearable>
<el-select
v-model="queryParams.status"
placeholder="请选择状态"
clearable
>
<el-option
v-for="dict in dict.type.sys_normal_disable"
:key="dict.value"
......@@ -63,8 +79,16 @@
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
<el-button
type="primary"
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>
......@@ -77,7 +101,8 @@
size="mini"
@click="handleAdd"
v-hasPermi="['system:ledgerProject:add']"
>新增</el-button>
>新增</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
......@@ -88,7 +113,8 @@
:disabled="single"
@click="handleUpdate"
v-hasPermi="['system:ledgerProject:edit']"
>修改</el-button>
>修改</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
......@@ -99,7 +125,8 @@
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['system:ledgerProject:remove']"
>删除</el-button>
>删除</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
......@@ -109,18 +136,26 @@
size="mini"
@click="handleExport"
v-hasPermi="['system:ledgerProject:export']"
>导出</el-button>
>导出</el-button
>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
<right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="projectList" @selection-change="handleSelectionChange">
<el-table
v-loading="loading"
:data="projectList"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="序号" align="center">
<template slot-scope="scope">
<span>{{ scope.$index + 1 }}</span>
</template>
</el-table-column>
<el-table-column label="序号" align="center">
<template slot-scope="scope">
<span>{{ scope.$index + 1 }}</span>
</template>
</el-table-column>
<el-table-column label="项目名称" align="center" prop="name" />
<el-table-column label="项目类型" align="center" prop="type" />
<el-table-column label="项目业态" align="center" prop="business" />
......@@ -129,10 +164,17 @@
<el-table-column label="详细地址" align="center" prop="address" />
<el-table-column label="状态" align="center" prop="status">
<template slot-scope="scope">
<dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/>
<dict-tag
:options="dict.type.sys_normal_disable"
:value="scope.row.status"
/>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<el-table-column
label="操作"
align="center"
class-name="small-padding fixed-width"
>
<template slot-scope="scope">
<el-button
size="mini"
......@@ -140,20 +182,22 @@
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['system:ledgerProject:edit']"
>修改</el-button>
>修改</el-button
>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['system:ledgerProject:remove']"
>删除</el-button>
>删除</el-button
>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
......@@ -180,7 +224,12 @@
</el-select>
</el-form-item>
<el-form-item label="所属区域" prop="deptId">
<treeselect v-model="form.deptId" :options="deptOptions" :show-count="true" placeholder="请选择所属区域" />
<treeselect
v-model="form.deptId"
:options="deptOptions"
:show-count="true"
placeholder="请选择所属区域"
/>
</el-form-item>
<el-form-item label="所在城市" prop="city">
<el-input v-model="form.city" placeholder="请输入所在城市" />
......@@ -198,7 +247,6 @@
></el-option>
</el-select>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm">确 定</el-button>
......@@ -209,14 +257,29 @@
</template>
<script>
import { listUser, getUser, delUser, addUser, updateUser, resetUserPwd, changeUserStatus, deptTreeSelect } from "@/api/system/user";
import { listProject, getProject, delProject, addProject, updateProject } from "@/api/ledger/project/";
import {
listUser,
getUser,
delUser,
addUser,
updateUser,
resetUserPwd,
changeUserStatus,
deptTreeSelect,
} from "@/api/system/user";
import {
listProject,
getProject,
delProject,
addProject,
updateProject,
} from "@/api/ledger/project/";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
export default {
name: "Project",
dicts: ['sys_normal_disable', 'data_source', 'risk_project_business'],
dicts: ["sys_normal_disable", "data_source", "risk_project_business"],
components: { Treeselect },
data() {
return {
......@@ -255,15 +318,14 @@ export default {
// 表单参数
form: {},
// 表单校验
rules: {
}
rules: {},
};
},
watch: {
// 根据名称筛选部门树
deptName(val) {
this.$refs.tree.filter(val);
}
},
},
created() {
this.getList();
......@@ -273,7 +335,7 @@ export default {
/** 查询基础数据-项目列表 */
getList() {
this.loading = true;
listProject(this.queryParams).then(response => {
listProject(this.queryParams).then((response) => {
this.projectList = response.rows;
this.total = response.total;
this.loading = false;
......@@ -281,7 +343,7 @@ export default {
},
/** 查询部门下拉树结构 */
getDeptTree() {
deptTreeSelect().then(response => {
deptTreeSelect().then((response) => {
this.deptOptions = response.data;
});
},
......@@ -315,7 +377,7 @@ export default {
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
updateTime: null,
};
this.resetForm("form");
},
......@@ -331,9 +393,9 @@ export default {
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
this.ids = selection.map((item) => item.id);
this.single = selection.length !== 1;
this.multiple = !selection.length;
},
/** 新增按钮操作 */
handleAdd() {
......@@ -344,8 +406,8 @@ export default {
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getProject(id).then(response => {
const id = row.id || this.ids;
getProject(id).then((response) => {
this.form = response.data;
this.open = true;
this.title = "修改基础数据-项目";
......@@ -353,16 +415,16 @@ export default {
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
this.$refs["form"].validate((valid) => {
if (valid) {
if (this.form.id != null) {
updateProject(this.form).then(response => {
updateProject(this.form).then((response) => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addProject(this.form).then(response => {
addProject(this.form).then((response) => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
......@@ -374,19 +436,27 @@ export default {
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除基础数据-项目编号为"' + ids + '"的数据项?').then(function() {
return delProject(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
this.$modal
.confirm('是否确认删除基础数据-项目编号为"' + ids + '"的数据项?')
.then(function () {
return delProject(ids);
})
.then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
})
.catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('system/ledger/project/export', {
...this.queryParams
}, `project_${new Date().getTime()}.xlsx`)
}
}
this.download(
"system/ledger/project/export",
{
...this.queryParams,
},
`project_${new Date().getTime()}.xlsx`
);
},
},
};
</script>
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