Commit 1bcbfa2a by YG8429

设备人工修改密码

parent f74cd1d4
...@@ -35,6 +35,15 @@ export function updateDevice(data) { ...@@ -35,6 +35,15 @@ export function updateDevice(data) {
}) })
} }
// 修改设备密码
export function updateDevicePassword(data) {
return request({
url: '/system/device/updateDevicePassword',
method: 'post',
data: data
})
}
// 删除设备信息 // 删除设备信息
export function delDevice(id) { export function delDevice(id) {
return request({ return request({
......
...@@ -87,6 +87,14 @@ ...@@ -87,6 +87,14 @@
v-hasPermi="['system:device:edit']" v-hasPermi="['system:device:edit']"
>关门 >关门
</el-button> </el-button>
<el-button v-if="scope.row.devType=='CCEE'"
size="mini"
type="text"
icon="el-icon-switch"
@click="handleUpdate(scope.row)"
v-hasPermi="['system:device:edit']"
>修改密码
</el-button>
<el-button v-if="scope.row.devType=='0001'" <el-button v-if="scope.row.devType=='0001'"
size="mini" size="mini"
type="text" type="text"
...@@ -114,17 +122,38 @@ ...@@ -114,17 +122,38 @@
:limit.sync="queryParams.pageSize" :limit.sync="queryParams.pageSize"
@pagination="getList" @pagination="getList"
/> />
</div> </div>
<selectDevice ref="select" :roomId="roomId" @ok="handleQuery"/> <selectDevice ref="select" :roomId="roomId" @ok="handleQuery"/>
</div> </div>
<!-- 修改密码对话框-->
<el-dialog :title="passwordTitle" :visible.sync="passwordOpen" :append-to-body="true" width="80%px" append-to-bod>
<el-form ref="passwordForm" :model="passwordForm" label-width="120px">
<el-form-item label="设备名称" prop="devName">
<el-input v-model="passwordForm.devName" :disabled="true" placeholder="请输入设备名称" />
</el-form-item>
<el-form-item label="设备ID" prop="devId">
<el-input v-model="passwordForm.devId" :disabled="true" placeholder="请输入设备ID" />
</el-form-item>
<el-form-item label="设备原密码" prop="devPsw">
<el-input v-model="passwordForm.devPsw" :disabled="true" placeholder="请输入设备密码" />
</el-form-item>
<el-form-item label="设备新密码" prop="newDevPsw">
<el-input v-model="passwordForm.newDevPsw" placeholder="请输入设备密码" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitPackForm">确 定</el-button>
<el-button @click="passwordCancel">取 消</el-button>
</div>
</el-dialog>
</el-drawer> </el-drawer>
</template> </template>
<script> <script>
import {listByRoom, openOrClose} from "@/api/system/device"; import { addDevice, getDevice, listByRoom, openOrClose, updateDevice, updateDevicePassword } from '@/api/system/device'
import { deleteRoomDevice } from "@/api/system/room"; import { deleteRoomDevice, getRoom } from '@/api/system/room'
import selectDevice from "./selectDevice"; import selectDevice from "./selectDevice";
import { insertPack } from '@/api/system/pack'
export default { export default {
name: "RoomDevice", name: "RoomDevice",
...@@ -132,6 +161,8 @@ export default { ...@@ -132,6 +161,8 @@ export default {
components: {selectDevice}, components: {selectDevice},
data() { data() {
return { return {
passwordTitle: "",
passwordOpen: false,
// 遮罩层 // 遮罩层
loading: true, loading: true,
// 选中数组 // 选中数组
...@@ -163,6 +194,7 @@ export default { ...@@ -163,6 +194,7 @@ export default {
}, },
// 表单参数 // 表单参数
form: {}, form: {},
passwordForm: {},
}; };
}, },
created() { created() {
...@@ -193,6 +225,7 @@ export default { ...@@ -193,6 +225,7 @@ export default {
} }
} }
}, },
methods: { methods: {
/** 查询设备信息列表 */ /** 查询设备信息列表 */
getList() { getList() {
...@@ -204,11 +237,32 @@ export default { ...@@ -204,11 +237,32 @@ export default {
this.loading = false; this.loading = false;
}); });
}, },
passwordReset() {
this.passwordForm = {
devName: null,
devId: null,
devPsw: null,
newDevPsw: null
};
this.resetForm("passwordForm");
},
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1;
this.getList(); this.getList();
}, },
passwordCancel() {
this.passwordOpen = false;
this.passwordReset();
},
handleUpdate(row) {
const id = row.id || this.ids
getDevice(id).then(response => {
this.passwordForm = response.data;
this.passwordOpen = true;
this.passwordTitle = "修改密码";
});
},
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.resetForm("queryForm"); this.resetForm("queryForm");
...@@ -246,6 +300,18 @@ export default { ...@@ -246,6 +300,18 @@ export default {
this.$modal.msgSuccess(msg); this.$modal.msgSuccess(msg);
}); });
}, },
//修改密码
submitPackForm() {
this.$refs["passwordForm"].validate(valid => {
if (valid) {
updateDevicePassword(this.passwordForm).then(response => {
this.$modal.msgSuccess("修改成功");
this.passwordOpen = false;
this.getList();
});
}
});
},
} }
} }
</script> </script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment