<template> <div v-if="isShowBtn" class="btn btn-primary btn-type" :disabled='info.readonly' :title="info.name" :style="{ boxShadow: '1px 2px 6px 0px #D9E5FF', background: activeColor.bg ? activeColor.bg : '', borderColor: activeColor.bd ? activeColor.bd : '', color: activeColor.fc ? activeColor.fc : '', opacity: isBlockClick ? '0.8' : '1' }" autobuild="false" @click="onClick(info.readonly)"> <i v-if="info.icon && JSON.parse(info.icon).type == 'font'" :class="[info.icon ? JSON.parse(info.icon).icon : '']" /> <i v-else-if="info.icon && JSON.parse(info.icon).type == 'img'" :class="[info.icon ? JSON.parse(info.icon).icon : '']" height="14"> <img style="height:14px;" :src="path + JSON.parse(info.icon).icon" /> </i> <i v-else :class="activeColor.btnIcon ? activeColor.btnIcon : ''"></i> {{ info.name }} <!-- {{info.type}} --> </div> </template> <script> // import { constants } from 'crypto'; export default { props: [ "info", "isBlockClick" ], data: function () { return { path: window.location.origin + '/obpm/uploads/lib/icon', isShowBtn: true,//鏄惁鏄剧ず鎸夐挳 } }, computed: { activeColor() { let data = { bg: '', //鑳屾櫙鑹� btnIcon: '', //鍥炬爣 bd: '' //杈规棰滆壊 } let currentColor = ''; if (this.info.colorType) { // warning success danger primary info default 涓鸿鍥炬寜閽殑棰滆壊 if (this.info.colorType == 'warning') { currentColor = "#ec971f"; } else if (this.info.colorType == "success") { currentColor = "#449d44"; } else if (this.info.colorType == "danger") { currentColor = "#d9534e"; } else if (this.info.colorType == "primary") { currentColor = "#337ab7"; } else if (this.info.colorType == "info") { currentColor = "#5bc0de"; } else if (this.info.colorType == "default") { currentColor = ""; } else { currentColor = this.info.colorType; } } switch (this.info.type) { case 1: //杞藉叆瑙嗗浘 data = { bg: currentColor ? currentColor : '#337ab7', btnIcon: 'queryBtnicon', bd: currentColor ? currentColor : '#337ab7', }; return data; case 2: //鍒涘缓 data = { bg: currentColor ? currentColor : '#337ab7', btnIcon: 'createBtnicon', bd: currentColor ? currentColor : '#337ab7', }; return data; case 3: //鍒犻櫎 data = { bg: currentColor ? currentColor : '#d9534f', btnIcon: 'deleteBtnicon', bd: currentColor ? currentColor : '#d9534f', }; return data; case 4: //淇濆瓨骞跺惎鍔ㄦ祦绋� data = { bg: currentColor ? currentColor : '#337ab7', btnIcon: 'queryBtnicon', bd: currentColor ? currentColor : '#337ab7', }; return data; case 5: //娴佺▼澶勭悊 data = { bg: currentColor ? currentColor : 'linear-gradient(90deg, #40D0FF 0%, #409EFF 100%)', btnIcon: 'submitflowicon', // bd: currentColor?currentColor:'#337ab7', }; return data; case 8: //鍏抽棴绐楀彛 data = { bg: currentColor ? currentColor : '#337ab7', btnIcon: 'queryBtnicon', bd: currentColor ? currentColor : '#337ab7', }; return data; case 10: //杩斿洖 data = { bg: currentColor ? currentColor : '#fff', btnIcon: 'backBtnicon', bd: currentColor ? currentColor : '#ccc', fc: '#000', }; return data; case 11: //淇濆瓨骞惰繑鍥� // data = { // bg: currentColor?currentColor:'#337ab7', // btnIcon: 'queryBtnicon', // bd: currentColor?currentColor:'#337ab7', // }; data = { bg: currentColor ? currentColor : 'linear-gradient(90deg, #40D0FF 0%, #409EFF 100%)', btnIcon: 'submitflowicon', }; return data; case 13: //鏃� data = { bg: currentColor ? currentColor : '#5bc0de', btnIcon: 'queryBtnicon', bd: currentColor ? currentColor : '#5bc0de', }; return data; case 14: //缃戦〉鎵撳嵃(琛ㄥ崟) data = { bg: currentColor ? currentColor : '#5bc0de', btnIcon: 'queryBtnicon', bd: currentColor ? currentColor : '#5bc0de', }; return data; case 15: //缃戦〉鎵撳嵃鍚巻鍙� data = { bg: currentColor ? currentColor : '#337ab7', btnIcon: 'queryBtnicon', bd: currentColor ? currentColor : '#337ab7', }; return data; case 16: //瀵煎嚭excel data = { bg: currentColor ? currentColor : '#5bc0de', btnIcon: 'exportToExcelBtnicon', bd: currentColor ? currentColor : '#5bc0de', }; return data; case 19: //淇濆瓨鑽夌ǹ涓嶆牎妫€ data = { bg: currentColor ? currentColor : '#337ab7', btnIcon: 'queryBtnicon', bd: currentColor ? currentColor : '#337ab7', }; return data; case 18: //娓呯┖鎵€鏈夋暟鎹� data = { bg: currentColor ? currentColor : '#d9534f', btnIcon: 'clearAllBtnicon', bd: currentColor ? currentColor : '#d9534f', }; return data; case 20: //鎵归噺鎻愪氦 data = { bg: currentColor ? currentColor : '#337ab7', btnIcon: 'batchApproveBtnicon', bd: currentColor ? currentColor : '#337ab7', }; return data; case 21: //淇濆瓨骞跺鍒� data = { bg: currentColor ? currentColor : '#337ab7', btnIcon: 'queryBtnicon', bd: currentColor ? currentColor : '#337ab7', }; return data; case 25: //PDF瀵煎嚭 data = { bg: currentColor ? currentColor : '#337ab7', btnIcon: 'queryBtnicon', bd: currentColor ? currentColor : '#337ab7', }; return data; case 26: //鏂囦欢涓嬭浇 data = { bg: currentColor ? currentColor : '#5bc0de', btnIcon: 'fileDownloadBtnicon', bd: currentColor ? currentColor : '#5bc0de', }; return data; case 27: //瀵煎叆excel data = { bg: currentColor ? currentColor : '#5bc0de', btnIcon: 'excelImportBtnicon', bd: currentColor ? currentColor : '#5bc0de', }; return data; case 28: //鐢靛瓙绛剧珷 data = { bg: currentColor ? currentColor : '#337ab7', btnIcon: 'queryBtnicon', bd: currentColor ? currentColor : '#337ab7', }; return data; case 29: //鎵归噺绛剧珷 data = { bg: currentColor ? currentColor : '#337ab7', btnIcon: 'batchSignatureBtnicon', bd: currentColor ? currentColor : '#337ab7', }; return data; case 30: //鑷畾涔夋墦鍗� data = { bg: currentColor ? currentColor : '#5bc0de', btnIcon: 'queryBtnicon', bd: currentColor ? currentColor : '#5bc0de', }; return data; case 33: //娴佺▼鍚姩 data = { bg: currentColor ? currentColor : '#337ab7', btnIcon: 'queryBtnicon', bd: currentColor ? currentColor : '#337ab7', }; return data; case 34: //淇濆瓨 data = { bg: currentColor ? currentColor : 'linear-gradient(90deg, #7AD34F 0%, #67C23A 100%)', btnIcon: 'saveBtnicon', // bd: currentColor?currentColor:'#5cb85c' }; return data; case 36: //缃戦〉鎵撳嵃(瑙嗗浘) data = { bg: currentColor ? currentColor : '#5bc0de', btnIcon: 'printViewBtnicon', bd: currentColor ? currentColor : '#5bc0de' }; return data; case 37: //閭欢鐭俊鍒嗕韩 data = { bg: currentColor ? currentColor : '#337ab7', btnIcon: 'queryBtnicon', bd: currentColor ? currentColor : '#337ab7', }; return data; case 42: //淇濆瓨骞舵柊寤� data = { bg: currentColor ? currentColor : '#337ab7', btnIcon: 'queryBtnicon', bd: currentColor ? currentColor : '#337ab7', }; return data; case 43: //璺宠浆 data = { bg: currentColor ? currentColor : '#f0ad4e', btnIcon: 'jumpToBtnicon', bd: currentColor ? currentColor : '#f0ad4e' }; return data; case 45: //褰掓。 data = { bg: currentColor ? currentColor : '#337ab7', btnIcon: 'queryBtnicon', bd: currentColor ? currentColor : '#337ab7', }; return data; case 46: //绛剧珷 data = { bg: currentColor ? currentColor : '#337ab7', btnIcon: 'queryBtnicon', bd: currentColor ? currentColor : '#337ab7', }; return data; case 47: //鍥為€€娴佺▼ data = { bg: currentColor ? currentColor : '#ec971f', btnIcon: 'regressesflowicon', bd: currentColor ? currentColor : '#ec971f', }; return data; case 48: //鍌姙娴佺▼ data = { bg: currentColor ? currentColor : '#337ab7', btnIcon: 'queryBtnicon', bd: currentColor ? currentColor : '#337ab7', }; return data; case 49: //鎸傝捣娴佺▼ data = { bg: currentColor ? currentColor : '#337ab7', btnIcon: 'queryBtnicon', bd: currentColor ? currentColor : '#337ab7', }; return data; case 50: //鎭㈠娴佺▼ data = { bg: currentColor ? currentColor : '#337ab7', btnIcon: 'queryBtnicon', bd: currentColor ? currentColor : '#337ab7', }; return data; case 51: //鍥炴挙娴佺▼ data = { bg: currentColor ? currentColor : '#337ab7', btnIcon: 'queryBtnicon', bd: currentColor ? currentColor : '#337ab7', }; return data; case 52: //缁堟娴佺▼ data = { bg: currentColor ? currentColor : '#337ab7', btnIcon: 'queryBtnicon', bd: currentColor ? currentColor : '#337ab7', }; return data; case 53: //缂栬緫娴佺▼瀹℃壒浜� data = { bg: currentColor ? currentColor : '#337ab7', btnIcon: 'queryBtnicon', bd: currentColor ? currentColor : '#337ab7', }; return data; case 54: //璋冩暣娴佺▼ data = { bg: currentColor ? currentColor : '#337ab7', btnIcon: 'queryBtnicon', bd: currentColor ? currentColor : '#337ab7', }; return data; case 55: //鐐硅瘎 data = { bg: currentColor ? currentColor : '#337ab7', btnIcon: 'queryBtnicon', bd: currentColor ? currentColor : '#337ab7', }; return data; case 56: //琛ョ data = { bg: currentColor ? currentColor : '#337ab7', btnIcon: 'queryBtnicon', bd: currentColor ? currentColor : '#337ab7', }; return data; case 57: //鍔犵涓诲姙 case 58: //鍔犵鍗忓姙 data = { bg: currentColor ? currentColor : '#31b0d5', btnIcon: 'queryBtnicon', bd: currentColor ? currentColor : '#31b0d5', }; return data; case 0: //娴佺▼澶勭悊鍦ㄦ祦绋嬬殑琛ㄥ崟鏉冮檺閲岃缃簡闅愯棌锛宼ype杩斿洖0 this.isShowBtn = false default: break; } return ''; } }, methods: { onClick(val) { if (val) { return; } this.onAction(this.info); }, onAction(act) { let activityType = act.type; if (this.isBlockClick) return // 鎸夐挳浜嬩欢鎵ц鍓�,鏈姹傚墠闃叉閲嶅鐐瑰嚮--form_normalform.vue--runBeforeAction() switch (act.type) { case 1: //杞藉叆瑙嗗浘 this.$emit("action", act); break; case 2: //鍒涘缓 this.$emit("action", act); break; case 3: //鍒犻櫎 this.$emit("action", act); break; case 4: //淇濆瓨骞跺惎鍔ㄦ祦绋� act.flowType = '1'; this.$emit("action", act); break; case 5: //娴佺▼澶勭悊 this.$store.commit('searchFlag', 2)//楂樼骇鏌ヨ杩斿洖璁颁綇鐘舵€� act.flowType = '80'; this.$parent.flowHandle(act); break; case 8: //鍏抽棴绐楀彛 this.$parent.runBeforeAction(this.info.id, '', '', activityType); break; case 10: //杩斿洖 this.$store.commit('searchFlag', 2)//楂樼骇鏌ヨ杩斿洖璁颁綇鐘舵€� this.$emit("action", act); break; case 11: //淇濆瓨骞惰繑鍥� this.$store.commit('searchFlag', 2)//楂樼骇鏌ヨ杩斿洖璁颁綇鐘舵€� this.$emit("action", act); // this.$parent.runBeforeAction(act.id, '', '', activityType); break; case 13: //鏃� this.$emit("action", act); break; case 14: //缃戦〉鎵撳嵃(琛ㄥ崟) // this.$parent.runBeforeAction(act.id, '', '', activityType, ); this.$emit("action", act); break; case 15: //缃戦〉鎵撳嵃鍚巻鍙� this.$parent.runBeforeAction(act.id, '', '', activityType); break; case 16: //瀵煎嚭excel this.$emit("action", act); break; case 19: //淇濆瓨鑽夌ǹ涓嶆牎妫€ this.$parent.runBeforeAction(act.id, '', '', activityType, '', act); break; case 18: //娓呯┖鎵€鏈夋暟鎹� this.$emit("action", act); break; case 20: //鎵归噺鎻愪氦 act.flowType = '80'; this.$emit("action", act); break; case 21: //淇濆瓨骞跺鍒� // this.$parent.runBeforeAction(act.id, '', '', activityType); this.$emit("action", act); break; case 25: //PDF瀵煎嚭 // this.$parent.runBeforeAction(act.id, '', '', activityType); this.$emit("action", act); break; case 26: //鏂囦欢涓嬭浇 this.$emit("action", act); break; case 27: //瀵煎叆excel this.$emit("action", act); break; case 28: //鐢靛瓙绛剧珷 this.$emit("action", act); break; case 29: //鎵归噺绛剧珷 this.$emit("action", act); break; case 30: //鑷畾涔夋墦鍗� this.$emit("action", act); break; case 33: //娴佺▼鍚姩 act.flowType = '1'; this.$emit("action", act); break; case 34: //淇濆瓨 // this.$parent.runBeforeAction(act.id, '', '', activityType); this.$emit("action", act); break; case 36: //缃戦〉 this.$emit("action", act); break; case 37: //閭欢鐭俊鍒嗕韩 this.$emit("action", act); break; case 42: //淇濆瓨骞舵柊寤� this.$emit("action", act); //this.$parent.runBeforeAction(act.id, '', '', activityType); break; case 43: //璺宠浆 this.$emit("action", act); break; case 45: //褰掓。 this.$parent.runBeforeAction(act.id, '', '', activityType); break; case 46: //绛剧珷 this.$emit("action", act); break; case 47: //鍥為€€娴佺▼ this.$parent.flowHandle(act); break; case 48: //鍌姙娴佺▼ this.$emit("action", act); break; case 49: //鎸傝捣娴佺▼ act.flowType = '88'; this.$emit("action", act); break; case 50: //鎭㈠娴佺▼ act.flowType = '89'; this.$emit("action", act); break; case 51: //鍥炴挙娴佺▼ act.flowType = '85'; this.$emit("action", act); break; case 52: //缁堟娴佺▼ act.flowType = '8'; this.$emit("action", act); break; case 53: //缂栬緫娴佺▼瀹℃壒浜� this.$emit("action", act); break; case 54: //璋冩暣娴佺▼ break; case 55: //鐐硅瘎 this.$emit("action", act); break; case 56: //琛ョ this.$emit("action", act); break; case 57: //鍔犵涓诲姙 this.$emit("action", act); break; case 58: //鍔犵鍗忓姙 this.$emit("action", act); break; default: break; } } } }; </script>