|
@@ -1,7 +1,7 @@
|
|
|
<template>
|
|
|
<zz-form :cols="formCols" :data="formData" :rules="formRules" labelWidth="120" ref="form">
|
|
|
<template slot="communityId">
|
|
|
- <el-select class="width65" v-model="formData.communityId" clearable>
|
|
|
+ <el-select class="width65" v-model="formData.communityId" clearable @change="handleChange">
|
|
|
<el-option
|
|
|
:label="item.communityName"
|
|
|
:value="item.id"
|
|
@@ -19,6 +19,7 @@
|
|
|
|
|
|
<template slot="typeValue">
|
|
|
<el-cascader
|
|
|
+ :key="typeValueKey"
|
|
|
ref="typeValue"
|
|
|
v-model="formData.typeValue"
|
|
|
:props="defaultProps"
|
|
@@ -35,7 +36,6 @@
|
|
|
label: 'deviceName'
|
|
|
}"
|
|
|
:titles="['待选列表', '已选列表']"
|
|
|
- @change="handleChange"
|
|
|
:data="devicesArr"
|
|
|
></el-transfer>
|
|
|
</div>
|
|
@@ -169,13 +169,13 @@ export default {
|
|
|
children: 'children',
|
|
|
emitPath: false
|
|
|
},
|
|
|
+ typeValueKey: 0,
|
|
|
effectiveDate: []
|
|
|
};
|
|
|
},
|
|
|
-
|
|
|
methods: {
|
|
|
submit() {
|
|
|
- new Promise(resolve => {
|
|
|
+ new Promise((resolve) => {
|
|
|
this.$refs.form.validate(resolve);
|
|
|
}).then(() => {
|
|
|
var loading = this.$loading();
|
|
@@ -183,9 +183,6 @@ export default {
|
|
|
let initData = JSON.parse(JSON.stringify(this.formData));
|
|
|
if (this.params.todo === 'edit') {
|
|
|
url = '/sc-community/inspection/update';
|
|
|
- // } else {
|
|
|
- // initData.startDate = this.formData.startDate + '00:00:00';
|
|
|
- // initData.endDate = this.formData.endDate + '23:59:59';
|
|
|
}
|
|
|
this.$http
|
|
|
.post(url, initData)
|
|
@@ -209,18 +206,30 @@ export default {
|
|
|
this.formData.peopleName = this.$refs.userName.getCheckedNodes()[0].label;
|
|
|
},
|
|
|
deviceArrToggle() {
|
|
|
- this.formData.type = this.$refs.typeValue.getCheckedNodes()[0].data.type;
|
|
|
+ if (!!this.formData.typeValue) {
|
|
|
+ this.formData.type = this.$refs.typeValue.getCheckedNodes()[0].data.type;
|
|
|
+ }
|
|
|
this.getTypes();
|
|
|
},
|
|
|
getTypes() {
|
|
|
this.$http
|
|
|
- .get('/sc-community/inspection/getDevices', { type: this.formData.type, typeId: this.formData.typeValue })
|
|
|
+ .get('/sc-community/inspection/getDevices', {
|
|
|
+ type: this.formData.type,
|
|
|
+ typeId: this.formData.typeValue,
|
|
|
+ communityId: this.formData.communityId
|
|
|
+ })
|
|
|
.then(({ data, msg }) => {
|
|
|
- this.devicesArr = data;
|
|
|
+ this.devicesArr = data || [];
|
|
|
});
|
|
|
},
|
|
|
+
|
|
|
handleChange(e) {
|
|
|
- console.log(this.rightChecked);
|
|
|
+ if (!!this.formData.typeValue) {
|
|
|
+ this.formData.typeValue = '';
|
|
|
+ this.formData.type = '';
|
|
|
+ this.typeValueKey++;
|
|
|
+ this.getTypes();
|
|
|
+ }
|
|
|
},
|
|
|
effectiveDateToggle(va) {
|
|
|
let arr = va;
|
|
@@ -267,7 +276,7 @@ export default {
|
|
|
this.$http.get('/sc-community/inspection/getInspectionDevices?id=' + id).then(({ data, msg }) => {
|
|
|
if (!!data && data.length > 0) {
|
|
|
let deviceIds = [];
|
|
|
- data.map(item => {
|
|
|
+ data.map((item) => {
|
|
|
deviceIds.push(item.deviceId);
|
|
|
});
|
|
|
this.formData.deviceIds = deviceIds;
|
|
@@ -279,9 +288,9 @@ export default {
|
|
|
this.deviceArr = this.params.deviceArr;
|
|
|
this.findUser = this.params.arrData;
|
|
|
if (!!this.params.data && !!this.params.data.id) {
|
|
|
- new Promise(resolve => {
|
|
|
+ new Promise((resolve) => {
|
|
|
this.getDetails(this.params.data.id, resolve);
|
|
|
- }).then(_ => {
|
|
|
+ }).then((_) => {
|
|
|
this.getTypes();
|
|
|
this.getSelectDevice(this.params.data.id);
|
|
|
});
|