Browse Source

feat:[系统管理][字典选择器]新增浓度、体积、质量选择器

luojie
HanLong 3 weeks ago
parent
commit
a7b21b4bae
6 changed files with 491 additions and 1 deletions
  1. +1
    -1
      src/views/business/comps/select/SelectCctj.vue
  2. +98
    -0
      src/views/business/comps/select/SelectCcwz.vue
  3. +98
    -0
      src/views/business/comps/select/SelectNddw.vue
  4. +98
    -0
      src/views/business/comps/select/SelectTjdw.vue
  5. +98
    -0
      src/views/business/comps/select/SelectYxqdw.vue
  6. +98
    -0
      src/views/business/comps/select/SelectZldw.vue

+ 1
- 1
src/views/business/comps/select/SelectCctj.vue View File

@ -80,7 +80,7 @@ export default {
}) })
}, },
handleChange(val) { handleChange(val) {
this.$emit('change', this.multiple ? (val && val.length>0 ? val.join(','): ''):(val || ''))
this.$emit('input', this.multiple ? (val && val.length>0 ? val.join(','): ''):(val || ''))
//, //,
let _index = _.findIndex(this.list, function (a) { let _index = _.findIndex(this.list, function (a) {
return a.dictLabel == val return a.dictLabel == val

+ 98
- 0
src/views/business/comps/select/SelectCcwz.vue View File

@ -0,0 +1,98 @@
<!-- 存储位置选择器 -->
<template>
<div>
<el-select style="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>
</div>
</template>
<script>
import { listData } from "@/api/system/dict/data"
export default {
name: "SelectCcwz",
components: {},
props: {
value: {
type: [Number, String , Array],
default: '',
},
readonly: {
type: Boolean,
default: false
},
multiple: {
type: Boolean,
default: false
},
filterable: {
type: Boolean,
default: true
},
placeholder: {
type: String,
default: ''
}
},
watch: {
value: {
immediate: true,
handler(v) {
if(!this.multiple){
this.selected = v ? v : ''
}else{
if(v){
//,
let arr = v.split(',')
let s = []
_.forEach(arr,a=>{
s.push(a)
})
this.selected = s
}else{
this.selected = []
}
}
}
},
},
data() {
return {
selected: '',
list: [],
queryParams: {
pageNum: 1,
pageSize: 9999,
dictType: 'system_business_ccwz',
status: 0
},
};
},
mounted() {
this.getList()
},
methods: {
getList() {
this.list = []
listData(this.queryParams).then(response => {
this.list = response.rows
})
},
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])
} else {
this.$emit('change', null)
}
},
}
};
</script>

+ 98
- 0
src/views/business/comps/select/SelectNddw.vue View File

@ -0,0 +1,98 @@
<!-- 浓度单位选择器 -->
<template>
<div>
<el-select style="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>
</div>
</template>
<script>
import { listData } from "@/api/system/dict/data"
export default {
name: "SelectNddw",
components: {},
props: {
value: {
type: [Number, String , Array],
default: '',
},
readonly: {
type: Boolean,
default: false
},
multiple: {
type: Boolean,
default: false
},
filterable: {
type: Boolean,
default: true
},
placeholder: {
type: String,
default: ''
}
},
watch: {
value: {
immediate: true,
handler(v) {
if(!this.multiple){
this.selected = v ? v : ''
}else{
if(v){
//,
let arr = v.split(',')
let s = []
_.forEach(arr,a=>{
s.push(a)
})
this.selected = s
}else{
this.selected = []
}
}
}
},
},
data() {
return {
selected: '',
list: [],
queryParams: {
pageNum: 1,
pageSize: 9999,
dictType: 'system_business_nddw',
status: 0
},
};
},
mounted() {
this.getList()
},
methods: {
getList() {
this.list = []
listData(this.queryParams).then(response => {
this.list = response.rows
})
},
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])
} else {
this.$emit('change', null)
}
},
}
};
</script>

