Merge branch 'dev' of gitee.com:liqianglog/django-vue-admin into dev

pull/102/head
Angelo 2023-07-14 04:16:47 +08:00
commit a77237ee40
9 changed files with 201 additions and 47 deletions

View File

@ -2,4 +2,5 @@
# python manage.py makemigrations
# python manage.py migrate
# python manage.py init -y
gunicorn -c gunicorn_conf.py application.asgi:application
#gunicorn -c gunicorn_conf.py application.asgi:application
uvicorn application.asgi:application --port 8000 --host 0.0.0.0 --workers 4

View File

@ -277,6 +277,6 @@ class InitSettingsViewSet(APIView):
SystemConfig.objects.filter(status=False, parent_id__isnull=False).values('parent__key',
'key')]
data = dict(filter(lambda x: x[0] not in backend_config, data.items()))
data = self.filter_system_config_values(data=data)
data['schema_name'] = connection.tenant.schema_name
if hasattr(connection, 'tenant'):
data['schema_name'] = connection.tenant.schema_name
return DetailResponse(data=data)

View File

@ -3,7 +3,7 @@ certifi==2021.5.30
chardet==4.0.0
coreapi==2.3.3
coreschema==0.0.4
Django==3.2.12
Django==3.2.19
django-comment-migrate==0.1.7
django-cors-headers==3.10.1
django-filter==22.1
@ -11,8 +11,8 @@ django-ranged-response==0.2.0
django-redis==5.2.0
django-restql==0.15.3
django-simple-captcha==0.5.17
django-tenants==3.4.8
django-timezone-field==4.2.3
django-tenants==3.5.0
django-timezone-field==5.0
djangorestframework==3.14.0
djangorestframework-simplejwt==5.2.2
packaging==23.0
@ -29,7 +29,7 @@ pyparsing==2.4.7
pyPEG2==2.15.2
pypinyin==0.48.0
pytz==2021.1
requests==2.28.2
requests==2.28.0
ruamel.yaml==0.17.10
ruamel.yaml.clib==0.2.4
six==1.16.0

View File

@ -56,6 +56,9 @@
<div style="text-align: center" v-if="_elProps.listType === 'avatar'">
<img style="max-width: 100%;" :src="dialogImageUrl" alt="">
</div>
<div style="text-align: center" v-else-if="_elProps.listType === 'picture-card'">
<img style="max-width: 100%;" :src="dialogImageUrl" alt="">
</div>
<div style="text-align: center" v-else>
<div id="player" v-if="dialogVisible">
<div class="player-container">

View File

