|
|
@@ -96,15 +96,14 @@ import {
|
|
|
export default {
|
|
|
name: 'Device',
|
|
|
props: {
|
|
|
- group: {
|
|
|
- type: Object,
|
|
|
+ tenant: {
|
|
|
+ type: String,
|
|
|
required: true
|
|
|
}
|
|
|
},
|
|
|
data () {
|
|
|
const productSelectSchema = {
|
|
|
- remote: getProducts,
|
|
|
- condition: { tenant: this.group.path },
|
|
|
+ remote: this.getProducts,
|
|
|
pagination: true,
|
|
|
value: 'id',
|
|
|
label: 'name'
|
|
|
@@ -117,8 +116,8 @@ export default {
|
|
|
productSelectSchema,
|
|
|
schema: {
|
|
|
keepalive: true,
|
|
|
- condition: { productId: void 0, name: '', tenant: this.group.path },
|
|
|
- list: getDevicesByAdmin,
|
|
|
+ condition: { productId: void 0, name: '' },
|
|
|
+ list: this.getDevicesByAdmin,
|
|
|
transform: this.transform,
|
|
|
transformData: this.transformTableData,
|
|
|
buttons: [
|
|
|
@@ -168,7 +167,24 @@ export default {
|
|
|
return this.isSub ? '新增备份设备' : '新增设备'
|
|
|
}
|
|
|
},
|
|
|
+ watch: {
|
|
|
+ group () {
|
|
|
+ this.$refs.table.pageTo(1)
|
|
|
+ }
|
|
|
+ },
|
|
|
methods: {
|
|
|
+ getProducts (params) {
|
|
|
+ return getProducts({
|
|
|
+ tenant: this.tenant,
|
|
|
+ ...params
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getDevicesByAdmin (params) {
|
|
|
+ return getDevicesByAdmin({
|
|
|
+ tenant: this.tenant,
|
|
|
+ ...params
|
|
|
+ })
|
|
|
+ },
|
|
|
transform (data) {
|
|
|
return {
|
|
|
...data,
|
|
|
@@ -210,7 +226,7 @@ export default {
|
|
|
longitude: '',
|
|
|
latitude: '',
|
|
|
address: '',
|
|
|
- tenant: this.group.path
|
|
|
+ tenant: this.tenant
|
|
|
}
|
|
|
this.$refs.editDialog.show()
|
|
|
},
|