Merge remote-tracking branch 'origin/develop' into develop

This commit is contained in:
super_liu
2021-11-08 17:51:30 +08:00
2 changed files with 682 additions and 1 deletions
@@ -0,0 +1,674 @@
<!-- 配置管理 - 属性自定义 - 其他 -->
<template>
<div class="attribute-custom v-class">
<div class="action-bar1">
<el-button class="common-button-primary add-button" size="mini" type="primary" v-btn-permission="''" @click="showAddModel"><i class="el-icon-plus"></i>新增</el-button>
</div>
<loading :loading="attributeDataLoading">数据处理中</loading>
<div class="content">
<el-table
style="width: 100%;"
:data="attributeList"
height="100%"
border
ref="selections"
:header-cell-style="{background: '#e8e8e8', color: '#333333', fontSize: '16px',
fontWeight: 'bold', height: '48px'}"
@on-selection-change="handleSelectone"
>
<el-table-column
type="selection"
width="55"
align="center"
>
</el-table-column>
<el-table-column
prop="sarType"
label="所属模块"
width="140"
>
<template slot-scope="scope">
{{ getSarTypeText(scope.row.sarType) }}
</template>
</el-table-column>
<el-table-column
prop="attrField"
label="属性字段"
>
</el-table-column>
<el-table-column
prop="attrName"
label="属性名称"
>
</el-table-column>
<el-table-column
prop="attrType"
label="属性类型"
>
<template slot-scope="scope">
{{ getAttrTypeText(scope.row.attrType) }}
</template>
</el-table-column>
<el-table-column
prop="attrLen"
label="字段长度"
width="120"
>
</el-table-column>
<el-table-column
prop="orderNum"
label="展示顺序"
width="100"
>
</el-table-column>
<el-table-column label="操作" align="center" width="50" fixed="right">
<template slot-scope="scope">
<div @click.stop style="display: inline-block">
<el-dropdown trigger="click" @command="handleCommand">
<i class="iconfont">&#xe61e;</i>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item :command="[scope.row, '编辑']" v-btn-permission="'b1e60ec7b60389713bf5b450ec2d1115'">编辑</el-dropdown-item>
<el-dropdown-item :disabled="scope.row.isEdit==='1'" v-btn-permission="'c157be4e073787ea6c4a04bd39686c2d'" :command="[scope.row, '删除']">删除</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
</template>
</el-table-column>
</el-table>
</div>
<pagination :total="total" :pageChange="pageNo" :pageSizeChange="pageSize" @pageChange="pageChange" @pageSizeChange="pageSizeChange"></pagination>
<!-- 新建抽屉-->
<el-drawer
:title="attributeTitle"
:visible.sync="showInfoModal"
size="800px"
:styles="styles"
:wrapperClosable="false"
@close="cancelModel"
>
<div class="demo-drawer-content">
<el-form
ref="attributeEO"
:model="attributeEO"
:rules="attributeEOFormRules"
class="label-input-form"
label-width="150px"
>
<input v-model="attributeEO.id" v-show="false">
<el-form-item label="所属模块" prop="sarType" class="add-form-item" v-show="false">
<el-input v-model="attributeEO.sarType" ></el-input>
</el-form-item>
<el-form-item label="属性字段" prop="attrField" class="add-form-item" :class="{'form-item-disabled': addOrEdit === 'edit'}">
<el-input v-model.trim="attributeEO.attrField" :disabled="addOrEdit === 'edit'" placeholder="请输入属性字段" clearable/>
</el-form-item>
<el-form-item label="属性名称" prop="attrName" class="add-form-item">
<el-input v-model.trim="attributeEO.attrName" placeholder="请输入属性名称" clearable/>
</el-form-item>
<el-form-item label="属性类型" prop="attrType" class="add-form-item" :class="{'form-item-disabled': addOrEdit === 'edit'}">
<el-select v-model="attributeEO.attrType" placeholder="请选择" :disabled="addOrEdit === 'edit'" filterable>
<el-option
v-for="item in attrTypeOptions"
:label="item.label"
:value="item.value"
:key="item.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="选项值" prop="selVal" class="add-form-item" v-if="attributeEO.attrType === 'SEL_OPTION' || attributeEO.attrType === 'SEL_OPTS'">
<el-select v-model="attributeEO.selVal" placeholder="请选择" :disabled="addOrEdit === 'edit'" filterable>
<el-option
v-for="item in relateDicIdOptions"
:label="item.label"
:value="item.value"
:key="item.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="字段长度" prop="attrLen" class="add-form-item">
<el-input v-model.number="attributeEO.attrLen" :disabled="addOrEdit === 'edit'" placeholder="只允许输入正整数" number :maxlength="4"/>
</el-form-item>
<el-form-item label="展示顺序" prop="orderNum" class="add-form-item">
<el-input v-model.number="attributeEO.orderNum" placeholder="只允许输入正整数" number :maxlength="3"/>
</el-form-item>
<el-form-item label="是否必填" prop="isMust" class="add-form-item">
<el-select v-model="attributeEO.isMust">
<el-option v-for="opt in isMustOptions" :key="opt.value" :value="opt.value" :label="opt.label">{{ opt.label }}</el-option>
</el-select>
</el-form-item>
<el-form-item label="是否展示" prop="isShowImp" class="add-form-item">
<el-select v-model="attributeEO.isShowImp">
<el-option
v-for="opt in isMustOptions"
:key="opt.value"
:value="opt.value"
:label="opt.label"
></el-option>
</el-select>
</el-form-item>
</el-form>
</div>
<div id="roleFormButton" class="demo-drawer-footer">
<el-button class="common-button-primary" icon="el-icon-check" type="primary" @click="saveInfo()">提交</el-button>
<el-button class="common-button-default" icon="el-icon-close" @click="cancelModel">取消</el-button>
</div>
</el-drawer>
<!-- <el-dialog
destroy-on-close
:close-on-click-modal="false"
:close-on-press-escape="false"
:visible.sync="displayLocationFormDialogVisible"
:title="displayLocationFormDialogTilte"
@on-ok="handleDisplayLocationFormDialogSubmit('displayLocationDialogForm')"
@on-cancel="handleDisplayLocationFormDialogReset('displayLocationDialogForm')"
width="400px"
>
<el-form
ref="displayLocationDialogForm"
:model="displayLocationDialogFormData"
:rules="displayLocationDialogFormRules"
label-width="100px"
class="label-input-form"
>
<el-form-item label="区域名称" prop="areaName" class="add-form-item">
<el-input v-model="displayLocationDialogFormData.areaName" placeholder="请输入区域名称"></el-input>
</el-form-item>
<el-form-item label="所属模块" prop="sarType" class="add-form-item">
<el-select v-model="displayLocationDialogFormData.sarType" filterable>
<el-option
v-for="item in sarTypeLocationOptions"
:key="item.value"
:label="item.label"
:value="item.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="排序号" prop="showIndex" class="add-form-item">
<el-input v-model.number="displayLocationDialogFormData.showIndex" placeholder="请输入排序号"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button class="common-button-default" @click="handleDisplayLocationFormDialogReset('displayLocationDialogForm')"> </el-button>
<el-button class="common-button-primary" type="primary" @click="handleDisplayLocationFormDialogSubmit('displayLocationDialogForm')"> </el-button>
</span>
</el-dialog>-->
</div>
</template>
<script>
const sarType = 'OTHER'
export default {
name: 'attribute-custom',
data () {
return {
sarType: sarType,
displayLocationDialogTableConfig: {
columns: [
{
title: '展示区域',
key: 'areaName'
},
{
title: '排序号',
key: 'showIndex'
},
{
title: '操作',
slot: 'operations'
}
],
page: {
pageSize: 100,
currentPage: 1,
total: 0
},
loading: false
},
displayLocationDialogTableData: [],
displayLocationDialogVisible: false,
displayLocationFormDialogVisible: false,
defaultDisplayLocationDialogFormData: {
areaName: '',
sarType: '',
showIndex: ''
},
displayLocationDialogFormData: {
areaName: '',
showIndex: ''
},
displayLocationDialogFormRules: {
areaName: [
{ required: true, message: '请输入展示区域', trigger: 'blur' },
{ type: 'string', max: 100, message: '最多输入100字', trigger: 'blur' }
],
sarType: [
{required: true, message: '所属模块不能为空', trigger: 'change'}
],
showIndex: [
{ type: 'number', required: true, message: '不能为空且为正整数', trigger: 'blur' },
{ type: 'number', min: 0, max: 999, message: '请输入0-999之间的整数', trigger: 'blur' }
]
},
attributeDataLoading: false,
attributeList: [],
total: 0,
pageNo: 1,
pageSize: this.$store.getters.userInfo.configContent,
attributeEO: {
id: '',
attrField: '',
attrName: '',
attrLen: '',
attrType: '',
orderNum: '',
isMust: '1',
isShowImp: '0',
selVal: '',
isSearch: '1',
sarType: 'OTHER',
isWarn: '1'
},
attrTypeOptions: [
{ label: '输入框(字符串)', value: 'INPUT_STR' },
{ label: '输入框(数字)', value: 'INPUT_NUM' },
{ label: '单选下拉框', value: 'SEL_OPTION' },
{ label: '多选下拉框', value: 'SEL_OPTS' },
{ label: '单日期选择', value: 'DATE_PICKER' },
{ label: '多日期选择', value: 'DATE_PIC_OPTS' },
{ label: '文件', value: 'FILE' },
{ label: '文本框', value: 'TEXTAREA' }
],
sarTypeLocationOptions: [
// { label: '国内政策', value: 'INLAND_LAWS' },
{ label: '国内外政策', value: 'Other' }
],
isMustOptions: [
{ label: '是', value: '0' },
{ label: '否', value: '1' }
],
showRegionOptions: [],
relateDicIdOptions: [],
attributeTitle: '',
showInfoModal: false,
attributeEOFormRules: {
sarType: [
{required: true, message: '所属模块不能为空', trigger: 'change'}
],
attrField: [
{required: true, message: '属性字段不能为空', trigger: 'blur'},
{type: 'string', max: 50, message: '最多输入50位', trigger: 'blur'},
{type: 'string', validator: this.verify.validFieldOracle, trigger: 'blur'}
],
attrName: [
{required: true, message: '属性名称不能为空', trigger: 'blur'},
{type: 'string', max: 100, message: '最多输入100位', trigger: 'blur'}
],
attrType: [
{required: true, message: '属性类型不能为空', trigger: 'change'}
],
attrLen: [
{type: 'number', required: true, message: '字段长度不能为空且为正整数', trigger: 'blur'},
{type: 'string', validator: this.verify.validStandNumInCompile2, trigger: 'blur'}
],
orderNum: [
{type: 'number', required: true, message: '展示顺序不能为空且为正整数', trigger: 'blur'},
{type: 'string', validator: this.verify.validStandNumInCompile2, trigger: 'blur'}
],
isMust: [
{required: true, message: '是否必填不能为空', trigger: 'change'}
],
isShowImp: [
{required: true, message: '是否展示必填不能为空', trigger: 'change'}
],
showRegionId:[
{required:true, message:'展示区域不能为空', trigger:'change'}
]
},
styles: {
height: 'calc(100% - 55px)',
overflow: 'auto',
paddingBottom: '53px',
position: 'static'
},
addOrEdit: '',
selectedList: []
}
},
computed: {
/*displayLocationFormDialogTilte () {
const formData = {...this.displayLocationDialogFormData}
const isEdit = !!formData.id
return isEdit ? '修改展示区域' : '新增展示区域'
}*/
},
methods: {
// 更多
handleCommand (command) {
switch (command[1]) {
case '编辑':
this.handleTableEdit(command[0])
break
case '删除':
this.handleTableDelete(command[0])
break
}
},
// 展示区域 更多
handleCommand2 (command) {
switch (command[1]) {
case '修改':
this.showAddDisplayLocationDialog(command[0])
break
case '删除':
this.removeDisplayLocation(command[0])
break
}
},
removeDisplayLocation (data) {
this.$confirm('确认删除该条数据?', {
confirmButtonClass: 'common-button-primary',
roundButton: false,
title: '确认删除',
callback: (action, instance) => {
if (action === 'confirm') {
const {id} = data
this.$http.delete('lawssBase/utArea/deleteById', {
id,
sarType: this.sarType
}, {
_this: this
}, res => {
this.queryDisplayLocationDialogTableData()
}, e => {
console.log(e)
})
}
}
})
},
handleDisplayLocationFormDialogSubmit (name) {
this.$refs[name].validate((valid) => {
if (valid) {
const formData = {...this.displayLocationDialogFormData, sarType: this.sarType}
const isEdit = !!formData.id
const url = isEdit ? 'lawssBase/utArea/updateUtArea' : 'lawssBase/utArea/createUtArea'
const method = isEdit ? 'putData' : 'postData'
this.$http[method](url, formData, {
_this: this
}, res => {
this.displayLocationFormDialogVisible = false
this.queryDisplayLocationDialogTableData()
// this.displayLocationDialogTableData = res.data.list
// this.displayLocationDialogTableConfig.page.total = res.data.count
}, e => {
console.log(e)
})
} else {
// this.$message.error('Fail!')
}
})
},
handleDisplayLocationFormDialogReset (name) {
this.displayLocationFormDialogVisible = false
this.$nextTick(() => {
this.$refs.displayLocationDialogForm.resetFields()
})
},
/**
* 打开新增展示区域管理弹框
*/
showAddDisplayLocationDialog (data) {
if (data) {
// 编辑
this.displayLocationDialogFormData = {
areaName: data.areaName,
showIndex: data.showIndex,
id: data.id,
sarType: data.sarType
}
} else {
this.displayLocationDialogFormData = {...this.defaultDisplayLocationDialogFormData}
}
this.displayLocationFormDialogVisible = true
},
/**
* 查询展示区域管理弹框里的列表数据
*/
queryDisplayLocationDialogTableData () {
return new Promise((resolve, reject) => {
this.$http.get('lawssBase/utArea/page', {
page: this.displayLocationDialogTableConfig.page.currentPage,
pageSize: this.displayLocationDialogTableConfig.page.pageSize,
sarType: this.sarType
}, {
_this: this.displayLocationDialogTableConfig,
loading: 'loading'
}, res => {
this.displayLocationDialogTableData = res.data.list
this.displayLocationDialogTableConfig.page.total = res.data.count
resolve(res)
}, e => {
console.log(e)
reject(e)
})
})
},
/**
* 查询新增弹框里的列表数据
*/
queryDisplayLocationList (sarType) {
return new Promise((resolve, reject) => {
this.$http.get('lawssBase/utArea/getAreaList', {
sarType: sarType || this.sarType
}, {
_this: this
}, res => {
this.showRegionOptions = res.data || []
resolve(res)
}, e => {
console.log(e)
reject(e)
})
})
},
handleSelectone (data) {
this.selectedList = []
for (let i = 0; i < data.length; i++) {
this.selectedList.push(data[i].id)
}
},
pageChange (page) {
this.pageNo = page
this.getAttrByPage()
},
pageSizeChange (pageSize) {
this.pageSize = pageSize
this.getAttrByPage()
},
getAttrByPage () {
this.$http.get('lawss/sarStandAttrDetails/page', {
page: this.pageNo,
pageSize: this.pageSize,
sarType: this.sarType
}, {
_this: this,
loading: 'attributeDataLoading'
},
res => {
this.attributeList = res.data.list
this.total = res.data.count
}, e => {})
this.$refs.selections.clearSelection()
},
async showAddModel () {
await this.queryDisplayLocationList()
// this.$refs['attributeEO'] && this.$refs['attributeEO'].resetFields()
this.attributeEO.newWebSite = ''
this.addOrEdit = 'add'
this.attributeTitle = '新增'
this.showInfoModal = true
this.$nextTick(() => {
this.$refs['attributeEO'].resetFields()
})
},
saveInfo () {
this.$refs['attributeEO'].validate((valid) => {
if (valid) {
if ((this.attributeEO.attrType === 'SEL_OPTION' || this.attributeEO.attrType === 'SEL_OPTS') && (this.attributeEO.selVal == null || this.attributeEO.selVal === '')) {
this.$message.warning('下拉框类型字段,选项值不能为空')
} else {
if (this.addOrEdit === 'add') {
this.$http.postData('lawss/sarStandAttrDetails/createStandAttrDetails', this.attributeEO,
{
_this: this
}, res => {
if (res.ok) {
this.getAttrByPage()
this.showInfoModal = false
} else {
}
})
} else {
this.$http.putData('lawss/sarStandAttrDetails/updateStandAttrDetails', this.attributeEO,
{
_this: this
}, res => {
if (res.ok) {
this.getAttrByPage()
this.showInfoModal = false
} else {
}
})
}
}
}
})
},
cancelModel () {
this.showInfoModal = false
this.$refs['attributeEO'] && this.$refs['attributeEO'].resetFields()
},
deleteAttr () {
if (this.selectedList.length === 0) {
this.$message.error('请先选择要删除的数据!')
} else {
this.$confirm('确认删除选中数据?', {
title: '提示',
confirmButtonClass: 'common-button-primary',
roundButton: false,
callback: (action, instance) => {
if (action === 'confirm') {
this.$http.put('lawss/sarStandAttrDetails/deleteByIds', {
ids: this.selectedList.join(','),
sarType: this.sarType
}, {
_this: this
}, res => {
this.getAttrByPage()
}, e => {
})
}
}
})
}
},
getDictionarySelList () {
this.$http.get('sys/dictionary/getDictionaryCodeSelList', {
sarType: this.sarType
}, {
_this: this
},
res => {
this.relateDicIdOptions = res.data
}, e => {})
},
getAttrTypeText (type) {
let texts = ''
if (type === 'INPUT_STR') {
texts = '输入框(字符串)'
} else if (type === 'INPUT_NUM') {
texts = '输入框(数字)'
} else if (type === 'SEL_OPTION') {
texts = '单选下拉框'
} else if (type === 'SEL_OPTS') {
texts = '多选下拉框'
} else if (type === 'DATE_PICKER') {
texts = '单日期选择'
} else if (type === 'DATE_PIC_OPTS') {
texts = '多日期选择'
} else if (type === 'FILE') {
texts = '文件'
} else if (type === 'TEXTAREA') {
texts = '文本框'
}
return texts
},
getSarTypeText (type) {
let texts = ''
if (type === 'OTHER') {
texts = '其他'
}
return texts
},
async handleTableEdit (params) {
await this.queryDisplayLocationList(params.sarType)
// this.$refs['attributeEO'] && this.$refs['attributeEO'].resetFields()
this.addOrEdit = 'edit'
this.attributeTitle = '编辑'
this.showInfoModal = true
this.attributeEO = JSON.parse(JSON.stringify(params))
},
handleTableDelete (params) {
this.selectedList = []
this.selectedList.push(params.id)
this.deleteAttr()
},
async handleSarTypeChange (sarType) {
this.attributeEO.showRegionId = ''
await this.queryDisplayLocationList(sarType)
}
},
mounted () {
this.getAttrByPage()
this.getDictionarySelList()
}
}
</script>
<style lang="less" scoped>
@import '~@/assets/styles/mixins';
.attribute-custom{
background: #FFF;
height: 100%;
position: relative;
display: flex;
flex-direction: column;
flex: auto;
.action-bar{
padding: 0;
}
.content {
padding: 0;
overflow-y: auto;
flex: auto;
display: flex;
flex-direction: column;
//height: calc(~'100% - 50px - 56px');
}
.pagination {
position: static;
/deep/ .pagination-slot {
padding: 0;
}
}
.modalStyle{
padding: 14px;
font-size: 15px;
}
.sysMenuTreeDiv{
height: 400px;
overflow-y: auto;
}
}
</style>
@@ -16,6 +16,11 @@
<buss v-if="tabValue === 'buss'"></buss>
</div>
</el-tab-pane>
<!-- <el-tab-pane label="其他" name="other">
<div style="position: absolute;top: 0;left: 0;right: 0;bottom: 0;">
<other v-if="tabValue === 'other'"></other>
</div>
</el-tab-pane>-->
</el-tabs>
</div>
</template>
@@ -24,12 +29,14 @@
import Laws from './components/laws'
import Stand from './components/stand'
import Buss from './components/buss'
/*import Other from './components/other'*/
export default {
name: 'index',
components: {
Laws,
Stand,
Buss
Buss,
// Other
},
data () {
return {