126 lines
2.6 KiB
TypeScript
126 lines
2.6 KiB
TypeScript
// export const tabList = [
|
|
// {
|
|
// name: '所有资源',
|
|
// type: TabType.all,
|
|
// },
|
|
// {
|
|
// name: '油田医院',
|
|
// type: TabType.youTianYiYuan,
|
|
// },
|
|
// {
|
|
// name: '医疗点',
|
|
// type: TabType.yiLiaoDian,
|
|
// },
|
|
// ];
|
|
import {cloneDeep} from 'lodash-es';
|
|
import {nextTick, onMounted, ref} from "vue";
|
|
import {allSecondaryDeparts} from "/@/components/secondaryScreen/commonApi";
|
|
|
|
export const watchIcon = new URL('/@/assets/img/watch.png', import.meta.url).href;
|
|
|
|
export function useDepart() {
|
|
const orgCode = ref();
|
|
const option = ref([]);
|
|
const fieldNames = {label: 'departName', value: 'orgCode',}
|
|
onMounted(() => {
|
|
getOptionData();
|
|
});
|
|
|
|
function setOption(data) {
|
|
option.value = data;
|
|
orgCode.value = data[0]?.orgCode
|
|
}
|
|
|
|
async function getOptionData() {
|
|
const {result, code} = await allSecondaryDeparts();
|
|
if (code == 200) {
|
|
setOption(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
|
|
}
|
|
}
|
|
|
|
export function useFooterTable() {
|
|
const footerList = ref([
|
|
{
|
|
name: '单位名称',
|
|
value: '',
|
|
key: 'orgName'
|
|
},
|
|
{
|
|
name: '单位人数',
|
|
value: '',
|
|
key: 'userCount'
|
|
},
|
|
{
|
|
name: '入库设备数量',
|
|
value: '',
|
|
key: 'deviceNum'
|
|
},
|
|
{
|
|
name: '佩戴手表人数',
|
|
value: '',
|
|
key: 'allotDeviceNum'
|
|
},
|
|
{
|
|
name: '近一周活跃人数',
|
|
value: '',
|
|
key: 'sevenDayNum'
|
|
},
|
|
{
|
|
name: '近一月活跃人数',
|
|
value: '',
|
|
key: 'a'
|
|
},
|
|
{
|
|
name: '近一年活跃人数',
|
|
value: '',
|
|
key: 'b'
|
|
}
|
|
])
|
|
|
|
function setFooterList(res: any) {
|
|
|
|
const arrList = cloneDeep(footerList.value)
|
|
if (res) {
|
|
arrList.forEach(item => {
|
|
item.value = res[item.key] || ''
|
|
})
|
|
}
|
|
footerList.value = arrList
|
|
|
|
}
|
|
|
|
return {
|
|
footerList,
|
|
setFooterList
|
|
}
|
|
} |