-- 修改

This commit is contained in:
yuping
2022-12-04 02:35:38 +08:00
parent c2692a615c
commit 8af9e5e53f
7 changed files with 227 additions and 145 deletions

View File

@@ -11,50 +11,36 @@
style="width: 100%"
:options="options"
allowClear
@change="change"
:disabled="disabled"
>
</a-select>
</template>
<script>
import {onMounted, reactive, toRefs, watch} from "vue";
<script setup>
import {computed, defineEmits, defineProps, onMounted, ref} from "vue";
import {useStore} from "vuex";
export default {
name: "ProjectClass",
const store = useStore();
props: {
modelValue: {
type: Number,
},
disabled: {
type: Boolean,
default: false
},
},
setup(props, ctx) {
const store = useStore();
const props = defineProps({
value: String,
disabled: String
})
const emit = defineEmits({})
const state = reactive({
options: [],
id: props.modelValue
});
const options = ref([])
watch(props, () => {
if (props.modelValue !== state.id) {
state.id = props.modelValue
}
})
watch(state.id,()=>{
ctx.emit('update:modelValue',state.id)
})
const id = computed(() => {
return props.value
})
onMounted(() => {
options.value = store.state.projectClass.map(e => ({value: parseInt(e.dictCode), label: e.dictName}))
})
function change(key, obj) {
emit('update:name', obj[0])
emit('update:value', key)
}
onMounted(() => {
state.options = store.state.projectClass.map(e => ({value: parseInt(e.dictCode), label: e.dictName}))
})
return {
...toRefs(state),
};
},
};
</script>