弹窗选择控件优化!

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'

@ -41,7 +41,7 @@
</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>
@ -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: ''
},
formData: {
type: Object
bissId: {
type: String,
default: ''
},
templateJson: {
includeFields: {
type: String,
default: ''
},
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 => {
getDataInterfaceDataInfo(this.interfaceId, query).then(res => {
const data = res.data && res.data.length ? res.data[0] : {}
this.innerValue = data[this.relationField]
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