弹窗选择控件优化!

product
巴卫 2 years ago
parent a10d10612a
commit f6e1079780

@ -2,4 +2,4 @@
ENV = 'production'
VUE_APP_BASE_API = 'http://127.0.0.1:8000'
VUE_APP_BASE_WSS = 'wss://127.0.0.1:8000/websocket'
VUE_APP_BASE_WSS = 'wss://222.71.165.188:8000/websocket'

@ -2,25 +2,25 @@
<div class="popupSelect-container">
<div class="el-select" @click="openDialog">
<el-input :placeholder="placeholder" v-model="innerValue" readonly :validate-event="false"
@mouseenter.native="inputHovering = true" @mouseleave.native="inputHovering = false">
@mouseenter.native="inputHovering = true" @mouseleave.native="inputHovering = false">
<template slot="suffix">
<i v-show="!showClose"
:class="['el-select__caret', 'el-input__icon', 'el-icon-arrow-up']"></i>
:class="['el-select__caret', 'el-input__icon', 'el-icon-arrow-up']"></i>
<i v-if="showClose" class="el-select__caret el-input__icon el-icon-circle-close"
@click="clear"></i>
@click="clear"></i>
</template>
</el-input>
</div>
<template v-if="popupType==='dialog'">
<el-dialog :title="popupTitle" :close-on-click-modal="false" :visible.sync="visible"
v-if="visible" class="JNPF-dialog JNPF-dialog_center" lock-scroll append-to-body
:width='popupWidth'>
v-if="visible" class="JNPF-dialog JNPF-dialog_center" lock-scroll append-to-body
:width='popupWidth'>
<el-row class="JNPF-common-search-box" :gutter="16">
<el-form @submit.native.prevent>
<el-col :span="10">
<el-form-item label="关键词">
<el-input v-model="listQuery.keyword" placeholder="请输入关键词查询" clearable
@keyup.enter.native="search()" class="search-input" />
@keyup.enter.native="search()" class="search-input" />
</el-form-item>
</el-col>
<el-col :span="8">
@ -36,12 +36,12 @@
<div class="JNPF-common-search-box-right">
<el-tooltip effect="dark" :content="$t('common.refresh')" placement="top">
<el-link icon="icon-ym icon-ym-Refresh JNPF-common-head-icon" :underline="false"
@click="initData()" />
@click="initData()" />
</el-tooltip>
</div>
</el-row>
<JNPF-table v-loading="listLoading" :data="list" :border="false" highlight-current-row
@row-click="rowClick" :hasNO="false">
@row-click="rowClick" @row-dblclick="rowdbClick" :hasNO="false">
<el-table-column width="35">
<template slot-scope="scope">
<el-radio :label="scope.row[propsValue]" v-model="checked">&nbsp;</el-radio>
@ -49,10 +49,10 @@
</el-table-column>
<el-table-column type="index" width="50" label="序号" align="center" />
<el-table-column :prop="item.value" :label="item.label" v-for="(item,i) in columnOptions"
:key="i" />
:key="i" />
</JNPF-table>
<pagination :total="total" :page.sync="listQuery.currentPage"
:limit.sync="listQuery.pageSize" @pagination="initData" v-if="hasPage" />
:limit.sync="listQuery.pageSize" @pagination="initData" v-if="hasPage" />
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false" size="small">{{$t('common.cancelButton')}}</el-button>
<el-button type="primary" @click="select()" size="small">{{$t('common.confirmButton')}}
@ -62,14 +62,14 @@
</template>
<template v-if="popupType ==='drawer'">
<el-drawer :title="popupTitle" :visible.sync="visible" :wrapperClosable="false" ref="drawer"
:size='popupWidth' append-to-body class="JNPF-common-drawer">
:size='popupWidth' append-to-body class="JNPF-common-drawer">
<div class="JNPF-flex-main">
<el-row class="JNPF-common-search-box" :gutter="16">
<el-form @submit.native.prevent>
<el-col :span="10">
<el-form-item label="关键词">
<el-input v-model="listQuery.keyword" placeholder="请输入关键词查询" clearable
@keyup.enter.native="search()" class="search-input" />
@keyup.enter.native="search()" class="search-input" />
</el-form-item>
</el-col>
<el-col :span="8">
@ -85,12 +85,12 @@
<div class="JNPF-common-search-box-right">
<el-tooltip effect="dark" :content="$t('common.refresh')" placement="top">
<el-link icon="icon-ym icon-ym-Refresh JNPF-common-head-icon" :underline="false"
@click="initData()" />
@click="initData()" />
</el-tooltip>
</div>
</el-row>
<JNPF-table v-loading="listLoading" :data="list" :border="false" highlight-current-row
@row-click="rowClick" :hasNO="false">
@row-click="rowClick" :hasNO="false">
<el-table-column width="35">
<template slot-scope="scope">
<el-radio :label="scope.row[propsValue]" v-model="checked">&nbsp;</el-radio>
@ -98,10 +98,10 @@
</el-table-column>
<el-table-column type="index" width="50" label="序号" align="center" />
<el-table-column :prop="item.value" :label="item.label"
v-for="(item,i) in columnOptions" :key="i" />
v-for="(item,i) in columnOptions" :key="i" />
</JNPF-table>
<pagination :total="total" :page.sync="listQuery.currentPage"
:limit.sync="listQuery.pageSize" @pagination="initData" v-if="hasPage" />
:limit.sync="listQuery.pageSize" @pagination="initData" v-if="hasPage" />
<div class="drawer-footer">
<el-button @click="visible = false" size="small">{{$t('common.cancelButton')}}
</el-button>
@ -115,20 +115,26 @@
</template>
<script>
import { getDataInterfaceDataSelect, getDataInterfaceDataInfoByIds } from '@/api/systemData/dataInterface'
import { getDataInterfaceDataSelect, getDataInterfaceDataInfo } from '@/api/systemData/dataInterface'
export default {
name: 'PopupSelect',
props: {
value: {
default: ''
},
rowIndex: {
default: null
interfaceId: {
type: String,
default: ''
},
bissId: {
type: String,
default: ''
},
formData: {
type: Object
includeFields: {
type: String,
default: ''
},
templateJson: {
excludeFields: {
type: Array,
default: () => []
},
@ -233,6 +239,7 @@ export default {
},
created() {
this.listQuery.pageSize = this.hasPage ? this.pageSize : 10000
// this.reset()
this.setDefault()
},
methods: {
@ -244,6 +251,9 @@ export default {
let query = {
...this.listQuery,
interfaceId: this.interfaceId,
bissId: this.bissId,
includeFields: this.includeFields,
excludeFields: this.excludeFields,
propsValue: this.propsValue,
relationField: this.relationField,
columnOptions: columnOptions.join(','),
@ -309,6 +319,12 @@ export default {
this.$emit('change', this.checked, this.checkedRow)
this.visible = false
},
rowdbClick(row){
this.checked = row[this.propsValue]
this.checkedTxt = row[this.relationField]
this.checkedRow = row
this.select();
},
rowClick(row) {
this.checked = row[this.propsValue]
this.checkedTxt = row[this.relationField]
@ -317,20 +333,21 @@ export default {
setDefault() {
if (this.value) {
if (!this.interfaceId) return
const paramList = this.getParamList()
let query = {
ids: [this.value],
id: this.value,
interfaceId: this.interfaceId,
bissId: this.bissId,
includeFields: this.includeFields,
excludeFields: this.excludeFields,
propsValue: this.propsValue,
relationField: this.relationField,
paramList
}
getDataInterfaceDataInfoByIds(this.interfaceId, query).then(res => {
const data = res.data && res.data.length ? res.data[0] : {}
this.innerValue = data[this.relationField]
getDataInterfaceDataInfo(this.interfaceId, query).then(res => {
const data = res.data && res.data.length ? res.data[0] : {}
this.innerValue = res.data[this.relationField]
if (!this.field) return
let relationData = this.$store.state.generator.relationData
this.$set(relationData, this.field, data)
this.$set(relationData, this.field, res.data)
this.$eventBus.$emit('popupAttrEventBus', relationData, this.field)
this.$store.commit('generator/UPDATE_RELATION_DATA', relationData)
})

Loading…
Cancel
Save