@ -15,7 +15,7 @@
<el-row style="margin-bottom: 0" :gutter="5" v-for="(field, index) in currentForm.data" :key="index">
<el-col :span="elProps.index.span" v-if="elProps.index">
<div style="text-align: center">
{{index+1}}
{{ index + 1 }}
</div>
</el-col>
<el-col :span="elProps.fields[key].span" v-for="(_,key) in elProps.fields" :key="key">
@ -24,6 +24,7 @@
:rules="[
{ required: elProps.fields[key].required, message: '不能为空', trigger: 'blur' },
]"
style="text-align: center"
>
<el-select v-model="field[key]" v-if="elProps.fields[key].type === 'select'" placeholder="请选择">
<el-option
@ -33,22 +34,36 @@
:value="item.value">
</el-option>
</el-select>
<el-input-number style="width: 100%" v-else-if="elProps.fields[key].type === 'number'" controls-position="right" v-model="field[key]"></el-input-number>
<div v-else-if="elProps.fields[key].type === 'image'" style="height: 50px;width: 50px;">
<d2p-file-uploader v-model="field[key]" :elProps="elProps.fields[key].elProps || { listType: 'picture-card', accept: '.png,.jpeg,.jpg,.ico,.bmp,.gif', limit: 1 }"></d2p-file-uploader>
<el-input-number style="width: 100%" v-else-if="elProps.fields[key].type === 'number'"
controls-position="right" v-model="field[key]"></el-input-number>
<div class="d2p-images" v-else-if="elProps.fields[key].type === 'image'">
<d2p-file-uploader v-model="field[key]"
:elProps="elProps.fields[key].elProps || { listType: 'picture-card', accept: '.png,.jpeg,.jpg,.ico,.bmp,.gif', limit: 1 }"></d2p-file-uploader>
</div>
<!-- 富文本 -->
<span v-else-if="elProps.fields[key].type === 'ueditor'">
<values-popover v-model="field[key]" :elProps="{ type: 'ueditor' }" @previewClick="previewClick(index,key)"></values-popover>
<values-popover v-model="field[key]" :elProps="{ type: 'ueditor' }"
@previewClick="previewClick(index,key)"></values-popover>
</span>
<!-- 多对多 -->
<span v-else-if="elProps.fields[key].type === 'many_to_many'">
<values-popover
v-model="field[key]"
:dict="elProps.fields[key].dict"
:elProps="{ type: elProps.fields[key].value?.type || 'manyToMany', rowKey: elProps.fields[key].value?.rowKey || 'title', label: elProps.value?.title || '答复选项内容' }"
@listClick="manyToManyClick(index,key)">
</values-popover>
</span>
<el-input v-model="field[key]" v-else placeholder="请输入"></el-input>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item>
<el-button @click.prevent="topDomain(index)" :disabled="index === 0" type="primary" circle icon="el-icon-top"></el-button>
<el-button @click.prevent="bottomDomain(index)" :disabled="index === currentForm.data.length - 1" type="primary" circle icon="el-icon-bottom"></el-button>
<el-button @click.prevent="removeDomain(index)" type="danger" circle icon="el-icon-delete"></el-button>
<el-button @click.prevent="topDomain(index)" :disabled="index === 0" type="primary" circle
icon="el-icon-top"></el-button>
<el-button @click.prevent="bottomDomain(index)" :disabled="index === currentForm.data.length - 1"
type="primary" circle icon="el-icon-bottom"></el-button>
<el-button @click.prevent="removeDomain(index)" type="danger" circle icon="el-icon-delete"></el-button>
</el-form-item>
</el-col>
</el-row>
@ -64,7 +79,7 @@
append-to-body
width="900">
<d2p-ueditor
v-if="currentForm.data && currentForm.data[ueditorIndex]"
v-if="currentForm.data && currentForm.data[ueditorIndex] && ueditorKey"
v-model="currentForm.data[ueditorIndex][ueditorKey]"
:config="ueditorConfig">
</d2p-ueditor>
@ -72,10 +87,27 @@
<el-button type="primary" @click="previewVisible = false">完成</el-button>
</span>
</el-dialog>
<el-dialog
title="编辑"
:visible.sync="manyToManyVisible"
append-to-body
v-if="currentForm.data && currentForm.data[manyToManyIndex] && manyToManyKey"
:width="elProps.fields[manyToManyKey].dialogWidth">
<foreign-key-crud-form
v-model="currentForm.data[manyToManyIndex][manyToManyKey]"
:isInitRows="elProps.fields[manyToManyKey].isInitRows"
:elProps="elProps.fields[manyToManyKey].elProps"
@change="foreignChange"
></foreign-key-crud-form>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="manyToManyVisible = false">保存</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import util from '@/libs/util.js'
export default {
name: 'foreignKeyCrudForm',
model: {
@ -128,6 +160,50 @@ export default {
required: true,
min: 0,
max: null
},
option_data: {
name: '选项题目',
type: 'many_to_many',
span: 2,
default: [],
required: false,
unit: '个',
value: {
type: 'strList',
rowKey: 'name',
title: '选项内容'
},
//
isInitRows: true,
dialogWidth: '700',
dict: {
value: 'id', // value
label: 'name' // label
},
elProps: {
index: {
name: '序号',
span: 2
},
fields: {
name: {
name: '题目选项内容',
type: 'input',
span: 10,
default: null,
required: true
},
sort: {
name: '排序',
type: 'number',
span: 8,
default: 0,
required: true,
min: 0,
max: null
}
}
}
}
}
}
@ -164,7 +240,11 @@ export default {
//
previewVisible: false,
ueditorIndex: 0,
ueditorKey: null
ueditorKey: null,
//
manyToManyIndex: 0,
manyToManyKey: null,
manyToManyVisible: false
}
},
computed: {
@ -254,12 +334,55 @@ export default {
this.ueditorKey = key
this.previewVisible = true
console.log('previewClick', index, key)
},
//
manyToManyClick (index, key) {
this.manyToManyIndex = index
this.manyToManyKey = key
this.manyToManyVisible = true
if (!this.currentForm.data[this.manyToManyIndex][this.manyToManyKey]) {
this.currentForm.data[this.manyToManyIndex][this.manyToManyKey] = []
}
},
foreignChange (res) {
if (this.manyToManyKey) {
this.currentForm.data[this.manyToManyIndex][this.manyToManyKey] = res
}
}
}
}
</script>
<style scoped>
::v-deep .d2p-file-uploader .el-upload--picture-card{
<style lang="scss">
.d2p-images {
height: 30px;
width: 30px;
.el-upload-list__item-thumbnail {
height: 60px !important;
width: 60px !important;
}
.el-upload-list__item {
width: 60px !important;
height: 60px !important;
line-height: 0 !important;
img {
height: 60px !important;
width: 60px !important;
}
}
.el-upload-list__item-actions {
height: 60px !important;
width: 60px !important;
line-height: 0 !important;
}
}
</style>
<style lang="scss" scoped>
::v-deep .d2p-file-uploader .el-upload--picture-card {
width: 50px;
height: 50px;
}

View File

@ -18,10 +18,10 @@
{{ item[dict.label] }}
</el-descriptions-item>
</el-descriptions>
<el-button type="primary" plain size="mini" slot="reference"><span> {{ value.length }} {{ elProps.unit }}</span>
<el-button type="primary" plain size="mini" slot="reference" @click="listClick"><span> {{ value.length }} {{ elProps.unit }}</span>
</el-button>
</el-popover>
<el-button v-else type="primary" plain size="mini" slot="reference"><span> {{
<el-button v-else type="primary" plain size="mini" slot="reference" @click="listClick"><span> {{
value.length
}} {{ elProps.unit }}</span>
</el-button>
@ -36,6 +36,30 @@
</el-descriptions-item>
</el-descriptions>
</div>
<div v-if="elProps.type === 'manyToMany'">
<el-popover
placement="right"
width="300"
trigger="hover"
v-if="value.length > 0"
@show="showEvents"
@hide="show=false">
<el-descriptions class="margin-top" :column="1" size="mini" border>
<el-descriptions-item v-for="(item,index) in value" :key="index" labelStyle="width: 60px;">
<template slot="label">
选项{{ index + 1 }}
</template>
{{ item[dict.label] }}
</el-descriptions-item>
</el-descriptions>
<el-button type="primary" plain size="mini" slot="reference" @click="listClick"><span> {{ value.length }} {{ elProps.unit }}</span>
</el-button>
</el-popover>
<el-button v-else type="primary" plain size="mini" slot="reference" @click="listClick"><span> {{
value.length
}} {{ elProps.unit }}</span>
</el-button>
</div>
<div v-else-if="elProps.type === 'ueditor'">
<el-popover
placement="right"
@ -46,10 +70,10 @@
@show="showEvents"
@hide="show=false">
<div v-html="value" v-if="show"></div>
<el-button type="primary" plain size="mini" slot="reference"><span>预览</span>
<el-button type="primary" plain size="mini" slot="reference" @click="previewClick"><span>预览</span>
</el-button>
</el-popover>
<el-button v-else type="primary" plain size="mini" slot="reference"><span>预览</span>
<el-button v-else type="primary" plain size="mini" slot="reference" @click="previewClick"><span>预览</span>
</el-button>
</div>
</div>
@ -125,7 +149,9 @@ export default {
if (this.value.constructor === Array) {
const ids = []
this.value.map(res => {
ids.push(res[this.dict.value])
if (res) {
ids.push(res[this.dict.value])
}
})
params[this.dict.value] = ids
} else {
@ -135,12 +161,18 @@ export default {
request({ url: this.dict.url, params: params }).then(ret => {
this.data = ret.data.data || ret.data
})
},
previewClick () {
this.$emit('previewClick')
},
listClick () {
this.$emit('listClick')
}
}
}
</script>
<style >
.userprjtreepop{
<style>
.userprjtreepop {
width: 80%;
overflow-x: auto;
max-height: 80%;

View File

@ -58,7 +58,6 @@ new Vue({
// 初始化配置
this.$store.dispatch('d2admin/settings/load')
this.$store.dispatch('d2admin/dictionary/load')
this.$store.dispatch('d2admin/permission/load')
},
created () {

View File

@ -1,11 +1,3 @@
/*
* @创建文件时间: 2021-06-01 22:41:21
* @Auther: 猿小天
* @最后修改人: 猿小天
* @最后修改时间: 2021-11-19 21:35:56
* 联系Qq:1638245306
* @文件介绍: 菜单获取
*/
import { uniqueId } from 'lodash'
import { request } from '@/api/service'
import XEUtils from 'xe-utils'
@ -76,7 +68,8 @@ export const handleRouter = function (menuData) {
meta: {
title: item.name,
auth: true,
cache: item.cache
cache: item.cache,
openInNewWindow: item.frame_out
}
}
if (item.frame_out) {

View File

@ -1,11 +1,3 @@
/*
* @创建文件时间: 2021-06-01 22:41:21
* @Auther: 猿小天
* @最后修改人: 猿小天
* @最后修改时间: 2021-11-19 21:49:43
* 联系Qq:1638245306
* @文件介绍:
*/
import Vue from 'vue'
import VueRouter from 'vue-router'
// 进度条
@ -42,7 +34,7 @@ const router = new VueRouter({
*/
router.beforeEach(async (to, from, next) => {
// 白名单
const whiteList = ['/login', '/auth-redirect', '/bind', '/register', '/oauth2']
const whiteList = ['/login', '/auth-redirect', '/bind', '/register', '/clientRenew', '/oauth2']
// 确认已经加载多标签页数据 https://github.com/d2-projects/d2-admin/issues/201
await store.dispatch('d2admin/page/isLoaded')
// 确认已经加载组件尺寸设置 https://github.com/d2-projects/d2-admin/issues/198
@ -64,6 +56,7 @@ router.beforeEach(async (to, from, next) => {
})
await store.dispatch('d2admin/user/set', res.data, { root: true })
await store.dispatch('d2admin/account/load')
await store.dispatch('d2admin/permission/load', routes)
store.dispatch('d2admin/dept/load')
store.dispatch('d2admin/settings/init')
}
@ -92,11 +85,21 @@ router.beforeEach(async (to, from, next) => {
next({ path: to.fullPath, replace: true, params: to.params })
})
} else {
next()
const childrenPath = window.qiankunActiveRule || []
if (to.name) {
// name 属性说明是主应用的路由
next()
if (to.meta.openInNewWindow && !to.query.newWindow) {
// 在新窗口中打开路由
const { href } = router.resolve({
path: to.path + '?newWindow=1'
})
window.open(href, '_blank')
// 取消当前导航
NProgress.done()
next(false)
} else {
next()
}
} else if (childrenPath.some((item) => to.path.includes(item))) {
next()
} else {