
import { allProvidersListApi, cycleTypeListApi, feeItemGetTypeListApi, getBranchCompanyCustomersApi, getCalculateUnitListApi, getCountryListApi, getCountTypeListApi, getCurrencyApi, getCustomertApi, geteightArithmeticListApi, getFeeItemListApi, getfeeItemSpecialFlagApi, getfeeItemTypeApi, getFeeSetTypeApi, getPackageTypeListApi, getParametersListApi, getPartitionTypeListApi, getPickValueTypeListApi, getPortInfoListApi, getproductApi, getSpecialParametersListApi, getUnitTypeListApi, jobStatusListApi, shareTypeListApi, unitTypeIntegerListApi, specialFeeItemListApi, unitTypeParamListApi, customerTypeListApi, operatingTypeListApi, feeDataTypeListApi, feeQueryTypeListApi, reportModelTypeListApi, reportQueryDateTypeListApi, companyEntityTypeListApi, airBusinessTypeListApi, airCompanyListApi, deliverChannelListApi, getCostFeeItemListApi, compareTypeListApi, mpsCountFeeTypeListApi, accountPeriodTypeListApi, customerBillStatusListApi, getMpsParametersListApi, getRemoteSurveyTypeListApi, getCopyDataTypeListApi, getPaymentPlatformList, getAllPaymentPlatformList, getProfitStatusList } from '@/api/base/basedata';
import { ListIitem } from '@/api/base/BaseDataModel';
import { useReturnData } from '@/utils/useReturnData';
import { defineStore } from 'pinia'
//定义state类型
export type DropDownState = {
    weightArithmeticList: Array<ListIitem>
    unitTypeList: Array<ListIitem>
    feeItemList: Array<Recordable>
    countTypeList: Array<ListIitem>
    costFeeItemList: Array<ListIitem>
    packageTypeList: Array<ListIitem>
    portInfoList: Array<ListIitem>
    countryList: Array<ListIitem>
    calculateUnitList: Array<ListIitem>
    specialParametersList: Array<ListIitem>
    partitionTypeList: Array<ListIitem>
    parametersList: Array<ListIitem>
    mpsParametersList: Array<ListIitem>
    remoteSurveyTypeList: Array<ListIitem>
    pickValueTypeList: Array<ListIitem>
    unitTypeIntegerList: Array<ListIitem>
    productList: Array<ListIitem>
    customertList: Array<ListIitem>
    branchCompanyCustomers: Array<ListIitem>
    feeSetTypeList: Array<ListIitem>
    currencyList: Array<ListIitem>
    feeItemTypeList: Array<ListIitem>
    feeItemSpecialFlagList: Array<ListIitem>
    allProvidersList: Array<ListIitem>
    deliverChannelList: Array<ListIitem>
    shareTypeList: Array<ListIitem>
    cycleTypeList: Array<ListIitem>
    jobStatusList: Array<ListIitem>
    feeItemGetTypeList: Array<ListIitem>
    specialFeeItemList: Array<ListIitem>
    unitTypeParamList: Array<ListIitem>
    customerTypeList: Array<ListIitem>
    operatingTypeList: Array<ListIitem>
    feeDataTypeList: Array<ListIitem>
    feeQueryTypeList: Array<ListIitem>
    reportModelTypeList: Array<ListIitem>
    reportQueryDateTypeList: Array<ListIitem>
    companyEntityTypeList: Array<ListIitem>
    airBusinessTypeList: Array<ListIitem>
    airCompanyList: Array<ListIitem>
    compareTypeList: Array<ListIitem>
    mpsCountFeeTypeList: Array<ListIitem>
    accountPeriodTypeList: Array<ListIitem>
    customerBillStatusList: Array<ListIitem>
    copyDataTypeList: Array<ListIitem>
    paymentPlatformList: Array<ListIitem>
    allPaymentPlatformList: Array<ListIitem>
    profitStatusList: Array<ListIitem>
}
const { resData } = useReturnData(true)
//定义` 下拉框列表 `store
export const useDropDownDataStore = defineStore('dropDownData', {
    state: (): DropDownState => {
        return {
            weightArithmeticList: [],//重量计算方式列表
            unitTypeList: [],//单位类型列表
            feeItemList: [],//费用类型列表
            countTypeList: [],//算法
            costFeeItemList: [],//成本费用类型
            packageTypeList: [],//包装类型列表
            portInfoList: [],//口岸列表
            countryList: [],//国家/地区列表
            calculateUnitList: [],//计量重量
            specialParametersList: [],//特殊参数
            partitionTypeList: [],//分区类型
            parametersList: [],//计费参数
            mpsParametersList: [],
            remoteSurveyTypeList: [],//是否是偏远
            pickValueTypeList: [],//取值对比
            unitTypeIntegerList: [],//计算符
            productList: [],//产品列表
            customertList: [],//客户
            branchCompanyCustomers: [],//公司
            feeSetTypeList: [],//费用类型
            currencyList: [],//币种
            feeItemTypeList: [],//费用类型
            feeItemSpecialFlagList: [],//特殊费用
            allProvidersList: [],//渠道商
            deliverChannelList: [],//成本产品列表
            shareTypeList: [],//分摊方式
            cycleTypeList: [],//周期类型
            jobStatusList: [],//任务状态
            feeItemGetTypeList: [],//取值类型
            specialFeeItemList: [],//特殊费用类型
            unitTypeParamList: [],//计算符号
            customerTypeList: [],//费用类型
            operatingTypeList: [],//费用操作类型
            feeDataTypeList: [],//费用数据类型
            feeQueryTypeList: [],//费用查询类型
            reportModelTypeList: [],//报表模板类型
            reportQueryDateTypeList: [],//报表模板类型
            companyEntityTypeList: [],//主体类型
            airBusinessTypeList: [],//航空业务类型
            airCompanyList: [],//航空公司
            compareTypeList: [],//大货比价类型
            mpsCountFeeTypeList: [],//一票多件计费方式
            accountPeriodTypeList: [],//账期类型
            customerBillStatusList: [],//客户账单状态
            copyDataTypeList: [],//拷贝数据类型
            paymentPlatformList: [],//支付平台下拉框数据
            allPaymentPlatformList: [],//支付方式列表
            profitStatusList: [],//盈利状态列表
        }
    },
    actions: {
        /**
         * 获取重量计算方式列表
         */
        async addWeightArithmeticList() {
            // 判断如果有数据就不请求接口
            if (this.weightArithmeticList.length > 0) return;
            const res = await geteightArithmeticListApi()
            this.weightArithmeticList = resData(res)
        },
        /**
         * 获取单位类型列表
         */
        async addUnitTypeList() {
            if (this.unitTypeList.length > 0) return;
            const res = await getUnitTypeListApi()
            this.unitTypeList = resData(res)
        },
        /**
         * 获取费用类型列表
         */
        async addFeeItemList() {
            if (this.feeItemList.length > 0) return;
            const res = await getFeeItemListApi()
            this.feeItemList = resData(res)
        },
        async addStratFeeItemList() {
            if (this.feeItemList.length > 0) return this.feeItemList;
            const res = await getFeeItemListApi()
            this.feeItemList = resData(res)
            return this.feeItemList
        },
        /**
         * 获取成本费用类型列表
         */
        async addCostFeeItemList() {
            if (this.costFeeItemList.length > 0) return;
            const res = await getCostFeeItemListApi()
            this.costFeeItemList = resData(res)
        },
        /**
         * 获取算法列表
         */
        async addCountTypeList() {
            if (this.countTypeList.length > 0) return;
            const res = await getCountTypeListApi()
            this.countTypeList = resData(res)
        },
        /**
         * 获取包装类型列表
         */
        async addPackageTypeList() {
            if (this.packageTypeList.length > 0) return;
            const res = await getPackageTypeListApi()
            this.packageTypeList = resData(res)
        },
        /**
         * 获取口岸列表
         */
        async addPortInfoList() {
            if (this.portInfoList.length > 0) return;
            const res = await getPortInfoListApi()
            this.portInfoList = resData(res)
        },
        /**
         * 获取国家/地区列表
         */
        async addCountryList() {
            if (this.countryList.length > 0) return;
            const res = await getCountryListApi()
            this.countryList = resData(res)
        },
        /**
         * 获取计量单位列表
         */
        async addCalculateUnitList() {
            if (this.calculateUnitList.length > 0) return;
            const res = await getCalculateUnitListApi()
            this.calculateUnitList = resData(res)
        },
        /**
         * 获取特殊参数下拉列表框数据
         */
        async addSpecialParametersList() {
            if (this.specialParametersList.length > 0) return;
            const res = await getSpecialParametersListApi()
            this.specialParametersList = resData(res)
        },
        /**
         * 获取分区类型列表
         */
        async addPartitionTypeList() {
            if (this.partitionTypeList.length > 0) return;
            const res = await getPartitionTypeListApi()
            this.partitionTypeList = resData(res)
        },
        /**
         * 获取计费参数列表
         */
        async addParametersList() {
            if (this.parametersList.length > 0) return;
            const res = await getParametersListApi()
            this.parametersList = resData(res)
        },
        /**
         * 获取偏远计算符号列表
         */
        async addMpsParametersList() {
            if (this.mpsParametersList.length > 0) return;
            const res = await getMpsParametersListApi()
            this.mpsParametersList = resData(res)
        },
        /**
         * 是否是偏远
         */
        async addRemoteSurveyTypeList() {
            if (this.remoteSurveyTypeList.length > 0) return;
            const res = await getRemoteSurveyTypeListApi()
            this.remoteSurveyTypeList = resData(res)
        },
        /**
         * 获取取值对比列表
         */
        async addPickValueTypeList() {
            if (this.pickValueTypeList.length > 0) return;
            const res = await getPickValueTypeListApi()
            this.pickValueTypeList = resData(res)
        },
        /**
         * 获取计算符列表
         */
        async addUnitTypeIntegerList() {
            if (this.unitTypeIntegerList.length > 0) return;
            const res = await unitTypeIntegerListApi()
            this.unitTypeIntegerList = resData(res)
        },
        /**
         * 获产品数据
         */
        async addProductList() {
            if (this.productList.length > 0) return this.productList;
            const res = await getproductApi()
            this.productList = resData(res)
            return this.productList
        },
        /**
         * 获客户数据
         */
        async addCustomertList() {
            if (this.customertList.length > 0) return;
            const res = await getCustomertApi()
            this.customertList = resData(res)
        },
        /**
         * 获取分公司信息
         */
        async addBranchCompanyCustomers() {
            if (this.branchCompanyCustomers.length > 0) return;
            const res = await getBranchCompanyCustomersApi()
            this.branchCompanyCustomers = resData(res)
        },
        /**
         * 获取费用类型
         */
        async addFeeSetTypeList() {
            if (this.feeSetTypeList.length > 0) return;
            const res = await getFeeSetTypeApi()
            this.feeSetTypeList = resData(res)
        },
        /**
         * 获取币种
         */
        async addCurrencyList() {
            // 判断如果有数据就不请求接口
            if (this.currencyList.length > 0) return;
            const res = await getCurrencyApi()
            this.currencyList = resData(res)
        },
        /**
         * 费用类型store
         */
        async addFeeItemTypeList() {
            if (this.feeItemTypeList.length > 0) return;
            const res = await getfeeItemTypeApi()
            this.feeItemTypeList = resData(res)
        },
        /**
         * 费用特殊类别store
         */
        async addFeeItemSpecialFlagList() {
            if (this.feeItemSpecialFlagList.length > 0) return;
            const res = await getfeeItemSpecialFlagApi()
            this.feeItemSpecialFlagList = resData(res)
        },
        /**
         * 渠道商store
         */
        async addAllProvidersList() {
            if (this.allProvidersList.length > 0) return this.allProvidersList;
            const res = await allProvidersListApi()
            this.allProvidersList = resData(res)
            return this.allProvidersList
        },
        /**
         * 成本产品列表
         */
        async addDeliverChannelListApi() {
            if (this.deliverChannelList.length > 0) return;
            const res = await deliverChannelListApi()
            this.deliverChannelList = resData(res)
        },
        /**
         * 分摊方式 store
         */
        async addShareTypeList() {
            if (this.shareTypeList.length > 0) return
            const res = await shareTypeListApi()
            this.shareTypeList = resData(res)
        },
        /**
         * 周期类型
         */
        async addCycleTypeList() {
            if (this.cycleTypeList.length > 0) return this.cycleTypeList
            const res = await cycleTypeListApi()
            this.cycleTypeList = resData(res)
            return this.cycleTypeList
        },
        /**
         * 任务状态
         */
        async addJobStatusList() {
            if (this.jobStatusList.length > 0) return this.jobStatusList
            const res = await jobStatusListApi()
            this.jobStatusList = resData(res)
            return this.jobStatusList
        },
        /**
         * 费用取值类型
         */
        async addFeeItemGetTypeList() {
            if (this.feeItemGetTypeList.length > 0) return
            const res = await feeItemGetTypeListApi()
            this.feeItemGetTypeList = resData(res)
        },
        /**
       * 费用特使费用类型
       */
        async addSpecialFeeItemList() {
            if (this.specialFeeItemList.length > 0) return
            const res = await specialFeeItemListApi()
            this.specialFeeItemList = resData(res)
        },
        /**
         * 计算符号
         */
        async addUnitTypeParamList() {
            if (this.unitTypeParamList.length > 0) return
            const res = await unitTypeParamListApi()
            this.unitTypeParamList = resData(res)
        },
        /**
         * 费用类型
         */
        async addCustomerTypeList() {
            if (this.customerTypeList.length > 0) return
            const res = await customerTypeListApi()
            this.customerTypeList = resData(res)
        },
        /**
         * 费用操作类型
         */
        async addOperatingTypeList() {
            if (this.operatingTypeList.length > 0) return
            const res = await operatingTypeListApi()
            this.operatingTypeList = resData(res)
        },
        /**
         * 费用数据类型
         */
        async addFeeDataTypeList() {
            if (this.feeDataTypeList.length > 0) return
            const res = await feeDataTypeListApi()
            this.feeDataTypeList = resData(res)
        },
        /**
         * 费用数据类型
         */
        async addFeeQueryTypeList() {
            if (this.feeQueryTypeList.length > 0) return
            const res = await feeQueryTypeListApi()
            this.feeQueryTypeList = resData(res)
        },
        /**
         * 报表模板类型
         */
        async addReportModelTypeList() {
            if (this.reportModelTypeList.length > 0) return
            const res = await reportModelTypeListApi()
            this.reportModelTypeList = resData(res)
        },
        /**
         * 查询时间类型
         */
        async addReportQueryDateTypeList() {
            if (this.reportQueryDateTypeList.length > 0) return
            const res = await reportQueryDateTypeListApi()
            this.reportQueryDateTypeList = resData(res)
        },
        /**
         * 主体类型
         */
        async addCompanyEntityTypeListApi() {
            if (this.companyEntityTypeList.length > 0) return
            const res = await companyEntityTypeListApi()
            this.companyEntityTypeList = resData(res)
        },
        /**
         * 航空业务类型
         */
        async addAirBusinessTypeListApi() {
            if (this.airBusinessTypeList.length > 0) return
            const res = await airBusinessTypeListApi()
            this.airBusinessTypeList = resData(res)
        },
        /**
         * 航空公司
         */
        async addAirCompanyListApi() {
            if (this.airCompanyList.length > 0) return
            const res = await airCompanyListApi()
            this.airCompanyList = resData(res)
        },
        /**
         * 大货比价类型
         */
        async addCompareTypeList() {
            if (this.compareTypeList.length > 0) return
            const res = await compareTypeListApi()
            this.compareTypeList = resData(res)
        },
        /**
         * 大货比价类型
         */
        async addMpsCountFeeTypeList() {
            if (this.mpsCountFeeTypeList.length > 0) return
            const res = await mpsCountFeeTypeListApi()
            this.mpsCountFeeTypeList = resData(res)
        },
        /**
         *  账期类型
         */
        async addAccountPeriodTypeList() {
            if (this.accountPeriodTypeList.length > 0) return
            const res = await accountPeriodTypeListApi()
            this.accountPeriodTypeList = resData(res)
        },
        /**
         *  客户账单状态
         */
        async addCustomerBillStatusList() {
            if (this.customerBillStatusList.length > 0) return
            const res = await customerBillStatusListApi()
            this.customerBillStatusList = resData(res)
        },
        /**
         *  拷贝数据类型列表
         */
        async addCopyDataTypeList() {
            if (this.copyDataTypeList.length > 0) return
            const res = await getCopyDataTypeListApi()
            this.copyDataTypeList = resData(res)
        },
        /**
         *  支付平台下拉框数据
         */
        async addPaymentPlatformList() {
            if (this.paymentPlatformList.length > 0) return
            const res = await getPaymentPlatformList()
            this.paymentPlatformList = resData(res)
        },
        /**
         *  支付方式列表数据
         */
        async addAllPaymentPlatformList() {
            if (this.allPaymentPlatformList.length > 0) return
            const res = await getAllPaymentPlatformList()
            this.allPaymentPlatformList = resData(res)
        },
        /**
         *  盈利状态列表
         */
        async addProfitStatusList() {
            if (this.profitStatusList.length > 0) return
            const res = await getProfitStatusList()
            this.profitStatusList = resData(res)
        },
    },
    getters: {
        getWeightArithmeticList(state) {
            return state.weightArithmeticList;
        },
        getUnitTypeList(state) {
            return state.unitTypeList;
        },
        getFeeItemList(state) {
            return state.feeItemList;
        },
        getCountTypeList(state) {
            return state.countTypeList;
        },
        getPackageTypeList(state) {
            return state.packageTypeList;
        },
        getPortInfoList(state) {
            return state.portInfoList;
        },
        getCountryList(state) {
            return state.countryList;
        },
        getCalculateUnitList(state) {
            return state.calculateUnitList;
        },
        getSpecialParametersList(state) {
            return state.specialParametersList;
        },
        getPartitionTypeList(state) {
            return state.partitionTypeList;
        },
        getParametersList(state) {
            return state.parametersList;
        },
        getMpsParametersList(state) {
            return state.mpsParametersList
        },
        getRemoteSurveyTypeList(state) {
            return state.remoteSurveyTypeList
        },
        getPickValueTypeList(state) {
            return state.pickValueTypeList;
        },
        getUnitTypeIntegerList(state) {
            return state.unitTypeIntegerList;
        },
        getProductList(state) {
            return state.productList;
        },
        getCustomertList(state) {
            return state.customertList;
        },
        getBranchCompanyCustomers(state) {
            return state.branchCompanyCustomers;
        },
        getFeeSetTypeList(state) {
            return state.feeSetTypeList;
        },
        getCurrencyList(state) {
            return state.currencyList;
        },
        getFeeItemTypeList(state) {
            return state.feeItemTypeList;
        },
        getFeeItemSpecialFlagList(state) {
            return state.feeItemSpecialFlagList;
        },
        getAllProvidersList(state) {
            return state.allProvidersList;
        },
        getDeliverChannelList(state) {
            return state.deliverChannelList
        },
        getShareTypeList(state) {
            return state.shareTypeList;
        },
        getCycleTypeList(state) {
            return state.cycleTypeList;
        },
        getJobStatusList(state) {
            return state.cycleTypeList;
        },
        getFeeItemGetTypeList(state) {
            return state.feeItemGetTypeList
        },
        getspecialFeeItemList(state) {
            return state.specialFeeItemList
        },
        getUnitTypeParamList(state) {
            return state.unitTypeParamList
        },
        getCustomerTypeList(state) {
            return state.customerTypeList
        },
        getOperatingTypeList(state) {
            return state.operatingTypeList
        },
        getFeeDataTypeList(state) {
            return state.feeDataTypeList
        },
        getFeeQueryTypeList(state) {
            return state.feeQueryTypeList
        },
        getReportModelTypeList(state) {
            return state.reportModelTypeList
        },
        getReportQueryDateTypeList(state) {
            return state.reportQueryDateTypeList
        },
        getCompanyEntityTypeList(state) {
            return state.companyEntityTypeList
        },
        getAirBusinessTypeList(state) {
            return state.airBusinessTypeList
        },
        getAirCompanyList(state) {
            return state.airCompanyList
        },
        getCostFeeItemList(state) {
            return state.costFeeItemList
        },
        getCompareTypeList(state) {
            return state.compareTypeList
        },
        getMpsCountFeeTypeList(state) {
            return state.mpsCountFeeTypeList
        },
        getAccountPeriodTypeList(state) {
            return state.accountPeriodTypeList
        },
        getcustomerBillStatusList(state) {
            return state.customerBillStatusList
        },
        getCopyDataTypeList(state) {
            return state.copyDataTypeList
        },
        getPaymentPlatformList(state) {
            return state.paymentPlatformList
        },
        getAllPaymentPlatformList(state) {
            return state.allPaymentPlatformList
        },
        getProfitStatusList(state) {
            return state.profitStatusList
        }
    }
})