webpackJsonp([10],{ /***/ "4MyM": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); // EXTERNAL MODULE: ./src/components/Title.vue + 2 modules var Title = __webpack_require__("/+Ed"); // EXTERNAL MODULE: ./src/components/Pagination.vue + 2 modules var Pagination = __webpack_require__("cMGX"); // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./src/pages/user/AddUser.vue // // // // // // // // // // // // // // // // // // // // // // // // // /* harmony default export */ var AddUser = ({ name: 'AddUser', props: ['available', 'areaList', 'URL', 'contextPath'], data: function data() { var that = this; var validateUsername = function validateUsername(rule, value, callback) { var cellphone = /^1\d{10}$/; if (value) { if (!cellphone.test(value)) { callback(new Error('格式不正确')); } else { callback(); } } else { callback(); } }; var validateUsernameBack = function validateUsernameBack(rule, value, callback) { if (that.returnCode == 4013) { callback(new Error('用户名已存在')); } else { callback(); } }; return { form: { username: '', areaInfo: '' }, returnCode: '0', rules: { username: [{ required: true, message: '用户名不能为空', trigger: ['blur', 'change'] }, { validator: validateUsername, trigger: ['blur', 'change'] }, { validator: validateUsernameBack, trigger: ['blur', 'change'] }], areaInfo: [{ required: true, message: '请选择区域', trigger: ['blur', 'change'] }] } }; }, computed: { areaCode: function areaCode() { var that = this; if (that.form.areaInfo) { return that.form.areaInfo[that.form.areaInfo.length - 1]; } else { return ''; } } }, mounted: function mounted() {}, methods: { submitForm: function submitForm(formName) { var that = this; that.$refs[formName].validate(function (valid) { if (valid) { var formData = that.$qs.stringify({ phone: that.form.username, areaCode: that.areaCode }); that.$axios({ method: 'post', url: that.contextPath + that.URL.addUser, data: formData, loader: true }).then(function (res) { var returnCode = Number(res.data.resultCode); if (returnCode === 0) { //添加成功 that.closeDialog(); that.$parent.getUserList(); } else if (returnCode === 4013) { //手机号码已存在 that.returnCode = returnCode; that.$refs.addUserForm && that.$refs.addUserForm.validateField('username'); } else { that.$alert(res.data.message, '提示', { customClass: 'wafConfirm', confirmButtonText: '我知道了', type: 'warning' }); } }).catch(function (e) { e && that.$message.error(e.message); }); } else { console.log('error submit!!'); return false; } }); }, closeDialog: function closeDialog() { var that = this; that.$emit('update:available', false); } } }); // CONCATENATED MODULE: ./node_modules/vue-loader/lib/template-compiler?{"id":"data-v-31ad24ac","hasScoped":false,"transformToRequire":{"video":["src","poster"],"source":"src","img":"src","image":"xlink:href"},"buble":{"transforms":{}}}!./node_modules/vue-loader/lib/selector.js?type=template&index=0!./src/pages/user/AddUser.vue var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('el-dialog',{attrs:{"title":"添加管理员","visible":_vm.available,"close-on-click-modal":false,"close-on-press-escape":false,"custom-class":'operaUserDialog',"center":""},on:{"close":_vm.closeDialog}},[_c('div',{staticClass:"addUserFormArea"},[_c('el-form',{ref:"addUserForm",attrs:{"rules":_vm.rules,"model":_vm.form,"label-width":"90px","size":"small"}},[_c('el-form-item',{attrs:{"label":"用户名","prop":"username"}},[_c('el-input',{attrs:{"placeholder":"请输入"},model:{value:(_vm.form.username),callback:function ($$v) {_vm.$set(_vm.form, "username", $$v)},expression:"form.username"}})],1),_vm._v(" "),_c('el-form-item',{attrs:{"label":"区域","prop":"areaInfo"}},[_c('el-cascader',{attrs:{"expand-trigger":"hover","options":_vm.areaList},model:{value:(_vm.form.areaInfo),callback:function ($$v) {_vm.$set(_vm.form, "areaInfo", $$v)},expression:"form.areaInfo"}})],1)],1)],1),_vm._v(" "),_c('template',{slot:"footer"},[_c('el-button',{on:{"click":_vm.closeDialog}},[_vm._v("取消")]),_vm._v(" "),_c('el-button',{attrs:{"type":"primary"},on:{"click":function($event){return _vm.submitForm('addUserForm')}}},[_vm._v("确定")])],1)],2)} var staticRenderFns = [] var esExports = { render: render, staticRenderFns: staticRenderFns } /* harmony default export */ var user_AddUser = (esExports); // CONCATENATED MODULE: ./src/pages/user/AddUser.vue function injectStyle (ssrContext) { __webpack_require__("oRY/") } var normalizeComponent = __webpack_require__("VU/8") /* script */ /* template */ /* template functional */ var __vue_template_functional__ = false /* styles */ var __vue_styles__ = injectStyle /* scopeId */ var __vue_scopeId__ = null /* moduleIdentifier (server only) */ var __vue_module_identifier__ = null var Component = normalizeComponent( AddUser, user_AddUser, __vue_template_functional__, __vue_styles__, __vue_scopeId__, __vue_module_identifier__ ) /* harmony default export */ var pages_user_AddUser = (Component.exports); // EXTERNAL MODULE: ./node_modules/vuex/dist/vuex.esm.js var vuex_esm = __webpack_require__("NYxO"); // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./src/pages/user/User.vue // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // /* harmony default export */ var User = ({ name: 'User', props: { type: { type: String, required: true, validator: function validator(value) { return ['admin', 'common'].indexOf(value) !== -1; } } }, components: { Title: Title["a" /* default */], Pagination: Pagination["a" /* default */], AddUser: pages_user_AddUser }, data: function data() { return { moduleTitle: '用户管理', total: 0, currentPage: 1, pageSize: 10, tableData: [], areaList: [], searchParams: { username: '' }, URL: { getAreaList: '/rest/allArea', getUserList: '/admin/userlist', addUser: '/admin/addUser', deleteUser: '/admin/delete' }, availableAddUser: false // showList: false, // listTypes: ['admin','common'] }; }, computed: { adminList: function adminList() { var that = this; return that.type === 'admin'; }, contextPath: function contextPath() { return this.$store.state.urlHost; }, adminTHeight: function adminTHeight() { var that = this; return that.adminList ? this.$store.state.adminTHeight : this.$store.state.adminTHeight + 44; }, pageTitle: function pageTitle() { var that = this; return that.adminList ? '管理员列表' : '用户列表'; }, tableKey: function tableKey() { return this.type; } }, watch: { type: function type(val) { //用户列表类型改变时重置组件数据 var that = this; that.resetData(); that.getUserList(); } }, beforeMount: function beforeMount() { var that = this; // that.showList = that.listTypes.indexOf(that.type) >= 0; }, mounted: function mounted() { var that = this; that.getRelyData(); that.getUserList(); }, methods: { resetData: function resetData() { var that = this; that.searchParams.username = ''; that.currentPage = 1; that.pageSize = 10; that.tableData = []; that.availableAddUser = false; }, getRelyData: function getRelyData() { var that = this; var getAreaList = function getAreaList() { return that.$axios({ method: 'post', url: that.contextPath + that.URL.getAreaList, needInterceptors: true, showError: true, loader: true }); }; that.$axios.all([getAreaList()]).then(that.$axios.spread(function (areaResult) { that.areaList = areaResult.options || []; })); }, getUserList: function getUserList(currentPage, pageSize) { var that = this; that.$axios({ method: 'post', url: that.contextPath + that.URL.getUserList, needInterceptors: true, showError: true, loader: false, data: that.$qs.stringify({ type: that.adminList ? 1 : 0, phone: that.searchParams.username.trim(), currentPage: (currentPage || that.currentPage || 1) - 1, pageSize: pageSize || that.pageSize || 10 }) }).then(function (result) { that.total = result.totalItems; that.tableData = result.data || []; }).catch(function (e) {}); }, sizeChange: function sizeChange(val) { var that = this; that.currentPage = 1; that.pageSize = val; that.getUserList(that.currentPage, val); }, currentChange: function currentChange(val) { var that = this; that.currentPage = val; that.getUserList(val, that.pageSize); }, addUser: function addUser() { var that = this; that.availableAddUser = true; }, deleteUser: function deleteUser(data) { var that = this; that.$confirm('您确定要删除该用户吗?', '提示', { customClass: 'wafConfirm', confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning' }).then(function () { that.$axios({ method: 'post', url: that.contextPath + that.URL.deleteUser + '/' + data.id, needInterceptors: true, loader: true }).then(function () { that.getUserList(); }).catch(function (e) { var message = ''; if (e && e.code == '4208') { message = '无法删除