<template>
|
<a-form style="margin-top: 8px" >
|
<a-modal class="modelSize" title="配置传感器" destroyOnClose :visible="visible" @cancel="handleCancel">
|
<!-- <a-card :bordered="false" style="margin-top:24px"> -->
|
<div class="tableList">
|
<av-standard-table
|
:dataSource="dataSource"
|
:columns="columns"
|
:selectedRows="selectedRows"
|
@tableChange="handlerTableChange"
|
@selectChange="handlerSelectChange"
|
:paginationProps="pagination"
|
></av-standard-table>
|
</div>
|
<!-- </a-card> -->
|
<template slot="footer">
|
<a-button key="cancel" @click="handleCancel">
|
取消
|
</a-button>
|
<a-button key="forward" type="primary" @click="handleOk">
|
完成
|
</a-button>
|
</template>
|
</a-modal>
|
</a-form>
|
</template>
|
|
<script lang="ts">
|
|
import {
|
Component,
|
Prop,
|
Vue,
|
Emit,
|
Model,
|
Watch,
|
} from 'vue-property-decorator';
|
import {
|
State,
|
Mutation,
|
namespace,
|
} from 'vuex-class';
|
|
import { get, post } from "@/util/request";
|
|
@Component({
|
components: {},
|
})
|
export default class UpdateTaskForm extends Vue {
|
@Prop({
|
type: Boolean,
|
default: false,
|
|
})
|
|
// private tableLoading: boolean = false;
|
|
|
|
private visible!: boolean;
|
|
private pagination:any={
|
total:0,
|
current:1,
|
pageSize:6,
|
showSizeChanger:false,
|
showQuickJumper:false
|
}
|
|
private created(){
|
this.sensorData()
|
}
|
|
private dataSource: any[] = [];
|
|
// 列表标题
|
private columns: any[] = [
|
{
|
title: "名称",
|
dataIndex: "name"
|
},
|
|
{
|
title: "键值",
|
dataIndex: "key"
|
},
|
{
|
title: "下限值",
|
dataIndex: "lower"
|
},
|
{
|
title: "上限值",
|
dataIndex: 'upper'
|
},
|
{
|
title: "单位",
|
dataIndex: 'code'
|
},
|
{
|
title: "描述",
|
dataIndex: 'desc'
|
}
|
];
|
|
private defaultSelectedKeys:any;
|
private defaultCheckedKeys:any;
|
|
private replaceFields:any = {
|
children: 'child',
|
title: 'name',
|
}
|
|
private idList:any;
|
|
@Prop({
|
type: Object,
|
default() {
|
return {};
|
},
|
})
|
private record!: any;
|
|
private selectedRows: any[] = [];
|
|
private form: any = null;
|
|
private formVals: any = {
|
target: '0',
|
template: '0',
|
type: '1',
|
time: '',
|
frequency: 'month',
|
};
|
|
private currentStep: number = 0;
|
|
private formLayout = {
|
labelCol: {
|
span: 7,
|
},
|
wrapperCol: {
|
span: 13,
|
},
|
};
|
|
private onSelect(selectedKeys: any, info: any) {
|
|
}
|
private onCheck(checkedKeys: any, info: any) {
|
|
this.idList = checkedKeys
|
|
}
|
// 请求菜单列表数据
|
private sensorData() {
|
// this.tableLoading = true;
|
get('sensor/getAllSensor',{
|
current:1,
|
size:100,
|
orderType:0
|
})
|
.then((res) => {
|
this.dataSource =res.data.data.manageRoles
|
})
|
.catch((err)=>{
|
console.log(err);
|
})
|
}
|
|
private handleBackward(): void {
|
this.currentStep--;
|
}
|
|
private handleNext(): void {
|
this.form.validateFields((err: any, fieldsValue: any) => {
|
if (err) {
|
return;
|
}
|
this.formVals = { ...this.formVals, ...fieldsValue };
|
this.currentStep++;
|
});
|
}
|
|
private handlerSelectChange(arr1: any, arr2: any) {
|
this.selectedRows = arr2;
|
}
|
|
private handlerTableChange(pagination: any, filter: any, sorter: any): void {
|
}
|
|
private handleCancel(): void {
|
this.updateVisible(false);
|
this.defaultSelectedKeys = []
|
this.defaultCheckedKeys = []
|
}
|
|
private handleOk(): void {
|
post('manageRole/updateRoleMenu', {menuIds:this.idList,id:this.record.id}).then((res) => {
|
this.updateVisible(false);
|
this.onOk();
|
this.defaultSelectedKeys = []
|
this.defaultCheckedKeys = []
|
});
|
}
|
|
@Emit('ok')
|
private onOk() {
|
|
}
|
|
private updateVisible(visible: boolean): void {
|
this.$emit('update:visible', visible);
|
}
|
|
private mounted(): void {
|
this.currentStep = 0;
|
}
|
|
// @Watch('record', {
|
// immediate: true,
|
// deep: true,
|
// })
|
|
private recordChange(value: any, oldValue: any): void {
|
this.formVals = {
|
...value,
|
...this.formVals,
|
};
|
this.currentStep = 0;
|
}
|
|
}
|
</script>
|
|
<style lang="less">
|
.modelSize{
|
.ant-modal-content{
|
width: 800px;
|
height: 600px;
|
}
|
.ant-empty{
|
height: 190px;
|
}
|
}
|
</style>
|