feat: MML操作支持多条发送/文件上传到网元
This commit is contained in:
@@ -1,13 +1,16 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { reactive, ref, onMounted, toRaw } from 'vue';
|
import { reactive, ref, onMounted, toRaw } from 'vue';
|
||||||
import { PageContainer } from '@ant-design-vue/pro-layout';
|
import { PageContainer } from '@ant-design-vue/pro-layout';
|
||||||
import { message } from 'ant-design-vue/lib';
|
import { Modal, message } from 'ant-design-vue/lib';
|
||||||
import CodemirrorEdite from '@/components/CodemirrorEdite/index.vue';
|
import CodemirrorEdite from '@/components/CodemirrorEdite/index.vue';
|
||||||
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
|
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
|
||||||
import useNeInfoStore from '@/store/modules/neinfo';
|
import useNeInfoStore from '@/store/modules/neinfo';
|
||||||
import { regExpIPv4, regExpIPv6 } from '@/utils/regular-utils';
|
import { regExpIPv4, regExpIPv6 } from '@/utils/regular-utils';
|
||||||
import useI18n from '@/hooks/useI18n';
|
import useI18n from '@/hooks/useI18n';
|
||||||
import { getMMLByNE, sendMMlByNE } from '@/api/mmlManage/neOperate';
|
import { getMMLByNE, sendMMlByNE } from '@/api/mmlManage/neOperate';
|
||||||
|
import { transferToNeFile } from '@/api/mmlManage/neOperate';
|
||||||
|
import { uploadFileChunk } from '@/api/tool/file';
|
||||||
|
import { UploadRequestOption } from 'ant-design-vue/lib/vc-upload/interface';
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
/**网元参数 */
|
/**网元参数 */
|
||||||
@@ -48,6 +51,7 @@ let state: StateType = reactive({
|
|||||||
param: [],
|
param: [],
|
||||||
},
|
},
|
||||||
from: {
|
from: {
|
||||||
|
uploadLoading: false,
|
||||||
sendLoading: false,
|
sendLoading: false,
|
||||||
},
|
},
|
||||||
autoCompleteValue: '',
|
autoCompleteValue: '',
|
||||||
@@ -88,7 +92,7 @@ function fnSendMML() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let cmdStr = '';
|
let cmdArr: string[] = [];
|
||||||
const operation = state.mmlSelect.operation;
|
const operation = state.mmlSelect.operation;
|
||||||
const object = state.mmlSelect.object;
|
const object = state.mmlSelect.object;
|
||||||
// 根据参数取值
|
// 根据参数取值
|
||||||
@@ -126,6 +130,7 @@ function fnSendMML() {
|
|||||||
|
|
||||||
// 拼装命令
|
// 拼装命令
|
||||||
const argsStr = argsArr.join(',');
|
const argsStr = argsArr.join(',');
|
||||||
|
let cmdStr = '';
|
||||||
if (object && argsStr) {
|
if (object && argsStr) {
|
||||||
cmdStr = `${operation} ${object} ${argsStr}`;
|
cmdStr = `${operation} ${object} ${argsStr}`;
|
||||||
} else if (object) {
|
} else if (object) {
|
||||||
@@ -133,35 +138,76 @@ function fnSendMML() {
|
|||||||
} else {
|
} else {
|
||||||
cmdStr = `${operation} ${argsStr}`;
|
cmdStr = `${operation} ${argsStr}`;
|
||||||
}
|
}
|
||||||
cmdStr = cmdStr.trim();
|
cmdArr = [cmdStr.trim()];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cmdStr) {
|
if (cmdArr.length > 0) {
|
||||||
state.autoCompleteValue = cmdStr;
|
state.autoCompleteValue = cmdArr[0];
|
||||||
} else {
|
} else {
|
||||||
let value = state.autoCompleteValue;
|
let value = state.autoCompleteValue;
|
||||||
if (value.indexOf('\n') !== -1) {
|
if (value.indexOf('\n') !== -1) {
|
||||||
value = value.replace(/(\r\n|\n)/g, ';');
|
value = value.replace(/(\r\n|\n)/g, ';');
|
||||||
}
|
}
|
||||||
cmdStr = value;
|
cmdArr = value.split(';');
|
||||||
}
|
}
|
||||||
|
|
||||||
// 发送
|
// 发送
|
||||||
state.mmlCmdLog += `${cmdStr}\n`;
|
state.mmlCmdLog += `${cmdArr.join('\n')}\n`;
|
||||||
state.from.sendLoading = true;
|
state.from.sendLoading = true;
|
||||||
const [neType, neId] = state.neType;
|
const [neType, neId] = state.neType;
|
||||||
sendMMlByNE(neType, neId, cmdStr).then(res => {
|
sendMMlByNE(neType, neId, cmdArr).then(res => {
|
||||||
state.from.sendLoading = false;
|
state.from.sendLoading = false;
|
||||||
if (res.code === RESULT_CODE_SUCCESS) {
|
if (res.code === RESULT_CODE_SUCCESS) {
|
||||||
let resultStr = res.data;
|
let resultArr = res.data;
|
||||||
resultStr = resultStr.replace(/(\r\n|\n)/g, '\n');
|
for (const str of resultArr) {
|
||||||
state.mmlCmdLog += `${resultStr}\n`;
|
const logStr = str.replace(/(\r\n|\n)/g, '\n');
|
||||||
|
state.mmlCmdLog += `${logStr}\n`;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
state.mmlCmdLog += `${res.msg}\n`;
|
state.mmlCmdLog += `${res.msg}\n`;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**上传变更 */
|
||||||
|
function fnUpload(up: UploadRequestOption, name: string) {
|
||||||
|
Modal.confirm({
|
||||||
|
title: t('common.tipTitle'),
|
||||||
|
content: t('views.mmlManage.uploadFileTip'),
|
||||||
|
onOk() {
|
||||||
|
const hide = message.loading(t('common.loading'), 0);
|
||||||
|
state.from.uploadLoading = true;
|
||||||
|
uploadFileChunk(up.file as File, 5, 'import')
|
||||||
|
.then(res => {
|
||||||
|
// 文件上传
|
||||||
|
if (res.code === RESULT_CODE_SUCCESS) {
|
||||||
|
const [neType, neId] = state.neType;
|
||||||
|
return transferToNeFile({
|
||||||
|
uploadPath: res.data.fileName,
|
||||||
|
neType: neType,
|
||||||
|
neId: neId,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then(res => {
|
||||||
|
// 文件转存
|
||||||
|
if (res.code === RESULT_CODE_SUCCESS) {
|
||||||
|
message.success(t('views.mmlManage.uploadFileOk'), 3);
|
||||||
|
state.from[name] = res.data;
|
||||||
|
} else {
|
||||||
|
message.error(res.msg, 3);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
state.from.uploadLoading = false;
|
||||||
|
hide();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**规则校验 */
|
/**规则校验 */
|
||||||
function ruleVerification(
|
function ruleVerification(
|
||||||
row: Record<string, any>,
|
row: Record<string, any>,
|
||||||
@@ -588,6 +634,29 @@ onMounted(() => {
|
|||||||
{{ k }}
|
{{ k }}
|
||||||
</a-select-option>
|
</a-select-option>
|
||||||
</a-select>
|
</a-select>
|
||||||
|
<a-input-group compact v-else-if="item.type === 'file'">
|
||||||
|
<a-input
|
||||||
|
v-model:value="state.from[item.name]"
|
||||||
|
style="width: calc(100% - 32px)"
|
||||||
|
/>
|
||||||
|
<a-upload
|
||||||
|
name="file"
|
||||||
|
list-type="text"
|
||||||
|
:accept="item.filter"
|
||||||
|
:max-count="1"
|
||||||
|
:show-upload-list="false"
|
||||||
|
:custom-request="v => fnUpload(v, item.name)"
|
||||||
|
>
|
||||||
|
<a-button
|
||||||
|
type="primary"
|
||||||
|
:loading="state.from.uploadLoading"
|
||||||
|
>
|
||||||
|
<template #icon>
|
||||||
|
<UploadOutlined />
|
||||||
|
</template>
|
||||||
|
</a-button>
|
||||||
|
</a-upload>
|
||||||
|
</a-input-group>
|
||||||
<a-input
|
<a-input
|
||||||
v-else
|
v-else
|
||||||
v-model:value="state.from[item.name]"
|
v-model:value="state.from[item.name]"
|
||||||
|
|||||||
@@ -1,13 +1,16 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { reactive, ref, onMounted, toRaw } from 'vue';
|
import { reactive, ref, onMounted, toRaw } from 'vue';
|
||||||
import { PageContainer } from '@ant-design-vue/pro-layout';
|
import { PageContainer } from '@ant-design-vue/pro-layout';
|
||||||
import { message } from 'ant-design-vue/lib';
|
import { Modal, message } from 'ant-design-vue/lib';
|
||||||
import CodemirrorEdite from '@/components/CodemirrorEdite/index.vue';
|
import CodemirrorEdite from '@/components/CodemirrorEdite/index.vue';
|
||||||
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
|
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
|
||||||
import useNeInfoStore from '@/store/modules/neinfo';
|
import useNeInfoStore from '@/store/modules/neinfo';
|
||||||
import { regExpIPv4, regExpIPv6 } from '@/utils/regular-utils';
|
import { regExpIPv4, regExpIPv6 } from '@/utils/regular-utils';
|
||||||
import useI18n from '@/hooks/useI18n';
|
import useI18n from '@/hooks/useI18n';
|
||||||
import { getMMLByOMC, sendMMlByOMC } from '@/api/mmlManage/omcOperate';
|
import { getMMLByOMC, sendMMlByOMC } from '@/api/mmlManage/omcOperate';
|
||||||
|
import { transferToNeFile } from '@/api/mmlManage/neOperate';
|
||||||
|
import { uploadFileChunk } from '@/api/tool/file';
|
||||||
|
import { UploadRequestOption } from 'ant-design-vue/lib/vc-upload/interface';
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
/**网元参数 */
|
/**网元参数 */
|
||||||
@@ -45,6 +48,7 @@ let state: StateType = reactive({
|
|||||||
param: [],
|
param: [],
|
||||||
},
|
},
|
||||||
from: {
|
from: {
|
||||||
|
uploadLoading: false,
|
||||||
sendLoading: false,
|
sendLoading: false,
|
||||||
},
|
},
|
||||||
autoCompleteValue: '',
|
autoCompleteValue: '',
|
||||||
@@ -85,7 +89,7 @@ function fnSendMML() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let cmdStr = '';
|
let cmdArr: string[] = [];
|
||||||
const operation = state.mmlSelect.operation;
|
const operation = state.mmlSelect.operation;
|
||||||
const object = state.mmlSelect.object;
|
const object = state.mmlSelect.object;
|
||||||
// 根据参数取值
|
// 根据参数取值
|
||||||
@@ -123,6 +127,7 @@ function fnSendMML() {
|
|||||||
|
|
||||||
// 拼装命令
|
// 拼装命令
|
||||||
const argsStr = argsArr.join(',');
|
const argsStr = argsArr.join(',');
|
||||||
|
let cmdStr = '';
|
||||||
if (object && argsStr) {
|
if (object && argsStr) {
|
||||||
cmdStr = `${operation} ${object}:${argsStr}`;
|
cmdStr = `${operation} ${object}:${argsStr}`;
|
||||||
} else if (object) {
|
} else if (object) {
|
||||||
@@ -130,34 +135,74 @@ function fnSendMML() {
|
|||||||
} else {
|
} else {
|
||||||
cmdStr = `${operation} ${argsStr}`;
|
cmdStr = `${operation} ${argsStr}`;
|
||||||
}
|
}
|
||||||
cmdStr = cmdStr.trim();
|
cmdArr = [cmdStr.trim()];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cmdStr) {
|
if (cmdArr.length > 0) {
|
||||||
state.autoCompleteValue = cmdStr;
|
state.autoCompleteValue = cmdArr[0];
|
||||||
} else {
|
} else {
|
||||||
let value = state.autoCompleteValue;
|
let value = state.autoCompleteValue;
|
||||||
if (value.indexOf('\n') !== -1) {
|
if (value.indexOf('\n') !== -1) {
|
||||||
value = value.replace(/(\r\n|\n)/g, ';');
|
value = value.replace(/(\r\n|\n)/g, ';');
|
||||||
}
|
}
|
||||||
cmdStr = value;
|
cmdArr = value.split(';');
|
||||||
}
|
}
|
||||||
|
|
||||||
// 发送
|
// 发送
|
||||||
state.mmlCmdLog += `${cmdStr}\n`;
|
state.mmlCmdLog += `${cmdArr.join('\n')}\n`;
|
||||||
state.from.sendLoading = true;
|
state.from.sendLoading = true;
|
||||||
sendMMlByOMC(state.neId, cmdStr).then(res => {
|
sendMMlByOMC(state.neId, cmdArr).then(res => {
|
||||||
state.from.sendLoading = false;
|
state.from.sendLoading = false;
|
||||||
if (res.code === RESULT_CODE_SUCCESS) {
|
if (res.code === RESULT_CODE_SUCCESS) {
|
||||||
let resultStr = res.data;
|
let resultArr = res.data;
|
||||||
resultStr = resultStr.replace(/(\r\n|\n)/g, '\n');
|
for (const str of resultArr) {
|
||||||
state.mmlCmdLog += `${resultStr}\n`;
|
const logStr = str.replace(/(\r\n|\n)/g, '\n');
|
||||||
|
state.mmlCmdLog += `${logStr}\n`;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
state.mmlCmdLog += `${res.msg}\n`;
|
state.mmlCmdLog += `${res.msg}\n`;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**上传变更 */
|
||||||
|
function fnUpload(up: UploadRequestOption, name: string) {
|
||||||
|
Modal.confirm({
|
||||||
|
title: t('common.tipTitle'),
|
||||||
|
content: t('views.mmlManage.uploadFileTip'),
|
||||||
|
onOk() {
|
||||||
|
const hide = message.loading(t('common.loading'), 0);
|
||||||
|
state.from.uploadLoading = true;
|
||||||
|
uploadFileChunk(up.file as File, 5, 'import')
|
||||||
|
.then(res => {
|
||||||
|
// 文件上传
|
||||||
|
if (res.code === RESULT_CODE_SUCCESS) {
|
||||||
|
return transferToNeFile({
|
||||||
|
uploadPath: res.data.fileName,
|
||||||
|
neType: 'OMC',
|
||||||
|
neId: state.neId,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then(res => {
|
||||||
|
// 文件转存
|
||||||
|
if (res.code === RESULT_CODE_SUCCESS) {
|
||||||
|
message.success(t('views.mmlManage.uploadFileOk'), 3);
|
||||||
|
state.from[name] = res.data;
|
||||||
|
} else {
|
||||||
|
message.error(res.msg, 3);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
state.from.uploadLoading = false;
|
||||||
|
hide();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**规则校验 */
|
/**规则校验 */
|
||||||
function ruleVerification(
|
function ruleVerification(
|
||||||
row: Record<string, any>,
|
row: Record<string, any>,
|
||||||
@@ -563,6 +608,29 @@ onMounted(() => {
|
|||||||
{{ k }}
|
{{ k }}
|
||||||
</a-select-option>
|
</a-select-option>
|
||||||
</a-select>
|
</a-select>
|
||||||
|
<a-input-group compact v-else-if="item.type === 'file'">
|
||||||
|
<a-input
|
||||||
|
v-model:value="state.from[item.name]"
|
||||||
|
style="width: calc(100% - 32px)"
|
||||||
|
/>
|
||||||
|
<a-upload
|
||||||
|
name="file"
|
||||||
|
list-type="text"
|
||||||
|
:accept="item.filter"
|
||||||
|
:max-count="1"
|
||||||
|
:show-upload-list="false"
|
||||||
|
:custom-request="v => fnUpload(v, item.name)"
|
||||||
|
>
|
||||||
|
<a-button
|
||||||
|
type="primary"
|
||||||
|
:loading="state.from.uploadLoading"
|
||||||
|
>
|
||||||
|
<template #icon>
|
||||||
|
<UploadOutlined />
|
||||||
|
</template>
|
||||||
|
</a-button>
|
||||||
|
</a-upload>
|
||||||
|
</a-input-group>
|
||||||
<a-input
|
<a-input
|
||||||
v-else
|
v-else
|
||||||
v-model:value="state.from[item.name]"
|
v-model:value="state.from[item.name]"
|
||||||
|
|||||||
@@ -1,13 +1,16 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { reactive, ref, onMounted, toRaw } from 'vue';
|
import { reactive, ref, onMounted, toRaw } from 'vue';
|
||||||
import { PageContainer } from '@ant-design-vue/pro-layout';
|
import { PageContainer } from '@ant-design-vue/pro-layout';
|
||||||
import { message } from 'ant-design-vue/lib';
|
import { Modal, message } from 'ant-design-vue/lib';
|
||||||
import CodemirrorEdite from '@/components/CodemirrorEdite/index.vue';
|
import CodemirrorEdite from '@/components/CodemirrorEdite/index.vue';
|
||||||
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
|
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
|
||||||
import useNeInfoStore from '@/store/modules/neinfo';
|
import useNeInfoStore from '@/store/modules/neinfo';
|
||||||
import { regExpIPv4, regExpIPv6 } from '@/utils/regular-utils';
|
import { regExpIPv4, regExpIPv6 } from '@/utils/regular-utils';
|
||||||
import useI18n from '@/hooks/useI18n';
|
import useI18n from '@/hooks/useI18n';
|
||||||
import { getMMLByUDM, sendMMlByUDM } from '@/api/mmlManage/udmOperate';
|
import { getMMLByUDM, sendMMlByUDM } from '@/api/mmlManage/udmOperate';
|
||||||
|
import { UploadRequestOption } from 'ant-design-vue/lib/vc-upload/interface';
|
||||||
|
import { uploadFileChunk } from '@/api/tool/file';
|
||||||
|
import { transferToNeFile } from '@/api/mmlManage/neOperate';
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
/**网元参数 */
|
/**网元参数 */
|
||||||
@@ -45,6 +48,7 @@ let state: StateType = reactive({
|
|||||||
param: [],
|
param: [],
|
||||||
},
|
},
|
||||||
from: {
|
from: {
|
||||||
|
uploadLoading: false,
|
||||||
sendLoading: false,
|
sendLoading: false,
|
||||||
},
|
},
|
||||||
autoCompleteValue: '',
|
autoCompleteValue: '',
|
||||||
@@ -85,7 +89,7 @@ function fnSendMML() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let cmdStr = '';
|
let cmdArr: string[] = [];
|
||||||
const operation = state.mmlSelect.operation;
|
const operation = state.mmlSelect.operation;
|
||||||
const object = state.mmlSelect.object;
|
const object = state.mmlSelect.object;
|
||||||
// 根据参数取值
|
// 根据参数取值
|
||||||
@@ -123,6 +127,7 @@ function fnSendMML() {
|
|||||||
|
|
||||||
// 拼装命令
|
// 拼装命令
|
||||||
const argsStr = argsArr.join(',');
|
const argsStr = argsArr.join(',');
|
||||||
|
let cmdStr = '';
|
||||||
if (object && argsStr) {
|
if (object && argsStr) {
|
||||||
cmdStr = `${operation} ${object}:${argsStr}`;
|
cmdStr = `${operation} ${object}:${argsStr}`;
|
||||||
} else if (object) {
|
} else if (object) {
|
||||||
@@ -130,34 +135,74 @@ function fnSendMML() {
|
|||||||
} else {
|
} else {
|
||||||
cmdStr = `${operation} ${argsStr}`;
|
cmdStr = `${operation} ${argsStr}`;
|
||||||
}
|
}
|
||||||
cmdStr = cmdStr.trim();
|
cmdArr = [cmdStr.trim()];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cmdStr) {
|
if (cmdArr.length > 0) {
|
||||||
state.autoCompleteValue = cmdStr;
|
state.autoCompleteValue = cmdArr[0];
|
||||||
} else {
|
} else {
|
||||||
let value = state.autoCompleteValue;
|
let value = state.autoCompleteValue;
|
||||||
if (value.indexOf('\n') !== -1) {
|
if (value.indexOf('\n') !== -1) {
|
||||||
value = value.replace(/(\r\n|\n)/g, ';');
|
value = value.replace(/(\r\n|\n)/g, ';');
|
||||||
}
|
}
|
||||||
cmdStr = value;
|
cmdArr = value.split(';');
|
||||||
}
|
}
|
||||||
|
|
||||||
// 发送
|
// 发送
|
||||||
state.mmlCmdLog += `${cmdStr}\n`;
|
state.mmlCmdLog += `${cmdArr.join('\n')}\n`;
|
||||||
state.from.sendLoading = true;
|
state.from.sendLoading = true;
|
||||||
sendMMlByUDM(state.neId, cmdStr).then(res => {
|
sendMMlByUDM(state.neId, cmdArr).then(res => {
|
||||||
state.from.sendLoading = false;
|
state.from.sendLoading = false;
|
||||||
if (res.code === RESULT_CODE_SUCCESS) {
|
if (res.code === RESULT_CODE_SUCCESS) {
|
||||||
let resultStr = res.data;
|
let resultArr = res.data;
|
||||||
resultStr = resultStr.replace(/(\r\n|\n)/g, '\n');
|
for (const str of resultArr) {
|
||||||
state.mmlCmdLog += `${resultStr}\n`;
|
const logStr = str.replace(/(\r\n|\n)/g, '\n');
|
||||||
|
state.mmlCmdLog += `${logStr}\n`;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
state.mmlCmdLog += `${res.msg}\n`;
|
state.mmlCmdLog += `${res.msg}\n`;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**上传变更 */
|
||||||
|
function fnUpload(up: UploadRequestOption, name: string) {
|
||||||
|
Modal.confirm({
|
||||||
|
title: t('common.tipTitle'),
|
||||||
|
content: t('views.mmlManage.uploadFileTip'),
|
||||||
|
onOk() {
|
||||||
|
const hide = message.loading(t('common.loading'), 0);
|
||||||
|
state.from.uploadLoading = true;
|
||||||
|
uploadFileChunk(up.file as File, 5, 'import')
|
||||||
|
.then(res => {
|
||||||
|
// 文件上传
|
||||||
|
if (res.code === RESULT_CODE_SUCCESS) {
|
||||||
|
return transferToNeFile({
|
||||||
|
uploadPath: res.data.fileName,
|
||||||
|
neType: 'UDM',
|
||||||
|
neId: state.neId,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then(res => {
|
||||||
|
// 文件转存
|
||||||
|
if (res.code === RESULT_CODE_SUCCESS) {
|
||||||
|
message.success(t('views.mmlManage.uploadFileOk'), 3);
|
||||||
|
state.from[name] = res.data;
|
||||||
|
} else {
|
||||||
|
message.error(res.msg, 3);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
state.from.uploadLoading = false;
|
||||||
|
hide();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**规则校验 */
|
/**规则校验 */
|
||||||
function ruleVerification(
|
function ruleVerification(
|
||||||
row: Record<string, any>,
|
row: Record<string, any>,
|
||||||
@@ -563,6 +608,29 @@ onMounted(() => {
|
|||||||
{{ k }}
|
{{ k }}
|
||||||
</a-select-option>
|
</a-select-option>
|
||||||
</a-select>
|
</a-select>
|
||||||
|
<a-input-group compact v-else-if="item.type === 'file'">
|
||||||
|
<a-input
|
||||||
|
v-model:value="state.from[item.name]"
|
||||||
|
style="width: calc(100% - 32px)"
|
||||||
|
/>
|
||||||
|
<a-upload
|
||||||
|
name="file"
|
||||||
|
list-type="text"
|
||||||
|
:accept="item.filter"
|
||||||
|
:max-count="1"
|
||||||
|
:show-upload-list="false"
|
||||||
|
:custom-request="v => fnUpload(v, item.name)"
|
||||||
|
>
|
||||||
|
<a-button
|
||||||
|
type="primary"
|
||||||
|
:loading="state.from.uploadLoading"
|
||||||
|
>
|
||||||
|
<template #icon>
|
||||||
|
<UploadOutlined />
|
||||||
|
</template>
|
||||||
|
</a-button>
|
||||||
|
</a-upload>
|
||||||
|
</a-input-group>
|
||||||
<a-input
|
<a-input
|
||||||
v-else
|
v-else
|
||||||
v-model:value="state.from[item.name]"
|
v-model:value="state.from[item.name]"
|
||||||
|
|||||||
Reference in New Issue
Block a user