This commit is contained in:
zk
2023-12-11 13:25:13 +08:00
parent bc15167485
commit c9663bb3ba
7 changed files with 149 additions and 33 deletions
@@ -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
}
}