From 8f9dce08ec70dc436b86a782e7bcb13872e52390 Mon Sep 17 00:00:00 2001
From: zhangyanpeng <bob.zhang@highdatas.com>
Date: 星期二, 20 八月 2024 20:06:24 +0800
Subject: [PATCH] 调整

---
 module/fee/page/popup/popup_edit_fee_execute.html |  242 +++++++++++++++++++++++++++++++++++-------------
 1 files changed, 176 insertions(+), 66 deletions(-)

diff --git a/module/fee/page/popup/popup_edit_fee_execute.html b/module/fee/page/popup/popup_edit_fee_execute.html
index f214595..e6f92a0 100644
--- a/module/fee/page/popup/popup_edit_fee_execute.html
+++ b/module/fee/page/popup/popup_edit_fee_execute.html
@@ -16,18 +16,18 @@
 					el: "#vbody",
 					data: {
 						dataname: "fee_task_execute",
-						table_dataname: "fee_working_out_base_execute",
+						table_dataname: "v_fee_working_grant_detail",
 						title: "鎵ц鍗曚俊鎭�",
 						dataRequest: [
 							{
-								name: "fee_working_out_base_execute", // 涓氬姟璐熻矗浜哄瓧娈�
-								dataname: "fee_working_out_base_execute",
+								name: "v_fee_working_grant_detail", // 涓氬姟璐熻矗浜哄瓧娈�
+								dataname: "v_fee_working_grant_detail",
 								url: "root/data/getEntitySet",
-								paramsobj: {dataname: "fee_working_out_base_execute", attachMeta: true, filter: "1<>1"},
+								paramsobj: {dataname: "v_fee_working_grant_detail", attachMeta: true, filter: "1<>1"},
 								isnotoption: true, //true:涓嶆槸閫夐」
 							}
 						],
-						meta_fee_working_out_base_execute: [],
+						meta_v_fee_working_grant_detail: [],
 						
 						options_md_org_master: [],
 						md_bu_org_obj: {},
@@ -51,6 +51,7 @@
 						formFields: [],
 						
 						newformData: {
+							code: createBaseCode("ZX"),
 							state_code: "Input",
 							state_name: "褰曞叆",
 							is_active: true,
@@ -58,7 +59,9 @@
 							type_code: "Customer", // Standard鏍囧噯浠风洰琛ㄣ�丆ustomer缁忛攢鍟嗕环鐩〃
 						},
 						formData: {},
-						
+						formDataDefault: {
+							guide_id: "fee_guide_settle_execute"
+						},
 						isRefresh: true,
 						tableFields: [],
 						tableData: [],
@@ -92,13 +95,14 @@
 						approveremark: '',//濉啓鐞嗙敱
 						passOrRefuse:false,
 						loading_pass: false,
+						tablebuttonClick: []
 					},
 					created() {
 						this.popupParames = clone(Root.popupParames);
 						// this.title = this.popupParames.title || this.popupParames.text
 						if (this.popupParames.data) {
-							if (this.popupParames.data._datano) {
-								this.title = this.title + this.popupParames.data._datano;
+							if (this.popupParames.data.code) {
+								this.title = this.title + this.popupParames.data.code;
 							}
 							this.formData = clone(this.popupParames.data);
 						}
@@ -137,9 +141,9 @@
 								this.formAttr.disabled = true;
 								this.isapproval = true;
 								
-								if (this.formData.current_step_name && this.formData.current_step_name == "杩愯惀閮ㄩ棬澶嶆牳") {
-									this.isedit = true;
-								}
+								// if (this.formData.current_step_name && this.formData.current_step_name == "杩愯惀閮ㄩ棬澶嶆牳") {
+								// 	this.isedit = true;
+								// }
 								
 							}
 							else if (this.popupParames.sceneCode == "refuseedit") {//鎷掔粷鍚庣殑缂栬緫
@@ -176,15 +180,15 @@
 									}
 								}
 								// 鑾峰彇鍙樻洿鐨勫瓧娈�
