@@ -116,10 +61,9 @@ defineExpose({
allow-clear
show-search
style="width: 220px"
- :options="availableOptions(index)"
+ :options="props.availableOptions(index)"
:filter-option="filterOption"
:placeholder="$t('license.selectNe')"
- @change="handleChange"
/>
-
+
- option.label.toLowerCase().includes(input.toLowerCase()),
- },
- },
+ // {
+ // fieldName: 'neList',
+ // label: $t('license.neList'),
+ // component: 'Select',
+ // componentProps: {
+ // allowClear: true,
+ // mode: 'multiple',
+ // options: getDictOptions(DICT_TYPE.LIC_NE_LIST, 'number'),
+ // showSearch: true,
+ // filterOption: (input: string, option: any) =>
+ // option.label.toLowerCase().includes(input.toLowerCase()),
+ // },
+ // },
// {
// fieldName: 'userNumber',
// label: $t('license.userNumber'),
@@ -353,15 +353,15 @@ export function useGridFormSchema(): VbenFormSchema[] {
// allowClear: true,
// },
// },
- {
- fieldName: 'applicationTime',
- label: $t('license.applicationTime'),
- component: 'RangePicker',
- componentProps: {
- ...getRangePickerDefaultProps(),
- allowClear: true,
- },
- },
+ // {
+ // fieldName: 'applicationTime',
+ // label: $t('license.applicationTime'),
+ // component: 'RangePicker',
+ // componentProps: {
+ // ...getRangePickerDefaultProps(),
+ // allowClear: true,
+ // },
+ // },
// {
// fieldName: 'remark',
// label: $t('license.remark'),
@@ -408,23 +408,23 @@ export function useGridColumns(
minWidth: 120,
formatter: 'formatDateTime',
},
- {
- field: 'neList',
- title: $t('license.neList'),
- minWidth: 120,
- cellRender: {
- name: 'CellDictGroup',
- props: {
- type: [
- DICT_TYPE.LIC_NE_ALL,
- DICT_TYPE.LIC_NE_5G,
- DICT_TYPE.LIC_NE_4G,
- DICT_TYPE.LIC_NE_23G,
- DICT_TYPE.LIC_NE_ADD,
- ],
- },
- },
- },
+ // {
+ // field: 'neList',
+ // title: $t('license.neList'),
+ // minWidth: 120,
+ // cellRender: {
+ // name: 'CellDictGroup',
+ // props: {
+ // type: [
+ // DICT_TYPE.LIC_NE_ALL,
+ // DICT_TYPE.LIC_NE_5G,
+ // DICT_TYPE.LIC_NE_4G,
+ // DICT_TYPE.LIC_NE_23G,
+ // DICT_TYPE.LIC_NE_ADD,
+ // ],
+ // },
+ // },
+ // },
{
field: 'userNumber',
title: $t('license.userNumber'),
@@ -435,12 +435,12 @@ export function useGridColumns(
title: $t('license.ranNumber'),
minWidth: 120,
},
- {
- field: 'activationCode',
- title: $t('license.activationCode'),
- visible: false,
- minWidth: 120,
- },
+ // {
+ // field: 'activationCode',
+ // title: $t('license.activationCode'),
+ // visible: false,
+ // minWidth: 120,
+ // },
// {
// field: 'licenseContent',
// visible: false,
@@ -505,10 +505,10 @@ export function useGridColumns(
code: 'detail',
text: $t('license.detail'),
},
- {
- code: 'edit',
- show: hasAccessByCodes(['license:license:update']),
- },
+ // {
+ // code: 'edit',
+ // show: hasAccessByCodes(['license:license:update']),
+ // },
{
code: 'apply',
text: $t('license.apply'),
diff --git a/apps/web-antd/src/views/license/license/index.vue b/apps/web-antd/src/views/license/license/index.vue
index e779f0b..b49cf37 100644
--- a/apps/web-antd/src/views/license/license/index.vue
+++ b/apps/web-antd/src/views/license/license/index.vue
@@ -183,7 +183,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
+import type { SelectProps } from 'ant-design-vue';
+
import type { LicenseApi } from '#/api/license/license';
import { computed, reactive, ref, watch } from 'vue';
@@ -21,7 +23,7 @@ import NeCode from '../components/ne-code.vue';
import { formData, useFormSchema } from '../data';
const emit = defineEmits(['success']);
-const neListOptions = getDictOptions(DICT_TYPE.LIC_NE_LIST, 'number');
+const neListOptions = getDictOptions(DICT_TYPE.LIC_NE_ALL, 'number');
const state = reactive({
indeterminate: false,
@@ -29,6 +31,7 @@ const state = reactive({
checkedList: [] as number[],
neCodeList: [] as LicenseApi.NeCode[],
});
+
const neCodeRef = ref();
const getTitle = computed(() => {
@@ -38,7 +41,7 @@ const getTitle = computed(() => {
}
return $t('ui.actionTitle.edit', ['License']);
} else {
- return $t('ui.actionTitle.create', ['License']);
+ return $t('license.applyAction', ['License']);
}
});
@@ -136,20 +139,70 @@ const [Modal, modalApi] = useVbenModal({
modalApi.unlock();
}
}
- // const neCodeList = data.neCodeList || [{ neList: [], activationCode: '' }];
- // data = { ...data, neCodeList };
// 处理数据
data.expiryDate = data.expiryDate ? data.expiryDate.toString() : '';
// 设置到 values
formData.value = data;
state.checkedList = data.neList || [];
- state.neCodeList = data.neCodeList || [];
+ state.neCodeList = data.neCodeList || [
+ { neList: [], activationCode: '', id: 1 },
+ ];
await formApi.setValues(formData.value);
},
});
-const getNeCodeList = (neCodeList: LicenseApi.NeCode[]) => {
- state.neCodeList = neCodeList;
+const options = ref([
+ {
+ label: '一体化',
+ options: getDictOptions(DICT_TYPE.LIC_NE_ALL, 'number'),
+ },
+ {
+ label: '5G',
+ options: getDictOptions(DICT_TYPE.LIC_NE_5G, 'number'),
+ },
+ {
+ label: '4G',
+ options: getDictOptions(DICT_TYPE.LIC_NE_4G, 'number'),
+ },
+ {
+ label: '2/3G',
+ options: getDictOptions(DICT_TYPE.LIC_NE_23G, 'number'),
+ },
+ {
+ label: '增值业务',
+ options: getDictOptions(DICT_TYPE.LIC_NE_ADD, 'number'),
+ },
+]);
+
+let nextId = 2;
+
+const removeNeCode = (item: LicenseApi.NeCode) => {
+ const index = state.neCodeList.indexOf(item);
+ if (index !== -1) {
+ state.neCodeList.splice(index, 1);
+ }
+};
+const addNeCode = () => {
+ state.neCodeList.push({
+ neList: [],
+ activationCode: '',
+ id: nextId++,
+ });
+};
+const availableOptions = (groupIdx: number) => {
+ // 其他分组已选标签
+ const otherSelected = new Set(
+ state.neCodeList
+ .filter((_, idx) => idx !== groupIdx)
+ .flatMap((g) => g.neList),
+ );
+ const aaaa = options.value?.map((item) => ({
+ ...item,
+ options: item.options.filter(
+ (option: any) => !otherSelected.has(option.value),
+ ),
+ }));
+ return aaaa;
};
@@ -178,7 +231,10 @@ const getNeCodeList = (neCodeList: LicenseApi.NeCode[]) => {