|
@@ -1,7 +1,7 @@
|
|
|
<template>
|
|
|
<div class="system-edit-dic-container">
|
|
|
<el-dialog :title="(ruleForm.id !== 0 ? '修改' : '添加') + '设备'" v-model="isShowDialog" width="769px">
|
|
|
- <el-form :model="ruleForm" ref="formRef" :rules="rules" label-width="110px">
|
|
|
+ <el-form v-loading="loading" :model="ruleForm" ref="formRef" :rules="rules" label-width="110px">
|
|
|
<el-form-item label="设备标识" prop="key">
|
|
|
<el-input v-model="ruleForm.key" placeholder="请输入设备标识" :disabled="ruleForm.id" />
|
|
|
</el-form-item>
|
|
@@ -160,6 +160,7 @@ export default defineComponent({
|
|
|
setup(prop, { emit }) {
|
|
|
const formRef = ref<HTMLElement | null>(null);
|
|
|
const tagRef = ref<HTMLElement | null>(null);
|
|
|
+ const loading = ref(false);
|
|
|
const mapRef = ref();
|
|
|
const certList = ref<any[]>([])
|
|
|
const state = reactive<DicState>({
|
|
@@ -190,7 +191,7 @@ export default defineComponent({
|
|
|
mapRef.value.openDialog(row);
|
|
|
}
|
|
|
// 打开弹窗
|
|
|
- const openDialog = (row: RuleFormState | null) => {
|
|
|
+ const openDialog = (row: any) => {
|
|
|
resetForm();
|
|
|
|
|
|
apiSystem.getInfoByKey('sys.device.phone.limit').then((res: any) => {
|
|
@@ -211,12 +212,15 @@ export default defineComponent({
|
|
|
|
|
|
|
|
|
if (row) {
|
|
|
- state.ruleForm = row;
|
|
|
- state.ruleForm.tags = row.tags || [];
|
|
|
- state.phone = row.extensionInfo ? JSON.parse(row.extensionInfo).phone : [];
|
|
|
- state.certificate = row.extensionInfo ? JSON.parse(row.extensionInfo).certificate : [];
|
|
|
- state.intro = row.extensionInfo ? JSON.parse(row.extensionInfo).intro : "";
|
|
|
- productKeyChange(row.productKey as string)
|
|
|
+ loading.value = true
|
|
|
+ api.instance.detail(row.key).then((res: any) => {
|
|
|
+ state.ruleForm = res.data;
|
|
|
+ state.ruleForm.tags = res.data.tags || [];
|
|
|
+ state.phone = res.data.extensionInfo ? JSON.parse(res.data.extensionInfo).phone : [];
|
|
|
+ state.certificate = res.data.extensionInfo ? JSON.parse(res.data.extensionInfo).certificate : [];
|
|
|
+ state.intro = res.data.extensionInfo ? JSON.parse(res.data.extensionInfo).intro : "";
|
|
|
+ state.product = res.data.product
|
|
|
+ }).finally(() => loading.value = false)
|
|
|
}
|
|
|
state.isShowDialog = true;
|
|
|
};
|
|
@@ -303,11 +307,12 @@ export default defineComponent({
|
|
|
api.product.detail(productKey).then((res: any) => {
|
|
|
const { authType, authUser, authPasswd, accessToken, certificateId } = res.data
|
|
|
state.product = res.data
|
|
|
+ // 认证方式使用设备的,不需要产品的来覆盖
|
|
|
state.ruleForm.authType = authType
|
|
|
- state.ruleForm.authUser = authUser
|
|
|
- state.ruleForm.authPasswd = authPasswd
|
|
|
- state.ruleForm.accessToken = accessToken
|
|
|
- state.ruleForm.certificateId = certificateId
|
|
|
+ // state.ruleForm.authUser = authUser
|
|
|
+ // state.ruleForm.authPasswd = authPasswd
|
|
|
+ // state.ruleForm.accessToken = accessToken
|
|
|
+ // state.ruleForm.certificateId = certificateId
|
|
|
})
|
|
|
}
|
|
|
|
|
@@ -319,6 +324,7 @@ export default defineComponent({
|
|
|
}
|
|
|
|
|
|
return {
|
|
|
+ loading,
|
|
|
certList,
|
|
|
productKeyChange,
|
|
|
tagRef,
|