|
@@ -1,6 +1,9 @@
|
|
|
|
|
+import { initData } from '@/common/methods'
|
|
|
import { SelectOption } from '@/common/setup/filter/interface'
|
|
import { SelectOption } from '@/common/setup/filter/interface'
|
|
|
|
|
+import APP from '@/services'
|
|
|
import { getUsrId } from '@/services/bus/user'
|
|
import { getUsrId } from '@/services/bus/user'
|
|
|
import { QueryMiddleGoodsDetail } from '@/services/go/ermcp/goodsInfo'
|
|
import { QueryMiddleGoodsDetail } from '@/services/go/ermcp/goodsInfo'
|
|
|
|
|
+import { Ermcp3Brand, Ermcp3Wrstandard, ErmcpDeliveryGoodsDetailEx } from '@/services/go/ermcp/goodsInfo/interface'
|
|
|
import moment, { Moment } from "moment"
|
|
import moment, { Moment } from "moment"
|
|
|
import { ref, SetupContext } from "vue"
|
|
import { ref, SetupContext } from "vue"
|
|
|
import { reportCycleType, reportCyleTimeType } from "./enum"
|
|
import { reportCycleType, reportCyleTimeType } from "./enum"
|
|
@@ -82,14 +85,11 @@ export function handleInitTypeAndTime() {
|
|
|
return { getInitTime, getInitType }
|
|
return { getInitTime, getInitType }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
+// 获取套保品种
|
|
|
export function handlMiddleGoods() {
|
|
export function handlMiddleGoods() {
|
|
|
const middleGoods = ref<SelectOption[]>([])
|
|
const middleGoods = ref<SelectOption[]>([])
|
|
|
- // 获取套保品种
|
|
|
|
|
function getTBList() {
|
|
function getTBList() {
|
|
|
return QueryMiddleGoodsDetail().then((res) => {
|
|
return QueryMiddleGoodsDetail().then((res) => {
|
|
|
- console.log('获取套保品种', res);
|
|
|
|
|
-
|
|
|
|
|
const result: SelectOption[] = [];
|
|
const result: SelectOption[] = [];
|
|
|
res.forEach((e) => {
|
|
res.forEach((e) => {
|
|
|
const { isvalid, middlegoodsname, middlegoodsid } = e.mg;
|
|
const { isvalid, middlegoodsname, middlegoodsid } = e.mg;
|
|
@@ -102,3 +102,51 @@ export function handlMiddleGoods() {
|
|
|
}
|
|
}
|
|
|
return { middleGoods, getTBList }
|
|
return { middleGoods, getTBList }
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+export function handleDG(context: SetupContext) {
|
|
|
|
|
+ // 现货品种
|
|
|
|
|
+ const DGList = ref<ErmcpDeliveryGoodsDetailEx[]>([])
|
|
|
|
|
+ const selectedDG = ref<Value | undefined>(undefined);
|
|
|
|
|
+ // 品牌
|
|
|
|
|
+ const gblist = ref<Ermcp3Brand[]>([])
|
|
|
|
|
+ const selectedGB = ref<Value | undefined>(undefined);
|
|
|
|
|
+ // 品类列表
|
|
|
|
|
+ const gmlist = ref<Ermcp3Wrstandard[]>([])
|
|
|
|
|
+ const selectedGM = ref<Value | undefined>(undefined);
|
|
|
|
|
+ function getDG() {
|
|
|
|
|
+ DGList.value = APP.get('DeliveryGoodsList').filter((e: ErmcpDeliveryGoodsDetailEx) => e.data.isvalid === 1)
|
|
|
|
|
+ }
|
|
|
|
|
+ initData(() => {
|
|
|
|
|
+ getDG()
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ function DGChange(value: any) {
|
|
|
|
|
+ const temp = DGList.value.find((e: ErmcpDeliveryGoodsDetailEx) => e.data.deliverygoodsname === value.key)
|
|
|
|
|
+ console.log('tem', temp)
|
|
|
|
|
+ if (temp) {
|
|
|
|
|
+ gblist.value = temp.gblist
|
|
|
|
|
+ gmlist.value = temp.gmlist
|
|
|
|
|
+ }
|
|
|
|
|
+ filterAction()
|
|
|
|
|
+ }
|
|
|
|
|
+ function GBOrGMChange() {
|
|
|
|
|
+ filterAction()
|
|
|
|
|
+ }
|
|
|
|
|
+ function filterAction() {
|
|
|
|
|
+ console.log(selectedDG.value)
|
|
|
|
|
+ const deliverygoodsname = selectedDG.value ? [selectedDG.value.key] : ['']
|
|
|
|
|
+ const brandname = selectedGB.value ? [selectedGB.value.key] : ['']
|
|
|
|
|
+ const wrstandardname = selectedGM.value ? [selectedGM.value.key] : ['']
|
|
|
|
|
+ const result = { deliverygoodsname, brandname, wrstandardname }
|
|
|
|
|
+ context.emit('filter', result)
|
|
|
|
|
+ }
|
|
|
|
|
+ function reset() {
|
|
|
|
|
+ selectedDG.value = undefined
|
|
|
|
|
+ selectedGB.value = undefined
|
|
|
|
|
+ selectedGM.value = undefined
|
|
|
|
|
+ filterAction()
|
|
|
|
|
+ }
|
|
|
|
|
+ return { DGList, gblist, gmlist, selectedDG, selectedGB, selectedGM, DGChange, reset, GBOrGMChange }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+// 获取品种数据
|