|
@@ -24,7 +24,7 @@
|
|
</el-select>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item :prop="`unitName`" :rules="buildingIdRules('单元', address.unitName)" class="form-item-flex-input">
|
|
<el-form-item :prop="`unitName`" :rules="buildingIdRules('单元', address.unitName)" class="form-item-flex-input">
|
|
- <el-select v-model="address.unitName" placeholder="请选择单元" clearable>
|
|
|
|
|
|
+ <el-select v-model="address.unitName" placeholder="请选择单元" clearable @change="roomNameList(address.unitName)">
|
|
<el-option
|
|
<el-option
|
|
v-for="(item, index) in unitList"
|
|
v-for="(item, index) in unitList"
|
|
:key="index"
|
|
:key="index"
|
|
@@ -34,30 +34,37 @@
|
|
</el-select>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item :prop="`roomNumber`" :rules="buildingIdRules('房间', address.roomNumber)" class="form-item-flex-input">
|
|
<el-form-item :prop="`roomNumber`" :rules="buildingIdRules('房间', address.roomNumber)" class="form-item-flex-input">
|
|
- <el-select v-model="address.roomNumber" placeholder="请选择房间" clearable>
|
|
|
|
|
|
+ <el-select v-model="address.roomNumber" placeholder="请选择房间" clearable @change="roomSelect()">
|
|
<el-option
|
|
<el-option
|
|
- v-for="(item, index) in unitList"
|
|
|
|
|
|
+ v-for="(item, index) in roomList"
|
|
:key="index"
|
|
:key="index"
|
|
- :label="item.unitName"
|
|
|
|
- :value="item.unitName"
|
|
|
|
|
|
+ :label="item.roomNumber"
|
|
|
|
+ :value="item.houseId"
|
|
></el-option>
|
|
></el-option>
|
|
</el-select>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</div>
|
|
</div>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
- <el-form-item label="住户" required>
|
|
|
|
- <el-select placeholder="请选择住户" v-model="formData.gateType">
|
|
|
|
- <el-option label="微信" :value="1"></el-option>
|
|
|
|
- <el-option label="支付宝" :value="2"></el-option>
|
|
|
|
- <el-option label="现金" :value="3"></el-option>
|
|
|
|
- <el-option label="其他" :value="5"></el-option>
|
|
|
|
|
|
+ <el-form-item :label="params.cardType == 1 ? '住户' : '员工'" prop="userId">
|
|
|
|
+ <el-select placeholder="请选择住户" v-model="formData.userId" @change="slectUser()" v-if="params.cardType == 1">
|
|
|
|
+ <el-option :label="item.name" :value="item.id" v-for="(item, index) in ScResident" :key="index"></el-option>
|
|
</el-select>
|
|
</el-select>
|
|
|
|
+
|
|
|
|
+ <el-cascader
|
|
|
|
+ ref="userName"
|
|
|
|
+ v-else
|
|
|
|
+ v-model="formData.userId"
|
|
|
|
+ :props="defaultProps"
|
|
|
|
+ :options="findUser"
|
|
|
|
+ @change="findUserToggle"
|
|
|
|
+ ></el-cascader>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item label="发卡" required>
|
|
<el-form-item label="发卡" required>
|
|
<el-radio-group v-model="formData.cardType">
|
|
<el-radio-group v-model="formData.cardType">
|
|
- <el-radio-button class="buttonSelect" label="读取卡"></el-radio-button>
|
|
|
|
- <el-radio-button class="buttonSelect" label="格式化卡"></el-radio-button>
|
|
|
|
|
|
+ <el-radio-button class="buttonSelect" :label="1" :value="1">读取卡</el-radio-button>
|
|
|
|
+ <el-radio-button class="buttonSelect" :label="2" :value="2">格式化卡</el-radio-button>
|
|
</el-radio-group>
|
|
</el-radio-group>
|
|
|
|
+ <el-input v-model="formData.cardNo"></el-input>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item label="到期时间" prop="expirationTime">
|
|
<el-form-item label="到期时间" prop="expirationTime">
|
|
<el-date-picker
|
|
<el-date-picker
|
|
@@ -72,13 +79,21 @@
|
|
<el-form-item label="选择门禁" required>
|
|
<el-form-item label="选择门禁" required>
|
|
<el-checkbox :indeterminate="checkAccessControl" v-model="checkAll" @change="handleCheckAllChange">全选</el-checkbox>
|
|
<el-checkbox :indeterminate="checkAccessControl" v-model="checkAll" @change="handleCheckAllChange">全选</el-checkbox>
|
|
<div class="formContent-item_title">围墙机</div>
|
|
<div class="formContent-item_title">围墙机</div>
|
|
- <el-checkbox-group v-model="formData.gateIds">
|
|
|
|
- <el-checkbox-button class="buttonSelect" :label="1">东出入口</el-checkbox-button>
|
|
|
|
- <el-checkbox-button class="buttonSelect" :label="2">南出入口</el-checkbox-button>
|
|
|
|
- <el-checkbox-button class="buttonSelect" :label="3">西出入口</el-checkbox-button>
|
|
|
|
- <el-checkbox-button class="buttonSelect" :label="4">北出入口</el-checkbox-button>
|
|
|
|
|
|
+ <el-checkbox-group v-model="gateIds" class="mgB20" @change="handleCheckChange">
|
|
|
|
+ <template v-for="(item, index) in gateList">
|
|
|
|
+ <el-checkbox-button :key="index" v-if="item.gateType == 1" class="buttonSelect" :label="item.id">{{
|
|
|
|
+ item.deviceName
|
|
|
|
+ }}</el-checkbox-button>
|
|
|
|
+ </template>
|
|
</el-checkbox-group>
|
|
</el-checkbox-group>
|
|
<div class="formContent-item_title">单元机</div>
|
|
<div class="formContent-item_title">单元机</div>
|
|
|
|
+ <el-checkbox-group v-model="gateIds" class="mgB20" @change="handleCheckChange">
|
|
|
|
+ <template v-for="(item, index) in gateList">
|
|
|
|
+ <el-checkbox-button :key="index" v-if="item.gateType == 2" class="buttonSelect" :label="item.id">{{
|
|
|
|
+ item.deviceName
|
|
|
|
+ }}</el-checkbox-button>
|
|
|
|
+ </template>
|
|
|
|
+ </el-checkbox-group>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-form>
|
|
</el-form>
|
|
</div>
|
|
</div>
|
|
@@ -89,18 +104,22 @@ export default {
|
|
props: ['params'],
|
|
props: ['params'],
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
|
|
+ defaultProps: {
|
|
|
|
+ value: 'id', // 唯一标识
|
|
|
|
+ label: 'label', // 标签显示
|
|
|
|
+ children: 'children',
|
|
|
|
+ emitPath: false
|
|
|
|
+ },
|
|
formData: {
|
|
formData: {
|
|
communityId: '',
|
|
communityId: '',
|
|
expirationTime: '',
|
|
expirationTime: '',
|
|
cardNo: '',
|
|
cardNo: '',
|
|
- cardType: '',
|
|
|
|
- gateIds: [
|
|
|
|
- {
|
|
|
|
- deviceId: '',
|
|
|
|
- duoduId: ''
|
|
|
|
- }
|
|
|
|
- ]
|
|
|
|
|
|
+ cardType: 1,
|
|
|
|
+ userId: '',
|
|
|
|
+ username: '',
|
|
|
|
+ gateIds: []
|
|
},
|
|
},
|
|
|
|
+ gateIds: [],
|
|
address: {
|
|
address: {
|
|
buildingId: '',
|
|
buildingId: '',
|
|
unitName: '',
|
|
unitName: '',
|
|
@@ -108,17 +127,22 @@ export default {
|
|
},
|
|
},
|
|
formRules: {
|
|
formRules: {
|
|
communityId: [this.$valid.selectRequired('所属社区')],
|
|
communityId: [this.$valid.selectRequired('所属社区')],
|
|
|
|
+ userId: [this.$valid.selectRequired('住户')],
|
|
expirationTime: [this.$valid.selectRequired('到期时间')]
|
|
expirationTime: [this.$valid.selectRequired('到期时间')]
|
|
},
|
|
},
|
|
envConfig: envConfig,
|
|
envConfig: envConfig,
|
|
token: {
|
|
token: {
|
|
[localStorage.getItem('SC_token') && 'Authorization']: 'Bearer ' + localStorage.getItem('SC_token')
|
|
[localStorage.getItem('SC_token') && 'Authorization']: 'Bearer ' + localStorage.getItem('SC_token')
|
|
},
|
|
},
|
|
- checkAll: [],
|
|
|
|
|
|
+ checkAll: false,
|
|
checkAccessControl: false,
|
|
checkAccessControl: false,
|
|
communityArr: [],
|
|
communityArr: [],
|
|
buildingList: [],
|
|
buildingList: [],
|
|
- unitList: []
|
|
|
|
|
|
+ unitList: [],
|
|
|
|
+ roomList: [],
|
|
|
|
+ gateList: [],
|
|
|
|
+ ScResident: [],
|
|
|
|
+ findUser: []
|
|
};
|
|
};
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
@@ -133,6 +157,8 @@ export default {
|
|
//查询楼栋下拉列表
|
|
//查询楼栋下拉列表
|
|
buildingNameList(id) {
|
|
buildingNameList(id) {
|
|
this.buildingList = [];
|
|
this.buildingList = [];
|
|
|
|
+ this.unitList = [];
|
|
|
|
+ this.roomList = [];
|
|
this.$http.post('/sc-community/assets/building/list/building', { communityId: id }).then(({ data, status, msg }) => {
|
|
this.$http.post('/sc-community/assets/building/list/building', { communityId: id }).then(({ data, status, msg }) => {
|
|
if (0 === status) {
|
|
if (0 === status) {
|
|
this.buildingList = data;
|
|
this.buildingList = data;
|
|
@@ -141,7 +167,8 @@ export default {
|
|
},
|
|
},
|
|
unitNameList(id) {
|
|
unitNameList(id) {
|
|
this.unitList = [];
|
|
this.unitList = [];
|
|
- this.$http.get('/sc-community/assets/building/house/find', { id: id }).then((res) => {
|
|
|
|
|
|
+ this.roomList = [];
|
|
|
|
+ this.$http.get('/sc-community/assets/building/house/find/v2', { id: id }).then((res) => {
|
|
if (res.status == 0) {
|
|
if (res.status == 0) {
|
|
if (res.data.buildingUnitList.length != 0) {
|
|
if (res.data.buildingUnitList.length != 0) {
|
|
this.unitList = res.data.buildingUnitList;
|
|
this.unitList = res.data.buildingUnitList;
|
|
@@ -149,6 +176,18 @@ export default {
|
|
}
|
|
}
|
|
});
|
|
});
|
|
},
|
|
},
|
|
|
|
+ roomNameList(id) {
|
|
|
|
+ this.roomList = [];
|
|
|
|
+ this.unitList.map((item, index) => {
|
|
|
|
+ if (item.unitName == id) {
|
|
|
|
+ this.roomList = item.roomList;
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ roomSelect() {
|
|
|
|
+ const { buildingId, unitName, roomNumber } = this.address;
|
|
|
|
+ this.getScResident(this.formData.communityId, buildingId, unitName, roomNumber);
|
|
|
|
+ },
|
|
buildingIdRules(name, val) {
|
|
buildingIdRules(name, val) {
|
|
return {
|
|
return {
|
|
required: true,
|
|
required: true,
|
|
@@ -163,16 +202,32 @@ export default {
|
|
}
|
|
}
|
|
};
|
|
};
|
|
},
|
|
},
|
|
|
|
+ slectUser() {
|
|
|
|
+ this.ScResident.map((item) => {
|
|
|
|
+ if (item.id == this.formData.userId) {
|
|
|
|
+ this.formData.username = item.name;
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ },
|
|
submit() {
|
|
submit() {
|
|
this.$refs.form.validate((valid) => {
|
|
this.$refs.form.validate((valid) => {
|
|
if (valid) {
|
|
if (valid) {
|
|
var loading = this.$loading();
|
|
var loading = this.$loading();
|
|
let installData = JSON.parse(JSON.stringify(this.formData));
|
|
let installData = JSON.parse(JSON.stringify(this.formData));
|
|
- if (installData.gateType == 2) {
|
|
|
|
- delete installData.gateUnitDtoList;
|
|
|
|
|
|
+ this.gateIds.map((item, index) => {
|
|
|
|
+ installData.gateIds.push({ deviceId: item });
|
|
|
|
+ });
|
|
|
|
+ if (this.params.cardType == 1) {
|
|
|
|
+ //房间号
|
|
|
|
+ installData.houseId = this.address.roomNumber;
|
|
|
|
+ const { buildingId, unitName, roomNumber } = this.address;
|
|
|
|
+ let thisBuId = this.buildingList.find((item) => item.id === buildingId);
|
|
|
|
+ let thisRoom = this.roomList.find((item) => item.houseId === roomNumber);
|
|
|
|
+ installData.address = `${thisBuId.buildingName}${this.CheckChinese(unitName, '单元')}${thisRoom['roomNumber']}`;
|
|
}
|
|
}
|
|
|
|
+
|
|
this.$http
|
|
this.$http
|
|
- .post('/sc-gate-web/gate/add', installData)
|
|
|
|
|
|
+ .post('/sc-gate-web/gateCard/add', installData)
|
|
.then(({ status, msg }) => {
|
|
.then(({ status, msg }) => {
|
|
if (status == 0) {
|
|
if (status == 0) {
|
|
this.$message.success(msg);
|
|
this.$message.success(msg);
|
|
@@ -190,12 +245,64 @@ export default {
|
|
});
|
|
});
|
|
},
|
|
},
|
|
handleCheckAllChange(val) {
|
|
handleCheckAllChange(val) {
|
|
- this.checkedCities = val ? [] : [];
|
|
|
|
|
|
+ let checked = this.gateList.map((item) => {
|
|
|
|
+ debugger;
|
|
|
|
+ return item.id;
|
|
|
|
+ });
|
|
|
|
+ this.gateIds = val ? checked : [];
|
|
this.checkAccessControl = false;
|
|
this.checkAccessControl = false;
|
|
|
|
+ },
|
|
|
|
+ handleCheckChange(val) {
|
|
|
|
+ let checkedCount = val.length;
|
|
|
|
+ this.checkAll = checkedCount === this.gateList.length;
|
|
|
|
+ this.checkAccessControl = checkedCount > 0 && checkedCount < this.gateList.length;
|
|
|
|
+ },
|
|
|
|
+ getGateList(communityId) {
|
|
|
|
+ this.$http.get('/sc-gate-web/gate/list', { communityId: communityId }).then(({ msg, data, status }) => {
|
|
|
|
+ if (status == 0) {
|
|
|
|
+ this.gateList = data;
|
|
|
|
+ } else {
|
|
|
|
+ this.$message.error(msg);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ getScResident(communityId, buildingId, unitName, roomNumber) {
|
|
|
|
+ this.$http
|
|
|
|
+ .get('/sc-community/scResident/list', {
|
|
|
|
+ communityId: communityId,
|
|
|
|
+ buildingId: buildingId,
|
|
|
|
+ unitName: unitName,
|
|
|
|
+ roomNumber: roomNumber
|
|
|
|
+ })
|
|
|
|
+ .then(({ msg, data, status }) => {
|
|
|
|
+ if (status == 0) {
|
|
|
|
+ this.ScResident = data;
|
|
|
|
+ } else {
|
|
|
|
+ this.$message.error(msg);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ CheckChinese(val, name) {
|
|
|
|
+ var reg = new RegExp('[\\u4E00-\\u9FFF]+', 'g');
|
|
|
|
+ let newVal = val;
|
|
|
|
+ if (!reg.test(val)) {
|
|
|
|
+ newVal = val + name;
|
|
|
|
+ }
|
|
|
|
+ return newVal;
|
|
|
|
+ },
|
|
|
|
+ getUserList() {
|
|
|
|
+ this.$http.get('/sc-user-center/user/findUserList').then(({ data, status, msg }) => {
|
|
|
|
+ this.findUser = data;
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ findUserToggle() {
|
|
|
|
+ this.formData.username = this.$refs.userName.getCheckedNodes()[0].label;
|
|
}
|
|
}
|
|
},
|
|
},
|
|
created() {
|
|
created() {
|
|
this.getorgTree();
|
|
this.getorgTree();
|
|
|
|
+ this.getUserList();
|
|
|
|
+ this.getGateList(this.params.obj.communityId);
|
|
}
|
|
}
|
|
};
|
|
};
|
|
</script>
|
|
</script>
|
|
@@ -215,6 +322,9 @@ export default {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+.el-checkbox {
|
|
|
|
+ margin-bottom: rem(20);
|
|
|
|
+}
|
|
.buttonSelect {
|
|
.buttonSelect {
|
|
padding: 0 rem(15);
|
|
padding: 0 rem(15);
|
|
text-align: center;
|
|
text-align: center;
|