+ 98
- 0
src/views/business/comps/select/SelectTjdw.vue View File

@ -0,0 +1,98 @@
<!-- 体积单位选择器 -->
<template>
<div>
<el-select style="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>
</div>
</template>
<script>
import { listData } from "@/api/system/dict/data"
export default {
name: "SelectTjdw",
components: {},
props: {
value: {
type: [Number, String , Array],
default: '',
},
readonly: {
type: Boolean,
default: false
},
multiple: {
type: Boolean,
default: false
},
filterable: {
type: Boolean,
default: true
},
placeholder: {
type: String,
default: ''
}
},
watch: {
value: {
immediate: true,
handler(v) {
if(!this.multiple){
this.selected = v ? v : ''
}else{
if(v){
//,
let arr = v.split(',')
let s = []
_.forEach(arr,a=>{
s.push(a)
})
this.selected = s
}else{
this.selected = []
}
}
}
},
},
data() {
return {
selected: '',
list: [],
queryParams: {
pageNum: 1,
pageSize: 9999,
dictType: 'system_business_tjdw',
status: 0
},
};
},
mounted() {
this.getList()
},
methods: {
getList() {
this.list = []
listData(this.queryParams).then(response => {
this.list = response.rows
})
},
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])
} else {
this.$emit('change', null)
}
},
}
};
</script>

+ 98
- 0
src/views/business/comps/select/SelectYxqdw.vue View File

@ -0,0 +1,98 @@
<!-- 有效期单位选择器 -->
<template>
<div>
<el-select style="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>
</div>
</template>
<script>
import { listData } from "@/api/system/dict/data"
export default {
name: "SelectYxqdw",
components: {},
props: {
value: {
type: [Number, String , Array],
default: '',
},
readonly: {
type: Boolean,
default: false
},
multiple: {
type: Boolean,
default: false
},
filterable: {
type: Boolean,
default: true
},
placeholder: {
type: String,
default: ''
}
},
watch: {
value: {
immediate: true,
handler(v) {
if(!this.multiple){
this.selected = v ? v : ''
}else{
if(v){
//,
let arr = v.split(',')
let s = []
_.forEach(arr,a=>{
s.push(a)
})
this.selected = s
}else{
this.selected = []
}
}
}
},
},
data() {
return {
selected: '',
list: [],
queryParams: {
pageNum: 1,
pageSize: 9999,
dictType: 'system_business_yxqdw',
status: 0
},
};
},
mounted() {
this.getList()
},
methods: {
getList() {
this.list = []
listData(this.queryParams).then(response => {
this.list = response.rows
})
},
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])
} else {
this.$emit('change', null)
}
},
}
};
</script>

+ 98
- 0
src/views/business/comps/select/SelectZldw.vue View File

@ -0,0 +1,98 @@
<!-- 质量单位选择器 -->
<template>
<div>
<el-select style="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>
</div>
</template>
<script>
import { listData } from "@/api/system/dict/data"
export default {
name: "SelectZldw",
components: {},
props: {
value: {
type: [Number, String , Array],
default: '',
},
readonly: {
type: Boolean,
default: false
},
multiple: {
type: Boolean,
default: false
},
filterable: {
type: Boolean,
default: true
},
placeholder: {
type: String,
default: ''
}
},
watch: {
value: {
immediate: true,
handler(v) {
if(!this.multiple){
this.selected = v ? v : ''
}else{
if(v){
//,
let arr = v.split(',')
let s = []
_.forEach(arr,a=>{
s.push(a)
})
this.selected = s
}else{
this.selected = []
}
}
}
},
},
data() {
return {
selected: '',
list: [],
queryParams: {
pageNum: 1,
pageSize: 9999,
dictType: 'system_business_zldw',
status: 0
},
};
},
mounted() {
this.getList()
},
methods: {
getList() {
this.list = []
listData(this.queryParams).then(response => {
this.list = response.rows
})
},
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])
} else {
this.$emit('change', null)
}
},
}
};
</script>

Loading…
Cancel
Save