This commit is contained in:
六如
2024-10-20 23:28:17 +08:00
parent 0cbadbeda8
commit c84a05b522
36 changed files with 985 additions and 164 deletions

View File

@@ -1,12 +1,71 @@
// options推荐写法
// 1. 定义一个 `ref`数组
import { type Ref, ref } from "vue";
import { type OptionsRow } from "plus-pro-components";
import { computed, type Ref, ref } from "vue";
import { type OptionsRow, type PlusColumn } from "plus-pro-components";
import { api } from "@/api/isvList";
import { api as groupApi } from "@/api/permGroup";
import { ElMessage } from "element-plus";
import { search } from "@/views/isv/list/index";
// 弹窗显示
export const dlgGroupSetting = ref(false);
export const settingGroupFormData = ref<any>({
isvId: 0,
groupCodeList: []
});
const groupList: Ref<OptionsRow[]> = ref([]);
// 2. 异步函数获取到值赋值到 `ref`
const loadGroup = async () => {
//
console.log(groupList);
const loadGroup = () => {
groupApi.listAll().then(resp => {
const rows = resp.data;
/*
options.value = [
{ label: '未解决', value: '0', color: 'red' },
{ label: '已解决', value: '1', color: 'blue' }
]
*/
groupList.value = rows.map(row => {
return {
label: row.groupName,
value: row.groupCode
};
});
});
};
loadGroup();
export const groupColumns: PlusColumn[] = [
{
label: "分组",
width: 120,
prop: "groupCodeList",
valueType: "checkbox",
// options推荐写法
// 3. 用 computed 返回 ref 的 value
options: computed(() => groupList.value)
}
];
export const settingGroup = (row: any) => {
api.listGroup(row.id).then(resp => {
settingGroupFormData.value = {
isvId: row.id,
groupCodeList: resp.data
};
dlgGroupSetting.value = true;
});
};
export const handleUpdateGroup = () => {
const data = settingGroupFormData.value;
api.updateGroup(data.isvId, data.groupCodeList).then(() => {
ElMessage({
message: "保存成功",
type: "success"
});
dlgGroupSetting.value = false;
search();
});
};