|
|
@@ -20,7 +20,7 @@
|
|
|
<el-row>
|
|
|
<el-col :span="24">
|
|
|
<el-form-item label="授权类型:" prop="isPermanent">
|
|
|
- <el-radio-group v-model="form.isPermanent">
|
|
|
+ <el-radio-group v-model="form.isPermanent" @change="handleChange">
|
|
|
<el-radio :label="0">临时授权</el-radio>
|
|
|
<el-radio :label="1">长期授权</el-radio>
|
|
|
</el-radio-group>
|
|
|
@@ -30,7 +30,7 @@
|
|
|
<el-form-item label="授权有效期:" prop="validTime">
|
|
|
<el-date-picker
|
|
|
v-model="form.validTime"
|
|
|
- type="daterange"
|
|
|
+ type="datetimerange"
|
|
|
range-separator="至"
|
|
|
start-placeholder="开始日期"
|
|
|
end-placeholder="结束日期"
|
|
|
@@ -91,7 +91,6 @@
|
|
|
userInfo: {
|
|
|
postName: '',
|
|
|
},
|
|
|
- // datasource: [],
|
|
|
deviceOptions: [],
|
|
|
bindDeviceData: [],
|
|
|
};
|
|
|
@@ -193,45 +192,8 @@
|
|
|
|
|
|
},
|
|
|
methods: {
|
|
|
- async datasource({ page, limit, where, order }) {
|
|
|
- console.log(this.list, 'this.list');
|
|
|
- const res = await listDevice({ ...where, ...order, pageNum: page, size: limit });
|
|
|
- // 与已绑定设备对比,标记绑定状态
|
|
|
- if (res.list && this.list.length > 0) {
|
|
|
- console.log(this.list, 'this.list~~~');
|
|
|
- const bindDeviceIds = this.list.map(item => item.deviceId);
|
|
|
- console.log(bindDeviceIds, 'bindDeviceIds');
|
|
|
- res.list = res.list.map(item => ({
|
|
|
- ...item,
|
|
|
- isBind: bindDeviceIds.includes(item.id) ? true : false
|
|
|
- }));
|
|
|
- }
|
|
|
- console.log(res, 'res');
|
|
|
- return res;
|
|
|
- },
|
|
|
-
|
|
|
- bindUserDevice(row) {
|
|
|
- console.log(row, 'row');
|
|
|
- bindDevice({
|
|
|
- deviceId: row.id,
|
|
|
- userId: this.current.id,
|
|
|
- jobNumber: this.current.jobNumber,
|
|
|
- }).then(res => {
|
|
|
- console.log(res, 'res');
|
|
|
- this.$message({
|
|
|
- message: '绑定成功',
|
|
|
- type: 'success'
|
|
|
- });
|
|
|
- row.isBind = true;
|
|
|
-
|
|
|
- this.$emit('success');
|
|
|
- }).catch(err => {
|
|
|
- console.log(err, 'err');
|
|
|
- // this.$message({
|
|
|
- // message: '绑定失败',
|
|
|
- // type: 'error'
|
|
|
- // });
|
|
|
- })
|
|
|
+ handleChange(val) {
|
|
|
+ console.log('handleChange', val);
|
|
|
},
|
|
|
|
|
|
submitForm() {
|
|
|
@@ -274,7 +236,12 @@
|
|
|
visible(visible) {
|
|
|
console.log(visible, 'visible');
|
|
|
if (visible) {
|
|
|
-
|
|
|
+ if(this.deviceInfo) {
|
|
|
+ this.form.isPermanent = this.deviceInfo.isPermanent;
|
|
|
+ this.form.validStart = this.deviceInfo.validStart;
|
|
|
+ this.form.validEnd = this.deviceInfo.validEnd;
|
|
|
+ this.form.validTime = [this.deviceInfo.validStart, this.deviceInfo.validEnd];
|
|
|
+ }
|
|
|
} else {
|
|
|
this.$refs.form?.clearValidate();
|
|
|
this.form = { ...this.defaultForm };
|