From 0df15ed47f6e2aa5eb0610890bed7dcbaabc7c92 Mon Sep 17 00:00:00 2001 From: cuiqian2004 <cuiqian2004@163.com> Date: 星期四, 11 七月 2024 17:32:07 +0800 Subject: [PATCH] test --- pages/modal/3018.vue | 208 +++++++++++++++++++++++++++------------------------- 1 files changed, 108 insertions(+), 100 deletions(-) diff --git a/pages/modal/3018.vue b/pages/modal/3018.vue index 43d0dd5..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> @@ -288,7 +288,7 @@ <script> import Base64 from '../../components/js-base64/base64.js' import pickerAddress from '../../js/pickerAddress/pickerAddress.vue' - import classUtils from "@/js/utils.js" + import utils from "@/js/utils.js" export default { modules: { Base64, @@ -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; } @@ -390,7 +390,7 @@ $this.$data.classAttrList = success.result; success.result.forEach(async (group, index) => { group.attr_list.forEach(async (attr, key) => { - if (classUtils.attrTypeIsDict((attr.type)) { + if (utils.classUtils.attrTypeIsDict((attr.type)) { await $this.DictItemGetList(attr, key, index); } }); @@ -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(classUtils.attrTypeIsDate(ca.Type)){ + if(utils.classUtils.attrTypeIsDateTime(ca.Type)){ var nowDate = new Date(); var date = { year: nowDate.getFullYear(), @@ -639,13 +639,13 @@ ca.Value = date.year + '-' + (date.month >= 10 ? date.month : '0' + date .month) + '-' + (date.day >= 10 ? date.day : '0' + date.day); } - if (classUtils.attrTypeIsObjRefMulti(ca.Type)) { + if (utils.classUtils.attrTypeIsObjRefMulti(ca.Type)) { ca.RelClsList = ca.RelCls; ca.Value = '璇�; } - if(classUtils.attrTypeIsRegion(ca.Type)) + if(utils.classUtils.attrTypeIsRegion(ca.Type)) ca.Value = '璇烽�鎷�; - if (classUtils.attrTypeIsBool(ca.Type)) + if (utils.classUtils.attrTypeIsBool(ca.Type)) ca.Value = false; attr.push(ca); @@ -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; } @@ -955,7 +955,7 @@ var attr = attrlist[i].Attr; for (var j = 0; j < attr.length; j++) { var ar = attr[j]; - if (classUtils.attrTypeIsDict(ar.Type)) + if (utils.classUtils.attrTypeIsDict(ar.Type)) req.push({ attr: ar.Name, value: itemvalue.Name @@ -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; @@ -1180,7 +1180,7 @@ for (var j = 0; j < attr.length; j++) { var ar = attr[j]; if (ar.Value == '璇烽�鎷� || ar.Value == '鈥斺�璇烽�鎷┾�鈥�) ar.Value = ''; - if (classUtils.attrTypeIsDict(ar.Type)) { + if (utils.classUtils.attrTypeIsDict(ar.Type)) { if (ar.select == true) { //鍒ゆ柇涓嬫媺鏄惁澶氶� var valStr = ""; for (var v in ar.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) { @@ -1425,7 +1425,7 @@ .length; l++) { var ca = this.$data.classAttrList[a].Attr[l]; if (value[i].attr == ca.Name) { - if (classUtils.attrTypeIsDict(ca.Type)) { + if (utils.classUtils.attrTypeIsDict(ca.Type)) { var dictItemList = []; for (var d in value[i].choice_list) { var list_val = value[i].choice_list[d]; @@ -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; @@ -1605,7 +1605,7 @@ var attr = $this.$data.classAttrList[c].Attr; for (var j = 0; j < attr.length; j++) { if (attr[j].Name == result[i].attr) { - if (classUtils.attrTypeIsDict(attr[j].Type)) { + if (utils.classUtils.attrTypeIsDict(attr[j].Type)) { var dictItemList = []; for (var d in result[i].choice_list) { var val = result[i].choice_list[d]; @@ -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,42 +2108,42 @@ } } 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') }); }); }, formatAttr(attr) { - if (classUtils.attrTypeIsObjRefMulti(attr.Type)) //if(ar.Type=='寮曠敤瀵硅薄(澶氫釜)') + if (utils.classUtils.attrTypeIsObjRefMulti(attr.Type)) //if(ar.Type=='寮曠敤瀵硅薄(澶氫釜)') if (attr.Value == '璇�) ar.Value = ''; - if (classUtils.attrTypeIsUser(attr.Type) || classUtils.attrTypeIsProject(attr + 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 (classUtils.attrTypeIsBool(attr.Type)) //if(ar.Type=='甯冨皵鍊�) + else if (utils.classUtils.attrTypeIsBool(attr.Type)) //if(ar.Type=='甯冨皵鍊�) return { attr: attr.Name, value: attr.Value ? '1' : '0' @@ -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> -- Gitblit v1.9.1