feat: 开站网元授权状态标签字典

This commit is contained in:
TsMask
2024-05-16 14:43:18 +08:00
parent 5be95a7af6
commit 7c54e372e5

View File

@@ -1,8 +1,9 @@
<script setup lang="ts"> <script setup lang="ts">
import { Modal, TableColumnsType, message } from 'ant-design-vue/lib'; import { Modal, TableColumnsType, message } from 'ant-design-vue/lib';
import { defineAsyncComponent, onMounted, reactive, ref, toRaw } from 'vue'; import { defineAsyncComponent, onMounted, reactive, ref } from 'vue';
import { fnToStepName, stepState } from '../hooks/useStep'; import { fnToStepName, stepState } from '../hooks/useStep';
import useI18n from '@/hooks/useI18n'; import useI18n from '@/hooks/useI18n';
import useDictStore from '@/store/modules/dict';
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants'; import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
import { import {
codeNeLicense, codeNeLicense,
@@ -11,10 +12,14 @@ import {
} from '@/api/ne/neLicense'; } from '@/api/ne/neLicense';
import saveAs from 'file-saver'; import saveAs from 'file-saver';
const { t } = useI18n(); const { t } = useI18n();
const { getDict } = useDictStore();
const UploadLicenseFile = defineAsyncComponent( const UploadLicenseFile = defineAsyncComponent(
() => import('../../../ne/neLicense/components/UploadLicenseFile.vue') () => import('../../../ne/neLicense/components/UploadLicenseFile.vue')
); );
/**字典数据-状态 */
let dictStatus = ref<DictType[]>([]);
/**表格字段列 */ /**表格字段列 */
let tableColumns = ref<TableColumnsType>([ let tableColumns = ref<TableColumnsType>([
{ {
@@ -99,8 +104,8 @@ function fnModalOpen() {
state.selectedRowKeys.includes(item.id) state.selectedRowKeys.includes(item.id)
); );
state.neLicenseList = neTypeArr; state.neLicenseList = neTypeArr;
}else{ } else {
state.neLicenseList = [] state.neLicenseList = [];
} }
state.visibleByLicenseFile = !state.visibleByLicenseFile; state.visibleByLicenseFile = !state.visibleByLicenseFile;
@@ -129,6 +134,10 @@ function fnRecordState() {
row.status = '1'; row.status = '1';
row.serialNum = res.data.sn; row.serialNum = res.data.sn;
row.expiryDate = res.data.expire; row.expiryDate = res.data.expire;
} else {
row.status = '0';
row.serialNum = '-';
row.expiryDate = '-';
} }
} }
message.success(t('common.operateOk'), 3); message.success(t('common.operateOk'), 3);
@@ -193,7 +202,7 @@ function fnGetList() {
if (state.selectedRowKeys.length > 0) { if (state.selectedRowKeys.length > 0) {
state.selectedRowKeys = []; state.selectedRowKeys = [];
} }
state.data = res.rows.filter(s => s.neType !== 'OMC');; state.data = res.rows.filter(s => s.neType !== 'OMC');
} }
state.loading = false; state.loading = false;
}); });
@@ -225,7 +234,14 @@ function fnStepNext(stepName: 'Done') {
} }
onMounted(() => { onMounted(() => {
fnGetList(); // 初始字典数据
getDict('ne_license_status')
.then(res => {
dictStatus.value = res;
})
.finally(() => {
fnGetList();
});
}); });
</script> </script>
@@ -249,6 +265,11 @@ onMounted(() => {
onChange: fnTableSelectedRowKeys, onChange: fnTableSelectedRowKeys,
}" }"
> >
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'status'">
<DictTag :options="dictStatus" :value="record.status" />
</template>
</template>
</a-table> </a-table>
<!-- 授权文件上传框 --> <!-- 授权文件上传框 -->