Merge pull request 'feat: 审批状态展示添加,任务审批审批状态字段变更,完善逻辑' (#69) from feat/task_select into test
Reviewed-on: #69pull/70/head^2
commit
f3433010de
@ -0,0 +1,77 @@
|
||||
<script lang="ts" setup>
|
||||
import { onBeforeMount, onMounted, ref } from 'vue'
|
||||
import type { FormRules } from 'naive-ui'
|
||||
import { useDictionary } from '@/store/modules/dictonary'
|
||||
import { useConfig } from '@/store/modules/asideConfig'
|
||||
|
||||
const configUseStore = useConfig()
|
||||
|
||||
configUseStore.$subscribe(() => {
|
||||
if(isLoadValue.value) {
|
||||
isLoadValue.value = false;
|
||||
return
|
||||
}
|
||||
let asideValue = configUseStore.getAsideValue;
|
||||
if(asideValue['izApprovalStatus'] && typeof asideValue['izApprovalStatus'] == "string") {
|
||||
let list = asideValue['izApprovalStatus'].split(',');
|
||||
formValue.value.plans = list;
|
||||
console.log("formValue.value.izApprovalStatus", formValue.value.plans);
|
||||
}else {
|
||||
formValue.value.plans = [];
|
||||
}
|
||||
});
|
||||
const props = defineProps<{
|
||||
value: string[] | null
|
||||
label: string
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'update:value', value: string[]): void
|
||||
}>()
|
||||
|
||||
const formValue = ref({
|
||||
plans: props.value,
|
||||
})
|
||||
if(typeof formValue.value.plans == "string") {
|
||||
let list = formValue.value.plans.split(',');
|
||||
formValue.value.plans = list;
|
||||
}
|
||||
const rules: FormRules = {
|
||||
plans: [
|
||||
{
|
||||
required: false,
|
||||
type: 'array',
|
||||
trigger: ['blur', 'change'],
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
const options = ref([])
|
||||
const configStore = useDictionary()
|
||||
const labStyle = {
|
||||
fontWeight: 'bold',
|
||||
}
|
||||
|
||||
onBeforeMount(async () => {
|
||||
const list = await configStore.fetchizApprovalStatusList()
|
||||
options.value = list
|
||||
})
|
||||
const isLoadValue = ref(false)
|
||||
function onChange(value: Array<string>) {
|
||||
isLoadValue.value = true;
|
||||
emit('update:value', value)
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<n-form :model="formValue" style="padding: 0px 10px;" :rules="rules">
|
||||
<n-form-item :label="label" path="plans" :label-style="labStyle">
|
||||
<n-select filterable
|
||||
v-model:value="formValue.plans" :max-tag-count="2" placeholder="请选择审核状态" multiple
|
||||
:options="options" @update:value="onChange"
|
||||
/>
|
||||
</n-form-item>
|
||||
</n-form>
|
||||
</template>
|
||||
|
||||
<style lang="less" scoped></style>
|
Loading…
Reference in new issue