update
This commit is contained in:
@@ -13,3 +13,58 @@
|
||||
// },
|
||||
// ];
|
||||
|
||||
import {onMounted, ref} from "vue";
|
||||
import {allSecondaryDeparts} from "/@/components/secondaryScreen/commonApi";
|
||||
|
||||
export function useDepart({selectOption = [],}) {
|
||||
const orgCode = ref();
|
||||
const option = ref([]);
|
||||
const fieldNames = {label: 'departName', value: 'orgCode',}
|
||||
onMounted(() => {
|
||||
if (selectOption && Array.isArray(selectOption) && selectOption.length > 0) {
|
||||
setOption(selectOption);
|
||||
} else {
|
||||
getOptionData();
|
||||
}
|
||||
});
|
||||
|
||||
function setOption(option) {
|
||||
option.value = selectOption || option;
|
||||
}
|
||||
|
||||
async function getOptionData() {
|
||||
const {result, code} = await allSecondaryDeparts();
|
||||
if (code == 200) {
|
||||
option.value = result;
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
orgCode,
|
||||
option,
|
||||
setOption,
|
||||
fieldNames
|
||||
};
|
||||
}
|
||||
|
||||
export function useTimeType(t) {
|
||||
const type = ref(t || '')
|
||||
const timeRangeOption = [
|
||||
{
|
||||
label: '近一周',
|
||||
value: 'week'
|
||||
},
|
||||
{
|
||||
label: '近一月',
|
||||
value: 'month'
|
||||
},
|
||||
{
|
||||
label: '近一年',
|
||||
value: 'year'
|
||||
}
|
||||
]
|
||||
return {
|
||||
type,
|
||||
timeRangeOption
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user