<!doctype html> <html> <head> <meta charset="utf-8"><meta http-equiv="Expires" content="0"><meta http-equiv="Pragma" content="no-cache"><meta http-equiv="Cache-control" content="no-cache"><meta http-equiv="Cache" content="no-cache"> <title>表å•+明细模æ¿1</title> <script type="text/javascript"> var pageVue = null; function loadJsCss(callback) { var jscss_urls = []; window.top.initJsCss(document, jscss_urls, callback); }; function initVue() { new FormVue({ el: "#vbody", data: { dataname: "fee_joint", table_dataname: "", title: "表å•+明细模æ¿1", formAttr: { istitle: false, title: "表å•åç§°", columnnumber: 2, labelwidth: "140px", labelposition: "left",//"left",// right//top size: "mini", border: "3px solid #c6c6c600" }, default_formFields: [ {isshow: "T", field: "biz_date", name: "è®¢å•æ—¥æœŸ", type: "date", formatter: "date", notvalunit: true}, {isshow: "T", field: "customer_name", name: "客户åç§°", type: "popup", required: true, notvalunit: true}, {isshow: "T", field: "customer_consignee_address", name: "收货地å€", required: true, type: "select",isfilterable:true, isrefresh:true, options: [], props:{value: "id", label: "address", checkStrictly: true}, notvalunit: true}, {isshow: "T", field: "customer_consignee_user_name", name: "è”系人", required: true, notvalunit: true}, {isshow: "T", field: "customer_consignee_phone", name: "è”系电è¯", required: true, notvalunit: true}, {isshow: "T", field: "operate_emp_name", name: "业务员åç§°", disabled: true, notvalunit: true}, {isshow: "T", field: "business_depart_name", name: "业务部门", type: "popup", required: true, notvalunit: true}, {isshow: "T", field: "province_name", name: "区域", width: "120", type: "popup", required: true, notvalunit: true}, {isshow: "T", field: "settle_type", name: "结算方å¼", type: "select", options: [{label: "现金",value: "cash"}, {label: "信用付款",value: "credit"}], required: true, notvalunit: true}, {isshow: "T", field: "emp_depart_name", name: "销售部门", disabled: true, defaultval: "", notvalunit: true}, {isshow: "T", field: "contract_no", name: "åˆåŒå·", notvalunit: true}, {isshow: "T", field: "amt_credit", name: "授信é¢åº¦", disabled: true, formatter: "money", notvalunit: true}, {isshow: "F", field: "iscreditsuccess", name: "资信检查结果", formatter: "TF3", notvalunit: true}, {isshow: "T", field: "amt", name: "è®¢å•æ€»é‡‘é¢", disabled: true, formatter: "money", align: "right", notvalunit: true}, {isshow: "T", field: "amt_receipts", name: "折扣åŽé‡‘é¢", disabled: true, formatter: "money", align: "right", notvalunit: true}, {isshow: "T", field: "amt_discount", name: "折扣总金é¢", disabled: true, formatter: "money", align: "right", notvalunit: true}, ], formFields: [], newformData: { //id: uuid_short(), // code: createCode("BA"), create_time: createDatetime(), state_code: "Draft", state_name: "è‰ç¨¿", creator_name: window.top.vue.userinfo.name, type_code: "", type_name: "", }, formData: {}, isRefresh: true, default_tableFields: [ {isshow: "T",field: "create_time", name: "创建日期", width: "130",formatter: "formatter_date"}, {isshow: "T", field: "delivery_part_name", name: "工厂åç§°", width: "180"}, {isshow: "T", field: "product_code", name: "产å“ç¼–å·", width: "120"}, {isshow: "T", field: "product_name", name: "产å“åç§°", width: "400", type: "popup", align: "left"}, {isshow: "T", field: "cnt", name: "æ•°é‡", width: "80", type: "input", istablesum: true}, {isshow: "T", field: "rebate_amt_sku", name: "折扣金é¢ï¼ˆä¸“项)", defaultval: 0, align: "right", width: "120", istablesum: true}, {isshow: "T", field: "rebate_amt_ty", name: "折扣金é¢ï¼ˆé€šç”¨ï¼‰", defaultval: 0, align: "right", width: "120", type: "popup"}, {isshow: "T", field: "price_type", name: "ä»·æ ¼ç±»åž‹", width: "120", type: "popup"}, {isshow: "T", field: "product_price", name: "å•ä»·", width: "80", formatter: "formatter_money", align: "right"}, {isshow: "T", field: "tax_rate", name: "税率", width: "110", type: "select", options: dataRoot.database.taxrate}, {isshow: "T", field: "product_conversion_rate", name: "æ¢ç®—率", width: "80"}, {isshow: "T", field: "standrad_cnt", name: "ä»¶æ•°", width: "80", istablesum: true}, {isshow: "T", field: "stock", name: "库å˜", width: "80", istablesum: true}, {isshow: "T", field: "amt", name: "金é¢", align: "right", width: "120", formatter: "formatter_money", istablesum: true}, {isshow: "T", field: "rebate_amt", name: "返利金é¢", align: "right", width: "100", formatter: "formatter_money", istablesum: true}, {isshow: "T", field: "sales_type", name: "销售类型", width: "120", type: "select", options: dataRoot.database.saletype}, {isshow: "T", field: "qty_return", name: "退货数é‡", width: "160", align: "right"}, {isshow: "T", field: "remark", name: "备注", type: "input", width: "180"}, ], tableFields: [], newTableData: { create_time: createDatetime(), creator_name: window.top.vue.userinfo.name, }, tableData: [], //按键æƒé™è®¾ç½® isedit: false,//æäº¤å‰ç¼–辑,ä¿å˜/æäº¤ isrefuseedit: false,//æ‹’ç»åŽç¼–辑,ä¿å˜/冿¬¡æäº¤ isapproval: false,//å®¡æ‰¹ï¼ŒåŒæ„/æ‹’ç»/转办/退回 iscommit: false,//æäº¤æ ‡è®° //å¼¹çª—å‚æ•° popupParames: {}, //å—æ®µè®¾ç½® tablefieldClick: {}, formfieldClick: {}, }, created() { this.popupParames = clone(Root.popupParames); this.title = this.popupParames.title || this.popupParames.text if (this.popupParames.data) { this.formData = clone(this.popupParames.data); } if (this.popupParames.sceneCode) { if (this.popupParames.sceneCode == "add") {//新增 if (this.newformData) { let formData_ = clone(this.formData); for (var k in this.newformData) { formData_[k] = this.newformData[k]; } this.formData = formData_; } if (this.newTableData) { this.tableData.push(clone(this.newTableData)); } this.isedit = true; } else if (this.popupParames.sceneCode == "browse") {//åªè¯» this.formAttr.disabled = true; } else if (this.popupParames.sceneCode == "edit") {//编辑 this.isedit = true; } else if (this.popupParames.sceneCode == "approval") {//审批 this.formAttr.disabled = true; this.isapproval = true; } else if (this.popupParames.sceneCode == "refuseedit") {//æ‹’ç»åŽçš„编辑 this.isrefuseedit = true; } } }, mounted() { var me = this; //é¢„åŠ è½½æ•°æ® if (this.dataRequest && this.dataRequest.length) { var result = {}; this.loadRequestData(this.dataRequest, result, function(data) { me.dataRequestObj = data; //é¢„åŠ è½½æ•°æ®åŽç»™å“ªäº›å—段设置options或formatterjson me.initData(); }); } else { this.initData(); } // 以æœåŠ¡çš„æ–¹å¼è°ƒç”¨çš„ Loading 需è¦å¼‚æ¥å…³é— this.$nextTick(() => { hideLoading(); //釿–°è®¾ç½®å¼¹çª—宽高 this.$nextTick(function(){ //let w_ = this.$refs.popup_body.offsetWidth + "px"; let w_ = "900px"; let h_ = this.$refs.popup_body.offsetHeight + "px"; Root.setPopupWH(w_, h_); }) }); }, methods:{ //å…³é—弹窗 closeDialog() { var me = this; if (me.popupParames.totab){ Root.tab.removeItem(Root.tab.selected); Root.tab.open(me.popupParames.parentOption, false); } else { Root.hidePopup(); } }, //å…³é—å‰è°ƒå›žè°ƒ saveAfter() { var me = this; if(this.popupParames.callback) { let obj = { //row: this.formData } this.popupParames.callback(obj, function() { me.closeDialog(); }); } else { me.closeDialog(); } }, initData() { let me = this var id_ = null; if (this.formData.id) { id_ = this.formData.id; } this.getRowDataById(id_, function(result) {//查询åŽçš„回调,用于获å–å—æ®µçš„ if (result.meta && result.meta[me.dataname] && result.meta[me.dataname].fields) { var metas = clone(result.meta[me.dataname].fields); var table_dataname_ = ""; for (var dataname_ in result.meta) { if (dataname_ != me.dataname && !table_dataname_) { table_dataname_ = dataname_; } } var table_metas = []; if (table_dataname_) { me.table_dataname = table_dataname_; table_metas = clone(result.meta[table_dataname_].fields); } var formFields_ = []; var tableFields_ = []; metas.map(f=>{ f.isshow = "T"; formFields_.push(clone(f)); }) table_metas.map(f=>{ f.isshow = "T"; tableFields_.push(clone(f)); }) if (!me.formFields || (me.formFields && me.formFields.length == 0)) { me.formFields = clone(formFields_); me.tableFields = clone(tableFields_); //å—æ®µæ•°ç»„è½¬å—æ®µobj,目的为了ç›é€‰æ—¶èŽ·å–å—æ®µå±žæ€§ me.fieldsToFieldsObj(); //è®¾ç½®å—æ®µäº‹ä»¶ me.tableFieldClick(); } } if (me.rowData[me.dataname]) { me.formData = me.rowData[me.dataname]; } if (me.rowData[me.table_dataname]) { me.tableData = me.rowData[me.table_dataname]; } }) }, tableFieldClick() { var me = this; //表å•å—æ®µäº‹ä»¶è®¾ç½® this.formfieldClick = { type_code: {//å—æ®µäº‹ä»¶è®¾ç½® val: {//有值时的点击事件 onclick: function(obj) {//æ•°æ®å€¼ç‚¹å‡»äº‹ä»¶ Root.message({ type: 'success', message: obj.val + '点击事件' }); }, onchange: function(obj) {//æ•°æ®ä¿®æ”¹äº‹ä»¶ Root.message({ type: 'success', message: 'æ•°æ®ä¿®æ”¹äº‹ä»¶' }); } }, popup: { onclick: function(obj) {//弹窗点击事件 Root.message({ type: 'success', message: '弹窗点击事件' }); } }, visible: { onchange: function(fieldObj, row, callback) {//下拉展开事件 Root.message({ type: 'success', message: '下拉展开事件' }); //釿–°è®¾ç½®é€‰æ‹©é¡¹ if (callback) { var obj_ = { options: [] }; callback(obj_); } } }, select: { onchange: function(obj) {//下拉更改事件 obj.data.type_name = clone(obj.selectoption.label); } }, input: { onchange: function(obj) {//输入更改事件 Root.message({ type: 'success', message: '输入更改事件' }); } }, button: { onclick: function(obj) {//按键点击事件 Root.message({ type: 'success', message: '按键点击事件' }); } }, buttonarray: { onclick: function(obj) {//æŒ‰é”®ç»„ç‚¹å‡»äº‹ä»¶ï¼Œéœ€è¦æ ¹æ®æŒ‰é”®çš„codeæ¥åˆ¤æ–具体事件 Root.message({ type: 'success', message: '按键组点击事件' }); } }, }, customer_name: { popup: { onclick: function(obj) {//弹窗点击事件 //打开 me.open_customerlist() } }, }, terminal_name: { popup: { onclick: function(obj) {//弹窗点击事件 //打开 me.open_terminallist() } }, }, product_name: { popup: { onclick: function(obj) {//弹窗点击事件 //打开 me.open_productlist() } }, }, }; //è¡¨æ ¼å—æ®µäº‹ä»¶è®¾ç½® this.tablefieldClick = { product_name: {//å—æ®µäº‹ä»¶è®¾ç½® val: {//有值时的点击事件 notclick_val: "",//ä¸å¯ç‚¹å‡»çš„值,1ã€æ˜¯æ•°ç»„["11","22"]ï¼›2ã€ä»¥â€œ;â€åˆ†éš”çš„å—符串"111;222" notclick_bindfield: [],//å½“è¯¥å—æ®µå€¼ç‰äºŽæŒ‡å®šå—段值时ä¸å¯ç‚¹å‡»["filterfield": "111"] onclick: function(obj) {//æ•°æ®å€¼ç‚¹å‡»äº‹ä»¶ Root.message({ type: 'success', message: obj.val + '点击事件' }); }, }, // defaultval: { // val: "查看",//空值时的显示值 // onclick: function(obj) {//默认值点击事件,æ¤äº‹ä»¶éœ€è¦è®¾ç½®valæ‰æœ‰æ•ˆ // Root.message({ // type: 'success', // message: '默认值点击事件' // }); // } // }, suffixval: { // val: "详情",//有值时的åŽç¼€ï¼Œæ¤åŽç¼€å’Œå•ä½åŽç¼€ä¸åŒï¼Œå¦‚ï¼šè¯¦æƒ…ï¼Œæ›´å¤šï¼ŒæŸ¥çœ‹ç‰ // onclick: function(obj) {//有值时的åŽç¼€ç‚¹å‡»äº‹ä»¶,æ¤äº‹ä»¶éœ€è¦è®¾ç½®valæ‰æœ‰æ•ˆ // //打开 // me.opentest() // } }, popup: { onclick: function(obj) {//弹窗点击事件 Root.message({ type: 'success', message: '弹窗点击事件' }); } }, visible: { onchange: function(obj) {//下拉展开事件 Root.message({ type: 'success', message: '下拉展开事件' }); } }, select: { onchange: function(obj) {//下拉更改事件 Root.message({ type: 'success', message: '下拉更改事件' }); } }, input: { onchange: function(obj) {//输入更改事件 Root.message({ type: 'success', message: '输入更改事件' }); } }, }, customer_name: { popup: { onclick: function(obj) {//弹窗点击事件 //打开 me.tablepopup_customerlist() } }, }, terminal_name: { popup: { onclick: function(obj) {//弹窗点击事件 //打开 me.tablepopup_terminallist() } }, }, product_name: { popup: { onclick: function(obj) {//弹窗点击事件 //打开 me.tablepopup_productlist() } }, }, }; }, open_customerlist(obj) { var me = this; Root.showPopup({ url: "../md/customer/popup/customer_list.html", width: 800, height: 550, data: this.oldObj, dataname: "customer", callback: function(obj, callback) { let formData_ = clone(me.formData); formData_.customer_name = obj.row.md_description; formData_.customer_code = obj.row.md_code; formData_.customer_id = obj.row.id; me.formData = formData_; if (callback) { callback(); } } }); }, open_terminallist(obj) { var me = this; Root.showPopup({ url: "../md/customer/popup/customer_list.html", width: 800, height: 550, data: this.oldObj, dataname: "customer", callback: function(obj, callback) { let formData_ = clone(me.formData); formData_.customer_name = obj.row.md_description; formData_.customer_code = obj.row.md_code; formData_.customer_id = obj.row.id; me.formData = formData_; if (callback) { callback(); } } }); }, open_productlist(obj) { var me = this; Root.showPopup({ url: "../md/product/popup/sku_list.html", width: 800, height: 550, callback: function(obj, callback) { let formData_ = clone(me.formData); formData_.product_id = obj.row.id; formData_.product_code = obj.row.md_code; formData_.product_name = obj.row.md_description; //formData_.spec = obj.row.pack_specification; me.formData = formData_; if (callback) { callback(); } } }); }, tablepopup_customerlist(obj) { var me = this; Root.showPopup({ url: "../md/customer/popup/customer_list.html", width: 800, height: 550, data: this.oldObj, dataname: "customer", callback: function(callbackobj, callback) { obj.row.customer_code = callbackobj.row.md_code obj.row.customer_name = callbackobj.row.md_description if (callback) { callback(); } } }); }, tablepopup_terminallist(obj) { var me = this; Root.showPopup({ url: "../md/customer/popup/customer_list.html", width: 800, height: 550, data: this.oldObj, dataname: "customer", callback: function(callbackobj, callback) { obj.row.terminal_id = callbackobj.row.id obj.row.terminal_name = callbackobj.row.md_description if (callback) { callback(); } } }); }, tablepopup_productlist(obj) { var me = this; Root.showPopup({ url: "../md/product/popup/sku_list.html", width: 800, height: 550, callback: function(callbackobj, callback) { obj.row.product_id = callbackobj.row.id; obj.row.product_code = callbackobj.row.md_code; obj.row.product_name = callbackobj.row.md_description; obj.row.spec = callbackobj.row.pack_specification; obj.row.pack = callbackobj.row.unit; if (callback) { callback(); } } }); }, addTableData() { var table_row = clone(this.newTableData); this.rowChange(table_row, "add", this.table_dataname); }, delData(scope) { let me = this; let row = scope.row; let index_ = scope.$index; Root.confirm('ç¡®å®šåˆ é™¤æ•°æ®ã€' + JSON.stringify(row) + '】å—?', 'åˆ é™¤æç¤º', { confirmButtonText: 'åˆ é™¤', cancelButtonText: 'å–æ¶ˆ', type: 'warning' }).then(() => { me.rowChange(row, "del", me.table_dataname); }).catch(() => { Root.message({ type: 'info', message: '已喿¶ˆåˆ 除' }); }); }, rowChange(row, type, tablename) { var me = this; if (type == "add") { this.tableData.unshift(row); } else if (type == "del") { if (row.id) { let param = { dataname: tablename, id: row.id } Server.call("root/data/deleteEntity", param, function(result) { console.log(result); if (result && result.data) { me.tableData.remove(row); Root.message({ type: 'success', message: 'åˆ é™¤æˆåŠŸ!' }); } }); } else { this.tableData.remove(row); } } else { } }, //æäº¤ submitRowTable() { this.iscommit = true; this.saveRowTable(); }, //ä¿å˜ saveRowTable() { var me = this; var operator_ = "save";//ä¿å˜ if(me.iscommit) { operator_ = "commit";//æäº¤ } var entity_ = clone(this.formData); var entity = {}; for (var r in entity_) { if (entity_[r] || entity_[r] == "" || entity_[r] == false || entity_[r] == 0) { entity[r] = entity_[r]; } } var tableData_ = []; this.tableData.map(r=>{ var row_ = {}; for (var k in r) { if (r[k]) { row_[k] = r[k]; } } tableData_.push(row_); }) if (tableData_.length == 0) { Root.message({ type: 'warning', message: 'è¯·å…ˆæ·»åŠ æ˜Žç»†æ•°æ®' }); return } let param = { dataname: this.dataname, // operator: operator_, data: {}, } param.data[this.dataname] = entity; param.data[this.table_dataname] = tableData_; Server.call("root/data/saveEntity", param, function(result) { console.log(result); if (result.success) { if(me.iscommit){ me.iscommit = false; Root.message({ type: 'success', message: 'æäº¤æˆåŠŸ' }); me.saveAfter(); } else { Root.message({ type: 'success', message: 'ä¿å˜æˆåŠŸ' }); me.saveAfter(); } } }); }, } }); }; loadJsCss(function () { initVue(); }); </script> <style> /* 在vue.jsä¸ v-cloak 这个指令是防æ¢é¡µé¢åŠ è½½æ—¶å‡ºçŽ° vuejs çš„å˜é‡å而设计的 */ [v-cloak] { display: none !important; } </style> </head> <body style="margin: 0px;"> <div v-cloak id="vbody"> <div id="page_root"> <div ref="popup_body" style="padding: 0 20px;"> <div class="el-dialog__header"> <div class="dialog-title"> <i class="iconfont icon-customermanagement"></i> <span> {{title}}</span> </div> </div> <div style="height: 550px; overflow-y: auto;"> <div class="el-dialog__body"> <h-form ref="form1" :form-attr="formAttr" :table-fields="formFields" :form-data="formData" :table-field-click="formfieldClick" > </h-form> <div class="h_dialog__body"> <div v-if="isedit || isrefuseedit" style=" text-align: right; "> <!-- 工具æ --> <div style=" display: inline-block; width: 90px;"> <el-button-group> <el-button @click="addTableData">新增明细</el-button> </el-button-group> </div> </div> <h-table v-if="isRefresh && tableFields.length" ref="table1" :table-fields="tableFields" :table-data="tableData" :is-edit-table-data="isedit || isrefuseedit" :is-within-edit-table-data="isedit || isrefuseedit" :is-pagination="false" :table-field-click="tablefieldClick" :is-show-index="tableData.length ? true : false" :edit-table-button="editTableButton" v-on:get-data="getData" v-on:del-data="delData" > </h-table> </div> </div> </div> <div class="el-dialog__footer"> <el-button size="small" type="default" @click="closeDialog">å– æ¶ˆ</el-button> <el-button size="small" v-if="isedit || isrefuseedit" type="primary" @click="saveRowTable":icon="buttonsconfig.save.icon">{{buttonsconfig.save.name}}</el-button> <el-button size="small" v-if="isedit" type="success" @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="primary" @click="">通 过</el-button> <el-button size="small" v-if="isapproval" type="danger" @click="">æ‹’ ç»</el-button> <el-button size="small" v-if="isapproval" type="primary" @click="">转 办</el-button> <el-button size="small" v-if="isapproval" type="success" @click="">退 回</el-button> </div> </div> </div> </div> <div id="page_loading" style="position: absolute; top:0px; width: 100vw; height: 50vh;"> <div class="spinner"> <div class="cube1"></div> <div class="cube2"></div> </div> </div> </body> </html>