| | |
| | | <template> |
| | | <el-row> |
| | | <el-col :span="24"> |
| | | <basic-container> |
| | | <avue-crud :option="option" :search.sync="search" :table-loading="loading" :data="data" ref="crud" v-model="form" |
| | | :permission="permissionList" @row-del="rowDel" @row-update="rowUpdate" @row-save="rowSave" |
| | | :before-open="beforeOpen" :page.sync="page" @search-change="searchChange" @search-reset="searchReset" |
| | | @selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange" |
| | | @refresh-change="refreshChange"> |
| | | <template slot="menuLeft"> |
| | | <el-button type="danger" size="small" plain icon="el-icon-delete" v-if="permission.household_delete" |
| | | @click="handleDelete">删 除 |
| | | </el-button> |
| | | </template> |
| | | <template slot-scope="{row}" slot="tenantName"> |
| | | <el-tag>{{ row.tenantName }}</el-tag> |
| | | </template> |
| | | <template slot-scope="{row}" slot="roleName"> |
| | | <el-tag>{{ row.roleName }}</el-tag> |
| | | </template> |
| | | <template slot-scope="{row}" slot="deptName"> |
| | | <el-tag>{{ row.deptName }}</el-tag> |
| | | </template> |
| | | <template slot-scope="{row}" slot="userTypeName"> |
| | | <el-tag>{{ row.userTypeName }}</el-tag> |
| | | </template> |
| | | </avue-crud> |
| | | </basic-container> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="24"> |
| | | <basic-container> |
| | | <avue-crud :option="option" :search.sync="search" :table-loading="loading" :data="data" ref="crud" |
| | | v-model="form" :permission="permissionList" @row-del="rowDel" @row-update="rowUpdate" |
| | | @row-save="rowSave" :before-open="beforeOpen" :page.sync="page" @search-change="searchChange" |
| | | @search-reset="searchReset" @selection-change="selectionChange" @current-change="currentChange" |
| | | @size-change="sizeChange" @refresh-change="refreshChange"> |
| | | <template slot="menuLeft"> |
| | | <el-button type="danger" size="small" plain icon="el-icon-delete" v-if="permission.household_delete" |
| | | @click="handleDelete">删 除 |
| | | </el-button> |
| | | </template> |
| | | <template slot-scope="{row}" slot="tenantName"> |
| | | <el-tag>{{ row.tenantName }}</el-tag> |
| | | </template> |
| | | <template slot-scope="{row}" slot="roleName"> |
| | | <el-tag>{{ row.roleName }}</el-tag> |
| | | </template> |
| | | <template slot-scope="{row}" slot="deptName"> |
| | | <el-tag>{{ row.deptName }}</el-tag> |
| | | </template> |
| | | <template slot-scope="{row}" slot="userTypeName"> |
| | | <el-tag>{{ row.userTypeName }}</el-tag> |
| | | </template> |
| | | </avue-crud> |
| | | </basic-container> |
| | | </el-col> |
| | | </el-row> |
| | | </template> |
| | | |
| | | <script> |
| | | import { |
| | | getList, |
| | | remove, |
| | | add, |
| | | update, |
| | | getDetatil |
| | | } from "@/api/userHouse/list/houseHold.js"; |
| | | getList, |
| | | remove, |
| | | add, |
| | | update, |
| | | getDetatil |
| | | } from "@/api/userHouse/list/houseHold.js" |
| | | import { |
| | | exportBlob |
| | | } from "@/api/common"; |
| | | exportBlob |
| | | } from "@/api/common" |
| | | import { |
| | | mapGetters |
| | | } from "vuex"; |
| | | mapGetters |
| | | } from "vuex" |
| | | import { |
| | | getToken |
| | | } from '@/util/auth'; |
| | | getToken |
| | | } from '@/util/auth' |
| | | import { |
| | | downloadXls |
| | | } from "@/util/util"; |
| | | downloadXls |
| | | } from "@/util/util" |
| | | import { |
| | | dateNow |
| | | } from "@/util/date"; |
| | | import NProgress from 'nprogress'; |
| | | import 'nprogress/nprogress.css'; |
| | | import Qs from "qs"; |
| | | dateNow |
| | | } from "@/util/date" |
| | | import NProgress from 'nprogress' |
| | | import 'nprogress/nprogress.css' |
| | | import Qs from "qs" |
| | | |
| | | export default { |
| | | data() { |
| | | return { |
| | | form: {}, |
| | | search: {}, |
| | | excelBox: false, |
| | | selectionList: [], |
| | | query: {}, |
| | | loading: true, |
| | | page: { |
| | | pageSize: 10, |
| | | currentPage: 1, |
| | | total: 0 |
| | | }, |
| | | option: { |
| | | height: 420, |
| | | calcHeight: 80, |
| | | tip: false, |
| | | searchShow: true, |
| | | searchMenuSpan: 6, |
| | | border: true, |
| | | index: true, |
| | | selection: true, |
| | | viewBtn: true, |
| | | addBtn: true, |
| | | dialogType: 'dialog', |
| | | dialogClickModal: false, |
| | | column: [{ |
| | | label: "姓名", |
| | | prop: "name", |
| | | search: true, |
| | | searchSpan: 4, |
| | | labelWidth:120, |
| | | }, |
| | | { |
| | | label: "电话", |
| | | prop: "phoneNumber", |
| | | labelWidth:120, |
| | | search: true, |
| | | searchSpan: 4, |
| | | }, |
| | | { |
| | | label: "身份证号", |
| | | labelWidth:120, |
| | | prop: "idCard", |
| | | }, |
| | | { |
| | | label: "性别", |
| | | prop: "gender", |
| | | type: "select", |
| | | labelWidth:120, |
| | | dicData: [ |
| | | { |
| | | label: "男", |
| | | value: 1 |
| | | data () { |
| | | return { |
| | | form: {}, |
| | | search: {}, |
| | | excelBox: false, |
| | | selectionList: [], |
| | | query: {}, |
| | | loading: true, |
| | | page: { |
| | | pageSize: 10, |
| | | currentPage: 1, |
| | | total: 0 |
| | | }, |
| | | { |
| | | label: "女", |
| | | value: 0 |
| | | option: { |
| | | labelWidth: 144, |
| | | height: 420, |
| | | calcHeight: 80, |
| | | tip: false, |
| | | searchShow: true, |
| | | searchMenuSpan: 6, |
| | | border: true, |
| | | index: true, |
| | | selection: true, |
| | | viewBtn: true, |
| | | addBtn: true, |
| | | dialogType: 'dialog', |
| | | dialogClickModal: false, |
| | | column: [{ |
| | | label: "姓名", |
| | | prop: "name", |
| | | search: true, |
| | | searchSpan: 4, |
| | | }, |
| | | { |
| | | label: "电话", |
| | | prop: "phoneNumber", |
| | | search: true, |
| | | searchSpan: 4, |
| | | }, |
| | | { |
| | | label: "身份证号", |
| | | prop: "idCard", |
| | | }, |
| | | { |
| | | label: "证件类型", |
| | | prop: "cardType", |
| | | type: "select", |
| | | dicUrl: "/api/blade-system/dict-biz/dictionary?code=cardType", |
| | | dataType: "number", |
| | | props: { |
| | | label: "dictValue", |
| | | value: "dictKey", |
| | | }, |
| | | }, |
| | | { |
| | | width: 160, |
| | | label: "证件号码", |
| | | prop: "cardNo", |
| | | }, |
| | | { |
| | | label: "性别", |
| | | prop: "gender", |
| | | type: "select", |
| | | dicData: [ |
| | | { |
| | | label: "男", |
| | | value: 1 |
| | | }, |
| | | { |
| | | label: "女", |
| | | value: 0 |
| | | }, |
| | | { |
| | | label: "未知", |
| | | value: 1 |
| | | } |
| | | ], |
| | | }, |
| | | { |
| | | label: "关系", |
| | | prop: "roleType", |
| | | type: "select", |
| | | dicUrl: "/api/blade-system/dict-biz/dictionary?code=roleType", |
| | | dataType: "number", |
| | | props: { |
| | | label: "dictValue", |
| | | value: "dictKey", |
| | | }, |
| | | }, |
| | | { |
| | | label: "与角色关系", |
| | | prop: "relationship", |
| | | type: "select", |
| | | dicUrl: "/api/blade-system/dict-biz/dictionary?code=roleRelation", |
| | | dataType: "number", |
| | | hide: true, |
| | | props: { |
| | | label: "dictValue", |
| | | value: "dictKey", |
| | | }, |
| | | }, |
| | | { |
| | | label: "小区", |
| | | prop: "aoiName", |
| | | display: false |
| | | }, |
| | | { |
| | | label: "地址", |
| | | prop: "address", |
| | | display: false |
| | | }, |
| | | { |
| | | label: "主要联系人", |
| | | prop: "isPrimaryContact", |
| | | type: "select", |
| | | dicUrl: "/api/blade-system/dict-biz/dictionary?code=primaryContactType", |
| | | dataType: "number", |
| | | hide: true, |
| | | props: { |
| | | label: "dictValue", |
| | | value: "dictKey", |
| | | }, |
| | | }, |
| | | { |
| | | label: "居住情况", |
| | | prop: "residentialStatus", |
| | | type: "select", |
| | | hide: true, |
| | | dicUrl: "/api/blade-system/dict-biz/dictionary?code=residentialStatusType", |
| | | dataType: "number", |
| | | props: { |
| | | label: "dictValue", |
| | | value: "dictKey", |
| | | }, |
| | | }, |
| | | { |
| | | label: "身份证号", |
| | | prop: "idCard", |
| | | hide: true, |
| | | }, |
| | | { |
| | | label: "生日", |
| | | prop: "birthday", |
| | | type: "date", |
| | | format: "yyyy-MM-dd", |
| | | valueFormat: "yyyy-MM-dd", |
| | | hide: true, |
| | | }, |
| | | { |
| | | label: "港澳台通行证", |
| | | prop: "hkmtPass", |
| | | hide: true, |
| | | }, |
| | | { |
| | | label: "护照", |
| | | prop: "passport", |
| | | hide: true, |
| | | }, |
| | | { |
| | | label: "民族", |
| | | prop: "ethnicity", |
| | | type: "select", |
| | | hide: true, |
| | | dicUrl: "/api/blade-system/dict-biz/dictionary?code=nationType", |
| | | dataType: "number", |
| | | props: { |
| | | label: "dictValue", |
| | | value: "dictKey", |
| | | }, |
| | | }, |
| | | { |
| | | label: "学历", |
| | | prop: "education", |
| | | type: "select", |
| | | hide: true, |
| | | dicUrl: "/api/blade-system/dict-biz/dictionary?code=educationType", |
| | | dataType: "number", |
| | | props: { |
| | | label: "dictValue", |
| | | value: "dictKey", |
| | | }, |
| | | }, |
| | | { |
| | | label: "户籍登记地", |
| | | prop: "hukouRegistration", |
| | | hide: true, |
| | | }, |
| | | { |
| | | label: "工作状态", |
| | | prop: "workStatus", |
| | | type: "select", |
| | | hide: true, |
| | | dicUrl: "/api/blade-system/dict-biz/dictionary?code=workStatusType", |
| | | dataType: "number", |
| | | props: { |
| | | label: "dictValue", |
| | | value: "dictKey", |
| | | }, |
| | | }, |
| | | { |
| | | label: "工作单位", |
| | | prop: "employer", |
| | | hide: true, |
| | | }, |
| | | { |
| | | label: "婚姻状态", |
| | | prop: "maritalStatus", |
| | | type: "select", |
| | | hide: true, |
| | | dicUrl: "/api/blade-system/dict-biz/dictionary?code=marriageStatusType", |
| | | dataType: "number", |
| | | props: { |
| | | label: "dictValue", |
| | | value: "dictKey", |
| | | }, |
| | | }, |
| | | { |
| | | label: "车牌号", |
| | | prop: "cardNumber", |
| | | hide: true, |
| | | }, |
| | | { |
| | | label: "其他联系方式", |
| | | prop: "otherContact", |
| | | hide: true, |
| | | }, |
| | | { |
| | | label: "现居住地址", |
| | | prop: "currentAddress", |
| | | hide: true, |
| | | }, |
| | | { |
| | | label: "残疾证", |
| | | prop: "disabilityCert", |
| | | hide: true, |
| | | }, |
| | | { |
| | | width: 160, |
| | | label: "宗教信仰", |
| | | prop: "religiousBelief", |
| | | }, |
| | | { |
| | | label: "健康状况", |
| | | prop: "healthStatus", |
| | | type: "select", |
| | | dicUrl: "/api/blade-system/dict-biz/dictionary?code=healthStatus", |
| | | dataType: "number", |
| | | props: { |
| | | label: "dictValue", |
| | | value: "dictKey", |
| | | }, |
| | | }, |
| | | { |
| | | width: 160, |
| | | label: "疾病名称", |
| | | prop: "diseaseName" |
| | | }, |
| | | { |
| | | label: "户籍类型", |
| | | prop: "residentType", |
| | | type: "select", |
| | | dicUrl: "/api/blade-system/dict-biz/dictionary?code=residentType", |
| | | dataType: "number", |
| | | props: { |
| | | label: "dictValue", |
| | | value: "dictKey", |
| | | }, |
| | | }, |
| | | { |
| | | width: 160, |
| | | label: "户籍地行政区划", |
| | | prop: "residentAdcode" |
| | | }, |
| | | { |
| | | width: 160, |
| | | label: "籍贯地行政区划", |
| | | prop: "nativePlaceAdcode" |
| | | }, |
| | | { |
| | | width: 160, |
| | | label: "外出详址", |
| | | prop: "goOutAddr" |
| | | }, |
| | | { |
| | | width: 160, |
| | | label: "外出去向", |
| | | prop: "goOutWhere" |
| | | }, |
| | | { |
| | | width: 160, |
| | | label: "外出时间", |
| | | prop: "goOutTime" |
| | | }, |
| | | { |
| | | width: 160, |
| | | label: "外出原因", |
| | | prop: "goOutReason" |
| | | }, |
| | | { |
| | | width: 160, |
| | | label: "职业类别", |
| | | prop: "occupation" |
| | | }, |
| | | { |
| | | width: 160, |
| | | label: "就职单位地址", |
| | | prop: "cmpyRegAddr" |
| | | }, |
| | | ] |
| | | }, |
| | | { |
| | | label: "未知", |
| | | value: 1 |
| | | houseCode: "", |
| | | data: [], |
| | | excelForm: {}, |
| | | excelOption: { |
| | | submitBtn: false, |
| | | emptyBtn: false, |
| | | column: [{ |
| | | label: '模板上传', |
| | | prop: 'excelFile', |
| | | type: 'upload', |
| | | drag: true, |
| | | loadText: '模板上传中,请稍等', |
| | | span: 24, |
| | | propsHttp: { |
| | | res: 'data' |
| | | }, |
| | | tip: '请上传 .xls,.xlsx 标准格式文件', |
| | | action: "/api/blade-system/user/import-user" |
| | | }, |
| | | { |
| | | label: "数据覆盖", |
| | | prop: "isCovered", |
| | | type: "switch", |
| | | align: "center", |
| | | width: 80, |
| | | dicData: [{ |
| | | label: "否", |
| | | value: 0 |
| | | }, |
| | | { |
| | | label: "是", |
| | | value: 1 |
| | | } |
| | | ], |
| | | value: 0, |
| | | slot: true, |
| | | rules: [{ |
| | | required: true, |
| | | message: "请选择是否覆盖", |
| | | trigger: "blur" |
| | | }] |
| | | }, |
| | | { |
| | | label: '模板下载', |
| | | prop: 'excelTemplate', |
| | | formslot: true, |
| | | span: 24, |
| | | } |
| | | ] |
| | | } |
| | | ], |
| | | }, |
| | | { |
| | | label: "关系", |
| | | prop: "roleType", |
| | | type: "select", |
| | | dicUrl: "/api/blade-system/dict-biz/dictionary?code=roleType", |
| | | labelWidth:120, |
| | | dataType: "number", |
| | | props: { |
| | | label: "dictValue", |
| | | value: "dictKey", |
| | | }, |
| | | }, |
| | | { |
| | | label: "与角色关系", |
| | | prop: "relationship", |
| | | type: "select", |
| | | dicUrl: "/api/blade-system/dict-biz/dictionary?code=roleRelation", |
| | | dataType: "number", |
| | | labelWidth:120, |
| | | hide: true, |
| | | props: { |
| | | label: "dictValue", |
| | | value: "dictKey", |
| | | }, |
| | | }, |
| | | { |
| | | label: "小区", |
| | | prop: "aoiName", |
| | | display: false |
| | | }, |
| | | { |
| | | label: "地址", |
| | | prop: "address", |
| | | display: false |
| | | }, |
| | | { |
| | | label: "主要联系人", |
| | | prop: "isPrimaryContact", |
| | | type: "select", |
| | | dicUrl: "/api/blade-system/dict-biz/dictionary?code=primaryContactType", |
| | | dataType: "number", |
| | | hide: true, |
| | | labelWidth:120, |
| | | props: { |
| | | label: "dictValue", |
| | | value: "dictKey", |
| | | }, |
| | | }, |
| | | { |
| | | label: "居住情况", |
| | | prop: "residentialStatus", |
| | | type: "select", |
| | | hide: true, |
| | | labelWidth:120, |
| | | dicUrl: "/api/blade-system/dict-biz/dictionary?code=residentialStatusType", |
| | | dataType: "number", |
| | | props: { |
| | | label: "dictValue", |
| | | value: "dictKey", |
| | | }, |
| | | }, |
| | | { |
| | | label: "身份证号", |
| | | prop: "idCard", |
| | | labelWidth:120, |
| | | hide: true, |
| | | }, |
| | | { |
| | | label: "生日", |
| | | prop: "birthday", |
| | | type: "date", |
| | | labelWidth:120, |
| | | format: "yyyy-MM-dd", |
| | | valueFormat: "yyyy-MM-dd", |
| | | hide: true, |
| | | }, |
| | | { |
| | | label: "港澳台通行证", |
| | | prop: "hkmtPass", |
| | | labelWidth:120, |
| | | hide: true, |
| | | }, |
| | | { |
| | | label: "护照", |
| | | prop: "passport", |
| | | labelWidth:120, |
| | | hide: true, |
| | | }, |
| | | { |
| | | label: "民族", |
| | | prop: "ethnicity", |
| | | type: "select", |
| | | hide: true, |
| | | labelWidth:120, |
| | | dicUrl: "/api/blade-system/dict-biz/dictionary?code=nationType", |
| | | dataType: "number", |
| | | props: { |
| | | label: "dictValue", |
| | | value: "dictKey", |
| | | }, |
| | | }, |
| | | { |
| | | label: "学历", |
| | | prop: "education", |
| | | type: "select", |
| | | hide: true, |
| | | labelWidth:120, |
| | | dicUrl: "/api/blade-system/dict-biz/dictionary?code=educationType", |
| | | dataType: "number", |
| | | props: { |
| | | label: "dictValue", |
| | | value: "dictKey", |
| | | }, |
| | | }, |
| | | { |
| | | label: "户籍登记地", |
| | | prop: "hukouRegistration", |
| | | labelWidth:120, |
| | | hide: true, |
| | | }, |
| | | { |
| | | label: "工作状态", |
| | | prop: "workStatus", |
| | | type: "select", |
| | | labelWidth:120, |
| | | hide: true, |
| | | dicUrl: "/api/blade-system/dict-biz/dictionary?code=workStatusType", |
| | | dataType: "number", |
| | | props: { |
| | | label: "dictValue", |
| | | value: "dictKey", |
| | | }, |
| | | }, |
| | | { |
| | | label: "工作单位", |
| | | prop: "employer", |
| | | labelWidth:120, |
| | | hide: true, |
| | | }, |
| | | { |
| | | label: "婚姻状态", |
| | | prop: "maritalStatus", |
| | | type: "select", |
| | | labelWidth:120, |
| | | hide: true, |
| | | dicUrl: "/api/blade-system/dict-biz/dictionary?code=marriageStatusType", |
| | | dataType: "number", |
| | | props: { |
| | | label: "dictValue", |
| | | value: "dictKey", |
| | | }, |
| | | }, |
| | | { |
| | | label: "车牌号", |
| | | prop: "cardNumber", |
| | | labelWidth:120, |
| | | hide: true, |
| | | }, |
| | | { |
| | | label: "其他联系方式", |
| | | prop: "otherContact", |
| | | labelWidth:120, |
| | | hide: true, |
| | | }, |
| | | { |
| | | label: "现居住地址", |
| | | prop: "currentAddress", |
| | | labelWidth:120, |
| | | hide: true, |
| | | }, |
| | | { |
| | | label: "残疾证", |
| | | prop: "disabilityCert", |
| | | labelWidth:120, |
| | | hide: true, |
| | | }, |
| | | ] |
| | | }, |
| | | houseCode: "", |
| | | data: [], |
| | | excelForm: {}, |
| | | excelOption: { |
| | | submitBtn: false, |
| | | emptyBtn: false, |
| | | column: [{ |
| | | label: '模板上传', |
| | | prop: 'excelFile', |
| | | type: 'upload', |
| | | drag: true, |
| | | loadText: '模板上传中,请稍等', |
| | | span: 24, |
| | | propsHttp: { |
| | | res: 'data' |
| | | }, |
| | | tip: '请上传 .xls,.xlsx 标准格式文件', |
| | | action: "/api/blade-system/user/import-user" |
| | | }, |
| | | { |
| | | label: "数据覆盖", |
| | | prop: "isCovered", |
| | | type: "switch", |
| | | align: "center", |
| | | width: 80, |
| | | dicData: [{ |
| | | label: "否", |
| | | value: 0 |
| | | }, |
| | | { |
| | | label: "是", |
| | | value: 1 |
| | | } |
| | | ], |
| | | value: 0, |
| | | slot: true, |
| | | rules: [{ |
| | | required: true, |
| | | message: "请选择是否覆盖", |
| | | trigger: "blur" |
| | | }] |
| | | }, |
| | | { |
| | | label: '模板下载', |
| | | prop: 'excelTemplate', |
| | | formslot: true, |
| | | span: 24, |
| | | } |
| | | ] |
| | | } |
| | | }; |
| | | }, |
| | | watch: { |
| | | }, |
| | | computed: { |
| | | ...mapGetters(["userInfo", "permission"]), |
| | | permissionList() { |
| | | return { |
| | | addBtn: this.vaildData(this.permission.household_add, true), |
| | | viewBtn: this.vaildData(this.permission.household_view, true), |
| | | delBtn: this.vaildData(this.permission.household_delete, true), |
| | | editBtn: this.vaildData(this.permission.household_edit, true) |
| | | }; |
| | | } |
| | | }, |
| | | mounted() { |
| | | }, |
| | | methods: { |
| | | init(data) { |
| | | this.houseCode = data.houseCode |
| | | this.onLoad(this.page) |
| | | }, |
| | | rowSave(row, done, loading) { |
| | | row['houseCode'] = this.houseCode |
| | | add(row).then(() => { |
| | | this.initFlag = false; |
| | | this.onLoad(this.page); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!" |
| | | }); |
| | | done(); |
| | | }, error => { |
| | | window.console.log(error); |
| | | loading(); |
| | | }); |
| | | watch: { |
| | | }, |
| | | rowUpdate(row, index, done, loading) { |
| | | update(row).then(() => { |
| | | this.initFlag = false; |
| | | this.onLoad(this.page); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!" |
| | | }); |
| | | done(); |
| | | }, error => { |
| | | window.console.log(error); |
| | | loading(); |
| | | }); |
| | | }, |
| | | rowDel(row) { |
| | | this.$confirm("确定将选择数据删除?", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning" |
| | | }) |
| | | .then(() => { |
| | | return remove(row.id); |
| | | }) |
| | | .then(() => { |
| | | this.onLoad(this.page); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!" |
| | | }); |
| | | }); |
| | | }, |
| | | searchReset() { |
| | | this.query = {}; |
| | | this.treeDeptId = ''; |
| | | this.onLoad(this.page); |
| | | }, |
| | | searchChange(params, done) { |
| | | this.query = params; |
| | | this.page.currentPage = 1; |
| | | this.onLoad(this.page, params); |
| | | done(); |
| | | }, |
| | | selectionChange(list) { |
| | | this.selectionList = list; |
| | | }, |
| | | selectionClear() { |
| | | this.selectionList = []; |
| | | // this.$refs.crud.toggleSelection(); |
| | | }, |
| | | handleDelete() { |
| | | if (this.selectionList.length === 0) { |
| | | this.$message.warning("请选择至少一条数据"); |
| | | return; |
| | | } |
| | | this.$confirm("确定将选择数据删除?", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning" |
| | | }) |
| | | .then(() => { |
| | | return remove(this.ids); |
| | | }) |
| | | .then(() => { |
| | | this.onLoad(this.page); |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!" |
| | | }); |
| | | this.$refs.crud.toggleSelection(); |
| | | }); |
| | | }, |
| | | handleImport() { |
| | | this.excelBox = true; |
| | | }, |
| | | uploadAfter(res, done, loading, column) { |
| | | window.console.log(column); |
| | | this.excelBox = false; |
| | | this.refreshChange(); |
| | | done(); |
| | | }, |
| | | handleExport() { |
| | | this.$confirm("是否导出住户数据?", "提示", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning" |
| | | }).then(() => { |
| | | NProgress.start(); |
| | | var data = { |
| | | ...this.query |
| | | computed: { |
| | | ...mapGetters(["userInfo", "permission"]), |
| | | permissionList () { |
| | | return { |
| | | addBtn: this.vaildData(this.permission.household_add, true), |
| | | viewBtn: this.vaildData(this.permission.household_view, true), |
| | | delBtn: this.vaildData(this.permission.household_delete, true), |
| | | editBtn: this.vaildData(this.permission.household_edit, true) |
| | | } |
| | | } |
| | | data = Qs.stringify(data); |
| | | exportBlob( |
| | | `/api/blade-household/household/export-household?${this.website.tokenHeader}=${getToken()}&` + data |
| | | ).then(res => { |
| | | downloadXls(res.data, `住户数据表${dateNow()}.xlsx`); |
| | | NProgress.done(); |
| | | }) |
| | | }); |
| | | }, |
| | | handleTemplate() { |
| | | exportBlob(`/api/blade-system/user/export-template?${this.website.tokenHeader}=${getToken()}`).then(res => { |
| | | downloadXls(res.data, "住户数据模板.xlsx"); |
| | | }) |
| | | mounted () { |
| | | }, |
| | | beforeOpen(done, type) { |
| | | if (["edit", "view"].includes(type)) { |
| | | getDetatil(this.form.id).then(res => { |
| | | this.form = res.data.data; |
| | | }); |
| | | } |
| | | this.initFlag = true; |
| | | done(); |
| | | }, |
| | | currentChange(currentPage) { |
| | | this.page.currentPage = currentPage; |
| | | }, |
| | | sizeChange(pageSize) { |
| | | this.page.pageSize = pageSize; |
| | | }, |
| | | refreshChange() { |
| | | this.onLoad(this.page, this.query); |
| | | }, |
| | | onLoad(page, params = {}) { |
| | | params['houseCode'] = this.houseCode |
| | | this.loading = true; |
| | | getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => { |
| | | const data = res.data.data; |
| | | this.page.total = data.total; |
| | | this.data = data.records; |
| | | this.loading = false; |
| | | this.selectionClear(); |
| | | }); |
| | | methods: { |
| | | init (data) { |
| | | this.houseCode = data.houseCode |
| | | this.onLoad(this.page) |
| | | }, |
| | | rowSave (row, done, loading) { |
| | | row['houseCode'] = this.houseCode |
| | | add(row).then(() => { |
| | | this.initFlag = false |
| | | this.onLoad(this.page) |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!" |
| | | }) |
| | | done() |
| | | }, error => { |
| | | window.console.log(error) |
| | | loading() |
| | | }) |
| | | }, |
| | | rowUpdate (row, index, done, loading) { |
| | | update(row).then(() => { |
| | | this.initFlag = false |
| | | this.onLoad(this.page) |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!" |
| | | }) |
| | | done() |
| | | }, error => { |
| | | window.console.log(error) |
| | | loading() |
| | | }) |
| | | }, |
| | | rowDel (row) { |
| | | this.$confirm("确定将选择数据删除?", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning" |
| | | }) |
| | | .then(() => { |
| | | return remove(row.id) |
| | | }) |
| | | .then(() => { |
| | | this.onLoad(this.page) |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!" |
| | | }) |
| | | }) |
| | | }, |
| | | searchReset () { |
| | | this.query = {} |
| | | this.treeDeptId = '' |
| | | this.onLoad(this.page) |
| | | }, |
| | | searchChange (params, done) { |
| | | this.query = params |
| | | this.page.currentPage = 1 |
| | | this.onLoad(this.page, params) |
| | | done() |
| | | }, |
| | | selectionChange (list) { |
| | | this.selectionList = list |
| | | }, |
| | | selectionClear () { |
| | | this.selectionList = [] |
| | | // this.$refs.crud.toggleSelection(); |
| | | }, |
| | | handleDelete () { |
| | | if (this.selectionList.length === 0) { |
| | | this.$message.warning("请选择至少一条数据") |
| | | return |
| | | } |
| | | this.$confirm("确定将选择数据删除?", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning" |
| | | }) |
| | | .then(() => { |
| | | return remove(this.ids) |
| | | }) |
| | | .then(() => { |
| | | this.onLoad(this.page) |
| | | this.$message({ |
| | | type: "success", |
| | | message: "操作成功!" |
| | | }) |
| | | this.$refs.crud.toggleSelection() |
| | | }) |
| | | }, |
| | | handleImport () { |
| | | this.excelBox = true |
| | | }, |
| | | uploadAfter (res, done, loading, column) { |
| | | window.console.log(column) |
| | | this.excelBox = false |
| | | this.refreshChange() |
| | | done() |
| | | }, |
| | | handleExport () { |
| | | this.$confirm("是否导出住户数据?", "提示", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning" |
| | | }).then(() => { |
| | | NProgress.start() |
| | | var data = { |
| | | ...this.query |
| | | } |
| | | data = Qs.stringify(data) |
| | | exportBlob( |
| | | `/api/blade-household/household/export-household?${this.website.tokenHeader}=${getToken()}&` + data |
| | | ).then(res => { |
| | | downloadXls(res.data, `住户数据表${dateNow()}.xlsx`) |
| | | NProgress.done() |
| | | }) |
| | | }) |
| | | }, |
| | | handleTemplate () { |
| | | exportBlob(`/api/blade-system/user/export-template?${this.website.tokenHeader}=${getToken()}`).then(res => { |
| | | downloadXls(res.data, "住户数据模板.xlsx") |
| | | }) |
| | | }, |
| | | beforeOpen (done, type) { |
| | | if (["edit", "view"].includes(type)) { |
| | | getDetatil(this.form.id).then(res => { |
| | | this.form = res.data.data |
| | | }) |
| | | } |
| | | this.initFlag = true |
| | | done() |
| | | }, |
| | | currentChange (currentPage) { |
| | | this.page.currentPage = currentPage |
| | | }, |
| | | sizeChange (pageSize) { |
| | | this.page.pageSize = pageSize |
| | | }, |
| | | refreshChange () { |
| | | this.onLoad(this.page, this.query) |
| | | }, |
| | | onLoad (page, params = {}) { |
| | | params['houseCode'] = this.houseCode |
| | | this.loading = true |
| | | getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => { |
| | | const data = res.data.data |
| | | this.page.total = data.total |
| | | this.data = data.records |
| | | this.loading = false |
| | | this.selectionClear() |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | }; |
| | | } |
| | | </script> |
| | | |
| | | <style> |
| | | .box { |
| | | height: 800px; |
| | | height: 800px; |
| | | } |
| | | |
| | | .el-scrollbar { |
| | | height: 100%; |
| | | height: 100%; |
| | | } |
| | | |
| | | .box .el-scrollbar__wrap { |
| | | overflow: scroll; |
| | | overflow: scroll; |
| | | } |
| | | </style> |