Browse Source

Merge remote-tracking branch 'origin/origin/module_style'

origin/sync_user
liuchuang 4 years ago
parent
commit
342b594af7
  1. 220
      src/views/modules/news/module-style-list.vue
  2. 52
      src/views/modules/news/moduletype-add-or-update.vue

220
src/views/modules/news/module-style-list.vue

@ -0,0 +1,220 @@
<template>
<el-dialog
append-to-body
:visible.sync="visible"
title="模块样式"
:close-on-click-modal="false"
:close-on-press-escape="false"
>
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="setModuleStyle()" label-width="120px">
<el-form-item label="模块样式:" prop="moduleStyle">
<el-radio-group v-model="dataForm.moduleStyle">
<el-radio v-for="item in moduleStyleList"
:key="item.dictValue"
:label="item.dictValue" style="margin-left: 30px;margin-top: 30px" @change="setModuleStyle(item.dictName,item.dictValue)">
{{ `${item.dictName}` }}
<div>
<el-image
style="width: 100px;height: 100px;"
:key="item.remark"
:src="item.remark"
:preview-src-list="previewImgList"
@click="clickImg(item.remark)">
</el-image>
</div>
</el-radio>
</el-radio-group>
</el-form-item>
</el-form>
<template slot="footer">
<el-button @click="visible = false">{{ $t('cancel') }}</el-button>
<el-button type="primary" @click="dataFormSubmitHandle()">{{ $t('confirm') }}</el-button>
</template>
</el-dialog>
</template>
<script>
import mixinViewModule from '@/mixins/view-module'
import 'element-ui/lib/theme-chalk/image.css'
export default {
mixins: [mixinViewModule],
data () {
return {
visible: false,
dataForm: {
moduleStyle: ''
},
moduleStyleList: [],
previewImgList: [],
data: {
moduleStyle: '',
moduleStyleName: ''
}
}
},
computed: {
dataRule () {
return {
moduleStyle: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
]
}
}
},
created () {
this.getModuleStyleList()
},
methods: {
clickImg (url) {
this.previewImgList = []
this.previewImgList.push(url)
},
getModuleStyleList () {
this.$http.get(`/sys/dict/listSimple/module_type_gui_style`).then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
}
this.moduleStyleList = res.data
}).catch(() => {})
},
setModuleStyle (name, value) {
this.data.moduleStyle = value
this.data.moduleStyleName = name
},
dataFormSubmitHandle () {
if (this.data.moduleStyle === '' || this.data.moduleStyle === undefined || this.data.moduleStyleName === '' || this.data.moduleStyleName === undefined) {
return this.$message.error('请选择模块样式')
}
this.$refs['dataForm'].validate((valid) => {
if (!valid) {
return false
}
this.$emit('setModuleStyle', this.data)
this.visible = false
})
},
init () {
this.visible = true
this.$nextTick(() => {
})
}
}
}
</script>
<style lang="scss">
.project-handle {
.el-timeline {
padding-left: 9px;
font-size: 13px;
}
}
.el-form-item__label {
font-weight: bold;
}
</style>
<style lang="scss" scoped>
.project-handle {
width: 100%;
height: calc(100vh - 120px);
background: #ffffff;
box-sizing: border-box;
padding: 10px;
.project-detail {
width: 79%;
height: 80%;
border: 2px solid #ccc;
box-sizing: border-box;
padding: 10px;
padding-top: 20px;
float:left;
margin-bottom: 1%;
position:relative;
.project-detail-tip {
position: absolute;
top: 0;
left:0;
width: 80px;
height: 30px;
line-height: 30px;
color: #ffffff;
background: #4ac38b;
text-align:center;
}
.el-form {
width: 58%;
height: 100%;
float:left;
overflow-y:auto;
&::-webkit-scrollbar {
width: 5px;
height: 1px;
}
&::-webkit-scrollbar-thumb {
border-radius: 5px;
background: #fff;
}
&::-webkit-scrollbar-track {
border-radius: 10px;
background: #fff;
}
}
.container {
width: 40%;
height: 100%;
float: right;
.location {
height: 30px;
line-height: 30px;
}
#map {
width: 100%;
height: calc(100% - 30px);
}
}
}
.project-progress {
width: 20%;
height: 80%;
float: right;
border: 2px solid #ccc;
box-sizing: border-box;
margin-left: 1%;
padding-top: 20px;
overflow-y:auto;
position: relative;
padding-top: 40px;
.project-progress-tip {
position: absolute;
top: 0;
left:0;
width: 80px;
height: 30px;
line-height: 30px;
color: #ffffff;
background: #0098ff;
text-align:center;
}
&::-webkit-scrollbar {
width: 5px;
height: 1px;
}
&::-webkit-scrollbar-thumb {
border-radius: 5px;
background: #aaa;
}
&::-webkit-scrollbar-track {
border-radius: 10px;
background: #ccc;
}
}
.handle-operation {
width: 79%;
height: 49%;
box-sizing: border-box;
border: 2px solid #ccc;
float:left;
}
}
</style>

