功能变化: 更新组件
parent
7659cc67dd
commit
227e1393a4
|
@ -29,8 +29,8 @@ function webSocketOnError (e) {
|
||||||
*/
|
*/
|
||||||
function webSocketOnMessage (e) {
|
function webSocketOnMessage (e) {
|
||||||
const data = JSON.parse(e.data)
|
const data = JSON.parse(e.data)
|
||||||
const { refresh_unread, systemConfig } = data
|
const { refreshUnread, systemConfig } = data
|
||||||
if (refresh_unread) {
|
if (refreshUnread) {
|
||||||
// 更新消息通知条数
|
// 更新消息通知条数
|
||||||
store.dispatch('d2admin/messagecenter/setUnread')
|
store.dispatch('d2admin/messagecenter/setUnread')
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import d2Container from './d2-container'
|
||||||
import tableProgress from './table-progress/lib/table-progress.vue'
|
import tableProgress from './table-progress/lib/table-progress.vue'
|
||||||
import cardSelect from '@/components/card-select/index'
|
import cardSelect from '@/components/card-select/index'
|
||||||
import selectorTable from '@/components/selector-table/index'
|
import selectorTable from '@/components/selector-table/index'
|
||||||
import m2mValuesPopover from '@/components/m2m-values-popover/index'
|
import valuesPopover from '@/components/values-popover/index'
|
||||||
// 注意 有些组件使用异步加载会有影响
|
// 注意 有些组件使用异步加载会有影响
|
||||||
Vue.component('d2-container', d2Container)
|
Vue.component('d2-container', d2Container)
|
||||||
Vue.component('d2-icon', () => import('./d2-icon'))
|
Vue.component('d2-icon', () => import('./d2-icon'))
|
||||||
|
@ -18,4 +18,4 @@ Vue.component('dvaHtml2pdf', () => import('./dvaHtml2pdf/index.vue'))
|
||||||
Vue.component('table-progress', tableProgress)
|
Vue.component('table-progress', tableProgress)
|
||||||
Vue.use(selectorTable)
|
Vue.use(selectorTable)
|
||||||
Vue.use(cardSelect)
|
Vue.use(cardSelect)
|
||||||
Vue.use(m2mValuesPopover)
|
Vue.use(valuesPopover)
|
||||||
|
|
|
@ -1,105 +0,0 @@
|
||||||
<!-- 多对多value值展示组件 -->
|
|
||||||
<template>
|
|
||||||
<div>
|
|
||||||
<el-popover
|
|
||||||
placement="right"
|
|
||||||
width="400"
|
|
||||||
trigger="hover"
|
|
||||||
v-if="value.length > 0"
|
|
||||||
@show="showEvents">
|
|
||||||
<el-descriptions class="margin-top" :column="1" size="mini" border>
|
|
||||||
<!-- <template slot="extra">-->
|
|
||||||
<!-- <el-button type="primary" size="mini" disabled>上一页</el-button>-->
|
|
||||||
<!-- <el-button type="primary" size="mini" disabled>下一页</el-button>-->
|
|
||||||
<!-- </template>-->
|
|
||||||
<el-descriptions-item v-for="(item,index) in data" :key="index">
|
|
||||||
<template slot="label">
|
|
||||||
<i class="el-icon-user"></i>
|
|
||||||
{{ elProps.label }}
|
|
||||||
</template>
|
|
||||||
{{ 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>
|
|
||||||
</el-popover>
|
|
||||||
<el-button v-else type="primary" plain size="mini" slot="reference"><span> {{ value.length }} {{elProps.unit}}</span>
|
|
||||||
</el-button>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import { d2CrudPlus } from 'd2-crud-plus'
|
|
||||||
import { request } from '@/api/service'
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: 'm2m-values-popover',
|
|
||||||
model: {
|
|
||||||
prop: 'value',
|
|
||||||
event: ['change', 'input']
|
|
||||||
},
|
|
||||||
mixins: [d2CrudPlus.input, d2CrudPlus.inputDict],
|
|
||||||
props: {
|
|
||||||
// 值
|
|
||||||
value: {
|
|
||||||
type: [String, Number, Array],
|
|
||||||
required: false,
|
|
||||||
default: ''
|
|
||||||
},
|
|
||||||
// 数据字典配置
|
|
||||||
dict: {
|
|
||||||
type: Object,
|
|
||||||
require: true
|
|
||||||
},
|
|
||||||
// 其他配置
|
|
||||||
elProps: {
|
|
||||||
type: Object,
|
|
||||||
require: false,
|
|
||||||
default () {
|
|
||||||
return {
|
|
||||||
type: 'text', // test/tree
|
|
||||||
rowKey: 'users',
|
|
||||||
label: '标题',
|
|
||||||
unit: '个'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
data () {
|
|
||||||
return {
|
|
||||||
data: []
|
|
||||||
}
|
|
||||||
},
|
|
||||||
value: {
|
|
||||||
handler (value, oldVal) {
|
|
||||||
this.showEvents()
|
|
||||||
},
|
|
||||||
deep: true
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
_elProps () {
|
|
||||||
return this.elProps
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted () {
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
showEvents () {
|
|
||||||
if (!this.data[0]) {
|
|
||||||
this.getData()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
getData () {
|
|
||||||
const params = {}
|
|
||||||
params[this.dict.value] = this.value
|
|
||||||
params.query = `{${this.dict.value},${this.dict.label}}`
|
|
||||||
request({ url: this.dict.url, params: params }).then(ret => {
|
|
||||||
this.data = ret.data.data || ret.data
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<style scoped>
|
|
||||||
|
|
||||||
</style>
|
|
|
@ -6,10 +6,23 @@
|
||||||
trigger="click"
|
trigger="click"
|
||||||
@show="visibleChange">
|
@show="visibleChange">
|
||||||
<div class="option">
|
<div class="option">
|
||||||
<el-input style="margin-bottom: 10px" v-model="search" clearable placeholder="请输入关键词" @change="getDict"
|
<el-row>
|
||||||
|
<el-col :span="21">
|
||||||
|
<el-input
|
||||||
|
style="margin-bottom: 10px"
|
||||||
|
v-model="search"
|
||||||
|
clearable
|
||||||
|
size="small"
|
||||||
|
placeholder="请输入关键词"
|
||||||
|
@change="getDict"
|
||||||
@clear="getDict">
|
@clear="getDict">
|
||||||
<el-button style="width: 100px" slot="append" icon="el-icon-search"></el-button>
|
<el-button style="width: 100px" slot="append" icon="el-icon-search"></el-button>
|
||||||
</el-input>
|
</el-input>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="3" style="padding-left: 10px;padding-right: 10px;">
|
||||||
|
<el-button type="primary" round size="mini" style="padding: 10px;" @click="onClear">清空选择</el-button>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
<el-table
|
<el-table
|
||||||
ref="tableRef"
|
ref="tableRef"
|
||||||
:data="tableData"
|
:data="tableData"
|
||||||
|
@ -57,7 +70,7 @@
|
||||||
</el-tag>
|
</el-tag>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<el-input v-else placeholder="请选择" slot:reference :disabled="disabled"></el-input>
|
<el-input v-else placeholder="请选择" slot:reference clearable :disabled="disabled"></el-input>
|
||||||
</div>
|
</div>
|
||||||
</el-popover>
|
</el-popover>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { d2CrudPlus } from 'd2-crud-plus'
|
||||||
import group from './group'
|
import group from './group'
|
||||||
|
|
||||||
function install (Vue, options) {
|
function install (Vue, options) {
|
||||||
Vue.component('m2m-values-popover', () => import('./m2m-values-popover'))
|
Vue.component('values-popover', () => import('./values-popover'))
|
||||||
if (d2CrudPlus != null) {
|
if (d2CrudPlus != null) {
|
||||||
// 注册字段类型`demo-extend`
|
// 注册字段类型`demo-extend`
|
||||||
d2CrudPlus.util.columnResolve.addTypes(group)
|
d2CrudPlus.util.columnResolve.addTypes(group)
|
|
@ -0,0 +1,131 @@
|
||||||
|
<!-- value值展示组件 -->
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<div v-if="elProps.type === 'list'">
|
||||||
|
<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 data" :key="index">
|
||||||
|
<template slot="label">
|
||||||
|
<i class="el-icon-user"></i>
|
||||||
|
{{ elProps.label }}
|
||||||
|
</template>
|
||||||
|
{{ 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>
|
||||||
|
</el-popover>
|
||||||
|
<el-button v-else type="primary" plain size="mini" slot="reference"><span> {{
|
||||||
|
value.length
|
||||||
|
}} {{ elProps.unit }}</span>
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
<div v-else-if="elProps.type === 'ueditor'">
|
||||||
|
<el-popover
|
||||||
|
placement="right"
|
||||||
|
width="400"
|
||||||
|
trigger="hover"
|
||||||
|
v-if="value.length > 0"
|
||||||
|
popper-class="userprjtreepop"
|
||||||
|
@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>
|
||||||
|
</el-popover>
|
||||||
|
<el-button v-else type="primary" plain size="mini" slot="reference"><span>预览</span>
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { d2CrudPlus } from 'd2-crud-plus'
|
||||||
|
import { request } from '@/api/service'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'valuesPopover',
|
||||||
|
model: {
|
||||||
|
prop: 'value',
|
||||||
|
event: ['change', 'input']
|
||||||
|
},
|
||||||
|
mixins: [d2CrudPlus.input, d2CrudPlus.inputDict],
|
||||||
|
props: {
|
||||||
|
// 值
|
||||||
|
value: {
|
||||||
|
type: [String, Number, Array],
|
||||||
|
required: false,
|
||||||
|
default: ''
|
||||||
|
},
|
||||||
|
// 数据字典配置
|
||||||
|
dict: {
|
||||||
|
type: Object,
|
||||||
|
require: true
|
||||||
|
},
|
||||||
|
// 其他配置
|
||||||
|
elProps: {
|
||||||
|
type: Object,
|
||||||
|
require: false,
|
||||||
|
default () {
|
||||||
|
return {
|
||||||
|
type: 'text', // test/tree/list/ueditor
|
||||||
|
rowKey: 'users',
|
||||||
|
label: '标题',
|
||||||
|
unit: '个'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
data: [],
|
||||||
|
show: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
value: {
|
||||||
|
handler (value, oldVal) {
|
||||||
|
this.showEvents()
|
||||||
|
},
|
||||||
|
deep: true
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
_elProps () {
|
||||||
|
return this.elProps
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted () {
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
showEvents () {
|
||||||
|
this.show = true
|
||||||
|
if (this.elProps.type === 'list') {
|
||||||
|
if (!this.data[0]) {
|
||||||
|
this.getListData()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
getListData () {
|
||||||
|
const params = {}
|
||||||
|
params[this.dict.value] = this.value
|
||||||
|
params.query = `{${this.dict.value},${this.dict.label}}`
|
||||||
|
request({ url: this.dict.url, params: params }).then(ret => {
|
||||||
|
this.data = ret.data.data || ret.data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style >
|
||||||
|
.userprjtreepop{
|
||||||
|
width: 80%;
|
||||||
|
overflow-x: auto;
|
||||||
|
max-height: 80%;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -1,6 +1,4 @@
|
||||||
import { request } from '@/api/service'
|
import { request } from '@/api/service'
|
||||||
import { urlPrefix } from '@/views/system/messageCenter/api'
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
namespaced: true,
|
namespaced: true,
|
||||||
state: {
|
state: {
|
||||||
|
|
|
@ -331,7 +331,7 @@ export default {
|
||||||
const form = JSON.parse(JSON.stringify(this.form))
|
const form = JSON.parse(JSON.stringify(this.form))
|
||||||
const keys = Object.keys(form)
|
const keys = Object.keys(form)
|
||||||
const values = Object.values(form)
|
const values = Object.values(form)
|
||||||
let submitForm = Object.assign([],this.formList)
|
const submitForm = Object.assign([], this.formList)
|
||||||
for (const index in this.formList) {
|
for (const index in this.formList) {
|
||||||
const item = this.formList[index]
|
const item = this.formList[index]
|
||||||
// eslint-disable-next-line camelcase
|
// eslint-disable-next-line camelcase
|
||||||
|
@ -397,14 +397,13 @@ export default {
|
||||||
const { tableData } = $table.getTableData()
|
const { tableData } = $table.getTableData()
|
||||||
const tableLength = tableData.length
|
const tableLength = tableData.length
|
||||||
if (tableLength === 0) {
|
if (tableLength === 0) {
|
||||||
const { row } = $table.insert()
|
$table.insert()
|
||||||
} else {
|
} else {
|
||||||
const errMap = await $table.validate().catch(errMap => errMap)
|
const errMap = await $table.validate().catch(errMap => errMap)
|
||||||
if (errMap) {
|
if (errMap) {
|
||||||
this.$message.error('校验不通过!')
|
this.$message.error('校验不通过!')
|
||||||
} else {
|
} else {
|
||||||
const { row } = $table.insert()
|
$table.insert()
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue