This commit is contained in:
zhangjianjun 2026-03-27 15:11:59 +08:00
parent 2a6263ac65
commit fade9d07e2
5 changed files with 30 additions and 14 deletions

View File

@ -9,6 +9,13 @@ export default {
params: {}
})
},
getDataDetail(id: number) {
return Request({
url: `yt/role/${id}`,
method: 'get',
params: {}
})
},
updateData(params: any) {
return Request({
url: 'yt/role',

View File

@ -52,7 +52,7 @@ export const uploadApi = {
method: 'post',
data: params,
params: {
expire: 24 * 30 * 12 * 10,
expire: 86400 * 24 * 30 * 12 * 10,
},
headers: {
"Content-Type": "multipart/form-data",

View File

@ -477,12 +477,12 @@ const NodeEditor: Component = defineComponent({
const zhItem = Array.isArray(zhArr) ? zhArr[i] : undefined
return h(NodeEditor, { parent: item, fieldKey: k, fieldMap: fm, depth: depth + 1, key: k, lang: p.lang, zhParent: zhItem })
}),
// h('div', { class: 'jfd-item-actions' },
// h(ElButton, {
// size: 'small', type: 'danger',
// onClick: () => value.splice(i, 1),
// }, () => [h(ElIcon, { size: 14 }, () => h(Delete)), ' '])
// )
h('div', { class: 'jfd-item-actions' },
h(ElButton, {
size: 'small', type: 'danger',
onClick: () => value.splice(i, 1),
}, () => [h(ElIcon, { size: 14 }, () => h(Delete)), ' 删除此项'])
)
])
})
)

View File

@ -62,7 +62,7 @@ const data: TableData = {
},
],
subFun(self, data) {
return self.api?.addData(data)
return self.api?.addData({...data, role: String(data.role)})
}
}
}
@ -98,7 +98,7 @@ const data: TableData = {
openValue: 1,
closeValue: 2,
subFun(self, data) {
return self.api?.updateData({id: String(data.id), status: String(data.status)})
return self.api?.updateData({id: String(data.id), status: String(data.status), role: String(data.role)})
},
}
},

View File

@ -11,9 +11,9 @@ const data: TableData = {
launchTask: [
async (self: any) => {
if (self.bean) {
const res = await self.api?.getResources({type: "page"})
const res2 = await self.api?.getResources({type: "api"})
self.bean.resources = [...res.data.items, ...res2.data.items].map((item:any) => {
const res = await self.api?.getResources({ type: "page", page: 1, size: 1000 })
const res2 = await self.api?.getResources({ type: "api", page: 1, size: 1000 })
self.bean.resources = [...res.data.items, ...res2.data.items].map((item: any) => {
const type = item.type === 'page' ? '页面' : '接口'
return {
key: item.id,
@ -60,7 +60,7 @@ const data: TableData = {
subFun(self, data) {
const params = {
...data,
resource: data.resource.map((i:number) => String(i))
resource: data.resource.map((i: number) => String(i))
}
return self.api?.addData(params)
}
@ -98,6 +98,15 @@ const data: TableData = {
title: '编辑',
type: 'warning',
primary: 'id',
beforeShow: async (self: any, form: any, row: any) => {
const res = await self.api?.getDataDetail(row.id)
const resources = res.data.map((item: any) => item.id)
const findItem = form.data.find((i: any) => i.key === 'resource')
findItem.values[form.show] = resources
console.log('row', row)
console.log('form', form)
console.log('resource', resources)
},
data: [
{
key: 'name',
@ -120,7 +129,7 @@ const data: TableData = {
const params = {
...data,
id: String(data.id),
resource: data.resource.map((i:number) => String(i))
resource: data.resource.map((i: number) => String(i))
}
return self.api?.updateData(params)
}