|
@@ -1,6 +1,6 @@
|
|
|
<template>
|
|
|
<div class="app-container">
|
|
|
- <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px" @submit.native.prevent>
|
|
|
+ <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" @submit.native.prevent>
|
|
|
<el-form-item label="姓名" prop="name">
|
|
|
<el-input
|
|
|
v-model="queryParams.name"
|
|
@@ -10,6 +10,16 @@
|
|
|
@keyup.enter.native="handleQuery"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
+ <el-form-item prop="deptId">
|
|
|
+ <template slot="label">
|
|
|
+ <span @click="changeQueryType" v-if="queryParams.deptName == 0">本级及下级</span>
|
|
|
+ <span @click="changeQueryType" v-if="queryParams.deptName == 1">只查询本级</span>
|
|
|
+ </template>
|
|
|
+ <treeselect v-model="queryParams.deptId" :options="deptOptions" multiple:false :show-count="true"
|
|
|
+ placeholder="请选择部门" @select="hx" :noResultsText="'空'" :noOptionsText="'空'"
|
|
|
+ style="width: 240px"/>
|
|
|
+ <el-input v-model="queryParams.deptName" v-if="false"/>
|
|
|
+ </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>
|
|
@@ -127,14 +137,15 @@
|
|
|
></el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
-<!-- <el-form-item label="姓名" prop="name">
|
|
|
- <el-input v-model="form.name" placeholder="请输入姓名" maxlength="20" disabled/>
|
|
|
- </el-form-item>-->
|
|
|
+ <!-- <el-form-item label="姓名" prop="name">
|
|
|
+ <el-input v-model="form.name" placeholder="请输入姓名" maxlength="20" disabled/>
|
|
|
+ </el-form-item>-->
|
|
|
<el-form-item label="行政职务" prop="position">
|
|
|
<el-input v-model="form.position" placeholder="请输入行政职务" maxlength="20"/>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="所属部门" prop="deptId" class="form-style">
|
|
|
- <treeselect v-model="form.deptId" :options="deptOptions" multiple:false :show-count="true" :noResultsText="'空'" :noOptionsText="'空'"
|
|
|
+ <treeselect v-model="form.deptId" :options="deptOptions" multiple:false :show-count="true"
|
|
|
+ :noResultsText="'空'" :noOptionsText="'空'"
|
|
|
placeholder="请选择部门" @select="hx"/>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
@@ -156,7 +167,7 @@
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="联系电话" prop="phone">
|
|
|
- <el-input v-model="form.phone" placeholder="请输入联系电话" disabled maxlength="20"/>
|
|
|
+ <el-input v-model="form.phone" placeholder="请输入联系电话" disabled maxlength="20"/>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
@@ -193,240 +204,246 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
- import {listPerson, getPerson, delPerson, addPerson, updatePerson} from "@/api/data/digitalenvironment/person";
|
|
|
- import Deptselector from '@/views/components/deptselector';
|
|
|
- import {
|
|
|
- selectUserList
|
|
|
- } from "@/api/data/digitalforest/linleader/linleader";
|
|
|
- import {treeselect} from "@/api/system/dept";
|
|
|
- import Treeselect from "@riophae/vue-treeselect";
|
|
|
- import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
|
|
- export default {
|
|
|
- dicts: ['centerdata_hydroenergy_plan_rank', 'centerdata_environment_job','sys_user_sex'],
|
|
|
- components: {
|
|
|
- Deptselector,
|
|
|
- Treeselect
|
|
|
- },
|
|
|
- setDataDeptId(e) {
|
|
|
- this.form.deptId = e.deptId;
|
|
|
- this.form.deptName = e.deptName;
|
|
|
- },
|
|
|
- name: "Person",
|
|
|
- data() {
|
|
|
- return {
|
|
|
- disabled:false,
|
|
|
- userList: [],
|
|
|
- deptOptions: undefined,
|
|
|
- // 遮罩层
|
|
|
- loading: true,
|
|
|
- // 选中数组
|
|
|
- ids: [],
|
|
|
- // 非单个禁用
|
|
|
- single: true,
|
|
|
- // 非多个禁用
|
|
|
- multiple: true,
|
|
|
- // 显示搜索条件
|
|
|
- showSearch: true,
|
|
|
- // 总条数
|
|
|
- total: 0,
|
|
|
- // 资源人员表格数据
|
|
|
- personList: [],
|
|
|
- // 弹出层标题
|
|
|
- title: "",
|
|
|
- // 是否显示弹出层
|
|
|
- open: false,
|
|
|
- // 查询参数
|
|
|
- queryParams: {
|
|
|
- pageNum: 1,
|
|
|
- pageSize: 10,
|
|
|
- name: null,
|
|
|
- sex: null,
|
|
|
- phone: null,
|
|
|
- attachId: null,
|
|
|
- post: null,
|
|
|
- position: null,
|
|
|
- introduction: null,
|
|
|
- riverwayLengthCounty: null,
|
|
|
- deptId: null,
|
|
|
- deptName: null,
|
|
|
- createName: null,
|
|
|
- updateName: null,
|
|
|
- dataStatus: null,
|
|
|
- userId: null
|
|
|
- },
|
|
|
- // 表单参数
|
|
|
- form: {
|
|
|
- dialogImageUrl: '',
|
|
|
- imageUrl: ''
|
|
|
- },
|
|
|
- // 表单校验
|
|
|
- rules: {
|
|
|
- sex: [
|
|
|
- {required: true, message: "性别不能为空", trigger: "change"}
|
|
|
- ],
|
|
|
- deptId: [
|
|
|
- {required: true, message: "所属部门不能为空", trigger: "change"}
|
|
|
- ],
|
|
|
- name: [
|
|
|
- {required: true, message: "姓名不能为空", trigger: "change"}
|
|
|
- ],
|
|
|
- post: [
|
|
|
- {required: true, message: "岗位不能为空", trigger: "change"}
|
|
|
- ],
|
|
|
- userId: [
|
|
|
- {required: true, message: "关联用户不能为空", trigger: "change"}
|
|
|
- ],
|
|
|
- environmentJob: [
|
|
|
- {required: true, message: "职务不能为空", trigger: "change"}
|
|
|
- ]
|
|
|
- }
|
|
|
- };
|
|
|
- },
|
|
|
- created() {
|
|
|
- this.getList();
|
|
|
- this.getTreeselect();
|
|
|
+import {listPerson, getPerson, delPerson, addPerson, updatePerson} from "@/api/data/digitalenvironment/person";
|
|
|
+import Deptselector from '@/views/components/deptselector';
|
|
|
+import {
|
|
|
+ selectUserList
|
|
|
+} from "@/api/data/digitalforest/linleader/linleader";
|
|
|
+import {treeselect} from "@/api/system/dept";
|
|
|
+import Treeselect from "@riophae/vue-treeselect";
|
|
|
+import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
|
|
|
|
|
- selectUserList().then(response => {
|
|
|
- this.userList = response.data;
|
|
|
- });
|
|
|
- },
|
|
|
- methods: {
|
|
|
- getTreeselect() {
|
|
|
- treeselect().then(response => {
|
|
|
- this.deptOptions = response.data
|
|
|
- })
|
|
|
- },
|
|
|
- hx(node) {
|
|
|
- this.form.dataDeptId = node.id
|
|
|
- this.form.deptId = node.id
|
|
|
- this.form.deptName = node.label
|
|
|
- this.$refs.form.validateField("deptId")
|
|
|
- },
|
|
|
- a(event) {
|
|
|
- this.form.name = event.nickName
|
|
|
- this.form.sex = event.sex
|
|
|
- this.form.phone = event.phonenumber
|
|
|
- },
|
|
|
- getUrl(url) {
|
|
|
- this.form.dialogImageUrl = url;
|
|
|
- this.form.attachId = url;
|
|
|
- },
|
|
|
- setDataDeptId(e) {
|
|
|
- this.form.deptId = e.deptId;
|
|
|
- this.form.deptName = e.deptName;
|
|
|
- },
|
|
|
- /** 查询环保人员列表 */
|
|
|
- getList() {
|
|
|
- this.loading = true;
|
|
|
- listPerson(this.queryParams).then(response => {
|
|
|
- this.personList = response.rows;
|
|
|
- this.total = response.total;
|
|
|
- this.loading = false;
|
|
|
- });
|
|
|
- },
|
|
|
- // 取消按钮
|
|
|
- cancel() {
|
|
|
- this.open = false;
|
|
|
- this.reset();
|
|
|
- },
|
|
|
- // 表单重置
|
|
|
- reset() {
|
|
|
- this.form = {
|
|
|
- id: null,
|
|
|
- name: null,
|
|
|
- sex: null,
|
|
|
- phone: null,
|
|
|
- attachId: null,
|
|
|
- post: null,
|
|
|
- position: null,
|
|
|
- introduction: null,
|
|
|
- riverwayLengthCounty: null,
|
|
|
- deptId: null,
|
|
|
- deptName: null,
|
|
|
- createBy: null,
|
|
|
- createName: null,
|
|
|
- createTime: null,
|
|
|
- updateBy: null,
|
|
|
- updateName: null,
|
|
|
- updateTime: null,
|
|
|
- dataStatus: "0",
|
|
|
- userId: null
|
|
|
- };
|
|
|
- this.resetForm("form");
|
|
|
- },
|
|
|
- /** 搜索按钮操作 */
|
|
|
- handleQuery() {
|
|
|
- this.queryParams.pageNum = 1;
|
|
|
- this.getList();
|
|
|
- },
|
|
|
- /** 重置按钮操作 */
|
|
|
- resetQuery() {
|
|
|
- this.resetForm("queryForm");
|
|
|
- this.handleQuery();
|
|
|
- },
|
|
|
- // 多选框选中数据
|
|
|
- handleSelectionChange(selection) {
|
|
|
- this.ids = selection.map(item => item.id)
|
|
|
- this.single = selection.length !== 1
|
|
|
- this.multiple = !selection.length
|
|
|
- },
|
|
|
- /** 新增按钮操作 */
|
|
|
- handleAdd() {
|
|
|
- this.reset();
|
|
|
- this.open = true;
|
|
|
- this.title = "添加环保人员";
|
|
|
- this.disabled=false;
|
|
|
+export default {
|
|
|
+ dicts: ['centerdata_hydroenergy_plan_rank', 'centerdata_environment_job', 'sys_user_sex'],
|
|
|
+ components: {
|
|
|
+ Deptselector,
|
|
|
+ Treeselect
|
|
|
+ },
|
|
|
+ setDataDeptId(e) {
|
|
|
+ this.form.deptId = e.deptId;
|
|
|
+ this.form.deptName = e.deptName;
|
|
|
+ },
|
|
|
+ name: "Person",
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ disabled: false,
|
|
|
+ userList: [],
|
|
|
+ deptOptions: undefined,
|
|
|
+ // 遮罩层
|
|
|
+ loading: true,
|
|
|
+ // 选中数组
|
|
|
+ ids: [],
|
|
|
+ // 非单个禁用
|
|
|
+ single: true,
|
|
|
+ // 非多个禁用
|
|
|
+ multiple: true,
|
|
|
+ // 显示搜索条件
|
|
|
+ showSearch: true,
|
|
|
+ // 总条数
|
|
|
+ total: 0,
|
|
|
+ // 资源人员表格数据
|
|
|
+ personList: [],
|
|
|
+ // 弹出层标题
|
|
|
+ title: "",
|
|
|
+ // 是否显示弹出层
|
|
|
+ open: false,
|
|
|
+ // 查询参数
|
|
|
+ queryParams: {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ name: null,
|
|
|
+ sex: null,
|
|
|
+ phone: null,
|
|
|
+ attachId: null,
|
|
|
+ post: null,
|
|
|
+ position: null,
|
|
|
+ introduction: null,
|
|
|
+ riverwayLengthCounty: null,
|
|
|
+ deptId: null,
|
|
|
+ deptName: 0,
|
|
|
+ createName: null,
|
|
|
+ updateName: null,
|
|
|
+ dataStatus: null,
|
|
|
+ userId: null
|
|
|
+ },
|
|
|
+ // 表单参数
|
|
|
+ form: {
|
|
|
+ dialogImageUrl: '',
|
|
|
+ imageUrl: ''
|
|
|
+ },
|
|
|
+ // 表单校验
|
|
|
+ rules: {
|
|
|
+ sex: [
|
|
|
+ {required: true, message: "性别不能为空", trigger: "change"}
|
|
|
+ ],
|
|
|
+ deptId: [
|
|
|
+ {required: true, message: "所属部门不能为空", trigger: "change"}
|
|
|
+ ],
|
|
|
+ name: [
|
|
|
+ {required: true, message: "姓名不能为空", trigger: "change"}
|
|
|
+ ],
|
|
|
+ post: [
|
|
|
+ {required: true, message: "岗位不能为空", trigger: "change"}
|
|
|
+ ],
|
|
|
+ userId: [
|
|
|
+ {required: true, message: "关联用户不能为空", trigger: "change"}
|
|
|
+ ],
|
|
|
+ environmentJob: [
|
|
|
+ {required: true, message: "职务不能为空", trigger: "change"}
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ };
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.getList();
|
|
|
+ this.getTreeselect();
|
|
|
|
|
|
- },
|
|
|
- /** 修改按钮操作 */
|
|
|
- handleUpdate(row) {
|
|
|
- this.reset();
|
|
|
- const id = row.id || this.ids
|
|
|
- this.disabled=true;
|
|
|
- getPerson(id).then(response => {
|
|
|
- this.form = response.data;
|
|
|
- this.open = true;
|
|
|
- this.title = "修改环保人员";
|
|
|
+ selectUserList().then(response => {
|
|
|
+ this.userList = response.data;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ getTreeselect() {
|
|
|
+ treeselect().then(response => {
|
|
|
+ this.deptOptions = response.data
|
|
|
+ })
|
|
|
+ },
|
|
|
+ hx(node) {
|
|
|
+ this.form.dataDeptId = node.id
|
|
|
+ this.form.deptId = node.id
|
|
|
+ this.form.deptName = node.label
|
|
|
+ this.$refs.form.validateField("deptId")
|
|
|
+ },
|
|
|
+ a(event) {
|
|
|
+ this.form.name = event.nickName
|
|
|
+ this.form.sex = event.sex
|
|
|
+ this.form.phone = event.phonenumber
|
|
|
+ },
|
|
|
+ getUrl(url) {
|
|
|
+ this.form.dialogImageUrl = url;
|
|
|
+ this.form.attachId = url;
|
|
|
+ },
|
|
|
+ setDataDeptId(e) {
|
|
|
+ this.form.deptId = e.deptId;
|
|
|
+ this.form.deptName = e.deptName;
|
|
|
+ },
|
|
|
+ /** 查询环保人员列表 */
|
|
|
+ getList() {
|
|
|
+ this.loading = true;
|
|
|
+ listPerson(this.queryParams).then(response => {
|
|
|
+ this.personList = response.rows;
|
|
|
+ this.total = response.total;
|
|
|
+ this.loading = false;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 取消按钮
|
|
|
+ cancel() {
|
|
|
+ this.open = false;
|
|
|
+ this.reset();
|
|
|
+ },
|
|
|
+ // 表单重置
|
|
|
+ reset() {
|
|
|
+ this.form = {
|
|
|
+ id: null,
|
|
|
+ name: null,
|
|
|
+ sex: null,
|
|
|
+ phone: null,
|
|
|
+ attachId: null,
|
|
|
+ post: null,
|
|
|
+ position: null,
|
|
|
+ introduction: null,
|
|
|
+ riverwayLengthCounty: null,
|
|
|
+ deptId: null,
|
|
|
+ deptName: null,
|
|
|
+ createBy: null,
|
|
|
+ createName: null,
|
|
|
+ createTime: null,
|
|
|
+ updateBy: null,
|
|
|
+ updateName: null,
|
|
|
+ updateTime: null,
|
|
|
+ dataStatus: "0",
|
|
|
+ userId: null
|
|
|
+ };
|
|
|
+ this.resetForm("form");
|
|
|
+ },
|
|
|
+ /** 搜索按钮操作 */
|
|
|
+ handleQuery() {
|
|
|
+ this.queryParams.pageNum = 1;
|
|
|
+ this.getList();
|
|
|
+ },
|
|
|
+ /** 重置按钮操作 */
|
|
|
+ resetQuery() {
|
|
|
+ this.queryParams.deptName = 0;
|
|
|
+ this.resetForm("queryForm");
|
|
|
+ this.handleQuery();
|
|
|
+ },
|
|
|
+ // 点击按钮修改是否只查询本级部门用户
|
|
|
+ changeQueryType() {
|
|
|
+ this.queryParams.deptName = this.queryParams.deptName == 0 ? 1 : 0;
|
|
|
+ },
|
|
|
+ // 多选框选中数据
|
|
|
+ handleSelectionChange(selection) {
|
|
|
+ this.ids = selection.map(item => item.id)
|
|
|
+ this.single = selection.length !== 1
|
|
|
+ this.multiple = !selection.length
|
|
|
+ },
|
|
|
+ /** 新增按钮操作 */
|
|
|
+ handleAdd() {
|
|
|
+ this.reset();
|
|
|
+ this.open = true;
|
|
|
+ this.title = "添加环保人员";
|
|
|
+ this.disabled = false;
|
|
|
|
|
|
- });
|
|
|
- },
|
|
|
- /** 提交按钮 */
|
|
|
- submitForm() {
|
|
|
- this.$refs["form"].validate(valid => {
|
|
|
- if (valid) {
|
|
|
- if (this.form.id != null) {
|
|
|
- updatePerson(this.form).then(response => {
|
|
|
- this.$modal.msgSuccess("修改成功");
|
|
|
- this.open = false;
|
|
|
- this.getList();
|
|
|
- });
|
|
|
- } else {
|
|
|
- addPerson(this.form).then(response => {
|
|
|
- this.$modal.msgSuccess("新增成功");
|
|
|
- this.open = false;
|
|
|
- this.getList();
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- },
|
|
|
- /** 删除按钮操作 */
|
|
|
- handleDelete(row) {
|
|
|
- const ids = row.id || this.ids;
|
|
|
- this.$modal.confirm('是否确认删除选中的数据项?').then(function () {
|
|
|
- return delPerson(ids);
|
|
|
- }).then(() => {
|
|
|
- this.getList();
|
|
|
- this.$modal.msgSuccess("删除成功");
|
|
|
- }).catch(() => {
|
|
|
- });
|
|
|
- },
|
|
|
- /** 导出按钮操作 */
|
|
|
- handleExport() {
|
|
|
- this.download('/center-data/environmentPerson/export', {
|
|
|
- ...this.queryParams
|
|
|
- }, `环保人员_${new Date().getTime()}.xlsx`)
|
|
|
- }
|
|
|
+ },
|
|
|
+ /** 修改按钮操作 */
|
|
|
+ handleUpdate(row) {
|
|
|
+ this.reset();
|
|
|
+ const id = row.id || this.ids
|
|
|
+ this.disabled = true;
|
|
|
+ getPerson(id).then(response => {
|
|
|
+ this.form = response.data;
|
|
|
+ this.open = true;
|
|
|
+ this.title = "修改环保人员";
|
|
|
+
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /** 提交按钮 */
|
|
|
+ submitForm() {
|
|
|
+ this.$refs["form"].validate(valid => {
|
|
|
+ if (valid) {
|
|
|
+ if (this.form.id != null) {
|
|
|
+ updatePerson(this.form).then(response => {
|
|
|
+ this.$modal.msgSuccess("修改成功");
|
|
|
+ this.open = false;
|
|
|
+ this.getList();
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ addPerson(this.form).then(response => {
|
|
|
+ this.$modal.msgSuccess("新增成功");
|
|
|
+ this.open = false;
|
|
|
+ this.getList();
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
- };
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /** 删除按钮操作 */
|
|
|
+ handleDelete(row) {
|
|
|
+ const ids = row.id || this.ids;
|
|
|
+ this.$modal.confirm('是否确认删除选中的数据项?').then(function () {
|
|
|
+ return delPerson(ids);
|
|
|
+ }).then(() => {
|
|
|
+ this.getList();
|
|
|
+ this.$modal.msgSuccess("删除成功");
|
|
|
+ }).catch(() => {
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /** 导出按钮操作 */
|
|
|
+ handleExport() {
|
|
|
+ this.download('/center-data/environmentPerson/export', {
|
|
|
+ ...this.queryParams
|
|
|
+ }, `环保人员_${new Date().getTime()}.xlsx`)
|
|
|
+ }
|
|
|
+ }
|
|
|
+};
|
|
|
</script>
|