Browse Source

feat:[存储位置选择]

lkf
HanLong 2 months ago
parent
commit
df0c7912b1
3 changed files with 51 additions and 27 deletions
  1. +45
    -23
      src/views/business/comps/select/BusinessSelect.vue
  2. +4
    -2
      src/views/business/resource/sj/comps/Bj.vue
  3. +2
    -2
      vue.config.js

+ 45
- 23
src/views/business/comps/select/BusinessSelect.vue View File

@ -8,25 +8,25 @@
<!-- 处置方式business_czfs --> <!-- 处置方式business_czfs -->
<template> <template>
<div> <div>
<el-select :style="showMax?'width:100%':''" v-model="selected" :placeholder="$t('form.placeholderSelect')" :disabled="readonly" :multiple="multiple" @change="handleChange" :filterable="filterable">
<el-option v-for="item in list" :key="item.dictCode" :label="item.dictLabel" :value="item.dictLabel" />
<el-select :style="showMax ? 'width:100%' : ''" v-model="selected" :placeholder="$t('form.placeholderSelect')"
:disabled="readonly" :multiple="multiple" @change="handleChange" :filterable="filterable">
<el-option v-for="item in list" :key="item.dictCode" :label="item.dictLabel" :value="item.dictLabel" />
</el-select> </el-select>
</div> </div>
</template> </template>
<script> <script>
import { listData } from "@/api/system/dict/data" import { listData } from "@/api/system/dict/data"
export default { export default {
name: "BusinessSelect", name: "BusinessSelect",
components: {}, components: {},
props: { props: {
dictType: { dictType: {
type: [Number, String , Array],
type: [Number, String, Array],
default: '' default: ''
}, },
value: { value: {
type: [Number, String , Array],
type: [Number, String, Array],
default: '', default: '',
}, },
readonly: { readonly: {
@ -54,18 +54,18 @@ export default {
value: { value: {
immediate: true, immediate: true,
handler(v) { handler(v) {
if(!this.multiple){
if (!this.multiple) {
this.selected = v ? v : '' this.selected = v ? v : ''
}else{
if(v){
} else {
if (v) {
//, //,
let arr = v.split(',') let arr = v.split(',')
let s = [] let s = []
_.forEach(arr,a=>{
_.forEach(arr, a => {
s.push(a) s.push(a)
}) })
this.selected = s this.selected = s
}else{
} else {
this.selected = [] this.selected = []
} }
} }
@ -90,23 +90,45 @@ export default {
methods: { methods: {
getList() { getList() {
this.list = [] this.list = []
listData(this.queryParams).then(response => {
this.list = response.rows
})
if (this.dictType === 'business_ccwz') {
listData(this.queryParams).then(response => {
this.list = response.rows
this.list.forEach(item => {
item.dictLabel = item.bh
item.dictCode = item.id
})
})
} else {
listData(this.queryParams).then(response => {
this.list = response.rows
})
}
}, },
handleChange(val) { handleChange(val) {
this.$emit('input', this.multiple ? (val && val.length>0 ? val.join(','): ''):(val || ''))
//,
let _index = _.findIndex(this.list, function (a) {
return a.dictLabel == val
})
console.log(_index)
if (_index > -1) {
this.$emit('change', this.list[_index])
console.log(val)
if (this.dictType === 'business_ccwz') {
this.$emit('input', this.multiple ? (val && val.length > 0 ? val.join(',') : '') : (val || ''))
//,
let _index = _.findIndex(this.list, function (a) {
return a.dictLabel == val
})
if (_index > -1) {
this.$emit('change', this.list[_index])
} else {
this.$emit('change', null)
}
} else { } else {
this.$emit('change', null)
this.$emit('input', this.multiple ? (val && val.length > 0 ? val.join(',') : '') : (val || ''))
//,
let _index = _.findIndex(this.list, function (a) {
return a.dictLabel == val
})
if (_index > -1) {
this.$emit('change', this.list[_index])
} else {
this.$emit('change', null)
}
} }
}, },
} }
}; };

+ 4
- 2
src/views/business/resource/sj/comps/Bj.vue View File

@ -49,7 +49,7 @@
<el-col :span="12"> <el-col :span="12">
<!-- 存储位置 --> <!-- 存储位置 -->
<el-form-item :label="$t('page.business.resource.sj.ccwz')" prop="ccwz"> <el-form-item :label="$t('page.business.resource.sj.ccwz')" prop="ccwz">
<BusinessSelect dictType="business_ccwz" v-model="form.ccwz" />
<BusinessSelect dictType="business_ccwz" v-model="form.ccwz" @change="onChangeCcwz"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -149,7 +149,6 @@ export default {
this.reset() this.reset()
sj_info({id: row.id}).then(response => { sj_info({id: row.id}).then(response => {
this.form = response.data this.form = response.data
console.log(this.form)
this.open = true this.open = true
}) })
@ -163,6 +162,9 @@ export default {
}) })
} }
}) })
},
onChangeCcwz(val) {
console.log(val)
} }
} }
} }

+ 2
- 2
vue.config.js View File

@ -34,8 +34,8 @@ module.exports = {
proxy: { proxy: {
// detail: https://cli.vuejs.org/config/#devserver-proxy // detail: https://cli.vuejs.org/config/#devserver-proxy
[process.env.VUE_APP_BASE_API]: { [process.env.VUE_APP_BASE_API]: {
// target: `http://localhost:8080`,
target: `http://39.99.251.173:8080`,
target: `http://localhost:8080`,
// target: `http://39.99.251.173:8080`,
changeOrigin: true, changeOrigin: true,
pathRewrite: { pathRewrite: {
['^' + process.env.VUE_APP_BASE_API]: '' ['^' + process.env.VUE_APP_BASE_API]: ''

Loading…
Cancel
Save