manage-client
Version:
经营管控模块前台组件
64 lines (52 loc) • 2.21 kB
JavaScript
import Vue from 'vue'
import {HttpResetClass} from 'vue-client'
import GetSaleParam from './MagGetSaleParams'
let loadParamGen = async function (f_filialeid) {
let http = new HttpResetClass()
if (GetSaleParam.gasbrands.length === 0 && GetSaleParam.prices.length === 0 && GetSaleParam.adjustables.length === 0 ) {
let getParams = await http.load('POST','rs/logic/getSaleInitData', {data: {f_orgid: f_filialeid?f_filialeid: Vue.$login.f.orgid}}, {resolveMsg: null, rejectMsg: '获取营收参数出错!!!'})
if (getParams.data) {
MagLoadParams.organizeData(getParams.data)
}
} else {
GetSaleParam.gasbrands = []
GetSaleParam.prices = []
GetSaleParam.adjustables = []
let getParams = await http.load('POST','rs/logic/getSaleInitData', {data: {f_orgid: f_filialeid ? f_filialeid : Vue.$login.f.orgid}}, {resolveMsg: null, rejectMsg: '获取营收参数出错!!!'})
if (getParams.data) {
MagLoadParams.organizeData(getParams.data)
}
}
}
let MagLoadParams = {
install (Vue, options) {
// 给vue增添对话框显示方法
Vue.MagLoadParams = Vue.prototype.$MagLoadParams = MagLoadParams
},
async loadParam (f_filialeid) {
await loadParamGen(f_filialeid)
},
// 开启卡监听
organizeData (fromSystem) {
fromSystem.gasbrands.forEach((item, index) => {
GetSaleParam.gasbrands[index] = {}
GetSaleParam.gasbrands[index].label = item.f_meter_brand
let gasmodel = []
item.gasmodel.forEach((item, index) => {
gasmodel[index] = {}
gasmodel[index].label = item.f_meter_style + item.f_type
gasmodel[index].value = item
})
item.gasmodel = gasmodel
GetSaleParam.gasbrands[index].value = item
})
fromSystem.adjustable.forEach((item, index) => {
GetSaleParam.adjustables[index] = {}
GetSaleParam.adjustables[index].label = item.f_adjustable_name
GetSaleParam.adjustables[index].value = item
})
GetSaleParam.prices = [...GetSaleParam.prices, ...fromSystem.price]
console.log('参数组织完毕', GetSaleParam)
},
}
export default MagLoadParams