Browse Source

门禁卡

Shannon_mu 3 years ago
parent
commit
49faa3a358

+ 14 - 7
accessControlSystem/src/views/accessControlCard/index.vue

@@ -57,9 +57,9 @@
                             <i
                                 v-if="scope.row.cardStatus === 1"
                                 class="zoniot_font zoniot-icon-qiyong1"
-                                @click="disableAccessControl(scope.row, 1)"
+                                @click="disableAccessControl(scope.row, 2)"
                             ></i>
-                            <i v-else class="zoniot_font zoniot-icon-jinyong1" @click="disableAccessControl(scope.row, 2)"></i>
+                            <i v-else class="zoniot_font zoniot-icon-jinyong1" @click="disableAccessControl(scope.row, 1)"></i>
                         </el-tooltip>
                         <el-tooltip class="item" effect="light" placement="bottom" content="注销">
                             <i class="zoniot_font zoniot-icon-tingyong redText" @click="cancellation(scope.row)"></i>
@@ -172,7 +172,7 @@ export default {
                 this.$store.dispatch('addPopup', {
                     url: `/accessControlCard/popups/${url}.vue`,
                     width: '548px',
-                    height:typeName == 'guanli' ? '350px':"600px",
+                    height: typeName == 'guanli' ? '350px' : '600px',
                     props: {
                         callback: resolve,
                         cardType: cardType,
@@ -204,18 +204,25 @@ export default {
         },
         disableAccessControl(row, sun) {
             if (sun == 1) {
-                this.disableAccessControlApi(sun, row.id);
+                this.disableAccessControlApi(sun, row);
             } else {
                 this.$msgBox(`禁用确认`, '门禁卡禁用后,住户将无法正常使用门禁卡开门', 'warning')
                     .then(() => {
-                        this.disableAccessControlApi(sun, row.id);
+                        this.disableAccessControlApi(sun, row);
                     })
                     .catch(() => {});
             }
         },
-        disableAccessControlApi(status, id) {
+        disableAccessControlApi(status, row) {
             this.$http
-                .post('/sc-gate-web/gateCard/operate', { cardStatus: status, id: id })
+                .post('/sc-gate-web/gateCard/operate', {
+                    cardStatus: status,
+                    id: row.id,
+                    cardNo: row.cardNo,
+                    type: status,
+                    communityId: row.communityId,
+                    expirationTime: row.expirationTime
+                })
                 .then(({ status, msg }) => {
                     if (status == 0) {
                         this.$message.success(msg);

+ 5 - 5
accessControlSystem/src/views/accessControlCard/popups/addHouseholdCard.vue

@@ -215,11 +215,11 @@ export default {
             this.$refs.form.validate((valid) => {
                 if (valid) {
                     let installData = JSON.parse(JSON.stringify(this.formData));
-                   let writeId = this.gateList.filter(item=>{
-                        return this.gateIds.includes(item.id)
-                    })
+                    let writeId = this.gateList.filter((item) => {
+                        return this.gateIds.includes(item.id);
+                    });
                     writeId.map((item, index) => {
-                        installData.gateIds.push({ deviceId: item.id ,duoduId:item.deviceNo});
+                        installData.gateIds.push({ deviceId: item.id, duoduId: item.deviceNo });
                     });
 
                     //房间号
@@ -332,7 +332,7 @@ export default {
                 return devNo;
             };
             let inFrom = {
-                depId: installData.communityId,
+                // depId: installData.communityId,
                 expire_date: installData.expirationTime,
                 guids: ids().join(',')
             };

+ 27 - 14
accessControlSystem/src/views/accessControlCard/popups/addManagemenCard.vue

@@ -161,22 +161,35 @@ export default {
                 }
             });
         },
+        getdepld(id, resolves) {
+            this.$http.get('/sc-gate-web/community/getId', { communityId: id }).then(({ data, status, msg }) => {
+                if (status == 0) {
+                    resolves && resolves(data);
+                } else {
+                    this.$message.error(msg);
+                }
+            });
+        },
         writeCard(installData) {
-            let inFrom = {
-                depId: installData.communityId,
-                expire_date: installData.expirationTime,
-            };
-            new Promise((resolve) => {
-                this.$http.post('/card/issue/manage', [inFrom]).then(({ data, status, msg }) => {
-                    if (status == 0) {
-                        this.$message.success(msg);
-                        resolve && resolve();
-                    } else {
-                        this.$message.error(msg);
-                    }
-                });
+            new Promise((resolves) => {
+                this.getdepld(installData.communityId, resolves);
             }).then((res) => {
-                this.isOk(installData);
+                let inFrom = {
+                    depId: res,
+                    expire_date: installData.expirationTime
+                };
+                new Promise((resolve) => {
+                    this.$http.post('/card/issue/manage', [inFrom]).then(({ data, status, msg }) => {
+                        if (status == 0) {
+                            // this.$message.success(msg);
+                            resolve && resolve();
+                        } else {
+                            this.$message.error(msg);
+                        }
+                    });
+                }).then((res) => {
+                    this.isOk(installData);
+                });
             });
         },
         isOk(installData) {

+ 50 - 26
accessControlSystem/src/views/accessControlCard/popups/continuedMake.vue

@@ -30,8 +30,13 @@ export default {
                 expirationTime: '',
                 id: '',
                 cardNo: '',
+                oldCardNo: '',
                 communityId: '',
-                type: this.params.type
+                type: this.params.type,
+                cardType: '',
+                userId: '',
+                userName: '',
+                houseId: ''
             },
             formRules: {
                 expirationTime: [this.$valid.selectRequired('到期时间')],
@@ -65,8 +70,12 @@ export default {
             this.$http.get('/sc-gate-web/gateCard/find/' + id).then(({ msg, data, status }) => {
                 if (status == 0) {
                     this.formData.id = data.id;
-                    this.formData.cardNo = data.cardNo;
+                    this.formData.oldCardNo = data.cardNo;
                     this.formData.communityId = data.communityId;
+                    this.formData.cardType = data.cardType;
+                    this.formData.userId = data.userId;
+                    this.formData.userName = data.username;
+                    this.formData.houseId = data.houseId;
                     this.thisObj = data;
                 } else {
                     this.$message.error(msg);
@@ -81,36 +90,51 @@ export default {
             }
             this.formData.cardNo = randomNumber.toString().replace(/,/g, '');
         },
+        getdepld(id, resolves) {
+            this.$http.get('/sc-gate-web/community/getId', { communityId: id }).then(({ data, status, msg }) => {
+                if (status == 0) {
+                    resolves && resolves(data);
+                } else {
+                    this.$message.error(msg);
+                }
+            });
+        },
         writeCard(installData) {
-            let ids = () => {
-                let newAr = [];
-                this.thisObj.gateList.map((item) => {
-                    newAr.push(item.deviceNo);
-                });
-                return newAr;
-            };
-            let inFrom = {
-                depId: this.params.row.communityId,
-                expire_date: installData.expirationTime,
-                guids: ids().join(',')
-            };
-            new Promise((resolve) => {
-                this.$http
-                    .post(`${this.params.row.cardType == 2 ? '/card/issue/manage' : '/card/issue/resident'}`, [inFrom])
-                    .then(({ data, status, msg }) => {
-                        if (status == 0) {
-                            // this.$message.success(msg);
-                            resolve && resolve();
-                        } else {
-                            this.$message.error(msg);
-                        }
-                    });
+            new Promise((resolves) => {
+                this.getdepld(this.params.row.communityId, resolves);
             }).then((res) => {
-                this.isOk(installData);
+                new Promise((resolve) => {
+                     let ids = () => {
+                        let arr = [];
+                        this.thisObj.gateList.map((item) => {
+                            arr.push({
+                                guids: item.deviceNo,
+                                expire_date: installData.expirationTime,
+                                depId: res
+                            });
+                        });
+                        return arr;
+                    };
+                    this.$http
+                        .post(`${this.params.row.cardType == 2 ? '/card/issue/manage' : '/card/issue/resident'}`, ids())
+                        .then(({ data, status, msg }) => {
+                            if (status == 0) {
+                                resolve && resolve();
+                            } else {
+                                this.$message.error(msg);
+                            }
+                        });
+                }).then((res) => {
+                    this.isOk(installData);
+                });
             });
         },
         isOk(installData) {
             var loading = this.$loading();
+            if(this.params.type == 5){
+                installData.cardNo = installData.oldCardNo
+                delete installData.oldCardNo
+            }
             this.$http
                 .post('/sc-gate-web/gateCard/operate', installData)
                 .then(({ status, msg }) => {