webpackJsonp([44],{

/***/ "ZQgO":
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });

// EXTERNAL MODULE: ./node_modules/babel-runtime/core-js/json/stringify.js
var stringify = __webpack_require__("mvHQ");
var stringify_default = /*#__PURE__*/__webpack_require__.n(stringify);

// EXTERNAL MODULE: ./src/api/index.js + 5 modules
var api = __webpack_require__("gyMJ");

// EXTERNAL MODULE: ./src/utils/index.js
var utils = __webpack_require__("0xDb");

// EXTERNAL MODULE: ./node_modules/moment/moment.js
var moment = __webpack_require__("PJh5");
var moment_default = /*#__PURE__*/__webpack_require__.n(moment);

// CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./src/views/doorMagnetism/subordinateUnit.vue

//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//




/* harmony default export */ var subordinateUnit = ({
	name: "alarmRecord",
	data: function data() {
		return {
			treeNodes: [],
			defaultProps: {
				children: 'children',
				label: 'label'
			},
			form1: {
				name: '',
				region: ''
			},
			dialogVisible1: false,
			rules: {
				region: [{
					required: true,
					message: '请选择上级单位',
					trigger: 'blur'
				}],
				name: [{
					required: true,
					message: '请输入单位名称',
					trigger: 'blur'
				}],
				personname: [{
					required: true,
					message: '请输入管理员姓名',
					trigger: 'blur'
				}],
				phone: [{
					required: true,
					message: '请输入管理员手机号',
					trigger: 'blur'
				}],
				password: [{
					required: true,
					message: '请输入管理员密码',
					trigger: 'blur'
				}]
			},
			form: {
				personname: '',
				password: '',
				name: '',
				region: '',
				phone: ''
			},
			dialogVisible: false,
			input: '',
			content: '切换单个/多个查询模式',
			selected: true,
			advancedQueryStatus: false,
			advancedQueryText: '高级查询',
			formInline: {
				region: '',
				name: ''
			},
			tableData: [],
			pageTotal: 0,
			rowStyle: {
				background: '#f8f9fa',
				fontSize: '12px'
			},
			multipleSelection: [],
			currentPage: 1,
			batch: true,
			enterpriselist: [{
				name: '全部',
				id: ''
			}],
			zNodes: [],
			info: {},
			modifyFrom: {},
			allNodes: [],
			SelectedList: [],
			sele: true
		};
	},

	computed: {},
	beforeCreate: function beforeCreate() {
		this.$store.commit('updateTenantId', 400);
	},
	created: function created() {
		this.info = JSON.parse(localStorage.getItem('info'));
		this.getEnterprise();
		this.getlist();
	},

	methods: {
		// 获取房间
		getlist: function getlist() {
			var _this = this;

			var data = {};
			Object(api["d" /* httpGet */])(data, this.$api.getPlaceList).then(function (res) {
				if (res.data.list.length > 0) {
					res.data.list.map(function (li) {
						li['disabled'] = true;
					});
					_this.allNodes = res.data.list;
					var arrdata = Object(utils["n" /* uniqueArray */])(res.data.list, "id");
					_this.treeNodes = Object(utils["p" /* ztreeToElementTree */])(arrdata, {});
				}
			});
		},
		modifyEnterFun: function modifyEnterFun() {
			var _this2 = this;

			var data = {
				list: [{
					enterpriseId: this.form1.region,
					id: this.form1.id,
					name: this.form1.name
				}]
			};
			Object(api["g" /* httpPost */])(data, this.$api.updateEnterprise).then(function (res) {
				if (res.success) {
					_this2.getEnterprise();
					_this2.dialogVisible1 = false;
					_this2.$message.success("修改成功");
				} else {
					_this2.$message.error("修改失败");
				}
			});
		},

		// 编辑单位
		modifyEnterprise: function modifyEnterprise(index, row) {
			this.dialogVisible1 = true;
			this.form1.region = row.parentId;
			this.form1.name = row.name;
			this.form1.id = row.id;
			this.modifyFrom = this.form1;
			this.getRoomEnterpriseId();
		},
		getRoomEnterpriseId: function getRoomEnterpriseId() {
			var _this3 = this;

			var SelectedList = [];
			this.allNodes.map(function (li) {
				if (li.enterpriseId == _this3.form1.id) {
					SelectedList.push(li.id);
				}
			});
			this.sele = false;
			this.$nextTick(function () {
				this.SelectedList = SelectedList;
				this.sele = true;
			});
		},

		// 删除单位
		remove: function remove(index, row) {
			var _this4 = this;

			var list = [];
			list.push(row);
			var data = Object(utils["j" /* recursion */])(list);
			this.$confirm("确定要删除吗？", "提示", {
				type: "warning"
			}).then(function () {
				Object(api["g" /* httpPost */])(data, _this4.$api.deleteEnterprise).then(function (res) {
					if (res.success) {
						_this4.getEnterprise();
						_this4.$message.success("删除成功");
					} else {
						_this4.getEnterprise();
						_this4.$message.error("删除失败");
					}
				});
			});
		},

		// 获取单位
		getEnterprise: function getEnterprise() {
			var _this5 = this;

			var data = {
				q: stringify_default()({
					name: this.formInline.name,
					enterpriseId: this.formInline.region
				})
			};
			Object(api["d" /* httpGet */])(data, this.$api.getEnterprise).then(function (res) {
				var enterpriselist = [];
				if (res.data.list.length > 0) {
					_this5.enterpriseId = res.data.list[0].id;
				}
				res.data.list.map(function (li) {
					li.pid = li.parentId;
					li.createTime = moment_default()(li.createTime).format('YYYY/MM/DD HH:MM:SS');
					if (_this5.info.enterpriseId == li.id) {
						enterpriselist.push(li);
					}
				});
				_this5.enterpriselist = enterpriselist;
				_this5.Enterprise = res.data.list;
				_this5.zNodes = [];
				_this5.zNodes = Object(utils["p" /* ztreeToElementTree */])(res.data.list, {}); //res.data.list;
				_this5.pageTotal = res.data.total;
			});
		},

		// 创建单位
		addEnterprise: function addEnterprise() {
			var _this6 = this;

			var form = this.form;
			if (form.region == "") {
				this.$message.error("请选择上级单位");
			} else if (form.name == "" || form.phone == "" || form.password == "" || form.personname == "") {
				this.$message.error("请填写完整信息");
			} else {
				var data = {
					name: form.name,
					parentId: form.region
				};
				Object(api["g" /* httpPost */])(data, this.$api.addEnterprise).then(function (res) {
					if (res.success) {
						var addform = {
							username: form.personname,
							phone: form.phone,
							password: form.password,
							enterpriseName: form.name,
							userType: 1,
							enterpriseId: res.data
						};
						Object(api["g" /* httpPost */])(addform, _this6.$api.addUser).then(function (res1) {
							if (res1.success) {
								_this6.$message.success("创建成功");
								_this6.dialogVisible = false;
							} else {
								_this6.$message.error("添加失败");
								_this6.dialogVisible = false;
							}
						});
					} else {
						_this6.$message.error("添加失败");
						_this6.dialogVisible = false;
					}
				});
			}
		},

		// 未处理记录处理关闭
		handleClose1: function handleClose1(done) {
			done();
		},

		// 批量处理关闭
		handleClose: function handleClose(done) {
			done();
		},

		// 添加下级单位弹窗显示
		batchProcessing: function batchProcessing() {
			this.dialogVisible = true;
		},

		// 分页
		handleSizeChange: function handleSizeChange(val) {
			console.log("\u6BCF\u9875 " + val + " \u6761");
		},
		handleCurrentChange: function handleCurrentChange(val) {
			console.log("\u5F53\u524D\u9875: " + val);
		},

		// 表头样式
		rowClass: function rowClass(_ref) {
			var row = _ref.row,
			    rowIndex = _ref.rowIndex;

			return "background:#f8f9fa;color:#333;font-blod:none;font-size:12px;";
		},

		// 表格勾选
		handleSelectionChange: function handleSelectionChange(val) {
			if (val.length > 0) {
				this.batch = false;
			} else {
				this.batch = true;
			}
		},

		// 高级查询显示
		advancedQueryFun: function advancedQueryFun() {
			if (this.advancedQueryStatus) {
				this.advancedQueryText = "高级查询";
				this.advancedQueryStatus = false;
			} else {
				this.advancedQueryText = "同用查询";
				this.advancedQueryStatus = true;
			}
		},

		// 输入监控
		InputFun: function InputFun(e) {
			console.log(e);
		},

		// 单个/多个查询切换
		switchFun: function switchFun() {
			this.selected = !this.selected;
		}
	},
	mounted: function mounted() {}
});
// CONCATENATED MODULE: ./node_modules/vue-loader/lib/template-compiler?{"id":"data-v-8f80ac8a","hasScoped":true,"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/views/doorMagnetism/subordinateUnit.vue
var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{attrs:{"id":"container"}},[_c('div',{staticClass:"alarmrecord"},[_c('el-card',{staticClass:"box-card"},[_c('el-row',{},[_c('div',{staticClass:"search"},[_c('el-form',{staticClass:"demo-form-inline",attrs:{"inline":true,"model":_vm.formInline}},[_c('el-form-item',[_c('el-select',{attrs:{"size":"middle","placeholder":"单位名称","clearable":""},model:{value:(_vm.formInline.region),callback:function ($$v) {_vm.$set(_vm.formInline, "region", $$v)},expression:"formInline.region"}},_vm._l((_vm.enterpriselist),function(item){return _c('el-option',{key:item.id,attrs:{"label":item.name,"value":item.id}})}),1)],1),_vm._v(" "),_c('el-form-item',[_c('el-input',{attrs:{"clearable":true,"placeholder":"请输入单位名称","size":"middle"},model:{value:(_vm.formInline.name),callback:function ($$v) {_vm.$set(_vm.formInline, "name", $$v)},expression:"formInline.name"}})],1),_vm._v(" "),_c('el-form-item',[_c('el-button',{attrs:{"type":"primary","size":"middle"},on:{"click":_vm.getEnterprise}},[_vm._v("查询")])],1)],1)],1)]),_vm._v(" "),_c('el-row',{staticClass:"marginTop"},[_c('div',{staticClass:"tablecell"},[_c('el-row',{staticClass:"floatRight"},[_c('el-button',{attrs:{"type":"primary","size":"mini"},on:{"click":_vm.batchProcessing}},[_vm._v("新增")])],1),_vm._v(" "),_c('el-table',{ref:"multipleTable",staticStyle:{"width":"100%"},attrs:{"data":_vm.zNodes,"border":true,"tooltip-effect":"dark","lazy":true,"header-cell-style":_vm.rowClass,"cell-style":{fontSize:'12px'},"stripe":"","height":"590","row-key":"id","default-expand-all":true,"tree-props":{children: 'children', hasChildren: 'hasChildren'}},on:{"selection-change":_vm.handleSelectionChange}},[_c('el-table-column',{attrs:{"prop":"name","label":"单位名称","width":"120"}}),_vm._v(" "),_c('el-table-column',{attrs:{"prop":"createTime","label":"创建时间","show-overflow-tooltip":""}}),_vm._v(" "),_c('el-table-column',{attrs:{"label":"操作","width":"380"},scopedSlots:_vm._u([{key:"default",fn:function(scope){return [_c('el-button',{attrs:{"type":"primary","size":"mini","disabled":_vm.info.enterpriseId==scope.row.id?true:false},on:{"click":function($event){return _vm.modifyEnterprise(scope.$index, scope.row)}}},[_vm._v("管理员\n\t\t\t\t\t\t\t\t")]),_vm._v(" "),_c('el-button',{attrs:{"type":"primary","size":"mini"},on:{"click":function($event){return _vm.modifyEnterprise(scope.$index, scope.row)}}},[_vm._v("编辑\n\t\t\t\t\t\t\t\t")]),_vm._v(" "),_c('el-button',{attrs:{"type":"danger","size":"mini"},on:{"click":function($event){return _vm.remove(scope.$index, scope.row)}}},[_vm._v("删除\n\t\t\t\t\t\t\t\t")])]}}])})],1)],1),_vm._v(" "),_c('div',{staticClass:"page"},[_c('el-pagination',{attrs:{"current-page":_vm.currentPage,"page-sizes":[10, 20, 100, 400],"page-size":10,"layout":"total, sizes, prev, pager, next, jumper","total":_vm.pageTotal},on:{"size-change":_vm.handleSizeChange,"current-change":_vm.handleCurrentChange}})],1)])],1),_vm._v(" "),_c('el-dialog',{attrs:{"title":"添加下级单位","visible":_vm.dialogVisible,"width":"40%","before-close":_vm.handleClose},on:{"update:visible":function($event){_vm.dialogVisible=$event}}},[_c('el-form',{ref:"form",attrs:{"model":_vm.form,"label-width":"120px","inline":true,"rules":_vm.rules}},[_c('el-form-item',{attrs:{"label":"上级单位","prop":"region"}},[_c('el-select',{staticClass:"w200",attrs:{"placeholder":"请选择"},model:{value:(_vm.form.region),callback:function ($$v) {_vm.$set(_vm.form, "region", $$v)},expression:"form.region"}},_vm._l((_vm.enterpriselist),function(item){return _c('el-option',{key:item.id,attrs:{"label":item.name,"value":item.id}})}),1)],1),_vm._v(" "),_c('el-form-item',{attrs:{"label":"单位名称","prop":"name"}},[_c('el-input',{staticClass:"w200",attrs:{"clearable":true},model:{value:(_vm.form.name),callback:function ($$v) {_vm.$set(_vm.form, "name", $$v)},expression:"form.name"}})],1),_vm._v(" "),_c('el-form-item',{attrs:{"label":"管理员姓名","prop":"personname"}},[_c('el-input',{staticClass:"w200",attrs:{"clearable":true},model:{value:(_vm.form.personname),callback:function ($$v) {_vm.$set(_vm.form, "personname", $$v)},expression:"form.personname"}})],1),_vm._v(" "),_c('el-form-item',{attrs:{"label":"管理员手机号","prop":"phone"}},[_c('el-input',{staticClass:"w200",attrs:{"type":"number","clearable":true},model:{value:(_vm.form.phone),callback:function ($$v) {_vm.$set(_vm.form, "phone", $$v)},expression:"form.phone"}})],1),_vm._v(" "),_c('el-form-item',{attrs:{"label":"管理员密码","prop":"password"}},[_c('el-input',{attrs:{"clearable":true},model:{value:(_vm.form.password),callback:function ($$v) {_vm.$set(_vm.form, "password", $$v)},expression:"form.password"}})],1),_vm._v(" "),_c('el-form-item',{attrs:{"label":"备注"}},[_c('el-input',{ref:"tree",staticClass:"w200",attrs:{"node-key":"id","default-checked-keys":_vm.SelectedList,"clearable":true},model:{value:(_vm.form.remark),callback:function ($$v) {_vm.$set(_vm.form, "remark", $$v)},expression:"form.remark"}})],1)],1),_vm._v(" "),_c('span',{staticClass:"dialog-footer",attrs:{"slot":"footer"},slot:"footer"},[_c('el-button',{on:{"click":function($event){_vm.dialogVisible = false}}},[_vm._v("取 消")]),_vm._v(" "),_c('el-button',{attrs:{"type":"primary"},on:{"click":_vm.addEnterprise}},[_vm._v("添 加")])],1)],1),_vm._v(" "),_c('el-dialog',{attrs:{"title":"编辑","visible":_vm.dialogVisible1,"width":"30%","before-close":_vm.handleClose1},on:{"update:visible":function($event){_vm.dialogVisible1=$event}}},[_c('el-form',{ref:"form1",attrs:{"model":_vm.form1,"label-width":"120px","inline":true}},[_c('el-form-item',{attrs:{"label":"上级单位"}},[_c('el-select',{staticClass:"w200",attrs:{"placeholder":"请选择"},model:{value:(_vm.form1.region),callback:function ($$v) {_vm.$set(_vm.form1, "region", $$v)},expression:"form1.region"}},_vm._l((_vm.enterpriselist),function(item){return _c('el-option',{key:item.id,attrs:{"label":item.name,"value":item.id}})}),1)],1),_vm._v(" "),_c('el-form-item',{attrs:{"label":"单位名称"}},[_c('el-input',{staticClass:"w200",attrs:{"clearable":true},model:{value:(_vm.form1.name),callback:function ($$v) {_vm.$set(_vm.form1, "name", $$v)},expression:"form1.name"}})],1),_vm._v(" "),_c('el-form-item',{staticClass:"blocklist",attrs:{"label":"管理房间"}},[(_vm.sele)?_c('el-tree',{attrs:{"data":_vm.treeNodes,"show-checkbox":"","node-key":"id","default-checked-keys":_vm.SelectedList,"props":_vm.defaultProps}}):_vm._e()],1)],1),_vm._v(" "),_c('span',{staticClass:"dialog-footer",attrs:{"slot":"footer"},slot:"footer"},[_c('el-button',{on:{"click":function($event){_vm.dialogVisible1 = false}}},[_vm._v("取 消")]),_vm._v(" "),_c('el-button',{attrs:{"type":"primary"},on:{"click":_vm.modifyEnterFun}},[_vm._v("确 定")])],1)],1)],1)])}
var staticRenderFns = []
var esExports = { render: render, staticRenderFns: staticRenderFns }
/* harmony default export */ var doorMagnetism_subordinateUnit = (esExports);
// CONCATENATED MODULE: ./src/views/doorMagnetism/subordinateUnit.vue
function injectStyle (ssrContext) {
  __webpack_require__("crQ+")
}
var normalizeComponent = __webpack_require__("VU/8")
/* script */


/* template */

/* template functional */
var __vue_template_functional__ = false
/* styles */
var __vue_styles__ = injectStyle
/* scopeId */
var __vue_scopeId__ = "data-v-8f80ac8a"
/* moduleIdentifier (server only) */
var __vue_module_identifier__ = null
var Component = normalizeComponent(
  subordinateUnit,
  doorMagnetism_subordinateUnit,
  __vue_template_functional__,
  __vue_styles__,
  __vue_scopeId__,
  __vue_module_identifier__
)

/* harmony default export */ var views_doorMagnetism_subordinateUnit = __webpack_exports__["default"] = (Component.exports);


/***/ }),

/***/ "crQ+":
/***/ (function(module, exports) {

// removed by extract-text-webpack-plugin

/***/ })

});