fix: 参数配置列表编辑切换属性回显错误
This commit is contained in:
@@ -9,11 +9,7 @@ import { reactive, toRaw } from 'vue';
|
|||||||
* @param param 父级传入 {t, treeState, ruleVerification}
|
* @param param 父级传入 {t, treeState, ruleVerification}
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
export default function useConfigList({
|
export default function useConfigList({ t, treeState, ruleVerification }: any) {
|
||||||
t,
|
|
||||||
treeState,
|
|
||||||
ruleVerification,
|
|
||||||
}: any) {
|
|
||||||
/**单列表状态类型 */
|
/**单列表状态类型 */
|
||||||
type ListStateType = {
|
type ListStateType = {
|
||||||
/**紧凑型 */
|
/**紧凑型 */
|
||||||
@@ -24,6 +20,8 @@ export default function useConfigList({
|
|||||||
data: Record<string, any>[];
|
data: Record<string, any>[];
|
||||||
/**编辑行记录 */
|
/**编辑行记录 */
|
||||||
editRecord: Record<string, any>;
|
editRecord: Record<string, any>;
|
||||||
|
/**确认提交等待 */
|
||||||
|
confirmLoading: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**单列表状态 */
|
/**单列表状态 */
|
||||||
@@ -44,6 +42,7 @@ export default function useConfigList({
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
data: [],
|
data: [],
|
||||||
|
confirmLoading: false,
|
||||||
editRecord: {},
|
editRecord: {},
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -54,11 +53,13 @@ export default function useConfigList({
|
|||||||
|
|
||||||
/**单列表编辑关闭 */
|
/**单列表编辑关闭 */
|
||||||
function listEditClose() {
|
function listEditClose() {
|
||||||
|
listState.confirmLoading = false;
|
||||||
listState.editRecord = {};
|
listState.editRecord = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**单列表编辑确认 */
|
/**单列表编辑确认 */
|
||||||
function listEditOk() {
|
function listEditOk() {
|
||||||
|
if (listState.confirmLoading) return;
|
||||||
const from = toRaw(listState.editRecord);
|
const from = toRaw(listState.editRecord);
|
||||||
// 检查规则
|
// 检查规则
|
||||||
const [ok, msg] = ruleVerification(from);
|
const [ok, msg] = ruleVerification(from);
|
||||||
@@ -71,6 +72,7 @@ export default function useConfigList({
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 发送
|
// 发送
|
||||||
|
listState.confirmLoading = true;
|
||||||
const hide = message.loading(t('common.loading'), 0);
|
const hide = message.loading(t('common.loading'), 0);
|
||||||
editPtNeConfigData({
|
editPtNeConfigData({
|
||||||
neType: treeState.neType,
|
neType: treeState.neType,
|
||||||
@@ -103,6 +105,7 @@ export default function useConfigList({
|
|||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
hide();
|
hide();
|
||||||
|
listState.confirmLoading = false;
|
||||||
listState.editRecord = {};
|
listState.editRecord = {};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import {
|
|||||||
import useNeOptions from '@/views/ne/neInfo/hooks/useNeOptions';
|
import useNeOptions from '@/views/ne/neInfo/hooks/useNeOptions';
|
||||||
import useI18n from '@/hooks/useI18n';
|
import useI18n from '@/hooks/useI18n';
|
||||||
import { OptionsType, WS } from '@/plugins/ws-websocket';
|
import { OptionsType, WS } from '@/plugins/ws-websocket';
|
||||||
|
import { hasRoles } from '@/plugins/auth-user';
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const { fnNeRestart, fnNeStop, fnNeLogFile } = useNeOptions();
|
const { fnNeRestart, fnNeStop, fnNeLogFile } = useNeOptions();
|
||||||
const ws = new WS();
|
const ws = new WS();
|
||||||
@@ -78,6 +79,9 @@ const graphNodeMenu = new Menu({
|
|||||||
if (!neState) {
|
if (!neState) {
|
||||||
return `<div><span>${label || id}</span></div>`;
|
return `<div><span>${label || id}</span></div>`;
|
||||||
}
|
}
|
||||||
|
if (hasRoles(['student'])) {
|
||||||
|
return '学生2024';
|
||||||
|
}
|
||||||
return `
|
return `
|
||||||
<div
|
<div
|
||||||
style="
|
style="
|
||||||
@@ -133,6 +137,16 @@ const graphNodeTooltip = new Tooltip({
|
|||||||
if (!neState) {
|
if (!neState) {
|
||||||
return `<div><span>${label || id}</span></div>`;
|
return `<div><span>${label || id}</span></div>`;
|
||||||
}
|
}
|
||||||
|
let notStudentInfo = '';
|
||||||
|
if (hasRoles(['teacher', 'admin'])) {
|
||||||
|
notStudentInfo = `
|
||||||
|
<div><strong>${t('views.monitor.topology.serialNum')}:</strong><span>
|
||||||
|
${neState.sn ?? '--'}
|
||||||
|
</span></div>
|
||||||
|
<div><strong>${t('views.monitor.topology.expiryDate')}:</strong><span>
|
||||||
|
${neState.expire ?? '--'}
|
||||||
|
</span></div> `;
|
||||||
|
}
|
||||||
return `
|
return `
|
||||||
<div
|
<div
|
||||||
style="
|
style="
|
||||||
@@ -160,12 +174,7 @@ const graphNodeTooltip = new Tooltip({
|
|||||||
<div><strong>${t('views.monitor.topology.version')}:</strong><span>
|
<div><strong>${t('views.monitor.topology.version')}:</strong><span>
|
||||||
${neState.version ?? '--'}
|
${neState.version ?? '--'}
|
||||||
</span></div>
|
</span></div>
|
||||||
<div><strong>${t('views.monitor.topology.serialNum')}:</strong><span>
|
${notStudentInfo}
|
||||||
${neState.sn ?? '--'}
|
|
||||||
</span></div>
|
|
||||||
<div><strong>${t('views.monitor.topology.expiryDate')}:</strong><span>
|
|
||||||
${neState.expire ?? '--'}
|
|
||||||
</span></div>
|
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user