Beispiel #1
0
func (this *ProductController) UiUpdate() {
	item := s.Product
	oItemDef, _ := itemDef.EntityDefMap[item]
	sn := this.GetString(s.Sn)
	if sn == "" {
		beego.Error("UiUpdate error: ", stat.ParamSnIsNone)
		this.Ctx.WriteString(stat.ParamSnIsNone)
		return
	}
	params := t.Params{s.Sn: sn}
	code, oldValueMap := svc.Get(item, params)
	if code == "success" {
		oldValueMap = transProductMap(oldValueMap)
		this.FillFormElement(ui.BuildFormElement(oItemDef, oldValueMap, map[string]string{}))
		_, suppliers := supplierMgr.GetSupplierListByProductSn(sn)
		this.Data["supplierList"] = suppliers
		_, categorys := svc.GetAll(s.Category)
		this.Data["CategoryOptions"] = ui.BuildSelectOptions(categorys, "", s.Key, s.Name, s.Flag)
		this.TplNames = "product/update.tpl"
	} else {
		this.Ctx.WriteString(stat.ItemNotFound)
	}
}
Beispiel #2
0
func getSupplierList(productSn string) []map[string]interface{} {
	if status, supplierMaps := supplierMgr.GetSupplierListByProductSn(productSn); strings.EqualFold(status, stat.Success) {
		return supplierMaps
	}
	return make([]map[string]interface{}, 0)
}