-								if (me.dataRequestObj.fee_working_out_base_execute) {
-								    let meta_ = me.dataRequestObj.fee_working_out_base_execute.meta.fee_working_out_base_execute.fields;
+								if (me.dataRequestObj.v_fee_working_grant_detail) {
+								    let meta_ = me.dataRequestObj.v_fee_working_grant_detail.meta.v_fee_working_grant_detail.fields;
 									meta_.map(f=>{
 										f.isshow = "T";
-										if (f.field == "_qty_trans" || f.field == "_qty_cal" || f.field == "_qty_final" || f.field == "_amt_final") {
+										if (f.field == "grant_amt" || f.field == "grant_qty") {
 											f.isfixed = "right";
 										}
 									})
-									me.meta_fee_working_out_base_execute = clone(meta_)
+									me.meta_v_fee_working_grant_detail = clone(meta_)
 								}
 								me.initData();
 							});
@@ -240,36 +244,14 @@
 									
 									metas.map(f=>{
 										f.isshow = "T";
-										if (f.field == "company_id") {
-											// f.isshow = "F";
-											f.options = me.options_md_org_master
+										if (f.field == "amt") {
+											f.inputtype = "span"
 										}
-										
-										if (f.field == "product_id") {
-											f.props = {label: "value", value: "code", multiple: false};
-											if (me.options_product.length) {
-												f.options = clone(me.options_product);
-											}
-											else if (me.formData.bu_id && me.md_bu_product_obj[me.formData.bu_id]) {
-												f.options = clone(me.md_bu_product_obj[me.formData.bu_id].children);
-											}
-											else {
-												f.options = [];
-											}
-										}
-										
-										// if (f.field == "customer_name" && (me.popupParames.sceneCode == "addbyagreement" || me.popupParames.sceneCode == "editbyagreement")) {
-										// 	f.disabled = true;
-										// }
-										// if ((f.field == "date_from" || f.field == "date_to") && (me.popupParames.sceneCode == "addbyagreement" || me.popupParames.sceneCode == "editbyagreement")) {
-										// 	f.isshow = false;
-										// }
-										
 										formFields_.push(clone(f));
 									})
 									if (!me.formFields || (me.formFields && me.formFields.length == 0)) {
 										me.formFields = clone(formFields_);
-										me.tableFields = clone(me.meta_fee_working_out_base_execute);
+										me.tableFields = clone(me.meta_v_fee_working_grant_detail);
 										
 										//璁剧疆瀛楁浜嬩欢
 										me.tableFieldClick();
@@ -305,6 +287,11 @@
 										me.formFields = clone(formFields_);
 									}
 									me.onTableQuery();
+								}
+								
+								// 鏄惁闇�瑕佸脊鍑烘鍏ュ崟閫夋嫨绐�
+								if(me.popupParames.sceneCode == "add") {
+									me.selectDetailPopup(true);
 								}
 							})
 						},
