feat: 回滚字典值.

This commit is contained in:
lijiahangmax
2023-10-31 01:32:13 +08:00
parent ada22636b3
commit 9a23b0634b
11 changed files with 277 additions and 15 deletions

View File

@@ -3,11 +3,17 @@
<!-- 列表-表格 -->
<dict-value-table ref="table"
@openAdd="() => modal.openAdd()"
@openUpdate="(e) => modal.openUpdate(e)" />
@openUpdate="(e) => modal.openUpdate(e)"
@openHistory="(e) => history.open(e.id, e.label)" />
<!-- 添加修改模态框 -->
<dict-value-form-modal ref="modal"
@added="modalAddCallback"
@updated="modalUpdateCallback" />
<!-- 历史值模态框 -->
<history-value-modal ref="history"
:type="historyType"
:rollback="rollback"
@updated="modalUpdateCallback" />
</div>
</template>
@@ -20,15 +26,18 @@
<script lang="ts" setup>
import DictValueTable from './components/dict-value-table.vue';
import DictValueFormModal from './components/dict-value-form-modal.vue';
import HistoryValueModal from '@/components/meta/history/history-value-modal.vue';
import { ref, onBeforeMount, onUnmounted } from 'vue';
import { historyType } from './types/const';
import { useCacheStore } from '@/store';
import { getDictKeyList } from '@/api/system/dict-key';
import { Message } from '@arco-design/web-vue';
import { rollbackDictValue } from '@/api/system/dict-value';
const render = ref(false);
const table = ref();
const modal = ref();
const history = ref();
const cacheStore = useCacheStore();
// 添加回调
@@ -41,6 +50,11 @@
table.value.updatedCallback();
};
// 回滚
const rollback = async (id: number, valueId: number) => {
await rollbackDictValue({ id, valueId });
};
// 加载字典配置项
const loadDictKeys = async () => {
try {

View File

@@ -0,0 +1,2 @@
// 历史值类型
export const historyType = 'DICT';