feat: 接入实训接口调试参数配置
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
import { ptResetAsDefault, ptSaveAsDefault } from '@/api/pt/neConfig';
|
||||
import { stuPtNeConfigApply } from '@/api/pt/neConfigApply';
|
||||
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
|
||||
import useI18n from '@/hooks/useI18n';
|
||||
import { regExpIPv4, regExpIPv6, validURL } from '@/utils/regular-utils';
|
||||
import message from 'ant-design-vue/lib/message';
|
||||
|
||||
export default function useOptions() {
|
||||
const { t } = useI18n();
|
||||
@@ -76,7 +80,7 @@ export default function useOptions() {
|
||||
break;
|
||||
case 'bool':
|
||||
// filter: '{"0":"false", "1":"true"}'
|
||||
|
||||
|
||||
if (filter && filter.indexOf('{') === 1) {
|
||||
let filterJson: Record<string, any> = {};
|
||||
try {
|
||||
@@ -161,5 +165,56 @@ export default function useOptions() {
|
||||
return result;
|
||||
}
|
||||
|
||||
return { ruleVerification };
|
||||
/**保存网元下所有配置为示例配置 */
|
||||
function ptSaveConfig(neType: string) {
|
||||
ptSaveAsDefault(neType, '001').then(res => {
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
message.success({
|
||||
content: t('common.operateOk'),
|
||||
duration: 3,
|
||||
});
|
||||
} else {
|
||||
message.error({
|
||||
content: `${res.msg}`,
|
||||
duration: 3,
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**重置网元下所有配置 */
|
||||
function ptResetConfig(neType: string) {
|
||||
ptResetAsDefault(neType).then(res => {
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
message.success({
|
||||
content: t('common.operateOk'),
|
||||
duration: 3,
|
||||
});
|
||||
} else {
|
||||
message.error({
|
||||
content: `${res.msg}`,
|
||||
duration: 3,
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**配置下方应用申请和撤回 */
|
||||
function ptConfigApply(neType: string, status: string) {
|
||||
stuPtNeConfigApply({ neType, status }).then(res => {
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
message.success({
|
||||
content: t('common.operateOk'),
|
||||
duration: 3,
|
||||
});
|
||||
} else {
|
||||
message.error({
|
||||
content: `${res.msg}`,
|
||||
duration: 3,
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return { ruleVerification, ptSaveConfig, ptResetConfig, ptConfigApply };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user