@@ -360,29 +347,122 @@
 							};
 							
 							this.tablefieldClick = {
-								_qty_trans: {
+								grant_qty: {
 								    input: {
 										onchange: function(obj) {
-											obj.row._qty_trans = obj.row._qty_trans * 1;
-											if (obj.row._qty_cal) {
-												obj.row._qty_final = (obj.row._qty_cal * 1) - (obj.row._qty_trans * 1)
-												obj.row._amt_final = obj.row._qty_final  * obj.row._taxunitprice
+											obj.row.grant_qty = obj.row.grant_qty * 1;
+											var grant_price = 0;
+											if (obj.row.grant_price) {
+												grant_price = obj.row.grant_price
 											}
-											
-											me.saveTableRow(obj.row);
+											else if (table_row.grant_qty && table_row.grant_amt) {
+												grant_price = table_row.grant_amt / table_row.grant_qty
+											}
+											obj.row.grant_amt = grant_price  * obj.row.grant_qty
+											if (obj.row.id) {
+												me.saveTableRow(obj.row);
+											}
 										}
 								    }
 								},
 							}
+							
+							this.tablebuttonClick = [
+								{
+									// name: "鏂板", // type: "primary", // icon: "el-icon-edit",
+									isbuttonshow: me.isedit,
+									code: "add", isselected: false, classname: "",
+									onclick: function(obj) {
+										me.selectDetailPopup(false)
+									}
+								},
+								// {
+								// 	// name: "鍒犻櫎", // type: "primary", // icon: "el-icon-edit",
+								// 	isbuttonshow: me.isedit,	type: "danger",
+								// 	code: "delete", isselected: true, classname: "",
+								// 	disabled: function(selectRowList) {
+								// 		var bo_ = true;
+								// 		if (selectRowList[0] && selectRowList[0].state_code == "Input") {
+								// 			bo_ = false;
+								// 		}
+								// 		return bo_
+								// 	},
+								// 	onclick: function(obj) {
+								// 		me.delData()
+								// 	}
+								// },
+							]
+							
+						},
+						
+						selectDetailPopup(isclose) {
+							var me = this;
+							//鎺掗櫎宸查�夌墿鏂�
+							var selectmap_ = {};
+							me.tableData.map(row=>{
+								if (row.sell_qty_id) {
+									var key_ = row.sell_qty_id
+									selectmap_[key_] = true
+								}
+							})
+							var filter_ = "";
+							var config = {
+								totab: false, //true: 浠ab瀵艰埅鐨勬柟寮忔墦寮�
+								width: "1000px",
+								height: "650px",
+								icon: "icon-product",
+								filter: filter_,
+								text: "閫夋嫨鎵ц娴佸悜",
+								id: "outBasePreGrantList" + "add",//totab: true鏃堕渶璁剧疆锛岀敤浜庡垽鏂槸鍚﹀凡鎵撳紑姝ら〉闈�
+								url: "module/fee/page/popup/outBasePreGrantList.html",
+								delta: {selectmap: selectmap_},
+								sceneCode: "add", //"refuseedit",//"approval", //"add"//"browse",
+								closecallback: function() {
+									if (isclose) {
+										me.closeDialog();
+									}
+								},
+								callback: function(obj, callback) {
+									me.loadDetailData(obj);
+									if (callback) {
+										callback();
+									}
+								}
+							};
+							me.doPopupByPublic(config);
+						},
+						
+						// 棣栨鍒涘缓鎾ら攢鍗曠殑妞嶅叆鍗曟暟鎹�
+						loadDetailData(obj) {
+							var me = this;
+							me.formData.guide_id = me.formDataDefault.guide_id;
+							
+							// 鏄庣粏琛ㄦ牸鏁版嵁
+							var list_h = clone(obj.list); //璐墿杞﹁繑鍥炰竴涓暟缁�
+							var tableData_ = clone(me.tableData);
+							list_h.map(row=>{
+								console.log(row);
+								var table_row = clone(row);
+								table_row.id = null
+								table_row.task_id = null
+								table_row.data_no = row.datano
+								table_row.sell_qty_id = row.id
+								table_row.out_fee_id = row.out_fee_id
+								table_row.grant_qty = row.qty_check - (row.qty_grant ? row.qty_grant : 0)
+								table_row.grant_amt = row.amt_check ? row.amt_check/row.qty_check * (row.qty_check - (row.qty_grant ? row.qty_grant : 0)) : 0
+								table_row.grant_price = row.amt_check ? row.amt_check/row.qty_check : 0
+								
+								tableData_.unshift(table_row)
+							})
+							me.tableData = clone(tableData_);
 						},
 						
 						saveTableRow(row) {
 							var me = this;
 							var entity_ = clone(row);
 							var entity = {
-								_qty_trans: entity_._qty_trans,
-								_qty_final: entity_._qty_final,
-								_amt_final: entity_._amt_final,
+								grant_qty: entity_.grant_qty,
+								grant_amt: entity_.grant_amt,
 								id: entity_.id
 							};
 							
@@ -567,7 +647,7 @@
 							let param_ = {
 								dataname: this.table_dataname,
 								filter: filter_,
-								orderby: "_dataNo",
+								orderby: "dataNo",
 								page: {
 									pageno: this.pagenum,
 									pagesize: this.pagesize
@@ -613,26 +693,52 @@
 						saveRowTable(callback) {
 							var me = this;
 							var operator_ = "saveEntity";//淇濆瓨
-							// if(me.iscommit) {
-							// 	operator_ = "commit";//鎻愪氦
-							// }
+							if(me.iscommit) {
+								operator_ = "commit";//鎻愪氦
+							}
 							
 							var entity_ = clone(this.formData);
-							var entity = {
-								_qty_trans: entity_._qty_trans,
-								_qty_final: entity_._qty_final,
-								_amt_final: entity_._amt_final,
-								id: entity_.id
-							};
+							var tableData_v = clone(this.tableData);
+							// var entity = {
+							// 	_qty_trans: entity_._qty_trans,
+							// 	_qty_final: entity_._qty_final,
+							// 	_amt_final: entity_._amt_final,
+							// 	id: entity_.id
+							// };
+							var tableData_ = [];
+							var sum_grant_amt = 0;
+							tableData_v.map(r=>{
+								var r_ = {
+									data_no: r.data_no || r.datano,
+									sell_qty_id: r.sell_qty_id,
+									out_fee_id: r.out_fee_id,
+									grant_qty: r.grant_qty,
+									grant_amt: r.grant_amt,
+								}
+								if (r.id) {
+									r_.id = r.id
+								}
+								if (entity_.id) {
+									r_.task_id = entity_.id
+								}
+								
+								if (r.grant_amt) {
+									sum_grant_amt += r.grant_amt;
+								}
+								
+								tableData_.push(r_)
+							})
 							
+							entity_.amt = sum_grant_amt;
 							let param = {
-								dataname: me.dataname,
+								dataname: "fee_task_execute",
 								data: {},
 							}
 							if (me.formData.id) {
 								param.id = me.formData.id
 							}
-							param.data[me.dataname] = entity;
+							param.data["fee_task_execute"] = entity_;
+							param.data["fee_working_grant_detail"] = tableData_;
 							
 							Server.call("root/data/" + operator_, param, function(result) {
 								console.log(result);
@@ -895,11 +1001,15 @@
 									:pagesize="pagesize"
 									:pagenum="pagenum"
 									:total="total"
-									:table-height="dheight - 252 - 64"
+									:table-height="dheight - 147 - 64 - (isedit ? 28 : 0)"
 									:is-highlight-row="true"
 									:isdraggableorder="false"
-									:isshowtool="false"
+									:isbasicfilterfields="false"
 									:isshow-shoppingcart="false"
+									:isbasicfilterfields="false"
+									:isfilterfield="false"
+									
+									:table-buttons-click="tablebuttonClick"
 									
 									v-on:get-data="getData"
 								>
@@ -929,9 +1039,9 @@
 							<el-button  size="small" v-if="isapproval" type="danger" plain @click="onShowApproval('goback')">閫�鍥炲埌涓婁竴姝�</el-button>
 						</el-button-group>
 						<el-button size="small" type="default" @click="closeDialog">鍙� 娑�</el-button>
-						<!-- <el-button size="small" v-if="isedit || isrefuseedit" type="primary" :loading="loading_save" @click="saveRowTable()":icon="buttonsconfig.save.icon">{{buttonsconfig.save.name}}</el-button>
+						<el-button size="small" v-if="isedit || isrefuseedit" type="primary" :loading="loading_save" @click="saveRowTable()":icon="buttonsconfig.save.icon">{{buttonsconfig.save.name}}</el-button>
 						<el-button size="small" v-if="isedit && !formData.agreement_id" type="success" :loading="loading_submit" @click="submitRowTable":icon="buttonsconfig.submit.icon">{{buttonsconfig.submit.name}}</el-button>
-						 -->
+						
 						<el-button size="small" v-if="isrefuseedit" type="success" @click="">鍐嶆鎻愪氦</el-button>
 						
 						<el-button size="small" v-if="isapproval" type="success" @click="onShowApproval('approve')">閫� 杩�</el-button>

--
Gitblit v1.8.0