|
|
@@ -18,13 +18,13 @@
|
|
|
:key="idx"
|
|
|
:label="item.name||item.label"
|
|
|
:value="item.value">
|
|
|
- <span class="option-item" style="float: left"><i :style="setupColorStyle(state.colorList[item.value%8])">{{ item.name||item.label }}</i></span>
|
|
|
+ <span class="option-item" style="float: left"><i :style="setupColorStyle(state.colorList[item.value%8])">{{ item.name || item.label }}</i></span>
|
|
|
<!-- :style="setupColorStyle(item.color)"-->
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
</template>
|
|
|
<script setup lang="ts" name="ExtDSelect">
|
|
|
-import { onMounted, reactive,watch} from 'vue';
|
|
|
+import {onMounted, reactive, watch} from 'vue';
|
|
|
import {Session} from "/@/utils/storage";
|
|
|
import u from "/@/utils/u";
|
|
|
|
|
|
@@ -58,28 +58,28 @@ const props = defineProps({
|
|
|
type: String,
|
|
|
default: '请选择'
|
|
|
},
|
|
|
- size:{
|
|
|
- type:String,
|
|
|
- default:'default'
|
|
|
+ size: {
|
|
|
+ type: String,
|
|
|
+ default: 'default'
|
|
|
}
|
|
|
})
|
|
|
|
|
|
const state = reactive({
|
|
|
- dicts:[],
|
|
|
- dataVal:null as any,
|
|
|
- colorList:["#FFB800","#009688","#1E9FFF","#00C7D2","#599CDE","#FF5722","#eb2f96","#4a5055"],
|
|
|
- dictList:{
|
|
|
- 'User.status':[
|
|
|
- {label:'有效',value:1},
|
|
|
- {label:'无效',value:0},
|
|
|
+ dicts: [] as Array<any>,
|
|
|
+ dataVal: null as any,
|
|
|
+ colorList: ["#FFB800", "#009688", "#1E9FFF", "#00C7D2", "#599CDE", "#FF5722", "#eb2f96", "#4a5055"],
|
|
|
+ dictList: {
|
|
|
+ 'User.status': [
|
|
|
+ {label: '有效', value: 1},
|
|
|
+ {label: '无效', value: 0},
|
|
|
]
|
|
|
}
|
|
|
})
|
|
|
|
|
|
-const emit = defineEmits(['update:modelValue','on-change']);
|
|
|
+const emit = defineEmits(['update:modelValue', 'on-change']);
|
|
|
|
|
|
-watch(()=>props.modelValue,(val,oldVal)=>{
|
|
|
- console.log('ExtDSelect',val,oldVal)
|
|
|
+watch(() => props.modelValue, (val, oldVal) => {
|
|
|
+ console.log('ExtDSelect', val, oldVal)
|
|
|
state.dataVal = props.modelValue;
|
|
|
})
|
|
|
|
|
|
@@ -110,8 +110,8 @@ onMounted(() => {
|
|
|
const dicts = Session.get("dicts");
|
|
|
if (!u.isEmptyOrNull(dicts)) {
|
|
|
state.dicts = dicts[props.type];
|
|
|
- }else{
|
|
|
- state.dicts =state. dictList[props.type]
|
|
|
+ } else {
|
|
|
+ state.dicts = state.dictList[props.type]
|
|
|
console.table(state.dicts)
|
|
|
}
|
|
|
|