@huilian/components-tms 3.0.5 → 3.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/bundle.esm.js +7 -7
- package/package.json +1 -1
package/lib/bundle.esm.js
CHANGED
|
@@ -2109,7 +2109,7 @@ this.inResize=false;this.$nextTick(t=>{this.inResize=true;});}}};/* script */con
|
|
|
2109
2109
|
//
|
|
2110
2110
|
//
|
|
2111
2111
|
//
|
|
2112
|
-
var script$b={name:'dp',props:{value:String|Array|Object,visible:{type:Boolean,default:false}},methods:{updateMsg(newVal){this.$emit('update-visible',newVal);}},computed:{computeStyle(){const type=Object.prototype.toString.call(this.value);let res=true;switch(type){case'[object Array]':this.value[0]==this.value[1];const errValues=[null,undefined,''];res=this.value.length==0||errValues.includes(this.value[0])&&errValues.includes(this.value[1]);break;case'[object Object]':res=Object.keys(this.value).length==0;break;case'[object String]':res=this.value.length==0;break;case'[object Number]':res=false;break;}return{color:!res?'#10c2b0':'#ccc'};}}};/* script */const __vue_script__$b=script$b;/* template */var __vue_render__$b=function(){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c("svg",{staticClass:"icon",style:_vm.computeStyle,attrs:{"aria-hidden":"true"},on:{click:_vm.updateMsg}},[_c("use",{attrs:{"xlink:href":"#fontFamily-a-web20_liebiaoshaixuan"}})]);};var __vue_staticRenderFns__$b=[];__vue_render__$b._withStripped=true;/* style */const __vue_inject_styles__$b=undefined;/* scoped */const __vue_scope_id__$b=undefined;/* module identifier */const __vue_module_identifier__$b=undefined;/* functional template */const __vue_is_functional_template__$b=false;/* style inject */ /* style inject SSR */ /* style inject shadow dom */const __vue_component__$b=/*#__PURE__*/normalizeComponent({render:__vue_render__$b,staticRenderFns:__vue_staticRenderFns__$b},__vue_inject_styles__$b,__vue_script__$b,__vue_scope_id__$b,__vue_is_functional_template__$b,__vue_module_identifier__$b,false,undefined,undefined,undefined);//
|
|
2112
|
+
var script$b={name:'dp',props:{value:String|Array|Object|Boolean,visible:{type:Boolean,default:false}},methods:{updateMsg(newVal){this.$emit('update-visible',newVal);}},computed:{computeStyle(){const type=Object.prototype.toString.call(this.value);let res=true;switch(type){case'[object Array]':this.value[0]==this.value[1];const errValues=[null,undefined,''];res=this.value.length==0||errValues.includes(this.value[0])&&errValues.includes(this.value[1]);break;case'[object Object]':res=Object.keys(this.value).length==0;break;case'[object String]':res=this.value.length==0;break;case'[object Number]':res=false;break;case'[object Boolean]':res=!this.value;break;}return{color:!res?'#10c2b0':'#ccc'};}}};/* script */const __vue_script__$b=script$b;/* template */var __vue_render__$b=function(){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c("svg",{staticClass:"icon",style:_vm.computeStyle,attrs:{"aria-hidden":"true"},on:{click:_vm.updateMsg}},[_c("use",{attrs:{"xlink:href":"#fontFamily-a-web20_liebiaoshaixuan"}})]);};var __vue_staticRenderFns__$b=[];__vue_render__$b._withStripped=true;/* style */const __vue_inject_styles__$b=undefined;/* scoped */const __vue_scope_id__$b=undefined;/* module identifier */const __vue_module_identifier__$b=undefined;/* functional template */const __vue_is_functional_template__$b=false;/* style inject */ /* style inject SSR */ /* style inject shadow dom */const __vue_component__$b=/*#__PURE__*/normalizeComponent({render:__vue_render__$b,staticRenderFns:__vue_staticRenderFns__$b},__vue_inject_styles__$b,__vue_script__$b,__vue_scope_id__$b,__vue_is_functional_template__$b,__vue_module_identifier__$b,false,undefined,undefined,undefined);//
|
|
2113
2113
|
var script$a={props:{setFormParams:Function,column:Object,ops:Object,// 请求参数
|
|
2114
2114
|
getConfig:Function,ruleFn:Function},components:{Dp:__vue_component__$b},watch:{ops:function(newVal,old){const{key}=this.getConfig(this.column);const ops=newVal;if(ops[key]){this.value=ops[key].split(',');// 约定 基本上check类型的值都是,分割的字符串
|
|
2115
2115
|
}else{this.value=[];}},visible:{deep:true,handler(value){if(this.ruleFn&&value){let{option}=this.getConfig(this.column);this.list=option;}}}},data(){return{trans,list:[],visible:false,value:[]};},mounted(){let{option}=this.getConfig(this.column);this.list=option;},methods:{submit(){const{key}=this.getConfig(this.column);this.setFormParams({[key]:this.value.join(',')});this.visible=false;},reset(){this.value=[];}}};/* script */const __vue_script__$a=script$a;/* template */var __vue_render__$a=function(){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c("span",[_c("el-popover",{attrs:{placement:"bottom",width:"100%",trigger:"click","popper-class":"pointRecord"},model:{value:_vm.visible,callback:function($$v){_vm.visible=$$v;},expression:"visible"}},[_c("div",{attrs:{"data-name":_vm.column.columnPropertyName}},[_c("el-select",{attrs:{multiple:"",filterable:"",placeholder:_vm.trans("请选择")},model:{value:_vm.value,callback:function($$v){_vm.value=$$v;},expression:"value"}},_vm._l(_vm.list,function(item){return _c("el-option",{key:item.label,attrs:{label:item.label,value:item.value}});}),1),_vm._v(" "),_c("el-button",{staticClass:"popBtn",attrs:{size:"mini"},on:{click:_vm.reset}},[_vm._v(_vm._s(_vm.trans("重置")))]),_vm._v(" "),_c("el-button",{staticClass:"popBtn",attrs:{type:"success",size:"mini"},on:{click:_vm.submit}},[_vm._v(_vm._s(_vm.trans("确定")))])],1),_vm._v(" "),_c("dp",{attrs:{slot:"reference",value:_vm.value},slot:"reference"})],1)],1);};var __vue_staticRenderFns__$a=[];__vue_render__$a._withStripped=true;/* style */const __vue_inject_styles__$a=function(inject){if(!inject)return;inject("data-v-56cd67c9_0",{source:".popBtn[data-v-56cd67c9] {\n vertical-align: bottom;\n margin-left: 5px;\n}\n.checkbox[data-v-56cd67c9] {\n max-height: 150px;\n overflow-y: auto;\n}\n.checkbox .el-checkbox[data-v-56cd67c9] {\n display: block;\n}\n\n/*# sourceMappingURL=Check.vue.map */",map:{"version":3,"sources":["/Users/chenlei/HLcode/test/components/FormTableScheme/component/ColHeader/Check.vue","Check.vue"],"names":[],"mappings":"AAwEA;EACA,sBAAA;EACA,gBAAA;ACvEA;AD0EA;EACA,iBAAA;EACA,gBAAA;ACvEA;ADyEA;EACA,cAAA;ACvEA;;AAEA,oCAAoC","file":"Check.vue","sourcesContent":["<template>\n <span>\n <el-popover placement=\"bottom\" width=\"100%\" trigger=\"click\" v-model=\"visible\" popper-class=\"pointRecord\">\n <div :data-name=\"column.columnPropertyName\">\n <el-select multiple v-model=\"value\" filterable :placeholder=\"trans('请选择')\">\n <el-option v-for=\"item in list\" :label=\"item.label\" :key=\"item.label\" :value=\"item.value\"></el-option>\n </el-select>\n <el-button class=\"popBtn\" size=\"mini\" @click=\"reset\">{{ trans('重置') }}</el-button>\n <el-button class=\"popBtn\" type=\"success\" size=\"mini\" @click=\"submit\">{{ trans('确定') }}</el-button>\n </div>\n <dp :value=\"value\" slot=\"reference\" />\n </el-popover>\n </span>\n</template>\n<script>\nimport Dp from './dp.vue'\nimport trans from '../../../lang/trans'\n\nexport default {\n props: {\n setFormParams: Function,\n column: Object,\n ops: Object, // 请求参数\n getConfig: Function,\n ruleFn: Function,\n },\n components: { Dp },\n watch: {\n ops: function (newVal, old) {\n const { key } = this.getConfig(this.column);\n const ops = newVal;\n if (ops[key]) {\n this.value = ops[key].split(',') // 约定 基本上check类型的值都是,分割的字符串\n } else {\n this.value = []\n }\n },\n visible: {\n deep: true,\n handler(value){\n if(this.ruleFn && value){\n let { option } = this.getConfig(this.column);\n this.list = option\n }\n }\n }\n },\n data() {\n return {\n trans,\n list: [],\n visible: false,\n value: [],\n }\n },\n mounted() {\n let { option } = this.getConfig(this.column);\n this.list = option\n },\n methods: {\n submit() {\n const { key } = this.getConfig(this.column);\n this.setFormParams({ [key]: this.value.join(',') })\n this.visible = false\n },\n reset() {\n this.value = [];\n }\n }\n}\n</script>\n<style lang=\"scss\" scoped>\n.popBtn {\n vertical-align: bottom;\n margin-left: 5px;\n}\n\n.checkbox {\n max-height: 150px;\n overflow-y: auto;\n\n .el-checkbox {\n display: block;\n }\n}\n</style>",".popBtn {\n vertical-align: bottom;\n margin-left: 5px;\n}\n\n.checkbox {\n max-height: 150px;\n overflow-y: auto;\n}\n.checkbox .el-checkbox {\n display: block;\n}\n\n/*# sourceMappingURL=Check.vue.map */"]},media:undefined});};/* scoped */const __vue_scope_id__$a="data-v-56cd67c9";/* module identifier */const __vue_module_identifier__$a=undefined;/* functional template */const __vue_is_functional_template__$a=false;/* style inject SSR */ /* style inject shadow dom */const __vue_component__$a=/*#__PURE__*/normalizeComponent({render:__vue_render__$a,staticRenderFns:__vue_staticRenderFns__$a},__vue_inject_styles__$a,__vue_script__$a,__vue_scope_id__$a,__vue_is_functional_template__$a,__vue_module_identifier__$a,false,createInjector,undefined,undefined);//
|
|
@@ -2119,7 +2119,7 @@ getConfig:Function,ruleFn:Function},components:{Dp:__vue_component__$b},watch:{o
|
|
|
2119
2119
|
var script$8={props:{column:Object,setFormParams:Function,getConfig:Function,config:{type:Object,default:()=>{return{rule:{type:'date'}};}},ops:Object// 请求参数
|
|
2120
2120
|
},components:{Dp:__vue_component__$b},watch:{ops:function(newVal){const{key}=this.getConfig(this.column);const ops=newVal;if(ops[key]){this.value=moment(ops[key]);}else{this.value='';}}},data(){return{trans,visible:false,value:''};},methods:{submit(){const{rule,key}=this.getConfig(this.column);const{format}=rule;if(this.value){const str=`${moment(this.value).format(format)}`;this.setFormParams({[key]:str});this.visible=false;}},reset(){this.value='';}}};/* script */const __vue_script__$8=script$8;/* template */var __vue_render__$8=function(){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c("span",[_c("el-popover",{attrs:{placement:"bottom",width:"400",trigger:"click","popper-class":"pointRecord"},model:{value:_vm.visible,callback:function($$v){_vm.visible=$$v;},expression:"visible"}},[_c("div",{attrs:{"data-name":_vm.column.columnPropertyName}},[_c("el-date-picker",{staticStyle:{"margin-bottom":"10px"},attrs:{type:_vm.config.rule.type,align:"right","unlink-panels":"","range-separator":_vm.trans("至"),"start-placeholder":_vm.trans("开始日期"),"end-placeholder":_vm.trans("结束日期")},model:{value:_vm.value,callback:function($$v){_vm.value=$$v;},expression:"value"}}),_vm._v(" "),_c("el-button",{attrs:{size:"mini"},on:{click:_vm.reset}},[_vm._v(_vm._s(_vm.trans("重置")))]),_vm._v(" "),_c("el-button",{attrs:{type:"success",size:"mini"},on:{click:_vm.submit}},[_vm._v(_vm._s(_vm.trans("确定")))])],1),_vm._v(" "),_c("dp",{attrs:{slot:"reference",value:_vm.value},slot:"reference"})],1)],1);};var __vue_staticRenderFns__$8=[];__vue_render__$8._withStripped=true;/* style */const __vue_inject_styles__$8=undefined;/* scoped */const __vue_scope_id__$8=undefined;/* module identifier */const __vue_module_identifier__$8=undefined;/* functional template */const __vue_is_functional_template__$8=false;/* style inject */ /* style inject SSR */ /* style inject shadow dom */const __vue_component__$8=/*#__PURE__*/normalizeComponent({render:__vue_render__$8,staticRenderFns:__vue_staticRenderFns__$8},__vue_inject_styles__$8,__vue_script__$8,__vue_scope_id__$8,__vue_is_functional_template__$8,__vue_module_identifier__$8,false,undefined,undefined,undefined);//
|
|
2121
2121
|
var script$7={props:{column:Object,setFormParams:Function,config:Object,ops:Object,// 请求参数,
|
|
2122
|
-
getConfig:Function},components:{Dp:__vue_component__$b},watch:{ops:function(newVal){const ops=newVal;const{key}=this.getConfig(this.column);const v1=ops[key[0]],v2=ops[key[1]];if(v1&&v2){this.value=[moment(v1),moment(v2)];}else{this.value=[];}}},data(){return{trans,visible:false,pickerOptions:{shortcuts:[{text:trans('最近一周'),onClick(picker){const end=new Date();const start=new Date();start.setTime(start.getTime()-3600*1000*24*7);picker.$emit('pick',[start,end]);}},{text:trans('最近一个月'),onClick(picker){const end=new Date();const start=new Date();start.setTime(start.getTime()-3600*1000*24*30);picker.$emit('pick',[start,end]);}},{text:trans('最近三个月'),onClick(picker){const end=new Date();const start=new Date();start.setTime(start.getTime()-3600*1000*24*90);picker.$emit('pick',[start,end]);}}]},value:[]};},methods:{updateVisible(){this.visible=!this.visible;},submit(){const{key,rule}=this.getConfig(this.column);const{format,isAuto0059=false}=rule;let f1=format,f2=format;if(isAuto0059){f1='YYYY-MM-DD 00:00:00';f2='YYYY-MM-DD 23:59:59';}if(this.value.length>1){const v1=moment(this.value[0]).format(f1);const v2=moment(this.value[1]).format(f2);this.setFormParams({[key[0]]:v1,[key[1]]:v2});}this.visible=false;},reset(){this.value=[];}}};/* script */const __vue_script__$7=script$7;/* template */var __vue_render__$7=function(){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c("span",[_c("el-popover",{attrs:{placement:"bottom",width:"425",trigger:"manual","popper-class":"pointRecord"},model:{value:_vm.visible,callback:function($$v){_vm.visible=$$v;},expression:"visible"}},[_c("div",{attrs:{"data-name":_vm.column.columnPropertyName}},[_c("el-date-picker",{staticStyle:{"margin-bottom":"10px"},attrs:{type:"datetimerange",align:"right","unlink-panels":"","range-separator":_vm.trans("至"),"start-placeholder":_vm.trans("开始日期"),"end-placeholder":_vm.trans("结束日期"),"picker-options":_vm.pickerOptions},model:{value:_vm.value,callback:function($$v){_vm.value=$$v;},expression:"value"}}),_vm._v(" "),_c("el-button",{attrs:{size:"mini"},on:{click:_vm.reset}},[_vm._v(_vm._s(_vm.trans("重置")))]),_vm._v(" "),_c("el-button",{attrs:{type:"success",size:"mini"},on:{click:_vm.submit}},[_vm._v(_vm._s(_vm.trans("确定")))])],1),_vm._v(" "),_c("dp",{attrs:{slot:"reference",value:_vm.
|
|
2122
|
+
getConfig:Function},components:{Dp:__vue_component__$b},watch:{ops:function(newVal){const ops=newVal;const{key}=this.getConfig(this.column);const v1=ops[key[0]],v2=ops[key[1]],v3=ops[key[2]];if(v1&&v2){this.value=[moment(v1),moment(v2)];if(key[2]){console.log(key[2]);console.log(v3);console.log(key[3]);if(v3==key[3]){this.isHaveValue=true;}else{this.isHaveValue=false;}}else{this.isHaveValue=true;}}else{this.value=[];this.isHaveValue=false;}}},data(){return{trans,visible:false,pickerOptions:{shortcuts:[{text:trans('最近一周'),onClick(picker){const end=new Date();const start=new Date();start.setTime(start.getTime()-3600*1000*24*7);picker.$emit('pick',[start,end]);}},{text:trans('最近一个月'),onClick(picker){const end=new Date();const start=new Date();start.setTime(start.getTime()-3600*1000*24*30);picker.$emit('pick',[start,end]);}},{text:trans('最近三个月'),onClick(picker){const end=new Date();const start=new Date();start.setTime(start.getTime()-3600*1000*24*90);picker.$emit('pick',[start,end]);}}]},value:[],isHaveValue:false};},methods:{updateVisible(){this.visible=!this.visible;},submit(){const{key,rule}=this.getConfig(this.column);const{format,isAuto0059=false}=rule;let f1=format,f2=format;if(isAuto0059){f1='YYYY-MM-DD 00:00:00';f2='YYYY-MM-DD 23:59:59';}if(this.value.length>1){const v1=moment(this.value[0]).format(f1);const v2=moment(this.value[1]).format(f2);console.log(key);if(key[2]&&key[3]){const v3=key[3];this.setFormParams({[key[0]]:v1,[key[1]]:v2,[key[2]]:v3});}else{this.setFormParams({[key[0]]:v1,[key[1]]:v2});}}this.visible=false;},reset(){this.value=[];}}};/* script */const __vue_script__$7=script$7;/* template */var __vue_render__$7=function(){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c("span",[_c("el-popover",{attrs:{placement:"bottom",width:"425",trigger:"manual","popper-class":"pointRecord"},model:{value:_vm.visible,callback:function($$v){_vm.visible=$$v;},expression:"visible"}},[_c("div",{attrs:{"data-name":_vm.column.columnPropertyName}},[_c("el-date-picker",{staticStyle:{"margin-bottom":"10px"},attrs:{type:"datetimerange",align:"right","unlink-panels":"","range-separator":_vm.trans("至"),"start-placeholder":_vm.trans("开始日期"),"end-placeholder":_vm.trans("结束日期"),"picker-options":_vm.pickerOptions},model:{value:_vm.value,callback:function($$v){_vm.value=$$v;},expression:"value"}}),_vm._v(" "),_c("el-button",{attrs:{size:"mini"},on:{click:_vm.reset}},[_vm._v(_vm._s(_vm.trans("重置")))]),_vm._v(" "),_c("el-button",{attrs:{type:"success",size:"mini"},on:{click:_vm.submit}},[_vm._v(_vm._s(_vm.trans("确定")))])],1),_vm._v(" "),_c("dp",{attrs:{slot:"reference",value:_vm.isHaveValue,visible:_vm.visible},on:{"update-visible":_vm.updateVisible},slot:"reference"})],1)],1);};var __vue_staticRenderFns__$7=[];__vue_render__$7._withStripped=true;/* style */const __vue_inject_styles__$7=undefined;/* scoped */const __vue_scope_id__$7=undefined;/* module identifier */const __vue_module_identifier__$7=undefined;/* functional template */const __vue_is_functional_template__$7=false;/* style inject */ /* style inject SSR */ /* style inject shadow dom */const __vue_component__$7=/*#__PURE__*/normalizeComponent({render:__vue_render__$7,staticRenderFns:__vue_staticRenderFns__$7},__vue_inject_styles__$7,__vue_script__$7,__vue_scope_id__$7,__vue_is_functional_template__$7,__vue_module_identifier__$7,false,undefined,undefined,undefined);//
|
|
2123
2123
|
var script$6={props:{setFormParams:Function,column:Object,ops:Object,// 请求参数
|
|
2124
2124
|
getConfig:Function},components:{Dp:__vue_component__$b},watch:{ops:function(newVal,old){const{key}=this.getConfig(this.column);const ops=newVal;this.value=ops[key]||'';}},data(){return{trans,visible:false,value:'',ruleCorrespond:''};},mounted(){const{ruleCorrespond}=this.getConfig(this.column);this.ruleCorrespond=ruleCorrespond;},methods:{querySearch(queryString,cb){return this.ruleCorrespond(queryString,cb);},submit(){const{key}=this.getConfig(this.column);this.setFormParams({[key]:this.value});this.visible=false;},reset(){this.value='';}}};/* script */const __vue_script__$6=script$6;/* template */var __vue_render__$6=function(){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c("span",[_c("el-popover",{attrs:{placement:"bottom",width:"100%",trigger:"click","popper-class":"pointRecord"},model:{value:_vm.visible,callback:function($$v){_vm.visible=$$v;},expression:"visible"}},[_c("div",{attrs:{"data-name":_vm.column.columnPropertyName}},[!_vm.ruleCorrespond?_c("el-input",{staticStyle:{"margin-bottom":"10px"},model:{value:_vm.value,callback:function($$v){_vm.value=$$v;},expression:"value"}}):_c("el-autocomplete",{attrs:{"fetch-suggestions":_vm.ruleCorrespond,placeholder:"请输入内容"},model:{value:_vm.value,callback:function($$v){_vm.value=$$v;},expression:"value"}}),_vm._v(" "),_c("el-button",{attrs:{size:"mini"},on:{click:_vm.reset}},[_vm._v(_vm._s(_vm.trans("重置")))]),_vm._v(" "),_c("el-button",{attrs:{type:"success",size:"mini"},on:{click:_vm.submit}},[_vm._v(_vm._s(_vm.trans("确定")))])],1),_vm._v(" "),_c("dp",{attrs:{slot:"reference",value:_vm.value},slot:"reference"})],1)],1);};var __vue_staticRenderFns__$6=[];__vue_render__$6._withStripped=true;/* style */const __vue_inject_styles__$6=undefined;/* scoped */const __vue_scope_id__$6=undefined;/* module identifier */const __vue_module_identifier__$6=undefined;/* functional template */const __vue_is_functional_template__$6=false;/* style inject */ /* style inject SSR */ /* style inject shadow dom */const __vue_component__$6=/*#__PURE__*/normalizeComponent({render:__vue_render__$6,staticRenderFns:__vue_staticRenderFns__$6},__vue_inject_styles__$6,__vue_script__$6,__vue_scope_id__$6,__vue_is_functional_template__$6,__vue_module_identifier__$6,false,undefined,undefined,undefined);//
|
|
2125
2125
|
//
|
|
@@ -2203,10 +2203,10 @@ var script$1={name:'FormTableScheme',components:{SelectCol:__vue_component__$c,C
|
|
|
2203
2203
|
default:()=>{return{};},type:Object},hasSearch:{default:true,type:Boolean},rowKey:{default:'columnProperty',type:String},countNum:{// 总数
|
|
2204
2204
|
default:0,type:Number},formatData:Function,isAutoScroll:{default:true,type:Boolean},setHeight:{default:'',type:String},getApi:Function,hooks:{default:()=>{},type:Function},columnsApi:Function,requestFn:{default:()=>{return pageTemplatecs$1;},type:Object},templateKey:String,selectcheck:Function,selectType:String,hasSelection:Boolean,hasIndex:{type:Boolean,default:false},selectable:Function,searchPlaceholder:String,actionWidth:{type:String,default:'100'},keywordsKEY:{type:String,default:'keywords'},ruleFn:{type:Object,default:function(){return{};}},colDisplayFn:{type:Function,default:function(col){return col;}},sortableList:{type:Object,default:function(){return{};}},isInitQuest:{type:Boolean,default:true}},setup(){},created(){// document.addEventListener('keyup', this.enter)
|
|
2205
2205
|
},destroyed(){// document.removeEventListener('keyup', this.enter)
|
|
2206
|
-
},mounted(){this.changePG();},activated(){this.$refs.FormTable.doLayout();},methods:{getConfig(item){return getOptions(item,this.ruleFn);},getLabel(item,row){let config=getOptions(item,this.ruleFn);return this.formatSwitch(config,row);},changeType(type){if(!bigSearch)return;this.searchType=type==1?'textarea':'text';if(type==1){this.$nextTick(()=>{this.$refs.myTextarea.focus();});}},dragHead(newWidth,oldWidth,column,event){const findColumn=this.columnsShow.find(c=>c.columnPropertyName==column.label);let formatWidth=Math.ceil(newWidth);this.requestFn.pageTemplatecs.saveMyTemplateColumnWidth({templateKey:this.templateKey,columnCode:findColumn.columnCode,width:formatWidth}).then(response=>{});},changePG(pages){this.requestFn.pageTemplatecs.selectUserTemplateColumns({templateKey:this.templateKey}).then(response=>{if(response.result==='success'){this.columns=response.data.map(i=>{if(i.queryConfig){i.queryConfig=JSON.parse(i.queryConfig);}return i;});}});this.requestFn.pageTemplatecs.selectMyTableColumns({templateKey:this.templateKey}).then(response=>{if(response.result==='success'){this.columnsShow=response.data.map(i=>{if(i.queryConfig){i.queryConfig=JSON.parse(i.queryConfig);}return i;});this.$nextTick(()=>{if(this.isInitQuest){this.getList();}});}});},setFormParams(obj,type='add'){if(type=='add'){this.searchParams={...this.searchParams,...obj};}else{for(let key in obj){delete this.searchParams[key];}}this.$nextTick(()=>{this.getList({skipCount:1});});},enter(e){if(e.key==='Enter'||e.keyCode===13){console.log('enter');}},getList(params,isClearParams=false){let searchParams;if(isClearParams){searchParams={...params,pageSize:this.searchParams.pageSize,skipCount:1};}else{searchParams={...this.searchParams,...params};}this.searchParams=searchParams;// 处理数据
|
|
2206
|
+
},mounted(){this.changePG();},activated(){this.$refs.FormTable.doLayout();},methods:{getConfig(item){return getOptions(item,this.ruleFn);},getLabel(item,row){let config=getOptions(item,this.ruleFn);return this.formatSwitch(config,row);},changeType(type){if(!this.bigSearch)return;this.searchType=type==1?'textarea':'text';if(type==1){this.$nextTick(()=>{this.$refs.myTextarea.focus();});}},dragHead(newWidth,oldWidth,column,event){const findColumn=this.columnsShow.find(c=>c.columnPropertyName==column.label);let formatWidth=Math.ceil(newWidth);this.requestFn.pageTemplatecs.saveMyTemplateColumnWidth({templateKey:this.templateKey,columnCode:findColumn.columnCode,width:formatWidth}).then(response=>{});},changePG(pages){this.requestFn.pageTemplatecs.selectUserTemplateColumns({templateKey:this.templateKey}).then(response=>{if(response.result==='success'){this.columns=response.data.map(i=>{if(i.queryConfig){i.queryConfig=JSON.parse(i.queryConfig);}return i;});}});this.requestFn.pageTemplatecs.selectMyTableColumns({templateKey:this.templateKey}).then(response=>{if(response.result==='success'){this.columnsShow=response.data.map(i=>{if(i.queryConfig){i.queryConfig=JSON.parse(i.queryConfig);}return i;});this.$nextTick(()=>{if(this.isInitQuest){this.getList();}});}});},setFormParams(obj,type='add'){if(type=='add'){this.searchParams={...this.searchParams,...obj};}else{for(let key in obj){delete this.searchParams[key];}}this.$nextTick(()=>{this.getList({skipCount:1});});},enter(e){if(e.key==='Enter'||e.keyCode===13){console.log('enter');}},getList(params,isClearParams=false){let searchParams;if(isClearParams){searchParams={...params,pageSize:this.searchParams.pageSize,skipCount:1};}else{searchParams={...this.searchParams,...params};}this.searchParams=searchParams;// 处理数据
|
|
2207
2207
|
let ops={};for(var key in searchParams){if(searchParams[key]!==''&&searchParams[key]!==null&&searchParams[key]!==undefined){ops[key]=searchParams[key];}}// 根据参数画tag
|
|
2208
|
-
formToValue(ops,this.columnsShow,this.colChange,this.ruleFn);const{pageSize,skipCount}=ops;this.listLoading=true;this.hooks(ops);this.getApi({...ops,pageSize:pageSize,skipCount:(skipCount-1)*pageSize,reqTypeSign:'config_table'}).then(response=>{if(response.result==='success'){if(this.formatData){this.list=this.formatData(response.data);}else{this.list=response.data;}this.ops=ops;this.count=response.count;}else{this.$message.error(response.msg);}this.$emit('update:countNum',this.count);this.listLoading=false;},err=>{this.listLoading=false;});},handleSelectionChange(val){let formatVal=val;if(this.selectType==='single'){formatVal=[val.pop()];let other=val;if(other&&other.length>0){other.forEach(row=>{this.$refs.FormTable.toggleRowSelection(row,false);});this.$refs.FormTable.toggleRowSelection(formatVal[0],true);}}this.selectcheck(formatVal);this.multipleSelection=formatVal;this.$emit('selectcheck',formatVal);},getNewCol(show,all){this.columnsShow=show;this.columns=all;this.tableKey=Math.random();// table不刷新 强制key
|
|
2209
|
-
},closeTag(tag){const index=this.tags.findIndex(i=>i.name===tag.name);const delItem=this.tags.splice(index,1)[0];const{key,type}=delItem;if(type==='dateRange'||type==='inputScope'){this.setFormParams({[key[0]]:'',[key[1]]:''},'remove');}else{this.setFormParams({[key]:''},'remove');}},closeAllTag(){const delKeys={};this.tags.forEach(i=>{const{key,type}=i;if(type==='dateRange'||type==='inputScope'){delKeys[key[0]]='';delKeys[key[1]]='';}else{delKeys[key]='';}});this.tags=[];this.setFormParams({...delKeys},'remove');},colChange(objTags){// const selectIndex =this.tags.findIndex(i => i.name === arrow)
|
|
2208
|
+
formToValue(ops,this.columnsShow,this.colChange,this.ruleFn);const{pageSize,skipCount}=ops;this.listLoading=true;this.hooks(ops);this.getApi({...ops,pageSize:pageSize,skipCount:(skipCount-1)*pageSize,reqTypeSign:'config_table'}).then(response=>{if(response.result==='success'){if(this.formatData){this.list=this.formatData(response.data);}else{this.list=response.data||[];}this.ops=ops;this.count=response.count;}else{this.$message.error(response.msg);}this.$emit('update:countNum',this.count);this.listLoading=false;},err=>{this.listLoading=false;});},handleSelectionChange(val){let formatVal=val;if(this.selectType==='single'){formatVal=[val.pop()];let other=val;if(other&&other.length>0){other.forEach(row=>{this.$refs.FormTable.toggleRowSelection(row,false);});this.$refs.FormTable.toggleRowSelection(formatVal[0],true);}}this.selectcheck(formatVal);this.multipleSelection=formatVal;this.$emit('selectcheck',formatVal);},getNewCol(show,all){this.columnsShow=show;this.columns=all;this.tableKey=Math.random();// table不刷新 强制key
|
|
2209
|
+
},closeTag(tag){const index=this.tags.findIndex(i=>i.name===tag.name);const delItem=this.tags.splice(index,1)[0];const{key,type}=delItem;if(type==='dateRange'||type==='inputScope'){this.setFormParams({[key[0]]:'',[key[1]]:'',[key[2]]:''},'remove');}else{this.setFormParams({[key]:''},'remove');}},closeAllTag(){const delKeys={};this.tags.forEach(i=>{const{key,type}=i;if(type==='dateRange'||type==='inputScope'){delKeys[key[0]]='';delKeys[key[1]]='';}else{delKeys[key]='';}});this.tags=[];this.setFormParams({...delKeys},'remove');},colChange(objTags){// const selectIndex =this.tags.findIndex(i => i.name === arrow)
|
|
2210
2210
|
// if(selectIndex >= 0){
|
|
2211
2211
|
// let select = this.tags[selectIndex]
|
|
2212
2212
|
// if(data.value.length > 0){
|
|
@@ -2219,7 +2219,7 @@ formToValue(ops,this.columnsShow,this.colChange,this.ruleFn);const{pageSize,skip
|
|
|
2219
2219
|
// } else {
|
|
2220
2220
|
// this.tags = this.tags.concat([{'name':arrow, value:data.value, str:data.str, key:data.searchKey, type: data.type }])
|
|
2221
2221
|
// }
|
|
2222
|
-
const arr=[];for(let key in objTags){arr.push(objTags[key]);}this.tags=[].concat(arr);},actionModal(){this.dialogFormVisible=true;this.columns;this.columns=this.columns.map(i=>{const isSelect=this.columnsShow.find(j=>j.columnPropertyName===i.columnPropertyName);i.show=!!isSelect;return i;});}}};/* script */const __vue_script__$1=script$1;/* template */var __vue_render__$1=function(){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c("div",{staticClass:"container"},[_c("div",{staticClass:"optBox"},[_c("div",{staticClass:"leftBtn"},[_vm._t("leftBtn")],2),_vm._v(" "),_c("div",{staticClass:"rightBtn"},[_vm.hasSearch?_c("el-input",{directives:[{name:"show",rawName:"v-show",value:_vm.searchType=="textarea",expression:"searchType == 'textarea'"}],ref:"myTextarea",class:{"input-with-select":true,textareaSpec:_vm.searchType=="textarea"},attrs:{type:"textarea",placeholder:_vm.searchPlaceholder||_vm.trans("请输入内容"),rows:10},on:{blur:function($event){return _vm.changeType(0);}},nativeOn:{keyup:function($event){if(!$event.type.indexOf("key")&&_vm._k($event.keyCode,"enter",13,$event.key,"Enter")){return null;}return _vm.getList({skipCount:1});}},model:{value:_vm.searchParams[_vm.keywordsKEY],callback:function($$v){_vm.$set(_vm.searchParams,_vm.keywordsKEY,typeof $$v==="string"?$$v.trim():$$v);},expression:"searchParams[keywordsKEY]"}},[_c("el-button",{attrs:{slot:"append",icon:"el-icon-search"},on:{click:function($event){return _vm.getList({skipCount:1});}},slot:"append"})],1):_vm._e(),_vm._v(" "),_vm.hasSearch?_c("el-input",{directives:[{name:"show",rawName:"v-show",value:_vm.searchType=="text",expression:"searchType == 'text'"}],staticClass:"input-with-select",attrs:{placeholder:_vm.searchPlaceholder||_vm.trans("请输入内容")},on:{focus:function($event){return _vm.changeType(1);}},nativeOn:{keyup:function($event){if(!$event.type.indexOf("key")&&_vm._k($event.keyCode,"enter",13,$event.key,"Enter")){return null;}return _vm.getList({skipCount:1});}},model:{value:_vm.searchParams[_vm.keywordsKEY],callback:function($$v){_vm.$set(_vm.searchParams,_vm.keywordsKEY,typeof $$v==="string"?$$v.trim():$$v);},expression:"searchParams[keywordsKEY]"}},[_c("el-button",{attrs:{slot:"append",icon:"el-icon-search"},on:{click:function($event){return _vm.getList({skipCount:1});}},slot:"append"})],1):_vm._e(),_vm._v(" "),_c("el-divider",{attrs:{direction:"vertical"}}),_vm._v(" "),_c("el-button",{attrs:{size:"mini"},on:{click:_vm.actionModal}},[_c("svg",{staticClass:"icon",staticStyle:{color:"#10C2B0",cursor:"pointer"},attrs:{"aria-hidden":"true"}},[_c("use",{attrs:{"xlink:href":"#fontFamily-a-web20_shaixuanpeizhi"}})])])],1)]),_vm._v(" "),_c("div",{staticClass:"tagBox"},_vm._l(_vm.tags,function(tag){return _c("el-tag",{key:tag.name,attrs:{closable:"",type:"info"},on:{close:function($event){return _vm.closeTag(tag);}}},[_vm._v("\n "+_vm._s(tag.name+":"+tag.str)+"\n ")]);}),1),_vm._v(" "),_vm.tags.length>1?_c("el-button",{staticClass:"clearAll",on:{click:_vm.closeAllTag}},[_vm._v(_vm._s(_vm.trans("取消全部筛选")))]):_vm._e(),_vm._v(" "),_c("el-table",{directives:[{name:"loading",rawName:"v-loading",value:_vm.listLoading,expression:"listLoading"}],key:_vm.tableKey,ref:"FormTable",staticClass:"table",attrs:{data:_vm.list,"row-key":_vm.rowKey,border:"",fit:""},on:{"sort-change":function($event){return _vm.$emit("sortChange",$event);},"selection-change":_vm.handleSelectionChange,"header-dragend":_vm.dragHead}},[_vm.hasSelection?_c("el-table-column",{attrs:{type:"selection",width:"40",selectable:_vm.selectable}}):_vm._e(),_vm._v(" "),_vm.hasIndex?_c("el-table-column",{attrs:{label:_vm.trans("序号"),type:"index",width:"50"}}):_vm._e(),_vm._v(" "),_vm._t("additional"),_vm._v(" "),_vm._l(_vm.colDisplayFn(_vm.columnsShow),function(item){return _c("el-table-column",{key:item.columnCode,attrs:{label:item.columnPropertyName,fixed:item.isFixed==1&&"left","min-width":(item.defaultWidth||item.minWidth)+20,"show-overflow-tooltip":"",sortable:_vm.sortableList[item.columnProperty]||false,prop:item.columnProperty,align:"center"},scopedSlots:_vm._u([{key:"header",fn:function(ref){var column=ref.column;return[_c("span",[_vm._v(_vm._s(column.label))]),_vm._v(" "),_vm.$scopedSlots[item.columnProperty+"Header"]?_c("span",[_c("tips",[_vm._t(item.columnProperty+"Header")],2)],1):_vm._e(),_vm._v(" "),item.queryConfig&&item.queryConfig.type&&item.isQuery?_c(item.queryConfig.type,{tag:"component",attrs:{config:item.queryConfig,column:item,setFormParams:_vm.setFormParams,ops:_vm.ops,getConfig:_vm.getConfig,ruleFn:_vm.ruleFn[item.columnProperty]}}):_vm._e()];}},{key:"default",fn:function(ref){var row=ref.row;return[_vm.$scopedSlots[item.columnProperty]?_c("span",[_vm._t(item.columnProperty,null,{props:row,queryConfig:item.queryConfig,options:_vm.getConfig(item),label:_vm.getLabel(item,row)})],2):_c("span",[_vm._v(_vm._s(_vm.getLabel(item,row)))])];}}],null,true)});}),_vm._v(" "),_vm.$scopedSlots.actionBtn?_c("el-table-column",{attrs:{label:_vm.trans("操作"),align:"center",width:_vm.actionWidth,"class-name":"small-padding",fixed:"right"},scopedSlots:_vm._u([{key:"default",fn:function(ref){var row=ref.row;return[_vm._t("actionBtn",null,{props:row})];}}],null,true)}):_vm._e()],2),_vm._v(" "),_c("div",{staticClass:"btmBox"},[_c("div",{staticClass:"btmLeft"},[_vm._t("btmLeft")],2),_vm._v(" "),_c("pagination",{directives:[{name:"show",rawName:"v-show",value:_vm.count>0,expression:"count > 0"}],staticClass:"text-right mt-0 pagi",attrs:{autoScroll:_vm.isAutoScroll,total:_vm.count,page:_vm.searchParams.skipCount,limit:_vm.searchParams.pageSize},on:{"update:page":function($event){return _vm.$set(_vm.searchParams,"skipCount",$event);},"update:limit":function($event){return _vm.$set(_vm.searchParams,"pageSize",$event);},pagination:_vm.getList}})],1),_vm._v(" "),_vm.columns.length>0?_c("select-col",{attrs:{saveMyTemplateColumns:_vm.saveMyTemplateColumns,templateKey:_vm.templateKey,getNewCol:_vm.getNewCol,initialColumns:_vm.columns,columnsShow:_vm.columnsShow,visible:_vm.dialogFormVisible},on:{"update:visible":function($event){_vm.dialogFormVisible=$event;}}}):_vm._e()],1);};var __vue_staticRenderFns__$1=[];__vue_render__$1._withStripped=true;/* style */const __vue_inject_styles__$1=function(inject){if(!inject)return;inject("data-v-ab71023a_0",{source:"\n.el-table__empty-block {\n background: #fbfbfb;\n}\n",map:{"version":3,"sources":["/Users/chenlei/HLcode/test/components/FormTableScheme/index.vue"],"names":[],"mappings":";AAsdA;IACA,mBAAA;AACA","file":"index.vue","sourcesContent":["<template>\n <div class=\"container\">\n <div class=\"optBox\">\n <div class=\"leftBtn\">\n <slot name=\"leftBtn\"></slot>\n </div>\n <div class=\"rightBtn\">\n <el-input v-if=\"hasSearch\" v-show=\"searchType == 'textarea'\" type=\"textarea\" @keyup.enter.native=\"getList({ skipCount: 1 })\"\n :placeholder=\"searchPlaceholder || trans('请输入内容')\" :class=\"{ 'input-with-select': true, textareaSpec:searchType == 'textarea' }\"\n v-model.trim=\"searchParams[keywordsKEY]\" \n @blur=\"changeType(0)\" :rows=\"10\" ref=\"myTextarea\" >\n <el-button slot=\"append\" icon=\"el-icon-search\" @click=\"getList({ skipCount: 1 })\"></el-button>\n </el-input>\n <el-input v-if=\"hasSearch\" v-show=\"searchType == 'text'\" @keyup.enter.native=\"getList({ skipCount: 1 })\"\n :placeholder=\"searchPlaceholder || trans('请输入内容')\" class=\"input-with-select\"\n v-model.trim=\"searchParams[keywordsKEY]\" @focus=\"changeType(1)\" >\n <el-button slot=\"append\" icon=\"el-icon-search\" @click=\"getList({ skipCount: 1 })\"></el-button>\n </el-input>\n <el-divider direction=\"vertical\"></el-divider>\n <el-button size=\"mini\" @click=\"actionModal\">\n <svg class=\"icon\" aria-hidden=\"true\" style=\"color:#10C2B0;cursor:pointer;\">\n <use xlink:href=\"#fontFamily-a-web20_shaixuanpeizhi\"></use>\n </svg>\n </el-button>\n </div> \n </div>\n\n <div class=\"tagBox\">\n <el-tag v-for=\"tag in tags\" :key=\"tag.name\" closable @close=\"closeTag(tag)\" type=\"info\">\n {{ `${tag.name}:${tag.str}` }}\n </el-tag>\n </div>\n <el-button class=\"clearAll\" v-if=\"tags.length > 1\" @click=\"closeAllTag\">{{ trans('取消全部筛选') }}</el-button>\n <el-table ref=\"FormTable\" v-loading=\"listLoading\" :data=\"list\" :row-key=\"rowKey\" border fit\n @sort-change=\"$emit('sortChange', $event)\" @selection-change=\"handleSelectionChange\" @header-dragend=\"dragHead\"\n class=\"table\" :key=\"tableKey\">\n <el-table-column v-if=\"hasSelection\" type=\"selection\" width=\"40\" :selectable=\"selectable\">\n </el-table-column>\n <el-table-column v-if=\"hasIndex\" :label=\"trans('序号')\" type=\"index\" width=\"50\">\n </el-table-column>\n <slot name=\"additional\"></slot>\n <el-table-column v-for=\"(item) in colDisplayFn(columnsShow)\" :key=\"item.columnCode\"\n :label=\"item.columnPropertyName\" :fixed=\"(item.isFixed == 1) && 'left'\"\n :min-width=\"(item.defaultWidth || item.minWidth) + 20\" show-overflow-tooltip\n :sortable=\"sortableList[item.columnProperty] || false\" :prop=\"item.columnProperty\" align=\"center\">\n <template slot=\"header\" slot-scope=\"{column}\">\n\n <span>{{ column.label }}</span>\n <span v-if=\"$scopedSlots[`${item.columnProperty}Header`]\">\n <tips>\n <slot :name=\"`${item.columnProperty}Header`\"></slot>\n </tips>\n </span>\n <component v-if=\"item.queryConfig && item.queryConfig.type && item.isQuery\"\n v-bind:is=\"item.queryConfig.type\" :config=\"item.queryConfig\" :column=\"item\"\n :setFormParams=\"setFormParams\" :ops=\"ops\" :getConfig=\"getConfig\" :ruleFn=\"ruleFn[item.columnProperty]\"></component>\n </template>\n <template slot-scope=\"{ row }\">\n <span v-if=\"$scopedSlots[item.columnProperty]\">\n <slot :name=\"item.columnProperty\" :props=\"row\" :queryConfig=\"item.queryConfig\" \n :options=\"getConfig(item)\"\n :label=\"getLabel(item, row)\"></slot>\n </span>\n <span v-else>{{ getLabel(item, row) }}</span>\n </template>\n </el-table-column>\n <el-table-column :label=\"trans('操作')\" align=\"center\" :width=\"actionWidth\" class-name=\"small-padding\"\n v-if=\"$scopedSlots.actionBtn\" fixed=\"right\">\n <template slot-scope=\"{ row }\">\n <slot name=\"actionBtn\" :props=\"row\">\n\n </slot>\n </template>\n </el-table-column>\n </el-table>\n <div class=\"btmBox\">\n <div class=\"btmLeft\">\n <slot name=\"btmLeft\"></slot>\n </div>\n <pagination v-show=\"count > 0\" :autoScroll=\"isAutoScroll\" class=\"text-right mt-0 pagi\" :total=\"count\"\n :page.sync=\"searchParams.skipCount\" :limit.sync=\"searchParams.pageSize\" @pagination=\"getList\" />\n </div>\n\n <select-col v-if=\"columns.length > 0\" :saveMyTemplateColumns=\"saveMyTemplateColumns\" :templateKey=\"templateKey\"\n :getNewCol=\"getNewCol\" :initialColumns=\"columns\" :columnsShow=\"columnsShow\"\n :visible.sync=\"dialogFormVisible\"></select-col>\n\n </div>\n</template>\n<script>\n/**\n * 表格\n * fetchParam {object} 请求参数\n * countNum {number} 数据总数 用法:countNum.sync=\"count\"\n * getApi {function} 请求接口\n * formatData {function} 返回参数格式化\n * sortChange {function} 排序事件函数\n * setHeight {string || number} 表格高度\n * selectcheck {function} 选择监听\n * selectable { function } checkbox 筛选禁用\n */\n\nimport { SelectCol, Check, Date, Inputsp, DateRange, Tips, pageTemplatecs, Radio, InputScope, Selectsp } from './component/index'\nimport Pagination from '@/components/Pagination';\nimport formatSwitch from './format';\nimport formToValue from './component/ColHeader/dataFormat'\nimport trans from '../lang/trans'\nimport getOptions from './component/utils'\nexport default {\n name: 'FormTableScheme',\n components: { SelectCol, Check, Date, Inputsp, Pagination, DateRange, Tips, Radio, InputScope, Selectsp },\n model: {\n event: 'sortChange'\n },\n data() {\n return {\n trans,\n dialogFormVisible: false,\n formatSwitch,\n list: [],\n saveMyTemplateColumns: this.requestFn.pageTemplatecs.saveMyTemplateColumns,\n columns: [],\n columnsShow: [],\n checkList: ['复选框 A'],\n tags: [],\n count: this.countNum,\n keywords: this.keywords,\n searchParams: {\n ...this.fetchParam,\n [this.keywordsKEY]: '',\n pageSize: 20,\n skipCount: 1\n },\n listLoading: false,\n ops: {},\n multipleSelection: [],\n tableKey: 'first',\n searchType:'text',\n }\n },\n watch: {\n fetchParam: {\n deep: true,\n immediate: true,\n handler() {\n this.searchParams = {\n ...this.searchParams,\n ...this.fetchParam\n }\n }\n },\n },\n props: {\n bigSearch:{\n default: false,\n type: Boolean\n },\n fetchParam: { // 上传时附带的参数\n default: () => {\n return {}\n },\n type: Object\n },\n hasSearch: {\n default: true,\n type: Boolean\n },\n rowKey: {\n default: 'columnProperty',\n type: String\n },\n countNum: { // 总数\n default: 0,\n type: Number\n },\n formatData: Function,\n isAutoScroll: {\n default: true,\n type: Boolean\n },\n setHeight: {\n default: '',\n type: String\n },\n getApi: Function,\n hooks: {\n default: () => {\n\n },\n type: Function\n },\n columnsApi: Function,\n requestFn: {\n default: () => {\n return pageTemplatecs\n },\n type: Object\n },\n templateKey: String,\n selectcheck: Function,\n selectType: String,\n hasSelection: Boolean,\n hasIndex: {\n type: Boolean,\n default: false\n },\n selectable: Function,\n searchPlaceholder: String,\n actionWidth: {\n type: String,\n default: '100'\n },\n keywordsKEY: {\n type: String,\n default: 'keywords'\n },\n ruleFn: {\n type: Object,\n default: function () {\n return {}\n },\n },\n colDisplayFn: {\n type: Function,\n default: function (col) {\n return col\n }\n },\n sortableList: {\n type: Object,\n default: function () {\n return {}\n },\n },\n isInitQuest: {\n type: Boolean,\n default: true\n }\n },\n setup() {\n\n },\n created() {\n // document.addEventListener('keyup', this.enter)\n },\n destroyed() {\n // document.removeEventListener('keyup', this.enter)\n },\n mounted() {\n this.changePG()\n },\n activated() {\n this.$refs.FormTable.doLayout()\n },\n methods: {\n getConfig(item){\n return getOptions(item,this.ruleFn)\n },\n getLabel(item, row){\n let config = getOptions(item,this.ruleFn)\n return this.formatSwitch(config,row)\n },\n changeType(type){\n if(!bigSearch) return;\n this.searchType = type == 1 ? 'textarea':'text';\n if(type == 1){\n this.$nextTick(() => {\n this.$refs.myTextarea.focus();\n })\n } \n },\n dragHead(newWidth, oldWidth, column, event) {\n const findColumn = this.columnsShow.find(c => c.columnPropertyName == column.label)\n let formatWidth = Math.ceil(newWidth)\n this.requestFn.pageTemplatecs.saveMyTemplateColumnWidth({ templateKey: this.templateKey, columnCode: findColumn.columnCode, width: formatWidth }).then((response) => {\n })\n },\n changePG(pages) {\n this.requestFn.pageTemplatecs.selectUserTemplateColumns({ templateKey: this.templateKey }).then((response) => {\n if (response.result === 'success') {\n this.columns = response.data.map((i) => {\n if (i.queryConfig) {\n i.queryConfig = JSON.parse(i.queryConfig)\n }\n return i\n })\n }\n })\n this.requestFn.pageTemplatecs.selectMyTableColumns({ templateKey: this.templateKey }).then((response) => {\n if (response.result === 'success') {\n this.columnsShow = response.data.map((i) => {\n if (i.queryConfig) {\n i.queryConfig = JSON.parse(i.queryConfig)\n }\n return i\n })\n this.$nextTick(() => {\n if (this.isInitQuest) {\n this.getList()\n }\n })\n }\n })\n\n },\n setFormParams(obj, type = 'add') {\n if (type == 'add') {\n this.searchParams = {\n ...this.searchParams,\n ...obj,\n }\n } else {\n for (let key in obj) {\n delete this.searchParams[key]\n }\n }\n\n this.$nextTick(() => {\n this.getList({\n skipCount: 1,\n });\n })\n },\n enter(e) {\n if ((e.key === 'Enter' || e.keyCode === 13)) {\n console.log('enter')\n }\n },\n getList(params, isClearParams = false) {\n let searchParams\n if (isClearParams) {\n searchParams = {\n ...params,\n pageSize: this.searchParams.pageSize,\n skipCount: 1,\n }\n } else {\n searchParams = {\n ...this.searchParams,\n ...params,\n }\n }\n\n\n this.searchParams = searchParams;\n\n\n // 处理数据\n let ops = {};\n for (var key in searchParams) {\n if (searchParams[key] !== '' && searchParams[key] !== null && searchParams[key] !== undefined) {\n ops[key] = searchParams[key]\n }\n }\n // 根据参数画tag\n formToValue(ops, this.columnsShow, this.colChange, this.ruleFn)\n\n\n\n const { pageSize, skipCount } = ops\n\n this.listLoading = true\n this.hooks(ops)\n this.getApi({\n ...ops,\n pageSize: pageSize,\n skipCount: (skipCount - 1) * pageSize,\n reqTypeSign:'config_table'\n }).then(response => {\n if (response.result === 'success') {\n if (this.formatData) {\n this.list = this.formatData(response.data)\n } else {\n this.list = response.data\n }\n this.ops = ops\n this.count = response.count\n } else {\n this.$message.error(response.msg)\n }\n this.$emit('update:countNum', this.count)\n this.listLoading = false\n }, err => {\n this.listLoading = false\n })\n },\n handleSelectionChange(val) {\n let formatVal = val\n if (this.selectType === 'single') {\n formatVal = [val.pop()]\n let other = val\n if (other && other.length > 0) {\n other.forEach(row => {\n this.$refs.FormTable.toggleRowSelection(row, false);\n });\n this.$refs.FormTable.toggleRowSelection(formatVal[0], true);\n }\n }\n this.selectcheck(formatVal)\n this.multipleSelection = formatVal;\n this.$emit('selectcheck', formatVal)\n },\n getNewCol(show, all) {\n this.columnsShow = show\n this.columns = all\n this.tableKey = Math.random() // table不刷新 强制key\n\n },\n closeTag(tag) {\n const index = this.tags.findIndex(i => i.name === tag.name)\n const delItem = this.tags.splice(index, 1)[0];\n const { key, type } = delItem\n if (type === 'dateRange' || type === 'inputScope') {\n this.setFormParams({ [key[0]]: '', [key[1]]: '' }, 'remove')\n } else {\n this.setFormParams({ [key]: '' }, 'remove')\n }\n\n },\n closeAllTag() {\n const delKeys = {}\n this.tags.forEach((i) => {\n const { key, type } = i\n if (type === 'dateRange' || type === 'inputScope') {\n delKeys[key[0]] = ''\n delKeys[key[1]] = ''\n } else {\n delKeys[key] = ''\n }\n })\n this.tags = [];\n this.setFormParams({ ...delKeys }, 'remove')\n },\n colChange(objTags) {\n // const selectIndex =this.tags.findIndex(i => i.name === arrow)\n // if(selectIndex >= 0){\n // let select = this.tags[selectIndex]\n // if(data.value.length > 0){\n // select.value = data.value\n // select.str = data.str\n // this.$set(this.tags, selectIndex, select)\n // } else {\n // this.tags.splice(selectIndex,1)\n // }\n\n // } else {\n // this.tags = this.tags.concat([{'name':arrow, value:data.value, str:data.str, key:data.searchKey, type: data.type }])\n // }\n const arr = []\n for (let key in objTags) {\n arr.push(objTags[key])\n }\n\n this.tags = [].concat(arr)\n\n },\n\n actionModal() {\n this.dialogFormVisible = true\n this.columns;\n this.columns = this.columns.map((i) => {\n const isSelect = this.columnsShow.find(j => j.columnPropertyName === i.columnPropertyName)\n i.show = !!isSelect;\n return i\n })\n },\n }\n}\n</script>\n<style>\n.el-table__empty-block {\n background: #fbfbfb;\n}\n</style>\n<style lang=\"less\" scoped>\n.container {\n padding: 15px;\n margin: 0px;\n width: 100%;\n background: #fff;\n float: left;\n}\n\n.input-with-select {\n width: 300px;\n}\n\n.optBox {\n margin-bottom: 10px;\n overflow:hidden;\n}\n\n.leftBtn {\n float: left;\n}\n\n.rightBtn {\n float: right;\n .textareaSpec{\n position: absolute;\n right:100px;\n z-index: 1000;\n width:700px;\n height: 400px;\n // transition: all 1s ease-out;\n }\n .border {\n border: 1px solid rgb(220, 223, 230)\n }\n}\n\n.tagBox {\n width: calc(100% - 140px);\n float: left;\n overflow: hidden;\n >.el-tag {\n margin: 4px 10px 0 0;\n }\n}\n\n.clearAll {\n float: right;\n}\n\n.table {\n width: 100%;\n margin-top: 10px;\n float: left;\n // overflow-x: visible;\n // overflow-y: visible;\n // /deep/ .el-table__header-wrapper{\n // position: sticky;\n // top:84px;\n // z-index:5;\n // }\n // /deep/ .el-table__fixed-header-wrapper{\n // z-index:5;\n // }\n}\n\n.pagi {\n float: right;\n}\n\n.pagi.pagination-container {\n padding: 0px;\n padding-top: 20px;\n}\n\n.btmBox {\n width: 100%;\n float: left;\n display: flex;\n justify-content: space-between;\n}\n</style>"]},media:undefined}),inject("data-v-ab71023a_1",{source:".container[data-v-ab71023a] {\n padding: 15px;\n margin: 0px;\n width: 100%;\n background: #fff;\n float: left;\n}\n.input-with-select[data-v-ab71023a] {\n width: 300px;\n}\n.optBox[data-v-ab71023a] {\n margin-bottom: 10px;\n overflow: hidden;\n}\n.leftBtn[data-v-ab71023a] {\n float: left;\n}\n.rightBtn[data-v-ab71023a] {\n float: right;\n}\n.rightBtn .textareaSpec[data-v-ab71023a] {\n position: absolute;\n right: 100px;\n z-index: 1000;\n width: 700px;\n height: 400px;\n}\n.rightBtn .border[data-v-ab71023a] {\n border: 1px solid #dcdfe6;\n}\n.tagBox[data-v-ab71023a] {\n width: calc(100% - 140px);\n float: left;\n overflow: hidden;\n}\n.tagBox > .el-tag[data-v-ab71023a] {\n margin: 4px 10px 0 0;\n}\n.clearAll[data-v-ab71023a] {\n float: right;\n}\n.table[data-v-ab71023a] {\n width: 100%;\n margin-top: 10px;\n float: left;\n}\n.pagi[data-v-ab71023a] {\n float: right;\n}\n.pagi.pagination-container[data-v-ab71023a] {\n padding: 0px;\n padding-top: 20px;\n}\n.btmBox[data-v-ab71023a] {\n width: 100%;\n float: left;\n display: flex;\n justify-content: space-between;\n}\n",map:{"version":3,"sources":["index.vue"],"names":[],"mappings":"AAAA;EACE,aAAa;EACb,WAAW;EACX,WAAW;EACX,gBAAgB;EAChB,WAAW;AACb;AACA;EACE,YAAY;AACd;AACA;EACE,mBAAmB;EACnB,gBAAgB;AAClB;AACA;EACE,WAAW;AACb;AACA;EACE,YAAY;AACd;AACA;EACE,kBAAkB;EAClB,YAAY;EACZ,aAAa;EACb,YAAY;EACZ,aAAa;AACf;AACA;EACE,yBAAyB;AAC3B;AACA;EACE,yBAAyB;EACzB,WAAW;EACX,gBAAgB;AAClB;AACA;EACE,oBAAoB;AACtB;AACA;EACE,YAAY;AACd;AACA;EACE,WAAW;EACX,gBAAgB;EAChB,WAAW;AACb;AACA;EACE,YAAY;AACd;AACA;EACE,YAAY;EACZ,iBAAiB;AACnB;AACA;EACE,WAAW;EACX,WAAW;EACX,aAAa;EACb,8BAA8B;AAChC","file":"index.vue","sourcesContent":[".container {\n padding: 15px;\n margin: 0px;\n width: 100%;\n background: #fff;\n float: left;\n}\n.input-with-select {\n width: 300px;\n}\n.optBox {\n margin-bottom: 10px;\n overflow: hidden;\n}\n.leftBtn {\n float: left;\n}\n.rightBtn {\n float: right;\n}\n.rightBtn .textareaSpec {\n position: absolute;\n right: 100px;\n z-index: 1000;\n width: 700px;\n height: 400px;\n}\n.rightBtn .border {\n border: 1px solid #dcdfe6;\n}\n.tagBox {\n width: calc(100% - 140px);\n float: left;\n overflow: hidden;\n}\n.tagBox > .el-tag {\n margin: 4px 10px 0 0;\n}\n.clearAll {\n float: right;\n}\n.table {\n width: 100%;\n margin-top: 10px;\n float: left;\n}\n.pagi {\n float: right;\n}\n.pagi.pagination-container {\n padding: 0px;\n padding-top: 20px;\n}\n.btmBox {\n width: 100%;\n float: left;\n display: flex;\n justify-content: space-between;\n}\n"]},media:undefined});};/* scoped */const __vue_scope_id__$1="data-v-ab71023a";/* module identifier */const __vue_module_identifier__$1=undefined;/* functional template */const __vue_is_functional_template__$1=false;/* style inject SSR */ /* style inject shadow dom */const __vue_component__$1=/*#__PURE__*/normalizeComponent({render:__vue_render__$1,staticRenderFns:__vue_staticRenderFns__$1},__vue_inject_styles__$1,__vue_script__$1,__vue_scope_id__$1,__vue_is_functional_template__$1,__vue_module_identifier__$1,false,createInjector,undefined,undefined);__vue_component__$1.install=function(Vue){Vue.component(__vue_component__$1.name,__vue_component__$1);};/*!
|
|
2222
|
+
const arr=[];for(let key in objTags){arr.push(objTags[key]);}this.tags=[].concat(arr);},actionModal(){this.dialogFormVisible=true;this.columns;this.columns=this.columns.map(i=>{const isSelect=this.columnsShow.find(j=>j.columnPropertyName===i.columnPropertyName);i.show=!!isSelect;return i;});}}};/* script */const __vue_script__$1=script$1;/* template */var __vue_render__$1=function(){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c("div",{staticClass:"container"},[_c("div",{staticClass:"optBox"},[_c("div",{staticClass:"leftBtn"},[_vm._t("leftBtn")],2),_vm._v(" "),_c("div",{staticClass:"rightBtn"},[_vm.hasSearch?_c("el-input",{directives:[{name:"show",rawName:"v-show",value:_vm.searchType=="textarea",expression:"searchType == 'textarea'"}],ref:"myTextarea",class:{"input-with-select":true,textareaSpec:_vm.searchType=="textarea"},attrs:{type:"textarea",placeholder:_vm.searchPlaceholder||_vm.trans("请输入内容"),rows:10},on:{blur:function($event){return _vm.changeType(0);}},nativeOn:{keyup:function($event){if(!$event.type.indexOf("key")&&_vm._k($event.keyCode,"enter",13,$event.key,"Enter")){return null;}return _vm.getList({skipCount:1});}},model:{value:_vm.searchParams[_vm.keywordsKEY],callback:function($$v){_vm.$set(_vm.searchParams,_vm.keywordsKEY,typeof $$v==="string"?$$v.trim():$$v);},expression:"searchParams[keywordsKEY]"}},[_c("el-button",{attrs:{slot:"append",icon:"el-icon-search"},on:{click:function($event){return _vm.getList({skipCount:1});}},slot:"append"})],1):_vm._e(),_vm._v(" "),_vm.hasSearch?_c("el-input",{directives:[{name:"show",rawName:"v-show",value:_vm.searchType=="text",expression:"searchType == 'text'"}],staticClass:"input-with-select",attrs:{placeholder:_vm.searchPlaceholder||_vm.trans("请输入内容")},on:{focus:function($event){return _vm.changeType(1);}},nativeOn:{keyup:function($event){if(!$event.type.indexOf("key")&&_vm._k($event.keyCode,"enter",13,$event.key,"Enter")){return null;}return _vm.getList({skipCount:1});}},model:{value:_vm.searchParams[_vm.keywordsKEY],callback:function($$v){_vm.$set(_vm.searchParams,_vm.keywordsKEY,typeof $$v==="string"?$$v.trim():$$v);},expression:"searchParams[keywordsKEY]"}},[_c("el-button",{attrs:{slot:"append",icon:"el-icon-search"},on:{click:function($event){return _vm.getList({skipCount:1});}},slot:"append"})],1):_vm._e(),_vm._v(" "),_c("el-divider",{attrs:{direction:"vertical"}}),_vm._v(" "),_c("el-button",{attrs:{size:"mini"},on:{click:_vm.actionModal}},[_c("svg",{staticClass:"icon",staticStyle:{color:"#10C2B0",cursor:"pointer"},attrs:{"aria-hidden":"true"}},[_c("use",{attrs:{"xlink:href":"#fontFamily-a-web20_shaixuanpeizhi"}})])])],1)]),_vm._v(" "),_c("div",{staticClass:"tagBox"},_vm._l(_vm.tags,function(tag){return _c("el-tag",{key:tag.name,attrs:{closable:"",type:"info"},on:{close:function($event){return _vm.closeTag(tag);}}},[_vm._v("\n "+_vm._s(tag.name+":"+tag.str)+"\n ")]);}),1),_vm._v(" "),_vm.tags.length>1?_c("el-button",{staticClass:"clearAll",on:{click:_vm.closeAllTag}},[_vm._v(_vm._s(_vm.trans("取消全部筛选")))]):_vm._e(),_vm._v(" "),_c("el-table",{directives:[{name:"loading",rawName:"v-loading",value:_vm.listLoading,expression:"listLoading"}],key:_vm.tableKey,ref:"FormTable",staticClass:"table",attrs:{data:_vm.list,"row-key":_vm.rowKey,border:"",fit:""},on:{"sort-change":function($event){return _vm.$emit("sortChange",$event);},"selection-change":_vm.handleSelectionChange,"header-dragend":_vm.dragHead}},[_vm.hasSelection?_c("el-table-column",{attrs:{type:"selection",width:"50",selectable:_vm.selectable}}):_vm._e(),_vm._v(" "),_vm.hasIndex?_c("el-table-column",{attrs:{label:_vm.trans("序号"),type:"index",width:"50"}}):_vm._e(),_vm._v(" "),_vm._t("additional"),_vm._v(" "),_vm._l(_vm.colDisplayFn(_vm.columnsShow),function(item){return _c("el-table-column",{key:item.columnCode,attrs:{label:item.columnPropertyName,fixed:item.isFixed==1&&"left","min-width":(item.defaultWidth||item.minWidth)+20,"show-overflow-tooltip":"",sortable:_vm.sortableList[item.columnProperty]||false,prop:item.columnProperty,align:"center"},scopedSlots:_vm._u([{key:"header",fn:function(ref){var column=ref.column;return[_c("span",[_vm._v(_vm._s(column.label))]),_vm._v(" "),_vm.$scopedSlots[item.columnProperty+"Header"]?_c("span",[_c("tips",[_vm._t(item.columnProperty+"Header")],2)],1):_vm._e(),_vm._v(" "),item.queryConfig&&item.queryConfig.type&&item.isQuery?_c(item.queryConfig.type,{tag:"component",attrs:{config:item.queryConfig,column:item,setFormParams:_vm.setFormParams,ops:_vm.ops,getConfig:_vm.getConfig,ruleFn:_vm.ruleFn[item.columnProperty]}}):_vm._e()];}},{key:"default",fn:function(ref){var row=ref.row;return[_vm.$scopedSlots[item.columnProperty]?_c("span",[_vm._t(item.columnProperty,null,{props:row,queryConfig:item.queryConfig,options:_vm.getConfig(item),label:_vm.getLabel(item,row)})],2):_c("span",[_vm._v(_vm._s(_vm.getLabel(item,row)))])];}}],null,true)});}),_vm._v(" "),_vm.$scopedSlots.actionBtn?_c("el-table-column",{attrs:{label:_vm.trans("操作"),align:"center",width:_vm.actionWidth,"class-name":"small-padding",fixed:"right"},scopedSlots:_vm._u([{key:"default",fn:function(ref){var row=ref.row;return[_vm._t("actionBtn",null,{props:row})];}}],null,true)}):_vm._e()],2),_vm._v(" "),_c("div",{staticClass:"btmBox"},[_c("div",{staticClass:"btmLeft"},[_vm._t("btmLeft")],2),_vm._v(" "),_c("pagination",{directives:[{name:"show",rawName:"v-show",value:_vm.count>0,expression:"count > 0"}],staticClass:"text-right mt-0 pagi",attrs:{autoScroll:_vm.isAutoScroll,total:_vm.count,page:_vm.searchParams.skipCount,limit:_vm.searchParams.pageSize},on:{"update:page":function($event){return _vm.$set(_vm.searchParams,"skipCount",$event);},"update:limit":function($event){return _vm.$set(_vm.searchParams,"pageSize",$event);},pagination:_vm.getList}})],1),_vm._v(" "),_vm.columns.length>0?_c("select-col",{attrs:{saveMyTemplateColumns:_vm.saveMyTemplateColumns,templateKey:_vm.templateKey,getNewCol:_vm.getNewCol,initialColumns:_vm.columns,columnsShow:_vm.columnsShow,visible:_vm.dialogFormVisible},on:{"update:visible":function($event){_vm.dialogFormVisible=$event;}}}):_vm._e()],1);};var __vue_staticRenderFns__$1=[];__vue_render__$1._withStripped=true;/* style */const __vue_inject_styles__$1=function(inject){if(!inject)return;inject("data-v-7baace6f_0",{source:"\n.el-table__empty-block {\n background: #fbfbfb;\n}\n",map:{"version":3,"sources":["/Users/chenlei/HLcode/test/components/FormTableScheme/index.vue"],"names":[],"mappings":";AAsdA;IACA,mBAAA;AACA","file":"index.vue","sourcesContent":["<template>\n <div class=\"container\">\n <div class=\"optBox\">\n <div class=\"leftBtn\">\n <slot name=\"leftBtn\"></slot>\n </div>\n <div class=\"rightBtn\">\n <el-input v-if=\"hasSearch\" v-show=\"searchType == 'textarea'\" type=\"textarea\" @keyup.enter.native=\"getList({ skipCount: 1 })\"\n :placeholder=\"searchPlaceholder || trans('请输入内容')\" :class=\"{ 'input-with-select': true, textareaSpec:searchType == 'textarea' }\"\n v-model.trim=\"searchParams[keywordsKEY]\" \n @blur=\"changeType(0)\" :rows=\"10\" ref=\"myTextarea\" >\n <el-button slot=\"append\" icon=\"el-icon-search\" @click=\"getList({ skipCount: 1 })\"></el-button>\n </el-input>\n <el-input v-if=\"hasSearch\" v-show=\"searchType == 'text'\" @keyup.enter.native=\"getList({ skipCount: 1 })\"\n :placeholder=\"searchPlaceholder || trans('请输入内容')\" class=\"input-with-select\"\n v-model.trim=\"searchParams[keywordsKEY]\" @focus=\"changeType(1)\" >\n <el-button slot=\"append\" icon=\"el-icon-search\" @click=\"getList({ skipCount: 1 })\"></el-button>\n </el-input>\n <el-divider direction=\"vertical\"></el-divider>\n <el-button size=\"mini\" @click=\"actionModal\">\n <svg class=\"icon\" aria-hidden=\"true\" style=\"color:#10C2B0;cursor:pointer;\">\n <use xlink:href=\"#fontFamily-a-web20_shaixuanpeizhi\"></use>\n </svg>\n </el-button>\n </div> \n </div>\n\n <div class=\"tagBox\">\n <el-tag v-for=\"tag in tags\" :key=\"tag.name\" closable @close=\"closeTag(tag)\" type=\"info\">\n {{ `${tag.name}:${tag.str}` }}\n </el-tag>\n </div>\n <el-button class=\"clearAll\" v-if=\"tags.length > 1\" @click=\"closeAllTag\">{{ trans('取消全部筛选') }}</el-button>\n <el-table ref=\"FormTable\" v-loading=\"listLoading\" :data=\"list\" :row-key=\"rowKey\" border fit\n @sort-change=\"$emit('sortChange', $event)\" @selection-change=\"handleSelectionChange\" @header-dragend=\"dragHead\"\n class=\"table\" :key=\"tableKey\">\n <el-table-column v-if=\"hasSelection\" type=\"selection\" width=\"50\" :selectable=\"selectable\">\n </el-table-column>\n <el-table-column v-if=\"hasIndex\" :label=\"trans('序号')\" type=\"index\" width=\"50\">\n </el-table-column>\n <slot name=\"additional\"></slot>\n <el-table-column v-for=\"(item) in colDisplayFn(columnsShow)\" :key=\"item.columnCode\"\n :label=\"item.columnPropertyName\" :fixed=\"(item.isFixed == 1) && 'left'\"\n :min-width=\"(item.defaultWidth || item.minWidth) + 20\" show-overflow-tooltip\n :sortable=\"sortableList[item.columnProperty] || false\" :prop=\"item.columnProperty\" align=\"center\">\n <template slot=\"header\" slot-scope=\"{column}\">\n\n <span>{{ column.label }}</span>\n <span v-if=\"$scopedSlots[`${item.columnProperty}Header`]\">\n <tips>\n <slot :name=\"`${item.columnProperty}Header`\"></slot>\n </tips>\n </span>\n <component v-if=\"item.queryConfig && item.queryConfig.type && item.isQuery\"\n v-bind:is=\"item.queryConfig.type\" :config=\"item.queryConfig\" :column=\"item\"\n :setFormParams=\"setFormParams\" :ops=\"ops\" :getConfig=\"getConfig\" :ruleFn=\"ruleFn[item.columnProperty]\"></component>\n </template>\n <template slot-scope=\"{ row }\">\n <span v-if=\"$scopedSlots[item.columnProperty]\">\n <slot :name=\"item.columnProperty\" :props=\"row\" :queryConfig=\"item.queryConfig\" \n :options=\"getConfig(item)\"\n :label=\"getLabel(item, row)\"></slot>\n </span>\n <span v-else>{{ getLabel(item, row) }}</span>\n </template>\n </el-table-column>\n <el-table-column :label=\"trans('操作')\" align=\"center\" :width=\"actionWidth\" class-name=\"small-padding\"\n v-if=\"$scopedSlots.actionBtn\" fixed=\"right\">\n <template slot-scope=\"{ row }\">\n <slot name=\"actionBtn\" :props=\"row\">\n\n </slot>\n </template>\n </el-table-column>\n </el-table>\n <div class=\"btmBox\">\n <div class=\"btmLeft\">\n <slot name=\"btmLeft\"></slot>\n </div>\n <pagination v-show=\"count > 0\" :autoScroll=\"isAutoScroll\" class=\"text-right mt-0 pagi\" :total=\"count\"\n :page.sync=\"searchParams.skipCount\" :limit.sync=\"searchParams.pageSize\" @pagination=\"getList\" />\n </div>\n\n <select-col v-if=\"columns.length > 0\" :saveMyTemplateColumns=\"saveMyTemplateColumns\" :templateKey=\"templateKey\"\n :getNewCol=\"getNewCol\" :initialColumns=\"columns\" :columnsShow=\"columnsShow\"\n :visible.sync=\"dialogFormVisible\"></select-col>\n\n </div>\n</template>\n<script>\n/**\n * 表格\n * fetchParam {object} 请求参数\n * countNum {number} 数据总数 用法:countNum.sync=\"count\"\n * getApi {function} 请求接口\n * formatData {function} 返回参数格式化\n * sortChange {function} 排序事件函数\n * setHeight {string || number} 表格高度\n * selectcheck {function} 选择监听\n * selectable { function } checkbox 筛选禁用\n */\n\nimport { SelectCol, Check, Date, Inputsp, DateRange, Tips, pageTemplatecs, Radio, InputScope, Selectsp } from './component/index'\nimport Pagination from '@/components/Pagination';\nimport formatSwitch from './format';\nimport formToValue from './component/ColHeader/dataFormat'\nimport trans from '../lang/trans'\nimport getOptions from './component/utils'\nexport default {\n name: 'FormTableScheme',\n components: { SelectCol, Check, Date, Inputsp, Pagination, DateRange, Tips, Radio, InputScope, Selectsp },\n model: {\n event: 'sortChange'\n },\n data() {\n return {\n trans,\n dialogFormVisible: false,\n formatSwitch,\n list: [],\n saveMyTemplateColumns: this.requestFn.pageTemplatecs.saveMyTemplateColumns,\n columns: [],\n columnsShow: [],\n checkList: ['复选框 A'],\n tags: [],\n count: this.countNum,\n keywords: this.keywords,\n searchParams: {\n ...this.fetchParam,\n [this.keywordsKEY]: '',\n pageSize: 20,\n skipCount: 1\n },\n listLoading: false,\n ops: {},\n multipleSelection: [],\n tableKey: 'first',\n searchType:'text',\n }\n },\n watch: {\n fetchParam: {\n deep: true,\n immediate: true,\n handler() {\n this.searchParams = {\n ...this.searchParams,\n ...this.fetchParam\n }\n }\n },\n },\n props: {\n bigSearch:{\n default: false,\n type: Boolean\n },\n fetchParam: { // 上传时附带的参数\n default: () => {\n return {}\n },\n type: Object\n },\n hasSearch: {\n default: true,\n type: Boolean\n },\n rowKey: {\n default: 'columnProperty',\n type: String\n },\n countNum: { // 总数\n default: 0,\n type: Number\n },\n formatData: Function,\n isAutoScroll: {\n default: true,\n type: Boolean\n },\n setHeight: {\n default: '',\n type: String\n },\n getApi: Function,\n hooks: {\n default: () => {\n\n },\n type: Function\n },\n columnsApi: Function,\n requestFn: {\n default: () => {\n return pageTemplatecs\n },\n type: Object\n },\n templateKey: String,\n selectcheck: Function,\n selectType: String,\n hasSelection: Boolean,\n hasIndex: {\n type: Boolean,\n default: false\n },\n selectable: Function,\n searchPlaceholder: String,\n actionWidth: {\n type: String,\n default: '100'\n },\n keywordsKEY: {\n type: String,\n default: 'keywords'\n },\n ruleFn: {\n type: Object,\n default: function () {\n return {}\n },\n },\n colDisplayFn: {\n type: Function,\n default: function (col) {\n return col\n }\n },\n sortableList: {\n type: Object,\n default: function () {\n return {}\n },\n },\n isInitQuest: {\n type: Boolean,\n default: true\n }\n },\n setup() {\n\n },\n created() {\n // document.addEventListener('keyup', this.enter)\n },\n destroyed() {\n // document.removeEventListener('keyup', this.enter)\n },\n mounted() {\n this.changePG()\n },\n activated() {\n this.$refs.FormTable.doLayout()\n },\n methods: {\n getConfig(item){\n return getOptions(item,this.ruleFn)\n },\n getLabel(item, row){\n let config = getOptions(item,this.ruleFn)\n return this.formatSwitch(config,row)\n },\n changeType(type){\n if(!this.bigSearch) return;\n this.searchType = type == 1 ? 'textarea':'text';\n if(type == 1){\n this.$nextTick(() => {\n this.$refs.myTextarea.focus();\n })\n } \n },\n dragHead(newWidth, oldWidth, column, event) {\n const findColumn = this.columnsShow.find(c => c.columnPropertyName == column.label)\n let formatWidth = Math.ceil(newWidth)\n this.requestFn.pageTemplatecs.saveMyTemplateColumnWidth({ templateKey: this.templateKey, columnCode: findColumn.columnCode, width: formatWidth }).then((response) => {\n })\n },\n changePG(pages) {\n this.requestFn.pageTemplatecs.selectUserTemplateColumns({ templateKey: this.templateKey }).then((response) => {\n if (response.result === 'success') {\n this.columns = response.data.map((i) => {\n if (i.queryConfig) {\n i.queryConfig = JSON.parse(i.queryConfig)\n }\n return i\n })\n }\n })\n this.requestFn.pageTemplatecs.selectMyTableColumns({ templateKey: this.templateKey }).then((response) => {\n if (response.result === 'success') {\n this.columnsShow = response.data.map((i) => {\n if (i.queryConfig) {\n i.queryConfig = JSON.parse(i.queryConfig)\n }\n return i\n })\n this.$nextTick(() => {\n if (this.isInitQuest) {\n this.getList()\n }\n })\n }\n })\n\n },\n setFormParams(obj, type = 'add') {\n if (type == 'add') {\n this.searchParams = {\n ...this.searchParams,\n ...obj,\n }\n } else {\n for (let key in obj) {\n delete this.searchParams[key]\n }\n }\n\n this.$nextTick(() => {\n this.getList({\n skipCount: 1,\n });\n })\n },\n enter(e) {\n if ((e.key === 'Enter' || e.keyCode === 13)) {\n console.log('enter')\n }\n },\n getList(params, isClearParams = false) {\n let searchParams\n if (isClearParams) {\n searchParams = {\n ...params,\n pageSize: this.searchParams.pageSize,\n skipCount: 1,\n }\n } else {\n searchParams = {\n ...this.searchParams,\n ...params,\n }\n }\n\n\n this.searchParams = searchParams;\n\n\n // 处理数据\n let ops = {};\n for (var key in searchParams) {\n if (searchParams[key] !== '' && searchParams[key] !== null && searchParams[key] !== undefined) {\n ops[key] = searchParams[key]\n }\n }\n // 根据参数画tag\n formToValue(ops, this.columnsShow, this.colChange, this.ruleFn)\n\n\n\n const { pageSize, skipCount } = ops\n\n this.listLoading = true\n this.hooks(ops)\n this.getApi({\n ...ops,\n pageSize: pageSize,\n skipCount: (skipCount - 1) * pageSize,\n reqTypeSign:'config_table'\n }).then(response => {\n if (response.result === 'success') {\n if (this.formatData) {\n this.list = this.formatData(response.data)\n } else {\n this.list = response.data || []\n }\n this.ops = ops\n this.count = response.count\n } else {\n this.$message.error(response.msg)\n }\n this.$emit('update:countNum', this.count)\n this.listLoading = false\n }, err => {\n this.listLoading = false\n })\n },\n handleSelectionChange(val) {\n let formatVal = val\n if (this.selectType === 'single') {\n formatVal = [val.pop()]\n let other = val\n if (other && other.length > 0) {\n other.forEach(row => {\n this.$refs.FormTable.toggleRowSelection(row, false);\n });\n this.$refs.FormTable.toggleRowSelection(formatVal[0], true);\n }\n }\n this.selectcheck(formatVal)\n this.multipleSelection = formatVal;\n this.$emit('selectcheck', formatVal)\n },\n getNewCol(show, all) {\n this.columnsShow = show\n this.columns = all\n this.tableKey = Math.random() // table不刷新 强制key\n\n },\n closeTag(tag) {\n const index = this.tags.findIndex(i => i.name === tag.name)\n const delItem = this.tags.splice(index, 1)[0];\n const { key, type } = delItem\n if (type === 'dateRange' || type === 'inputScope') {\n this.setFormParams({ [key[0]]: '', [key[1]]: '', [key[2]]: '' }, 'remove')\n } else {\n this.setFormParams({ [key]: '' }, 'remove')\n }\n\n },\n closeAllTag() {\n const delKeys = {}\n this.tags.forEach((i) => {\n const { key, type } = i\n if (type === 'dateRange' || type === 'inputScope') {\n delKeys[key[0]] = ''\n delKeys[key[1]] = ''\n } else {\n delKeys[key] = ''\n }\n })\n this.tags = [];\n this.setFormParams({ ...delKeys }, 'remove')\n },\n colChange(objTags) {\n // const selectIndex =this.tags.findIndex(i => i.name === arrow)\n // if(selectIndex >= 0){\n // let select = this.tags[selectIndex]\n // if(data.value.length > 0){\n // select.value = data.value\n // select.str = data.str\n // this.$set(this.tags, selectIndex, select)\n // } else {\n // this.tags.splice(selectIndex,1)\n // }\n\n // } else {\n // this.tags = this.tags.concat([{'name':arrow, value:data.value, str:data.str, key:data.searchKey, type: data.type }])\n // }\n const arr = []\n for (let key in objTags) {\n arr.push(objTags[key])\n }\n\n this.tags = [].concat(arr)\n\n },\n\n actionModal() {\n this.dialogFormVisible = true\n this.columns;\n this.columns = this.columns.map((i) => {\n const isSelect = this.columnsShow.find(j => j.columnPropertyName === i.columnPropertyName)\n i.show = !!isSelect;\n return i\n })\n },\n }\n}\n</script>\n<style>\n.el-table__empty-block {\n background: #fbfbfb;\n}\n</style>\n<style lang=\"less\" scoped>\n.container {\n padding: 15px;\n margin: 0px;\n width: 100%;\n background: #fff;\n float: left;\n}\n\n.input-with-select {\n width: 300px;\n}\n\n.optBox {\n margin-bottom: 10px;\n overflow:hidden;\n}\n\n.leftBtn {\n float: left;\n}\n\n.rightBtn {\n float: right;\n .textareaSpec{\n position: absolute;\n right:100px;\n z-index: 1000;\n width:700px;\n height: 400px;\n // transition: all 1s ease-out;\n }\n .border {\n border: 1px solid rgb(220, 223, 230)\n }\n}\n\n.tagBox {\n width: calc(100% - 140px);\n float: left;\n overflow: hidden;\n >.el-tag {\n margin: 4px 10px 0 0;\n }\n}\n\n.clearAll {\n float: right;\n}\n\n.table {\n width: 100%;\n margin-top: 10px;\n float: left;\n // overflow-x: visible;\n // overflow-y: visible;\n // /deep/ .el-table__header-wrapper{\n // position: sticky;\n // top:84px;\n // z-index:5;\n // }\n // /deep/ .el-table__fixed-header-wrapper{\n // z-index:5;\n // }\n}\n\n.pagi {\n float: right;\n}\n\n.pagi.pagination-container {\n padding: 0px;\n padding-top: 20px;\n}\n\n.btmBox {\n width: 100%;\n float: left;\n display: flex;\n justify-content: space-between;\n}\n</style>"]},media:undefined}),inject("data-v-7baace6f_1",{source:".container[data-v-7baace6f] {\n padding: 15px;\n margin: 0px;\n width: 100%;\n background: #fff;\n float: left;\n}\n.input-with-select[data-v-7baace6f] {\n width: 300px;\n}\n.optBox[data-v-7baace6f] {\n margin-bottom: 10px;\n overflow: hidden;\n}\n.leftBtn[data-v-7baace6f] {\n float: left;\n}\n.rightBtn[data-v-7baace6f] {\n float: right;\n}\n.rightBtn .textareaSpec[data-v-7baace6f] {\n position: absolute;\n right: 100px;\n z-index: 1000;\n width: 700px;\n height: 400px;\n}\n.rightBtn .border[data-v-7baace6f] {\n border: 1px solid #dcdfe6;\n}\n.tagBox[data-v-7baace6f] {\n width: calc(100% - 140px);\n float: left;\n overflow: hidden;\n}\n.tagBox > .el-tag[data-v-7baace6f] {\n margin: 4px 10px 0 0;\n}\n.clearAll[data-v-7baace6f] {\n float: right;\n}\n.table[data-v-7baace6f] {\n width: 100%;\n margin-top: 10px;\n float: left;\n}\n.pagi[data-v-7baace6f] {\n float: right;\n}\n.pagi.pagination-container[data-v-7baace6f] {\n padding: 0px;\n padding-top: 20px;\n}\n.btmBox[data-v-7baace6f] {\n width: 100%;\n float: left;\n display: flex;\n justify-content: space-between;\n}\n",map:{"version":3,"sources":["index.vue"],"names":[],"mappings":"AAAA;EACE,aAAa;EACb,WAAW;EACX,WAAW;EACX,gBAAgB;EAChB,WAAW;AACb;AACA;EACE,YAAY;AACd;AACA;EACE,mBAAmB;EACnB,gBAAgB;AAClB;AACA;EACE,WAAW;AACb;AACA;EACE,YAAY;AACd;AACA;EACE,kBAAkB;EAClB,YAAY;EACZ,aAAa;EACb,YAAY;EACZ,aAAa;AACf;AACA;EACE,yBAAyB;AAC3B;AACA;EACE,yBAAyB;EACzB,WAAW;EACX,gBAAgB;AAClB;AACA;EACE,oBAAoB;AACtB;AACA;EACE,YAAY;AACd;AACA;EACE,WAAW;EACX,gBAAgB;EAChB,WAAW;AACb;AACA;EACE,YAAY;AACd;AACA;EACE,YAAY;EACZ,iBAAiB;AACnB;AACA;EACE,WAAW;EACX,WAAW;EACX,aAAa;EACb,8BAA8B;AAChC","file":"index.vue","sourcesContent":[".container {\n padding: 15px;\n margin: 0px;\n width: 100%;\n background: #fff;\n float: left;\n}\n.input-with-select {\n width: 300px;\n}\n.optBox {\n margin-bottom: 10px;\n overflow: hidden;\n}\n.leftBtn {\n float: left;\n}\n.rightBtn {\n float: right;\n}\n.rightBtn .textareaSpec {\n position: absolute;\n right: 100px;\n z-index: 1000;\n width: 700px;\n height: 400px;\n}\n.rightBtn .border {\n border: 1px solid #dcdfe6;\n}\n.tagBox {\n width: calc(100% - 140px);\n float: left;\n overflow: hidden;\n}\n.tagBox > .el-tag {\n margin: 4px 10px 0 0;\n}\n.clearAll {\n float: right;\n}\n.table {\n width: 100%;\n margin-top: 10px;\n float: left;\n}\n.pagi {\n float: right;\n}\n.pagi.pagination-container {\n padding: 0px;\n padding-top: 20px;\n}\n.btmBox {\n width: 100%;\n float: left;\n display: flex;\n justify-content: space-between;\n}\n"]},media:undefined});};/* scoped */const __vue_scope_id__$1="data-v-7baace6f";/* module identifier */const __vue_module_identifier__$1=undefined;/* functional template */const __vue_is_functional_template__$1=false;/* style inject SSR */ /* style inject shadow dom */const __vue_component__$1=/*#__PURE__*/normalizeComponent({render:__vue_render__$1,staticRenderFns:__vue_staticRenderFns__$1},__vue_inject_styles__$1,__vue_script__$1,__vue_scope_id__$1,__vue_is_functional_template__$1,__vue_module_identifier__$1,false,createInjector,undefined,undefined);__vue_component__$1.install=function(Vue){Vue.component(__vue_component__$1.name,__vue_component__$1);};/*!
|
|
2223
2223
|
* html2canvas 1.4.1 <https://html2canvas.hertzen.com>
|
|
2224
2224
|
* Copyright (c) 2022 Niklas von Hertzen <https://hertzen.com>
|
|
2225
2225
|
* Released under MIT License
|
|
@@ -2564,4 +2564,4 @@ var myUrl=URL.createObjectURL(myBlob);// 创建a标签,下载图片
|
|
|
2564
2564
|
this.downImg(myUrl);},//base64 转 blob
|
|
2565
2565
|
dataURLtoBlob(dataurl){var arr=dataurl.split(',');var mime=arr[0].match(/:(.*?);/)[1];var bstr=atob(arr[1]),n=bstr.length,u8arr=new Uint8Array(n);while(n--){u8arr[n]=bstr.charCodeAt(n);}return new Blob([u8arr],{type:mime});},//下载图片 filename是图片名称
|
|
2566
2566
|
downImg(url){// 创建a标签 并设置其相关属性,最后触发其点击事件
|
|
2567
|
-
let a=document.createElement("a");let clickEvent=document.createEvent("MouseEvents");a.setAttribute("href",url);a.setAttribute("download",this.fileName);a.setAttribute("target",'_blank');clickEvent.initEvent('click',true,true);a.dispatchEvent(clickEvent);}}};/* script */const __vue_script__=script;/* template */var __vue_render__=function(){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c("div",{staticClass:"HtmlToImg"},[_c("div",{staticStyle:{position:"absolute",top:"-3000px"}},[_vm._t("default")],2)]);};var __vue_staticRenderFns__=[];__vue_render__._withStripped=true;/* style */const __vue_inject_styles__=undefined;/* scoped */const __vue_scope_id__=undefined;/* module identifier */const __vue_module_identifier__=undefined;/* functional template */const __vue_is_functional_template__=false;/* style inject */ /* style inject SSR */ /* style inject shadow dom */const __vue_component__=/*#__PURE__*/normalizeComponent({render:__vue_render__,staticRenderFns:__vue_staticRenderFns__},__vue_inject_styles__,__vue_script__,__vue_scope_id__,__vue_is_functional_template__,__vue_module_identifier__,false,undefined,undefined,undefined);__vue_component__.install=function(Vue){Vue.component(__vue_component__.name,__vue_component__);};var version="3.0.
|
|
2567
|
+
let a=document.createElement("a");let clickEvent=document.createEvent("MouseEvents");a.setAttribute("href",url);a.setAttribute("download",this.fileName);a.setAttribute("target",'_blank');clickEvent.initEvent('click',true,true);a.dispatchEvent(clickEvent);}}};/* script */const __vue_script__=script;/* template */var __vue_render__=function(){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c("div",{staticClass:"HtmlToImg"},[_c("div",{staticStyle:{position:"absolute",top:"-3000px"}},[_vm._t("default")],2)]);};var __vue_staticRenderFns__=[];__vue_render__._withStripped=true;/* style */const __vue_inject_styles__=undefined;/* scoped */const __vue_scope_id__=undefined;/* module identifier */const __vue_module_identifier__=undefined;/* functional template */const __vue_is_functional_template__=false;/* style inject */ /* style inject SSR */ /* style inject shadow dom */const __vue_component__=/*#__PURE__*/normalizeComponent({render:__vue_render__,staticRenderFns:__vue_staticRenderFns__},__vue_inject_styles__,__vue_script__,__vue_scope_id__,__vue_is_functional_template__,__vue_module_identifier__,false,undefined,undefined,undefined);__vue_component__.install=function(Vue){Vue.component(__vue_component__.name,__vue_component__);};var version="3.0.7";const components=[__vue_component__$g,__vue_component__$f,__vue_component__$e,__vue_component__$d,__vue_component__$1,__vue_component__];const install=function(Vue){components.forEach(component=>{Vue.component(component.name,component);});};if(typeof window!=="undefined"&&window.Vue){install(window.Vue);}var index={version,install};export{__vue_component__$1 as FormTableScheme,__vue_component__$f as HelloVue,__vue_component__ as HtmlToImg,__vue_component__$g as MyButton,__vue_component__$d as ShowFile,__vue_component__$e as UploadFile,index as default,install};
|