OSS资源修改分组

This commit is contained in:
15386982806 2024-05-27 16:41:34 +08:00
parent 907e9d35a7
commit ef528a2952

View File

@ -387,7 +387,7 @@
> >
<FormItem label="所在分组" prop="id"> <FormItem label="所在分组" prop="id">
<Cascader <Cascader
v-model="groupFormValidate.id" v-model="defaultValue"
:data="treeData" :data="treeData"
change-on-select change-on-select
@on-change="treeDataChange" @on-change="treeDataChange"
@ -447,6 +447,7 @@ export default {
level: 0, level: 0,
directoryName: "", directoryName: "",
}, },
defaultValue: [], // id
groupRuleValidate: { groupRuleValidate: {
directoryName: [ directoryName: [
{ {
@ -871,7 +872,12 @@ export default {
if (val && this.isComponent) { if (val && this.isComponent) {
this.selectedOss = []; this.selectedOss = [];
} }
} },
defaultValue(val) {
if (val) {
this.groupFormValidate.parentId = val;
}
},
}, },
methods: { methods: {
@ -901,22 +907,33 @@ export default {
}, },
// tree // tree
renderContent (h, { root, node, data }) { renderContent (h, { root, node, data }) {
return h('span', {style: {display: 'inline-block', width: '100%'}}, if (data.value === '0') {
[ return h('span', {style: {display: 'inline-block', width: '100%'}},
h('span', [h("Icon", {type: 'ios-paper-outline', style: {marginRight: '8px'}}), h('span', data.title)]), [
h('span', {style: {display: 'inline-block', float: 'right', marginRight: '10px'}}, h('span', [h("Icon", {type: 'ios-paper-outline', style: {marginRight: '8px'}}), h('span', data.title)]),
[ h('span', {style: {display: 'inline-block', float: 'right', marginRight: '10px'}}, [])
h("Dropdown", {style: {marginLeft: "4px"}}, ]
[ );
h("Icon", {props: {type: 'ios-more', size: "20",}, style: {display: 'inline-block'}, on:{click: () => {}}}), } else {
h("DropdownMenu", {slot: "list" return h('span', {style: {display: 'inline-block', width: '100%'}},
}, [ [
h("DropdownItem", { nativeOn:{click: () => {this.handleContextMenuEdit()}} }, "编辑"), h('span', [h("Icon", {type: 'ios-paper-outline', style: {marginRight: '8px'}}), h('span', data.title)]),
h("DropdownItem", { nativeOn:{click: () => {this.handleContextMenuDelete()}} }, "删除"), h('span', {style: {display: 'inline-block', float: 'right', marginRight: '10px'}},
]) [
]), h("Dropdown", {style: {marginLeft: "4px"}},
]) [
]); h("Icon", {props: {type: 'ios-more', size: "20",}, style: {display: 'inline-block'}, on:{click: () => {}}}),
h("DropdownMenu", {slot: "list"
}, [
h("DropdownItem", { nativeOn:{click: () => {this.handleContextMenuEdit(root, node, data)}} }, "编辑"),
h("DropdownItem", { nativeOn:{click: () => {this.handleContextMenuDelete()}} }, "删除"),
])
]),
])
]
);
}
}, },
@ -927,17 +944,14 @@ export default {
this.selectedGroupData = val; this.selectedGroupData = val;
}, },
// //
handleContextMenuEdit(val) { handleContextMenuEdit(root, node, data) {
this.insertOrUpdate = "update"; this.insertOrUpdate = "update";
this.enableGroup = true; this.enableGroup = true;
// this.groupFormValidate = this.selectedGroupData; this.groupFormValidate.directoryName = data.label;
this.groupFormValidate.id = [data.value];
this.groupFormValidate.directoryName = this.selectedGroupData.title; this.groupFormValidate.level = data.level;
this.groupFormValidate.id = [this.selectedGroupData.value]; this.groupFormValidate.parentId = data.parentId;
this.groupFormValidate.level = this.selectedGroupData.level; this.defaultValue = [data.parentId];
this.groupFormValidate.parentId = this.selectedGroupData.parentId;
}, },
// //
async handleContextMenuDelete(val) { async handleContextMenuDelete(val) {
@ -969,15 +983,13 @@ export default {
if (valid) { if (valid) {
let res let res
const params = { ...this.groupFormValidate }; const params = { ...this.groupFormValidate };
if (this.insertOrUpdate === "insert") { if (this.insertOrUpdate === "insert") {
// params.directoryType = this.selectedGroupData.directoryType
params.parentId = params.id[params.id.length - 1]; params.parentId = params.id[params.id.length - 1];
// params.type = this.selectedGroupData.type
delete params.id; delete params.id;
res = await addFileDirectory(params); res = await addFileDirectory(params);
} else { } else {
params.id = params.id[params.id.length - 1]; params.id = params.id[params.id.length - 1];
params.parentId = params.parentId[params.parentId.length - 1];
res = await updateFileDirectory(params); res = await updateFileDirectory(params);
} }