52
src/views/modules/news/moduletype-add-or-update.vue

@ -29,6 +29,11 @@
<el-option v-for="item in moduleTypeList" :key="item.dictValue" :label="item.dictName" :value="item.dictValue">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="模块样式">
<el-input v-model="dataForm.moduleStyle" v-show="false"></el-input>
<el-button type="primary" @click="openModuleStyleSelect">点击选择模块样式</el-button>
{{moduleStyleName}}
</el-form-item>
<el-form-item label="类别名称" prop="typeName">
<el-input v-model="dataForm.typeName" placeholder="类别名称"></el-input>
@ -37,7 +42,7 @@
<el-input v-model="dataForm.typeCode" placeholder="类别编码"></el-input>
</el-form-item>
<el-form-item prop="parentName" label="上级分类" class="category-list">
<el-popover v-model="categoryListVisible" ref="categoryListPopover" placement="bottom-start" trigger="click">
<el-popover v-model="categoryListVisible" popper-class="scroll-tree" ref="categoryListPopover" placement="bottom-start" trigger="click">
<el-tree :data="categoryList"
:props="{ label: 'typeName', children: 'children' }"
node-key="id"
@ -81,12 +86,15 @@
<el-button @click="visible = false">{{ $t('cancel') }}</el-button>
<el-button type="primary" @click="dataFormSubmitHandle()">{{ $t('confirm') }}</el-button>
</template>
<module-style-list v-if="moduleStyleListVisible"
ref="moduleStyleList" @setModuleStyle="setModuleStyle"></module-style-list>
</el-dialog>
</template>
<script>
import debounce from 'lodash/debounce'
import Cookies from 'js-cookie'
import moduleStyleList from './module-style-list'
export default {
data () {
return {
@ -105,8 +113,12 @@ export default {
createdTime: '',
updatedBy: '',
updatedTime: '',
moduleType:''
moduleType:'',
moduleStyle: '',
},
moduleStyleName: '',
moduleStyleListVisible: false,
moduleStyleList: [],
moduleTypeList:[],
uploadUrl: '',
loading: false,
@ -137,11 +149,34 @@ export default {
},
created () {
this.getModuleTypeInfo ()
this.getModuleStyleList()
this.$nextTick(() => {
this.uploadUrl = `${window.SITE_CONFIG['apiURL']}/oss/file/upload?token=${Cookies.get('token')}`
})
},
components: {
moduleStyleList
},
methods: {
setModuleStyle (data) {
this.dataForm.moduleStyle = data.moduleStyle
this.moduleStyleName = data.moduleStyleName
},
getModuleStyleList () {
this.$http.get(`/sys/dict/listSimple/module_type_gui_style`).then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
}
this.moduleStyleList = res.data
}).catch(() => {})
},
openModuleStyleSelect () {
this.moduleStyleListVisible = true
this.$nextTick(() => {
this.$refs.moduleStyleList.dataForm.moduleStyle = this.dataForm.moduleStyle
this.$refs.moduleStyleList.init()
})
},
//
getModuleTypeInfo () {
this.$http.get(`sys/dict/listSimple/news_module_type`).then(({ data: res }) => {
@ -157,6 +192,8 @@ export default {
this.loading = true
},
init () {
this.moduleStyleName = ''
this.dataForm.moduleStyle = ''
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
@ -199,6 +236,12 @@ export default {
this.dataForm = {
...this.dataForm,
...res.data
}
if (res.data.moduleStyle) {
let dict = this.moduleStyleList.filter(item => item.dictValue === res.data.moduleStyle)[0].dictName
if (dict) {
this.moduleStyleName = dict
}
}
if (this.dataForm.pid === '0') {
return this.categoryListTreeSetDefaultHandle()
@ -259,4 +302,9 @@ export default {
height: 178px;
display: block;
}
.scroll-tree {
width: 500px;
height: 600px;
overflow: auto;
}
</style>
Loading…
Cancel
Save