refactor: table去掉无用逻辑

This commit is contained in:
RubyLiu 2023-08-11 10:54:35 +08:00 committed by fit2-zhao
parent 280ed916d6
commit 30794f628f
2 changed files with 3 additions and 6 deletions

View File

@ -19,9 +19,6 @@ const msTableStore = defineStore('msTable', {
if (!this.selectorColumnMap.has(tableKey)) { if (!this.selectorColumnMap.has(tableKey)) {
const tmpMap = this.selectorColumnMap; const tmpMap = this.selectorColumnMap;
column.forEach((item) => { column.forEach((item) => {
if (item.showInTable === undefined) {
item.showInTable = true;
}
if (item.showDrag === undefined) { if (item.showDrag === undefined) {
item.showDrag = false; item.showDrag = false;
} }
@ -48,7 +45,7 @@ const msTableStore = defineStore('msTable', {
if (this.selectorColumnMap.has(key)) { if (this.selectorColumnMap.has(key)) {
const tmpArr = this.selectorColumnMap.get(key)?.column || []; const tmpArr = this.selectorColumnMap.get(key)?.column || [];
const nonSortableColumns = tmpArr.filter((item) => !item.showDrag); const nonSortableColumns = tmpArr.filter((item) => !item.showDrag);
const couldSortableColumns = tmpArr.filter((item) => item.showDrag); const couldSortableColumns = tmpArr.filter((item) => !!item.showDrag);
return { nonSort: nonSortableColumns, couldSort: couldSortableColumns }; return { nonSort: nonSortableColumns, couldSort: couldSortableColumns };
} }
return { nonSort: [], couldSort: [] }; return { nonSort: [], couldSort: [] };
@ -59,7 +56,7 @@ const msTableStore = defineStore('msTable', {
getShowInTableColumns(key: string): MsTableColumn { getShowInTableColumns(key: string): MsTableColumn {
if (this.selectorColumnMap.has(key)) { if (this.selectorColumnMap.has(key)) {
const tmpArr = this.selectorColumnMap.get(key)?.column; const tmpArr = this.selectorColumnMap.get(key)?.column;
return tmpArr?.filter((item) => item.showInTable) || []; return tmpArr?.filter((item) => !!item.showInTable) || [];
} }
return []; return [];
}, },

View File

@ -16,7 +16,7 @@
:label="t('system.userGroup.user')" :label="t('system.userGroup.user')"
:rules="[{ required: true, message: t('system.userGroup.pleaseSelectUser') }]" :rules="[{ required: true, message: t('system.userGroup.pleaseSelectUser') }]"
> >
<ms-user-selector v-model:value="form.name" /> <MsUserSelector v-model:value="form.name" />
</a-form-item> </a-form-item>
</a-form> </a-form>
</div> </div>