@huilian/components-tms 3.6.1 → 3.7.2
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 +45 -11
- package/package.json +1 -1
package/lib/bundle.esm.js
CHANGED
|
@@ -2275,19 +2275,53 @@ if(findRes&&findRes.isQuery){let config=getOptions(findRes,ruleFn);let{type,colu
|
|
|
2275
2275
|
// rule = ruleFn[columnProperty](newRule)
|
|
2276
2276
|
// }
|
|
2277
2277
|
let value,str;// dateRange 数据比较特殊 searchKey = [xxStart,xxEnd],所以值和str要特殊处理
|
|
2278
|
-
if(type==='dateRange'||type==='inputScope'){value=formatTable[type].formToValue(formValues,searchKey);str=formatTable[type].valueToStr(value,config);}else{value=formatTable[type].formToValue(formValues[key]);str=formatTable[type].valueToStr(value,config);}tagNeedCols[columnPropertyName]={name:columnPropertyName,value,str,key:searchKey,type};}}}callbackFn(tagNeedCols);return tagNeedCols;}
|
|
2279
|
-
|
|
2278
|
+
if(type==='dateRange'||type==='inputScope'){value=formatTable[type].formToValue(formValues,searchKey);str=formatTable[type].valueToStr(value,config);}else{value=formatTable[type].formToValue(formValues[key]);str=formatTable[type].valueToStr(value,config);}tagNeedCols[columnPropertyName]={name:columnPropertyName,value,str,key:searchKey,type};}}}callbackFn(tagNeedCols);return tagNeedCols;};/**
|
|
2279
|
+
* SelectKey 逻辑封装
|
|
2280
|
+
*/class SelectKeyManager{/**
|
|
2281
|
+
* 初始化校验函数,返回最终合法 value
|
|
2282
|
+
* @param {Object} options
|
|
2283
|
+
* @param {Array} options.selectKeyList - 下拉选项列表
|
|
2284
|
+
* @param {Object} options.fetchParam - 初始参数
|
|
2285
|
+
* @param {string} options.keywordsKEY - 默认的 keywords key
|
|
2286
|
+
* @returns {string|number}
|
|
2287
|
+
*/static initValue(options){const{selectKeyList,fetchParam,keywordsKEY}=options;// 列表为空或未定义,返回空字符串
|
|
2288
|
+
if(!selectKeyList||selectKeyList.length===0){return"";}// 1. 优先使用 fetchParam 中存在的 key
|
|
2289
|
+
// 遍历 selectKeyList,看哪个 value 在 fetchParam 中有值
|
|
2290
|
+
if(fetchParam){const hit=selectKeyList.find(item=>{const val=fetchParam[String(item.value)];return val!==undefined&&val!==null&&val!=="";});if(hit)return hit.value;}// 2. 其次尝试使用 keywordsKEY (如果它在列表中)
|
|
2291
|
+
const hasKeyword=selectKeyList.find(item=>item.value===keywordsKEY);if(hasKeyword)return keywordsKEY;// 3. 最后默认使用第一个
|
|
2292
|
+
return selectKeyList[0].value;}/**
|
|
2293
|
+
* 切换列表时的重置逻辑
|
|
2294
|
+
* @returns {string} 空字符串
|
|
2295
|
+
*/static resetOnListChange(){return"";}}//
|
|
2296
|
+
var script$3={name:"FormTableScheme",components:{SelectCol:__vue_component__$f,Check:__vue_component__$d,Date:__vue_component__$b,Inputsp:__vue_component__$9,Pagination,DateRange:__vue_component__$a,Tips:__vue_component__$8,Radio:__vue_component__$c,InputScope:__vue_component__$6,Selectsp:__vue_component__$5,Cascader:__vue_component__$4},model:{event:"sortChange"},data(){return{SelectKeyManager,trans,dialogFormVisible:false,formatSwitch,list:[],saveMyTemplateColumns:this.requestFn.pageTemplatecs.saveMyTemplateColumns,columns:[],columnsShow:[],checkList:["复选框 A"],tags:[],count:this.countNum,keywords:this.keywords,searchParams:{...this.fetchParam,[this.keywordsKEY]:"",pageSize:20,skipCount:1},listLoading:false,ops:{},multipleSelection:[],tableKey:"first",searchType:"text",selectKey:""};},watch:{fetchParam:{deep:true,immediate:true,handler(){this.searchParams={...this.searchParams,...this.fetchParam};this.initSelectKey();}},selectKeyList:{deep:true,immediate:true,handler(newList,oldList){// 如果是初始化(oldList undefined),走 initSelectKey
|
|
2297
|
+
// 如果是动态切换(newList !== oldList),走 reset
|
|
2298
|
+
// 但 immediate: true 会导致首次也触发 handler,此时 oldList 为 undefined
|
|
2299
|
+
// 实际上 mounted 也会调 initSelectKey (via changePG -> getList?)
|
|
2300
|
+
// 我们统一策略:
|
|
2301
|
+
// 1. 如果 selectKey 为空,或者列表变了需要重置,则处理
|
|
2302
|
+
// initSelectKey 内部已经判断了空值逻辑
|
|
2303
|
+
if(oldList===undefined){this.initSelectKey();}else{// 切换列表,清空并触发事件
|
|
2304
|
+
const prev=this.selectKey;this.selectKey=SelectKeyManager.resetOnListChange();this.$emit('selectKeyChange',{prev,current:this.selectKey,list:newList});}}}},props:{bigSearch:{default:false,type:Boolean},fetchParam:{// 上传时附带的参数
|
|
2280
2305
|
default:()=>{return{};},type:Object},hasSearch:{default:true,type:Boolean},rowKey:{default:"columnProperty",type:String},selectKeyList:{default:()=>{return[];},type:Array},countNum:{// 总数
|
|
2281
2306
|
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)
|
|
2282
2307
|
},destroyed(){// document.removeEventListener('keyup', this.enter)
|
|
2283
|
-
},mounted(){this.changePG();},activated(){this.$refs.FormTable.doLayout();},methods:{
|
|
2308
|
+
},mounted(){this.changePG();},activated(){this.$refs.FormTable.doLayout();},methods:{initSelectKey(){// 使用 SelectKeyManager 进行初始化
|
|
2309
|
+
this.selectKey=SelectKeyManager.initValue({selectKeyList:this.selectKeyList,fetchParam:this.fetchParam,keywordsKEY:this.keywordsKEY});},getCurrentKeywordsKey(){return this.selectKey||this.keywordsKEY;},handleSelectKeyChange(newKey){// 如果之前有值,需要将值转移到新的字段
|
|
2284
2310
|
if(this.searchParams[this.keywordsKEY]&&newKey!==this.keywordsKEY){this.searchParams[newKey]=this.searchParams[this.keywordsKEY];this.searchParams[this.keywordsKEY]="";}},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;// 处理数据
|
|
2285
|
-
let ops={};for(var key in searchParams){if(searchParams[key]!==""&&searchParams[key]!==null&&searchParams[key]!==undefined){ops[key]=searchParams[key];}}
|
|
2286
|
-
if(this.selectKeyList&&this.selectKeyList.length>0){//
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
allSelectKeys.
|
|
2311
|
+
let ops={};for(var key in searchParams){if(searchParams[key]!==""&&searchParams[key]!==null&&searchParams[key]!==undefined){ops[key]=searchParams[key];}}console.log(ops);// 确保使用正确的关键词字段,并删除其他在selectKeyList中的key值
|
|
2312
|
+
if(this.selectKeyList&&this.selectKeyList.length>0){// 在开始处理之前,再次调用 initSelectKey 以确保 selectKey 与当前的 ops 保持同步
|
|
2313
|
+
// 这一步至关重要,因为 ops 可能包含从 fetchParam 合并进来的新值,
|
|
2314
|
+
// 而 initSelectKey 依赖 this.fetchParam,可能还没来得及响应
|
|
2315
|
+
// 实际上 ops 才是最准确的参数来源
|
|
2316
|
+
const allSelectKeys=this.selectKeyList.map(item=>item.value);// 如果 selectKey 当前指向的值为空,但在 ops 中存在其他有效 key,
|
|
2317
|
+
// 应该先切换 selectKey,防止后续逻辑误删
|
|
2318
|
+
if(!ops[this.selectKey]){const activeKey=allSelectKeys.find(key=>ops[key]);if(activeKey){this.selectKey=activeKey;}}// 1. 如果有 keywordsKEY 的值,优先使用 keywordsKEY,并覆盖到当前 selectKey
|
|
2319
|
+
if(ops[this.keywordsKEY]){// 将 keywordsKEY 的值赋给 selectKey
|
|
2320
|
+
ops[this.selectKey]=ops[this.keywordsKEY];// 清除 keywordsKEY,避免重复
|
|
2321
|
+
if(this.selectKey!==this.keywordsKEY){delete ops[this.keywordsKEY];}}// 2. 检查当前 selectKey 是否有值
|
|
2322
|
+
// 如果没有值,尝试从其他 selectKeyList 中找到第一个有值的 key 切换过去
|
|
2323
|
+
if(!ops[this.selectKey]){const activeKey=allSelectKeys.find(key=>ops[key]);if(activeKey){this.selectKey=activeKey;}}// 3. 最终清理:只保留当前 selectKey 的值,清除 selectKeyList 中其他 key 的值
|
|
2324
|
+
allSelectKeys.forEach(key=>{if(key!==this.selectKey&&ops[key]){delete ops[key];}});}else if(this.selectKey&&this.selectKey!==this.keywordsKEY&&ops[this.keywordsKEY]){// 兼容原有逻辑
|
|
2291
2325
|
ops[this.selectKey]=ops[this.keywordsKEY];delete ops[this.keywordsKEY];}// 根据参数画tag
|
|
2292
2326
|
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;this.tableKey=Math.random();this.$refs.FormTable.doLayout();},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
|
|
2293
2327
|
},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");}},handleSelectAll(val){this.$emit("selectAll",Array.from(val));},handleSelect(selection,row){this.$emit("select",{selection,row});},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)
|
|
@@ -2303,7 +2337,7 @@ formToValue(ops,this.columnsShow,this.colChange,this.ruleFn);const{pageSize,skip
|
|
|
2303
2337
|
// } else {
|
|
2304
2338
|
// this.tags = this.tags.concat([{'name':arrow, value:data.value, str:data.str, key:data.searchKey, type: data.type }])
|
|
2305
2339
|
// }
|
|
2306
|
-
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__$3=script$3;/* template */var __vue_render__$3=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.getCurrentKeywordsKey()],callback:function($$v){_vm.$set(_vm.searchParams,_vm.getCurrentKeywordsKey(),typeof $$v==="string"?$$v.trim():$$v);},expression:"searchParams[getCurrentKeywordsKey()]"}},[_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'"}],class:{"input-with-select":true,width400:_vm.selectKeyList.length>0},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.getCurrentKeywordsKey()],callback:function($$v){_vm.$set(_vm.searchParams,_vm.getCurrentKeywordsKey(),typeof $$v==="string"?$$v.trim():$$v);},expression:"searchParams[getCurrentKeywordsKey()]"}},[_vm.selectKeyList.length>0?_c("el-select",{staticStyle:{width:"120px"},attrs:{slot:"prepend",placeholder:"请选择"},on:{change:_vm.handleSelectKeyChange},slot:"prepend",model:{value:_vm.selectKey,callback:function($$v){_vm.selectKey=$$v;},expression:"selectKey"}},_vm._l(_vm.selectKeyList,function(item){return _c("el-option",{key:item.value,attrs:{label:item.label,value:item.value}});}),1):_vm._e(),_vm._v(" "),_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);}}},[_c("div",{staticClass:"tagItem"},[_vm._v(_vm._s(tag.name+":"+tag.str))])]);}),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,"select-all":_vm.handleSelectAll,select:_vm.handleSelect}},[_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__$3=[];__vue_render__$3._withStripped=true;/* style */const __vue_inject_styles__$3=function(inject){if(!inject)return;inject("data-v-2e1086c8_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":";AAkqBA;EACA,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\n v-if=\"hasSearch\"\n v-show=\"searchType == 'textarea'\"\n type=\"textarea\"\n @keyup.enter.native=\"getList({ skipCount: 1 })\"\n :placeholder=\"searchPlaceholder || trans('请输入内容')\"\n :class=\"{\n 'input-with-select': true,\n textareaSpec: searchType == 'textarea',\n }\"\n v-model.trim=\"searchParams[getCurrentKeywordsKey()]\"\n @blur=\"changeType(0)\"\n :rows=\"10\"\n ref=\"myTextarea\"\n >\n <el-button\n slot=\"append\"\n icon=\"el-icon-search\"\n @click=\"getList({ skipCount: 1 })\"\n ></el-button>\n </el-input>\n <el-input\n v-if=\"hasSearch\"\n v-show=\"searchType == 'text'\"\n @keyup.enter.native=\"getList({ skipCount: 1 })\"\n :placeholder=\"searchPlaceholder || trans('请输入内容')\"\n :class=\"{\n 'input-with-select': true,\n width400: selectKeyList.length > 0,\n }\"\n v-model.trim=\"searchParams[getCurrentKeywordsKey()]\"\n @focus=\"changeType(1)\"\n >\n <el-select\n v-model=\"selectKey\"\n slot=\"prepend\"\n placeholder=\"请选择\"\n v-if=\"selectKeyList.length > 0\"\n style=\"width: 120px\"\n @change=\"handleSelectKeyChange\"\n >\n <el-option\n v-for=\"item in selectKeyList\"\n :key=\"item.value\"\n :label=\"item.label\"\n :value=\"item.value\"\n ></el-option>\n </el-select>\n <el-button\n slot=\"append\"\n icon=\"el-icon-search\"\n @click=\"getList({ skipCount: 1 })\"\n ></el-button>\n </el-input>\n <el-divider direction=\"vertical\"></el-divider>\n <el-button size=\"mini\" @click=\"actionModal\">\n <svg\n class=\"icon\"\n aria-hidden=\"true\"\n style=\"color: #10c2b0; cursor: pointer\"\n >\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\n v-for=\"tag in tags\"\n :key=\"tag.name\"\n closable\n @close=\"closeTag(tag)\"\n type=\"info\"\n >\n <div class=\"tagItem\">{{ `${tag.name}:${tag.str}` }}</div>\n </el-tag>\n </div>\n <el-button class=\"clearAll\" v-if=\"tags.length > 1\" @click=\"closeAllTag\">{{\n trans(\"取消全部筛选\")\n }}</el-button>\n <el-table\n ref=\"FormTable\"\n v-loading=\"listLoading\"\n :data=\"list\"\n :row-key=\"rowKey\"\n border\n fit\n @sort-change=\"$emit('sortChange', $event)\"\n @selection-change=\"handleSelectionChange\"\n @header-dragend=\"dragHead\"\n @select-all=\"handleSelectAll\"\n @select=\"handleSelect\"\n class=\"table\"\n :key=\"tableKey\"\n >\n <el-table-column\n v-if=\"hasSelection\"\n type=\"selection\"\n width=\"50\"\n :selectable=\"selectable\"\n >\n </el-table-column>\n <el-table-column\n v-if=\"hasIndex\"\n :label=\"trans('序号')\"\n type=\"index\"\n width=\"50\"\n >\n </el-table-column>\n <slot name=\"additional\"></slot>\n <el-table-column\n v-for=\"item in colDisplayFn(columnsShow)\"\n :key=\"item.columnCode\"\n :label=\"item.columnPropertyName\"\n :fixed=\"item.isFixed == 1 && 'left'\"\n :min-width=\"(item.defaultWidth || item.minWidth) + 20\"\n show-overflow-tooltip\n :sortable=\"sortableList[item.columnProperty] || false\"\n :prop=\"item.columnProperty\"\n align=\"center\"\n >\n <template slot=\"header\" slot-scope=\"{ column }\">\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\n v-if=\"item.queryConfig && item.queryConfig.type && item.isQuery\"\n v-bind:is=\"item.queryConfig.type\"\n :config=\"item.queryConfig\"\n :column=\"item\"\n :setFormParams=\"setFormParams\"\n :ops=\"ops\"\n :getConfig=\"getConfig\"\n :ruleFn=\"ruleFn[item.columnProperty]\"\n ></component>\n </template>\n <template slot-scope=\"{ row }\">\n <span v-if=\"$scopedSlots[item.columnProperty]\">\n <slot\n :name=\"item.columnProperty\"\n :props=\"row\"\n :queryConfig=\"item.queryConfig\"\n :options=\"getConfig(item)\"\n :label=\"getLabel(item, row)\"\n ></slot>\n </span>\n <span v-else>{{ getLabel(item, row) }}</span>\n </template>\n </el-table-column>\n <el-table-column\n :label=\"trans('操作')\"\n align=\"center\"\n :width=\"actionWidth\"\n class-name=\"small-padding\"\n v-if=\"$scopedSlots.actionBtn\"\n fixed=\"right\"\n >\n <template slot-scope=\"{ row }\">\n <slot name=\"actionBtn\" :props=\"row\"> </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\n v-show=\"count > 0\"\n :autoScroll=\"isAutoScroll\"\n class=\"text-right mt-0 pagi\"\n :total=\"count\"\n :page.sync=\"searchParams.skipCount\"\n :limit.sync=\"searchParams.pageSize\"\n @pagination=\"getList\"\n />\n </div>\n\n <select-col\n v-if=\"columns.length > 0\"\n :saveMyTemplateColumns=\"saveMyTemplateColumns\"\n :templateKey=\"templateKey\"\n :getNewCol=\"getNewCol\"\n :initialColumns=\"columns\"\n :columnsShow=\"columnsShow\"\n :visible.sync=\"dialogFormVisible\"\n ></select-col>\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 {\n SelectCol,\n Check,\n Date,\n Inputsp,\n DateRange,\n Tips,\n pageTemplatecs,\n Radio,\n InputScope,\n Selectsp,\n Cascader,\n} 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: {\n SelectCol,\n Check,\n Date,\n Inputsp,\n Pagination,\n DateRange,\n Tips,\n Radio,\n InputScope,\n Selectsp,\n Cascader,\n },\n model: {\n event: \"sortChange\",\n },\n data() {\n return {\n trans,\n dialogFormVisible: false,\n formatSwitch,\n list: [],\n saveMyTemplateColumns:\n 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 selectKey: (this.selectKeyList[0] && this.selectKeyList[0].value) || \"\",\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 // 上传时附带的参数\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 selectKeyList: {\n default: () => {\n return [];\n },\n type: Array,\n },\n countNum: {\n // 总数\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 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 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 getCurrentKeywordsKey() {\n return this.selectKey || this.keywordsKEY;\n },\n handleSelectKeyChange(newKey) {\n // 如果之前有值,需要将值转移到新的字段\n if (this.searchParams[this.keywordsKEY] && newKey !== this.keywordsKEY) {\n this.searchParams[newKey] = this.searchParams[this.keywordsKEY];\n this.searchParams[this.keywordsKEY] = \"\";\n }\n },\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(\n (c) => c.columnPropertyName == column.label\n );\n let formatWidth = Math.ceil(newWidth);\n this.requestFn.pageTemplatecs\n .saveMyTemplateColumnWidth({\n templateKey: this.templateKey,\n columnCode: findColumn.columnCode,\n width: formatWidth,\n })\n .then((response) => {});\n },\n changePG(pages) {\n this.requestFn.pageTemplatecs\n .selectUserTemplateColumns({ templateKey: this.templateKey })\n .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\n .selectMyTableColumns({ templateKey: this.templateKey })\n .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 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 this.searchParams = searchParams;\n\n // 处理数据\n let ops = {};\n for (var key in searchParams) {\n if (\n searchParams[key] !== \"\" &&\n searchParams[key] !== null &&\n searchParams[key] !== undefined\n ) {\n ops[key] = searchParams[key];\n }\n }\n\n // 确保使用正确的关键词字段,并删除其他在selectKeyList中的key值\n if (this.selectKeyList && this.selectKeyList.length > 0) {\n // 获取所有selectKeyList中的key值\n const allSelectKeys = this.selectKeyList.map((item) => item.value);\n\n // 如果当前有选中的selectKey,确保使用它\n if (this.selectKey) {\n // 如果默认keywordsKEY有值且不是当前选中的key,将值转移到当前选中的key\n if (ops[this.keywordsKEY] && this.selectKey !== this.keywordsKEY) {\n ops[this.selectKey] = ops[this.keywordsKEY];\n delete ops[this.keywordsKEY];\n }\n\n // 删除其他在selectKeyList中的key值(除了当前选中的)\n allSelectKeys.forEach((key) => {\n if (key !== this.selectKey && ops[key]) {\n delete ops[key];\n }\n });\n }\n } else if (\n this.selectKey &&\n this.selectKey !== this.keywordsKEY &&\n ops[this.keywordsKEY]\n ) {\n // 兼容原有逻辑\n ops[this.selectKey] = ops[this.keywordsKEY];\n delete ops[this.keywordsKEY];\n }\n\n // 根据参数画tag\n formToValue(ops, this.columnsShow, this.colChange, this.ruleFn);\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(\n (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 this.tableKey = Math.random();\n this.$refs.FormTable.doLayout();\n },\n (err) => {\n this.listLoading = false;\n }\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 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(\n { [key[0]]: \"\", [key[1]]: \"\", [key[2]]: \"\" },\n \"remove\"\n );\n } else {\n this.setFormParams({ [key]: \"\" }, \"remove\");\n }\n },\n handleSelectAll(val) {\n this.$emit(\"selectAll\", Array.from(val));\n },\n handleSelect(selection, row) {\n this.$emit(\"select\", { selection, row });\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 actionModal() {\n this.dialogFormVisible = true;\n this.columns;\n this.columns = this.columns.map((i) => {\n const isSelect = this.columnsShow.find(\n (j) => j.columnPropertyName === i.columnPropertyName\n );\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.width400 {\n width: 400px;\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 max-width: 420px;\n /deep/.el-tag__close {\n vertical-align: super;\n }\n }\n .tagItem {\n max-width: 397px;\n display: inline-block;\n white-space: nowrap; /* 防止文本换行 */\n overflow: hidden; /* 隐藏超出的内容 */\n text-overflow: ellipsis; /* 将超出的内容显示为省略号 */\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-2e1086c8_1",{source:".container[data-v-2e1086c8] {\n padding: 15px;\n margin: 0px;\n width: 100%;\n background: #fff;\n float: left;\n}\n.input-with-select[data-v-2e1086c8] {\n width: 300px;\n}\n.width400[data-v-2e1086c8] {\n width: 400px;\n}\n.optBox[data-v-2e1086c8] {\n margin-bottom: 10px;\n overflow: hidden;\n}\n.leftBtn[data-v-2e1086c8] {\n float: left;\n}\n.rightBtn[data-v-2e1086c8] {\n float: right;\n}\n.rightBtn .textareaSpec[data-v-2e1086c8] {\n position: absolute;\n right: 100px;\n z-index: 1000;\n width: 700px;\n height: 400px;\n}\n.rightBtn .border[data-v-2e1086c8] {\n border: 1px solid #dcdfe6;\n}\n.tagBox[data-v-2e1086c8] {\n width: calc(100% - 140px);\n float: left;\n overflow: hidden;\n}\n.tagBox > .el-tag[data-v-2e1086c8] {\n margin: 4px 10px 0 0;\n max-width: 420px;\n}\n.tagBox > .el-tag[data-v-2e1086c8] .el-tag__close {\n vertical-align: super;\n}\n.tagBox .tagItem[data-v-2e1086c8] {\n max-width: 397px;\n display: inline-block;\n white-space: nowrap;\n /* 防止文本换行 */\n overflow: hidden;\n /* 隐藏超出的内容 */\n text-overflow: ellipsis;\n /* 将超出的内容显示为省略号 */\n}\n.clearAll[data-v-2e1086c8] {\n float: right;\n}\n.table[data-v-2e1086c8] {\n width: 100%;\n margin-top: 10px;\n float: left;\n}\n.pagi[data-v-2e1086c8] {\n float: right;\n}\n.pagi.pagination-container[data-v-2e1086c8] {\n padding: 0px;\n padding-top: 20px;\n}\n.btmBox[data-v-2e1086c8] {\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,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;EACpB,gBAAgB;AAClB;AACA;EACE,qBAAqB;AACvB;AACA;EACE,gBAAgB;EAChB,qBAAqB;EACrB,mBAAmB;EACnB,WAAW;EACX,gBAAgB;EAChB,YAAY;EACZ,uBAAuB;EACvB,iBAAiB;AACnB;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.width400 {\n width: 400px;\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 max-width: 420px;\n}\n.tagBox > .el-tag /deep/ .el-tag__close {\n vertical-align: super;\n}\n.tagBox .tagItem {\n max-width: 397px;\n display: inline-block;\n white-space: nowrap;\n /* 防止文本换行 */\n overflow: hidden;\n /* 隐藏超出的内容 */\n text-overflow: ellipsis;\n /* 将超出的内容显示为省略号 */\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__$3="data-v-2e1086c8";/* module identifier */const __vue_module_identifier__$3=undefined;/* functional template */const __vue_is_functional_template__$3=false;/* style inject SSR */ /* style inject shadow dom */const __vue_component__$3=/*#__PURE__*/normalizeComponent({render:__vue_render__$3,staticRenderFns:__vue_staticRenderFns__$3},__vue_inject_styles__$3,__vue_script__$3,__vue_scope_id__$3,__vue_is_functional_template__$3,__vue_module_identifier__$3,false,createInjector,undefined,undefined);__vue_component__$3.install=function(Vue){Vue.component(__vue_component__$3.name,__vue_component__$3);};/*!
|
|
2340
|
+
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__$3=script$3;/* template */var __vue_render__$3=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.getCurrentKeywordsKey()],callback:function($$v){_vm.$set(_vm.searchParams,_vm.getCurrentKeywordsKey(),typeof $$v==="string"?$$v.trim():$$v);},expression:"searchParams[getCurrentKeywordsKey()]"}},[_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'"}],class:{"input-with-select":true,width400:_vm.selectKeyList.length>0},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.getCurrentKeywordsKey()],callback:function($$v){_vm.$set(_vm.searchParams,_vm.getCurrentKeywordsKey(),typeof $$v==="string"?$$v.trim():$$v);},expression:"searchParams[getCurrentKeywordsKey()]"}},[_vm.selectKeyList.length>0?_c("el-select",{staticStyle:{width:"120px"},attrs:{slot:"prepend",placeholder:"请选择"},on:{change:_vm.handleSelectKeyChange},slot:"prepend",model:{value:_vm.selectKey,callback:function($$v){_vm.selectKey=$$v;},expression:"selectKey"}},_vm._l(_vm.selectKeyList,function(item){return _c("el-option",{key:item.value,attrs:{label:item.label,value:item.value}});}),1):_vm._e(),_vm._v(" "),_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);}}},[_c("div",{staticClass:"tagItem"},[_vm._v(_vm._s(tag.name+":"+tag.str))])]);}),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,"select-all":_vm.handleSelectAll,select:_vm.handleSelect}},[_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__$3=[];__vue_render__$3._withStripped=true;/* style */const __vue_inject_styles__$3=function(inject){if(!inject)return;inject("data-v-22fb6ca5_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":";AAytBA;EACA,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\n v-if=\"hasSearch\"\n v-show=\"searchType == 'textarea'\"\n type=\"textarea\"\n @keyup.enter.native=\"getList({ skipCount: 1 })\"\n :placeholder=\"searchPlaceholder || trans('请输入内容')\"\n :class=\"{\n 'input-with-select': true,\n textareaSpec: searchType == 'textarea',\n }\"\n v-model.trim=\"searchParams[getCurrentKeywordsKey()]\"\n @blur=\"changeType(0)\"\n :rows=\"10\"\n ref=\"myTextarea\"\n >\n <el-button\n slot=\"append\"\n icon=\"el-icon-search\"\n @click=\"getList({ skipCount: 1 })\"\n ></el-button>\n </el-input>\n <el-input\n v-if=\"hasSearch\"\n v-show=\"searchType == 'text'\"\n @keyup.enter.native=\"getList({ skipCount: 1 })\"\n :placeholder=\"searchPlaceholder || trans('请输入内容')\"\n :class=\"{\n 'input-with-select': true,\n width400: selectKeyList.length > 0,\n }\"\n v-model.trim=\"searchParams[getCurrentKeywordsKey()]\"\n @focus=\"changeType(1)\"\n >\n <el-select\n v-model=\"selectKey\"\n slot=\"prepend\"\n placeholder=\"请选择\"\n v-if=\"selectKeyList.length > 0\"\n style=\"width: 120px\"\n @change=\"handleSelectKeyChange\"\n >\n <el-option\n v-for=\"item in selectKeyList\"\n :key=\"item.value\"\n :label=\"item.label\"\n :value=\"item.value\"\n ></el-option>\n </el-select>\n <el-button\n slot=\"append\"\n icon=\"el-icon-search\"\n @click=\"getList({ skipCount: 1 })\"\n ></el-button>\n </el-input>\n <el-divider direction=\"vertical\"></el-divider>\n <el-button size=\"mini\" @click=\"actionModal\">\n <svg\n class=\"icon\"\n aria-hidden=\"true\"\n style=\"color: #10c2b0; cursor: pointer\"\n >\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\n v-for=\"tag in tags\"\n :key=\"tag.name\"\n closable\n @close=\"closeTag(tag)\"\n type=\"info\"\n >\n <div class=\"tagItem\">{{ `${tag.name}:${tag.str}` }}</div>\n </el-tag>\n </div>\n <el-button class=\"clearAll\" v-if=\"tags.length > 1\" @click=\"closeAllTag\">{{\n trans(\"取消全部筛选\")\n }}</el-button>\n <el-table\n ref=\"FormTable\"\n v-loading=\"listLoading\"\n :data=\"list\"\n :row-key=\"rowKey\"\n border\n fit\n @sort-change=\"$emit('sortChange', $event)\"\n @selection-change=\"handleSelectionChange\"\n @header-dragend=\"dragHead\"\n @select-all=\"handleSelectAll\"\n @select=\"handleSelect\"\n class=\"table\"\n :key=\"tableKey\"\n >\n <el-table-column\n v-if=\"hasSelection\"\n type=\"selection\"\n width=\"50\"\n :selectable=\"selectable\"\n >\n </el-table-column>\n <el-table-column\n v-if=\"hasIndex\"\n :label=\"trans('序号')\"\n type=\"index\"\n width=\"50\"\n >\n </el-table-column>\n <slot name=\"additional\"></slot>\n <el-table-column\n v-for=\"item in colDisplayFn(columnsShow)\"\n :key=\"item.columnCode\"\n :label=\"item.columnPropertyName\"\n :fixed=\"item.isFixed == 1 && 'left'\"\n :min-width=\"(item.defaultWidth || item.minWidth) + 20\"\n show-overflow-tooltip\n :sortable=\"sortableList[item.columnProperty] || false\"\n :prop=\"item.columnProperty\"\n align=\"center\"\n >\n <template slot=\"header\" slot-scope=\"{ column }\">\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\n v-if=\"item.queryConfig && item.queryConfig.type && item.isQuery\"\n v-bind:is=\"item.queryConfig.type\"\n :config=\"item.queryConfig\"\n :column=\"item\"\n :setFormParams=\"setFormParams\"\n :ops=\"ops\"\n :getConfig=\"getConfig\"\n :ruleFn=\"ruleFn[item.columnProperty]\"\n ></component>\n </template>\n <template slot-scope=\"{ row }\">\n <span v-if=\"$scopedSlots[item.columnProperty]\">\n <slot\n :name=\"item.columnProperty\"\n :props=\"row\"\n :queryConfig=\"item.queryConfig\"\n :options=\"getConfig(item)\"\n :label=\"getLabel(item, row)\"\n ></slot>\n </span>\n <span v-else>{{ getLabel(item, row) }}</span>\n </template>\n </el-table-column>\n <el-table-column\n :label=\"trans('操作')\"\n align=\"center\"\n :width=\"actionWidth\"\n class-name=\"small-padding\"\n v-if=\"$scopedSlots.actionBtn\"\n fixed=\"right\"\n >\n <template slot-scope=\"{ row }\">\n <slot name=\"actionBtn\" :props=\"row\"> </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\n v-show=\"count > 0\"\n :autoScroll=\"isAutoScroll\"\n class=\"text-right mt-0 pagi\"\n :total=\"count\"\n :page.sync=\"searchParams.skipCount\"\n :limit.sync=\"searchParams.pageSize\"\n @pagination=\"getList\"\n />\n </div>\n\n <select-col\n v-if=\"columns.length > 0\"\n :saveMyTemplateColumns=\"saveMyTemplateColumns\"\n :templateKey=\"templateKey\"\n :getNewCol=\"getNewCol\"\n :initialColumns=\"columns\"\n :columnsShow=\"columnsShow\"\n :visible.sync=\"dialogFormVisible\"\n ></select-col>\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 {\n SelectCol,\n Check,\n Date,\n Inputsp,\n DateRange,\n Tips,\n pageTemplatecs,\n Radio,\n InputScope,\n Selectsp,\n Cascader,\n} 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\";\nimport { SelectKeyManager } from \"./useSelectKey\";\nexport default {\n name: \"FormTableScheme\",\n components: {\n SelectCol,\n Check,\n Date,\n Inputsp,\n Pagination,\n DateRange,\n Tips,\n Radio,\n InputScope,\n Selectsp,\n Cascader,\n },\n model: {\n event: \"sortChange\",\n },\n data() {\n return {\n SelectKeyManager,\n trans,\n dialogFormVisible: false,\n formatSwitch,\n list: [],\n saveMyTemplateColumns:\n 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 selectKey: \"\",\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 this.initSelectKey();\n },\n },\n selectKeyList: {\n deep: true,\n immediate: true,\n handler(newList, oldList) {\n // 如果是初始化(oldList undefined),走 initSelectKey\n // 如果是动态切换(newList !== oldList),走 reset\n // 但 immediate: true 会导致首次也触发 handler,此时 oldList 为 undefined\n // 实际上 mounted 也会调 initSelectKey (via changePG -> getList?)\n // 我们统一策略:\n // 1. 如果 selectKey 为空,或者列表变了需要重置,则处理\n // initSelectKey 内部已经判断了空值逻辑\n \n if (oldList === undefined) {\n this.initSelectKey();\n } else {\n // 切换列表,清空并触发事件\n const prev = this.selectKey;\n this.selectKey = SelectKeyManager.resetOnListChange();\n this.$emit('selectKeyChange', { prev, current: this.selectKey, list: newList });\n }\n },\n },\n },\n props: {\n bigSearch: {\n default: false,\n type: Boolean,\n },\n fetchParam: {\n // 上传时附带的参数\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 selectKeyList: {\n default: () => {\n return [];\n },\n type: Array,\n },\n countNum: {\n // 总数\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 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 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 initSelectKey() {\n // 使用 SelectKeyManager 进行初始化\n this.selectKey = SelectKeyManager.initValue({\n selectKeyList: this.selectKeyList,\n fetchParam: this.fetchParam,\n keywordsKEY: this.keywordsKEY\n });\n },\n getCurrentKeywordsKey() {\n return this.selectKey || this.keywordsKEY;\n },\n handleSelectKeyChange(newKey) {\n // 如果之前有值,需要将值转移到新的字段\n if (this.searchParams[this.keywordsKEY] && newKey !== this.keywordsKEY) {\n this.searchParams[newKey] = this.searchParams[this.keywordsKEY];\n this.searchParams[this.keywordsKEY] = \"\";\n }\n },\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(\n (c) => c.columnPropertyName == column.label\n );\n let formatWidth = Math.ceil(newWidth);\n this.requestFn.pageTemplatecs\n .saveMyTemplateColumnWidth({\n templateKey: this.templateKey,\n columnCode: findColumn.columnCode,\n width: formatWidth,\n })\n .then((response) => {});\n },\n changePG(pages) {\n this.requestFn.pageTemplatecs\n .selectUserTemplateColumns({ templateKey: this.templateKey })\n .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\n .selectMyTableColumns({ templateKey: this.templateKey })\n .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 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 this.searchParams = searchParams;\n\n // 处理数据\n let ops = {};\n for (var key in searchParams) {\n if (\n searchParams[key] !== \"\" &&\n searchParams[key] !== null &&\n searchParams[key] !== undefined\n ) {\n ops[key] = searchParams[key];\n }\n }\n console.log(ops);\n // 确保使用正确的关键词字段,并删除其他在selectKeyList中的key值\n if (this.selectKeyList && this.selectKeyList.length > 0) {\n // 在开始处理之前,再次调用 initSelectKey 以确保 selectKey 与当前的 ops 保持同步\n // 这一步至关重要,因为 ops 可能包含从 fetchParam 合并进来的新值,\n // 而 initSelectKey 依赖 this.fetchParam,可能还没来得及响应\n // 实际上 ops 才是最准确的参数来源\n const allSelectKeys = this.selectKeyList.map((item) => item.value);\n\n // 如果 selectKey 当前指向的值为空,但在 ops 中存在其他有效 key,\n // 应该先切换 selectKey,防止后续逻辑误删\n if (!ops[this.selectKey]) {\n const activeKey = allSelectKeys.find((key) => ops[key]);\n if (activeKey) {\n this.selectKey = activeKey;\n }\n }\n\n // 1. 如果有 keywordsKEY 的值,优先使用 keywordsKEY,并覆盖到当前 selectKey\n if (ops[this.keywordsKEY]) {\n // 将 keywordsKEY 的值赋给 selectKey\n ops[this.selectKey] = ops[this.keywordsKEY];\n // 清除 keywordsKEY,避免重复\n if (this.selectKey !== this.keywordsKEY) {\n delete ops[this.keywordsKEY];\n }\n }\n\n // 2. 检查当前 selectKey 是否有值\n // 如果没有值,尝试从其他 selectKeyList 中找到第一个有值的 key 切换过去\n if (!ops[this.selectKey]) {\n const activeKey = allSelectKeys.find((key) => ops[key]);\n if (activeKey) {\n this.selectKey = activeKey;\n }\n }\n\n // 3. 最终清理:只保留当前 selectKey 的值,清除 selectKeyList 中其他 key 的值\n allSelectKeys.forEach((key) => {\n if (key !== this.selectKey && ops[key]) {\n delete ops[key];\n }\n });\n } else if (\n this.selectKey &&\n this.selectKey !== this.keywordsKEY &&\n ops[this.keywordsKEY]\n ) {\n // 兼容原有逻辑\n ops[this.selectKey] = ops[this.keywordsKEY];\n delete ops[this.keywordsKEY];\n }\n\n // 根据参数画tag\n formToValue(ops, this.columnsShow, this.colChange, this.ruleFn);\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(\n (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 this.tableKey = Math.random();\n this.$refs.FormTable.doLayout();\n },\n (err) => {\n this.listLoading = false;\n }\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 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(\n { [key[0]]: \"\", [key[1]]: \"\", [key[2]]: \"\" },\n \"remove\"\n );\n } else {\n this.setFormParams({ [key]: \"\" }, \"remove\");\n }\n },\n handleSelectAll(val) {\n this.$emit(\"selectAll\", Array.from(val));\n },\n handleSelect(selection, row) {\n this.$emit(\"select\", { selection, row });\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 actionModal() {\n this.dialogFormVisible = true;\n this.columns;\n this.columns = this.columns.map((i) => {\n const isSelect = this.columnsShow.find(\n (j) => j.columnPropertyName === i.columnPropertyName\n );\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.width400 {\n width: 400px;\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 max-width: 420px;\n /deep/.el-tag__close {\n vertical-align: super;\n }\n }\n .tagItem {\n max-width: 397px;\n display: inline-block;\n white-space: nowrap; /* 防止文本换行 */\n overflow: hidden; /* 隐藏超出的内容 */\n text-overflow: ellipsis; /* 将超出的内容显示为省略号 */\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-22fb6ca5_1",{source:".container[data-v-22fb6ca5] {\n padding: 15px;\n margin: 0px;\n width: 100%;\n background: #fff;\n float: left;\n}\n.input-with-select[data-v-22fb6ca5] {\n width: 300px;\n}\n.width400[data-v-22fb6ca5] {\n width: 400px;\n}\n.optBox[data-v-22fb6ca5] {\n margin-bottom: 10px;\n overflow: hidden;\n}\n.leftBtn[data-v-22fb6ca5] {\n float: left;\n}\n.rightBtn[data-v-22fb6ca5] {\n float: right;\n}\n.rightBtn .textareaSpec[data-v-22fb6ca5] {\n position: absolute;\n right: 100px;\n z-index: 1000;\n width: 700px;\n height: 400px;\n}\n.rightBtn .border[data-v-22fb6ca5] {\n border: 1px solid #dcdfe6;\n}\n.tagBox[data-v-22fb6ca5] {\n width: calc(100% - 140px);\n float: left;\n overflow: hidden;\n}\n.tagBox > .el-tag[data-v-22fb6ca5] {\n margin: 4px 10px 0 0;\n max-width: 420px;\n}\n.tagBox > .el-tag[data-v-22fb6ca5] .el-tag__close {\n vertical-align: super;\n}\n.tagBox .tagItem[data-v-22fb6ca5] {\n max-width: 397px;\n display: inline-block;\n white-space: nowrap;\n /* 防止文本换行 */\n overflow: hidden;\n /* 隐藏超出的内容 */\n text-overflow: ellipsis;\n /* 将超出的内容显示为省略号 */\n}\n.clearAll[data-v-22fb6ca5] {\n float: right;\n}\n.table[data-v-22fb6ca5] {\n width: 100%;\n margin-top: 10px;\n float: left;\n}\n.pagi[data-v-22fb6ca5] {\n float: right;\n}\n.pagi.pagination-container[data-v-22fb6ca5] {\n padding: 0px;\n padding-top: 20px;\n}\n.btmBox[data-v-22fb6ca5] {\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,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;EACpB,gBAAgB;AAClB;AACA;EACE,qBAAqB;AACvB;AACA;EACE,gBAAgB;EAChB,qBAAqB;EACrB,mBAAmB;EACnB,WAAW;EACX,gBAAgB;EAChB,YAAY;EACZ,uBAAuB;EACvB,iBAAiB;AACnB;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.width400 {\n width: 400px;\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 max-width: 420px;\n}\n.tagBox > .el-tag /deep/ .el-tag__close {\n vertical-align: super;\n}\n.tagBox .tagItem {\n max-width: 397px;\n display: inline-block;\n white-space: nowrap;\n /* 防止文本换行 */\n overflow: hidden;\n /* 隐藏超出的内容 */\n text-overflow: ellipsis;\n /* 将超出的内容显示为省略号 */\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__$3="data-v-22fb6ca5";/* module identifier */const __vue_module_identifier__$3=undefined;/* functional template */const __vue_is_functional_template__$3=false;/* style inject SSR */ /* style inject shadow dom */const __vue_component__$3=/*#__PURE__*/normalizeComponent({render:__vue_render__$3,staticRenderFns:__vue_staticRenderFns__$3},__vue_inject_styles__$3,__vue_script__$3,__vue_scope_id__$3,__vue_is_functional_template__$3,__vue_module_identifier__$3,false,createInjector,undefined,undefined);__vue_component__$3.install=function(Vue){Vue.component(__vue_component__$3.name,__vue_component__$3);};/*!
|
|
2307
2341
|
* html2canvas 1.4.1 <https://html2canvas.hertzen.com>
|
|
2308
2342
|
* Copyright (c) 2022 Niklas von Hertzen <https://hertzen.com>
|
|
2309
2343
|
* Released under MIT License
|
|
@@ -2710,4 +2744,4 @@ for(let key in this.formData){if(this.formData[key]!==""){formData.append(key,th
|
|
|
2710
2744
|
// fileType: failFileType,
|
|
2711
2745
|
// };
|
|
2712
2746
|
const searchParams=new URLSearchParams();searchParams.append("fileCode",fileCode);searchParams.append("fileType",failFileType);for(let key in this.errorParams){if(this.errorParams[key]||this.errorParams[key]==0){searchParams.append(key,this.errorParams[key]);}}// 加密
|
|
2713
|
-
let headers={"Content-Type":"application/x-www-form-urlencoded"};const urlApi="/gateway/huilianApi/errorcs/exportErrorFile";if(window.HLEncryption){headers=window.HLEncryption.setRequestHeaders({url:urlApi,headers:headers});}const response=await fetch(urlApi,{method:"post",headers:headers,body:searchParams.toString()});if(!response.ok){throw new Error(`下载请求失败: ${response.statusText}`);}const blob=await response.blob();const name=response.headers.get("content-disposition").split("filename=")[1];const url=window.URL.createObjectURL(blob);const a=document.createElement("a");a.href=url;a.download=decodeURIComponent(name);document.body.appendChild(a);a.click();document.body.removeChild(a);window.URL.revokeObjectURL(url);}else{this.$message({message:"无文件可下载",type:"warning"});}}}};/* 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("span",{staticClass:"StandardImportComponents",staticStyle:{display:"inline-block"}},[_c("el-button",{attrs:{type:_vm.btnType},on:{click:_vm.openDialog}},[_vm._v(_vm._s(_vm.btnText))]),_vm._v(" "),_c("el-dialog",{attrs:{title:_vm.dialogTitle,visible:_vm.dialogVisible,width:"600px","close-on-click-modal":false,"close-on-press-escape":false,"before-close":_vm.handleClose,"append-to-body":""},on:{"update:visible":function($event){_vm.dialogVisible=$event;}}},[_c("div",[_vm._t("content-header")],2),_vm._v(" "),_c("div",{staticStyle:{position:"relative"}},[_c("el-upload",{ref:"importFile",attrs:{action:_vm.importApi,"file-list":_vm.fileList,accept:"."+_vm.fileType,"before-upload":_vm.beforeUploadForm,data:_vm.formData,limit:1,"on-change":_vm.handleChange,"on-remove":_vm.handleRemove,"on-success":_vm.handleSuccess,"on-error":_vm.handleError,"auto-upload":false,"http-request":_vm.customHttpRequest}},[_c("el-button",{attrs:{slot:"trigger",size:"small",type:"primary"},slot:"trigger"},[_vm._v("选取文件")]),_vm._v(" "),_c("div",{staticClass:"el-upload__tip",attrs:{slot:"tip"},slot:"tip"},[_vm._v("\n "+_vm._s(_vm.fileTypeComputer)+"\n ")])],1),_vm._v(" "),_c("div",{staticStyle:{position:"absolute",top:"0",left:"100px"}},[_c("el-button",{attrs:{type:"text"},on:{click:_vm.getTemp}},[_vm._v(" 模板下载 ")])],1),_vm._v(" "),_c("div",{directives:[{name:"show",rawName:"v-show",value:_vm.detailData.successCount||_vm.detailData.failCount,expression:"detailData.successCount || detailData.failCount"}],staticClass:"mt-10",staticStyle:{"font-size":"12px","font-weight":"400",color:"#999999"}},[_vm._v("\n 导入结果(仅展示最后一次上传结果):\n "),_c("span",{staticStyle:{color:"#333333"}},[_vm._v("\n 成功"+_vm._s(_vm.detailData.successCount||0)+"条,失败"+_vm._s(_vm.detailData.failCount||0)+"条\n ")]),_vm._v("\n \n "),_c("a",{directives:[{name:"show",rawName:"v-show",value:_vm.failFileType&&_vm.detailData.failCount,expression:"failFileType && detailData.failCount"}],staticStyle:{color:"#599ebf"},attrs:{href:"javascript:void(0)"},on:{click:function($event){return _vm.downloadFile(_vm.fileCode,_vm.failFileType);}}},[_vm._v("\n 下载失败信息\n ")])])],1),_vm._v(" "),_c("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[_c("el-button",{on:{click:_vm.handleClose}},[_vm._v(" 取 消 ")]),_vm._v(" "),_c("el-button",{attrs:{type:"primary",loading:_vm.isSubmitLoading},on:{click:_vm.query}},[_vm._v("\n 确 定\n ")])],1)])],1);};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.
|
|
2747
|
+
let headers={"Content-Type":"application/x-www-form-urlencoded"};const urlApi="/gateway/huilianApi/errorcs/exportErrorFile";if(window.HLEncryption){headers=window.HLEncryption.setRequestHeaders({url:urlApi,headers:headers});}const response=await fetch(urlApi,{method:"post",headers:headers,body:searchParams.toString()});if(!response.ok){throw new Error(`下载请求失败: ${response.statusText}`);}const blob=await response.blob();const name=response.headers.get("content-disposition").split("filename=")[1];const url=window.URL.createObjectURL(blob);const a=document.createElement("a");a.href=url;a.download=decodeURIComponent(name);document.body.appendChild(a);a.click();document.body.removeChild(a);window.URL.revokeObjectURL(url);}else{this.$message({message:"无文件可下载",type:"warning"});}}}};/* 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("span",{staticClass:"StandardImportComponents",staticStyle:{display:"inline-block"}},[_c("el-button",{attrs:{type:_vm.btnType},on:{click:_vm.openDialog}},[_vm._v(_vm._s(_vm.btnText))]),_vm._v(" "),_c("el-dialog",{attrs:{title:_vm.dialogTitle,visible:_vm.dialogVisible,width:"600px","close-on-click-modal":false,"close-on-press-escape":false,"before-close":_vm.handleClose,"append-to-body":""},on:{"update:visible":function($event){_vm.dialogVisible=$event;}}},[_c("div",[_vm._t("content-header")],2),_vm._v(" "),_c("div",{staticStyle:{position:"relative"}},[_c("el-upload",{ref:"importFile",attrs:{action:_vm.importApi,"file-list":_vm.fileList,accept:"."+_vm.fileType,"before-upload":_vm.beforeUploadForm,data:_vm.formData,limit:1,"on-change":_vm.handleChange,"on-remove":_vm.handleRemove,"on-success":_vm.handleSuccess,"on-error":_vm.handleError,"auto-upload":false,"http-request":_vm.customHttpRequest}},[_c("el-button",{attrs:{slot:"trigger",size:"small",type:"primary"},slot:"trigger"},[_vm._v("选取文件")]),_vm._v(" "),_c("div",{staticClass:"el-upload__tip",attrs:{slot:"tip"},slot:"tip"},[_vm._v("\n "+_vm._s(_vm.fileTypeComputer)+"\n ")])],1),_vm._v(" "),_c("div",{staticStyle:{position:"absolute",top:"0",left:"100px"}},[_c("el-button",{attrs:{type:"text"},on:{click:_vm.getTemp}},[_vm._v(" 模板下载 ")])],1),_vm._v(" "),_c("div",{directives:[{name:"show",rawName:"v-show",value:_vm.detailData.successCount||_vm.detailData.failCount,expression:"detailData.successCount || detailData.failCount"}],staticClass:"mt-10",staticStyle:{"font-size":"12px","font-weight":"400",color:"#999999"}},[_vm._v("\n 导入结果(仅展示最后一次上传结果):\n "),_c("span",{staticStyle:{color:"#333333"}},[_vm._v("\n 成功"+_vm._s(_vm.detailData.successCount||0)+"条,失败"+_vm._s(_vm.detailData.failCount||0)+"条\n ")]),_vm._v("\n \n "),_c("a",{directives:[{name:"show",rawName:"v-show",value:_vm.failFileType&&_vm.detailData.failCount,expression:"failFileType && detailData.failCount"}],staticStyle:{color:"#599ebf"},attrs:{href:"javascript:void(0)"},on:{click:function($event){return _vm.downloadFile(_vm.fileCode,_vm.failFileType);}}},[_vm._v("\n 下载失败信息\n ")])])],1),_vm._v(" "),_c("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[_c("el-button",{on:{click:_vm.handleClose}},[_vm._v(" 取 消 ")]),_vm._v(" "),_c("el-button",{attrs:{type:"primary",loading:_vm.isSubmitLoading},on:{click:_vm.query}},[_vm._v("\n 确 定\n ")])],1)])],1);};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.7.2";const components=[__vue_component__$j,__vue_component__$i,__vue_component__$h,__vue_component__$g,__vue_component__$3,__vue_component__$2,__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 ExportList,__vue_component__$3 as FormTableScheme,__vue_component__$i as HelloVue,__vue_component__$2 as HtmlToImg,__vue_component__$j as MyButton,__vue_component__$g as ShowFile,__vue_component__ as StandardImport,__vue_component__$h as UploadFile,index as default,install};
|