From 9b8282bcf5c5fbc22858bbfa15934b7f8a0ab753 Mon Sep 17 00:00:00 2001 From: cuiqian2004 <cuiqian2004@163.com> Date: 星期三, 10 七月 2024 18:24:55 +0800 Subject: [PATCH] smallwnd --- js/utils.js | 46 pages/modal/3018_2.vue | 460 ++++- pages/modal/3018.vue | 184 +- pages/modal/5602.vue | 75 pages/modal/5601.vue | 15 pages.json | 58 pages/modal/small-wnd/line.vue | 595 +++++++ pages/modal/ms_classAttr.vue | 4 pages/modal/3037.vue | 335 ++-- locale/zh-Hans.json | 6 pages/modal/5600.vue | 76 pages/modal/small-wnd/index.vue | 2783 +++++++++++++++++++++++++++++++++++ pages/modal/classAttr.vue | 2 13 files changed, 4,183 insertions(+), 456 deletions(-) diff --git a/js/utils.js b/js/utils.js index 3b36c71..9413133 100644 --- a/js/utils.js +++ b/js/utils.js @@ -9,7 +9,19 @@ return false }, attrTypeIsNumber: function(type) { - if (type == '鏁存暟' || type == '娴偣鏁� || type == 'int' || type == 'float') { + if (attrTypeIsInt(type) || attrTypeIsFloat(type)) { + return true + } + return false + }, + attrTypeIsFloat: function(type) { + if (type == '娴偣鏁� || type == 'float') { + return true + } + return false + }, + attrTypeIsInt: function(type) { + if (type == '鏁存暟' || type == 'int') { return true } return false @@ -21,14 +33,32 @@ } return false }, - attrTypeIsDate: function(type) { + attrTypeIsDateTime: function(type) { if (type == '鏃ユ湡' || type == '鏃堕棿' || type == 'date' || type == 'datetime') { + return true + } + return false + }, + attrTypeIsDate: function(type) { + if (type == '鏃ユ湡' || type == 'date' ) { + return true + } + return false + }, + attrTypeIsTime: function(type) { + if (type == '鏃堕棿' || type == 'datetime') { return true } return false }, attrTypeIsObjRefMulti: function(type) { if (type == '寮曠敤瀵硅薄(澶氫釜)' || type == 'obj-ref-multi') { + return true + } + return false + }, + attrTypeIsObjRef: function(type) { + if (type == '寮曠敤瀵硅薄(鍗曚釜)' || type == 'obj-ref') { return true } return false @@ -58,6 +88,18 @@ } return false }, + attrTypeIsCode: function(type) { + if (type == '缂栫爜' || type == 'code') { + return true + } + return false + }, + attrTypeIsGuid: function(type) { + if (type == 'GUID' || type == 'guid') { + return true + } + return false + }, } var session = { diff --git a/locale/zh-Hans.json b/locale/zh-Hans.json index 5be548b..de85b2b 100644 --- a/locale/zh-Hans.json +++ b/locale/zh-Hans.json @@ -108,7 +108,11 @@ "page.execute_event_success": "鎵ц浜嬩欢鎴愬姛", "page.are_you_sure_delete_sorted_data": "纭畾鍒犻櫎璇ュ凡鍒嗘嫞鏁版嵁锛�, - "page.are_you_sure_delete_coded_disk_data": "纭畾鍒犻櫎璇ュ凡鐮佺洏鏁版嵁锛� + "page.are_you_sure_delete_coded_disk_data": "纭畾鍒犻櫎璇ュ凡鐮佺洏鏁版嵁锛�, + "page.tip_no_set_edit_wnd": "鏈缃紪杈戠獥鍙f牱寮�, + "page.cannot_empty": "涓嶈兘涓虹┖", + "page.required": " 蹇呭~" + diff --git a/pages.json b/pages.json index e43c23a..73a6a2e 100644 --- a/pages.json +++ b/pages.json @@ -14,10 +14,12 @@ "titleNView": { "buttons": [{ //鍙充晶鎿嶄綔鎸夐挳鏍峰紡瀹氫箟,鏄互鏁扮粍褰㈠紡瀹氫箟锛屽彲瀹氫箟澶氫釜 "color": "#000000", - "fontSize": "16", + "fontSize": "24px", "width": "auto", "float": "right", //瀵艰埅鏍忕殑宸﹀彸浣嶇疆 - "text": "%sys.refresh%" + // "text": "222" + "fontSrc": "/static/uni.ttf", + "text": "\ue462" }] } } @@ -52,7 +54,7 @@ "navigationBarTitleText": "%page.selpsn.select_project%", "enablePullDownRefresh": false } - } + }, // ,{ // "path" : "pages/modal/3018", // "style" : @@ -61,23 +63,30 @@ // "enablePullDownRefresh": false // } // } - , { + // { + // "path": "pages/modal/small-wnd/index", + // "style": { + // "navigationBarTitleText": "鏂板", + // "enablePullDownRefresh": false + // } + // }, + { "path": "pages/modal/3018_2", "style": { "navigationBarTitleText": "%sys.add2%", "enablePullDownRefresh": false, - // "app-plus": { - // "titleNView": { - // "buttons": [{ //鍙充晶鎿嶄綔鎸夐挳鏍峰紡瀹氫箟,鏄互鏁扮粍褰㈠紡瀹氫箟锛屽彲瀹氫箟澶氫釜 - // "color": "#000000", - // "fontSize": "16", - // "width": "auto", - // "float": "right", //瀵艰埅鏍忕殑宸﹀彸浣嶇疆 - // "text": "\ue612", - // "fontSrc": "/static/uni.ttf" // 瀛椾綋鏂囦欢璺緞 - // }] - // } - // } + "app-plus": { + "titleNView": { + "buttons": [{ //鍙充晶鎿嶄綔鎸夐挳鏍峰紡瀹氫箟,鏄互鏁扮粍褰㈠紡瀹氫箟锛屽彲瀹氫箟澶氫釜 + "color": "#000000", + "colorPressed": "#2D8CF0", + "fontSize": "24px", + "float": "right", //瀵艰埅鏍忕殑宸﹀彸浣嶇疆 + "fontSrc": "/static/uni.ttf", + "text": "\ue612" + }] + } + } } } // ,{ @@ -94,23 +103,12 @@ "navigationBarTitleText": "%sys.add2%", "enablePullDownRefresh": false } - }, { + }, + { "path": "pages/modal/3200", "style": { "navigationBarTitleText": "%sys.add2%", - "app-plus": { - "titleNView": { - "buttons": [{ //鍙充晶鎿嶄綔鎸夐挳鏍峰紡瀹氫箟,鏄互鏁扮粍褰㈠紡瀹氫箟锛屽彲瀹氫箟澶氫釜 - "color": "#000000", - "colorPressed": "#2D8CF0", - "fontSize": "28px", - "float": "right", //瀵艰埅鏍忕殑宸﹀彸浣嶇疆 - "fontSrc": "/static/mobox-sys.ttf", - "text": "\ue924" - // "type": "favorite" - }] - } - } + "enablePullDownRefresh": false } }, { "path": "pages/modal/3201", diff --git a/pages/modal/3018.vue b/pages/modal/3018.vue index 65a0133..f2eae75 100644 --- a/pages/modal/3018.vue +++ b/pages/modal/3018.vue @@ -254,7 +254,7 @@ </div> </view> - <button type="default" @tap="cancel" class="btn_cancel">鍙栨秷</button> + <button type="default" @tap="cancel" class="btn_cancel">{{translateSys('cancel')}}</button> <button type="default" @tap="sava" class="btn_add">{{title}}</button> <!-- 鏅�寮圭獥 top bottom center left right --> <view> @@ -274,8 +274,8 @@ </view> </view> <view class="popup-footer"> - <button type="default" @tap="popup_sava" class="btn_popup_add">纭畾</button> - <button type="default" @tap="popup_cancel" class="btn_popup_cancel">鍙栨秷</button> + <button type="default" @tap="popup_sava" class="btn_popup_add">{{translateSys('ok')}}</button> + <button type="default" @tap="popup_cancel" class="btn_popup_cancel">{{translateSys('cancel')}}</button> </view> </view> </uni-popup> @@ -306,7 +306,7 @@ }, data() { return { - title: '鏂板', + title: this.translateSys('add2'), param: {}, type: '', classAttrList: [], @@ -350,19 +350,19 @@ console.log(param); if (!param.EditDlgMode) { uni.showModal({ - title: "鎻愮ず", + title: this.translateSys('tip') + "", content: "璇ュ姛鑳界偣鏈厤缃紪杈戠獥鍙o紝璇烽噸鏂伴厤缃紒", showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); return; } if (!param.Edit_dlg.Name) { uni.showModal({ - title: "鎻愮ず", + title: this.translateSys('tip') + "", content: "璇ュ姛鑳界偣鏈厤缃獥鍙f牱寮忥紝璇烽噸鏂伴厤缃紒", showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); return; } @@ -400,19 +400,19 @@ }, 500); } else { uni.showModal({ - title: "閿欒1", + title: this.translateSys('error') + " 1", content: success.err_msg, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); } }).catch(ex => { // console.log(ex); uni.showModal({ - title: "閿欒1.1", + title: this.translateSys('error') + " 1.1", content: ex.errMsg, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); }); @@ -434,19 +434,19 @@ } else { uni.showModal({ - title: "閿欒1.2", + title: this.translateSys('error') + " 1.2", content: success.err_msg, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); } }).catch(ex => { // console.log(ex); uni.showModal({ - title: "閿欒1.3", + title: this.translateSys('error') + " 1.3", content: ex.errMsg, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); }); }, @@ -476,19 +476,19 @@ $this.viewParam(); } else { uni.showModal({ - title: "閿欒1.4", + title: this.translateSys('error') + " 1.4", content: success.err_msg, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); } }).catch(ex => { console.log(ex); uni.showModal({ - title: "閿欒1.5", + title: this.translateSys('error') + " 1.5", content: ex.errMsg, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); }); } @@ -629,7 +629,7 @@ ca.Value = ca.dictitem[d].CN_S_NAME; } } - if(utils.classUtils.attrTypeIsDate(ca.Type)){ + if(utils.classUtils.attrTypeIsDateTime(ca.Type)){ var nowDate = new Date(); var date = { year: nowDate.getFullYear(), @@ -725,10 +725,10 @@ } else { uni.showModal({ - title: "鎻愮ず", + title: this.translateSys('tip') + "", content: "鏈壘鍒板彲鏄剧ず鐨勭殑灞炴�", showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); } }, @@ -760,19 +760,19 @@ var button_callback = $this.$data.classAttrList[index].Attr[iindex].button_callback; if (!before_click_button) { uni.showModal({ - title: "鎻愮ず", + title: this.translateSys('tip') + "", content: "before_click_button-event_id涓虹┖锛�, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); return; } if (!button_callback) { uni.showModal({ - title: "鎻愮ず", + title: this.translateSys('tip') + "", content: "button_callback-event_id涓虹┖锛�, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); return; } @@ -817,10 +817,10 @@ } if (!$this.$data.popupParam) { uni.showModal({ - title: "鎻愮ず", + title: this.translateSys('tip') + "", content: "popupParam涓虹┖锛�, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); return; } @@ -1112,10 +1112,10 @@ classAttr_AddRef(e) { console.log(e.target); uni.showModal({ - title: "鎻愮ず", + title: this.translateSys('tip') + "", content: "姝ゅ姛鑳借繕鏈疄鐜帮紒", showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); // var value=this.$data.classAttrList[e.target.dataset['index']].Attr[e.target.dataset['iindex']].RelCls[e.target.value]; // this.$data.classAttrList[e.target.dataset['index']].Attr[e.target.dataset['iindex']].Value=value; @@ -1212,10 +1212,10 @@ uni.hideLoading(); // uni.showToast({title:ar.DispName+'涓嶈兘涓虹┖锛�,icon:"success",duration:3000}); uni.showModal({ - title: "鎻愮ず", + title: this.translateSys('tip') + "", content: ar.DispName + '涓嶈兘涓虹┖锛�, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); return; } @@ -1270,19 +1270,19 @@ if (action.ret == '0') { if (action.ret != 0) { uni.showModal({ - title: "鎻愮ず", + title: this.translateSys('tip') + "", content: '鎵ц鑴氭湰澶辫触锛� + action.result, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); return; } if (action.info) { uni.showModal({ - title: "鎻愮ず", + title: this.translateSys('tip') + "", content: '鎵ц鑴氭湰澶辫触锛� + action.info, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); return; } @@ -1310,20 +1310,20 @@ // this.cancel(); } else { uni.showModal({ - title: "閿欒", + title: this.translateSys('error') + " ", content: success.err_msg, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); } }).catch(ex => { console.log(ex); uni.hideLoading(); uni.showModal({ - title: "鎻愮ず", + title: this.translateSys('tip') + "", content: ex.errMsg, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); }); }, @@ -1387,26 +1387,26 @@ var tip = data.err_info ? typeof data.err_info == 'string' ? data.err_info : data .err_info.join('<br/>') : ''; if (data.ret == 801) uni.showModal({ - title: '鎻愮ず', + title: this.translateSys('tip') , content: tip, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); else uni.showModal({ - title: '鎻愮ず', + title: this.translateSys('tip') , content: tip + ',鎻愮ず:' + data.ret, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); return false } else { var tip = data.info ? typeof data.info == 'string' ? data.info : data.info.join( '<br/>') : ''; if (tip) uni.showModal({ - title: '鎻愮ず', + title: this.translateSys('tip') , content: tip, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); if (data.action) { @@ -1465,10 +1465,10 @@ } if (action_type == 'open_select_userdlg') { uni.showModal({ - title: "閿欒2.2", + title: this.translateSys('error') + " 2.2", content: "open_select_userdlg杩欎釜action_type杩樻湭澶勭悊锛�, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); } // else if (action_type == 'tip_dlg') { @@ -1480,19 +1480,19 @@ } } else { uni.showModal({ - title: "閿欒2", + title: this.translateSys('error') + " 2", content: success.err_msg, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); } }).catch(ex => { // console.log(ex); uni.showModal({ - title: "閿欒2.1", + title: this.translateSys('error') + " 2.1", content: ex.errMsg, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); }); }, @@ -1570,26 +1570,26 @@ var tip = data.err_info ? typeof data.err_info == 'string' ? data.err_info : data .err_info.join('<br/>') : ''; if (data.ret == 801) uni.showModal({ - title: '鎻愮ず', + title: this.translateSys('tip') , content: tip, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); else uni.showModal({ - title: '鎻愮ず', + title: this.translateSys('tip') , content: tip + ',鎻愮ず:' + data.ret, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); return false } else { var tip = data.info ? typeof data.info == 'string' ? data.info : data.info.join( '<br/>') : ''; if (tip) uni.showModal({ - title: '鎻愮ず', + title: this.translateSys('tip') , content: tip, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); var actionlist = data.action; @@ -1684,19 +1684,19 @@ } } else { uni.showModal({ - title: "閿欒3", + title: this.translateSys('error') + " 3", content: success.err_msg, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); } }).catch(ex => { // console.log(ex); uni.showModal({ - title: "閿欒3.1", + title: this.translateSys('error') + " 3.1", content: ex.errMsg, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); }); }, @@ -1788,26 +1788,26 @@ var tip = data.err_info ? typeof data.err_info == 'string' ? data.err_info : data .err_info.join('<br/>') : ''; if (data.ret == 801) uni.showModal({ - title: '鎻愮ず', + title: this.translateSys('tip') , content: tip, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); else uni.showModal({ - title: '鎻愮ず', + title: this.translateSys('tip') , content: tip + ',鎻愮ず:' + data.ret, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); return false } else { var tip = data.info ? typeof data.info == 'string' ? data.info : data.info.join( '<br/>') : ''; if (tip) uni.showModal({ - title: '鎻愮ず', + title: this.translateSys('tip') , content: tip, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); var result = data.result; @@ -1833,19 +1833,19 @@ } } else { uni.showModal({ - title: "閿欒4", + title: this.translateSys('error') + " 4", content: success.err_msg, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); } }).catch(ex => { // console.log(ex); uni.showModal({ - title: "閿欒4.1", + title: this.translateSys('error') + " 4.1", content: ex.errMsg, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); }); }, @@ -1939,26 +1939,26 @@ var tip = data.err_info ? typeof data.err_info == 'string' ? data.err_info : data .err_info.join('<br/>') : ''; if (data.ret == 801) uni.showModal({ - title: '鎻愮ず', + title: this.translateSys('tip') , content: tip, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); else uni.showModal({ - title: '鎻愮ず', + title: this.translateSys('tip') , content: tip + ',鎻愮ず:' + data.ret, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); return false } else { var tip = data.info ? typeof data.info == 'string' ? data.info : data.info.join( '<br/>') : ''; if (tip) uni.showModal({ - title: '鎻愮ず', + title: this.translateSys('tip') , content: tip, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); if (data != "") { @@ -1973,7 +1973,7 @@ if (action.action_type == 'open_panel') { var d = dialog({ title: '<i class="ace-icon fa fa-info-circle"></i> ' + - '鎻愮ず', + this.translateSys('tip') , content: action.action_type + '姝ction灏氭湭澶勭悊锛� }); d.show(); @@ -2017,7 +2017,7 @@ } else if (action.action_type == 'open_data_query_dlg') { var d = dialog({ title: '<i class="ace-icon fa fa-info-circle"></i> ' + - '鎻愮ず', + this.translateSys('tip') , content: action.action_type + '姝ction灏氭湭澶勭悊锛� }); d.show(); @@ -2099,7 +2099,7 @@ } else { var d = dialog({ title: '<i class="ace-icon fa fa-info-circle"></i> ' + - '鎻愮ず', + this.translateSys('tip') , content: action.action_type + '姝ction灏氭湭澶勭悊锛� }); d.show(); @@ -2108,28 +2108,28 @@ } } else { uni.showModal({ - title: "鎻愮ず5.2", + title: this.translateSys('tip') + "5.2", content: '璋冪敤 before_click_button 鑴氭湰杩斿洖绌猴紝event_id' + eventid, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); } } } else { uni.showModal({ - title: "閿欒5", + title: this.translateSys('error') + " 5", content: success.err_msg, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); } }).catch(ex => { // console.log(ex); uni.showModal({ - title: "鎻愮ず5.1", + title: this.translateSys('tip') + "5.1", content: ex.errMsg, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); }); }, @@ -2154,6 +2154,14 @@ value: attr.Value ? attr.Value : '' }; }, + translate(t) { + if (typeof this.$t == "function") return this.$t(`page.${t}`) + else return t; + }, + translateSys(t) { + if (typeof this.$t == "function") return this.$t(`sys.${t}`) + else return t; + }, } } </script> diff --git a/pages/modal/3018_2.vue b/pages/modal/3018_2.vue index e0be8dd..73b45c7 100644 --- a/pages/modal/3018_2.vue +++ b/pages/modal/3018_2.vue @@ -29,15 +29,17 @@ :type="item.name=='Input'?'text':item.name=='InputNumber'?'number':'text'" v-model="item.value" :disabled="item.disabled" :placeholder="item.placeholder" :style="{'width':item.setting.prefix && item.setting.suffix?'78%':item.setting.prefix || item.setting.suffix?'87%':'96%'}" - :focus="focusMateria" @focus="ontap(item)" @blur="onevent(item)" /> + :focus="focusFieldId == item.fieldId" @focus="ontap(item)" @click="onClick(item)" + @blur="onevent(item)" /> <text v-if="item.setting.suffix" class="uni-icon" :class="[item.setting.suffix]" @click="classAttr_extButton(item)"></text> </view> <!-- 澶氳鏂囨湰 --> <view class="input-wrapper" v-if="item.name=='Textarea' && !item.disabled"> <textarea class="uni-input" :class="item.disabled?'input-disabled':''" :value="item.value" - :placeholder="item.placeholder" @blur="onModelValue(item)" :data-index="index" - style="height:60px;" :style="{'width':'96%'}" :disabled="item.disabled"></textarea> + :focus="focusFieldId == item.fieldId" :placeholder="item.placeholder" @blur="onModelValue(item)" + @click="onClick(item)" :data-index="index" style="height:60px;" :style="{'width':'96%'}" + :disabled="item.disabled"></textarea> </view> <!-- 澶嶉�妗�--> @@ -76,7 +78,8 @@ :type="cols.name=='Input'?'text':cols.name=='InputNumber'?'number':'text'" v-model="cols.value" :disabled="cols.disabled" :placeholder="cols.placeholder" :style="{'width':cols.setting.prefix && cols.setting.suffix?'78%':cols.setting.prefix || cols.setting.suffix?'87%':'96%'}" - :focus="focusMateria" @focus="ontap(cols)" @blur="onevent(cols)" /> + :focus="focusFieldId == cols.fieldId" @focus="ontap(cols)" @click="onClick(cols)" + @blur="onevent(cols)" /> <text v-if="cols.setting.suffix" class="uni-icon" :class="[cols.setting.suffix]" @click="onchange(cols)"></text> </view> @@ -87,7 +90,8 @@ <!-- 澶氳鏂囨湰 --> <view class="input-wrapper" v-if="cols.name=='Textarea' && !cols.disabled"> <textarea class="uni-input" :value="cols.value" :class="cols.disabled?'input-disabled':''" - :placeholder="cols.placeholder" @blur="onModelValue(cols)" style="height:60px;" + :placeholder="cols.placeholder" :focus="focusFieldId == cols.fieldId" + @blur="onModelValue(cols)" @click="onClick(cols)" style="height:60px;" :style="{'width':'96%'}" :disabled="cols.disabled"></textarea> </view> <!-- 澶嶉�妗�--> @@ -175,7 +179,8 @@ popupType: "center", check_list: {}, - focusMateria: false, + focusFieldId: "", + focusOldFieldId: "", head_styledef: { form: { items: [] @@ -188,13 +193,45 @@ content: '' }; }, + onNavigationBarButtonTap(e) { + + const $this = this + uni.scanCode({ + scanType: ["qrCode"], + success: function(res) { + if ($this.focusFieldId) { + const items = $this.head_styledef.form.items || [] + for (let i in items) { + const ele = items[i] + if (ele.name == 'Input' || ele.name == 'InputNumber'|| ele.name == 'Textarea') { + if ($this.focusFieldId == ele.fieldId) { + $this.onScanValue(ele, res.result) + break; + } + } else if (ele.name == "Layot") { + let curIndex = (ele.setting.colList || []).findIndex((col, index2, arr) => { + return (col.name == 'Input' || col.name == 'InputNumber'|| col.name == 'Textarea') && $this + .focusFieldId == col.fieldId; + }) + if (curIndex > -1) { + let col = ele.setting.colList[curIndex] + $this.onScanValue(col, res.result) + break + } + } + } + } + } + }) + }, onLoad(options) { // console.log(options); uni.setNavigationBarTitle({ title: options.titlename }); //璁剧疆椤堕儴鏍囬 this.$data.param = JSON.parse(options.param); - this.$data.title = this.$data.param.Add_BtnName ? this.$data.param.Add_BtnName : options.titlename; //璁剧疆鎸夐挳鏂囧瓧 + this.$data.title = this.$data.param.Add_BtnName ? this.$data.param.Add_BtnName : options + .titlename; //璁剧疆鎸夐挳鏂囧瓧 console.log(this.$data.param); //鑾峰彇鏁版嵁绫荤殑鑷畾涔夎〃鍗曞弬鏁�@@ -204,6 +241,27 @@ }, methods: { + setData: function(obj) { + let that = this; + let keys = []; + let val, data; + + Object.keys(obj).forEach(function(key) { + keys = key.split("."); + val = obj[key]; + data = that.$data; + keys.forEach(function(key2, index) { + if (index + 1 == keys.length) { + that.$set(data, key2, val); + } else { + if (!data[key2]) { + that.$set(data, key2, {}); + } + } + data = data[key2]; + }); + }); + }, async Head_UIStyleGetInfo(class_id, style_id) { //鑾峰彇鑷畾涔夎〃鍗曟牱寮� var $this = this; var dataInfo = { @@ -218,7 +276,8 @@ //mobox2鐨剆tyle_def鏄痡son瀛楃涓� styledef = ret.result.style_def.replace(/\\/g, ""); //mobox3鐨剆tyle_def鏄痓ase64瀛楃涓�- if (!ret.result.style_def.includes('"')) styledef = Base64.decode(ret.result + if (!ret.result.style_def.includes('"')) styledef = Base64.decode(ret + .result .style_def); } $this.$data.head_styledef = ret.result.style_def ? JSON.parse(styledef) : {}; @@ -228,6 +287,14 @@ if (ele.useDict == true) { //鍒ゆ柇useDict鏄惁浣跨敤瀛楀吀 await this.DictGetInfo(ele.bind.dict, index, 'mast'); } + if ($this.focusFieldId == "") { + if (ele.name == 'Input' || ele.name == 'InputNumber'|| ele.name == 'Textarea') { + $this.setData({ + focusFieldId: ele.fieldId + }) + } + } + }); if ($this.head_styledef.event?.length > 0) { $this.head_styledef.event.forEach(async (a) => { //鍒ゆ柇鏄惁鏄垵濮嬪寲浜嬩欢 @@ -331,7 +398,8 @@ if (success.err_code == 0) { var data = success.result; if (data.ret != 0) { - var tip = data.err_info ? typeof data.err_info == 'string' ? data.err_info : data + var tip = data.err_info ? typeof data.err_info == 'string' ? data + .err_info : data .err_info.join('<br/>') : ''; if (data.ret == 801) uni.showModal({ title: this.translateSys("tip"), @@ -347,8 +415,9 @@ }); return false } else { - var tip = data.info ? typeof data.info == 'string' ? data.info : data.info.join( - '<br/>') : ''; + var tip = data.info ? typeof data.info == 'string' ? data.info : data.info + .join( + '<br/>') : ''; if (tip) uni.showModal({ title: this.translateSys("tip"), content: tip, @@ -385,7 +454,8 @@ } else if (attr.name == 'Layout') { attr.setting.colList.forEach(col => { if (col) { - if (col.fieldId == result[i].attr) { + if (col.fieldId == result[i] + .attr) { var dictItemList = []; for (var d in result[i] .choice_list) { @@ -413,7 +483,8 @@ //鍒ゆ柇琛ㄥ崟閲屾槸鍚︽湁杩斿洖瀛楁锛屾病鏈夊氨瑁呰浇鍒癿odel閲岋紝鐐瑰嚮纭畾鎻愪氦鐨勬椂鍊欏甫涓婅繖浜涙暟鎹� if ($this.head_styledef.form.model[result[i].attr] == undefined) { - $this.head_styledef.form.model[result[i].attr] = result[i] + $this.head_styledef.form.model[result[i].attr] = + result[i] .value; } //鍒ゆ柇鏄惁鏄爡鏍艰〃鍗�@@ -423,19 +494,23 @@ attr.oldvalue = ''; attr.value = result[i].value; attr.oldvalue = result[i].value; - $this.head_styledef.form.model[attr.fieldId] = result[ - i].value; + $this.head_styledef.form.model[attr.fieldId] = + result[ + i].value; } } else if (attr.name == 'Layout') { attr.setting.colList.forEach(col => { if (col) { - if (col.fieldId == result[i].attr) { + if (col.fieldId == result[i] + .attr) { col.value = ''; col.oldvalue = ''; col.value = result[i].value; col.oldvalue = result[i].value; - $this.head_styledef.form.model[col - .fieldId] = result[i].value; + $this.head_styledef.form.model[ + col + .fieldId] = result[i] + .value; } } }); @@ -449,9 +524,12 @@ $this.$data.refdatastore.push(result[i]); } if (length == 0) { - for (var j = 0; j < $this.$data.refdatastore.length; j++) { - if ($this.$data.refdatastore[j].attr == result[i].attr) { - $this.$data.refdatastore[j].value = result[i].value; + for (var j = 0; j < $this.$data.refdatastore + .length; j++) { + if ($this.$data.refdatastore[j].attr == result[i] + .attr) { + $this.$data.refdatastore[j].value = result[i] + .value; } } } @@ -459,26 +537,34 @@ } else if (data.action[i].action_type == 'set_dlg_attr_show') { var result = action.value; result.forEach(async (attr, key) => { - $this.$data.head_styledef.form.items.forEach(async ( - ele, index) => { - //鍒ゆ柇鏄惁鏄爡鏍艰〃鍗�- if (ele.name != 'Layout') { - if (ele.fieldId == attr.attr) { - ele.show = attr.show; + $this.$data.head_styledef.form.items.forEach( + async ( + ele, index) => { + //鍒ゆ柇鏄惁鏄爡鏍艰〃鍗�+ if (ele.name != 'Layout') { + if (ele.fieldId == attr + .attr) { + ele.show = attr.show; + } + } else if (ele.name == + 'Layout') { + ele.setting.colList + .forEach( + col => { + if (col) { + if (col + .fieldId == + attr + .attr + ) { + col.show = + attr + .show; + } + } + }); } - } else if (ele.name == 'Layout') { - ele.setting.colList.forEach( - col => { - if (col) { - if (col.fieldId == - attr.attr) { - col.show = attr - .show; - } - } - }); - } - }); + }); }); var head_styledef = JSON.parse(JSON.stringify($this.$data .head_styledef)); @@ -488,10 +574,13 @@ } else { uni.showModal({ title: this.translateSys("tip"), - content: this.translate('execute_init_event_failed') + + content: this.translate( + 'execute_init_event_failed') + this.translateSys("full_stop") + - this.translate('reason') + this.translateSys("colon") + - this.translateSys("quotation_mark_left") + action + this.translate('reason') + this.translateSys( + "colon") + + this.translateSys("quotation_mark_left") + + action .action_type + this.translateSys( "quotation_mark_right") + this .translate('tip_action_unprocessed'), @@ -566,50 +655,109 @@ // } // } // }) + this.focusOldFieldId = item.fieldId getApp().onScan((result) => { console.log(result); - uni.hideKeyboard(); - var $this = this; - console.log(item); - if (item.oldvalue != result.decodedata) { - item.oldvalue = result.decodedata; - item.value = result.decodedata; - var attr = item.fieldId; - $this.head_styledef.form.model[attr] = result.decodedata; - if (result.decodedata) { //绗竴涓緭鍏ユ涓嶄负绌�- $this.focusMateria = true; //鍒濆鍖栵紝绗簩涓緭鍏ユfocus灞炴� - // setTimeout(function(){ - // $this.focusMateria=true; //绗簩涓緭鍏ユ鑾峰彇鐒︾偣 - setTimeout(function() { - uni.hideKeyboard(); - }, 1000); - // },500); - } - var eventid = item.bind.onChangeEvent.id; //鍐呭鍙樺寲鍚庝簨浠�- if (eventid) { - var obj_attr = this.head_styledef.form.model; - // console.log(obj_attr); - var req = Object.keys(obj_attr).map((a) => ({ - attr: a, - val: obj_attr[a] || "", - })); + // uni.hideKeyboard(); + this.onScanValue(item, result.decodedata) + }) + }, + onScanValue(item, value) { + const $this = this; + console.log("onScanValue", item); + if (item.oldvalue != value) { + item.oldvalue = value; + item.value = value; + var attr = value + $this.head_styledef.form.model[attr] = value; + if (item.value) { //绗竴涓緭鍏ユ涓嶄负绌�+ //鍒濆鍖栵紝涓嬩釜杈撳叆妗唂ocus灞炴� + var findd = false + const items = $this.head_styledef.form.items || [] + for (let i in items) { + const ele = items[i] - var info = { - eventid: eventid, - edtype: "0", - projectid: '', - rclsid: '', - robjid: '', - userlogin: '', - clsid: this.$data.param.DataCls.id, - objid: "", - attr: req, - dataJson: [], + if (ele.name != "Layout") { + if (ele.name == 'Input' || ele.name == 'InputNumber'|| ele.name == 'Textarea') { + if (attr == ele.fieldId) { + findd = true + } else { + if (findd) { + $this.setData({ + focusFieldId: ele.fieldId + }) + break + } + + } + + } + } else { + if (findd) { + let curIndex = ele.setting.colList.findIndex((col, index2, arr) => { + return (col.name == 'Input' || col.name == 'InputNumber'|| col.name == 'Textarea'); + }) + if (curIndex > -1) { + $this.setData({ + focusFieldId: ele.setting.colList[curIndex] + .fieldId + }) + break + } + + } else { + let curIndex = ele.setting.colList.findIndex((col, index2, arr) => { + return attr == col.fieldId; + }) + if (curIndex > -1) { + findd = true + let curIndex2 = ele.setting.colList.findIndex((col, index2, arr) => { + return (col.name == 'Input' || col.name == + 'InputNumber'|| col.name == 'Textarea') && + index2 > + curIndex; + }) + if (curIndex2 > -1) { + $this.setData({ + focusFieldId: ele.setting.colList[curIndex] + .fieldId + }) + break + } + } + } + } - this.DataObjRunCustomEvent(info, ''); } } - }) + + var eventid = item.bind.onChangeEvent.id; //鍐呭鍙樺寲鍚庝簨浠�+ if (eventid) { + var obj_attr = this.head_styledef.form.model; + // console.log(obj_attr); + var req = Object.keys(obj_attr).map((a) => ({ + attr: a, + val: obj_attr[a] || "", + })); + + var info = { + eventid: eventid, + edtype: "0", + projectid: '', + rclsid: '', + robjid: '', + userlogin: '', + clsid: this.$data.param.DataCls.id, + objid: "", + attr: req, + dataJson: [], + } + this.DataObjRunCustomEvent(info, ''); + } + } + }, + onClick(item) { + this.focusFieldId = item.fieldId }, onevent(item) { // console.log(e.target); @@ -853,7 +1001,8 @@ if (success.err_code == 0) { var data = success.result; if (data.ret != 0) { - var tip = data.err_info ? typeof data.err_info == 'string' ? data.err_info : data + var tip = data.err_info ? typeof data.err_info == 'string' ? data.err_info : + data .err_info.join('<br/>') : ''; if (data.ret == 801) uni.showModal({ title: this.translateSys("tip"), @@ -869,8 +1018,9 @@ }); return false } else { - var tip = data.info ? typeof data.info == 'string' ? data.info : data.info.join( - '<br/>') : ''; + var tip = data.info ? typeof data.info == 'string' ? data.info : data.info + .join( + '<br/>') : ''; if (tip) uni.showModal({ title: this.translateSys("tip"), content: tip, @@ -887,7 +1037,8 @@ var result = action.value; for (var i = 0; i < result.length; i++) { if (result[i].choice_list) { - for (var c = 0; c < $this.head_styledef.form.items.length; c++) { + for (var c = 0; c < $this.head_styledef.form.items + .length; c++) { var attr = $this.head_styledef.form.items[c]; if (attr.name != 'Layout') { if (attr.fieldId == result[i].attr) { @@ -906,10 +1057,13 @@ } else if (attr.name == 'Layout') { attr.setting.colList.forEach(col => { if (col) { - if (col.fieldId == result[i].attr) { + if (col.fieldId == result[i] + .attr) { var dictItemList = []; - for (var d in result[i].choice_list) { - var val = result[i].choice_list[d]; + for (var d in result[i] + .choice_list) { + var val = result[i] + .choice_list[d]; dictItemList.push({ "CN_S_NAME": val, "CN_S_VALUE": val, @@ -925,12 +1079,15 @@ } } - for (var c = 0; c < $this.$data.head_styledef.form.items.length; c++) { + for (var c = 0; c < $this.$data.head_styledef.form.items + .length; c++) { var attr = $this.$data.head_styledef.form.items[c]; // console.log(attr[j].Name+'=='+result[i].attr); //鍒ゆ柇琛ㄥ崟閲屾槸鍚︽湁杩斿洖瀛楁锛屾病鏈夊氨瑁呰浇鍒癿odel閲岋紝鐐瑰嚮纭畾鎻愪氦鐨勬椂鍊欏甫涓婅繖浜涙暟鎹�- if ($this.head_styledef.form.model[result[i].attr] == undefined) { - $this.head_styledef.form.model[result[i].attr] = result[i] + if ($this.head_styledef.form.model[result[i].attr] == + undefined) { + $this.head_styledef.form.model[result[i].attr] = + result[i] .value; } //鍒ゆ柇鏄惁鏄爡鏍艰〃鍗�@@ -940,7 +1097,8 @@ attr.oldvalue = ''; attr.value = result[i].value; attr.oldvalue = result[i].value; - $this.head_styledef.form.model[attr.fieldId] = result[i] + $this.head_styledef.form.model[attr.fieldId] = + result[i] .value; } } else if (attr.name == 'Layout') { @@ -967,8 +1125,10 @@ } if (length == 0) { for (var j = 0; j < $this.$data.refdatastore.length; j++) { - if ($this.$data.refdatastore[j].attr == result[i].attr) { - $this.$data.refdatastore[j].value = result[i].value; + if ($this.$data.refdatastore[j].attr == result[i] + .attr) { + $this.$data.refdatastore[j].value = result[i] + .value; } } } @@ -976,27 +1136,33 @@ } else if (action.action_type == 'set_dlg_attr_show') { var result = action.value; result.forEach(async (attr, key) => { - $this.$data.head_styledef.form.items.forEach(async (ele, - index) => { - //鍒ゆ柇鏄惁鏄爡鏍艰〃鍗�- if (ele.name != 'Layout') { - if (ele.fieldId == attr.attr) { - ele.show = attr.show; - } - } else if (ele.name == 'Layout') { - ele.setting.colList.forEach(col => { - if (col) { - if (col.fieldId == attr - .attr) { - col.show = attr - .show; - } + $this.$data.head_styledef.form.items.forEach( + async (ele, + index) => { + //鍒ゆ柇鏄惁鏄爡鏍艰〃鍗�+ if (ele.name != 'Layout') { + if (ele.fieldId == attr.attr) { + ele.show = attr.show; } - }); - } - }); + } else if (ele.name == 'Layout') { + ele.setting.colList.forEach( + col => { + if (col) { + if (col + .fieldId == + attr + .attr) { + col.show = + attr + .show; + } + } + }); + } + }); }); - var head_styledef = JSON.parse(JSON.stringify($this.$data.head_styledef)); + var head_styledef = JSON.parse(JSON.stringify($this.$data + .head_styledef)); $this.$data.head_styledef = []; $this.$data.head_styledef = head_styledef; // console.log($this.$data.head_styledef); @@ -1005,7 +1171,8 @@ } else { uni.showModal({ title: this.translateSys("tip"), - content: this.translateSys("quotation_mark_left") + action + content: this.translateSys("quotation_mark_left") + + action .action_type + this.translateSys( "quotation_mark_right") + this.translate( "tip_action_unprocessed"), @@ -1027,7 +1194,8 @@ var attr = $this.$data.head_styledef.form.items[c]; //鍒ゆ柇琛ㄥ崟閲屾槸鍚︽湁杩斿洖瀛楁锛屾病鏈夊氨瑁呰浇鍒癿odel閲岋紝鐐瑰嚮纭畾鎻愪氦鐨勬椂鍊欏甫涓婅繖浜涙暟鎹� if ($this.head_styledef.form.model[result[i].attr] == undefined) { - $this.head_styledef.form.model[result[i].attr] = result[i].value; + $this.head_styledef.form.model[result[i].attr] = result[i] + .value; } //鍒ゆ柇鏄惁鏄爡鏍艰〃鍗� if (attr.name != 'Layout') { @@ -1036,7 +1204,8 @@ attr.oldvalue = ''; attr.value = result[i].value; attr.oldvalue = result[i].value; - $this.head_styledef.form.model[attr.fieldId] = result[i].value; + $this.head_styledef.form.model[attr.fieldId] = result[i] + .value; } } else if (attr.name == 'Layout') { attr.setting.colList.forEach(col => { @@ -1046,7 +1215,8 @@ col.oldvalue = ''; col.value = result[i].value; col.oldvalue = result[i].value; - $this.head_styledef.form.model[col.fieldId] = + $this.head_styledef.form.model[col + .fieldId] = result[i].value; } } @@ -1162,7 +1332,8 @@ if (success.err_code == 0) { var data = success.result; if (data.ret != 0) { - var tip = data.err_info ? typeof data.err_info == 'string' ? data.err_info : data + var tip = data.err_info ? typeof data.err_info == 'string' ? data.err_info : + data .err_info.join('<br/>') : ''; if (data.ret == 801) uni.showModal({ title: this.translateSys("tip"), @@ -1178,8 +1349,9 @@ }); return false } else { - var tip = data.info ? typeof data.info == 'string' ? data.info : data.info.join( - '<br/>') : ''; + var tip = data.info ? typeof data.info == 'string' ? data.info : data.info + .join( + '<br/>') : ''; if (tip) uni.showModal({ title: this.translateSys("tip"), content: tip, @@ -1200,7 +1372,8 @@ var d = dialog({ title: '<i class="ace-icon fa fa-info-circle"></i> ' + this.translateSys("tip"), - content: this.translateSys("quotation_mark_left") + action + content: this.translateSys("quotation_mark_left") + + action .action_type + this.translateSys( "quotation_mark_right") + this.translate( "tip_action_unprocessed") @@ -1217,13 +1390,15 @@ data_attr: data_attr } uni.navigateTo({ - url: '../selpsn/index?mulit=false¶m=' + JSON.stringify( - param), + url: '../selpsn/index?mulit=false¶m=' + JSON + .stringify( + param), events: { AddPer(data, param) { // console.log(param); console.log(data); - var callback_eventid = param.button_callback + var callback_eventid = param + .button_callback .trim(); var info = { eventid: callback_eventid, @@ -1232,13 +1407,15 @@ rclsid: '', robjid: '', userlogin: '', - clsid: $this.$data.param.DataCls.id, + clsid: $this.$data.param.DataCls + .id, objid: "", attr: param.req, inputparameter: data, dataJson: [], } - $this.DataObjRunCustomEvent(info, param.data_attr); + $this.DataObjRunCustomEvent(info, param + .data_attr); } } }); @@ -1246,7 +1423,8 @@ var d = dialog({ title: '<i class="ace-icon fa fa-info-circle"></i> ' + this.translateSys("tip"), - content: this.translateSys("quotation_mark_left") + action + content: this.translateSys("quotation_mark_left") + + action .action_type + this.translateSys( "quotation_mark_right") + this.translate( "tip_action_unprocessed") @@ -1295,17 +1473,20 @@ req: req } uni.navigateTo({ - url: '../selPrj/index?relation=' + priRel + '¶m=' + + url: '../selPrj/index?relation=' + priRel + + '¶m=' + JSON.stringify(param_), events: { AddPer(data, param) { var attr = param.item.fieldId; - $this.head_styledef.form.model[attr] = data[0].ID + + $this.head_styledef.form.model[attr] = + data[0].ID + ';' + data[0].Name; // $this.$data.classAttrList[param.index].Attr[param.iindex].Value=data[0].Name; // $this.$data.classAttrList[param.index].Attr[param.iindex].ValID=data[0].ID+';'+data[0].Name; - var callback_eventid = param.button_callback + var callback_eventid = param + .button_callback .trim(); if (callback_eventid) { var info = { @@ -1315,7 +1496,8 @@ rclsid: "", robjid: "", userlogin: "", - clsid: $this.$data.param.DataCls.id, + clsid: $this.$data.param + .DataCls.id, objid: "", attr: param.req, dataJson: [], @@ -1438,7 +1620,8 @@ uni.showModal({ title: this.translateSys("tip"), content: this.translate('execute_script_failed') + this - .translateSys('comma') + this.translate('result') + this + .translateSys('comma') + this.translate('result') + + this .translateSys('colon') + action.result, showCancel: false, confirmText: this.translateSys("cancel") @@ -1449,7 +1632,8 @@ uni.showModal({ title: this.translateSys("tip"), content: this.translate('execute_script_failed') + this - .translateSys('comma') + this.translate('result') + this + .translateSys('comma') + this.translate('result') + + this .translateSys('colon') + action.info, showCancel: false, confirmText: this.translateSys("cancel") @@ -1468,7 +1652,7 @@ } } else uni.showToast({ - title: this.translate('create_success') , + title: this.translate('create_success'), icon: "success", duration: 3000 }); @@ -1532,7 +1716,8 @@ if (success.err_code == 0) { var data = success.result; if (data.ret != 0) { - var tip = data.err_info ? typeof data.err_info == 'string' ? data.err_info : data + var tip = data.err_info ? typeof data.err_info == 'string' ? data.err_info : + data .err_info.join('<br/>') : ''; if (data.ret == 801) uni.showModal({ title: this.translateSys("tip"), @@ -1548,8 +1733,9 @@ }); return false } else { - var tip = data.info ? typeof data.info == 'string' ? data.info : data.info.join( - '<br/>') : ''; + var tip = data.info ? typeof data.info == 'string' ? data.info : data.info + .join( + '<br/>') : ''; if (tip) uni.showModal({ title: this.translateSys("tip"), content: tip, diff --git a/pages/modal/3037.vue b/pages/modal/3037.vue index 89d712d..c4fdf87 100644 --- a/pages/modal/3037.vue +++ b/pages/modal/3037.vue @@ -288,7 +288,7 @@ <div class="panel_title">{{param.Sub_Cls.Title}}</div> <!-- 浠庢暟鎹壂鐮佸尯 --> <view class="v-area class_attr_body" v-if="param.Sub_Cls.Can_Add_Delete == true"> - <h4 style="margin: 15rpx 0 0 30rpx;font-weight: bold;">鏂板{{param.Sub_Cls.Name }}</h4> + <h4 style="margin: 15rpx 0 0 30rpx;font-weight: bold;">{{`${translateSys('add2')}'${param.Sub_Cls.Name}'` }}</h4> <view class="form-group"> <!-- 宸﹀彸甯冨眬 --> <p class="tx_title2">{{param.Scan_Code.Name}}:</p> @@ -608,7 +608,8 @@ </view> </view> - <button type="default" @tap="cancel" class="btn_cancel" v-if="param.Sub_Cls.Can_Add_Delete == true">鍙栨秷</button> + <button type="default" @tap="cancel" class="btn_cancel" + v-if="param.Sub_Cls.Can_Add_Delete == true">{{translateSys('cancel')}}</button> <button type="default" @tap="sava" class="btn_add" v-if="param.Sub_Cls.Can_Add_Delete == true">{{title}}</button> <button type="default" @tap="sava" class="btn_sava" @@ -632,8 +633,9 @@ </view> </view> <view class="popup-footer"> - <button type="default" @tap="popup_sava" class="btn_popup_add">纭畾</button> - <button type="default" @tap="popup_cancel" class="btn_popup_cancel">鍙栨秷</button> + <button type="default" @tap="popup_sava" class="btn_popup_add">{{translateSys('ok')}}</button> + <button type="default" @tap="popup_cancel" + class="btn_popup_cancel">{{translateSys('cancel')}}</button> </view> </view> </uni-popup> @@ -682,19 +684,19 @@ console.log(param); if (!param.Master_Cls.View_Style) { uni.showModal({ - title: "鎻愮ず", + title: this.translateSys('tip') + "", content: "璇ュ姛鑳界偣鏈厤缃晫闈㈢獥鍙o紝璇烽噸鏂伴厤缃紒", showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); return; } if (!param.Master_Cls.View_Style.Name) { uni.showModal({ - title: "鎻愮ず", + title: this.translateSys('tip') + "", content: "璇ュ姛鑳界偣鏈厤缃獥鍙f牱寮忥紝璇烽噸鏂伴厤缃紒", showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); return; } @@ -733,19 +735,19 @@ }, 500); } else { uni.showModal({ - title: "閿欒1", + title: this.translateSys('error') + " 1", content: success.err_msg, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); } }).catch(ex => { // console.log(ex); uni.showModal({ - title: "閿欒1.1", + title: this.translateSys('error') + " 1.1", content: ex.errMsg, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); }); } @@ -777,19 +779,19 @@ }, 500); } else { uni.showModal({ - title: "閿欒1_1", + title: this.translateSys('error') + " 1_1", content: success.err_msg, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); } }).catch(ex => { // console.log(ex); uni.showModal({ - title: "閿欒1_1.1", + title: this.translateSys('error') + " 1_1.1", content: ex.errMsg, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); }); } @@ -816,19 +818,19 @@ } else { uni.showModal({ - title: "閿欒1.2", + title: this.translateSys('error') + " 1.2", content: success.err_msg, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); } }).catch(ex => { // console.log(ex); uni.showModal({ - title: "閿欒1.3", + title: this.translateSys('error') + " 1.3", content: ex.errMsg, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); }); }, @@ -859,19 +861,19 @@ $this.viewParam('Mast'); } else { uni.showModal({ - title: "閿欒1.2", + title: this.translateSys('error') + " 1.2", content: success.err_msg, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); } }).catch(ex => { console.log(ex); uni.showModal({ - title: "閿欒1.3", + title: this.translateSys('error') + " 1.3", content: ex.errMsg, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); }); } @@ -895,19 +897,19 @@ // $this.subClass_attr_init(); } else { uni.showModal({ - title: "閿欒1.2", + title: this.translateSys('error') + " 1.2", content: success.err_msg, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); } }).catch(ex => { console.log(ex); uni.showModal({ - title: "閿欒1.3", + title: this.translateSys('error') + " 1.3", content: ex.errMsg, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); }); } @@ -1072,7 +1074,7 @@ } // console.log(ca.dictitem); } - if (utils.classUtils.attrTypeIsDate(ca + if (utils.classUtils.attrTypeIsDateTime(ca .Type )) // if(ca.Type=='鏃ユ湡' || ca.Type=='鏃堕棿' ||ca.Type=='date' || ca.Type=='datetime') { @@ -1091,9 +1093,11 @@ ca.RelClsList = ca.RelCls; ca.Value = '璇烽�鎷�; } - if (utils.classUtils.attrTypeIsRegion(ca.Type)) //if(ca.Type=='鐪佸競鍖�|| ca.Type=='region') + if (utils.classUtils.attrTypeIsRegion(ca + .Type)) //if(ca.Type=='鐪佸競鍖�|| ca.Type=='region') ca.Value = '璇烽�鎷�; - if (utils.classUtils.attrTypeIsBool(ca.Type)) //if(ca.Type=='甯冨皵鍊�|| ca.Type=='bool') + if (utils.classUtils.attrTypeIsBool(ca + .Type)) //if(ca.Type=='甯冨皵鍊�|| ca.Type=='bool') ca.Value = false; attr.push(ca); @@ -1178,10 +1182,10 @@ } else { uni.showModal({ - title: "鎻愮ず", + title: this.translateSys('tip') + "", content: "鏈壘鍒板彲鏄剧ず鐨勭殑灞炴�", showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); } }, @@ -1228,7 +1232,7 @@ } } } - if (utils.classUtils.attrTypeIsDate(ca.Type)) //if(ca.Type=='鏃ユ湡' || ca.Type=='鏃堕棿') + if (utils.classUtils.attrTypeIsDateTime(ca.Type)) //if(ca.Type=='鏃ユ湡' || ca.Type=='鏃堕棿') { var nowDate = new Date(); var date = { @@ -1244,7 +1248,8 @@ ca.RelClsList = ca.RelCls; ca.Value = '璇�; } - if (utils.classUtils.attrTypeIsRegion(ca.Type)) //if(ca.Type=='鐪佸競鍖�||ca.Type=='region') + if (utils.classUtils.attrTypeIsRegion(ca + .Type)) //if(ca.Type=='鐪佸競鍖�||ca.Type=='region') ca.Value = '璇烽�鎷�; if (utils.classUtils.attrTypeIsBool(ca.Type)) //if(ca.Type=='甯冨皵鍊�||ca.Type=='bool') ca.Value = false; @@ -1331,10 +1336,10 @@ } else { uni.showModal({ - title: "鎻愮ず", + title: this.translateSys('tip') + "", content: "鏈壘鍒板彲鏄剧ず鐨勭殑灞炴�", showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); } }, @@ -1343,10 +1348,10 @@ var Before_Select_Event = $this.$data.param.Scan_Code.Before_Select_Event; if (!Before_Select_Event) { uni.showModal({ - title: "鎻愮ず", + title: this.translateSys('tip') + "", content: "閫夋嫨鍓嶄簨浠朵负绌猴紒", showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); return; } @@ -1358,10 +1363,10 @@ var ar = attr[j]; if (ar.Value == '璇烽�鎷�) { uni.showModal({ - title: "鎻愮ず", + title: this.translateSys('tip') + "", content: ar.DispName + "鏈�鎷╂暟鎹紒", showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); return; } @@ -1410,10 +1415,10 @@ uni.hideLoading(); // uni.showToast({title:ar.DispName+'涓嶈兘涓虹┖锛�,icon:"success",duration:3000}); uni.showModal({ - title: "鎻愮ず", + title: this.translateSys('tip') + "", content: ar.DispName + '涓嶈兘涓虹┖锛�, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); return; } @@ -1488,10 +1493,10 @@ var After_Select_Event = $this.$data.param.Scan_Code.After_Select_Event; if (!After_Select_Event) { uni.showModal({ - title: "鎻愮ず", + title: this.translateSys('tip') + "", content: "閫夋嫨鍚庝簨浠朵负绌猴紒", showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); return; } @@ -1511,10 +1516,10 @@ } if (data.length == 0) { uni.showModal({ - title: "鎻愮ず", + title: this.translateSys('tip') + "", content: "鏈�鎷╂暟鎹紒", showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); return; } @@ -1526,10 +1531,10 @@ var ar = attr[j]; if (ar.Value == '璇烽�鎷�) { uni.showModal({ - title: "鎻愮ず", + title: this.translateSys('tip') + "", content: ar.DispName + "鏈�鎷╂暟鎹紒", showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); return; } @@ -1589,27 +1594,27 @@ if (ret.err_code == 0) { $this.$data.subPanelList.splice(index, 1); uni.showModal({ - title: "鎻愮ず", + title: this.translateSys('tip') + "", content: "鍒犻櫎鎴愬姛锛�, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); } else { uni.showModal({ - title: "閿欒9", + title: this.translateSys('error') + " 9", content: success.msg, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); } }).catch(ex => { console.log(ex); uni.hideLoading(); uni.showModal({ - title: "鎻愮ず9.1", + title: this.translateSys('tip') + "9.1", content: ex.errMsg, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); }); } @@ -2277,19 +2282,19 @@ .button_callback; if (!before_click_button) { uni.showModal({ - title: "鎻愮ず", + title: this.translateSys('tip') + "", content: "before_click_button-event_id涓虹┖锛�, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); return; } if (!button_callback) { uni.showModal({ - title: "鎻愮ず", + title: this.translateSys('tip') + "", content: "button_callback-event_id涓虹┖锛�, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); return; } @@ -2368,10 +2373,10 @@ classAttr_AddRef(e) { console.log(e.target); uni.showModal({ - title: "鎻愮ず", + title: this.translateSys('tip') + "", content: "姝ゅ姛鑳借繕鏈疄鐜帮紒", showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); // var value=this.$data.classAttrList[e.target.dataset['index']].Attr[e.target.dataset['iindex']].RelCls[e.target.value]; // this.$data.classAttrList[e.target.dataset['index']].Attr[e.target.dataset['iindex']].Value=value; @@ -2488,15 +2493,14 @@ name: ar.Name, value: ar.Value }); - } else - { - const node = this.formatAttr(ar) - req.push({ - name: node.attr, - value: node.value - }); - } - + } else { + const node = this.formatAttr(ar) + req.push({ + name: node.attr, + value: node.value + }); + } + if (ar.notempty == true && !ar .Value) { @@ -2504,12 +2508,12 @@ uni.hideLoading(); // uni.showToast({title:ar.DispName+'涓嶈兘涓虹┖锛�,icon:"success",duration:3000}); uni.showModal({ - title: "鎻愮ず", + title: this.translateSys('tip') + "", content: ar .DispName + '涓嶈兘涓虹┖锛�, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); return; } @@ -2605,21 +2609,21 @@ // this.class_attr_init(); } else { uni.showModal({ - title: "閿欒", + title: this.translateSys('error') + " ", content: success .err_msg, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); } }).catch(ex => { console.log(ex); uni.hideLoading(); uni.showModal({ - title: "鎻愮ず", + title: this.translateSys('tip') + "", content: ex.errMsg, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); }); }, @@ -2699,19 +2703,19 @@ '<br/>') : ''; if (data.ret == 801) uni.showModal({ - title: '鎻愮ず', + title: this.translateSys('tip'), content: tip, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); else uni.showModal({ - title: '鎻愮ず', + title: this.translateSys('tip'), content: tip + ',鎻愮ず:' + data .ret, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); return false } else { @@ -2723,10 +2727,10 @@ ''; if (tip) uni .showModal({ - title: '鎻愮ず', + title: this.translateSys('tip'), content: tip, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); if (data.action) { @@ -2911,10 +2915,10 @@ 'open_select_userdlg' ) { uni.showModal({ - title: "閿欒2.2", + title: this.translateSys('error') + " 2.2", content: "open_select_userdlg杩欎釜action_type杩樻湭澶勭悊锛�, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); } } @@ -2923,20 +2927,20 @@ } } else { uni.showModal({ - title: "閿欒2", + title: this.translateSys('error') + " 2", content: success .err_msg, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); } }).catch(ex => { // console.log(ex); uni.showModal({ - title: "閿欒2.1", + title: this.translateSys('error') + " 2.1", content: ex.errMsg, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); }); }, @@ -3034,19 +3038,19 @@ '<br/>') : ''; if (data.ret == 801) uni.showModal({ - title: '鎻愮ず', + title: this.translateSys('tip'), content: tip, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); else uni.showModal({ - title: '鎻愮ず', + title: this.translateSys('tip'), content: tip + ',鎻愮ず:' + data .ret, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); return false } else { @@ -3058,10 +3062,10 @@ ''; if (tip) uni .showModal({ - title: '鎻愮ず', + title: this.translateSys('tip'), content: tip, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); var actionlist = data @@ -3399,20 +3403,20 @@ } } else { uni.showModal({ - title: "閿欒3", + title: this.translateSys('error') + " 3", content: success .err_msg, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); } }).catch(ex => { // console.log(ex); uni.showModal({ - title: "閿欒3.1", + title: this.translateSys('error') + " 3.1", content: ex.errMsg, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); }); }, @@ -3531,19 +3535,19 @@ '<br/>') : ''; if (data.ret == 801) uni.showModal({ - title: '鎻愮ず', + title: this.translateSys('tip'), content: tip, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); else uni.showModal({ - title: '鎻愮ず', + title: this.translateSys('tip'), content: tip + ',鎻愮ず:' + data .ret, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); return false } else { @@ -3555,10 +3559,10 @@ ''; if (tip) uni .showModal({ - title: '鎻愮ず', + title: this.translateSys('tip'), content: tip, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); var result = data @@ -3623,20 +3627,20 @@ } } else { uni.showModal({ - title: "閿欒4", + title: this.translateSys('error') + " 4", content: success .err_msg, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); } }).catch(ex => { // console.log(ex); uni.showModal({ - title: "閿欒4.1", + title: this.translateSys('error') + " 4.1", content: ex.errMsg, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); }); }, @@ -3761,19 +3765,19 @@ '<br/>') : ''; if (data.ret == 801) uni.showModal({ - title: '鎻愮ず', + title: this.translateSys('tip'), content: tip, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); else uni.showModal({ - title: '鎻愮ず', + title: this.translateSys('tip'), content: tip + ',鎻愮ず:' + data .ret, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); return false } else { @@ -3785,10 +3789,10 @@ ''; if (tip) uni .showModal({ - title: '鎻愮ず', + title: this.translateSys('tip'), content: tip, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); if (data != "") { @@ -3821,7 +3825,7 @@ var d = dialog({ title: '<i class="ace-icon fa fa-info-circle"></i> ' + - '鎻愮ず', + this.translateSys('tip'), content: action .action_type + '姝ction灏氭湭澶勭悊锛� @@ -3909,7 +3913,7 @@ var d = dialog({ title: '<i class="ace-icon fa fa-info-circle"></i> ' + - '鎻愮ず', + this.translateSys('tip'), content: action .action_type + '姝ction灏氭湭澶勭悊锛� @@ -4071,7 +4075,7 @@ var d = dialog({ title: '<i class="ace-icon fa fa-info-circle"></i> ' + - '鎻愮ず', + this.translateSys('tip'), content: action .action_type + '姝ction灏氭湭澶勭悊锛� @@ -4083,30 +4087,30 @@ } } else { uni.showModal({ - title: "鎻愮ず5.2", + title: this.translateSys('tip') + "5.2", content: '璋冪敤 before_click_button 鑴氭湰杩斿洖绌猴紝event_id' + eventid, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); } } } else { uni.showModal({ - title: "閿欒5", + title: this.translateSys('error') + " 5", content: success .err_msg, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); } }).catch(ex => { // console.log(ex); uni.showModal({ - title: "鎻愮ず5.1", + title: this.translateSys('tip') + "5.1", content: ex.errMsg, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); }); }, @@ -4186,19 +4190,19 @@ '<br/>') : ''; if (data.ret == 801) uni.showModal({ - title: '鎻愮ず', + title: this.translateSys('tip'), content: tip, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); else uni.showModal({ - title: '鎻愮ず', + title: this.translateSys('tip'), content: tip + ',鎻愮ず:' + data .ret, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); return false } else { @@ -4210,10 +4214,10 @@ ''; if (tip) uni .showModal({ - title: '鎻愮ず', + title: this.translateSys('tip'), content: tip, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); var actionlist = data @@ -4395,10 +4399,10 @@ 'open_select_userdlg' ) { uni.showModal({ - title: "閿欒6.2", + title: this.translateSys('error') + " 6.2", content: "open_select_userdlg杩欎釜action_type杩樻湭澶勭悊锛�, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); } } @@ -4406,20 +4410,20 @@ } } else { uni.showModal({ - title: "閿欒6", + title: this.translateSys('error') + " 6", content: success .err_msg, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); } }).catch(ex => { // console.log(ex); uni.showModal({ - title: "閿欒6.1", + title: this.translateSys('error') + " 6.1", content: ex.errMsg, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); }); }, @@ -4509,19 +4513,19 @@ '<br/>') : ''; if (data.ret == 801) uni.showModal({ - title: '鎻愮ず', + title: this.translateSys('tip'), content: tip, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); else uni.showModal({ - title: '鎻愮ず', + title: this.translateSys('tip'), content: tip + ',鎻愮ず:' + data .ret, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); return false } else { @@ -4533,10 +4537,10 @@ ''; if (tip) uni .showModal({ - title: '鎻愮ず', + title: this.translateSys('tip'), content: tip, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); var actionlist = data @@ -4613,7 +4617,8 @@ ] .attr ) { - if (utils.classUtils.attrTypeIsDict(attr[j].Type)) { + if (utils.classUtils.attrTypeIsDict(attr[j] + .Type)) { var dictItemList = []; for ( @@ -5261,20 +5266,20 @@ } } else { uni.showModal({ - title: "閿欒7", + title: this.translateSys('error') + " 7", content: success .err_msg, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); } }).catch(ex => { // console.log(ex); uni.showModal({ - title: "閿欒7.1", + title: this.translateSys('error') + " 7.1", content: ex.errMsg, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); }); }, @@ -5320,12 +5325,12 @@ uni.hideLoading(); // uni.showToast({title:ar.DispName+'涓嶈兘涓虹┖锛�,icon:"success",duration:3000}); uni.showModal({ - title: "鎻愮ず", + title: this.translateSys('tip') + "", content: ar .DispName + '涓嶈兘涓虹┖锛�, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); return; } @@ -5347,7 +5352,7 @@ if (ar.Value == '璇烽�鎷� || ar .Value == '鈥斺�璇烽�鎷┾�鈥�) ar .Value = ''; - if (utils.classUtils.attrTypeIsDict(ar.Type)) { + if (utils.classUtils.attrTypeIsDict(ar.Type)) { if (ar.select == true) { //鍒ゆ柇涓嬫媺鏄惁澶氶� var valStr = ""; @@ -5377,12 +5382,12 @@ uni.hideLoading(); // uni.showToast({title:ar.DispName+'涓嶈兘涓虹┖锛�,icon:"success",duration:3000}); uni.showModal({ - title: "鎻愮ず", + title: this.translateSys('tip') + "", content: ar .DispName + '涓嶈兘涓虹┖锛�, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); return; } @@ -5461,19 +5466,19 @@ '<br/>') : ''; if (data.ret == 801) uni.showModal({ - title: '鎻愮ず', + title: this.translateSys('tip'), content: tip, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); else uni.showModal({ - title: '鎻愮ず', + title: this.translateSys('tip'), content: tip + ',鎻愮ず:' + data .ret, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); return false } else { @@ -5485,10 +5490,10 @@ ''; if (tip) uni .showModal({ - title: '鎻愮ず', + title: this.translateSys('tip'), content: tip, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); var result = data @@ -5521,21 +5526,21 @@ } } else { uni.showModal({ - title: "閿欒8", + title: this.translateSys('error') + " 8", content: success .err_msg, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); } }).catch(ex => { // console.log(ex); uni.hideLoading(); uni.showModal({ - title: "閿欒8.1", + title: this.translateSys('error') + " 8.1", content: ex.errMsg, showCancel: false, - confirmText: "鍙栨秷" + confirmText: this.translateSys('cancel') }); }); }, @@ -5560,6 +5565,14 @@ value: attr.Value ? attr.Value : '' }; }, + translate(t) { + if (typeof this.$t == "function") return this.$t(`page.${t}`) + else return t; + }, + translateSys(t) { + if (typeof this.$t == "function") return this.$t(`sys.${t}`) + else return t; + }, } } </script> diff --git a/pages/modal/5600.vue b/pages/modal/5600.vue index b73e1f3..1024330 100644 --- a/pages/modal/5600.vue +++ b/pages/modal/5600.vue @@ -19,7 +19,8 @@ :placeholder="item.placeholder" :style="{'width':item.setting.prefix && item.setting.suffix?'78%':item.setting.prefix || item.setting.suffix?'87%':'96%'}" :focus="focusFieldId == item.fieldId" @focus="ontap(index,item)" - @keyup.enter="onEnterChange(item)" @blur="onEnterChange(item)" /> + @click="onClick(item)" @keyup.enter="onEnterChange(item)" + @blur="onEnterChange(item)" /> <text v-if="item.setting.suffix" class="uni-icon" :class="[item.setting.suffix]" @click="onEnterChange(item)"></text> </view> @@ -490,7 +491,9 @@ }); }); }, - + onClick(item) { + this.focusFieldId = item.fieldId + }, ontap(index, item) { //鎵爜鍔熻兘 // var $ele = e; //console.log(e.target) @@ -533,19 +536,62 @@ } if (item.value) { //绗竴涓緭鍏ユ涓嶄负绌� //鍒濆鍖栵紝涓嬩釜杈撳叆妗唂ocus灞炴� - const curIndex = $this.head_styledef.form.items.findIndex((ele, index2, arr) => { - return (ele.name == 'Input' || ele.name == 'InputNumber') && index2 > - index; - }) - if (curIndex > -1) { - $this.setData({ - focusFieldId: $this.head_styledef.form.items[curIndex].fieldId - }) - } - // setTimeout(function() { - // uni.hideKeyboard(); - // }, 1000); + var findd = false + for (let i in $this.head_styledef.form.items) { + const ele = $this.head_styledef.form.items[i] + if (ele.name != "Layout") { + if (ele.name == 'Input' || ele.name == 'InputNumber') { + if (attr == ele.fieldId) { + findd = true + } else { + if (findd) { + $this.setData({ + focusFieldId: ele.fieldId + }) + break + } + + } + + } + } else { + if (findd) { + let curIndex = ele.setting.colList.findIndex((col, index2, arr) => { + return (col.name == 'Input' || col.name == 'InputNumber'); + }) + if (curIndex > -1) { + $this.setData({ + focusFieldId: ele.setting.colList[curIndex] + .fieldId + }) + break + } + + } else { + let curIndex = ele.setting.colList.findIndex((col, index2, arr) => { + return attr == col.fieldId; + }) + if (curIndex > -1) { + findd = true + let curIndex2 = ele.setting.colList.findIndex((col, index2, arr) => { + return (col.name == 'Input' || col.name == + 'InputNumber') && + index2 > + curIndex; + }) + if (curIndex2 > -1) { + $this.setData({ + focusFieldId: ele.setting.colList[curIndex] + .fieldId + }) + break + } + } + } + + } + } } // if(onSuffixClickCallbackEvent.id){ //鍚庡浘鏍囩偣鍑讳簨浠� // this.onSuffixClick(onSuffixClickCallbackEvent); @@ -1516,7 +1562,7 @@ item_list: jsonlist, ext_data: $this.detail1ExtData }) - + // console.log(jsonlist); $this.runCustomEvent(event, input_param, list, '1'); // jsonlist.forEach(async (json,key)=>{ diff --git a/pages/modal/5601.vue b/pages/modal/5601.vue index 08b41f4..c4389c5 100644 --- a/pages/modal/5601.vue +++ b/pages/modal/5601.vue @@ -17,7 +17,8 @@ :style="{'padding-left':item.setting.prefix?0 : '8rpx','right':item.setting.suffix?0 : '8rpx'}" :type="item.name=='Input'?'text':'number'" v-model="item.value" :disabled="item.disabled" :placeholder="item.placeholder" :focus="focusFieldId == item.fieldId" @focus="ontap(item)" - @keyup.enter="onEnterChange(item)" @blur="onEnterChange(item)" /> + @click="onClick(item)" @keyup.enter="onEnterChange(item)" + @blur="onEnterChange(item)" /> <text v-if="item.setting.suffix" class="uni-icon" :class="[item.setting.suffix]" @click="onEnterChange(item)"></text> </view> @@ -39,7 +40,8 @@ :type="col.name=='Input'?'text':'number'" v-model="col.value" :disabled="col.disabled" :placeholder="col.placeholder" :focus="focusFieldId == col.fieldId" @focus="ontap(col)" - @keyup.enter="onEnterChange(col)" @blur="onEnterChange(col)" /> + @click="onClick(col)" @keyup.enter="onEnterChange(col)" + @blur="onEnterChange(col)" /> <text v-if="col.setting.suffix" class="uni-icon" :class="[col.setting.suffix]" @click="onEnterChange(col)"></text> </view> @@ -444,7 +446,9 @@ }); }); }, - + onClick(item) { + this.focusFieldId = item.fieldId + }, ontap(item) { //鎵爜鍔熻兘 // var $ele = e; //console.log(e.target) @@ -528,6 +532,7 @@ } }) }, + onEnterChange(item) { //鍥炶溅锛岀偣鍑绘寜閽紝鍙栨秷鑺傜偣浜嬩欢 console.log(item); if (item.oldvalue != item.value) { @@ -736,7 +741,7 @@ // value = {"page_name":"鐮佺洏涓�, "row":{"id":"xx"}} var value = item.value; const pageData = $this.pageDetail.find((page) => { - return value.page_name == page.Name; + return value.page_name == page.Name; }); if (pageData?.DefList) { pageData.DefList.forEach(ele => { @@ -778,7 +783,7 @@ "remove_subtable_page_row") { //娓呴櫎闈㈡澘涓寚瀹歩d鐨勬暟鎹� var value = item.value; const pageData = $this.pageDetail.find((page) => { - return value.page_name == page.Name; + return value.page_name == page.Name; }); if (pageData ?.DefList diff --git a/pages/modal/5602.vue b/pages/modal/5602.vue index 670fc9c..fcb74fd 100644 --- a/pages/modal/5602.vue +++ b/pages/modal/5602.vue @@ -24,7 +24,7 @@ :type="item.name=='Input'?'text':'number'" v-model="item.value" :disabled="item.disabled" :placeholder="item.placeholder" :style="{'width':item.setting.prefix && item.setting.suffix?'78%':item.setting.prefix || item.setting.suffix?'87%':'96%'}" - :focus="focusFieldId == item.fieldId" @focus="ontap(index,item)" + :focus="focusFieldId == item.fieldId" @focus="ontap(index,item)" @click="onClick(item)" @keyup.enter="onEnterChange(item)" @blur="onEnterChange(item)" /> <text v-if="item.setting.suffix" class="uni-icon" :class="[item.setting.suffix]" @click="onEnterChange(item)"></text> @@ -493,7 +493,9 @@ }); }); }, - + onClick(item) { + this.focusFieldId = item.fieldId + }, ontap(index, item) { //鎵爜鍔熻兘 // var $ele = e; this.focusOldFieldId = item.fieldId @@ -516,21 +518,66 @@ if (onChangeEvent.id) { //鍐呭鍙樺寲鍚庝簨浠� $this.onChange(onChangeEvent); } - if (item.value) { //杈撳叆妗嗕笉涓虹┖ + if (item.value) { //绗竴涓緭鍏ユ涓嶄负绌� //鍒濆鍖栵紝涓嬩釜杈撳叆妗唂ocus灞炴� - const curIndex = $this.head_styledef.form.items.findIndex((ele, index2, arr) => { - return (ele.name == 'Input' || ele.name == 'InputNumber') && index2 > - index; - }) - if (curIndex > -1) { - $this.setData({ - focusFieldId: $this.head_styledef.form.items[curIndex].fieldId - }) + var findd = false + for (let i in $this.head_styledef.form.items) { + const ele = $this.head_styledef.form.items[i] + + if (ele.name != "Layout") { + if (ele.name == 'Input' || ele.name == 'InputNumber') { + if (attr == ele.fieldId) { + findd = true + } else { + if (findd) { + $this.setData({ + focusFieldId: ele.fieldId + }) + break + } + + } + + } + } else { + if (findd) { + let curIndex = ele.setting.colList.findIndex((col, index2, arr) => { + return (col.name == 'Input' || col.name == 'InputNumber'); + }) + if (curIndex > -1) { + $this.setData({ + focusFieldId: ele.setting.colList[curIndex] + .fieldId + }) + break + } + + } else { + let curIndex = ele.setting.colList.findIndex((col, index2, arr) => { + return attr == col.fieldId; + }) + if (curIndex > -1) { + findd = true + let curIndex2 = ele.setting.colList.findIndex((col, index2, arr) => { + return (col.name == 'Input' || col.name == + 'InputNumber') && + index2 > + curIndex; + }) + if (curIndex2 > -1) { + $this.setData({ + focusFieldId: ele.setting.colList[curIndex] + .fieldId + }) + break + } + } + } + + } } - // setTimeout(function(){ - // uni.hideKeyboard(); - // },1000); } + // if(onSuffixClickCallbackEvent.id){ //鍚庡浘鏍囩偣鍑讳簨浠� // this.onSuffixClick(onSuffixClickCallbackEvent); // } diff --git a/pages/modal/classAttr.vue b/pages/modal/classAttr.vue index ceb5356..8cde51b 100644 --- a/pages/modal/classAttr.vue +++ b/pages/modal/classAttr.vue @@ -1052,7 +1052,7 @@ ca.Value = ca.dictitem[d].CN_S_NAME; } } - if (utils.classUtils.attrTypeIsDate(ca.Type)) { + if (utils.classUtils.attrTypeIsDateTime(ca.Type)) { var nowDate = new Date(); var date = { year: nowDate.getFullYear(), diff --git a/pages/modal/ms_classAttr.vue b/pages/modal/ms_classAttr.vue index 822a007..e1c74dd 100644 --- a/pages/modal/ms_classAttr.vue +++ b/pages/modal/ms_classAttr.vue @@ -2005,7 +2005,7 @@ } } - if (utils.classUtils.attrTypeIsDate(ca.Type)) { + if (utils.classUtils.attrTypeIsDateTime(ca.Type)) { var nowDate = new Date(); var date = { year: nowDate.getFullYear(), @@ -2160,7 +2160,7 @@ ca.Value = ca.dictitem[d].CN_S_NAME; } } - if (utils.classUtils.attrTypeIsDate(ca.Type)) { + if (utils.classUtils.attrTypeIsDateTime(ca.Type)) { var nowDate = new Date(); var date = { year: nowDate.getFullYear(), diff --git a/pages/modal/small-wnd/index.vue b/pages/modal/small-wnd/index.vue new file mode 100644 index 0000000..3d67208 --- /dev/null +++ b/pages/modal/small-wnd/index.vue @@ -0,0 +1,2783 @@ +<template> + <view class="uni-page-modal-small-wnd"> + <view class="v-area" v-for="(classattr,index) in classAttrList"> + <div class="class_attr_title" style="display: none;"> + <div class="title_line"></div> + <div class="title_icon" :style="{'background-color':classattr.BkColor}"> + <i class="ace-icon fa" :class="classattr.ImgFontStyle"></i> + </div> + <span class="title">{{classattr.Name}}</span> + <a href="javascript:;" class="arrow" @tap="onarrow(index,classattr.Open)"><i class="ace-icon fa " + :class="classattr.Open?'fa-angle-down':'fa-angle-up'"></i></a> + </div> + <div class="class_attr_body" :style="{'display':classattr.Open?'block':'none'}"> + <div class="dv_field_div" v-for="(attr,iindex) in classattr.Attr"> + <view class="form-group" + v-if="attr.Type=='瀛楃涓� || attr.Type=='鍙彉闀垮瓧绗︿覆' || attr.Type=='鏁存暟' || attr.Type=='娴偣鏁� ||attr.Type=='char' || attr.Type=='varchar' || attr.Type=='int' || attr.Type=='float'" + :style="{'display':attr.hidden == true?'none':''}"> + <view v-if="classattr.control_style=='涓婁笅甯冨眬'"> + <text class="tx_title" :style="{'width':classattr.title_p_wdith+'%'}">{{attr.DispName}}:<i + class="i_tishi" v-if="attr.notempty==true">*</i></text> <!-- attr.NotEmpty=='1' --> + <div class="text-right" v-if="attr.ext_button==true"> + <a @tap="classAttr_extButton(index,iindex)"><i + class="ace-icon fa fa-plus-circle"></i></a> + </div> + <input + :type="attr.Type=='鏁存暟' || attr.Type=='娴偣鏁� || attr.Type=='int' || attr.Type=='float'?'number':'text'" + :value="attr.Value" @focus="ontap" @blur="onevent" v-if="attr.Height=='1'" + :data-index="index" :data-iindex="iindex" :style="{'width':attr.Width}" + :disabled="attr.edit?false:true"> + <!-- =='flase'?true:false --> + <textarea :value="attr.Value" @focus="ontap" @blur="onevent" v-else-if="attr.Height=='2'" + :data-index="index" :data-iindex="iindex" style="height:60px;" + :style="{'width':attr.Width}" :disabled="attr.edit?false:true"></textarea> + <textarea :value="attr.Value" @focus="ontap" @blur="onevent" v-else-if="attr.Height=='3'" + :data-index="index" :data-iindex="iindex" style="height:90px;" + :style="{'width':attr.Width}" :disabled="attr.edit?false:true"></textarea> + <!-- 鎵爜鍚庝簨浠惰繑鍥�--> + <div class="input_vallist"> + <ul v-for="(inputval,vindex) in inputValList"> + <li><span>{{inputval.Name}}</span><a href="javascript:;" + @tap="inputValListIsDel(vindex)"><i class="ace-icon fa fa-times"></i></a> + </li> + </ul> + </div> + </view> + <view v-if="classattr.control_style=='宸﹀彸甯冨眬'"> + <p class="tx_title2" :style="{'width':classattr.title_p_wdith+'%'}">{{attr.DispName}}:</p> + <input + :type="attr.Type=='鏁存暟' || attr.Type=='娴偣鏁� || attr.Type=='int' || attr.Type=='float' ?'number':'text'" + class="attr_field" :value="attr.Value" @focus="ontap" @blur="onevent" + v-if="attr.Height=='1'" :data-index="index" :data-iindex="iindex" + :style="{'width': attr.Width.split('%')[0] - classattr.title_p_wdith - (attr.notempty==true?10:5) - (attr.ext_button==true?9:0) +'%'}" + :disabled="attr.edit?false:true"> + <textarea class="attr_field" :value="attr.Value" @focus="ontap" @blur="onevent" + v-else-if="attr.Height=='2'" :data-index="index" :data-iindex="iindex" + style="height:60px;" + :style="{'width': attr.Width.split('%')[0] - classattr.title_p_wdith - (attr.notempty==true?10:5) - (attr.ext_button==true?9:0) +'%'}" + :disabled="attr.edit?false:true"></textarea> + <textarea class="attr_field" :value="attr.Value" @focus="ontap" @blur="onevent" + v-else-if="attr.Height=='3'" :data-index="index" :data-iindex="iindex" + style="height:90px;" + :style="{'width': attr.Width.split('%')[0] - classattr.title_p_wdith - (attr.notempty==true?10:5) - (attr.ext_button==true?9:0) +'%'}" + :disabled="attr.edit?false:true"></textarea> + <div class="text-right2" v-if="attr.ext_button==true"> + <a @tap="classAttr_extButton(index,iindex)"><i + class="ace-icon fa fa-plus-circle"></i></a> + </div> + <i class="i_tishi" v-if="attr.notempty==true">*</i> + </view> + </view> + <view class="form-group" v-if="attr.Type=='甯冨皵鍊� || attr.Type=='bool'" + :style="{'display':attr.hidden == true?'none':''}"> + <checkbox-group class="check_rememberPwd" @change="oncheck" :data-ischeck="attr.Value" + :data-index="index" :data-iindex="iindex" + :style="{'margin-left': classattr.control_style=='宸﹀彸甯冨眬'?classattr.title_p_wdith+2 +'%':'10rpx'}"> + <label> + <checkbox :value="attr.Value" :checked="attr.Value" /> + <text>{{attr.DispName}}<i class="i_tishi" v-if="attr.notempty==true">*</i></text> + </label> + </checkbox-group> + </view> + <view class="form-group" + v-if="attr.Type=='鏃ユ湡' || attr.Type=='鏃堕棿' || attr.Type=='date' || attr.Type=='datetime'" + :style="{'display':attr.hidden == true?'none':''}"> + <view v-if="classattr.control_style=='涓婁笅甯冨眬'"> + <text class="tx_title" :style="{'width':classattr.title_p_wdith+'%'}">{{attr.DispName}}:<i + class="i_tishi" v-if="attr.notempty==true">*</i></text> + <picker mode="date" :value="attr.Value" @change="ondateTime" class="date_iput" + :data-index="index" :data-iindex="iindex" :style="{'width':attr.Width}"> + <view class="picker">{{attr.Value}}</view> + </picker> + </view> + <view v-if="classattr.control_style=='宸﹀彸甯冨眬'"> + <p class="tx_title2" :style="{'width':classattr.title_p_wdith+'%'}">{{attr.DispName}}:</p> + <picker mode="date" :value="attr.Value" @change="ondateTime" class="date_iput attr_field" + :data-index="index" :data-iindex="iindex" + :style="{'width': attr.Width.split('%')[0] - classattr.title_p_wdith - (attr.notempty==true?10:5) +'%'}"> + <view class="picker">{{attr.Value}}</view> + </picker> + <i class="i_tishi" v-if="attr.notempty==true">*</i> + </view> + </view> + <view class="form-group" + v-if="attr.Type=='瀛楀吀' || attr.Type=='瀛楀吀-瀛楃涓� || attr.Type=='瀛楀吀-鏁存暟' || attr.Type=='dict' || attr.Type=='dict-char' || attr.Type=='dict-int'" + :style="{'display':attr.hidden == true?'none':''}"> + <view v-if="classattr.control_style=='涓婁笅甯冨眬'"> + <text class="tx_title">{{attr.DispName}}:<i class="i_tishi" + v-if="attr.notempty==true">*</i></text> + <picker class="section_iput" @change="onchange" :range="attr.dictitem" range-key="CN_S_NAME" + v-if="attr.select==false" :data-index="index" :data-iindex="iindex" + :style="{'width':attr.Width}" :disabled="attr.edit?false:true"> + <label class="">{{ attr.Value }}</label> + </picker> + <select-cy :value="attr.Value" :name="attr.Name" :options="attr.dictitem" + showClearIcon="true" @change="onchange2" v-else-if="attr.select==true" + :data-index="index" :data-iindex="iindex" :style="{'width':attr.Width}" + :disabled="attr.edit?false:true"></select-cy> + </view> + <view v-if="classattr.control_style=='宸﹀彸甯冨眬'"> + <p class="tx_title2" :style="{'width':classattr.title_p_wdith+'%'}">{{attr.DispName}}:</p> + <picker class="section_iput attr_field" @change="onchange" :range="attr.dictitem" + range-key="CN_S_NAME" v-if="attr.select==false" :data-index="index" + :data-iindex="iindex" + :style="{'width': attr.Width.split('%')[0] - classattr.title_p_wdith - (attr.notempty==true?10:5) +'%'}"> + <label class="">{{ attr.Value }}</label> + </picker> + <select-cy :value="attr.Value" :name="attr.Name" :options="attr.dictitem" + showClearIcon="true" @change="onchange2" v-else-if="attr.select==true" + :data-index="index" :data-iindex="iindex" + :style="{'display':'inline-block','margin-left':'8px','width':attr.Width.split('%')[0] - classattr.title_p_wdith - (attr.notempty==true?10:5) +'%'}"></select-cy> + <i class="i_tishi" v-if="attr.notempty==true">*</i> + </view> + </view> + <view class="form-group" + v-if="attr.Type=='寮曠敤瀵硅薄(鍗曚釜)' || attr.Type=='寮曠敤瀵硅薄(澶氫釜)' ||attr.Type=='obj-ref' || attr.Type=='obj-ref-multi'" + :style="{'display':attr.hidden == true?'none':''}"> + <view v-if="classattr.control_style=='涓婁笅甯冨眬'"> + <text class="tx_title">{{attr.DispName}}:<i class="i_tishi" + v-if="attr.notempty==true">*</i></text> + <div class="text-right" v-if="attr.Type=='寮曠敤瀵硅薄(鍗曚釜)'|| attr.Type=='obj-ref'"> + <a @tap="classAttr_AddRef" :data-classid="attr.RelCls[0].id" + :data-classname="attr.RelCls[0].name"><i class="ace-icon fa fa-plus-circle"></i></a> + </div> + <div class="text-right" v-if="attr.Type=='寮曠敤瀵硅薄(澶氫釜)'|| attr.Type=='obj-ref-multi'"> + <picker class="select" @change="classAttr_AddRef" :range="attr.RelClsList" + range-key="name" :data-index="index" :data-iindex="iindex"> + <label class="">{{ attr.Value }}</label> + </picker> + <a class="class_attr_add_ref"><i class="ace-icon fa fa-plus-circle"></i></a> + </div> + <input type="text" :data-index="index" :data-iindex="iindex" :style="{'width':attr.Width}" + disabled="true"> + </view> + <view v-if="classattr.control_style=='宸﹀彸甯冨眬'"> + <p class="tx_title2" :style="{'width':classattr.title_p_wdith+'%'}">{{attr.DispName}}:</p> + <input type="text" class="attr_field" :data-index="index" :data-iindex="iindex" + :style="{'width': attr.Width.split('%')[0] - classattr.title_p_wdith - (attr.notempty==true?10:5) - 9 +'%'}" + disabled="true"> + <div class="text-right2" v-if="attr.Type=='寮曠敤瀵硅薄(鍗曚釜)'|| attr.Type=='obj-ref'"> + <a @tap="classAttr_AddRef" :data-classid="attr.RelCls[0].id" + :data-classname="attr.RelCls[0].name"><i class="ace-icon fa fa-plus-circle"></i></a> + </div> + <div class="text-right2" v-if="attr.Type=='寮曠敤瀵硅薄(澶氫釜)'|| attr.Type=='obj-ref-multi'"> + <picker class="select" @change="classAttr_AddRef" :range="attr.RelClsList" + range-key="name" :data-index="index" :data-iindex="iindex"> + <label class="">{{ attr.Value }}</label> + </picker> + <a class="class_attr_add_ref"><i class="ace-icon fa fa-plus-circle"></i></a> + </div> + <i class="i_tishi" v-if="attr.notempty==true">*</i> + </view> + </view> + <view class="form-group" v-if="attr.Type=='寮曠敤浜哄憳' ||attr.Type=='user' " + :style="{'display':attr.hidden == true?'none':''}"> + <view v-if="classattr.control_style=='涓婁笅甯冨眬'"> + <text class="tx_title">{{attr.DispName}}:<i class="i_tishi" + v-if="attr.notempty==true">*</i></text> + <div class="text-right"> + <a class="class_attr_add_per" @tap="classAttr_AddPer(index,iindex)"><i + class="ace-icon fa fa-plus-circle"></i></a> + </div> + <input type="text" :value="attr.Value" :style="{'width':attr.Width}" disabled="true"> + </view> + <view v-if="classattr.control_style=='宸﹀彸甯冨眬'"> + <p class="tx_title2" :style="{'width':classattr.title_p_wdith+'%'}">{{attr.DispName}}:</p> + <input type="text" class="attr_field" :value="attr.Value" + :style="{'width': attr.Width.split('%')[0] - classattr.title_p_wdith - (attr.notempty==true?10:5) - 9 +'%'}" + disabled="true"> + <div class="text-right2"> + <a class="class_attr_add_per" @tap="classAttr_AddPer(index,iindex)"><i + class="ace-icon fa fa-plus-circle"></i></a> + </div> + <i class="i_tishi" v-if="attr.notempty==true">*</i> + </view> + </view> + <view class="form-group" v-if="attr.Type=='寮曠敤椤圭洰' ||attr.Type=='project'" + :style="{'display':attr.hidden == true ?'none':''}"> + <view v-if="classattr.control_style=='涓婁笅甯冨眬'"> + <text class="tx_title">{{attr.DispName}}:<i class="i_tishi" + v-if="attr.notempty==true">*</i></text> + <div class="text-right"> + <a href="#" class="class_attr_add_prj" @tap="classAttr_AddPrj(index,iindex)"><i + class="ace-icon fa fa-plus-circle"></i></a> + </div> + <input type="text" :value="attr.Value" :style="{'width':attr.Width}" disabled="true"> + </view> + <view v-if="classattr.control_style=='宸﹀彸甯冨眬'"> + <p class="tx_title2" :style="{'width':classattr.title_p_wdith+'%'}">{{attr.DispName}}:</p> + <input type="text" class="attr_field" :value="attr.Value" + :style="{'width': attr.Width.split('%')[0] - classattr.title_p_wdith - (attr.notempty==true?10:5) - 9 +'%'}" + disabled="true"> + <div class="text-right2"> + <a class="class_attr_add_prj" @tap="classAttr_AddPrj(index,iindex)"><i + class="ace-icon fa fa-plus-circle"></i></a> + </div> + <i class="i_tishi" v-if="attr.notempty==true">*</i> + </view> + </view> + <view class="form-group" v-if="attr.Type=='缂栫爜' || attr.Type=='code'" + :style="{'display':attr.hidden == true ?'none':''}"> + <view v-if="classattr.control_style=='涓婁笅甯冨眬'"> + <text class="tx_title">{{attr.DispName}}:<i class="i_tishi" + v-if="attr.notempty==true">*</i></text> + <input type="text" :data-index="index" :data-iindex="iindex" :style="{'width':attr.Width}" + :disabled="attr.edit?false:true"> + </view> + <view v-if="classattr.control_style=='宸﹀彸甯冨眬'"> + <p class="tx_title2" :style="{'width':classattr.title_p_wdith+'%'}">{{attr.DispName}}:</p> + <input type="text" class="attr_field" :data-index="index" :data-iindex="iindex" + :style="{'width': attr.Width.split('%')[0] - classattr.title_p_wdith - (attr.notempty==true?10:5) +'%'}" + :disabled="attr.edit?false:true"> + <i class="i_tishi" v-if="attr.notempty==true">*</i> + </view> + </view> + <view class="form-group" v-if="attr.Type=='鐪佸競鍖� ||attr.Type=='region'" + :style="{'display':attr.hidden == true?'none':''}"> + <view v-if="classattr.control_style=='涓婁笅甯冨眬'"> + <text class="tx_title">{{attr.DispName}}:<i class="i_tishi" + v-if="attr.notempty==true">*</i></text> + <pickerAddress class="date_iput" @change="addresschange" :data-index="index" + :data-iindex="iindex" :style="{'width':attr.Width}">{{attr.Value}}</pickerAddress> + </view> + <view v-if="classattr.control_style=='宸﹀彸甯冨眬'"> + <p class="tx_title2" :style="{'width':classattr.title_p_wdith+'%'}">{{attr.DispName}}:</p> + <pickerAddress class="date_iput attr_field" @change="addresschange" :data-index="index" + :data-iindex="iindex" + :style="{'width': attr.Width.split('%')[0] - classattr.title_p_wdith - (attr.notempty==true?10:5) +'%'}"> + {{attr.Value}} + </pickerAddress> + <i class="i_tishi" v-if="attr.notempty==true">*</i> + </view> + </view> + </div> + </div> + + </view> + <button type="default" @tap="cancel" class="btn_cancel">{{translateSys('cancel')}}</button> + <button type="default" @tap="sava" class="btn_add">{{title}}</button> + <!-- 鏅�寮圭獥 top bottom center left right --> + <view> + <uni-popup class="view-popup" ref="popup" background-color="#fff" @change="popupChange"> + <view class="popup-header">{{check_list.title}}</view> + <view class="popup-content" :class="{ 'popup-height': popupType === 'left' || popupType === 'right' }" + :style="{'width':check_list.width?check_list.width+'px':'200px','height':check_list.height?check_list.height+'px':'88%'}"> + <view class="popup-cont" :style="{'height':check_list.height?check_list.height-45+'px':'415px'}"> + <view class="view_popup_CheckList" v-for="(item,index) in check_list.items"> + <checkbox-group class="check_list" @change="checkChange" :data-ischeck="item.check" + :data-index="index" :style="{'margin-left': '10rpx'}"> + <label> + <checkbox :value="item.check" :checked="item.check" /> + <text>{{item.name}}</text> + </label> + </checkbox-group> + </view> + </view> + <view class="popup-footer"> + <button type="default" @tap="popup_sava" class="btn_popup_add">{{translateSys('ok')}}</button> + <button type="default" @tap="popup_cancel" + class="btn_popup_cancel">{{translateSys('cancel')}}</button> + </view> + </view> + </uni-popup> + </view> + <!-- <button class="button" type="primary" @click="classAttr_extButton('right')"><text class="button-text">鍙充晶</text></button> --> + + </view> +</template> + +<script> + import Base64 from '../../components/js-base64/base64.js' + import pickerAddress from '../../js/pickerAddress/pickerAddress.vue' + import utils from "@/js/utils.js" + export default { + name: "PageModalSmallWnd", + modules: { + Base64, + }, + components: { + pickerAddress + }, + onBackPress(e) { + // console.log("鐩戝惉杩斿洖鎸夐挳浜嬩欢",e); + if (this.type) { + var eventChannel = this.$scope.eventChannel; + // const eventChannel = this.getOpenerEventChannel(); + eventChannel.emit(this.type, ""); + } + }, + data() { + return { + title: this.translateSys('add2'), + style_def: {}, + show_style_list: [], + attrList: [], + param: {}, + dictList: [], + type: '', + classAttrList: [], + classGridStyle: [], + edit_inital_event: "", //寮圭獥鍒濆鍖栦簨浠禝D + edit_ok_event: "", //寮圭獥鐐瑰嚮OK 瑙﹀彂浜嬩欢ID + edit_select_compose_event: "", //閫夋嫨缁勬垚瀵硅薄鏃惰皟鐢�+ edit_compose_cls_id: "", + global_attr: [], + refdatastore: [], //寮曠敤鏁版嵁瀛樺偍鍖�/ {attr:'G_PRJ_' + bindattr + '_ID', value:info.id} + inputValList: [{ + Name: "test" + }, { + Name: "test2" + }, { + Name: "test3" + }, { + Name: "test4" + }, { + Name: "test5" + }, { + Name: "test6" + }, { + Name: "test7" + }], + popupType: "center", + check_list: {}, + popupParam: {}, + } + }, + computed: { + editMode() { + return !isNullOrEmpty(this.objId); + }, + }, + onLoad(options) { + // console.log(options); + this.title = options.titlename || (editMode ? this.translateSys('modify') : this.translateSys('add2') + param + .clsName); //璁剧疆鎸夐挳鏂囧瓧 + uni.setNavigationBarTitle({ + title: this.title + }); //璁剧疆椤堕儴鏍囬 + var param = JSON.parse(options.param); + + if (options.type) { + this.$data.type = options.type; + } + console.log(param); + if (!param.clsId) { + uni.showModal({ + title: this.translateSys('tip') + "", + content: this.translate("tip_no_master_class"), + showCancel: false, + confirmText: this.translateSys('cancel') + }); + return; + } + + this.$data.param = param; + this.loadData() + }, + methods: { + async loadData() { + + + // uistyle + await this.loadStyleDef(); + // show_style + this.loadShowStyle(); + // attrList + await this.loadAttrList(); + }, + async loadAttrList() { + var dataInfo = { + class_id: this.param.clsId, + class_name: this.param.clsName, + group_name: '' + }; + var $this = this; + + // console.log($this.$store.getters.getclassAttrList); + $this.$store.state.thisareaFuncID = this.param.clsId; + //鑾峰彇 + if ($this.$store.getters.getclassAttrList) { + $this.$data.attrList = $this.$store.getters.getclassAttrList; + } else { + $this.$store.dispatch('classAttrGetList', dataInfo).then(success => { + // console.log(success); + if (success.err_code == 0) { + $this.$data.attrList = success.result; + } + }).catch(ex => { + uni.showModal({ + title: this.translateSys('error') + " 1.1", + content: ex.errMsg, + showCancel: false, + confirmText: this.translateSys('cancel') + }) + }) + } + }, + async DictItemGetList(attr, name) { //Mobox3寰楀埌瀛楀吀椤瑰垪琛�+ this.data = []; + var $this = this; + var dataInfo = { + dict_id: undefined, + dict_name: name + }; + this.$store.dispatch('DictItemGetList', dataInfo).then(async (success) => { + // console.log(success); + if (success.err_code == 0) { + + let dicList = success.result?.dict_item_list || []; + $this.dictList[attr.attr] = dicList; + + let dictName = ""; + if (dicList?.length > 0) { + let defaultValue = dicList + .find( + (d) => d.is_default == + 1 + )?.name; + if (defaultValue) dictName = + defaultValue; + else dictName = dicList[0] + .name; + + } + this.form[attr.attr] = dictName; + } else { + uni.showModal({ + title: this.translateSys('error') + " 1.2", + content: success.err_msg, + showCancel: false, + confirmText: this.translateSys('cancel') + }); + } + }).catch(ex => { + // console.log(ex); + uni.showModal({ + title: this.translateSys('error') + " 1.3", + content: ex.errMsg, + showCancel: false, + confirmText: this.translateSys('cancel') + }); + }); + }, + async loadStyleDef() { + var $this = this; + + var gridstyleInfo = {}; + if (param.editDlg.id) { + gridstyleInfo = { + class_id: $this.param.clsId, + ui_style_id: this.param.editDlg.id, + }; + } else { + gridstyleInfo = { + class_id: $this.param.clsId, + ui_style_type: 2, + ui_style_name: $this.param.editDlg.name + }; + } + $this.$store.state.thisareaFuncID = this.param.clsId; + $this.$store.state.thisEditName = $this.$data.param.editDlg.name + // console.log($this.$store.getters.getclassGridStyleInfo); + //鑾峰彇 + if ($this.$store.getters.getclassGridStyleInfo) { + $this.$data.style_def = $this.$store.getters.getclassGridStyleInfo; + } else { + // console.log(gridstyleInfo); + $this.$store.dispatch('UIStyleGetInfo', gridstyleInfo).then(async (success) => { + // console.log(success); + if (success.err_code == 0) { + var styledef = Base64.decode(success.result.style_def); + $this.$data.style_def = JSON.parse(styledef); + } else { + uni.showModal({ + title: this.translateSys('error') + " 1.4", + content: success.err_msg, + showCancel: false, + confirmText: this.translateSys('cancel') + }); + } + }).catch(ex => { + console.log(ex); + uni.showModal({ + title: this.translateSys('error') + " 1.5", + content: ex.errMsg, + showCancel: false, + confirmText: this.translateSys('cancel') + }); + }); + } + }, + + async loadShowStyle() { + if (parseInt(this.style_def.lines) > 1) + this.show_style_list = this.style_def.show_style; + else if (this.style_def.show_style) + this.show_style_list = [{ + line: 1, + lineName: "", + attr_group: this.style_def.show_style, + }, ]; + else { + uni.showModal({ + title: this.translateSys('error'), + content: `鏁版嵁绫烩�${this.param.clsName}鈥濅腑鐨勫皬绐楀彛鈥�{this.param.editDlg.name}鈥濇湭瀹氫箟鈥滄樉绀烘牱寮忊�`, + showCancel: false, + confirmText: this.translateSys('cancel') + }); + + } + }, + async loadForm() { + this.form = {}; + this.errTip = {}; + + await Promise.all( + this.show_style_list.map(async (show_style) => { + await Promise.all( + show_style.map(async (group) => { + let group_def = this.attrList.find( + (a) => a.name == group.attrgroup_name + ); + group.def = { + bk_color: group_def.bk_color, + img_font_style: group_def.img_font_style || + "mobox-sys-mobox", + }; + await Promise.all( + group.attrs.map(async (attr) => { + let attr_def = group_def.attr_list.find( + (a) => a.name == attr.attr + ); + + // 鈥滃皬绐楀彛鈥濅腑鈥滄樉绀洪厤缃�鎸囧畾鐨勫睘鎬у湪褰撳墠鏁版嵁绫讳腑宸插彉鏇达紝鏃犳硶寰楀埌鐩稿簲鐨勫畾涔�+ if (!attr_def) { + uni.showModal({ + title: this.translateSys( + 'error'), + content: `褰撳墠鏁版嵁绫烩�${this.clsName}(${this.clsId})鈥濅腑鎵句笉鍒板悕涓衡�${attr.name}(${attr.attr})鈥濈殑灞炴�`, + showCancel: false, + confirmText: this + .translateSys('cancel') + }); + return; + } + attr.def = attr_def; + attr.type = this.getAttrType(show_style, + attr.def); + this.form[attr.attr] = this.defaultValue( + attr.type); + this.errTip[attr.attr] = ""; + if (attr.type == "select") { + if (attr.def.dict_name) { + let res = await dictInfo(attr, + attr.def + .dict_name); + let dicList = res.dict_item_list; + this.dicList[attr.attr] = dicList; + let dictName = ""; + if (dicList?.length > 0) { + let defaultValue = dicList + .find( + (d) => d.is_default == + 1 + )?.name; + if (defaultValue) dictName = + defaultValue; + else dictName = dicList[0] + .name; + } + this.form[attr.attr] = dictName; + } else { + this.dicList[attr.attr] = []; + this.form[attr.attr] = ""; + } + } + }) + ); + }) + ); + + }) + ); + + // this.opened = this.show_style + // .filter((a) => a.open) + // .map((a) => a.attrgroup_name); + + }, + async loadFormData() { + if (isNullOrEmpty(this.dataObj)) { + let obj = await getDataObjInfo({ + class_id: this.clsId, + obj_id: this.objId, + }); + this.show_style_list.forEach((show_style) => { + this.$refs[`line${show_style.line}`][0].loadFormData(obj); + }); + } else { + this.show_style_list.forEach((show_style) => { + this.$refs[`line${show_style.line}`][0].loadFormDataViaDataObj( + this.dataObj + ); + }); + } + }, + getAttrType(show_style, def) { + let type = def?.type; + let height = def?.height; + let ctrlType = ""; + show_style?.forEach((group) => { + ctrlType = group.attrs?.find((a) => a.attr == def.name)?.ctrl_type; + }); + + let guid = ["GUID"]; + let char = ["瀛楃涓�, "鍙彉闀垮瓧绗︿覆", "char", "varchar"]; + let select = ["瀛楀吀-瀛楃涓�, "瀛楀吀-鏁存暟", "dict-char", "dict-int"]; + let int = ["鏁存暟", "int"]; + let float = ["娴偣鏁�, "float"]; + let bool = ["甯冨皵鍊�, "bool"]; + let date = ["鏃ユ湡", "date"]; + let time = ["鏃堕棿", "datetime"]; + let refPsn = ["寮曠敤浜哄憳", "user"]; + + if (guid.includes(type) || char.includes(type)) + return ctrlType == "dropdown" ? + "select" : + height == 2 ? + "textarea" : + height == 3 ? + "textarea" : + "input"; + else if (select.includes(type)) return "select"; + else if (int.includes(type)) return "int"; + else if (float.includes(type)) return "float"; + else if (bool.includes(type)) return "checkbox"; + else if (date.includes(type)) return "date"; + else if (time.includes(type)) return "time"; + else if (refPsn.includes(type)) return "ref-psn"; + else return "unknown"; + }, + defaultValue(type) { + let value = undefined; + switch (type) { + case "input": + value = ""; + break; + case "select": + value = ""; + break; + case "int": + value = ""; + break; + case "float": + value = 0.0; + break; + case "checkbox": + value = false; + break; + case "date": + value = ""; + break; + case "time": + value = ""; + break; + case "ref-psn": + value = {}; + break; + } + return value; + }, + attrLabel(attr) { + if (attr.notempty || attr.def?.not_empty == 1) + return `${attr.name}锛堝繀濉級`; + else return attr.name; + }, + attrRequired(attr) { + if (attr.notempty || attr.def?.not_empty == 1) return true; + else return false; + }, + toHexColor(num) { + return `#${parseInt(num).toString(16)}`; + }, + reset() { + this.form = {}; + this.errTip = {}; + this.opened = []; + this.dicList = {}; + }, + viewParam() { //灏唌obox3灏忓啓鍙傛暟杞崲涓簃obox2澶у啓鍙傛暟 + var class_gridStyle = { + ID: this.$data.classGridStyle.id, + Name: this.$data.classGridStyle.name, + Type: this.$data.classGridStyle.type, + IsDefault: this.$data.classGridStyle.is_defaul, + StyleDef: this.$data.classGridStyle.style_def, + }; + this.$data.classGridStyle = class_gridStyle; + var class_attrList = []; + this.$data.classAttrList.forEach(data => { + var attrs = []; + if (data.attr_list) { + data.attr_list.forEach(attr => { + var dictitems = []; + if (attr.dictitem) { + attr.dictitem.forEach(dict => { + dictitems.push({ + ID: dict.id, + Name: dict.name, + Note: dict.note, + Order: dict.order, + ImgUrl: null, + Code: dict.code, + HasSub: null, + ParentID: null, + ParentName: null, + Lvl: dict.lvl, + IsDefault: dict.is_default, + Value: dict.value, + CN_G_ID: dict.id, + CN_G_DICT_ID: null, + CN_S_NAME: dict.name, + CN_S_NOTE: dict.note, + CN_N_ORDER: dict.order, + CN_S_IMG_URL: null, + CN_S_CODE: dict.code, + CN_C_HAS_SUB: null, + CN_G_PARENT_ITEM_ID: null, + CN_G_PARENT_ITEM_NAME: null, + CN_N_LVL: dict.lvl, + CN_C_IS_DEFAULT: dict.is_default, + CN_S_VALUE: dict.value + }); + }); + } + attrs.push({ + ID: attr.id, + Name: attr.name, + Type: attr.type, + Size: attr.size, + NotEmpty: attr.not_empty, + DefValue: attr.def_value, + Order: attr.order, + DictName: attr.dict_name, + DictID: attr.dict_id, + CodeDefName: attr.code_def_name, + CodeDefID: attr.code_def_id, + RelClsID: null, + RelCls: attr.ref_cls, + Width: attr.width, + Height: attr.height, + CtrlStyle: attr.ctrl_style, + HasAce: attr.has_ace, + CanShow: attr.can_show, + CanQuery: attr.can_query, + ReadOnly: attr.read_only, + IsKey: attr.is_key, + IsFixed: attr.is_fixed, + DispName: attr.disp_name, + LuaAttr: attr.lua_attr, + Desc: attr.desc, + ActionDef: attr.action_def ? Base64.decode(attr + .action_def) : '', + Multilingual: attr.multilingual, + RefCondition: attr.ref_condition, + GroupName: data.group, + Value: null, + dictitem: dictitems + }); + }); + } + class_attrList.push({ + Name: data.group, + Order: data.order, + HasAce: data.has_ace, + BkColor: data.bk_color, + ImgFontStyle: data.img_font_style, + Attr: attrs + }); + }); + this.$data.classAttrList = class_attrList; + // console.log(this.$data.classGridStyle); + // console.log(this.$data.classAttrList); + this.class_attr_init(); + }, + class_attr_init() { + var attrlist = this.$data.classGridStyle.StyleDef.show_style + var newattrlist = []; + if (this.$data.classAttrList.length > 0) { + for (var i = 0; i < attrlist.length; i++) { + var open = attrlist[i].open; + var name = attrlist[i].attrgroup_name; + var attrs = attrlist[i].attrs; + for (var s = 0; s < this.$data.classAttrList.length; s++) { + var clsattr = this.$data.classAttrList[s]; + // if (name == clsattr.Name) { + var attr = []; + for (var j = 0; j < attrs.length; j++) { + for (var l = 0; l < clsattr.Attr.length; l++) { + var ca = clsattr.Attr[l]; + if (attrs[j].attr == ca.Name) { + ca.action = attrs[j].action; + ca.edit = attrs[j].edit; + ca.notempty = attrs[j].notempty; + ca.ext_button = attrs[j].ext_button; + ca.button_img = attrs[j].button_img; + ca.button_tooltip = attrs[j].button_tooltip; + ca.before_click_button = attrs[j].before_click_button; + ca.button_callback = attrs[j].button_callback; + ca.hidden = attrs[j].hidden; + ca.select = attrs[j].select == undefined ? false : attrs[j].select; + ca.Value = ""; + if (ca.dictitem.length > 0) { + if (ca.select == true) + ca.Value = []; //ca.dictitem[0].CN_S_NAME; + else + ca.Value = '璇烽�鎷�; //ca.dictitem[0].CN_S_NAME; + var dictitemlist = []; + for (var d = 0; d < ca.dictitem.length; d++) { + ca.dictitem[d].label = ca.dictitem[d].CN_S_NAME; + ca.dictitem[d].value = ca.dictitem[d].CN_S_NAME; + ca.dictitem[d].attr = ca.Name; + if (ca.dictitem[d].CN_C_IS_DEFAULT == '1') + ca.Value = ca.dictitem[d].CN_S_NAME; + } + } + if (utils.classUtils.attrTypeIsDateTime(ca.Type)) { + var nowDate = new Date(); + var date = { + year: nowDate.getFullYear(), + month: nowDate.getMonth() + 1, + day: nowDate.getDate() + } + ca.Value = date.year + '-' + (date.month >= 10 ? date.month : '0' + + date + .month) + '-' + (date.day >= 10 ? date.day : '0' + date.day); + } + if (utils.classUtils.attrTypeIsObjRefMulti(ca.Type)) { + ca.RelClsList = ca.RelCls; + ca.Value = '璇�; + } + if (utils.classUtils.attrTypeIsRegion(ca.Type)) + ca.Value = '璇烽�鎷�; + if (utils.classUtils.attrTypeIsBool(ca.Type)) + ca.Value = false; + + attr.push(ca); + } + } + } + newattrlist.push({ + BkColor: clsattr.BkColor, + HasAce: clsattr.HasAce, + ImgFontStyle: clsattr.ImgFontStyle, + Name: clsattr.Name, + Order: clsattr.Order, + Open: open, + Attr: attr, + control_style: this.$data.classGridStyle.StyleDef.control_style, + title_p_wdith: this.$data.classGridStyle.StyleDef.title_p_wdith + }) + // } + } + } + if (newattrlist.length > 0) { + this.$data.classAttrList = newattrlist; + } + var req = []; + if (this.$data.classGridStyle.StyleDef) { + if (this.$data.classGridStyle.StyleDef.show_style.length > 0) { + var attrlist = this.$data.classGridStyle.StyleDef.show_style + // $el.find('.attr_field').prop('readonly', true); + // $el.find('.attr_field').prop('disabled', true); + for (var i = 0; i < attrlist.length; i++) { + var attr = attrlist[i].attrs + for (var j = 0; j < attr.length; j++) { + var ar = attr[j]; + req.push({ + attr: ar.attr, + val: ar.value ? ar.value : '' + }); + } + } + } + } + + var eventlist = this.$data.classGridStyle.StyleDef.event; + // console.log(eventlist); + if (eventlist) { + if (eventlist.length > 0) { + for (var i = 0; i < eventlist.length; i++) { + if (eventlist[i].event_id == 'before_ok') { + this.$data.edit_ok_event = eventlist[i]; + } else if (eventlist[i].event_id == 'initial') { + this.$data.edit_inital_event = eventlist[i]; + } else if (eventlist[i].event_id == 'before_select_compose') { + this.$data.edit_select_compose_event = eventlist[i].scrip_id; + this.$data.edit_compose_cls_id = eventlist[i].compose_cls_id; + } + } + } + } + // console.log(req); + if (this.$data.edit_inital_event) { + var eventid = this.$data.edit_inital_event.scrip_id; + var info = { + eventid: eventid, + edtype: "0", + projectid: '', + rclsid: '', + robjid: '', + userlogin: '', + clsid: this.$data.param.clsId, + objid: "", + attr: req, + } + this.ini_DataObjRunCustomEvent(info); + } + console.log(this.$data.classGridStyle); + console.log(this.$data.classAttrList); + + } else { + uni.showModal({ + title: this.translateSys('tip') + "", + content: "鏈壘鍒板彲鏄剧ず鐨勭殑灞炴�", + showCancel: false, + confirmText: this.translateSys('cancel') + }); + } + }, + + classAttr_extButton(index, iindex) { //寮规灞傛樉绀�type:top bottom center left right + var $this = this; + $this.$data.popupType = 'right' + // open 鏂规硶浼犲叆鍙傛暟 绛夊悓鍦�uni-popup 缁勪欢涓婄粦瀹�type灞炴� + $this.$refs.popup.open($this.popupType); + var data_attr = $this.$data.classAttrList[index].Attr[iindex]; + // var value = action.value; + // var action ={"action_type":"open_common_dlg","value":{"common_dlg_id":"check_list","config":{"title":"鐢熶骇宸ュ崟","appear_style":"sideslip","width":250,"multiple_choice":"1","items":[{"id":"133D50D7-D798-4D2E-A15F-308365092DF5","name":"5100691673", "check":false},{"id":"22992021-7D3B-4959-86B7-EF184B596AC6","name":"5100691674", "check":false},{"id":"48FBBE8E-594D-45D5-8C24-385C661C4A1C","name":"5100691675", "check":false},{"id":"4E429C60-325A-42ED-BEA3-B3397C07CCA1","name":"5100691668", "check":false}]}}} + // if (action.action_type == 'open_common_dlg') { + // var value = action.value; + // if(value.common_dlg_id == 'check_list'){ + // $this.$data.check_list= value.config; + // } + // } + // var popupParam={ + // index: index, + // iindex: iindex, + // button_callback:"", + // req:"", + // data_attr:data_attr + // } + // $this.$data.popupParam= popupParam; + // return; + var before_click_button = $this.$data.classAttrList[index].Attr[iindex].before_click_button; + var button_callback = $this.$data.classAttrList[index].Attr[iindex].button_callback; + if (!before_click_button) { + uni.showModal({ + title: this.translateSys('tip') + "", + content: "before_click_button-event_id涓虹┖锛�, + showCancel: false, + confirmText: this.translateSys('cancel') + }); + return; + } + if (!button_callback) { + uni.showModal({ + title: this.translateSys('tip') + "", + content: "button_callback-event_id涓虹┖锛�, + showCancel: false, + confirmText: this.translateSys('cancel') + }); + return; + } + this.DataObjRunCustomEvent_Return(before_click_button, data_attr, button_callback, index, iindex); + }, + popupChange(e) { + console.log('褰撳墠妯″紡锛� + e.type + ',鐘舵�锛� + e.show); + }, + checkChange(e) { //寮规check閫夋嫨 + // console.log(e.target.dataset); + var index = e.target.dataset.index; + var ischeck = e.target.dataset.ischeck; + var data = this.$data.check_list.items; + // this.$data.check_list.items=[]; + if (this.$data.check_list.multiple_choice == "0") { //鍒ゆ柇鏃跺崟閫夎繕鏄閫�+ for (var i in data) { + data[i].check = false; + } + } + data[index].check = ischeck ? false : true; + this.$data.check_list.items = data; + + }, + popup_cancel(e) { //寮规鍙栨秷 + this.$refs.popup.close(); + }, + popup_sava(e) { //寮规纭畾 + var $this = this; + var items = $this.$data.check_list.items; + var data = []; + var name = ""; + for (var i = 0; i < items.length; i++) { + if (items[i].check == true) { + if (name) + name += ';'; + name += items[i].name; + data.push({ + id: items[i].id, + name: items[i].name + }); + } + } + if (!$this.$data.popupParam) { + uni.showModal({ + title: this.translateSys('tip') + "", + content: "popupParam涓虹┖锛�, + showCancel: false, + confirmText: this.translateSys('cancel') + }); + return; + } + $this.$data.classAttrList[$this.$data.popupParam.index].Attr[$this.$data.popupParam.iindex].Value = + name; + console.log(data); + var callback_eventid = $this.$data.popupParam.button_callback.trim(); + var info = { + eventid: callback_eventid, + edtype: "0", + projectid: '', + rclsid: '', + robjid: '', + userlogin: '', + clsid: $this.$data.param.clsId, + objid: "", + attr: $this.$data.popupParam.req, + dataJson: data + } + $this.DataObjRunCustomEvent(info, $this.$data.popupParam.data_attr); + this.$refs.popup.close(); + }, + cancel(e) { + if (this.type) { + var eventChannel = this.$scope.eventChannel; + // const eventChannel = this.getOpenerEventChannel(); + eventChannel.emit(this.type, ""); + } + uni.navigateBack({ + delta: 1 //杩斿洖灞傛暟锛�鍒欎笂涓婇〉 + }); + }, + ontap(e) { //鎵爜鍔熻兘 + var $ele = e; + //console.log(e.target) + getApp().onScan((result) => { + console.log(result); + this.$data.classAttrList[e.target.dataset['index']].Attr[e.target.dataset['iindex']] + .Value = + result.decodedata; + uni.hideKeyboard(); + this.onevent($ele, result.decodedata); + }) + }, + onarrow(index, open) { + // console.log(index+'--'+open); + this.$data.classAttrList[index].Open = open == true ? false : true; + }, + ondateTime(e) { + //console.log(e.target) + this.$data.classAttrList[e.target.dataset['index']].Attr[e.target.dataset['iindex']].Value = e + .target + .value; + }, + onchange(e) { + // console.log(e.target); + var value = this.$data.classAttrList[e.target.dataset['index']].Attr[e.target.dataset['iindex']] + .dictitem[e + .target.value]; + var data_attr = this.$data.classAttrList[e.target.dataset['index']].Attr[e.target.dataset[ + 'iindex']]; + // console.log(data_attr); + if (value.Name != data_attr.Value) { + this.$data.classAttrList[e.target.dataset['index']].Attr[e.target.dataset['iindex']].Value = + value + .Name; + // console.log(this.$data.classAttrList[e.target.dataset['index']].Attr[e.target.dataset['iindex']].Value); + var eventid = this.$data.classAttrList[e.target.dataset['index']].Attr[e.target.dataset[ + 'iindex']] + .action; + if (eventid) { + // self.event_no_sub = 1; + var req = []; + var attrlist = this.$data.classAttrList; + for (var i = 0; i < attrlist.length; i++) { + var attr = attrlist[i].Attr; + for (var j = 0; j < attr.length; j++) { + var ar = attr[j]; + req.push(this.formatAttr(ar)) + + } + } + var info = { + eventid: eventid, + edtype: "0", + projectid: '', + rclsid: '', + robjid: '', + userlogin: '', + clsid: this.$data.param.clsId, + objid: "", + attr: req, + dataJson: [] + } + this.DataObjRunCustomEvent(info); + } + } + + }, + onchange2(item, value, delvalue) { + // console.log(item); + // console.log(value); + // console.log(delvalue); + //涓虹┖鏃讹紝娓呯┖灞炴�value + if (item.length == 0) { + var index, iindex, dindex = 0; + for (var i in this.$data.classAttrList) { + for (var j in this.$data.classAttrList[i].Attr) { + if (delvalue[0].attr == this.$data.classAttrList[i].Attr[j].Name) { + this.$data.classAttrList[i].Attr[j].Value = ""; + } + } + } + } + + for (var v in item) { + var index, iindex, dindex = 0; + for (var i in this.$data.classAttrList) { + for (var j in this.$data.classAttrList[i].Attr) { + if (item[v].attr == this.$data.classAttrList[i].Attr[j].Name) { + index = i; + iindex = j; + } + } + } + var itemvalue = item[v]; + var data_attr = this.$data.classAttrList[index].Attr[iindex]; + + // console.log(data_attr); + if (itemvalue.Name != data_attr.Value) { + this.$data.classAttrList[index].Attr[iindex].Value = value; + // console.log(this.$data.classAttrList[index].Attr[iindex].Value); + var eventid = this.$data.classAttrList[index].Attr[iindex].action; + if (eventid) { + // self.event_no_sub = 1; + var req = []; + var attrlist = this.$data.classAttrList; + for (var i = 0; i < attrlist.length; i++) { + var attr = attrlist[i].Attr; + for (var j = 0; j < attr.length; j++) { + var ar = attr[j]; + if (utils.classUtils.attrTypeIsDict(ar.Type)) + req.push({ + attr: ar.Name, + value: itemvalue.Name + }); + else + req.push(this.formatAttr(ar)) + } + } + var info = { + eventid: eventid, + edtype: "0", + projectid: '', + rclsid: '', + robjid: '', + userlogin: '', + clsid: this.$data.param.clsId, + objid: "", + attr: req, + dataJson: [], + } + this.DataObjRunCustomEvent(info); + } + } + } + + + }, + onevent(e, decodedata) { + // console.log(e.target); + var data_attr = this.$data.classAttrList[e.target.dataset['index']].Attr[e.target.dataset[ + 'iindex']]; + // console.log(decodedata); + if (e.target.value != data_attr.Value) { + this.$data.classAttrList[e.target.dataset['index']].Attr[e.target.dataset['iindex']].Value = + decodedata ? decodedata : e.target.value; + var eventid = this.$data.classAttrList[e.target.dataset['index']].Attr[e.target.dataset[ + 'iindex']] + .action; + if (eventid) { + // self.event_no_sub = 1; + var req = []; + var attrlist = this.$data.classAttrList; + for (var i = 0; i < attrlist.length; i++) { + var attr = attrlist[i].Attr; + for (var j = 0; j < attr.length; j++) { + var ar = attr[j]; + req.push(this.formatAttr(ar)) + } + } + var info = { + eventid: eventid, + edtype: "0", + projectid: '', + rclsid: '', + robjid: '', + userlogin: '', + clsid: this.$data.param.clsId, + objid: "", + attr: req, + dataJson: [], + } + this.DataObjRunCustomEvent(info, data_attr); + } + } + + }, + oncheck(e) { + // console.log(e.target); + var ischecked = e.target.dataset.ischeck ? false : true; + var data_attr = this.$data.classAttrList[e.target.dataset['index']].Attr[e.target.dataset[ + 'iindex']]; + // console.log(data_attr); + if (ischecked != data_attr.Value) { + this.$data.classAttrList[e.target.dataset['index']].Attr[e.target.dataset['iindex']].Value = + ischecked; + var eventid = this.$data.classAttrList[e.target.dataset['index']].Attr[e.target.dataset[ + 'iindex']] + .action; + if (eventid) { + // self.event_no_sub = 1; + var req = []; + var attrlist = this.$data.classAttrList; + for (var i = 0; i < attrlist.length; i++) { + var attr = attrlist[i].Attr; + for (var j = 0; j < attr.length; j++) { + var ar = attr[j]; + req.push(this.formatAttr(ar)) + } + } + var info = { + eventid: eventid, + edtype: "0", + projectid: '', + rclsid: '', + robjid: '', + userlogin: '', + clsid: this.$data.param.clsId, + objid: "", + attr: req, + dataJson: [], + } + this.DataObjRunCustomEvent(info); + } + } + + }, + inputValListIsDel(index) { + // console.log(index); + this.$data.inputValList.splice(index, 1); //鍒犻櫎tabPagejson鐨勫唴瀹�+ // console.log(this.$data.inputValList); + }, + addresschange(e) { + // console.log(e.target); + console.log(e.data.join(';')) + this.$data.classAttrList[e.target.dataset['index']].Attr[e.target.dataset['iindex']].Value = e.data + .join( + ';'); + }, + classAttr_AddPer(index, iindex) { + var param = { + index: index, + iindex: iindex + }; + var $this = this; + uni.navigateTo({ + url: '../selpsn/index?mulit=false¶m=' + JSON.stringify(param), + events: { + AddPer(data, param) { + // console.log(param); + console.log(data); + $this.$data.classAttrList[param.index].Attr[param.iindex].Value = data[0].Name; + $this.$data.classAttrList[param.index].Attr[param.iindex].ValID = data[0] + .Login + ';' + + data[0].Name; + + var eventid = $this.$data.classAttrList[param.index].Attr[param.iindex].action; + if (eventid) { + eventid = eventid.trim(); + if (eventid) { + var info = { + eventid: eventid, + edtype: "4", + projectid: "", + rclsid: "", + robjid: "", + userlogin: data[0].Login, + clsid: $this.$data.param.clsId, + objid: "", + attr: [], + dataJson: [], + } + + // var data_attr = $this.$data.classAttrList[param.index].Attr[param.iindex]; + $this.DataObjRunCustomEvent(info); + } + } + } + } + }); + }, + classAttr_AddRef(e) { + console.log(e.target); + uni.showModal({ + title: this.translateSys('tip') + "", + content: "姝ゅ姛鑳借繕鏈疄鐜帮紒", + showCancel: false, + confirmText: this.translateSys('cancel') + }); + // var value=this.$data.classAttrList[e.target.dataset['index']].Attr[e.target.dataset['iindex']].RelCls[e.target.value]; + // this.$data.classAttrList[e.target.dataset['index']].Attr[e.target.dataset['iindex']].Value=value; + }, + classAttr_AddPrj(index, iindex) { + var param = { + index: index, + iindex: iindex + }; + var $this = this; + uni.navigateTo({ + url: '../selPrj/index?relation=-1¶m=' + JSON.stringify(param), + events: { + AddPer(data, param) { + // console.log(param); + // console.log(data); + $this.$data.classAttrList[param.index].Attr[param.iindex].Value = data[0].Name; + $this.$data.classAttrList[param.index].Attr[param.iindex].ValID = data[0].ID + + ';' + + data[0].Name; + + var eventid = $this.$data.classAttrList[param.index].Attr[param.iindex].action; + if (eventid) { + eventid = eventid.trim(); + if (eventid) { + var info = { + eventid: eventid, + edtype: "2", + projectid: data[0].ID, + rclsid: "", + robjid: "", + userlogin: "", + clsid: $this.$data.param.clsId, + objid: "", + attr: [], + dataJson: [], + } + + // var data_attr = $this.$data.classAttrList[param.index].Attr[param.iindex]; + $this.DataObjRunCustomEvent(info); + } + } + } + } + }); + }, + //纭畾 + sava() { + if (this.$data.edit_ok_event) + this.OKDataObjRunCustomEvent(); + else + this.add(); + }, + add() { + uni.showLoading({ + title: "鍔犺浇涓�..", + mask: true + }); + var req = []; + var attrlist = this.$data.classAttrList; + for (var i = 0; i < attrlist.length; i++) { + var attr = attrlist[i].Attr; + for (var j = 0; j < attr.length; j++) { + var ar = attr[j]; + if (ar.Value == '璇烽�鎷� || ar.Value == '鈥斺�璇烽�鎷┾�鈥�) ar.Value = ''; + if (utils.classUtils.attrTypeIsDict(ar.Type)) { + if (ar.select == true) { //鍒ゆ柇涓嬫媺鏄惁澶氶� + var valStr = ""; + for (var v in ar.Value) { + if (valStr) + valStr += ";"; + valStr += ar.Value[v]; + } + req.push({ + name: ar.Name, + value: valStr + }); + } else + req.push({ + name: ar.Name, + value: ar.Value + }); + } else { + const node = this.formatAttr(ar) + req.push({ + name: node.attr, + value: node.value + }); + } + + + if (ar.notempty == true && !ar.Value) { + // if(ar.NotEmpty=='1'){ + uni.hideLoading(); + // uni.showToast({title:ar.DispName+'涓嶈兘涓虹┖锛�,icon:"success",duration:3000}); + uni.showModal({ + title: this.translateSys('tip') + "", + content: ar.DispName + '涓嶈兘涓虹┖锛�, + showCancel: false, + confirmText: this.translateSys('cancel') + }); + return; + } + } + } + var enviroment = { + 'function': '3000', // 鍔熻兘鐐圭紪鍙�+ cls_id: this.$data.param.clsId, // 鍔熻兘鐐逛富鏁版嵁绫绘爣璇�+ 'button': 'top', // top/bottom + button_name: '鏂板', + master: { + cls_id: this.$data.param.clsId, + } + }; + + enviroment = Base64.encode(JSON.stringify(enviroment)); //灏嗗瓧绗︿覆杞崲涓篵ase64缂栫爜 + var obj_attr = {}; + req.forEach(item => { + obj_attr[item.name] = item.value; + }); + // console.log(obj_attr); + // var dataInfo={ + // class_id: this.$data.param.clsId, data_obj_id: '', masterclsid: '', + // req: JSON.stringify(req), upfile: JSON.stringify([]), post_data: JSON.stringify({}), + // compose: JSON.stringify([]), refdatastore: JSON.stringify([]), extinfo: JSON.stringify(enviroment), + // not_trigger_sys_event: '' + // }; + var dataInfo = { + class_id: this.$data.param.clsId, + class_name: '', + master_cls_id: '', + master_obj_id: '', + creator: '', + creator_name: '', + not_trigger_event: '', + update_exist: '', + post_process: '', + ext_info: enviroment, + obj_attr: obj_attr + }; + console.log(dataInfo); + // return + this.$store.dispatch('createDataObj', dataInfo).then(success => { + console.log(success); + uni.hideLoading(); + if (success.err_code == 0) { + var result = success.result; + // if(result.result_type == 0){} + if (success.result.action) { + var action = JSON.parse(success.result.action); + console.log(action); + if (action.ret == '0') { + if (action.ret != 0) { + uni.showModal({ + title: this.translateSys('tip') + "", + content: '鎵ц鑴氭湰澶辫触锛� + action.result, + showCancel: false, + confirmText: this.translateSys('cancel') + }); + return; + } + if (action.info) { + uni.showModal({ + title: this.translateSys('tip') + "", + content: '鎵ц鑴氭湰澶辫触锛� + action.info, + showCancel: false, + confirmText: this.translateSys('cancel') + }); + return; + } + if (action.result_type == '0') { + uni.showToast({ + title: action.result, + icon: "success", + duration: 3000 + }); + } + + // "{"ret":0, "result_type":0, "result":"鍒涘缓鎴愬姛123123123","info":""}" + } + } else + uni.showToast({ + title: "鍒涘缓鎴愬姛锛�, + icon: "success", + duration: 3000 + }); + //鍒锋柊 + uni.redirectTo({ + url: '../modal/3018?param=' + JSON.stringify(this.$data.param) + + "&titlename=" + this.$data.title + }); + // this.cancel(); + } else { + uni.showModal({ + title: this.translateSys('error') + " ", + content: success.err_msg, + showCancel: false, + confirmText: this.translateSys('cancel') + }); + } + }).catch(ex => { + console.log(ex); + uni.hideLoading(); + uni.showModal({ + title: this.translateSys('tip') + "", + content: ex.errMsg, + showCancel: false, + confirmText: this.translateSys('cancel') + }); + }); + }, + ini_DataObjRunCustomEvent(info) { + var param = { + EditStyle: this.$data.param.editDlg.name, + ViewStyle: this.$data.param.editDlg.name, + NotTriggerSysEvent: 0, + enviroment: { + 'function': '3000', // 鍔熻兘鐐圭紪鍙�+ cls_id: this.$data.param.clsId, // 鍔熻兘鐐逛富鏁版嵁绫绘爣璇�+ 'button': 'top', // top/bottom + button_name: '鏂板', + master: { + cls_id: this.$data.param.clsId, // button=bottom鏃�master鐨刢ls_id + //obj_id: '' // button=bottom鏃�master鐨刼bj_id + } + } + } + var inputparameter = ''; + var global_attr = ''; + + param.enviroment = Base64.encode(JSON.stringify(param.enviroment)); //灏嗗瓧绗︿覆杞崲涓篵ase64缂栫爜 + var obj_attr = {}; + info.attr.forEach(item => { + obj_attr[item.attr] = item.val; + }); + // console.log(obj_attr); + // var dataInfo = { + // edtype: info.edtype, eventid: info.eventid, projectid: info.projectid, + // rclsid: info.rclsid, robjid: info.robjid, userlogin: info.userlogin, clsid: info.clsid, objid: info.objid, + // attr: JSON.stringify(info.attr), extinfo: JSON.stringify(param.enviroment), inputparameter: inputparameter, global_attr: global_attr + // } + if (!info.eventid.includes('{')) info.eventid = '{' + info.eventid + '}'; + var dataInfo = { + ed_type: info.edtype, + start_transaction: '', + class_id: info.clsid, + class_name: '', + event_id: info.eventid, + event_name: '', + data_obj_id: info.objid, + obj_attr: obj_attr, + prj_id: info.projectid, + ref_cls_id: info.rclsid, + rel_obj_id: info.robjid, + user_login: info.userlogin, + data_json: '', + compose_info: '', + ext_info: param.enviroment, + global_attr: global_attr, + input_param: inputparameter, + }; + console.log(dataInfo); + // return; + this.$store.dispatch('runCustomEvent', dataInfo).then(success => { + console.log(success); + if (success.err_code == 0) { + var data = success.result; + if (data.ret != 0) { + var tip = data.err_info ? typeof data.err_info == 'string' ? data.err_info : + data + .err_info.join('<br/>') : ''; + if (data.ret == 801) uni.showModal({ + title: this.translateSys('tip'), + content: tip, + showCancel: false, + confirmText: this.translateSys('cancel') + }); + else uni.showModal({ + title: this.translateSys('tip'), + content: tip + ',鎻愮ず:' + data.ret, + showCancel: false, + confirmText: this.translateSys('cancel') + }); + return false + } else { + var tip = data.info ? typeof data.info == 'string' ? data.info : data.info + .join( + '<br/>') : ''; + if (tip) uni.showModal({ + title: this.translateSys('tip'), + content: tip, + showCancel: false, + confirmText: this.translateSys('cancel') + }); + + if (data.action) { + var actionlist = data.action; + if (actionlist) { + for (var j = 0; j < actionlist.length; j++) { + var action = actionlist[j]; + var action_type = action.action_type; + var value = action.value; + if (action_type == 'set_dlg_attr') { + if (value) { + console.log(value); + for (var i = 0; i < value.length; i++) { + for (var a = 0; a < this.$data.classAttrList + .length; a++) { + for (var l = 0; l < this.$data.classAttrList[a] + .Attr + .length; l++) { + var ca = this.$data.classAttrList[a].Attr[l]; + if (value[i].attr == ca.Name) { + if (utils.classUtils.attrTypeIsDict(ca + .Type)) { + var dictItemList = []; + for (var d in value[i].choice_list) { + var list_val = value[i] + .choice_list[d]; + dictItemList.push({ + "CN_S_NAME": list_val, + "Name": list_val, + "label": list_val, + "value": list_val + }); + + } + ca.dictitem = dictItemList; + // attr[j].dictitem = val[i].choice_list; + } else { + ca.Value = value[i].value; + } + } + } + } + + var length = 0; + if (!this.$data.refdatastore.filter(function(s) { + return value[i].attr == s.attr + }).length) { + length = 1; + this.$data.refdatastore.push(value[i]); + } + if (length == 0) { + for (var j = 0; j < this.$data.refdatastore + .length; j++) { + if (this.$data.refdatastore[j].attr == value[i] + .attr) { + this.$data.refdatastore[j].value = value[i] + .value; + } + } + } + } + } + } + if (action_type == 'open_select_userdlg') { + uni.showModal({ + title: this.translateSys('error') + " 2.2", + content: "open_select_userdlg杩欎釜action_type杩樻湭澶勭悊锛�, + showCancel: false, + confirmText: this.translateSys('cancel') + }); + } + // else if (action_type == 'tip_dlg') { + + // } + } + } + } + } + } else { + uni.showModal({ + title: this.translateSys('error') + " 2", + content: success.err_msg, + showCancel: false, + confirmText: this.translateSys('cancel') + }); + } + }).catch(ex => { + // console.log(ex); + uni.showModal({ + title: this.translateSys('error') + " 2.1", + content: ex.errMsg, + showCancel: false, + confirmText: this.translateSys('cancel') + }); + }); + }, + DataObjRunCustomEvent(info, data_attr) { + var $this = this; + var enviroment = { + 'function': '3000', // 鍔熻兘鐐圭紪鍙�+ cls_id: this.$data.param.clsId, // 鍔熻兘鐐逛富鏁版嵁绫绘爣璇�+ 'button': 'top', // top/bottom + button_name: '鏂板', + master: { + cls_id: this.$data.param.clsId, // button=bottom鏃�master鐨刢ls_id + //obj_id: '' // button=bottom鏃�master鐨刼bj_id + } + }; + if (data_attr) { + enviroment.edit_dlg = { + type: 'small', //灏忕獥鍙�+ class_id: this.$data.param.clsId, //褰撳墠鏁版嵁绫籭d + } + if (data_attr) { + enviroment.edit_dlg.form_control = { //鎵�睘鐨勮〃鍗曟帶浠�+ name: data_attr.Name, //瀛楁灞炴� + text: data_attr.DispName, //鏄剧ず鏂囨湰 + group_name: data_attr.GroupName, //灞炴�缁�+ type: data_attr.Type, //瀛楁绫诲瀷 + readonly: data_attr.ReadOnly, //鏄惁鍙 + button_img: data_attr.button_img, //寮曠敤鎸夐挳鐨勫浘鏍�+ button_tooltip: data_attr.button_tooltip //寮曠敤鎸夐挳鐨則ooltip + } + } + } + + // var dataInfo = { + // edtype: info.edtype, eventid: info.eventid, projectid: info.projectid.replace('{','').replace('}',''), + // rclsid: info.rclsid, robjid: info.robjid, userlogin: info.userlogin, clsid: info.clsid, objid: info.objid, + // attr: JSON.stringify(info.attr), extinfo: JSON.stringify(enviroment), inputparameter: "", + // global_attr: JSON.stringify(this.$data.global_attr), dataJson:JSON.stringify(info.dataJson) + // } + enviroment = Base64.encode(JSON.stringify(enviroment)); //灏嗗瓧绗︿覆杞崲涓篵ase64缂栫爜 + var global_attr = Base64.encode(JSON.stringify(this.$data.global_attr)); //灏嗗瓧绗︿覆杞崲涓篵ase64缂栫爜 + if (info.dataJson) + info.dataJson = Base64.encode(JSON.stringify(info.dataJson)); //灏嗗瓧绗︿覆杞崲涓篵ase64缂栫爜 + var obj_attr = {}; + info.attr.forEach(item => { + obj_attr[item.attr] = item.val; + }); + if (!info.eventid.includes('{')) info.eventid = '{' + info.eventid + '}'; + var dataInfo = { + ed_type: info.edtype, + start_transaction: '', + class_id: info.clsid, + class_name: '', + event_id: info.eventid, + event_name: '', + data_obj_id: info.objid, + obj_attr: obj_attr, + prj_id: info.projectid, + ref_cls_id: info.rclsid, + rel_obj_id: info.robjid, + user_login: info.userlogin, + data_json: info.dataJson, + compose_info: '', + ext_info: enviroment, + global_attr: global_attr, + input_param: '', + }; + console.log(dataInfo); + // return; + this.$store.dispatch('runCustomEvent', dataInfo).then(success => { + console.log(success); + if (success.err_code == 0) { + var data = success.result; + if (data.ret != 0) { + var tip = data.err_info ? typeof data.err_info == 'string' ? data.err_info : + data + .err_info.join('<br/>') : ''; + if (data.ret == 801) uni.showModal({ + title: this.translateSys('tip'), + content: tip, + showCancel: false, + confirmText: this.translateSys('cancel') + }); + else uni.showModal({ + title: this.translateSys('tip'), + content: tip + ',鎻愮ず:' + data.ret, + showCancel: false, + confirmText: this.translateSys('cancel') + }); + return false + } else { + var tip = data.info ? typeof data.info == 'string' ? data.info : data.info + .join( + '<br/>') : ''; + if (tip) uni.showModal({ + title: this.translateSys('tip'), + content: tip, + showCancel: false, + confirmText: this.translateSys('cancel') + }); + + var actionlist = data.action; + if (actionlist) { + console.log(actionlist); + for (var i = 0; i < actionlist.length; i++) { + var action = actionlist[i]; + if (action.action_type == 'set_dlg_attr') { + var result = action.value; + for (var i = 0; i < result.length; i++) { + if (result[i].choice_list) { + for (var c = 0; c < $this.$data.classAttrList + .length; c++) { + var attr = $this.$data.classAttrList[c].Attr; + for (var j = 0; j < attr.length; j++) { + if (attr[j].Name == result[i].attr) { + if (utils.classUtils.attrTypeIsDict(attr[j] + .Type)) { + var dictItemList = []; + for (var d in result[i].choice_list) { + var val = result[i].choice_list[d]; + dictItemList.push({ + "CN_S_NAME": val, + "Name": val, + "label": val, + "value": val + }); + } + attr[j].dictitem = dictItemList; + // attr[j].dictitem = result[i].choice_list; + } + } + } + } + } + for (var c = 0; c < $this.$data.classAttrList.length; c++) { + var attr = $this.$data.classAttrList[c].Attr; + for (var j = 0; j < attr.length; j++) { + console.log(attr[j].Name + '==' + result[i].attr); + if (attr[j].Name == result[i].attr) { + attr[j].Value = result[i].value; + } + } + } + var length = 0; + if (!$this.$data.refdatastore.filter(function(s) { + return result[i].attr == s.attr + }).length) { + length = 1; + $this.$data.refdatastore.push(result[i]); + } + if (length == 0) { + for (var j = 0; j < $this.$data.refdatastore.length; j++) { + if ($this.$data.refdatastore[j].attr == result[i] + .attr) { + $this.$data.refdatastore[j].value = result[i] + .value; + } + } + } + } + } else if (data.action[i].action_type == 'set_global_attr') { + $this.$data.global_attr = data.action[i].value || []; + } + } + } + + if (data.result) { + var result = data.result; + for (var i = 0; i < result.length; i++) { + for (var c = 0; c < $this.$data.classAttrList.length; c++) { + var attr = $this.$data.classAttrList[c].Attr; + for (var j = 0; j < attr.length; j++) { + if (attr[j].Name == result[i].attr) { + attr[j].Value = result[i].value; + } + } + } + + var length = 0; + if (!$this.$data.refdatastore.filter(function(s) { + return result[i].attr == s.attr + }).length) { + length = 1; + $this.$data.refdatastore.push(result[i]); + } + if (length == 0) { + for (var j = 0; j < $this.$data.refdatastore.length; j++) { + if ($this.$data.refdatastore[j].attr == result[i].attr) { + $this.$data.refdatastore[j].value = result[i].value; + } + } + } + } + } + } + } else { + uni.showModal({ + title: this.translateSys('error') + " 3", + content: success.err_msg, + showCancel: false, + confirmText: this.translateSys('cancel') + }); + } + }).catch(ex => { + // console.log(ex); + uni.showModal({ + title: this.translateSys('error') + " 3.1", + content: ex.errMsg, + showCancel: false, + confirmText: this.translateSys('cancel') + }); + }); + }, + OKDataObjRunCustomEvent() { + var enviroment = { + 'function': '3000', // 鍔熻兘鐐圭紪鍙�+ cls_id: this.$data.param.clsId, // 鍔熻兘鐐逛富鏁版嵁绫绘爣璇�+ 'button': 'top', // top/bottom + button_name: '鏂板', + master: { + cls_id: this.$data.param.clsId, // button=bottom鏃�master鐨刢ls_id + + } + }; + var eventid = this.$data.edit_ok_event.scrip_id; + var req = []; + var attrlist = this.$data.classAttrList; + for (var i = 0; i < attrlist.length; i++) { + var attr = attrlist[i].Attr; + for (var j = 0; j < attr.length; j++) { + var ar = attr[j]; + if (ar.Value == '璇烽�鎷� || ar.Value == '鈥斺�璇烽�鎷┾�鈥�) ar.Value = ''; + req.push(this.formatAttr(ar)); + } + } + if (this.$data.refdatastore.length > 0) { + for (var i = 0; i < this.$data.refdatastore.length; i++) { + if (!req.filter(function(s) { + return this.$data.refdatastore[i].attr == s.name + }).length) { + length = 1; + req.push({ + 'attr': this.$data.refdatastore[i].attr, + 'val': this.$data.refdatastore[i].value + }); + } + } + } + var info = { + eventid: eventid, + edtype: "0", + projectid: '', + rclsid: '', + robjid: '', + userlogin: '', + clsid: this.$data.param.clsId, + objid: "", + attr: req, + } + // var dataInfo = { + // edtype: info.edtype, eventid: info.eventid, projectid: info.projectid,rclsid: info.rclsid, + // robjid: info.robjid, userlogin: info.userlogin, clsid: info.clsid, objid: info.objid, + // attr: JSON.stringify(info.attr), extinfo: JSON.stringify(enviroment), global_attr: JSON.stringify(this.$data.global_attr) + // } + + enviroment = Base64.encode(JSON.stringify(enviroment)); //灏嗗瓧绗︿覆杞崲涓篵ase64缂栫爜 + var global_attr = Base64.encode(JSON.stringify(this.$data.global_attr)); //灏嗗瓧绗︿覆杞崲涓篵ase64缂栫爜 + var obj_attr = {}; + info.attr.forEach(item => { + obj_attr[item.attr] = item.val; + }); + if (!eventid.includes('{')) eventid = '{' + eventid + '}'; + var dataInfo = { + ed_type: info.edtype, + start_transaction: '', + class_id: info.clsid, + class_name: '', + event_id: eventid, + event_name: '', + data_obj_id: info.objid, + obj_attr: obj_attr, + prj_id: info.projectid, + ref_cls_id: info.rclsid, + rel_obj_id: info.robjid, + user_login: info.userlogin, + data_json: '', + compose_info: '', + ext_info: enviroment, + global_attr: global_attr, + input_param: '', + }; + console.log(dataInfo); + // return; + this.$store.dispatch('runCustomEvent', dataInfo).then(success => { + console.log(success); + if (success.err_code == 0) { + var data = success.result; + if (data.ret != 0) { + var tip = data.err_info ? typeof data.err_info == 'string' ? data.err_info : + data + .err_info.join('<br/>') : ''; + if (data.ret == 801) uni.showModal({ + title: this.translateSys('tip'), + content: tip, + showCancel: false, + confirmText: this.translateSys('cancel') + }); + else uni.showModal({ + title: this.translateSys('tip'), + content: tip + ',鎻愮ず:' + data.ret, + showCancel: false, + confirmText: this.translateSys('cancel') + }); + return false + } else { + var tip = data.info ? typeof data.info == 'string' ? data.info : data.info + .join( + '<br/>') : ''; + if (tip) uni.showModal({ + title: this.translateSys('tip'), + content: tip, + showCancel: false, + confirmText: this.translateSys('cancel') + }); + + var result = data.result; + for (var i = 0; i < result.length; i++) { + // self.class_attr_ele.find('.attr_field[data-field="' + result[i].attr + '"]').val(result[i].value).data('val', result[i].value); + var length = 0; + if (!this.$data.refdatastore.filter(function(s) { + return result[i].attr == s.attr + }).length) { + length = 1; + this.$data.refdatastore.push(result[i]); + } + if (length == 0) { + for (var j = 0; j < this.$data.refdatastore.length; j++) { + if (this.$data.refdatastore[j].attr == result[i].attr) { + this.$data.refdatastore[j].value = result[i].value; + } + } + } + } + + this.add(); + } + } else { + uni.showModal({ + title: this.translateSys('error') + " 4", + content: success.err_msg, + showCancel: false, + confirmText: this.translateSys('cancel') + }); + } + }).catch(ex => { + // console.log(ex); + uni.showModal({ + title: this.translateSys('error') + " 4.1", + content: ex.errMsg, + showCancel: false, + confirmText: this.translateSys('cancel') + }); + }); + }, + DataObjRunCustomEvent_Return(eventid, data_attr, button_callback, index, iindex) { + var enviroment = { + 'function': '3000', // 鍔熻兘鐐圭紪鍙�+ cls_id: this.$data.param.clsId, // 鍔熻兘鐐逛富鏁版嵁绫绘爣璇�+ 'button': 'top', // top/bottom + button_name: '鏂板', + master: { + cls_id: this.$data.param.clsId, // button=bottom鏃�master鐨刢ls_id + //obj_id: '' // button=bottom鏃�master鐨刼bj_id + } + }; + var req = []; + var attrlist = this.$data.classAttrList; + for (var i = 0; i < attrlist.length; i++) { + var attr = attrlist[i].Attr; + for (var j = 0; j < attr.length; j++) { + var ar = attr[j]; + req.push(this.formatAttr(ar)) + } + } + if (this.$data.refdatastore.length > 0) { + for (var i = 0; i < this.$data.refdatastore.length; i++) { + if (!req.filter(function(s) { + return this.$data.refdatastore[i].attr == s.name + }).length) { + length = 1; + req.push({ + 'attr': this.$data.refdatastore[i].attr, + 'val': this.$data.refdatastore[i].value + }); + } + } + } + var extinfo = enviroment; + extinfo.edit_dlg = { + type: 'small', //灏忕獥鍙�+ class_id: this.$data.param.clsId, //褰撳墠鏁版嵁绫籭d + } + if (data_attr) { + extinfo.edit_dlg.form_control = { //鎵�睘鐨勮〃鍗曟帶浠�+ name: data_attr.Name, //瀛楁灞炴� + text: data_attr.DispName, //鏄剧ず鏂囨湰 + group_name: data_attr.GroupName, //灞炴�缁�+ type: data_attr.Type, //瀛楁绫诲瀷 + readonly: data_attr.ReadOnly, //鏄惁鍙 + button_img: data_attr.button_img, //寮曠敤鎸夐挳鐨勫浘鏍�+ button_tooltip: data_attr.button_tooltip //寮曠敤鎸夐挳鐨則ooltip + } + } + // var dataInfo = { + // edtype: "0", eventid: eventid, projectid: '',rclsid: '', robjid: '', userlogin: '', + // clsid: this.$data.param.clsId, objid: '',attr: JSON.stringify(req), + // extinfo: JSON.stringify(extinfo), global_attr: JSON.stringify(this.$data.global_attr) + // } + extinfo = Base64.encode(JSON.stringify(extinfo)); //灏嗗瓧绗︿覆杞崲涓篵ase64缂栫爜 + var global_attr = Base64.encode(JSON.stringify(this.$data.global_attr)); //灏嗗瓧绗︿覆杞崲涓篵ase64缂栫爜 + var obj_attr = {}; + req.forEach(item => { + obj_attr[item.attr] = item.val; + }); + if (!eventid.includes('{')) eventid = '{' + eventid + '}'; + var dataInfo = { + ed_type: "0", + start_transaction: '', + class_id: this.$data.param.clsId, + class_name: '', + event_id: eventid, + event_name: '', + data_obj_id: '', + obj_attr: obj_attr, + prj_id: '', + ref_cls_id: '', + rel_obj_id: '', + user_login: '', + data_json: '', + compose_info: '', + ext_info: extinfo, + global_attr: global_attr, + input_param: '', + }; + console.log(dataInfo); + // return; + this.$store.dispatch('runCustomEvent', dataInfo).then(success => { + console.log(success); + if (success.err_code == 0) { + var data = success.result; + if (data.ret != 0) { + var tip = data.err_info ? typeof data.err_info == 'string' ? data.err_info : + data + .err_info.join('<br/>') : ''; + if (data.ret == 801) uni.showModal({ + title: this.translateSys('tip'), + content: tip, + showCancel: false, + confirmText: this.translateSys('cancel') + }); + else uni.showModal({ + title: this.translateSys('tip'), + content: tip + ',鎻愮ず:' + data.ret, + showCancel: false, + confirmText: this.translateSys('cancel') + }); + return false + } else { + var tip = data.info ? typeof data.info == 'string' ? data.info : data.info + .join( + '<br/>') : ''; + if (tip) uni.showModal({ + title: this.translateSys('tip'), + content: tip, + showCancel: false, + confirmText: this.translateSys('cancel') + }); + + if (data != "") { + var actions = data.action; + console.log(actions); + if (actions) { + for (var i = 0; i < actions.length; i++) { + var action = actions[i]; + var val = action.value; + var enviroment = JSON.stringify(enviroment); + + if (action.action_type == 'open_panel') { + var d = dialog({ + title: '<i class="ace-icon fa fa-info-circle"></i> ' + + this.translateSys('tip'), + content: action.action_type + '姝ction灏氭湭澶勭悊锛� + }); + d.show(); + } else if (action.action_type == 'open_select_userdlg') { + var style = val.style; + // style == 'user' ? '閫夋嫨浜哄憳' : style == 'department' ? '閫夋嫨閮ㄩ棬' : style == 'role' ? '閫夋嫨瑙掕壊' : '' + var $this = this; + var param = { + index: index, + iindex: iindex, + button_callback: button_callback, + req: req, + data_attr: data_attr + } + uni.navigateTo({ + url: '../selpsn/index?mulit=false¶m=' + JSON + .stringify( + param), + events: { + AddPer(data, param) { + // console.log(param); + console.log(data); + var callback_eventid = param + .button_callback + .trim(); + var info = { + eventid: callback_eventid, + edtype: "0", + projectid: '', + rclsid: '', + robjid: '', + userlogin: '', + clsid: $this.$data.param.clsId, + objid: "", + attr: param.req, + inputparameter: data, + dataJson: [], + } + $this.DataObjRunCustomEvent(info, param + .data_attr); + } + } + }); + } else if (action.action_type == 'open_data_query_dlg') { + var d = dialog({ + title: '<i class="ace-icon fa fa-info-circle"></i> ' + + this.translateSys('tip'), + content: action.action_type + '姝ction灏氭湭澶勭悊锛� + }); + d.show(); + } else if (action.action_type == 'open_common_dlg') { + var $this = this; + if (val.common_dlg_id == 'check_list') { + $this.$data.check_list = val.config; + if (val.config.appear_style == 'sideslip') //鍒ゆ柇鏄惁鏄晶婊�+ $this.$data.popupType = 'right'; + else + $this.$data.popupType = 'center' + // open 鏂规硶浼犲叆鍙傛暟 绛夊悓鍦�uni-popup 缁勪欢涓婄粦瀹�type灞炴� + $this.$refs.popup.open($this.$data.popupType); + var popupParam = { + index: index, + iindex: iindex, + button_callback: button_callback, + req: req, + data_attr: data_attr + } + $this.$data.popupParam = popupParam; + } + } else if (action.action_type == 'open_project_query_dlg') { + //console.log(action.value.select_range); + //console.log(action.value.mulit_select); + var priRel = '-1'; + if (action.value.select_range == '鍏ㄩ儴鐩稿叧') + priRel = '0'; + else if (action.value.select_range == '鎴戣礋璐g殑椤圭洰') + priRel = '1'; + else if (action.value.select_range == '鎴戝垱寤虹殑') + priRel = '2'; + else if (action.value.select_range == '鎴戝弬涓庣殑' || action.value + .select_range == '鎴戝弬鍔犵殑') + priRel = '3'; + else if (action.value.select_range == '鎴戝叧娉ㄧ殑') + priRel = '4'; + else if (action.value.select_range == '鎴戜笅灞炵殑椤圭洰') + priRel = '5'; + + var $this = this; + var param_ = { + index: index, + iindex: iindex, + button_callback: button_callback, + req: req + } + uni.navigateTo({ + url: '../selPrj/index?relation=' + priRel + + '¶m=' + + JSON.stringify(param_), + events: { + AddPer(data, param) { + $this.$data.classAttrList[param.index] + .Attr[param + .iindex].Value = data[0].Name; + $this.$data.classAttrList[param.index] + .Attr[param + .iindex].ValID = data[0].ID + ';' + + data[0] + .Name; + var callback_eventid = param + .button_callback + .trim(); + if (callback_eventid) { + var info = { + eventid: callback_eventid, + edtype: "2", + projectid: data[0].ID, + rclsid: "", + robjid: "", + userlogin: "", + clsid: $this.$data.param.clsId, + objid: "", + attr: param.req, + dataJson: [], + } + + $this.DataObjRunCustomEvent(info); + } + } + } + }); + } else { + var d = dialog({ + title: '<i class="ace-icon fa fa-info-circle"></i> ' + + this.translateSys('tip'), + content: action.action_type + '姝ction灏氭湭澶勭悊锛� + }); + d.show(); + } + } + } + } else { + uni.showModal({ + title: this.translateSys('tip') + "5.2", + content: '璋冪敤 before_click_button 鑴氭湰杩斿洖绌猴紝event_id' + eventid, + showCancel: false, + confirmText: this.translateSys('cancel') + }); + } + } + } else { + uni.showModal({ + title: this.translateSys('error') + " 5", + content: success.err_msg, + showCancel: false, + confirmText: this.translateSys('cancel') + }); + } + }).catch(ex => { + // console.log(ex); + uni.showModal({ + title: this.translateSys('tip') + "5.1", + content: ex.errMsg, + showCancel: false, + confirmText: this.translateSys('cancel') + }); + }); + }, + + formatAttr(attr) { + if (utils.classUtils.attrTypeIsObjRefMulti(attr.Type)) //if(ar.Type=='寮曠敤瀵硅薄(澶氫釜)') + if (attr.Value == '璇�) ar.Value = ''; + if (utils.classUtils.attrTypeIsUser(attr.Type) || utils.classUtils.attrTypeIsProject(attr + .Type)) //if(ar.Type=='寮曠敤浜哄憳' || ar.Type=='寮曠敤椤圭洰') + return { + attr: attr.Name, + value: attr.ValID ? attr.ValID : '' + }; + else if (utils.classUtils.attrTypeIsBool(attr.Type)) //if(ar.Type=='甯冨皵鍊�) + return { + attr: attr.Name, + value: attr.Value ? '1' : '0' + }; + else + return { + attr: attr.Name, + value: attr.Value ? attr.Value : '' + }; + }, + translate(t) { + if (typeof this.$t == "function") return this.$t(`page.${t}`) + else return t; + }, + translateSys(t) { + if (typeof this.$t == "function") return this.$t(`sys.${t}`) + else return t; + }, + } + } +</script> +<style lang="less"> + .uni-page-modal-small-wnd { + + + .class_attr_title { + font-size: 44rpx; + padding-bottom: 22rpx; + position: relative; + } + + .class_attr_title .title_line { + border-bottom: 2rpx solid #aaa; + position: relative; + bottom: -50rpx; + width: calc(100% - 290rpx); + margin-left: 100px; + } + + .class_attr_title .title_icon { + border-radius: 50%; + width: 100rpx; + line-height: 64rpx; + display: inline-block; + vertical-align: middle; + padding-top: 10rpx; + padding-left: 20rpx; + text-align: center; + color: #fff; + } + + .class_attr_title i { + color: #2c6aa0 !important; + } + + .class_attr_title .title_icon i { + font-size: 80rpx; + } + + .class_attr_title .title { + padding-right: 22rpx; + display: inline-block; + background-color: #fff; + position: relative; + bottom: -8rpx; + } + + .class_attr_title .arrow { + position: absolute; + top: 6rpx; + right: 30rpx; + font-size: 60rpx; + } + + input::-webkit-input-placeholder { + font-size: 12rpx; + } + + textarea { + width: 98%; + border: 1px solid #d5d5d5; + padding: 10rpx 8rpx 12rpx; + background: #FFF; + border-radius: 0 !important; + font-size: 34rpx; + font-family: inherit; + box-shadow: none !important; + transition-duration: 0.1s; + color: #046db3; + margin-top: 4px; + } + + input { + border: 1px solid #d5d5d5; + width: 98%; + height: 52rpx; + background: #FFF; + border-radius: 0 !important; + color: #046db3; + padding: 10rpx 8rpx 12rpx; + font-size: 34rpx; + font-family: inherit; + box-shadow: none !important; + transition-duration: 0.1s; + margin-top: 4rpx; + } + + .select { + width: 20px; + position: absolute; + opacity: 0; + } + + .class_attr_body .form-group { + margin: 20rpx 30rpx; + /* margin-left: -12px; + margin-right: -12px; */ + } + + .form-group>label[class*="col-"] { + margin-bottom: 8rpx; + font-size: 32rpx; + } + + .form-group label { + vertical-align: middle; + line-height: 60rpx; + } + + .no-padding-right { + padding-right: 0 !important; + } + + .col-xs-12 { + width: 100%; + } + + .tx_title { + font-size: 32rpx; + } + + .tx_title2 { + font-size: 32rpx; + text-align: right; + display: inline-block; + vertical-align: -2px; + } + + .text-right { + margin-right: 20rpx; + margin-top: -6rpx; + display: inline-block; + float: right; + font-size: 48rpx; + } + + .text-right a, + .text-right2 a { + color: #337ab7; + } + + .text-right2 { + margin: 0; + vertical-align: -4px; + margin-left: 9px; + float: none; + font-size: 48rpx; + display: inline-block; + } + + .section_iput { + border: 1px solid #d5d5d5; + width: 98%; + height: 62rpx; + background: #FFF; + border-radius: 0 !important; + color: #046db3; + padding: 10rpx 8rpx 10rpx; + font-size: 34rpx; + font-family: inherit; + box-shadow: none !important; + transition-duration: 0.1s; + } + + .date_iput { + border: 1px solid #d5d5d5; + /* width: 98%; */ + height: 62rpx; + background: #FFF; + border-radius: 0 !important; + color: #046db3; + padding: 10rpx 8rpx 4rpx; + font-size: 34rpx; + font-family: inherit; + box-shadow: none !important; + transition-duration: 0.1s; + } + + button.btn_add { + width: 49.5%; + margin-top: 50rpx; + padding: 20rpx; + line-height: 1.5; + background: #27A6E1; + border: none; + color: #fff; + font-size: 38rpx; + font-weight: bold; + float: right; + display: inline-block; + } + + button.btn_cancel { + width: 49.5%; + margin-top: 50rpx; + padding: 20rpx; + line-height: 1.5; + background: #27A6E1; + border: none; + color: #fff; + font-size: 38rpx; + font-weight: bold; + float: left; + display: inline-block; + } + + .i_tishi { + color: red; + vertical-align: sub; + font-style: initial; + margin-left: 20rpx; + font-size: 17px; + } + + .attr_field { + display: inline-block; + vertical-align: middle; + margin-left: 8px; + /* width: 71%; */ + } + + .input_vallist { + max-height: 350rpx; + overflow-y: auto; + display: none; + } + + .input_vallist ul { + /* border: 1px solid red; */ + padding: 0 20rpx; + } + + .input_vallist ul li { + list-style: none; + padding: 20rpx; + border-bottom: 1px solid #ccc; + } + + .input_vallist ul li a { + float: right; + } + + .input_vallist ul li a i { + font-size: 45rpx; + } + + .view-popup { + position: relative; + } + + .popup-content { + @include flex; + align-items: center; + justify-content: center; + padding: 30rpx; + background-color: #fff; + /* height: 150px; */ + /* border: 1px solid red; */ + } + + .popup-cont { + overflow-y: auto; + /* border: 1px solid red; */ + } + + .popup-height { + @include height; + /* width: 200px; */ + } + + .popup-header { + font-size: 42rpx; + font-weight: bold; + margin: 20rpx 20rpx 0px 20rpx; + } + + .view_popup_CheckList { + margin-bottom: 20rpx; + } + + .popup-footer { + float: right; + position: absolute; + bottom: 0; + right: 20rpx; + } + + button.btn_popup_add { + width: 180rpx; + margin-top: 50rpx; + margin-right: 20rpx; + padding: 15rpx; + line-height: 1.5; + background: #27A6E1; + border: none; + color: #fff; + font-size: 38rpx; + font-weight: bold; + /* float: left; */ + display: inline-block; + } + + button.btn_popup_cancel { + width: 180rpx; + margin-top: 50rpx; + padding: 15rpx; + line-height: 1.5; + background: #27A6E1; + border: none; + color: #fff; + font-size: 38rpx; + font-weight: bold; + /* float: right; */ + display: inline-block; + } + + .touch-item { + background-color: #F8F9FC; + display: flex; + justify-content: space-between; + width: 100%; + overflow: hidden + } + + .itemcontent { + display: flex; + flex-direction: column; + padding: 5px 10px; + border-bottom: 1px solid #eeeeee; + margin-right: 0; + margin-left: -100px; + width: 100%; + -webkit-transition: all 0.4s; + transition: all 0.4s; + -webkit-transform: translateX(100px); + transform: translateX(100px); + position: relative; + } + + .itembtn { + width: 100px; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + background-color: #119bf8; + color: white; + position: relative; + -webkit-transform: translateX(100px); + transform: translateX(100px); + -webkit-transition: all 0.4s; + transition: all 0.4s; + } + + .touch-move-active .itemcontent, + .touch-move-active .itembtn { + -webkit-transform: translateX(0); + transform: translateX(0); + } + } +</style> \ No newline at end of file diff --git a/pages/modal/small-wnd/line.vue b/pages/modal/small-wnd/line.vue new file mode 100644 index 0000000..ee958d2 --- /dev/null +++ b/pages/modal/small-wnd/line.vue @@ -0,0 +1,595 @@ +<template> + <view class="uni-page-modal-small-wnd-line"> + + + + <uni-forms ref="baseForm" :modelValue="form" :label-position="control_style=='宸﹀彸甯冨眬' ? 'left':'top'" + :label-align="control_style=='宸﹀彸甯冨眬' ? 'right':'left'" :label-width="titleWdith"> + <view class="uni-group-item" v-for="(group,index) in show_style" :key="group.attrgroup_name"> + <view class="uni-panel-title" @click="group.open = !group.open"> + <text class="uni-title-icon" :style="{ backgroundColor: toHexColor(group.def?.bk_color) }"><text + class="uni-icon" :class="group.def?.img_font_style"></text></text> + <text class="uni-title-text">{{group.attrgroup_name}}</text> + <view class="uni-panel-icon-btn"> + <uni-icons color="#000" type="down" size="18" /> + </view> + </view> + <view v-if="group.open" class="uni-head-style" :class="hiddenAttrs.includes(attr.attr)? 'uni-hidden':''" + v-for="(attr,i) in group.attrs" :key="`attr-${index}-${i}`"> + <uni-forms-item :label="attrLabel(attr)" :required="attrRequired(attr)" :error="errTip[attr.attr]"> + <view class="input-wrapper"> + <input v-if="attr.type == 'input'" :ref="`ref${attr.attr}`" v-model="form[attr.attr]" + :ref="`ref${attr.attr}`" :disabled="!attr.edit" @on-blur="onChange(attr)" /> + <textarea v-else-if="attr.type == 'textarea'" :ref="`ref${attr.attr}`" + v-model="form[attr.attr]" :ref="`ref${attr.attr}`" :disabled="!attr.edit" + @on-blur="onChange(attr)" /> + <input v-else-if="attr.type == 'int'" :ref="`ref${attr.attr}`" v-model="form[attr.attr]" + type="number" :ref="`ref${attr.attr}`" :disabled="!attr.edit" + @on-blur="onChange(attr)" /> + <input v-else-if="attr.type == 'float'" :ref="`ref${attr.attr}`" v-model="form[attr.attr]" + type="digit" :ref="`ref${attr.attr}`" :disabled="!attr.edit" + @on-blur="onChange(attr)" /> + <div v-if="attr.ext_button==true&& (attr.type == 'input' ||attr.type == 'textarea'||attr.type == 'int'||attr.type == 'float') " + class="right-ext-btn"> + <a @tap="onClickExtButton(index,i)"><i class="ace-icon fa fa-plus-circle"></i></a> + </div> + + <switch v-else-if="attr.type == 'checkbox'" :ref="`ref${attr.attr}`" + :checked="form[attr.attr]" :ref="`ref${attr.attr}`" :disabled="!attr.edit" + @change="form[attr.attr]=checked"> + </switch> + <uni-data-select id="dv_select" v-if="attr.type == 'select'" :ref="`ref${attr.attr}`" + :class="attr.edit?'':'input-disabled'" v-model="form[attr.attr]" + :localdata="dictList[attr.attr]" @change="onChange(attr)" :disabled="!attr.edit" + clear></uni-data-select> + <picker v-else-if="attr.type == 'date'" :ref="`ref${attr.attr}`" mode="date" + style="width: 100%" :value="form[attr.attr]" :ref="`ref${attr.attr}`" + :disabled="!attr.edit" @change="form[attr.attr]=value" /> + <picker v-else-if="attr.type == 'time'" :ref="`ref${attr.attr}`" mode="time" + style="width: 100%" :value="form[attr.attr]" :ref="`ref${attr.attr}`" + :disabled="!attr.edit" @change="form[attr.attr]=value" /> + <textarea v-else-if="attr.type == 'ref-psn'" :ref="`ref${attr.attr}`" + :value="form[attr.attr]" :ref="`ref${attr.attr}`" disabled /> + <div v-if="attr.type == 'ref-psn'" class="right-ext-btn"> + <a @tap="onClickAddPsn(index,i)"><i class="ace-icon fa fa-plus-circle"></i></a> + </div> + <pickerAddress v-else-if="attr.type == 'region'" :ref="`ref${attr.attr}`" + @change="onAddressChange" :data-attr="attr.attr"> {{form[attr.attr]}} + </pickerAddress> + <div v-else-if="attr.type == 'ref-obj'"> + <a @tap="classAttr_AddRef" :data-classid="attr.RelCls[0].id" + :data-classname="attr.RelCls[0].name"><i class="ace-icon fa fa-plus-circle"></i></a> + </div> + <div v-else-if="attr.type == 'ref-obj-multi'"> + <picker class="select" @change="classAttr_AddRef" :range="attr.RelClsList" + range-key="name" :data-index="index" :data-iindex="iindex"> + <label class="">{{ attr.Value }}</label> + </picker> + <a class="class_attr_add_ref"><i class="ace-icon fa fa-plus-circle"></i></a> + </div> + + <textarea v-else-if="attr.type == 'ref-prj'" :ref="`ref${attr.attr}`" + :value="form[attr.attr]" :ref="`ref${attr.attr}`" disabled /> + <div v-if="attr.type == 'ref-prj'" class="right-ext-btn"> + <a @tap="onClickAddPrj(index,i)"><i class="ace-icon fa fa-plus-circle"></i></a> + </div> + <input v-if="attr.type == 'code'" :ref="`ref${attr.attr}`" v-model="form[attr.attr]" + :ref="`ref${attr.attr}`" :disabled="!attr.edit" /> + </view> + </uni-forms-item> + </view> + </view> + </uni-forms> + </view> +</template> + +<script> + import Base64 from '../../components/js-base64/base64.js' + import pickerAddress from '../../js/pickerAddress/pickerAddress.vue' + import utils from "@/js/utils.js" + export default { + name: "PageModalSmallWndLine", + inject: ["getFormAllAttrObj"], + components: { + pickerAddress + }, + props: { + clsId: { + type: String, + default: "" + }, + clsName: { + type: String, + default: "" + }, + show_style: { + type: Object, + default: {} + }, + attrList: { + type: Array, + default: [] + }, + control_style: { + type: String, + default: "" + }, + title_p_wdith: { + type: Number, + default: 0 + }, + + }, + data() { + return { + titleWdith: 100, + form: {}, + errTip: {}, + opened: [], + dictList: {}, + globalAttrs: [], + hiddenAttrs: [], + }; + }, + computed: { + formAttrObj() { + return this.getFormAllAttrObj(); + }, + initialEvent() { + let event = this.show_style.Event?.find((e) => e.event_id == "initial"); + return { + id: event?.scrip_id, + name: event?.scrip_name, + }; + }, + + + }, + mounted() { + uni.getSystemInfo({ + success: function(info) { + + // 浣犲彲浠ュ皢灞忓箷瀹藉害淇濆瓨鍦ㄤ竴涓彉閲忎腑渚涘悗缁娇鐢�+ if (this.control_style == '宸﹀彸甯冨眬') { + if (this.title_p_wdith > 0 && this.title_p_wdith < 100) { + this.titleWdith = this.title_p_wdith * info.windowWidth / 100 + } else { + this.titleWdith = 20 * info.windowWidth / 100 + } + } else { + this.titleWdith = info.windowWidth + } + console.log('灞忓箷瀹藉害锛屾爣棰樺搴�, info.windowWidth, this.titleWdith); + } + }); + }, + methods: { + isValid() { + let flag = true; + this.show_style.forEach((group) => { + group.attrs.forEach((attr) => { + let val = this.form[attr.attr]; + if (utils.classUtils.attrTypeIsDate(attr.def.type)) val = dayjs(val).format( + "YYYY-MM-DD"); + if (attr.def.not_empty == 1 && isNullOrEmpty(val)) { + this.errTip[attr.attr] = `${attr.name}${this.translate('cannot_empty')}`; + flag = false; + if (this.$refs[`ref${attr.attr}`][0].focus) + this.$refs[`ref${attr.attr}`][0].focus(); + else if (this.$refs[`ref${attr.attr}`][0].$el.focus) + this.$refs[`ref${attr.attr}`][0].$el.focus(); + } + }); + }); + return flag; + }, + async loadForm() { + this.form = {}; + this.errTip = {}; + + await Promise.all( + this.show_style.map(async (group) => { + let group_def = this.attrList.find( + (a) => a.name == group.attrgroup_name + ); + group.def = { + bk_color: group_def.bk_color, + img_font_style: group_def.img_font_style || "mobox-sys-mobox", + }; + await Promise.all( + group.attrs.map(async (attr) => { + let attr_def = group_def.attr_list.find( + (a) => a.name == attr.attr + ); + + // 鈥滃皬绐楀彛鈥濅腑鈥滄樉绀洪厤缃�鎸囧畾鐨勫睘鎬у湪褰撳墠鏁版嵁绫讳腑宸插彉鏇达紝鏃犳硶寰楀埌鐩稿簲鐨勫畾涔�+ if (!attr_def) { + this.showError( + `褰撳墠鏁版嵁绫烩�${this.clsName}(${this.clsId})鈥濅腑鎵句笉鍒板悕涓衡�${attr.name}(${attr.attr})鈥濈殑灞炴�` + ) + + return; + } + + attr.def = attr_def; + + attr.type = this.getAttrType(attr.def); + + this.form[attr.attr] = this.defaultValue(attr.type); + this.errTip[attr.attr] = ""; + + if (attr.type == "select") { + if (attr.def.dict_name) { + let res = await dictInfo(undefined, attr.def + .dict_name); + let dicList = res.dict_item_list; + this.dictList[attr.attr] = dicList; + let dictName = ""; + if (dicList?.length > 0) { + let defaultValue = dicList.find( + (d) => d.is_default == 1 + )?.name; + if (defaultValue) dictName = defaultValue; + else dictName = dicList[0].name; + } + this.form[attr.attr] = dictName; + } else { + this.dictList[attr.attr] = []; + this.form[attr.attr] = ""; + } + } + }) + ); + }) + ); + this.opened = this.show_style + .filter((a) => a.open) + .map((a) => a.attrgroup_name); + }, + async loadFormData(obj) { + this.show_style.forEach((group) => { + group.attrs.forEach((attr) => { + let info = obj.attr_list.find((o) => o.name == attr.attr); + if (info) { + if (attr.type == "ref-psn") + this.form[attr.attr] = { + id: info.value.split(";")[0], + name: info.value.split(";")[1], + type: 0, + }; + else this.form[attr.attr] = info.value; + } + }); + }); + }, + async loadFormDataViaDataObj(dataObj) { + this.show_style.forEach((group) => { + group.attrs.forEach((attr) => { + if (attr.attr in dataObj) this.form[attr.attr] = dataObj[attr.attr]; + }); + }); + }, + getAttrType(def) { + let type = def?.type; + let height = def?.height; + let ctrlType = ""; + this.show_style?.forEach((group) => { + ctrlType = group.attrs?.find((a) => a.attr == def.name)?.ctrl_type; + }); + if (utils.classUtils.attrTypeIsGuid(type) || utils.classUtils.attrTypeIsString(type)) + return ctrlType == "dropdown" ? + "select" : + height == 2 ? + "textarea" : + height == 3 ? + "textarea" : + "input"; + else if (utils.classUtils.attrTypeIsDict(type)) return "select"; + else if (utils.classUtils.attrTypeIsInt(type)) return "int"; + else if (utils.classUtils.attrTypeIsFloat(type)) return "float"; + + else if (utils.classUtils.attrTypeIsBool(type)) return "checkbox"; + else if (utils.classUtils.attrTypeIsDate(type)) return "date"; + else if (utils.classUtils.attrTypeIsTime(type)) return "time"; + else if (utils.classUtils.attrTypeIsUser(type)) return "ref-psn"; + else if (utils.classUtils.attrTypeIsRegion(type)) return "region"; + else if (utils.classUtils.attrTypeIsObjRefMulti(type)) return "ref-obj-multi"; + else if (utils.classUtils.attrTypeIsObjRef(type)) return "ref-obj"; + else if (utils.classUtils.attrTypeIsProject(type)) return "ref-prj"; + else if (utils.classUtils.attrTypeIsCode(type)) return "code"; + else return "unknown"; + }, + defaultValue(type) { + let value = undefined; + switch (type) { + case "input": + value = ""; + break; + case "select": + value = ""; + break; + case "int": + value = "0"; + break; + case "float": + value = "0.0"; + break; + case "checkbox": + value = false; + break; + case "date": + value = ""; + break; + case "time": + value = ""; + break; + case "region": + value = ""; + break; + case "ref-psn": + value = {}; + break; + case "ref-obj-multi": + value = []; + break; + case "ref-obj": + value = {}; + break; + case "ref-prj": + value = {}; + break; + case "code": + value = ""; + break; + + + } + return value; + }, + attrLabel(attr) { + if (attr.notempty || attr.def?.not_empty == 1) + return `${attr.name}锛�{this.translate('required')}锛塦; + else return attr.name; + }, + attrRequired(attr) { + if (attr.notempty || attr.def?.not_empty == 1) return true; + else return false; + }, + toHexColor(num) { + return `#${parseInt(num).toString(16)}`; + }, + reset() { + this.form = {}; + this.errTip = {}; + this.opened = []; + this.dictList = {}; + }, + clearTip() { + Object.keys(this.errTip).forEach((k) => { + this.errTip[k] = ""; + }); + }, + clearData() { + Object.keys(this.form).forEach((k) => { + this.form[k] = ""; + }); + }, + onAddressChange(e) { + console.log(e.data.join(';')) + this.form[e.target.dataset['attr']] = e.data + .join( + ';'); + }, + async onChange(attr) { + if (!this.form[attr.attr]) return; + let action = attr.action; + if (!action) return; + if (action[0] != "{" && action[action.length - 1] != "}") + action = `{${action}}`; + let extInfo = { + ...this.enviroment, + }; + try { + lua( + this, + await runCustomEvent({ + ed_type: 0, + class_id: this.clsId, + event_id: action, + obj_attr: this.formAttrObj, + ext_info: Base64.encode(JSON.stringify(extInfo)), + }) + ); + } catch (ex) { + this.showError(ex); + } + }, + onClickExtButton(gindex, index) {}, + onClickAddPsn(gindex, index) {}, + onClickAddPrj(gindex, index) {}, + + findAttrDef(attr) { + let def; + this.show_style.forEach((group) => { + let r = group.attrs.find((a) => a.attr == attr); + if (r) def = r; + }); + return def; + }, + setFormValues(attrs) { + attrs.forEach((attr) => { + if (attr.attr in this.form) { + this.form[attr.attr] = attr.value; + if (attr.choice_list) { + // 鍏堝垽鏂槸鍚︽槸瀛楀吀绫诲瀷 + let type = this.getAttrType(this.findAttrDef(attr.attr)?.def); + if (type == "select") + if (attr.choice_list) + this.dictList[attr.attr] = attr.choice_list.map((name) => ({ + name, + })); + } + } + }); + }, + hideFormItems(attrs) { + let attrList = []; + this.show_style.forEach((group) => attrList.push(...group.attrs)); + this.hiddenAttrs = [ + ...attrList.filter((a) => a.hidden === true).map((a) => a.attr), + ...attrs + .filter((attr) => attr.attr in this.form && attr.show === false) + .map((attr) => attr.attr), + ]; + }, + setFormAllValues(attrs) { + this.$emit("on-set-all-value", attrs); + }, + showError(ex) { + uni.showModal({ + title: this.translateSys('error') + " 1.1", + content: typeof ex == "string" ? ex : typeof ex.errMsg == "string" ? ex.errMsg : "", + showCancel: false, + confirmText: this.translateSys('cancel') + }) + }, + translate(t) { + if (typeof this.$t == "function") return this.$t(`page.${t}`) + else return t; + }, + translateSys(t) { + if (typeof this.$t == "function") return this.$t(`sys.${t}`) + else return t; + }, + }, + } +</script> + + +<style lang="less"> + .uni-page-modal-small-wnd-line { + width: 100%; + display: flex; + flex-direction: column; + + .uni-group-item { + border-radius: 8px; + background-color: #fff; + margin: 5px; + padding-bottom: 5px; + + } + + .uni-select { + border: 0; + } + + .uni-panel-title { + display: flex; + width: calc(100% - 10rpx); + flex-direction: row; + } + + + .input-wrapper:hover { + border: 1px solid rgb(41, 121, 255); + } + + .uni-title-icon { + background-color: #ffdd00; + border-radius: 50%; + width: 36px; + height: 36px; + margin: 5px; + margin-right: 12px; + display: inline-block; + vertical-align: middle; + text-align: center; + line-height: 40px; + + .uni-icon { + color: #fff; + font-size: 20px + } + + } + + .uni-title-text { + flex: 1; + font-weight: 600; + line-height: 45px; + } + + .uni-panel-icon-btn { + font-size: 18px; + padding: 8px; + margin-top: 5px; + // height: 36px; + // width: 36px; + + } + + .uni-panel-text { + flex: 1; + color: #000000; + font-weight: normal; + } + + .uni-head-style { + display: flex; + flex-direction: column; + width: calc(100% - 30rpx); + padding: 15rpx; + } + + .uni-head-style input { + width: calc(100% - 20rpx); + height: 52rpx; + line-height: 34rpx; + background: #FFF; + border-radius: 0 !important; + color: #2d8cf0; + padding: 10rpx 10rpx 12rpx; + font-size: 34rpx; + font-family: inherit; + box-shadow: none !important; + transition-duration: 0.1s; + margin-top: 4rpx; + } + + .input-disabled { + background-color: #f3f3f3 !important; + } + + .uni-hidden { + display: none; + } + + + .input-wrapper { + border: 1px solid #d5d5d5; + width: 100%; + display: flex; + flex-direction: row; + + .uni-textarea, + .uni-input { + flex: 1; + padding: 12rpx 8rpx; + // height: 40rpx; + // line-height: 40rpx; + } + + .uni-icon { + padding: 8rpx; + font-size: 32rpx; + color: rgb(192, 196, 204); + } + + .right-ext-btn { + margin: 5rpx 10rpx 5rpx 5rpx; + } + + } + } +</style> \ No newline at end of file -- Gitblit v1.9.1