wiser-components 1.0.6 → 1.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/index.esm.js +1 -1
- package/lib/index.js +1 -1
- package/lib/index.umd.js +1 -1
- package/package.json +1 -1
package/lib/index.esm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function e(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var a=document.head||document.getElementsByTagName("head")[0],l=document.createElement("style");l.type="text/css","top"===i&&a.firstChild?a.insertBefore(l,a.firstChild):a.appendChild(l),l.styleSheet?l.styleSheet.cssText=e:l.appendChild(document.createTextNode(e))}}function t(e){return e?e.replace(/([A-Z])/g,"-$1").toLowerCase().replace(/^-/,""):e}import{utils as i,read as a}from"xlsx";import{saveAs as l}from"file-saver";import s from"@/assets/icon-search.png";e(".long-input-wrapper{background-color:#fff;border:1px solid #e0e0e0;border-radius:4px;padding:8px}.intTxt{width:80%}");var r={render(){var e=this,t=e.$createElement;return(e.i.t||t)("el-input",e.l(e.o({staticClass:"intTxt",attrs:{"show-word-limit":e.showWordLimit,placeholder:e.placeholder,"auto-complete":"new-password",disabled:e.disabled},on:{input:t=>e.$emit("input",t)}},"el-input",e.$attrs,!1),e.$listeners),[e.p(Object.keys(this.$slots),function(t){return e.h(t,null,{slot:t})})],2)},staticRenderFns:[],name:"LongInput",props:{showWordLimit:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},placeholder:{type:String,default:"请输入"}},install(e){e.component(r.name,r)}};e("");var o={render(){var e=this,t=e.$createElement,i=e.i.t||t;return i("el-select",e.l(e.o({attrs:{value:e.value,placeholder:e.placeholder}},"el-select",e.$attrs,!1),e.$listeners),[e.h("unshift"),e.u(" "),e.h("default",function(){return e.p(e.options,function(t,a){return i("el-option",{key:a,attrs:{value:t[e.valueKey],label:t[e.labelKey],disabled:t[e.disabledOption]}})})},{slot:"default"}),e.u(" "),e.h("prefix",null,{slot:"prefix"}),e.u(" "),e.h("empty",null,{slot:"empty"})],2)},staticRenderFns:[],name:"LongSelect",props:{value:{type:[String,Number],default:""},dataList:{type:Array,default:()=>[]},disabledOption:{type:[Boolean,Number],default:!1},valueKey:{type:[String,Number],default:"value"},labelKey:{type:[String,Number],default:"label"},mode:{type:String,default:"local"},dict:{type:String,default:""},url:{type:String,default:""},requestParams:{type:Object,default(){}},placeholder:{type:String,default:"请选择"}},data(){return{options:[]}},watch:{dataList:{deep:!0,immediate:!0,handler(e){"local"===this.mode&&(this.options=e)}},dict:{deep:!0,handler(e){this.init()}}},created(){this.init()},methods:{init(){"remote"===this.mode&&this.dict&&this.getDicts(this.dict).then(e=>{this.options=(e.data||[]).map(e=>({[this.valueKey]:e.dictCode,[this.labelKey]:e.dictLabel}))})}},install(e){e.component(o.name,o)}};e(".variable-config-dialog :deep(.el-dialog__body){padding:20px}.variable-config-dialog :deep(.el-dialog__header){padding:20px 20px 10px}.dialog-title{align-items:center;color:#303133;display:flex;font-size:16px;font-weight:700;gap:24px;padding:0 20px}.dialog-title .title-left{color:#303133;flex:1;min-width:500px}.dialog-title .title-separator{color:#dcdfe6;flex-shrink:0;font-weight:400}.dialog-title .title-right{color:#303133;flex:1;min-width:400px}.dialog-body{display:flex;gap:24px;min-height:500px}.left-section{flex:1;min-width:500px}.section-title{color:#303133;font-size:16px;font-weight:700;margin-bottom:16px}.variable-selector{align-items:flex-start;display:flex;gap:16px}.variable-panel{border:1px solid #dcdfe6;border-radius:4px;display:flex;flex:1;flex-direction:column;height:500px;overflow:hidden}.panel-header{align-items:center;background:#f5f7fa;border-bottom:1px solid #dcdfe6;display:flex;justify-content:space-between;padding:12px 16px}.select-all-checkbox :deep(.el-checkbox__label){padding-left:8px}.panel-title{color:#303133;font-weight:500}.panel-count{color:#909399;font-size:12px}.panel-search{border-bottom:1px solid #dcdfe6;padding:12px}.panel-list{flex:1;overflow-y:auto;padding:8px}.variable-item{border-radius:4px;cursor:pointer;padding:8px 12px;transition:background-color .2s}.variable-item:hover{background-color:#f5f7fa}.variable-item :deep(.el-checkbox){width:100%}.variable-item :deep(.el-checkbox__label){width:100%}.arrow-buttons{display:flex;flex-direction:column;gap:12px;justify-content:center;padding-top:100px}.arrow-buttons .el-button{margin-left:0!important}.right-section{display:flex;flex:1;flex-direction:column;min-width:400px;overflow:hidden}.config-desc{color:#909399;flex-shrink:0;font-size:13px;line-height:1.5;margin-bottom:24px}.config-group{margin-bottom:32px}.config-group:last-child{margin-bottom:0}.config-label{color:#303133;font-size:14px;font-weight:500;margin-bottom:12px}.config-options{display:flex;flex:1;flex-direction:column;gap:16px;margin-top:16px;overflow-x:hidden;overflow-y:auto;padding-right:8px}.config-options::-webkit-scrollbar{width:6px}.config-options::-webkit-scrollbar-track{background:#f1f1f1;border-radius:3px}.config-options::-webkit-scrollbar-thumb{background:#c1c1c1;border-radius:3px}.config-options::-webkit-scrollbar-thumb:hover{background:#a8a8a8}.config-option-row{align-items:center;display:flex;gap:12px;margin-bottom:8px}.config-option-row.is-parent .option-label{color:#303133;font-weight:500}.config-option-row.is-leaf .option-label{color:#606266}.option-label{color:#606266;flex:1;font-size:13px;min-width:0;white-space:normal;word-break:break-all}.option-label.required{color:#303133;font-weight:500}.option-label .required-mark{color:#f56c6c;margin-left:2px}.config-select{flex-shrink:0;width:350px}.non-leaf-label{color:#909399;font-size:13px;font-style:italic}.disabled-option{cursor:not-allowed!important}.disabled-option,.disabled-text{color:#c0c4cc!important}:deep(.el-select-dropdown__item.is-disabled){color:#c0c4cc!important;cursor:not-allowed!important}:deep(.el-select-dropdown__item.is-disabled) span{color:#c0c4cc!important}.checkbox-list{border:1px solid #dcdfe6;border-radius:4px;display:flex;flex:1;flex-direction:column;gap:8px;max-height:200px;overflow-y:auto;padding:8px}.dialog-footer{text-align:right}");var n={render(){var e=this,t=e.$createElement,i=e.i.t||t;return i("div",[i("el-dialog",{staticClass:"variable-config-dialog",staticStyle:{"max-height":"90vh"},attrs:{visible:e.dialogVisible,width:"1200px"},on:{"update:visible"(t){e.dialogVisible=t},close:e.handleClose}},[i("div",{staticClass:"dialog-title",attrs:{slot:"title"},slot:"title"},[i("span",{staticClass:"title-left"},[e.u("选择分析变量")]),e.u(" "),i("span",{staticClass:"title-separator"},[e.u("|")]),e.u(" "),i("span",{staticClass:"title-right"},[e.u("配置变量")])]),e.u(" "),i("div",{staticClass:"dialog-body"},[i("div",{staticClass:"left-section"},[i("div",{staticClass:"variable-selector"},[i("div",{staticClass:"variable-panel"},[i("div",{staticClass:"panel-header"},[i("el-checkbox",{staticClass:"select-all-checkbox",attrs:{indeterminate:e.leftIndeterminate},on:{change:e.handleLeftSelectAll},model:{value:e.leftSelectAll,callback(t){e.leftSelectAll=t},expression:"leftSelectAll"}},[i("span",{staticClass:"panel-title"},[e.u("全选")])]),e.u(" "),i("span",{staticClass:"panel-count"},[e.u(e.m(e.selectedAllCount)+"/"+e.m(e.allVariables.length))])],1),e.u(" "),i("div",{staticClass:"panel-search"},[i("el-input",{attrs:{placeholder:"请输入关键字","suffix-icon":"el-icon-search",size:"small"},on:{input:e.handleLeftSearch},model:{value:e.leftKeyword,callback(t){e.leftKeyword=t},expression:"leftKeyword"}})],1),e.u(" "),i("div",{staticClass:"panel-list"},e.p(e.filteredLeftVariables,function(t){return i("div",{key:t.field,staticClass:"variable-item"},[i("el-checkbox",{on:{change:i=>e.handleLeftCheckChange(t)},model:{value:t.checked,callback(i){e.$set(t,"checked",i)},expression:"item.checked"}},[e.u("\n "+e.m(t.field)+"\n ")])],1)}),0)]),e.u(" "),i("div",{staticClass:"arrow-buttons"},[i("el-button",{attrs:{type:"primary",icon:"el-icon-arrow-right",size:"small",disabled:!e.hasLeftSelected},on:{click:e.moveToRight}}),e.u(" "),i("el-button",{attrs:{type:"danger",icon:"el-icon-arrow-left",size:"small",disabled:!e.hasRightSelected},on:{click:e.moveToLeft}})],1),e.u(" "),i("div",{staticClass:"variable-panel"},[i("div",{staticClass:"panel-header"},[i("el-checkbox",{staticClass:"select-all-checkbox",attrs:{indeterminate:e.rightIndeterminate},on:{change:e.handleRightSelectAll},model:{value:e.rightSelectAll,callback(t){e.rightSelectAll=t},expression:"rightSelectAll"}},[i("span",{staticClass:"panel-title"},[e.u("已选")])]),e.u(" "),i("span",{staticClass:"panel-count"},[e.u(e.m(e.selectedRightCount)+"/"+e.m(e.selectedVariables.length))])],1),e.u(" "),i("div",{staticClass:"panel-search"},[i("el-input",{attrs:{placeholder:"请输入关键字","suffix-icon":"el-icon-search",size:"small"},on:{input:e.handleRightSearch},model:{value:e.rightKeyword,callback(t){e.rightKeyword=t},expression:"rightKeyword"}})],1),e.u(" "),i("div",{staticClass:"panel-list"},e.p(e.filteredRightVariables,function(t){return i("div",{key:t.field,staticClass:"variable-item"},[i("el-checkbox",{on:{change:i=>e.handleRightCheckChange(t)},model:{value:t.checked,callback(i){e.$set(t,"checked",i)},expression:"item.checked"}},[e.u("\n "+e.m(t.field)+"\n ")])],1)}),0)])])]),e.u(" "),i("div",{staticClass:"right-section"},[i("div",{staticClass:"config-desc"},[e.u("\n 数据文件中因变量的值,需赋予参考值,方便精准进行数据分析。\n ")]),e.u(" "),i("div",{staticClass:"config-options"},e.p(e.flatMenuItems,function(t){return i("div",{key:t.pathString,staticClass:"config-option-row"},[i("span",{staticClass:"option-label",class:{required:t.required}},[e.u("\n "+e.m(t.pathString)+"\n "),t.required?i("span",{staticClass:"required-mark"},[e.u("*")]):e.v()]),e.u(" "),i("el-select",{staticClass:"config-select",attrs:{placeholder:e.getPlaceholder(t),clearable:t.nullable,multiple:t.multiple},on:{change:i=>e.handleConfigChange(t.pathString,i)},model:{value:e.configValues[t.pathString],callback(i){e.$set(e.configValues,t.pathString,i)},expression:"configValues[menuItem.pathString]"}},e.p(e.getAvailableOptions(t.pathString,t.multiple),function(t){return i("el-option",{key:t.value,class:{"disabled-option":t.disabled},attrs:{label:t.label,value:t.value,disabled:t.disabled}},[i("span",{class:{"disabled-text":t.disabled}},[e.u(e.m(t.label))])])}),1)],1)}),0)])]),e.u(" "),i("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[i("el-button",{on:{click:e.handleClose}},[e.u("取消")]),e.u(" "),i("el-button",{staticStyle:{color:"#fff"},attrs:{type:"primary"},on:{click:e.handleSave}},[e.u("保存")])],1)])],1)},staticRenderFns:[],name:"LongVariableViewer",props:{visible:{type:Boolean,default:!1},values:{type:Array,default:()=>[]},menus:{type:Array,default:()=>[]}},data(){return{dialogVisible:!1,leftKeyword:"",rightKeyword:"",allVariables:[],selectedVariables:[],configValues:{},configChangeTimer:null}},computed:{filteredLeftVariables(){return this.leftKeyword?this.allVariables.filter(e=>e.field.toLowerCase().includes(this.leftKeyword.toLowerCase())):this.allVariables},filteredRightVariables(){return this.rightKeyword?this.selectedVariables.filter(e=>e.field.toLowerCase().includes(this.rightKeyword.toLowerCase())):this.selectedVariables},selectedAllCount(){return this.allVariables.filter(e=>e.checked).length},selectedRightCount(){return this.selectedVariables.filter(e=>e.checked).length},hasLeftSelected(){return this.allVariables.some(e=>e.checked)},hasRightSelected(){return this.selectedVariables.some(e=>e.checked)},leftSelectAll:{get(){const e=this.filteredLeftVariables;return 0!==e.length&&e.every(e=>e.checked)},set(){}},leftIndeterminate(){const e=this.filteredLeftVariables;if(0===e.length)return!1;const t=e.filter(e=>e.checked).length;return t>0&&t<e.length},rightSelectAll:{get(){const e=this.filteredRightVariables;return 0!==e.length&&e.every(e=>e.checked)},set(){}},rightIndeterminate(){const e=this.filteredRightVariables;if(0===e.length)return!1;const t=e.filter(e=>e.checked).length;return t>0&&t<e.length},flatMenuItems(){if(!this.menus||0===this.menus.length)return[];const e=[],t=(i,a=[])=>{const l=[...a,i.label];if(i.children&&0!==i.children.length)i.children&&i.children.length>0&&i.children.forEach(e=>{t(e,l)});else{const t=l.join("/");e.push({label:i.label,path:l,pathString:t,isLeaf:!0,id:i.id,fieldName:i.fieldName,required:i.required,nullable:i.nullable,multiple:i.multiple,originalMenu:i})}};return this.menus.forEach(e=>{t(e)}),e},tableData(){const e=[];return Object.keys(this.configValues).forEach(t=>{const i=this.configValues[t];if(!i||Array.isArray(i)&&0===i.length)return;const a=this.flatMenuItems.find(e=>e.pathString===t);if(!a)return;const l=a.pathString;(Array.isArray(i)?i:[i]).forEach(t=>{const i=t+"";i&&e.push({field:i,fullPath:l,varType:a.path&&a.path.length>0?a.path[0]:l,attr:a.path&&a.path.length>0?a.path[a.path.length-1]:""})})}),e}},watch:{visible:{handler(e){this.dialogVisible=e},immediate:!0},dialogVisible(e){this.$emit("update:visible",e)},values:{handler(e){this.handleValuesChange(e)},immediate:!0,deep:!0},selectedVariables:{handler(){const e=this.selectedVariables.map(e=>e.field),t={...this.configValues};let i=!1;Object.keys(t).forEach(a=>{const l=t[a];if(Array.isArray(l)){const s=l.filter(t=>e.includes(t));s.length!==l.length&&(t[a]=s,i=!0)}else l&&!e.includes(l)&&(t[a]="",i=!0)}),i&&(this.configValues=t)},deep:!0},configValues:{handler(){this.configChangeTimer&&clearTimeout(this.configChangeTimer),this.configChangeTimer=setTimeout(()=>{this.$nextTick(()=>{this.$emit("config-changed",this.tableData)})},100)},deep:!0}},methods:{handleValuesChange(e){if(!e||0===e.length)return this.allVariables=[],this.selectedVariables=[],void 0;const t=[];if(e.length>0){const i=e[0];"object"==typeof i&&null!==i&&t.push(...Object.keys(i))}this.allVariables=t.map(e=>({field:e,checked:!1})),this.selectedVariables=[]},handleLeftSearch(){},handleRightSearch(){},handleLeftCheckChange(){},handleRightCheckChange(){},handleLeftSelectAll(e){this.filteredLeftVariables.forEach(t=>{t.checked=e})},handleRightSelectAll(e){this.filteredRightVariables.forEach(t=>{t.checked=e})},moveToRight(){const e=this.allVariables.filter(e=>e.checked);0!==e.length&&(e.forEach(e=>{e.checked=!1,this.selectedVariables.find(t=>t.field===e.field)||this.selectedVariables.push({field:e.field,checked:!1})}),this.allVariables=this.allVariables.filter(t=>!e.some(e=>e.field===t.field)))},moveToLeft(){const e=this.selectedVariables.filter(e=>e.checked);0!==e.length&&(e.forEach(e=>{e.checked=!1,this.allVariables.find(t=>t.field===e.field)||this.allVariables.push({field:e.field,checked:!1})}),this.selectedVariables=this.selectedVariables.filter(t=>!e.some(e=>e.field===t.field)))},handleClose(){this.dialogVisible=!1},getPlaceholder(e){return e.required?"必选":e.nullable?"请选择":"必选"},getAvailableOptions(e,t=!1){const i=this.selectedVariables.map(e=>e.field),a=this.configValues[e],l=t?Array.isArray(a)?a:[]:a?[a]:[],s=[];return Object.keys(this.configValues).forEach(t=>{if(t!==e&&this.configValues[t]){const e=this.configValues[t];Array.isArray(e)?s.push(...e):s.push(e)}}),i.map(e=>l.includes(e)?{label:e,value:e,disabled:!1}:{label:e,value:e,disabled:s.includes(e)})},handleConfigChange(e,t){this.$set(this.configValues,e,t);const i=this.flatMenuItems.find(t=>t.pathString===e);i&&i.multiple&&!Array.isArray(t)&&this.$set(this.configValues,e,t?[t]:[])},generateConfigFromMenus(){return this.flatMenuItems.forEach(e=>{e.pathString in this.configValues||(e.multiple?this.$set(this.configValues,e.pathString,[]):this.$set(this.configValues,e.pathString,""))}),{...this.configValues}},handleSave(){const e={config:this.generateConfigFromMenus(),selectedVariables:this.selectedVariables.map(e=>e.field)};this.$emit("save",e),this.dialogVisible=!1},$restoreConfig(e){if(!e||"object"!=typeof e)return;const t=new Set;Object.keys(e).forEach(i=>{const a=e[i];a&&a.values&&Array.isArray(a.values)&&a.values.forEach(e=>t.add(e))}),t.forEach(e=>{this.selectedVariables.find(t=>t.field===e)||this.selectedVariables.push({field:e,checked:!1})}),this.configValues={},Object.keys(e).forEach(t=>{const i=e[t];if(!i||!i.values||!Array.isArray(i.values)||0===i.values.length)return;const a=this.flatMenuItems.filter(e=>e.fieldName===t);if(0!==a.length)if(1===a.length){const e=a[0],t=e.pathString;e.multiple?this.$set(this.configValues,t,[...i.values]):this.$set(this.configValues,t,i.values[0])}else{const e=a.filter(e=>!e.multiple),t=a.filter(e=>e.multiple);if(t.length>0){const e=t[0];this.$set(this.configValues,e.pathString,[...i.values])}else e.length>0&&i.values.forEach((t,i)=>{if(i<e.length){const a=e[i];this.$set(this.configValues,a.pathString,t)}})}})},$getValues(){const e={};return Object.keys(this.configValues).forEach(t=>{const i=this.configValues[t];if(!i||Array.isArray(i)&&0===i.length)return;const a=this.flatMenuItems.find(e=>e.pathString===t);if(!a||!a.fieldName)return;const l=a.fieldName;e[l]||(e[l]={values:[]}),(Array.isArray(i)?i:[i]).forEach(t=>{e[l].values.includes(t)||e[l].values.push(t)})}),e},$getTableData(){return this.generateConfigFromMenus(),void 0,this.tableData}},install(e){e.component(n.name,n)}};e(".long-excel-viewer :deep(.el-dialog__body){padding:0 10px 10px}");var d={render(){var e=this,t=e.$createElement,i=e.i.t||t;return i("div",{staticClass:"long-excel-viewer"},[i("el-dialog",{attrs:{visible:e.dialogVisible,title:"示例文件",width:"1000px"},on:{"update:visible"(t){e.dialogVisible=t},close:e.handleClose},scopedSlots:e.k([{key:"title",fn:()=>[i("div",{staticStyle:{display:"flex","justify-content":"space-between"}},[i("div",{staticStyle:{display:"flex","align-items":"center",gap:"10px"}},[i("img",{attrs:{src:e.searchIcon}}),e.u(" "),i("div",{staticStyle:{"font-weight":"bold"}},[e.u("文件预览")])]),e.u(" "),i("div",{staticStyle:{"margin-right":"30px"}},[i("el-button",{attrs:{type:"primary",icon:"el-icon-download",size:"mini",disabled:!e.tableData.length||e.downloading,loading:e.downloading},on:{click:e.downloadExcel}},[e.u("下载")])],1)])],proxy:!0}])},[e.u(" "),e.tableData.length?i("el-table",{staticStyle:{width:"100%","margin-top":"20px"},attrs:{data:e.tableData,border:"",height:"500px"}},e.p(e.columns,function(e){return i("el-table-column",{key:e,attrs:{prop:e,label:e}})}),1):e.v(),e.u(" "),e.pagination.total>0?i("el-pagination",{staticStyle:{"margin-top":"20px","text-align":"center"},attrs:{"current-page":e.pagination.current,"page-sizes":[10,20,50,100],"page-size":e.pagination.pageSize,layout:"total, sizes, prev, pager, next, jumper",total:e.pagination.total},on:{"size-change":e.handleSizeChange,"current-change":e.handleCurrentChange}}):e.v()],1)],1)},staticRenderFns:[],name:"LongExcelViewer",props:{visible:{type:Boolean,default:!1},url:{type:String,default:""}},data(){return{searchIcon:s,tableData:[],columns:[],rawWorkbook:null,downloading:!1,VUE_APP_BASE_API:process.env.VUE_APP_BASE_API,pagination:{total:0,current:1,pageSize:20},queryParams:{fileId:"",pageNum:1,pageSize:20}}},computed:{dialogVisible:{get(){return this.visible},set(e){this.$emit("update:visible",e)}}},watch:{visible(e){e&&this.url&&this.loadExcelFromUrl()},url(e){e&&this.visible&&this.loadExcelFromUrl()}},methods:{async loadExcelFromUrl(){if(!this.url)return;const e=this.url.split("/").pop();this.queryParams.fileId=e;try{const e=await this.$api.dataAnalysis.filePreview(this.queryParams);void 0,e&&e.data&&e.data.records&&Array.isArray(e.data.records)?(this.processTableData(e.data.records),this.pagination.total=e.data.total||0,this.pagination.current=e.data.current||1,this.pagination.pageSize=e.data.size||20):this.$message.error("数据格式错误")}catch(t){void 0,this.$message.error("加载Excel文件失败: "+t.message)}},processTableData(e){const t=e[0];t&&t.headers&&t.data&&(1==this.pagination.current&&(this.columns=t.headers||[]),this.tableData=t.data||[])},processWorkbook(e){this.rawWorkbook=e;const t=e.Sheets[e.SheetNames[0]],a=i.sheet_to_json(t,{header:1});a.length&&(this.columns=a[0],this.tableData=a.slice(1).map(e=>{const t={};return this.columns.forEach((i,a)=>{t[i]=e[a]}),t}))},handleFileChange(e){const t=new FileReader;return t.onload=e=>{const t=new Uint8Array(e.target.result),i=a(t,{type:"array"});this.processWorkbook(i)},t.readAsArrayBuffer(e.raw),!1},downloadExcel(){if(!this.url||this.downloading)return;this.downloading=!0;const e=require("axios").create({baseURL:this.VUE_APP_BASE_API,timeout:3e4,responseType:"blob"});e.interceptors.request.use(e=>{const t=this.$store.getters.token||localStorage.getItem("token");return t&&(e.headers.Authorization="Bearer "+t),e}),e.interceptors.response.use(e=>("blob"===e.config.responseType,e),e=>Promise.reject(e));const t=this.url.split("/").pop();e.get("/file/upload/"+t).then(e=>{const t=e.data;let i="示例文件.xlsx";const a=e.headers["content-disposition"];if(a){const e=a.match(/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/);if(e&&e[1]){i=e[1].replace(/['"]/g,"");try{i=decodeURIComponent(i)}catch(s){void 0}}}l(t,i),this.$message.success("下载成功")}).catch(e=>{void 0,this.$message.error("下载失败,请重试")}).finally(()=>{this.downloading=!1})},closeDialog(){this.dialogVisible=!1},handleClose(){this.closeDialog(),this.tableData=[],this.columns=[],this.rawWorkbook=null},handleSizeChange(e){this.queryParams.pageSize=e,this.queryParams.pageNum=1,this.loadExcelFromUrl()},handleCurrentChange(e){this.queryParams.pageNum=e,this.loadExcelFromUrl()}},install(e){e.component(d.name,d)}};e("");var c={render(){var e=this,t=e.$createElement,i=e.i.t||t;return i("div",[i("el-button",{attrs:{size:"small",type:"primary",icon:"el-icon-setting"},on:{click:e.onAdjust}},[e.u("\n 调整变量\n ")]),e.u(" "),i("long-variable-viewer",{ref:"variableViewerRef",attrs:{visible:e.modalVisiable,values:e.values,menus:e.menus},on:{"update:visible"(t){e.modalVisiable=t},"config-changed":e.handleConfigChanged}})],1)},staticRenderFns:[],name:"LongVariableViewerButton",props:{values:{type:Array,default:()=>[]},menus:{type:Array,default:()=>[]}},data(){return{modalVisiable:!1,tableDataCache:[],updateTimer:null,valuesUpdateTimer:null,menusUpdateTimer:null,updatingTableData:!1}},mounted(){void 0,this.$nextTick(()=>{this.updateTableData()})},beforeDestroy(){this.updateTimer&&clearInterval(this.updateTimer),this.valuesUpdateTimer&&clearTimeout(this.valuesUpdateTimer),this.menusUpdateTimer&&clearTimeout(this.menusUpdateTimer)},watch:{modalVisiable(e){e||(this.$emit("update:columns",this.$refs.variableViewerRef.$getValues()),this.$nextTick(()=>{this.updateTableData()}))},values:{handler(){this.valuesUpdateTimer&&clearTimeout(this.valuesUpdateTimer),this.valuesUpdateTimer=setTimeout(()=>{this.updateTableData()},300)},deep:!0},menus:{handler(){this.menusUpdateTimer&&clearTimeout(this.menusUpdateTimer),this.menusUpdateTimer=setTimeout(()=>{this.updateTableData()},300)},deep:!0}},computed:{tableData(){return this.tableDataCache}},methods:{onAdjust(){this.modalVisiable=!0},$getValues(){return this.$refs.variableViewerRef.$getValues()},$triggerUpdate(){this.$emit("update:columns",this.$getValues()),this.$nextTick(()=>{this.updateTableData()})},$restoreConfig(e){this.$refs.variableViewerRef&&this.$refs.variableViewerRef.$restoreConfig&&(this.$refs.variableViewerRef.$restoreConfig(e),this.$nextTick(()=>{this.updateTableData()}))},handleConfigChanged(e){Array.isArray(e)&&(this.tableDataCache=e,this.$emit("table-data-updated",e))},updateTableData(){if(!this.updatingTableData)if(this.updatingTableData=!0,this.$refs.variableViewerRef&&this.$refs.variableViewerRef.$getTableData){const e=this.$refs.variableViewerRef.$getTableData()||[],t=JSON.parse(JSON.stringify(e)),i=JSON.parse(JSON.stringify(this.tableDataCache));JSON.stringify(t)!==JSON.stringify(i)?(this.tableDataCache=e,this.$nextTick(()=>{this.$emit("table-data-updated",e),this.updatingTableData=!1})):this.updatingTableData=!1}else this.tableDataCache.length>0&&(this.tableDataCache=[]),this.updatingTableData=!1}},install(e){e.component(c.name,c)}};e("");var p={render(){var e=this,t=e.$createElement,i=e.i.t||t;return i("div",{staticStyle:{display:"inline-block","margin-left":"4px"},on:{click(e){e.stopPropagation()}}},[i("el-button",{attrs:{type:"text",size:"small",icon:"el-icon-document"},on:{click:e.onExample}},[e.u("示例文件")]),e.u(" "),i("long-excel-viewer",{attrs:{visible:e.modalVisiable,url:e.url},on:{"update:visible"(t){e.modalVisiable=t}}})],1)},staticRenderFns:[],name:"LongExcelViewerButton",props:{url:{type:String,default:""}},data(){return{modalVisiable:!1}},methods:{onExample(e){e.stopPropagation(),e.preventDefault(),this.modalVisiable=!0}},install(e){e.component(p.name,p)}};e(".long-uploader-wrapper .el-form-item{margin-bottom:0}.long-uploader-wrapper :deep(.el-upload) .el-upload-dragger{height:130px!important}.long-uploader-wrapper :deep(.el-upload) .el-upload-dragger .el-icon-upload{margin:8px 0}.variable-config-section{background-color:#f8f9fa;border:1px solid #e9ecef;border-radius:4px;margin-top:16px}.config-header{align-items:center;background-color:#e8e9f2;border-bottom:1px solid #e9ecef;cursor:pointer;display:flex;justify-content:space-between;padding:0 12px;transition:background-color .2s}.config-header:hover{background-color:#f0f0f0}.config-title{color:#303133;font-size:14px;margin:0}.collapse-arrow{color:#909399;font-size:12px;transition:transform .3s ease}.collapse-arrow.is-collapsed{transform:rotate(-90deg)}.config-content{padding:12px}.variable-config-section .el-table{font-size:12px}.variable-config-section .el-table th{background-color:#f5f7fa;color:#606266;font-weight:600}.variable-config-section .el-table td{padding:8px 0}.no-data{color:#909399;font-size:14px;padding:20px;text-align:center}");var h={render(){var e=this,t=e.$createElement,i=e.i.t||t;return i("div",{staticClass:"long-uploader-wrapper"},[i("div",[i("div",{staticStyle:{float:"right","margin-top":"-80px"}},[e.options.example&&e.options.example.value?i("long-excel-viewer-button",{attrs:{url:e.options.example.value}}):e.v()],1),e.u(" "),i("div",{staticStyle:{display:"flex","align-items":"center","justify-content":"space-between","margin-bottom":"12px"}},[i("div",{staticStyle:{display:"flex","align-items":"center",gap:"12px",position:"relative"}},[i("el-upload",{attrs:{action:e.uploadUrl,headers:{Authorization:"Bearer "+e.token},"on-preview":e.handlePreview,"on-remove":e.handleRemove,"before-remove":e.beforeRemove,"on-change":e.handleChange,"before-upload":e.beforeUpload,accept:e.fileType,drag:"","on-exceed":e.handleExceed,"file-list":e.fileList}},[i("i",{staticClass:"el-icon-upload",staticStyle:{color:"#6C1537"}}),e.u(" "),i("div",{staticClass:"el-upload__text"},[i("div",{staticStyle:{"line-height":"18px"}},[e.u("将文件拖到此处,或"),i("em",[e.u("点击上传")])]),e.u(" "),i("div",{staticStyle:{"line-height":"18px"}},[e.u("\n 支持上传"),i("em",[e.u("xlsx")]),e.u("、"),i("em",[e.u("xls")]),e.u("、"),i("em",[e.u("csv")])])])])],1)]),e.u(" "),e.fileList.length>0?i("div",{staticStyle:{"margin-top":"-20px"}},[e.C(0),e.u(" "),i("div",[e.p(e.fileList,function(t){return i("el-tag",{key:t.uid,staticStyle:{"margin-right":"8px",cursor:"pointer"},attrs:{closable:""},on:{close:i=>e.handleRemove(t),click:i=>e.handleFileClick(t)}},[e.u("\n "+e.m(t.name)+"\n ")])}),e.u(" "),e.fileList.length>0&&e.options.variable&&e.options.variable.enable?i("div",{staticStyle:{display:"flex","align-items":"center"}},[i("span",{staticStyle:{color:"#f56c6c","margin-right":"5px"}},[e.u("*")]),e.u(" "),i("long-variable-viewer-button",{ref:"variableViewerRef",attrs:{values:e.fileData,menus:e.options.variable.menus},on:{"update:columns":e.handleUpdateColumns,"table-data-updated":e.handleTableDataUpdated}})],1):e.v()],2)]):e.v()]),e.u(" "),e.fileList.length>0&&e.options.variable&&e.options.variable.enable&&e.hasConfiguredVariables?i("div",{staticClass:"variable-config-section"},[i("div",{staticClass:"config-header",on:{click:e.toggleCollapse}},[i("span",{staticClass:"config-title"},[e.u("当前变量配置")]),e.u(" "),i("i",{staticClass:"el-icon-caret-bottom collapse-arrow",class:{"is-collapsed":e.isCollapsed}})]),e.u(" "),i("div",{directives:[{name:"show",rawName:"v-show",value:!e.isCollapsed,expression:"!isCollapsed"}],staticClass:"config-content"},[0===e.currentVariableValues.length?i("div",{staticClass:"no-data"},[e.u("\n 暂无数据\n ")]):i("el-table",{staticStyle:{width:"100%"},attrs:{data:e.currentVariableValues,size:"mini","max-height":"300",border:""}},[i("el-table-column",{attrs:{prop:"field",label:"字段名","show-overflow-tooltip":""}}),e.u(" "),i("el-table-column",{attrs:{prop:"fullPath",label:"属性","show-overflow-tooltip":""}})],1),e.u(" "),i("div",{staticClass:"debug-info",staticStyle:{"margin-top":"8px","font-size":"12px",color:"#999"}},[e.u("\n 数据条数: "+e.m(e.currentVariableValues.length)+"\n ")])],1)]):e.v(),e.u(" "),i("long-excel-viewer",{attrs:{visible:e.previewVisible,url:e.previewUrl},on:{"update:visible"(t){e.previewVisible=t}}})],1)},staticRenderFns:[function(){var e=this,t=e.$createElement,i=e.i.t||t;return i("div",{staticStyle:{"font-size":"12px",color:"#999","line-height":"20px"}},[i("i",{staticClass:"el-icon-info",staticStyle:{"margin-right":"5px"}}),e.u(" "),i("span",[e.u("点击文件名称可预览文件")])])}],name:"LongUploader",props:{options:{type:Object,default:()=>({variable:{enable:!1,values:[],menus:[]},example:{value:""},file:{id:"",name:""}})},value:{type:Object,default:()=>({fileId:"",columns:[],fileName:""})},fileId:{type:String,default:""},limit:{type:Number,default:1},fileSize:{type:Number,default:3},fileType:{type:String,default:".xlsx,.xls,.csv"}},data(){return{uploadUrl:process.env.VUE_APP_BASE_API+"/file/upload",fileList:[],token:"",fileData:[],fileToken:"",variableViewerRef:null,isCollapsed:!0,hasTriggerUpdate:!1,previewVisible:!1,previewUrl:"",tableDataCache:[]}},computed:{currentVariableValues(){return this.tableDataCache.map(e=>({field:e.field||"",fullPath:e.fullPath||"",varType:e.varType||"",attr:e.attr||""}))},hasConfiguredVariables(){return this.currentVariableValues.length>0}},created(){this.token=localStorage.getItem("token")},watch:{fileId:{handler(e){this.fileToken=e},immediate:!0,deep:!0},value:{handler(e,t){void 0,!e||!e.fileId||t&&t.fileId===e.fileId||(this.fileToken=e.fileId,this.downloadFile(e.fileId,e.columns||{})),!e||!e.fileName||t&&t.fileName===e.fileName||(this.fileList=[{name:e.fileName,uid:e.fileId}])},immediate:!0,deep:!0}},methods:{downloadFile(e,t={}){this.$api.dataAnalysis.filePreview({fileId:e}).then(e=>{if(e&&e.data&&e.data.records&&e.data.records.length>0){const i=e.data.records[0].headers||[];this.$emit("update:headers",i);const a=this.options.variable.menus||[],l={};i.forEach(e=>{l[e]={field:e,varType:"",attr:""}}),t&&"object"==typeof t&&Object.keys(t).forEach(e=>{const i=t[e];if(void 0,i&&i.values&&Array.isArray(i.values)){const t=a.find(t=>t.fieldName===e);void 0,t&&i.values.forEach(i=>{l[i]&&(l[i]={field:i,varType:t.label||e,attr:t.label||e})})}}),this.fileData=[{...l}],this.$nextTick(()=>{if(this.$refs.variableViewerRef&&t&&Object.keys(t).length>0&&"function"==typeof this.$refs.variableViewerRef.$restoreConfig&&(this.$refs.variableViewerRef.$restoreConfig(t),this.$nextTick(()=>{this.$refs.variableViewerRef&&"function"==typeof this.$refs.variableViewerRef.updateTableData&&this.$refs.variableViewerRef.updateTableData()})),this.$route.query.id){if(this.hasTriggerUpdate)return;"function"==typeof this.$refs.variableViewerRef.$triggerUpdate&&this.$refs.variableViewerRef.$triggerUpdate(),this.hasTriggerUpdate=!0}})}}).catch(e=>{this.$message.error(e.message||"数据文件内容不匹配,请重新上传")}).finally(()=>{this.loading=!1})},handleColumns(e=[]){const t=this.options.variable.menus||[];void 0,0!=t.length&&e.forEach(e=>{void 0;const i=t.find(t=>t.fieldName==e.fieldName);void 0,e.varType=i.label,e.attr=i.attr})},handleTableDataUpdated(e){Array.isArray(e)&&(this.tableDataCache=e)},handleUpdateColumns(e){void 0,this.$emit("update:columns",e)},beforeUpload(e){if(void 0,e.size>1048576*this.fileSize)return this.$message.error(`上传文件大小不能超过 ${this.fileSize} MB!`),!1;const t=e.type,i=e.name.toLowerCase();return!!(["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.ms-excel","text/csv"].includes(t)||i.endsWith(".xlsx")||i.endsWith(".xls")||i.endsWith(".csv"))||(this.$message.error("只支持上传 xlsx、xls、csv 格式的文件!"),!1)},handleChange(e,t){if(t.length>1?this.fileList=[t[t.length-1]]:this.fileList=t.filter(e=>void 0!==e.raw),"success"===e.status){const t=e.response;t&&200===t.code&&(this.fileToken=t.data.id,this.$emit("update:fileId",this.fileToken),this.loadFromUrl(this.fileToken))}},loadFromUrl(e){this.$api.dataAnalysis.filePreview({fileId:e}).then(e=>{if(e&&e.data&&e.data.records&&e.data.records.length>0){const t=(e.data.records[0]||{data:[],headers:[]}).headers||[];if(t.length>0){this.$emit("update:headers",t);const e={};t.forEach(t=>{e[t]={field:t,varType:"",attr:""}}),this.fileData=[{...e}]}else this.$emit("update:headers",[]),this.fileData=[]}})},handleRemove(e){this.fileList=this.fileList.filter(t=>t.uid!==e.uid),this.fileToken="",this.fileData=[],this.$emit("update:fileId",""),this.$emit("update:headers",[])},onAdjust(){this.$emit("adjust")},handleRemove1(e,t){void 0},handlePreview(e){void 0},handleExceed(e,t){this.$message.warning(`上传文件数量不能超过 ${this.limit} 个!`),t.length>this.limit&&(this.fileList=t.slice(-this.limit))},beforeRemove(){return!0},toggleCollapse(){this.isCollapsed=!this.isCollapsed},handleFileClick(){event.stopPropagation(),this.fileToken?(this.previewUrl=`${process.env.VUE_APP_BASE_API}/file/preview/${this.fileToken}`,this.previewVisible=!0):this.$message.warning("文件ID不存在,无法预览")}},install(e){e.component(h.name,h)}};e(".long-radio-wrapper{display:flex;flex-wrap:wrap}.long-radio-wrapper ::v-deep .el-radio{line-height:24px;margin-bottom:0}.long-radio-wrapper ::v-deep .el-radio__label{display:inline-block;vertical-align:middle;white-space:normal;word-break:break-all}.long-radio-item{margin:4px 12px 4px 0;width:100px}");var u={render(){var e=this,t=e.$createElement,i=e.i.t||t;return i("el-radio-group",e.l(e.o({staticClass:"long-radio-wrapper"},"el-radio-group",e.$attrs,!1),e.$listeners),e.p(e.options,function(t,a){return i("el-radio",{key:a,staticClass:"long-radio-item",attrs:{label:t[e.valueKey],disabled:t[e.disabledOption]}},[e.u("\n "+e.m(t[e.labelKey])+"\n ")])}),1)},staticRenderFns:[],name:"LongRadio",props:{dataList:{type:Array,default:()=>[]},disabledOption:{type:[Boolean,Number],default:!1},valueKey:{type:[String,Number],default:"value"},labelKey:{type:[String,Number],default:"label"},mode:{type:String,default:"local"},dict:{type:String,default:""},url:{type:String,default:""},requestParams:{type:Object,default(){}},placeholder:{type:String,default:"请选择"}},data(){return{options:[]}},watch:{dataList:{deep:!0,immediate:!0,handler(e){"local"===this.mode&&(this.options=e)}},dict:{deep:!0,handler(e){this.init()}}},created(){this.init()},methods:{init(){"remote"===this.mode&&this.dict&&this.getDicts(this.dict).then(e=>{this.options=(e.data||[]).map(e=>({[this.valueKey]:e.dictCode,[this.labelKey]:e.dictLabel}))})}},install(e){e.component(u.name,u)}};e(".long-group{background-color:#f8f8f8;box-sizing:border-box;height:100%;padding:10px;width:100%}.long-group .group-header{color:#333;font-size:14px;font-weight:700}");var f={render(){var e=this,t=e.$createElement,i=e.i.t||t;return i("div",{staticClass:"long-group"},[i("div",{staticClass:"group-header"},[e.u(e.m(e.label))]),e.u(" "),e.h("default")],2)},staticRenderFns:[],name:"LongGroup",props:{label:{type:String,default:""}},install(e){e.component(f.name,f)}};e(".long-color-picker{width:200px}.long-color-picker .el-color-picker__trigger{width:100%}.long-color-picker .el-color-picker__trigger .el-color-picker__icon{left:unset!important;right:5px!important;width:unset!important}");var g={render(){var e=this,t=e.$createElement;return(e.i.t||t)("el-color-picker",e.l(e.o({staticClass:"long-color-picker"},"el-color-picker",e.$attrs,!1),e.$listeners))},staticRenderFns:[],name:"LongColorPicker",install(e){e.component(g.name,g)}};e("");var b={render(){var e=this,t=e.$createElement;return(e.i.t||t)("el-input-number",e.l(e.o({staticClass:"long-number-input",attrs:{"controls-position":"right",step:e.stepValue,value:e.value,max:e.maxValue,min:e.minValue},on:{input:t=>e.$emit("input",t)}},"el-input-number",e.$attrs,!1),e.$listeners))},staticRenderFns:[],name:"LongNumberInput",props:{value:{type:[String,Number],default:0},placeholder:{type:String,default:"请输入"},max:{type:[Number,String],default:""},min:{type:[Number,String],default:""},step:{type:[Number,String],default:1}},data(){return{maxValue:""===this.max?Number.MAX_SAFE_INTEGER:+this.max,minValue:""===this.min?Number.MIN_SAFE_INTEGER:+this.min,stepValue:+this.step}},watch:{max:{handler(e){this.maxValue=""===e?Number.MAX_SAFE_INTEGER:+e},immediate:!0},min:{handler(e){this.minValue=""===e?Number.MIN_SAFE_INTEGER:+e},immediate:!0},step:{handler(e){this.stepValue=+e},immediate:!0}},install(e){e.component(b.name,b)}};e(".long-checkbox-wrapper{display:flex;flex-wrap:wrap}.long-checkbox-wrapper ::v-deep .el-checkbox{line-height:24px;margin-bottom:0}.long-checkbox-item{margin:1px 6px 1px 0;min-width:50px}");var m={render(){var e=this,t=e.$createElement,i=e.i.t||t;return i("el-checkbox-group",e.l(e.o({staticClass:"long-checkbox-wrapper",attrs:{value:e.value},on:{change:e.handleInput}},"el-checkbox-group",e.$attrs,!1),e.$listeners),e.p(e.options,function(t,a){return i("el-checkbox",{key:a,staticClass:"long-checkbox-item",attrs:{label:t[e.valueKey],disabled:e.getDisabled(t)}},[e.u("\n "+e.m(t[e.labelKey])+"\n ")])}),1)},staticRenderFns:[],name:"LongCheckBox",props:{value:{type:Array,default:()=>[]},dataList:{type:Array,default:()=>[]},disabledOption:{type:[String,Boolean,Number],default:!1},valueKey:{type:[String,Number],default:"value"},labelKey:{type:[String,Number],default:"label"},mode:{type:String,default:"local"},dict:{type:String,default:""},url:{type:String,default:""},requestParams:{type:Object,default(){}},placeholder:{type:String,default:"请选择"}},data(){return{options:[]}},watch:{dataList:{deep:!0,immediate:!0,handler(e){"local"===this.mode&&(this.options=e)}},dict:{deep:!0,handler(e){this.init()}}},created(){this.init()},methods:{init(){"remote"===this.mode&&this.dict&&this.getDicts(this.dict).then(e=>{this.options=(e.data||[]).map(e=>({[this.valueKey]:e.dictCode,[this.labelKey]:e.dictLabel}))})},handleInput(e){this.$emit("input",e),this.$emit("change",e)},getDisabled(e){return"string"==typeof this.disabledOption?e[this.disabledOption]||!1:"boolean"==typeof this.disabledOption?this.disabledOption:"number"==typeof this.disabledOption&&e[this.disabledOption]||!1}},install(e){e.component(m.name,m)}},x=[r,o,n,d,c,p,h,u,f,g,b,m],v=function(e){v.installed||(v.installed=!0,["ElInput","ElSelect","ElOption","ElCheckbox","ElCheckboxGroup","ElRadio","ElRadioGroup","ElButton","ElDialog","ElTable","ElTableColumn","ElUpload","ElTag","ElPagination","ElInputNumber","ElColorPicker","ElForm","ElFormItem","ElIcon"].forEach(function(i){var a=e.options.components[i];if(a){var l=t(i);l&&l!==i&&(e.options.components[l]||e.component(l,a))}}),x.forEach(function(i){if(i){var a=i.name||i.options&&i.options.name;if(a){e.component(a,i);var l=t(a);l&&l!==a&&e.component(l,i)}}}))};"undefined"!=typeof window&&window.Vue&&v(window.Vue);var y={version:"1.0.0",install:v,Input:r,Select:o,VariableViewer:n,ExcelViewer:d,VariableViewerButton:c,ExcelViewerButton:p,Uploader:h,Radio:u,Group:f,ColorPicker:g,NumberInput:b,CheckBox:m};export{m as CheckBox,g as ColorPicker,d as ExcelViewer,p as ExcelViewerButton,f as Group,r as Input,b as NumberInput,u as Radio,o as Select,h as Uploader,n as VariableViewer,c as VariableViewerButton,y as default};
|
|
1
|
+
function e(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var a=document.head||document.getElementsByTagName("head")[0],l=document.createElement("style");l.type="text/css","top"===i&&a.firstChild?a.insertBefore(l,a.firstChild):a.appendChild(l),l.styleSheet?l.styleSheet.cssText=e:l.appendChild(document.createTextNode(e))}}function t(e){return e?e.replace(/([A-Z])/g,"-$1").toLowerCase().replace(/^-/,""):e}import{utils as i,read as a}from"xlsx";import{saveAs as l}from"file-saver";import s from"@/assets/icon-search.png";e(".long-input-wrapper{background-color:#fff;border:1px solid #e0e0e0;border-radius:4px;padding:8px}.intTxt{width:80%}");var r={render(){var e=this,t=e.$createElement;return(e.i.t||t)("el-input",e.l(e.o({staticClass:"intTxt",attrs:{"show-word-limit":e.showWordLimit,placeholder:e.placeholder,"auto-complete":"new-password",disabled:e.disabled},on:{input(t){return e.$emit("input",t)}}},"el-input",e.$attrs,!1),e.$listeners),[e.p(Object.keys(this.$slots),function(t){return e.h(t,null,{slot:t})})],2)},staticRenderFns:[],name:"LongInput",props:{showWordLimit:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},placeholder:{type:String,default:"请输入"}},install(e){e.component(r.name,r)}};e("");var o={render(){var e=this,t=e.$createElement,i=e.i.t||t;return i("el-select",e.l(e.o({attrs:{value:e.value,placeholder:e.placeholder}},"el-select",e.$attrs,!1),e.$listeners),[e.h("unshift"),e.u(" "),e.h("default",function(){return e.p(e.options,function(t,a){return i("el-option",{key:a,attrs:{value:t[e.valueKey],label:t[e.labelKey],disabled:t[e.disabledOption]}})})},{slot:"default"}),e.u(" "),e.h("prefix",null,{slot:"prefix"}),e.u(" "),e.h("empty",null,{slot:"empty"})],2)},staticRenderFns:[],name:"LongSelect",props:{value:{type:[String,Number],default:""},dataList:{type:Array,default(){return[]}},disabledOption:{type:[Boolean,Number],default:!1},valueKey:{type:[String,Number],default:"value"},labelKey:{type:[String,Number],default:"label"},mode:{type:String,default:"local"},dict:{type:String,default:""},url:{type:String,default:""},requestParams:{type:Object,default(){}},placeholder:{type:String,default:"请选择"}},data:()=>({options:[]}),watch:{dataList:{deep:!0,immediate:!0,handler(e){"local"===this.mode&&(this.options=e)}},dict:{deep:!0,handler(e){this.init()}}},created(){this.init()},methods:{init(){"remote"===this.mode&&this.dict&&this.getDicts(this.dict).then(e=>{this.options=(e.data||[]).map(e=>({[this.valueKey]:e.dictCode,[this.labelKey]:e.dictLabel}))})}},install(e){e.component(o.name,o)}};e(".variable-config-dialog :deep(.el-dialog__body){padding:20px}.variable-config-dialog :deep(.el-dialog__header){padding:20px 20px 10px}.dialog-title{align-items:center;color:#303133;display:flex;font-size:16px;font-weight:700;gap:24px;padding:0 20px}.dialog-title .title-left{color:#303133;flex:1;min-width:500px}.dialog-title .title-separator{color:#dcdfe6;flex-shrink:0;font-weight:400}.dialog-title .title-right{color:#303133;flex:1;min-width:400px}.dialog-body{display:flex;gap:24px;min-height:500px}.left-section{flex:1;min-width:500px}.section-title{color:#303133;font-size:16px;font-weight:700;margin-bottom:16px}.variable-selector{align-items:flex-start;display:flex;gap:16px}.variable-panel{border:1px solid #dcdfe6;border-radius:4px;display:flex;flex:1;flex-direction:column;height:500px;overflow:hidden}.panel-header{align-items:center;background:#f5f7fa;border-bottom:1px solid #dcdfe6;display:flex;justify-content:space-between;padding:12px 16px}.select-all-checkbox :deep(.el-checkbox__label){padding-left:8px}.panel-title{color:#303133;font-weight:500}.panel-count{color:#909399;font-size:12px}.panel-search{border-bottom:1px solid #dcdfe6;padding:12px}.panel-list{flex:1;overflow-y:auto;padding:8px}.variable-item{border-radius:4px;cursor:pointer;padding:8px 12px;transition:background-color .2s}.variable-item:hover{background-color:#f5f7fa}.variable-item :deep(.el-checkbox){width:100%}.variable-item :deep(.el-checkbox__label){width:100%}.arrow-buttons{display:flex;flex-direction:column;gap:12px;justify-content:center;padding-top:100px}.arrow-buttons .el-button{margin-left:0!important}.right-section{display:flex;flex:1;flex-direction:column;min-width:400px;overflow:hidden}.config-desc{color:#909399;flex-shrink:0;font-size:13px;line-height:1.5;margin-bottom:24px}.config-group{margin-bottom:32px}.config-group:last-child{margin-bottom:0}.config-label{color:#303133;font-size:14px;font-weight:500;margin-bottom:12px}.config-options{display:flex;flex:1;flex-direction:column;gap:16px;margin-top:16px;overflow-x:hidden;overflow-y:auto;padding-right:8px}.config-options::-webkit-scrollbar{width:6px}.config-options::-webkit-scrollbar-track{background:#f1f1f1;border-radius:3px}.config-options::-webkit-scrollbar-thumb{background:#c1c1c1;border-radius:3px}.config-options::-webkit-scrollbar-thumb:hover{background:#a8a8a8}.config-option-row{align-items:center;display:flex;gap:12px;margin-bottom:8px}.config-option-row.is-parent .option-label{color:#303133;font-weight:500}.config-option-row.is-leaf .option-label{color:#606266}.option-label{color:#606266;flex:1;font-size:13px;min-width:0;white-space:normal;word-break:break-all}.option-label.required{color:#303133;font-weight:500}.option-label .required-mark{color:#f56c6c;margin-left:2px}.config-select{flex-shrink:0;width:350px}.non-leaf-label{color:#909399;font-size:13px;font-style:italic}.disabled-option{cursor:not-allowed!important}.disabled-option,.disabled-text{color:#c0c4cc!important}:deep(.el-select-dropdown__item.is-disabled){color:#c0c4cc!important;cursor:not-allowed!important}:deep(.el-select-dropdown__item.is-disabled) span{color:#c0c4cc!important}.checkbox-list{border:1px solid #dcdfe6;border-radius:4px;display:flex;flex:1;flex-direction:column;gap:8px;max-height:200px;overflow-y:auto;padding:8px}.dialog-footer{text-align:right}");var n={render(){var e=this,t=e.$createElement,i=e.i.t||t;return i("div",[i("el-dialog",{staticClass:"variable-config-dialog",staticStyle:{"max-height":"90vh"},attrs:{visible:e.dialogVisible,width:"1200px"},on:{"update:visible"(t){e.dialogVisible=t},close:e.handleClose}},[i("div",{staticClass:"dialog-title",attrs:{slot:"title"},slot:"title"},[i("span",{staticClass:"title-left"},[e.u("选择分析变量")]),e.u(" "),i("span",{staticClass:"title-separator"},[e.u("|")]),e.u(" "),i("span",{staticClass:"title-right"},[e.u("配置变量")])]),e.u(" "),i("div",{staticClass:"dialog-body"},[i("div",{staticClass:"left-section"},[i("div",{staticClass:"variable-selector"},[i("div",{staticClass:"variable-panel"},[i("div",{staticClass:"panel-header"},[i("el-checkbox",{staticClass:"select-all-checkbox",attrs:{indeterminate:e.leftIndeterminate},on:{change:e.handleLeftSelectAll},model:{value:e.leftSelectAll,callback(t){e.leftSelectAll=t},expression:"leftSelectAll"}},[i("span",{staticClass:"panel-title"},[e.u("全选")])]),e.u(" "),i("span",{staticClass:"panel-count"},[e.u(e.m(e.selectedAllCount)+"/"+e.m(e.allVariables.length))])],1),e.u(" "),i("div",{staticClass:"panel-search"},[i("el-input",{attrs:{placeholder:"请输入关键字","suffix-icon":"el-icon-search",size:"small"},on:{input:e.handleLeftSearch},model:{value:e.leftKeyword,callback(t){e.leftKeyword=t},expression:"leftKeyword"}})],1),e.u(" "),i("div",{staticClass:"panel-list"},e.p(e.filteredLeftVariables,function(t){return i("div",{key:t.field,staticClass:"variable-item"},[i("el-checkbox",{on:{change(i){return e.handleLeftCheckChange(t)}},model:{value:t.checked,callback(i){e.$set(t,"checked",i)},expression:"item.checked"}},[e.u("\n "+e.m(t.field)+"\n ")])],1)}),0)]),e.u(" "),i("div",{staticClass:"arrow-buttons"},[i("el-button",{attrs:{type:"primary",icon:"el-icon-arrow-right",size:"small",disabled:!e.hasLeftSelected},on:{click:e.moveToRight}}),e.u(" "),i("el-button",{attrs:{type:"danger",icon:"el-icon-arrow-left",size:"small",disabled:!e.hasRightSelected},on:{click:e.moveToLeft}})],1),e.u(" "),i("div",{staticClass:"variable-panel"},[i("div",{staticClass:"panel-header"},[i("el-checkbox",{staticClass:"select-all-checkbox",attrs:{indeterminate:e.rightIndeterminate},on:{change:e.handleRightSelectAll},model:{value:e.rightSelectAll,callback(t){e.rightSelectAll=t},expression:"rightSelectAll"}},[i("span",{staticClass:"panel-title"},[e.u("已选")])]),e.u(" "),i("span",{staticClass:"panel-count"},[e.u(e.m(e.selectedRightCount)+"/"+e.m(e.selectedVariables.length))])],1),e.u(" "),i("div",{staticClass:"panel-search"},[i("el-input",{attrs:{placeholder:"请输入关键字","suffix-icon":"el-icon-search",size:"small"},on:{input:e.handleRightSearch},model:{value:e.rightKeyword,callback(t){e.rightKeyword=t},expression:"rightKeyword"}})],1),e.u(" "),i("div",{staticClass:"panel-list"},e.p(e.filteredRightVariables,function(t){return i("div",{key:t.field,staticClass:"variable-item"},[i("el-checkbox",{on:{change(i){return e.handleRightCheckChange(t)}},model:{value:t.checked,callback(i){e.$set(t,"checked",i)},expression:"item.checked"}},[e.u("\n "+e.m(t.field)+"\n ")])],1)}),0)])])]),e.u(" "),i("div",{staticClass:"right-section"},[i("div",{staticClass:"config-desc"},[e.u("\n 数据文件中因变量的值,需赋予参考值,方便精准进行数据分析。\n ")]),e.u(" "),i("div",{staticClass:"config-options"},e.p(e.flatMenuItems,function(t){return i("div",{key:t.pathString,staticClass:"config-option-row"},[i("span",{staticClass:"option-label",class:{required:t.required}},[e.u("\n "+e.m(t.pathString)+"\n "),t.required?i("span",{staticClass:"required-mark"},[e.u("*")]):e.v()]),e.u(" "),i("el-select",{staticClass:"config-select",attrs:{placeholder:e.getPlaceholder(t),clearable:t.nullable,multiple:t.multiple},on:{change(i){return e.handleConfigChange(t.pathString,i)}},model:{value:e.configValues[t.pathString],callback(i){e.$set(e.configValues,t.pathString,i)},expression:"configValues[menuItem.pathString]"}},e.p(e.getAvailableOptions(t.pathString,t.multiple),function(t){return i("el-option",{key:t.value,class:{"disabled-option":t.disabled},attrs:{label:t.label,value:t.value,disabled:t.disabled}},[i("span",{class:{"disabled-text":t.disabled}},[e.u(e.m(t.label))])])}),1)],1)}),0)])]),e.u(" "),i("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[i("el-button",{on:{click:e.handleClose}},[e.u("取消")]),e.u(" "),i("el-button",{staticStyle:{color:"#fff"},attrs:{type:"primary"},on:{click:e.handleSave}},[e.u("保存")])],1)])],1)},staticRenderFns:[],name:"LongVariableViewer",props:{visible:{type:Boolean,default:!1},values:{type:Array,default(){return[]}},menus:{type:Array,default(){return[]}}},data:()=>({dialogVisible:!1,leftKeyword:"",rightKeyword:"",allVariables:[],selectedVariables:[],configValues:{},configChangeTimer:null}),computed:{filteredLeftVariables(){return this.leftKeyword?this.allVariables.filter(e=>e.field.toLowerCase().includes(this.leftKeyword.toLowerCase())):this.allVariables},filteredRightVariables(){return this.rightKeyword?this.selectedVariables.filter(e=>e.field.toLowerCase().includes(this.rightKeyword.toLowerCase())):this.selectedVariables},selectedAllCount(){return this.allVariables.filter(e=>e.checked).length},selectedRightCount(){return this.selectedVariables.filter(e=>e.checked).length},hasLeftSelected(){return this.allVariables.some(e=>e.checked)},hasRightSelected(){return this.selectedVariables.some(e=>e.checked)},leftSelectAll:{get(){const e=this.filteredLeftVariables;return 0!==e.length&&e.every(e=>e.checked)},set(){}},leftIndeterminate(){const e=this.filteredLeftVariables;if(0===e.length)return!1;const t=e.filter(e=>e.checked).length;return t>0&&t<e.length},rightSelectAll:{get(){const e=this.filteredRightVariables;return 0!==e.length&&e.every(e=>e.checked)},set(){}},rightIndeterminate(){const e=this.filteredRightVariables;if(0===e.length)return!1;const t=e.filter(e=>e.checked).length;return t>0&&t<e.length},flatMenuItems(){if(!this.menus||0===this.menus.length)return[];const e=[],t=(i,a=[])=>{const l=[...a,i.label];if(i.children&&0!==i.children.length)i.children&&i.children.length>0&&i.children.forEach(e=>{t(e,l)});else{const t=l.join("/");e.push({label:i.label,path:l,pathString:t,isLeaf:!0,id:i.id,fieldName:i.fieldName,required:i.required,nullable:i.nullable,multiple:i.multiple,originalMenu:i})}};return this.menus.forEach(e=>{t(e)}),e},tableData(){const e=[];return Object.keys(this.configValues).forEach(t=>{const i=this.configValues[t];if(!i||Array.isArray(i)&&0===i.length)return;const a=this.flatMenuItems.find(e=>e.pathString===t);if(!a)return;const l=a.pathString;(Array.isArray(i)?i:[i]).forEach(t=>{const i=t+"";i&&e.push({field:i,fullPath:l,varType:a.path&&a.path.length>0?a.path[0]:l,attr:a.path&&a.path.length>0?a.path[a.path.length-1]:""})})}),e}},watch:{visible:{handler(e){this.dialogVisible=e},immediate:!0},dialogVisible(e){this.$emit("update:visible",e)},values:{handler(e){this.handleValuesChange(e)},immediate:!0,deep:!0},selectedVariables:{handler(){const e=this.selectedVariables.map(e=>e.field),t={...this.configValues};let i=!1;Object.keys(t).forEach(a=>{const l=t[a];if(Array.isArray(l)){const s=l.filter(t=>e.includes(t));s.length!==l.length&&(t[a]=s,i=!0)}else l&&!e.includes(l)&&(t[a]="",i=!0)}),i&&(this.configValues=t)},deep:!0},configValues:{handler(){this.configChangeTimer&&clearTimeout(this.configChangeTimer),this.configChangeTimer=setTimeout(()=>{this.$nextTick(()=>{this.$emit("config-changed",this.tableData)})},100)},deep:!0}},methods:{handleValuesChange(e){if(!e||0===e.length)return this.allVariables=[],this.selectedVariables=[],void 0;const t=[];if(e.length>0){const i=e[0];"object"==typeof i&&null!==i&&t.push(...Object.keys(i))}this.allVariables=t.map(e=>({field:e,checked:!1})),this.selectedVariables=[]},handleLeftSearch(){},handleRightSearch(){},handleLeftCheckChange(){},handleRightCheckChange(){},handleLeftSelectAll(e){this.filteredLeftVariables.forEach(t=>{t.checked=e})},handleRightSelectAll(e){this.filteredRightVariables.forEach(t=>{t.checked=e})},moveToRight(){const e=this.allVariables.filter(e=>e.checked);0!==e.length&&(e.forEach(e=>{e.checked=!1,this.selectedVariables.find(t=>t.field===e.field)||this.selectedVariables.push({field:e.field,checked:!1})}),this.allVariables=this.allVariables.filter(t=>!e.some(e=>e.field===t.field)))},moveToLeft(){const e=this.selectedVariables.filter(e=>e.checked);0!==e.length&&(e.forEach(e=>{e.checked=!1,this.allVariables.find(t=>t.field===e.field)||this.allVariables.push({field:e.field,checked:!1})}),this.selectedVariables=this.selectedVariables.filter(t=>!e.some(e=>e.field===t.field)))},handleClose(){this.dialogVisible=!1},getPlaceholder:e=>e.required?"必选":e.nullable?"请选择":"必选",getAvailableOptions(e,t=!1){const i=this.selectedVariables.map(e=>e.field),a=this.configValues[e],l=t?Array.isArray(a)?a:[]:a?[a]:[],s=[];return Object.keys(this.configValues).forEach(t=>{if(t!==e&&this.configValues[t]){const e=this.configValues[t];Array.isArray(e)?s.push(...e):s.push(e)}}),i.map(e=>l.includes(e)?{label:e,value:e,disabled:!1}:{label:e,value:e,disabled:s.includes(e)})},handleConfigChange(e,t){this.$set(this.configValues,e,t);const i=this.flatMenuItems.find(t=>t.pathString===e);i&&i.multiple&&!Array.isArray(t)&&this.$set(this.configValues,e,t?[t]:[])},generateConfigFromMenus(){return this.flatMenuItems.forEach(e=>{e.pathString in this.configValues||(e.multiple?this.$set(this.configValues,e.pathString,[]):this.$set(this.configValues,e.pathString,""))}),{...this.configValues}},handleSave(){const e={config:this.generateConfigFromMenus(),selectedVariables:this.selectedVariables.map(e=>e.field)};this.$emit("save",e),this.dialogVisible=!1},$restoreConfig(e){if(!e||"object"!=typeof e)return;const t=new Set;Object.keys(e).forEach(i=>{const a=e[i];a&&a.values&&Array.isArray(a.values)&&a.values.forEach(e=>t.add(e))}),t.forEach(e=>{this.selectedVariables.find(t=>t.field===e)||this.selectedVariables.push({field:e,checked:!1})}),this.configValues={},Object.keys(e).forEach(t=>{const i=e[t];if(!i||!i.values||!Array.isArray(i.values)||0===i.values.length)return;const a=this.flatMenuItems.filter(e=>e.fieldName===t);if(0!==a.length)if(1===a.length){const e=a[0],t=e.pathString;e.multiple?this.$set(this.configValues,t,[...i.values]):this.$set(this.configValues,t,i.values[0])}else{const e=a.filter(e=>!e.multiple),t=a.filter(e=>e.multiple);if(t.length>0){const e=t[0];this.$set(this.configValues,e.pathString,[...i.values])}else e.length>0&&i.values.forEach((t,i)=>{if(i<e.length){const a=e[i];this.$set(this.configValues,a.pathString,t)}})}})},$getValues(){const e={};return Object.keys(this.configValues).forEach(t=>{const i=this.configValues[t];if(!i||Array.isArray(i)&&0===i.length)return;const a=this.flatMenuItems.find(e=>e.pathString===t);if(!a||!a.fieldName)return;const l=a.fieldName;e[l]||(e[l]={values:[]}),(Array.isArray(i)?i:[i]).forEach(t=>{e[l].values.includes(t)||e[l].values.push(t)})}),e},$getTableData(){return this.generateConfigFromMenus(),void 0,this.tableData}},install(e){e.component(n.name,n)}};e(".long-excel-viewer :deep(.el-dialog__body){padding:0 10px 10px}");var d={render(){var e=this,t=e.$createElement,i=e.i.t||t;return i("div",{staticClass:"long-excel-viewer"},[i("el-dialog",{attrs:{visible:e.dialogVisible,title:"示例文件",width:"1000px"},on:{"update:visible"(t){e.dialogVisible=t},close:e.handleClose},scopedSlots:e.k([{key:"title",fn(){return[i("div",{staticStyle:{display:"flex","justify-content":"space-between"}},[i("div",{staticStyle:{display:"flex","align-items":"center",gap:"10px"}},[i("img",{attrs:{src:e.searchIcon}}),e.u(" "),i("div",{staticStyle:{"font-weight":"bold"}},[e.u("文件预览")])]),e.u(" "),i("div",{staticStyle:{"margin-right":"30px"}},[i("el-button",{attrs:{type:"primary",icon:"el-icon-download",size:"mini",disabled:!e.tableData.length||e.downloading,loading:e.downloading},on:{click:e.downloadExcel}},[e.u("下载")])],1)])]},proxy:!0}])},[e.u(" "),e.tableData.length?i("el-table",{staticStyle:{width:"100%","margin-top":"20px"},attrs:{data:e.tableData,border:"",height:"500px"}},e.p(e.columns,function(e){return i("el-table-column",{key:e,attrs:{prop:e,label:e}})}),1):e.v(),e.u(" "),e.pagination.total>0?i("el-pagination",{staticStyle:{"margin-top":"20px","text-align":"center"},attrs:{"current-page":e.pagination.current,"page-sizes":[10,20,50,100],"page-size":e.pagination.pageSize,layout:"total, sizes, prev, pager, next, jumper",total:e.pagination.total},on:{"size-change":e.handleSizeChange,"current-change":e.handleCurrentChange}}):e.v()],1)],1)},staticRenderFns:[],name:"LongExcelViewer",props:{visible:{type:Boolean,default:!1},url:{type:String,default:""}},data:()=>({searchIcon:s,tableData:[],columns:[],rawWorkbook:null,downloading:!1,VUE_APP_BASE_API:process.env.VUE_APP_BASE_API,pagination:{total:0,current:1,pageSize:20},queryParams:{fileId:"",pageNum:1,pageSize:20}}),computed:{dialogVisible:{get(){return this.visible},set(e){this.$emit("update:visible",e)}}},watch:{visible(e){e&&this.url&&this.loadExcelFromUrl()},url(e){e&&this.visible&&this.loadExcelFromUrl()}},methods:{async loadExcelFromUrl(){if(!this.url)return;const e=this.url.split("/").pop();this.queryParams.fileId=e;try{const e=await this.$api.dataAnalysis.filePreview(this.queryParams);void 0,e&&e.data&&e.data.records&&Array.isArray(e.data.records)?(this.processTableData(e.data.records),this.pagination.total=e.data.total||0,this.pagination.current=e.data.current||1,this.pagination.pageSize=e.data.size||20):this.$message.error("数据格式错误")}catch(t){void 0,this.$message.error("加载Excel文件失败: "+t.message)}},processTableData(e){const t=e[0];t&&t.headers&&t.data&&(1==this.pagination.current&&(this.columns=t.headers||[]),this.tableData=t.data||[])},processWorkbook(e){this.rawWorkbook=e;const t=e.Sheets[e.SheetNames[0]],a=i.sheet_to_json(t,{header:1});a.length&&(this.columns=a[0],this.tableData=a.slice(1).map(e=>{const t={};return this.columns.forEach((i,a)=>{t[i]=e[a]}),t}))},handleFileChange(e){const t=new FileReader;return t.onload=e=>{const t=new Uint8Array(e.target.result),i=a(t,{type:"array"});this.processWorkbook(i)},t.readAsArrayBuffer(e.raw),!1},downloadExcel(){if(!this.url||this.downloading)return;this.downloading=!0;const e=require("axios").create({baseURL:this.VUE_APP_BASE_API,timeout:3e4,responseType:"blob"});e.interceptors.request.use(e=>{const t=this.$store.getters.token||localStorage.getItem("token");return t&&(e.headers.Authorization="Bearer "+t),e}),e.interceptors.response.use(e=>("blob"===e.config.responseType,e),e=>Promise.reject(e));const t=this.url.split("/").pop();e.get("/file/upload/"+t).then(e=>{const t=e.data;let i="示例文件.xlsx";const a=e.headers["content-disposition"];if(a){const e=a.match(/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/);if(e&&e[1]){i=e[1].replace(/['"]/g,"");try{i=decodeURIComponent(i)}catch(s){void 0}}}l(t,i),this.$message.success("下载成功")}).catch(e=>{void 0,this.$message.error("下载失败,请重试")}).finally(()=>{this.downloading=!1})},closeDialog(){this.dialogVisible=!1},handleClose(){this.closeDialog(),this.tableData=[],this.columns=[],this.rawWorkbook=null},handleSizeChange(e){this.queryParams.pageSize=e,this.queryParams.pageNum=1,this.loadExcelFromUrl()},handleCurrentChange(e){this.queryParams.pageNum=e,this.loadExcelFromUrl()}},install(e){e.component(d.name,d)}};e("");var c={render(){var e=this,t=e.$createElement,i=e.i.t||t;return i("div",[i("el-button",{attrs:{size:"small",type:"primary",icon:"el-icon-setting"},on:{click:e.onAdjust}},[e.u("\n 调整变量\n ")]),e.u(" "),i("long-variable-viewer",{ref:"variableViewerRef",attrs:{visible:e.modalVisiable,values:e.values,menus:e.menus},on:{"update:visible"(t){e.modalVisiable=t},"config-changed":e.handleConfigChanged}})],1)},staticRenderFns:[],name:"LongVariableViewerButton",props:{values:{type:Array,default(){return[]}},menus:{type:Array,default(){return[]}}},data:()=>({modalVisiable:!1,tableDataCache:[],updateTimer:null,valuesUpdateTimer:null,menusUpdateTimer:null,updatingTableData:!1}),mounted(){void 0,this.$nextTick(()=>{this.updateTableData()})},beforeDestroy(){this.updateTimer&&clearInterval(this.updateTimer),this.valuesUpdateTimer&&clearTimeout(this.valuesUpdateTimer),this.menusUpdateTimer&&clearTimeout(this.menusUpdateTimer)},watch:{modalVisiable(e){e||(this.$emit("update:columns",this.$refs.variableViewerRef.$getValues()),this.$nextTick(()=>{this.updateTableData()}))},values:{handler(){this.valuesUpdateTimer&&clearTimeout(this.valuesUpdateTimer),this.valuesUpdateTimer=setTimeout(()=>{this.updateTableData()},300)},deep:!0},menus:{handler(){this.menusUpdateTimer&&clearTimeout(this.menusUpdateTimer),this.menusUpdateTimer=setTimeout(()=>{this.updateTableData()},300)},deep:!0}},computed:{tableData(){return this.tableDataCache}},methods:{onAdjust(){this.modalVisiable=!0},$getValues(){return this.$refs.variableViewerRef.$getValues()},$triggerUpdate(){this.$emit("update:columns",this.$getValues()),this.$nextTick(()=>{this.updateTableData()})},$restoreConfig(e){this.$refs.variableViewerRef&&this.$refs.variableViewerRef.$restoreConfig&&(this.$refs.variableViewerRef.$restoreConfig(e),this.$nextTick(()=>{this.updateTableData()}))},handleConfigChanged(e){Array.isArray(e)&&(this.tableDataCache=e,this.$emit("table-data-updated",e))},updateTableData(){if(!this.updatingTableData)if(this.updatingTableData=!0,this.$refs.variableViewerRef&&this.$refs.variableViewerRef.$getTableData){const e=this.$refs.variableViewerRef.$getTableData()||[],t=JSON.parse(JSON.stringify(e)),i=JSON.parse(JSON.stringify(this.tableDataCache));JSON.stringify(t)!==JSON.stringify(i)?(this.tableDataCache=e,this.$nextTick(()=>{this.$emit("table-data-updated",e),this.updatingTableData=!1})):this.updatingTableData=!1}else this.tableDataCache.length>0&&(this.tableDataCache=[]),this.updatingTableData=!1}},install(e){e.component(c.name,c)}};e("");var p={render(){var e=this,t=e.$createElement,i=e.i.t||t;return i("div",{staticStyle:{display:"inline-block","margin-left":"4px"},on:{click(e){e.stopPropagation()}}},[i("el-button",{attrs:{type:"text",size:"small",icon:"el-icon-document"},on:{click:e.onExample}},[e.u("示例文件")]),e.u(" "),i("long-excel-viewer",{attrs:{visible:e.modalVisiable,url:e.url},on:{"update:visible"(t){e.modalVisiable=t}}})],1)},staticRenderFns:[],name:"LongExcelViewerButton",props:{url:{type:String,default:""}},data:()=>({modalVisiable:!1}),methods:{onExample(e){e.stopPropagation(),e.preventDefault(),this.modalVisiable=!0}},install(e){e.component(p.name,p)}};e(".long-uploader-wrapper .el-form-item{margin-bottom:0}.long-uploader-wrapper :deep(.el-upload) .el-upload-dragger{height:130px!important}.long-uploader-wrapper :deep(.el-upload) .el-upload-dragger .el-icon-upload{margin:8px 0}.variable-config-section{background-color:#f8f9fa;border:1px solid #e9ecef;border-radius:4px;margin-top:16px}.config-header{align-items:center;background-color:#e8e9f2;border-bottom:1px solid #e9ecef;cursor:pointer;display:flex;justify-content:space-between;padding:0 12px;transition:background-color .2s}.config-header:hover{background-color:#f0f0f0}.config-title{color:#303133;font-size:14px;margin:0}.collapse-arrow{color:#909399;font-size:12px;transition:transform .3s ease}.collapse-arrow.is-collapsed{transform:rotate(-90deg)}.config-content{padding:12px}.variable-config-section .el-table{font-size:12px}.variable-config-section .el-table th{background-color:#f5f7fa;color:#606266;font-weight:600}.variable-config-section .el-table td{padding:8px 0}.no-data{color:#909399;font-size:14px;padding:20px;text-align:center}");var h={render(){var e=this,t=e.$createElement,i=e.i.t||t;return i("div",{staticClass:"long-uploader-wrapper"},[i("div",[i("div",{staticStyle:{float:"right","margin-top":"-80px"}},[e.options.example&&e.options.example.value?i("long-excel-viewer-button",{attrs:{url:e.options.example.value}}):e.v()],1),e.u(" "),i("div",{staticStyle:{display:"flex","align-items":"center","justify-content":"space-between","margin-bottom":"12px"}},[i("div",{staticStyle:{display:"flex","align-items":"center",gap:"12px",position:"relative"}},[i("el-upload",{attrs:{action:e.uploadUrl,headers:{Authorization:"Bearer "+e.token},"on-preview":e.handlePreview,"on-remove":e.handleRemove,"before-remove":e.beforeRemove,"on-change":e.handleChange,"before-upload":e.beforeUpload,accept:e.fileType,drag:"","on-exceed":e.handleExceed,"file-list":e.fileList}},[i("i",{staticClass:"el-icon-upload",staticStyle:{color:"#6C1537"}}),e.u(" "),i("div",{staticClass:"el-upload__text"},[i("div",{staticStyle:{"line-height":"18px"}},[e.u("将文件拖到此处,或"),i("em",[e.u("点击上传")])]),e.u(" "),i("div",{staticStyle:{"line-height":"18px"}},[e.u("\n 支持上传"),i("em",[e.u("xlsx")]),e.u("、"),i("em",[e.u("xls")]),e.u("、"),i("em",[e.u("csv")])])])])],1)]),e.u(" "),e.fileList.length>0?i("div",{staticStyle:{"margin-top":"-20px"}},[e.C(0),e.u(" "),i("div",[e.p(e.fileList,function(t){return i("el-tag",{key:t.uid,staticStyle:{"margin-right":"8px",cursor:"pointer"},attrs:{closable:""},on:{close(i){return e.handleRemove(t)},click(i){return e.handleFileClick(t)}}},[e.u("\n "+e.m(t.name)+"\n ")])}),e.u(" "),e.fileList.length>0&&e.options.variable&&e.options.variable.enable?i("div",{staticStyle:{display:"flex","align-items":"center"}},[i("span",{staticStyle:{color:"#f56c6c","margin-right":"5px"}},[e.u("*")]),e.u(" "),i("long-variable-viewer-button",{ref:"variableViewerRef",attrs:{values:e.fileData,menus:e.options.variable.menus},on:{"update:columns":e.handleUpdateColumns,"table-data-updated":e.handleTableDataUpdated}})],1):e.v()],2)]):e.v()]),e.u(" "),e.fileList.length>0&&e.options.variable&&e.options.variable.enable&&e.hasConfiguredVariables?i("div",{staticClass:"variable-config-section"},[i("div",{staticClass:"config-header",on:{click:e.toggleCollapse}},[i("span",{staticClass:"config-title"},[e.u("当前变量配置")]),e.u(" "),i("i",{staticClass:"el-icon-caret-bottom collapse-arrow",class:{"is-collapsed":e.isCollapsed}})]),e.u(" "),i("div",{directives:[{name:"show",rawName:"v-show",value:!e.isCollapsed,expression:"!isCollapsed"}],staticClass:"config-content"},[0===e.currentVariableValues.length?i("div",{staticClass:"no-data"},[e.u("\n 暂无数据\n ")]):i("el-table",{staticStyle:{width:"100%"},attrs:{data:e.currentVariableValues,size:"mini","max-height":"300",border:""}},[i("el-table-column",{attrs:{prop:"field",label:"字段名","show-overflow-tooltip":""}}),e.u(" "),i("el-table-column",{attrs:{prop:"fullPath",label:"属性","show-overflow-tooltip":""}})],1),e.u(" "),i("div",{staticClass:"debug-info",staticStyle:{"margin-top":"8px","font-size":"12px",color:"#999"}},[e.u("\n 数据条数: "+e.m(e.currentVariableValues.length)+"\n ")])],1)]):e.v(),e.u(" "),i("long-excel-viewer",{attrs:{visible:e.previewVisible,url:e.previewUrl},on:{"update:visible"(t){e.previewVisible=t}}})],1)},staticRenderFns:[function(){var e=this,t=e.$createElement,i=e.i.t||t;return i("div",{staticStyle:{"font-size":"12px",color:"#999","line-height":"20px"}},[i("i",{staticClass:"el-icon-info",staticStyle:{"margin-right":"5px"}}),e.u(" "),i("span",[e.u("点击文件名称可预览文件")])])}],name:"LongUploader",props:{options:{type:Object,default(){return{variable:{enable:!1,values:[],menus:[]},example:{value:""},file:{id:"",name:""}}}},value:{type:Object,default(){return{fileId:"",columns:[],fileName:""}}},fileId:{type:String,default:""},limit:{type:Number,default:1},fileSize:{type:Number,default:3},fileType:{type:String,default:".xlsx,.xls,.csv"}},data:()=>({uploadUrl:process.env.VUE_APP_BASE_API+"/file/upload",fileList:[],token:"",fileData:[],fileToken:"",variableViewerRef:null,isCollapsed:!0,hasTriggerUpdate:!1,previewVisible:!1,previewUrl:"",tableDataCache:[]}),computed:{currentVariableValues(){return this.tableDataCache.map(e=>({field:e.field||"",fullPath:e.fullPath||"",varType:e.varType||"",attr:e.attr||""}))},hasConfiguredVariables(){return this.currentVariableValues.length>0}},created(){this.token=localStorage.getItem("token")},watch:{fileId:{handler(e){this.fileToken=e},immediate:!0,deep:!0},value:{handler(e,t){void 0,!e||!e.fileId||t&&t.fileId===e.fileId||(this.fileToken=e.fileId,this.downloadFile(e.fileId,e.columns||{})),!e||!e.fileName||t&&t.fileName===e.fileName||(this.fileList=[{name:e.fileName,uid:e.fileId}])},immediate:!0,deep:!0}},methods:{downloadFile(e,t={}){this.$api.dataAnalysis.filePreview({fileId:e}).then(e=>{if(e&&e.data&&e.data.records&&e.data.records.length>0){const i=e.data.records[0].headers||[];this.$emit("update:headers",i);const a=this.options.variable.menus||[],l={};i.forEach(e=>{l[e]={field:e,varType:"",attr:""}}),t&&"object"==typeof t&&Object.keys(t).forEach(e=>{const i=t[e];if(void 0,i&&i.values&&Array.isArray(i.values)){const t=a.find(t=>t.fieldName===e);void 0,t&&i.values.forEach(i=>{l[i]&&(l[i]={field:i,varType:t.label||e,attr:t.label||e})})}}),this.fileData=[{...l}],this.$nextTick(()=>{if(this.$refs.variableViewerRef&&t&&Object.keys(t).length>0&&"function"==typeof this.$refs.variableViewerRef.$restoreConfig&&(this.$refs.variableViewerRef.$restoreConfig(t),this.$nextTick(()=>{this.$refs.variableViewerRef&&"function"==typeof this.$refs.variableViewerRef.updateTableData&&this.$refs.variableViewerRef.updateTableData()})),this.$route.query.id){if(this.hasTriggerUpdate)return;"function"==typeof this.$refs.variableViewerRef.$triggerUpdate&&this.$refs.variableViewerRef.$triggerUpdate(),this.hasTriggerUpdate=!0}})}}).catch(e=>{this.$message.error(e.message||"数据文件内容不匹配,请重新上传")}).finally(()=>{this.loading=!1})},handleColumns(e=[]){const t=this.options.variable.menus||[];void 0,0!=t.length&&e.forEach(e=>{void 0;const i=t.find(t=>t.fieldName==e.fieldName);void 0,e.varType=i.label,e.attr=i.attr})},handleTableDataUpdated(e){Array.isArray(e)&&(this.tableDataCache=e)},handleUpdateColumns(e){void 0,this.$emit("update:columns",e)},beforeUpload(e){if(void 0,e.size>1048576*this.fileSize)return this.$message.error(`上传文件大小不能超过 ${this.fileSize} MB!`),!1;const t=e.type,i=e.name.toLowerCase();return!!(["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.ms-excel","text/csv"].includes(t)||i.endsWith(".xlsx")||i.endsWith(".xls")||i.endsWith(".csv"))||(this.$message.error("只支持上传 xlsx、xls、csv 格式的文件!"),!1)},handleChange(e,t){if(t.length>1?this.fileList=[t[t.length-1]]:this.fileList=t.filter(e=>void 0!==e.raw),"success"===e.status){const t=e.response;t&&200===t.code&&(this.fileToken=t.data.id,this.$emit("update:fileId",this.fileToken),this.loadFromUrl(this.fileToken))}},loadFromUrl(e){this.$api.dataAnalysis.filePreview({fileId:e}).then(e=>{if(e&&e.data&&e.data.records&&e.data.records.length>0){const t=(e.data.records[0]||{data:[],headers:[]}).headers||[];if(t.length>0){this.$emit("update:headers",t);const e={};t.forEach(t=>{e[t]={field:t,varType:"",attr:""}}),this.fileData=[{...e}]}else this.$emit("update:headers",[]),this.fileData=[]}})},handleRemove(e){this.fileList=this.fileList.filter(t=>t.uid!==e.uid),this.fileToken="",this.fileData=[],this.$emit("update:fileId",""),this.$emit("update:headers",[])},onAdjust(){this.$emit("adjust")},handleRemove1(e,t){void 0},handlePreview(e){void 0},handleExceed(e,t){this.$message.warning(`上传文件数量不能超过 ${this.limit} 个!`),t.length>this.limit&&(this.fileList=t.slice(-this.limit))},beforeRemove:()=>!0,toggleCollapse(){this.isCollapsed=!this.isCollapsed},handleFileClick(){event.stopPropagation(),this.fileToken?(this.previewUrl=`${process.env.VUE_APP_BASE_API}/file/preview/${this.fileToken}`,this.previewVisible=!0):this.$message.warning("文件ID不存在,无法预览")}},install(e){e.component(h.name,h)}};e(".long-radio-wrapper{display:flex;flex-wrap:wrap}.long-radio-wrapper ::v-deep .el-radio{line-height:24px;margin-bottom:0}.long-radio-wrapper ::v-deep .el-radio__label{display:inline-block;vertical-align:middle;white-space:normal;word-break:break-all}.long-radio-item{margin:4px 12px 4px 0;width:100px}");var u={render(){var e=this,t=e.$createElement,i=e.i.t||t;return i("el-radio-group",e.l(e.o({staticClass:"long-radio-wrapper"},"el-radio-group",e.$attrs,!1),e.$listeners),e.p(e.options,function(t,a){return i("el-radio",{key:a,staticClass:"long-radio-item",attrs:{label:t[e.valueKey],disabled:t[e.disabledOption]}},[e.u("\n "+e.m(t[e.labelKey])+"\n ")])}),1)},staticRenderFns:[],name:"LongRadio",props:{dataList:{type:Array,default(){return[]}},disabledOption:{type:[Boolean,Number],default:!1},valueKey:{type:[String,Number],default:"value"},labelKey:{type:[String,Number],default:"label"},mode:{type:String,default:"local"},dict:{type:String,default:""},url:{type:String,default:""},requestParams:{type:Object,default(){}},placeholder:{type:String,default:"请选择"}},data:()=>({options:[]}),watch:{dataList:{deep:!0,immediate:!0,handler(e){"local"===this.mode&&(this.options=e)}},dict:{deep:!0,handler(e){this.init()}}},created(){this.init()},methods:{init(){"remote"===this.mode&&this.dict&&this.getDicts(this.dict).then(e=>{this.options=(e.data||[]).map(e=>({[this.valueKey]:e.dictCode,[this.labelKey]:e.dictLabel}))})}},install(e){e.component(u.name,u)}};e(".long-group{background-color:#f8f8f8;box-sizing:border-box;height:100%;padding:10px;width:100%}.long-group .group-header{color:#333;font-size:14px;font-weight:700}");var f={render(){var e=this,t=e.$createElement,i=e.i.t||t;return i("div",{staticClass:"long-group"},[i("div",{staticClass:"group-header"},[e.u(e.m(e.label))]),e.u(" "),e.h("default")],2)},staticRenderFns:[],name:"LongGroup",props:{label:{type:String,default:""}},install(e){e.component(f.name,f)}};e(".long-color-picker{width:200px}.long-color-picker .el-color-picker__trigger{width:100%}.long-color-picker .el-color-picker__trigger .el-color-picker__icon{left:unset!important;right:5px!important;width:unset!important}");var g={render(){var e=this,t=e.$createElement;return(e.i.t||t)("el-color-picker",e.l(e.o({staticClass:"long-color-picker"},"el-color-picker",e.$attrs,!1),e.$listeners))},staticRenderFns:[],name:"LongColorPicker",install(e){e.component(g.name,g)}};e("");var b={render(){var e=this,t=e.$createElement;return(e.i.t||t)("el-input-number",e.l(e.o({staticClass:"long-number-input",attrs:{"controls-position":"right",step:e.stepValue,value:e.value,max:e.maxValue,min:e.minValue},on:{input(t){return e.$emit("input",t)}}},"el-input-number",e.$attrs,!1),e.$listeners))},staticRenderFns:[],name:"LongNumberInput",props:{value:{type:[String,Number],default:0},placeholder:{type:String,default:"请输入"},max:{type:[Number,String],default:""},min:{type:[Number,String],default:""},step:{type:[Number,String],default:1}},data(){return{maxValue:""===this.max?Number.MAX_SAFE_INTEGER:+this.max,minValue:""===this.min?Number.MIN_SAFE_INTEGER:+this.min,stepValue:+this.step}},watch:{max:{handler(e){this.maxValue=""===e?Number.MAX_SAFE_INTEGER:+e},immediate:!0},min:{handler(e){this.minValue=""===e?Number.MIN_SAFE_INTEGER:+e},immediate:!0},step:{handler(e){this.stepValue=+e},immediate:!0}},install(e){e.component(b.name,b)}};e(".long-checkbox-wrapper{display:flex;flex-wrap:wrap}.long-checkbox-wrapper ::v-deep .el-checkbox{line-height:24px;margin-bottom:0}.long-checkbox-item{margin:1px 6px 1px 0;min-width:50px}");var m={render(){var e=this,t=e.$createElement,i=e.i.t||t;return i("el-checkbox-group",e.l(e.o({staticClass:"long-checkbox-wrapper",attrs:{value:e.value},on:{change:e.handleInput}},"el-checkbox-group",e.$attrs,!1),e.$listeners),e.p(e.options,function(t,a){return i("el-checkbox",{key:a,staticClass:"long-checkbox-item",attrs:{label:t[e.valueKey],disabled:e.getDisabled(t)}},[e.u("\n "+e.m(t[e.labelKey])+"\n ")])}),1)},staticRenderFns:[],name:"LongCheckBox",props:{value:{type:Array,default(){return[]}},dataList:{type:Array,default(){return[]}},disabledOption:{type:[String,Boolean,Number],default:!1},valueKey:{type:[String,Number],default:"value"},labelKey:{type:[String,Number],default:"label"},mode:{type:String,default:"local"},dict:{type:String,default:""},url:{type:String,default:""},requestParams:{type:Object,default(){}},placeholder:{type:String,default:"请选择"}},data:()=>({options:[]}),watch:{dataList:{deep:!0,immediate:!0,handler(e){"local"===this.mode&&(this.options=e)}},dict:{deep:!0,handler(e){this.init()}}},created(){this.init()},methods:{init(){"remote"===this.mode&&this.dict&&this.getDicts(this.dict).then(e=>{this.options=(e.data||[]).map(e=>({[this.valueKey]:e.dictCode,[this.labelKey]:e.dictLabel}))})},handleInput(e){this.$emit("input",e),this.$emit("change",e)},getDisabled(e){return"string"==typeof this.disabledOption?e[this.disabledOption]||!1:"boolean"==typeof this.disabledOption?this.disabledOption:"number"==typeof this.disabledOption&&e[this.disabledOption]||!1}},install(e){e.component(m.name,m)}},x=[r,o,n,d,c,p,h,u,f,g,b,m],v=function(e){if(!v.installed){v.installed=!0;var i=["ElInput","ElSelect","ElOption","ElCheckbox","ElCheckboxGroup","ElRadio","ElRadioGroup","ElButton","ElDialog","ElTable","ElTableColumn","ElUpload","ElTag","ElPagination","ElInputNumber","ElColorPicker","ElForm","ElFormItem","ElIcon"];i.forEach(function(i){var a=e.options.components[i];if(!a){var l=t(i);a=e.options.components[l]}if(a){var s=t(i);s&&s!==i&&(e.options.components[s]||e.component(s,a)),e.options.components[i]||e.component(i,a)}else"production"!==process.env.NODE_ENV,0}),e.nextTick(function(){i.forEach(function(i){var a=e.options.components[i];if(a){var l=t(i);l&&l!==i&&(e.options.components[l]||e.component(l,a))}})}),x.forEach(function(i){if(i){var a=i.name||i.options&&i.options.name;if(a){e.component(a,i);var l=t(a);l&&l!==a&&e.component(l,i)}}})}};"undefined"!=typeof window&&window.Vue&&v(window.Vue);var y={version:"1.0.0",install:v,Input:r,Select:o,VariableViewer:n,ExcelViewer:d,VariableViewerButton:c,ExcelViewerButton:p,Uploader:h,Radio:u,Group:f,ColorPicker:g,NumberInput:b,CheckBox:m};export{m as CheckBox,g as ColorPicker,d as ExcelViewer,p as ExcelViewerButton,f as Group,r as Input,b as NumberInput,u as Radio,o as Select,h as Uploader,n as VariableViewer,c as VariableViewerButton,y as default};
|
package/lib/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function e(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var a=document.head||document.getElementsByTagName("head")[0],l=document.createElement("style");l.type="text/css","top"===i&&a.firstChild?a.insertBefore(l,a.firstChild):a.appendChild(l),l.styleSheet?l.styleSheet.cssText=e:l.appendChild(document.createTextNode(e))}}function t(e){return e?e.replace(/([A-Z])/g,"-$1").toLowerCase().replace(/^-/,""):e}Object.defineProperty(exports,"t",{value:!0});var i=require("xlsx"),a=require("file-saver"),l=function(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}(require("@/assets/icon-search.png"));e(".long-input-wrapper{background-color:#fff;border:1px solid #e0e0e0;border-radius:4px;padding:8px}.intTxt{width:80%}");var s={render(){var e=this,t=e.$createElement;return(e.l.i||t)("el-input",e.o(e.p({staticClass:"intTxt",attrs:{"show-word-limit":e.showWordLimit,placeholder:e.placeholder,"auto-complete":"new-password",disabled:e.disabled},on:{input:t=>e.$emit("input",t)}},"el-input",e.$attrs,!1),e.$listeners),[e.h(Object.keys(this.$slots),function(t){return e.u(t,null,{slot:t})})],2)},staticRenderFns:[],name:"LongInput",props:{showWordLimit:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},placeholder:{type:String,default:"请输入"}},install(e){e.component(s.name,s)}};e("");var r={render(){var e=this,t=e.$createElement,i=e.l.i||t;return i("el-select",e.o(e.p({attrs:{value:e.value,placeholder:e.placeholder}},"el-select",e.$attrs,!1),e.$listeners),[e.u("unshift"),e.m(" "),e.u("default",function(){return e.h(e.options,function(t,a){return i("el-option",{key:a,attrs:{value:t[e.valueKey],label:t[e.labelKey],disabled:t[e.disabledOption]}})})},{slot:"default"}),e.m(" "),e.u("prefix",null,{slot:"prefix"}),e.m(" "),e.u("empty",null,{slot:"empty"})],2)},staticRenderFns:[],name:"LongSelect",props:{value:{type:[String,Number],default:""},dataList:{type:Array,default:()=>[]},disabledOption:{type:[Boolean,Number],default:!1},valueKey:{type:[String,Number],default:"value"},labelKey:{type:[String,Number],default:"label"},mode:{type:String,default:"local"},dict:{type:String,default:""},url:{type:String,default:""},requestParams:{type:Object,default(){}},placeholder:{type:String,default:"请选择"}},data(){return{options:[]}},watch:{dataList:{deep:!0,immediate:!0,handler(e){"local"===this.mode&&(this.options=e)}},dict:{deep:!0,handler(e){this.init()}}},created(){this.init()},methods:{init(){"remote"===this.mode&&this.dict&&this.getDicts(this.dict).then(e=>{this.options=(e.data||[]).map(e=>({[this.valueKey]:e.dictCode,[this.labelKey]:e.dictLabel}))})}},install(e){e.component(r.name,r)}};e(".variable-config-dialog :deep(.el-dialog__body){padding:20px}.variable-config-dialog :deep(.el-dialog__header){padding:20px 20px 10px}.dialog-title{align-items:center;color:#303133;display:flex;font-size:16px;font-weight:700;gap:24px;padding:0 20px}.dialog-title .title-left{color:#303133;flex:1;min-width:500px}.dialog-title .title-separator{color:#dcdfe6;flex-shrink:0;font-weight:400}.dialog-title .title-right{color:#303133;flex:1;min-width:400px}.dialog-body{display:flex;gap:24px;min-height:500px}.left-section{flex:1;min-width:500px}.section-title{color:#303133;font-size:16px;font-weight:700;margin-bottom:16px}.variable-selector{align-items:flex-start;display:flex;gap:16px}.variable-panel{border:1px solid #dcdfe6;border-radius:4px;display:flex;flex:1;flex-direction:column;height:500px;overflow:hidden}.panel-header{align-items:center;background:#f5f7fa;border-bottom:1px solid #dcdfe6;display:flex;justify-content:space-between;padding:12px 16px}.select-all-checkbox :deep(.el-checkbox__label){padding-left:8px}.panel-title{color:#303133;font-weight:500}.panel-count{color:#909399;font-size:12px}.panel-search{border-bottom:1px solid #dcdfe6;padding:12px}.panel-list{flex:1;overflow-y:auto;padding:8px}.variable-item{border-radius:4px;cursor:pointer;padding:8px 12px;transition:background-color .2s}.variable-item:hover{background-color:#f5f7fa}.variable-item :deep(.el-checkbox){width:100%}.variable-item :deep(.el-checkbox__label){width:100%}.arrow-buttons{display:flex;flex-direction:column;gap:12px;justify-content:center;padding-top:100px}.arrow-buttons .el-button{margin-left:0!important}.right-section{display:flex;flex:1;flex-direction:column;min-width:400px;overflow:hidden}.config-desc{color:#909399;flex-shrink:0;font-size:13px;line-height:1.5;margin-bottom:24px}.config-group{margin-bottom:32px}.config-group:last-child{margin-bottom:0}.config-label{color:#303133;font-size:14px;font-weight:500;margin-bottom:12px}.config-options{display:flex;flex:1;flex-direction:column;gap:16px;margin-top:16px;overflow-x:hidden;overflow-y:auto;padding-right:8px}.config-options::-webkit-scrollbar{width:6px}.config-options::-webkit-scrollbar-track{background:#f1f1f1;border-radius:3px}.config-options::-webkit-scrollbar-thumb{background:#c1c1c1;border-radius:3px}.config-options::-webkit-scrollbar-thumb:hover{background:#a8a8a8}.config-option-row{align-items:center;display:flex;gap:12px;margin-bottom:8px}.config-option-row.is-parent .option-label{color:#303133;font-weight:500}.config-option-row.is-leaf .option-label{color:#606266}.option-label{color:#606266;flex:1;font-size:13px;min-width:0;white-space:normal;word-break:break-all}.option-label.required{color:#303133;font-weight:500}.option-label .required-mark{color:#f56c6c;margin-left:2px}.config-select{flex-shrink:0;width:350px}.non-leaf-label{color:#909399;font-size:13px;font-style:italic}.disabled-option{cursor:not-allowed!important}.disabled-option,.disabled-text{color:#c0c4cc!important}:deep(.el-select-dropdown__item.is-disabled){color:#c0c4cc!important;cursor:not-allowed!important}:deep(.el-select-dropdown__item.is-disabled) span{color:#c0c4cc!important}.checkbox-list{border:1px solid #dcdfe6;border-radius:4px;display:flex;flex:1;flex-direction:column;gap:8px;max-height:200px;overflow-y:auto;padding:8px}.dialog-footer{text-align:right}");var o={render(){var e=this,t=e.$createElement,i=e.l.i||t;return i("div",[i("el-dialog",{staticClass:"variable-config-dialog",staticStyle:{"max-height":"90vh"},attrs:{visible:e.dialogVisible,width:"1200px"},on:{"update:visible"(t){e.dialogVisible=t},close:e.handleClose}},[i("div",{staticClass:"dialog-title",attrs:{slot:"title"},slot:"title"},[i("span",{staticClass:"title-left"},[e.m("选择分析变量")]),e.m(" "),i("span",{staticClass:"title-separator"},[e.m("|")]),e.m(" "),i("span",{staticClass:"title-right"},[e.m("配置变量")])]),e.m(" "),i("div",{staticClass:"dialog-body"},[i("div",{staticClass:"left-section"},[i("div",{staticClass:"variable-selector"},[i("div",{staticClass:"variable-panel"},[i("div",{staticClass:"panel-header"},[i("el-checkbox",{staticClass:"select-all-checkbox",attrs:{indeterminate:e.leftIndeterminate},on:{change:e.handleLeftSelectAll},model:{value:e.leftSelectAll,callback(t){e.leftSelectAll=t},expression:"leftSelectAll"}},[i("span",{staticClass:"panel-title"},[e.m("全选")])]),e.m(" "),i("span",{staticClass:"panel-count"},[e.m(e.v(e.selectedAllCount)+"/"+e.v(e.allVariables.length))])],1),e.m(" "),i("div",{staticClass:"panel-search"},[i("el-input",{attrs:{placeholder:"请输入关键字","suffix-icon":"el-icon-search",size:"small"},on:{input:e.handleLeftSearch},model:{value:e.leftKeyword,callback(t){e.leftKeyword=t},expression:"leftKeyword"}})],1),e.m(" "),i("div",{staticClass:"panel-list"},e.h(e.filteredLeftVariables,function(t){return i("div",{key:t.field,staticClass:"variable-item"},[i("el-checkbox",{on:{change:i=>e.handleLeftCheckChange(t)},model:{value:t.checked,callback(i){e.$set(t,"checked",i)},expression:"item.checked"}},[e.m("\n "+e.v(t.field)+"\n ")])],1)}),0)]),e.m(" "),i("div",{staticClass:"arrow-buttons"},[i("el-button",{attrs:{type:"primary",icon:"el-icon-arrow-right",size:"small",disabled:!e.hasLeftSelected},on:{click:e.moveToRight}}),e.m(" "),i("el-button",{attrs:{type:"danger",icon:"el-icon-arrow-left",size:"small",disabled:!e.hasRightSelected},on:{click:e.moveToLeft}})],1),e.m(" "),i("div",{staticClass:"variable-panel"},[i("div",{staticClass:"panel-header"},[i("el-checkbox",{staticClass:"select-all-checkbox",attrs:{indeterminate:e.rightIndeterminate},on:{change:e.handleRightSelectAll},model:{value:e.rightSelectAll,callback(t){e.rightSelectAll=t},expression:"rightSelectAll"}},[i("span",{staticClass:"panel-title"},[e.m("已选")])]),e.m(" "),i("span",{staticClass:"panel-count"},[e.m(e.v(e.selectedRightCount)+"/"+e.v(e.selectedVariables.length))])],1),e.m(" "),i("div",{staticClass:"panel-search"},[i("el-input",{attrs:{placeholder:"请输入关键字","suffix-icon":"el-icon-search",size:"small"},on:{input:e.handleRightSearch},model:{value:e.rightKeyword,callback(t){e.rightKeyword=t},expression:"rightKeyword"}})],1),e.m(" "),i("div",{staticClass:"panel-list"},e.h(e.filteredRightVariables,function(t){return i("div",{key:t.field,staticClass:"variable-item"},[i("el-checkbox",{on:{change:i=>e.handleRightCheckChange(t)},model:{value:t.checked,callback(i){e.$set(t,"checked",i)},expression:"item.checked"}},[e.m("\n "+e.v(t.field)+"\n ")])],1)}),0)])])]),e.m(" "),i("div",{staticClass:"right-section"},[i("div",{staticClass:"config-desc"},[e.m("\n 数据文件中因变量的值,需赋予参考值,方便精准进行数据分析。\n ")]),e.m(" "),i("div",{staticClass:"config-options"},e.h(e.flatMenuItems,function(t){return i("div",{key:t.pathString,staticClass:"config-option-row"},[i("span",{staticClass:"option-label",class:{required:t.required}},[e.m("\n "+e.v(t.pathString)+"\n "),t.required?i("span",{staticClass:"required-mark"},[e.m("*")]):e.k()]),e.m(" "),i("el-select",{staticClass:"config-select",attrs:{placeholder:e.getPlaceholder(t),clearable:t.nullable,multiple:t.multiple},on:{change:i=>e.handleConfigChange(t.pathString,i)},model:{value:e.configValues[t.pathString],callback(i){e.$set(e.configValues,t.pathString,i)},expression:"configValues[menuItem.pathString]"}},e.h(e.getAvailableOptions(t.pathString,t.multiple),function(t){return i("el-option",{key:t.value,class:{"disabled-option":t.disabled},attrs:{label:t.label,value:t.value,disabled:t.disabled}},[i("span",{class:{"disabled-text":t.disabled}},[e.m(e.v(t.label))])])}),1)],1)}),0)])]),e.m(" "),i("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[i("el-button",{on:{click:e.handleClose}},[e.m("取消")]),e.m(" "),i("el-button",{staticStyle:{color:"#fff"},attrs:{type:"primary"},on:{click:e.handleSave}},[e.m("保存")])],1)])],1)},staticRenderFns:[],name:"LongVariableViewer",props:{visible:{type:Boolean,default:!1},values:{type:Array,default:()=>[]},menus:{type:Array,default:()=>[]}},data(){return{dialogVisible:!1,leftKeyword:"",rightKeyword:"",allVariables:[],selectedVariables:[],configValues:{},configChangeTimer:null}},computed:{filteredLeftVariables(){return this.leftKeyword?this.allVariables.filter(e=>e.field.toLowerCase().includes(this.leftKeyword.toLowerCase())):this.allVariables},filteredRightVariables(){return this.rightKeyword?this.selectedVariables.filter(e=>e.field.toLowerCase().includes(this.rightKeyword.toLowerCase())):this.selectedVariables},selectedAllCount(){return this.allVariables.filter(e=>e.checked).length},selectedRightCount(){return this.selectedVariables.filter(e=>e.checked).length},hasLeftSelected(){return this.allVariables.some(e=>e.checked)},hasRightSelected(){return this.selectedVariables.some(e=>e.checked)},leftSelectAll:{get(){const e=this.filteredLeftVariables;return 0!==e.length&&e.every(e=>e.checked)},set(){}},leftIndeterminate(){const e=this.filteredLeftVariables;if(0===e.length)return!1;const t=e.filter(e=>e.checked).length;return t>0&&t<e.length},rightSelectAll:{get(){const e=this.filteredRightVariables;return 0!==e.length&&e.every(e=>e.checked)},set(){}},rightIndeterminate(){const e=this.filteredRightVariables;if(0===e.length)return!1;const t=e.filter(e=>e.checked).length;return t>0&&t<e.length},flatMenuItems(){if(!this.menus||0===this.menus.length)return[];const e=[],t=(i,a=[])=>{const l=[...a,i.label];if(i.children&&0!==i.children.length)i.children&&i.children.length>0&&i.children.forEach(e=>{t(e,l)});else{const t=l.join("/");e.push({label:i.label,path:l,pathString:t,isLeaf:!0,id:i.id,fieldName:i.fieldName,required:i.required,nullable:i.nullable,multiple:i.multiple,originalMenu:i})}};return this.menus.forEach(e=>{t(e)}),e},tableData(){const e=[];return Object.keys(this.configValues).forEach(t=>{const i=this.configValues[t];if(!i||Array.isArray(i)&&0===i.length)return;const a=this.flatMenuItems.find(e=>e.pathString===t);if(!a)return;const l=a.pathString;(Array.isArray(i)?i:[i]).forEach(t=>{const i=t+"";i&&e.push({field:i,fullPath:l,varType:a.path&&a.path.length>0?a.path[0]:l,attr:a.path&&a.path.length>0?a.path[a.path.length-1]:""})})}),e}},watch:{visible:{handler(e){this.dialogVisible=e},immediate:!0},dialogVisible(e){this.$emit("update:visible",e)},values:{handler(e){this.handleValuesChange(e)},immediate:!0,deep:!0},selectedVariables:{handler(){const e=this.selectedVariables.map(e=>e.field),t={...this.configValues};let i=!1;Object.keys(t).forEach(a=>{const l=t[a];if(Array.isArray(l)){const s=l.filter(t=>e.includes(t));s.length!==l.length&&(t[a]=s,i=!0)}else l&&!e.includes(l)&&(t[a]="",i=!0)}),i&&(this.configValues=t)},deep:!0},configValues:{handler(){this.configChangeTimer&&clearTimeout(this.configChangeTimer),this.configChangeTimer=setTimeout(()=>{this.$nextTick(()=>{this.$emit("config-changed",this.tableData)})},100)},deep:!0}},methods:{handleValuesChange(e){if(!e||0===e.length)return this.allVariables=[],this.selectedVariables=[],void 0;const t=[];if(e.length>0){const i=e[0];"object"==typeof i&&null!==i&&t.push(...Object.keys(i))}this.allVariables=t.map(e=>({field:e,checked:!1})),this.selectedVariables=[]},handleLeftSearch(){},handleRightSearch(){},handleLeftCheckChange(){},handleRightCheckChange(){},handleLeftSelectAll(e){this.filteredLeftVariables.forEach(t=>{t.checked=e})},handleRightSelectAll(e){this.filteredRightVariables.forEach(t=>{t.checked=e})},moveToRight(){const e=this.allVariables.filter(e=>e.checked);0!==e.length&&(e.forEach(e=>{e.checked=!1,this.selectedVariables.find(t=>t.field===e.field)||this.selectedVariables.push({field:e.field,checked:!1})}),this.allVariables=this.allVariables.filter(t=>!e.some(e=>e.field===t.field)))},moveToLeft(){const e=this.selectedVariables.filter(e=>e.checked);0!==e.length&&(e.forEach(e=>{e.checked=!1,this.allVariables.find(t=>t.field===e.field)||this.allVariables.push({field:e.field,checked:!1})}),this.selectedVariables=this.selectedVariables.filter(t=>!e.some(e=>e.field===t.field)))},handleClose(){this.dialogVisible=!1},getPlaceholder(e){return e.required?"必选":e.nullable?"请选择":"必选"},getAvailableOptions(e,t=!1){const i=this.selectedVariables.map(e=>e.field),a=this.configValues[e],l=t?Array.isArray(a)?a:[]:a?[a]:[],s=[];return Object.keys(this.configValues).forEach(t=>{if(t!==e&&this.configValues[t]){const e=this.configValues[t];Array.isArray(e)?s.push(...e):s.push(e)}}),i.map(e=>l.includes(e)?{label:e,value:e,disabled:!1}:{label:e,value:e,disabled:s.includes(e)})},handleConfigChange(e,t){this.$set(this.configValues,e,t);const i=this.flatMenuItems.find(t=>t.pathString===e);i&&i.multiple&&!Array.isArray(t)&&this.$set(this.configValues,e,t?[t]:[])},generateConfigFromMenus(){return this.flatMenuItems.forEach(e=>{e.pathString in this.configValues||(e.multiple?this.$set(this.configValues,e.pathString,[]):this.$set(this.configValues,e.pathString,""))}),{...this.configValues}},handleSave(){const e={config:this.generateConfigFromMenus(),selectedVariables:this.selectedVariables.map(e=>e.field)};this.$emit("save",e),this.dialogVisible=!1},$restoreConfig(e){if(!e||"object"!=typeof e)return;const t=new Set;Object.keys(e).forEach(i=>{const a=e[i];a&&a.values&&Array.isArray(a.values)&&a.values.forEach(e=>t.add(e))}),t.forEach(e=>{this.selectedVariables.find(t=>t.field===e)||this.selectedVariables.push({field:e,checked:!1})}),this.configValues={},Object.keys(e).forEach(t=>{const i=e[t];if(!i||!i.values||!Array.isArray(i.values)||0===i.values.length)return;const a=this.flatMenuItems.filter(e=>e.fieldName===t);if(0!==a.length)if(1===a.length){const e=a[0],t=e.pathString;e.multiple?this.$set(this.configValues,t,[...i.values]):this.$set(this.configValues,t,i.values[0])}else{const e=a.filter(e=>!e.multiple),t=a.filter(e=>e.multiple);if(t.length>0){const e=t[0];this.$set(this.configValues,e.pathString,[...i.values])}else e.length>0&&i.values.forEach((t,i)=>{if(i<e.length){const a=e[i];this.$set(this.configValues,a.pathString,t)}})}})},$getValues(){const e={};return Object.keys(this.configValues).forEach(t=>{const i=this.configValues[t];if(!i||Array.isArray(i)&&0===i.length)return;const a=this.flatMenuItems.find(e=>e.pathString===t);if(!a||!a.fieldName)return;const l=a.fieldName;e[l]||(e[l]={values:[]}),(Array.isArray(i)?i:[i]).forEach(t=>{e[l].values.includes(t)||e[l].values.push(t)})}),e},$getTableData(){return this.generateConfigFromMenus(),void 0,this.tableData}},install(e){e.component(o.name,o)}};e(".long-excel-viewer :deep(.el-dialog__body){padding:0 10px 10px}");var n={render(){var e=this,t=e.$createElement,i=e.l.i||t;return i("div",{staticClass:"long-excel-viewer"},[i("el-dialog",{attrs:{visible:e.dialogVisible,title:"示例文件",width:"1000px"},on:{"update:visible"(t){e.dialogVisible=t},close:e.handleClose},scopedSlots:e.C([{key:"title",fn:()=>[i("div",{staticStyle:{display:"flex","justify-content":"space-between"}},[i("div",{staticStyle:{display:"flex","align-items":"center",gap:"10px"}},[i("img",{attrs:{src:e.searchIcon}}),e.m(" "),i("div",{staticStyle:{"font-weight":"bold"}},[e.m("文件预览")])]),e.m(" "),i("div",{staticStyle:{"margin-right":"30px"}},[i("el-button",{attrs:{type:"primary",icon:"el-icon-download",size:"mini",disabled:!e.tableData.length||e.downloading,loading:e.downloading},on:{click:e.downloadExcel}},[e.m("下载")])],1)])],proxy:!0}])},[e.m(" "),e.tableData.length?i("el-table",{staticStyle:{width:"100%","margin-top":"20px"},attrs:{data:e.tableData,border:"",height:"500px"}},e.h(e.columns,function(e){return i("el-table-column",{key:e,attrs:{prop:e,label:e}})}),1):e.k(),e.m(" "),e.pagination.total>0?i("el-pagination",{staticStyle:{"margin-top":"20px","text-align":"center"},attrs:{"current-page":e.pagination.current,"page-sizes":[10,20,50,100],"page-size":e.pagination.pageSize,layout:"total, sizes, prev, pager, next, jumper",total:e.pagination.total},on:{"size-change":e.handleSizeChange,"current-change":e.handleCurrentChange}}):e.k()],1)],1)},staticRenderFns:[],name:"LongExcelViewer",props:{visible:{type:Boolean,default:!1},url:{type:String,default:""}},data(){return{searchIcon:l.default,tableData:[],columns:[],rawWorkbook:null,downloading:!1,VUE_APP_BASE_API:process.env.VUE_APP_BASE_API,pagination:{total:0,current:1,pageSize:20},queryParams:{fileId:"",pageNum:1,pageSize:20}}},computed:{dialogVisible:{get(){return this.visible},set(e){this.$emit("update:visible",e)}}},watch:{visible(e){e&&this.url&&this.loadExcelFromUrl()},url(e){e&&this.visible&&this.loadExcelFromUrl()}},methods:{async loadExcelFromUrl(){if(!this.url)return;const e=this.url.split("/").pop();this.queryParams.fileId=e;try{const e=await this.$api.dataAnalysis.filePreview(this.queryParams);void 0,e&&e.data&&e.data.records&&Array.isArray(e.data.records)?(this.processTableData(e.data.records),this.pagination.total=e.data.total||0,this.pagination.current=e.data.current||1,this.pagination.pageSize=e.data.size||20):this.$message.error("数据格式错误")}catch(t){void 0,this.$message.error("加载Excel文件失败: "+t.message)}},processTableData(e){const t=e[0];t&&t.headers&&t.data&&(1==this.pagination.current&&(this.columns=t.headers||[]),this.tableData=t.data||[])},processWorkbook(e){this.rawWorkbook=e;const t=e.Sheets[e.SheetNames[0]],a=i.utils.sheet_to_json(t,{header:1});a.length&&(this.columns=a[0],this.tableData=a.slice(1).map(e=>{const t={};return this.columns.forEach((i,a)=>{t[i]=e[a]}),t}))},handleFileChange(e){const t=new FileReader;return t.onload=e=>{const t=new Uint8Array(e.target.result),a=i.read(t,{type:"array"});this.processWorkbook(a)},t.readAsArrayBuffer(e.raw),!1},downloadExcel(){if(!this.url||this.downloading)return;this.downloading=!0;const e=require("axios").create({baseURL:this.VUE_APP_BASE_API,timeout:3e4,responseType:"blob"});e.interceptors.request.use(e=>{const t=this.$store.getters.token||localStorage.getItem("token");return t&&(e.headers.Authorization="Bearer "+t),e}),e.interceptors.response.use(e=>("blob"===e.config.responseType,e),e=>Promise.reject(e));const t=this.url.split("/").pop();e.get("/file/upload/"+t).then(e=>{const t=e.data;let i="示例文件.xlsx";const l=e.headers["content-disposition"];if(l){const e=l.match(/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/);if(e&&e[1]){i=e[1].replace(/['"]/g,"");try{i=decodeURIComponent(i)}catch(s){void 0}}}a.saveAs(t,i),this.$message.success("下载成功")}).catch(e=>{void 0,this.$message.error("下载失败,请重试")}).finally(()=>{this.downloading=!1})},closeDialog(){this.dialogVisible=!1},handleClose(){this.closeDialog(),this.tableData=[],this.columns=[],this.rawWorkbook=null},handleSizeChange(e){this.queryParams.pageSize=e,this.queryParams.pageNum=1,this.loadExcelFromUrl()},handleCurrentChange(e){this.queryParams.pageNum=e,this.loadExcelFromUrl()}},install(e){e.component(n.name,n)}};e("");var d={render(){var e=this,t=e.$createElement,i=e.l.i||t;return i("div",[i("el-button",{attrs:{size:"small",type:"primary",icon:"el-icon-setting"},on:{click:e.onAdjust}},[e.m("\n 调整变量\n ")]),e.m(" "),i("long-variable-viewer",{ref:"variableViewerRef",attrs:{visible:e.modalVisiable,values:e.values,menus:e.menus},on:{"update:visible"(t){e.modalVisiable=t},"config-changed":e.handleConfigChanged}})],1)},staticRenderFns:[],name:"LongVariableViewerButton",props:{values:{type:Array,default:()=>[]},menus:{type:Array,default:()=>[]}},data(){return{modalVisiable:!1,tableDataCache:[],updateTimer:null,valuesUpdateTimer:null,menusUpdateTimer:null,updatingTableData:!1}},mounted(){void 0,this.$nextTick(()=>{this.updateTableData()})},beforeDestroy(){this.updateTimer&&clearInterval(this.updateTimer),this.valuesUpdateTimer&&clearTimeout(this.valuesUpdateTimer),this.menusUpdateTimer&&clearTimeout(this.menusUpdateTimer)},watch:{modalVisiable(e){e||(this.$emit("update:columns",this.$refs.variableViewerRef.$getValues()),this.$nextTick(()=>{this.updateTableData()}))},values:{handler(){this.valuesUpdateTimer&&clearTimeout(this.valuesUpdateTimer),this.valuesUpdateTimer=setTimeout(()=>{this.updateTableData()},300)},deep:!0},menus:{handler(){this.menusUpdateTimer&&clearTimeout(this.menusUpdateTimer),this.menusUpdateTimer=setTimeout(()=>{this.updateTableData()},300)},deep:!0}},computed:{tableData(){return this.tableDataCache}},methods:{onAdjust(){this.modalVisiable=!0},$getValues(){return this.$refs.variableViewerRef.$getValues()},$triggerUpdate(){this.$emit("update:columns",this.$getValues()),this.$nextTick(()=>{this.updateTableData()})},$restoreConfig(e){this.$refs.variableViewerRef&&this.$refs.variableViewerRef.$restoreConfig&&(this.$refs.variableViewerRef.$restoreConfig(e),this.$nextTick(()=>{this.updateTableData()}))},handleConfigChanged(e){Array.isArray(e)&&(this.tableDataCache=e,this.$emit("table-data-updated",e))},updateTableData(){if(!this.updatingTableData)if(this.updatingTableData=!0,this.$refs.variableViewerRef&&this.$refs.variableViewerRef.$getTableData){const e=this.$refs.variableViewerRef.$getTableData()||[],t=JSON.parse(JSON.stringify(e)),i=JSON.parse(JSON.stringify(this.tableDataCache));JSON.stringify(t)!==JSON.stringify(i)?(this.tableDataCache=e,this.$nextTick(()=>{this.$emit("table-data-updated",e),this.updatingTableData=!1})):this.updatingTableData=!1}else this.tableDataCache.length>0&&(this.tableDataCache=[]),this.updatingTableData=!1}},install(e){e.component(d.name,d)}};e("");var c={render(){var e=this,t=e.$createElement,i=e.l.i||t;return i("div",{staticStyle:{display:"inline-block","margin-left":"4px"},on:{click(e){e.stopPropagation()}}},[i("el-button",{attrs:{type:"text",size:"small",icon:"el-icon-document"},on:{click:e.onExample}},[e.m("示例文件")]),e.m(" "),i("long-excel-viewer",{attrs:{visible:e.modalVisiable,url:e.url},on:{"update:visible"(t){e.modalVisiable=t}}})],1)},staticRenderFns:[],name:"LongExcelViewerButton",props:{url:{type:String,default:""}},data(){return{modalVisiable:!1}},methods:{onExample(e){e.stopPropagation(),e.preventDefault(),this.modalVisiable=!0}},install(e){e.component(c.name,c)}};e(".long-uploader-wrapper .el-form-item{margin-bottom:0}.long-uploader-wrapper :deep(.el-upload) .el-upload-dragger{height:130px!important}.long-uploader-wrapper :deep(.el-upload) .el-upload-dragger .el-icon-upload{margin:8px 0}.variable-config-section{background-color:#f8f9fa;border:1px solid #e9ecef;border-radius:4px;margin-top:16px}.config-header{align-items:center;background-color:#e8e9f2;border-bottom:1px solid #e9ecef;cursor:pointer;display:flex;justify-content:space-between;padding:0 12px;transition:background-color .2s}.config-header:hover{background-color:#f0f0f0}.config-title{color:#303133;font-size:14px;margin:0}.collapse-arrow{color:#909399;font-size:12px;transition:transform .3s ease}.collapse-arrow.is-collapsed{transform:rotate(-90deg)}.config-content{padding:12px}.variable-config-section .el-table{font-size:12px}.variable-config-section .el-table th{background-color:#f5f7fa;color:#606266;font-weight:600}.variable-config-section .el-table td{padding:8px 0}.no-data{color:#909399;font-size:14px;padding:20px;text-align:center}");var p={render(){var e=this,t=e.$createElement,i=e.l.i||t;return i("div",{staticClass:"long-uploader-wrapper"},[i("div",[i("div",{staticStyle:{float:"right","margin-top":"-80px"}},[e.options.example&&e.options.example.value?i("long-excel-viewer-button",{attrs:{url:e.options.example.value}}):e.k()],1),e.m(" "),i("div",{staticStyle:{display:"flex","align-items":"center","justify-content":"space-between","margin-bottom":"12px"}},[i("div",{staticStyle:{display:"flex","align-items":"center",gap:"12px",position:"relative"}},[i("el-upload",{attrs:{action:e.uploadUrl,headers:{Authorization:"Bearer "+e.token},"on-preview":e.handlePreview,"on-remove":e.handleRemove,"before-remove":e.beforeRemove,"on-change":e.handleChange,"before-upload":e.beforeUpload,accept:e.fileType,drag:"","on-exceed":e.handleExceed,"file-list":e.fileList}},[i("i",{staticClass:"el-icon-upload",staticStyle:{color:"#6C1537"}}),e.m(" "),i("div",{staticClass:"el-upload__text"},[i("div",{staticStyle:{"line-height":"18px"}},[e.m("将文件拖到此处,或"),i("em",[e.m("点击上传")])]),e.m(" "),i("div",{staticStyle:{"line-height":"18px"}},[e.m("\n 支持上传"),i("em",[e.m("xlsx")]),e.m("、"),i("em",[e.m("xls")]),e.m("、"),i("em",[e.m("csv")])])])])],1)]),e.m(" "),e.fileList.length>0?i("div",{staticStyle:{"margin-top":"-20px"}},[e.S(0),e.m(" "),i("div",[e.h(e.fileList,function(t){return i("el-tag",{key:t.uid,staticStyle:{"margin-right":"8px",cursor:"pointer"},attrs:{closable:""},on:{close:i=>e.handleRemove(t),click:i=>e.handleFileClick(t)}},[e.m("\n "+e.v(t.name)+"\n ")])}),e.m(" "),e.fileList.length>0&&e.options.variable&&e.options.variable.enable?i("div",{staticStyle:{display:"flex","align-items":"center"}},[i("span",{staticStyle:{color:"#f56c6c","margin-right":"5px"}},[e.m("*")]),e.m(" "),i("long-variable-viewer-button",{ref:"variableViewerRef",attrs:{values:e.fileData,menus:e.options.variable.menus},on:{"update:columns":e.handleUpdateColumns,"table-data-updated":e.handleTableDataUpdated}})],1):e.k()],2)]):e.k()]),e.m(" "),e.fileList.length>0&&e.options.variable&&e.options.variable.enable&&e.hasConfiguredVariables?i("div",{staticClass:"variable-config-section"},[i("div",{staticClass:"config-header",on:{click:e.toggleCollapse}},[i("span",{staticClass:"config-title"},[e.m("当前变量配置")]),e.m(" "),i("i",{staticClass:"el-icon-caret-bottom collapse-arrow",class:{"is-collapsed":e.isCollapsed}})]),e.m(" "),i("div",{directives:[{name:"show",rawName:"v-show",value:!e.isCollapsed,expression:"!isCollapsed"}],staticClass:"config-content"},[0===e.currentVariableValues.length?i("div",{staticClass:"no-data"},[e.m("\n 暂无数据\n ")]):i("el-table",{staticStyle:{width:"100%"},attrs:{data:e.currentVariableValues,size:"mini","max-height":"300",border:""}},[i("el-table-column",{attrs:{prop:"field",label:"字段名","show-overflow-tooltip":""}}),e.m(" "),i("el-table-column",{attrs:{prop:"fullPath",label:"属性","show-overflow-tooltip":""}})],1),e.m(" "),i("div",{staticClass:"debug-info",staticStyle:{"margin-top":"8px","font-size":"12px",color:"#999"}},[e.m("\n 数据条数: "+e.v(e.currentVariableValues.length)+"\n ")])],1)]):e.k(),e.m(" "),i("long-excel-viewer",{attrs:{visible:e.previewVisible,url:e.previewUrl},on:{"update:visible"(t){e.previewVisible=t}}})],1)},staticRenderFns:[function(){var e=this,t=e.$createElement,i=e.l.i||t;return i("div",{staticStyle:{"font-size":"12px",color:"#999","line-height":"20px"}},[i("i",{staticClass:"el-icon-info",staticStyle:{"margin-right":"5px"}}),e.m(" "),i("span",[e.m("点击文件名称可预览文件")])])}],name:"LongUploader",props:{options:{type:Object,default:()=>({variable:{enable:!1,values:[],menus:[]},example:{value:""},file:{id:"",name:""}})},value:{type:Object,default:()=>({fileId:"",columns:[],fileName:""})},fileId:{type:String,default:""},limit:{type:Number,default:1},fileSize:{type:Number,default:3},fileType:{type:String,default:".xlsx,.xls,.csv"}},data(){return{uploadUrl:process.env.VUE_APP_BASE_API+"/file/upload",fileList:[],token:"",fileData:[],fileToken:"",variableViewerRef:null,isCollapsed:!0,hasTriggerUpdate:!1,previewVisible:!1,previewUrl:"",tableDataCache:[]}},computed:{currentVariableValues(){return this.tableDataCache.map(e=>({field:e.field||"",fullPath:e.fullPath||"",varType:e.varType||"",attr:e.attr||""}))},hasConfiguredVariables(){return this.currentVariableValues.length>0}},created(){this.token=localStorage.getItem("token")},watch:{fileId:{handler(e){this.fileToken=e},immediate:!0,deep:!0},value:{handler(e,t){void 0,!e||!e.fileId||t&&t.fileId===e.fileId||(this.fileToken=e.fileId,this.downloadFile(e.fileId,e.columns||{})),!e||!e.fileName||t&&t.fileName===e.fileName||(this.fileList=[{name:e.fileName,uid:e.fileId}])},immediate:!0,deep:!0}},methods:{downloadFile(e,t={}){this.$api.dataAnalysis.filePreview({fileId:e}).then(e=>{if(e&&e.data&&e.data.records&&e.data.records.length>0){const i=e.data.records[0].headers||[];this.$emit("update:headers",i);const a=this.options.variable.menus||[],l={};i.forEach(e=>{l[e]={field:e,varType:"",attr:""}}),t&&"object"==typeof t&&Object.keys(t).forEach(e=>{const i=t[e];if(void 0,i&&i.values&&Array.isArray(i.values)){const t=a.find(t=>t.fieldName===e);void 0,t&&i.values.forEach(i=>{l[i]&&(l[i]={field:i,varType:t.label||e,attr:t.label||e})})}}),this.fileData=[{...l}],this.$nextTick(()=>{if(this.$refs.variableViewerRef&&t&&Object.keys(t).length>0&&"function"==typeof this.$refs.variableViewerRef.$restoreConfig&&(this.$refs.variableViewerRef.$restoreConfig(t),this.$nextTick(()=>{this.$refs.variableViewerRef&&"function"==typeof this.$refs.variableViewerRef.updateTableData&&this.$refs.variableViewerRef.updateTableData()})),this.$route.query.id){if(this.hasTriggerUpdate)return;"function"==typeof this.$refs.variableViewerRef.$triggerUpdate&&this.$refs.variableViewerRef.$triggerUpdate(),this.hasTriggerUpdate=!0}})}}).catch(e=>{this.$message.error(e.message||"数据文件内容不匹配,请重新上传")}).finally(()=>{this.loading=!1})},handleColumns(e=[]){const t=this.options.variable.menus||[];void 0,0!=t.length&&e.forEach(e=>{void 0;const i=t.find(t=>t.fieldName==e.fieldName);void 0,e.varType=i.label,e.attr=i.attr})},handleTableDataUpdated(e){Array.isArray(e)&&(this.tableDataCache=e)},handleUpdateColumns(e){void 0,this.$emit("update:columns",e)},beforeUpload(e){if(void 0,e.size>1048576*this.fileSize)return this.$message.error(`上传文件大小不能超过 ${this.fileSize} MB!`),!1;const t=e.type,i=e.name.toLowerCase();return!!(["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.ms-excel","text/csv"].includes(t)||i.endsWith(".xlsx")||i.endsWith(".xls")||i.endsWith(".csv"))||(this.$message.error("只支持上传 xlsx、xls、csv 格式的文件!"),!1)},handleChange(e,t){if(t.length>1?this.fileList=[t[t.length-1]]:this.fileList=t.filter(e=>void 0!==e.raw),"success"===e.status){const t=e.response;t&&200===t.code&&(this.fileToken=t.data.id,this.$emit("update:fileId",this.fileToken),this.loadFromUrl(this.fileToken))}},loadFromUrl(e){this.$api.dataAnalysis.filePreview({fileId:e}).then(e=>{if(e&&e.data&&e.data.records&&e.data.records.length>0){const t=(e.data.records[0]||{data:[],headers:[]}).headers||[];if(t.length>0){this.$emit("update:headers",t);const e={};t.forEach(t=>{e[t]={field:t,varType:"",attr:""}}),this.fileData=[{...e}]}else this.$emit("update:headers",[]),this.fileData=[]}})},handleRemove(e){this.fileList=this.fileList.filter(t=>t.uid!==e.uid),this.fileToken="",this.fileData=[],this.$emit("update:fileId",""),this.$emit("update:headers",[])},onAdjust(){this.$emit("adjust")},handleRemove1(e,t){void 0},handlePreview(e){void 0},handleExceed(e,t){this.$message.warning(`上传文件数量不能超过 ${this.limit} 个!`),t.length>this.limit&&(this.fileList=t.slice(-this.limit))},beforeRemove(){return!0},toggleCollapse(){this.isCollapsed=!this.isCollapsed},handleFileClick(){event.stopPropagation(),this.fileToken?(this.previewUrl=`${process.env.VUE_APP_BASE_API}/file/preview/${this.fileToken}`,this.previewVisible=!0):this.$message.warning("文件ID不存在,无法预览")}},install(e){e.component(p.name,p)}};e(".long-radio-wrapper{display:flex;flex-wrap:wrap}.long-radio-wrapper ::v-deep .el-radio{line-height:24px;margin-bottom:0}.long-radio-wrapper ::v-deep .el-radio__label{display:inline-block;vertical-align:middle;white-space:normal;word-break:break-all}.long-radio-item{margin:4px 12px 4px 0;width:100px}");var h={render(){var e=this,t=e.$createElement,i=e.l.i||t;return i("el-radio-group",e.o(e.p({staticClass:"long-radio-wrapper"},"el-radio-group",e.$attrs,!1),e.$listeners),e.h(e.options,function(t,a){return i("el-radio",{key:a,staticClass:"long-radio-item",attrs:{label:t[e.valueKey],disabled:t[e.disabledOption]}},[e.m("\n "+e.v(t[e.labelKey])+"\n ")])}),1)},staticRenderFns:[],name:"LongRadio",props:{dataList:{type:Array,default:()=>[]},disabledOption:{type:[Boolean,Number],default:!1},valueKey:{type:[String,Number],default:"value"},labelKey:{type:[String,Number],default:"label"},mode:{type:String,default:"local"},dict:{type:String,default:""},url:{type:String,default:""},requestParams:{type:Object,default(){}},placeholder:{type:String,default:"请选择"}},data(){return{options:[]}},watch:{dataList:{deep:!0,immediate:!0,handler(e){"local"===this.mode&&(this.options=e)}},dict:{deep:!0,handler(e){this.init()}}},created(){this.init()},methods:{init(){"remote"===this.mode&&this.dict&&this.getDicts(this.dict).then(e=>{this.options=(e.data||[]).map(e=>({[this.valueKey]:e.dictCode,[this.labelKey]:e.dictLabel}))})}},install(e){e.component(h.name,h)}};e(".long-group{background-color:#f8f8f8;box-sizing:border-box;height:100%;padding:10px;width:100%}.long-group .group-header{color:#333;font-size:14px;font-weight:700}");var u={render(){var e=this,t=e.$createElement,i=e.l.i||t;return i("div",{staticClass:"long-group"},[i("div",{staticClass:"group-header"},[e.m(e.v(e.label))]),e.m(" "),e.u("default")],2)},staticRenderFns:[],name:"LongGroup",props:{label:{type:String,default:""}},install(e){e.component(u.name,u)}};e(".long-color-picker{width:200px}.long-color-picker .el-color-picker__trigger{width:100%}.long-color-picker .el-color-picker__trigger .el-color-picker__icon{left:unset!important;right:5px!important;width:unset!important}");var f={render(){var e=this,t=e.$createElement;return(e.l.i||t)("el-color-picker",e.o(e.p({staticClass:"long-color-picker"},"el-color-picker",e.$attrs,!1),e.$listeners))},staticRenderFns:[],name:"LongColorPicker",install(e){e.component(f.name,f)}};e("");var g={render(){var e=this,t=e.$createElement;return(e.l.i||t)("el-input-number",e.o(e.p({staticClass:"long-number-input",attrs:{"controls-position":"right",step:e.stepValue,value:e.value,max:e.maxValue,min:e.minValue},on:{input:t=>e.$emit("input",t)}},"el-input-number",e.$attrs,!1),e.$listeners))},staticRenderFns:[],name:"LongNumberInput",props:{value:{type:[String,Number],default:0},placeholder:{type:String,default:"请输入"},max:{type:[Number,String],default:""},min:{type:[Number,String],default:""},step:{type:[Number,String],default:1}},data(){return{maxValue:""===this.max?Number.MAX_SAFE_INTEGER:+this.max,minValue:""===this.min?Number.MIN_SAFE_INTEGER:+this.min,stepValue:+this.step}},watch:{max:{handler(e){this.maxValue=""===e?Number.MAX_SAFE_INTEGER:+e},immediate:!0},min:{handler(e){this.minValue=""===e?Number.MIN_SAFE_INTEGER:+e},immediate:!0},step:{handler(e){this.stepValue=+e},immediate:!0}},install(e){e.component(g.name,g)}};e(".long-checkbox-wrapper{display:flex;flex-wrap:wrap}.long-checkbox-wrapper ::v-deep .el-checkbox{line-height:24px;margin-bottom:0}.long-checkbox-item{margin:1px 6px 1px 0;min-width:50px}");var b={render(){var e=this,t=e.$createElement,i=e.l.i||t;return i("el-checkbox-group",e.o(e.p({staticClass:"long-checkbox-wrapper",attrs:{value:e.value},on:{change:e.handleInput}},"el-checkbox-group",e.$attrs,!1),e.$listeners),e.h(e.options,function(t,a){return i("el-checkbox",{key:a,staticClass:"long-checkbox-item",attrs:{label:t[e.valueKey],disabled:e.getDisabled(t)}},[e.m("\n "+e.v(t[e.labelKey])+"\n ")])}),1)},staticRenderFns:[],name:"LongCheckBox",props:{value:{type:Array,default:()=>[]},dataList:{type:Array,default:()=>[]},disabledOption:{type:[String,Boolean,Number],default:!1},valueKey:{type:[String,Number],default:"value"},labelKey:{type:[String,Number],default:"label"},mode:{type:String,default:"local"},dict:{type:String,default:""},url:{type:String,default:""},requestParams:{type:Object,default(){}},placeholder:{type:String,default:"请选择"}},data(){return{options:[]}},watch:{dataList:{deep:!0,immediate:!0,handler(e){"local"===this.mode&&(this.options=e)}},dict:{deep:!0,handler(e){this.init()}}},created(){this.init()},methods:{init(){"remote"===this.mode&&this.dict&&this.getDicts(this.dict).then(e=>{this.options=(e.data||[]).map(e=>({[this.valueKey]:e.dictCode,[this.labelKey]:e.dictLabel}))})},handleInput(e){this.$emit("input",e),this.$emit("change",e)},getDisabled(e){return"string"==typeof this.disabledOption?e[this.disabledOption]||!1:"boolean"==typeof this.disabledOption?this.disabledOption:"number"==typeof this.disabledOption&&e[this.disabledOption]||!1}},install(e){e.component(b.name,b)}},m=[s,r,o,n,d,c,p,h,u,f,g,b],x=function(e){x.installed||(x.installed=!0,["ElInput","ElSelect","ElOption","ElCheckbox","ElCheckboxGroup","ElRadio","ElRadioGroup","ElButton","ElDialog","ElTable","ElTableColumn","ElUpload","ElTag","ElPagination","ElInputNumber","ElColorPicker","ElForm","ElFormItem","ElIcon"].forEach(function(i){var a=e.options.components[i];if(a){var l=t(i);l&&l!==i&&(e.options.components[l]||e.component(l,a))}}),m.forEach(function(i){if(i){var a=i.name||i.options&&i.options.name;if(a){e.component(a,i);var l=t(a);l&&l!==a&&e.component(l,i)}}}))};"undefined"!=typeof window&&window.Vue&&x(window.Vue);var v={version:"1.0.0",install:x,Input:s,Select:r,VariableViewer:o,ExcelViewer:n,VariableViewerButton:d,ExcelViewerButton:c,Uploader:p,Radio:h,Group:u,ColorPicker:f,NumberInput:g,CheckBox:b};exports.CheckBox=b,exports.ColorPicker=f,exports.ExcelViewer=n,exports.ExcelViewerButton=c,exports.Group=u,exports.Input=s,exports.NumberInput=g,exports.Radio=h,exports.Select=r,exports.Uploader=p,exports.VariableViewer=o,exports.VariableViewerButton=d,exports.default=v;
|
|
1
|
+
"use strict";function e(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var a=document.head||document.getElementsByTagName("head")[0],l=document.createElement("style");l.type="text/css","top"===i&&a.firstChild?a.insertBefore(l,a.firstChild):a.appendChild(l),l.styleSheet?l.styleSheet.cssText=e:l.appendChild(document.createTextNode(e))}}function t(e){return e?e.replace(/([A-Z])/g,"-$1").toLowerCase().replace(/^-/,""):e}Object.defineProperty(exports,"t",{value:!0});var i=require("xlsx"),a=require("file-saver"),l=function(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}(require("@/assets/icon-search.png"));e(".long-input-wrapper{background-color:#fff;border:1px solid #e0e0e0;border-radius:4px;padding:8px}.intTxt{width:80%}");var s={render(){var e=this,t=e.$createElement;return(e.l.i||t)("el-input",e.o(e.p({staticClass:"intTxt",attrs:{"show-word-limit":e.showWordLimit,placeholder:e.placeholder,"auto-complete":"new-password",disabled:e.disabled},on:{input(t){return e.$emit("input",t)}}},"el-input",e.$attrs,!1),e.$listeners),[e.h(Object.keys(this.$slots),function(t){return e.u(t,null,{slot:t})})],2)},staticRenderFns:[],name:"LongInput",props:{showWordLimit:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},placeholder:{type:String,default:"请输入"}},install(e){e.component(s.name,s)}};e("");var r={render(){var e=this,t=e.$createElement,i=e.l.i||t;return i("el-select",e.o(e.p({attrs:{value:e.value,placeholder:e.placeholder}},"el-select",e.$attrs,!1),e.$listeners),[e.u("unshift"),e.m(" "),e.u("default",function(){return e.h(e.options,function(t,a){return i("el-option",{key:a,attrs:{value:t[e.valueKey],label:t[e.labelKey],disabled:t[e.disabledOption]}})})},{slot:"default"}),e.m(" "),e.u("prefix",null,{slot:"prefix"}),e.m(" "),e.u("empty",null,{slot:"empty"})],2)},staticRenderFns:[],name:"LongSelect",props:{value:{type:[String,Number],default:""},dataList:{type:Array,default(){return[]}},disabledOption:{type:[Boolean,Number],default:!1},valueKey:{type:[String,Number],default:"value"},labelKey:{type:[String,Number],default:"label"},mode:{type:String,default:"local"},dict:{type:String,default:""},url:{type:String,default:""},requestParams:{type:Object,default(){}},placeholder:{type:String,default:"请选择"}},data:()=>({options:[]}),watch:{dataList:{deep:!0,immediate:!0,handler(e){"local"===this.mode&&(this.options=e)}},dict:{deep:!0,handler(e){this.init()}}},created(){this.init()},methods:{init(){"remote"===this.mode&&this.dict&&this.getDicts(this.dict).then(e=>{this.options=(e.data||[]).map(e=>({[this.valueKey]:e.dictCode,[this.labelKey]:e.dictLabel}))})}},install(e){e.component(r.name,r)}};e(".variable-config-dialog :deep(.el-dialog__body){padding:20px}.variable-config-dialog :deep(.el-dialog__header){padding:20px 20px 10px}.dialog-title{align-items:center;color:#303133;display:flex;font-size:16px;font-weight:700;gap:24px;padding:0 20px}.dialog-title .title-left{color:#303133;flex:1;min-width:500px}.dialog-title .title-separator{color:#dcdfe6;flex-shrink:0;font-weight:400}.dialog-title .title-right{color:#303133;flex:1;min-width:400px}.dialog-body{display:flex;gap:24px;min-height:500px}.left-section{flex:1;min-width:500px}.section-title{color:#303133;font-size:16px;font-weight:700;margin-bottom:16px}.variable-selector{align-items:flex-start;display:flex;gap:16px}.variable-panel{border:1px solid #dcdfe6;border-radius:4px;display:flex;flex:1;flex-direction:column;height:500px;overflow:hidden}.panel-header{align-items:center;background:#f5f7fa;border-bottom:1px solid #dcdfe6;display:flex;justify-content:space-between;padding:12px 16px}.select-all-checkbox :deep(.el-checkbox__label){padding-left:8px}.panel-title{color:#303133;font-weight:500}.panel-count{color:#909399;font-size:12px}.panel-search{border-bottom:1px solid #dcdfe6;padding:12px}.panel-list{flex:1;overflow-y:auto;padding:8px}.variable-item{border-radius:4px;cursor:pointer;padding:8px 12px;transition:background-color .2s}.variable-item:hover{background-color:#f5f7fa}.variable-item :deep(.el-checkbox){width:100%}.variable-item :deep(.el-checkbox__label){width:100%}.arrow-buttons{display:flex;flex-direction:column;gap:12px;justify-content:center;padding-top:100px}.arrow-buttons .el-button{margin-left:0!important}.right-section{display:flex;flex:1;flex-direction:column;min-width:400px;overflow:hidden}.config-desc{color:#909399;flex-shrink:0;font-size:13px;line-height:1.5;margin-bottom:24px}.config-group{margin-bottom:32px}.config-group:last-child{margin-bottom:0}.config-label{color:#303133;font-size:14px;font-weight:500;margin-bottom:12px}.config-options{display:flex;flex:1;flex-direction:column;gap:16px;margin-top:16px;overflow-x:hidden;overflow-y:auto;padding-right:8px}.config-options::-webkit-scrollbar{width:6px}.config-options::-webkit-scrollbar-track{background:#f1f1f1;border-radius:3px}.config-options::-webkit-scrollbar-thumb{background:#c1c1c1;border-radius:3px}.config-options::-webkit-scrollbar-thumb:hover{background:#a8a8a8}.config-option-row{align-items:center;display:flex;gap:12px;margin-bottom:8px}.config-option-row.is-parent .option-label{color:#303133;font-weight:500}.config-option-row.is-leaf .option-label{color:#606266}.option-label{color:#606266;flex:1;font-size:13px;min-width:0;white-space:normal;word-break:break-all}.option-label.required{color:#303133;font-weight:500}.option-label .required-mark{color:#f56c6c;margin-left:2px}.config-select{flex-shrink:0;width:350px}.non-leaf-label{color:#909399;font-size:13px;font-style:italic}.disabled-option{cursor:not-allowed!important}.disabled-option,.disabled-text{color:#c0c4cc!important}:deep(.el-select-dropdown__item.is-disabled){color:#c0c4cc!important;cursor:not-allowed!important}:deep(.el-select-dropdown__item.is-disabled) span{color:#c0c4cc!important}.checkbox-list{border:1px solid #dcdfe6;border-radius:4px;display:flex;flex:1;flex-direction:column;gap:8px;max-height:200px;overflow-y:auto;padding:8px}.dialog-footer{text-align:right}");var o={render(){var e=this,t=e.$createElement,i=e.l.i||t;return i("div",[i("el-dialog",{staticClass:"variable-config-dialog",staticStyle:{"max-height":"90vh"},attrs:{visible:e.dialogVisible,width:"1200px"},on:{"update:visible"(t){e.dialogVisible=t},close:e.handleClose}},[i("div",{staticClass:"dialog-title",attrs:{slot:"title"},slot:"title"},[i("span",{staticClass:"title-left"},[e.m("选择分析变量")]),e.m(" "),i("span",{staticClass:"title-separator"},[e.m("|")]),e.m(" "),i("span",{staticClass:"title-right"},[e.m("配置变量")])]),e.m(" "),i("div",{staticClass:"dialog-body"},[i("div",{staticClass:"left-section"},[i("div",{staticClass:"variable-selector"},[i("div",{staticClass:"variable-panel"},[i("div",{staticClass:"panel-header"},[i("el-checkbox",{staticClass:"select-all-checkbox",attrs:{indeterminate:e.leftIndeterminate},on:{change:e.handleLeftSelectAll},model:{value:e.leftSelectAll,callback(t){e.leftSelectAll=t},expression:"leftSelectAll"}},[i("span",{staticClass:"panel-title"},[e.m("全选")])]),e.m(" "),i("span",{staticClass:"panel-count"},[e.m(e.v(e.selectedAllCount)+"/"+e.v(e.allVariables.length))])],1),e.m(" "),i("div",{staticClass:"panel-search"},[i("el-input",{attrs:{placeholder:"请输入关键字","suffix-icon":"el-icon-search",size:"small"},on:{input:e.handleLeftSearch},model:{value:e.leftKeyword,callback(t){e.leftKeyword=t},expression:"leftKeyword"}})],1),e.m(" "),i("div",{staticClass:"panel-list"},e.h(e.filteredLeftVariables,function(t){return i("div",{key:t.field,staticClass:"variable-item"},[i("el-checkbox",{on:{change(i){return e.handleLeftCheckChange(t)}},model:{value:t.checked,callback(i){e.$set(t,"checked",i)},expression:"item.checked"}},[e.m("\n "+e.v(t.field)+"\n ")])],1)}),0)]),e.m(" "),i("div",{staticClass:"arrow-buttons"},[i("el-button",{attrs:{type:"primary",icon:"el-icon-arrow-right",size:"small",disabled:!e.hasLeftSelected},on:{click:e.moveToRight}}),e.m(" "),i("el-button",{attrs:{type:"danger",icon:"el-icon-arrow-left",size:"small",disabled:!e.hasRightSelected},on:{click:e.moveToLeft}})],1),e.m(" "),i("div",{staticClass:"variable-panel"},[i("div",{staticClass:"panel-header"},[i("el-checkbox",{staticClass:"select-all-checkbox",attrs:{indeterminate:e.rightIndeterminate},on:{change:e.handleRightSelectAll},model:{value:e.rightSelectAll,callback(t){e.rightSelectAll=t},expression:"rightSelectAll"}},[i("span",{staticClass:"panel-title"},[e.m("已选")])]),e.m(" "),i("span",{staticClass:"panel-count"},[e.m(e.v(e.selectedRightCount)+"/"+e.v(e.selectedVariables.length))])],1),e.m(" "),i("div",{staticClass:"panel-search"},[i("el-input",{attrs:{placeholder:"请输入关键字","suffix-icon":"el-icon-search",size:"small"},on:{input:e.handleRightSearch},model:{value:e.rightKeyword,callback(t){e.rightKeyword=t},expression:"rightKeyword"}})],1),e.m(" "),i("div",{staticClass:"panel-list"},e.h(e.filteredRightVariables,function(t){return i("div",{key:t.field,staticClass:"variable-item"},[i("el-checkbox",{on:{change(i){return e.handleRightCheckChange(t)}},model:{value:t.checked,callback(i){e.$set(t,"checked",i)},expression:"item.checked"}},[e.m("\n "+e.v(t.field)+"\n ")])],1)}),0)])])]),e.m(" "),i("div",{staticClass:"right-section"},[i("div",{staticClass:"config-desc"},[e.m("\n 数据文件中因变量的值,需赋予参考值,方便精准进行数据分析。\n ")]),e.m(" "),i("div",{staticClass:"config-options"},e.h(e.flatMenuItems,function(t){return i("div",{key:t.pathString,staticClass:"config-option-row"},[i("span",{staticClass:"option-label",class:{required:t.required}},[e.m("\n "+e.v(t.pathString)+"\n "),t.required?i("span",{staticClass:"required-mark"},[e.m("*")]):e.k()]),e.m(" "),i("el-select",{staticClass:"config-select",attrs:{placeholder:e.getPlaceholder(t),clearable:t.nullable,multiple:t.multiple},on:{change(i){return e.handleConfigChange(t.pathString,i)}},model:{value:e.configValues[t.pathString],callback(i){e.$set(e.configValues,t.pathString,i)},expression:"configValues[menuItem.pathString]"}},e.h(e.getAvailableOptions(t.pathString,t.multiple),function(t){return i("el-option",{key:t.value,class:{"disabled-option":t.disabled},attrs:{label:t.label,value:t.value,disabled:t.disabled}},[i("span",{class:{"disabled-text":t.disabled}},[e.m(e.v(t.label))])])}),1)],1)}),0)])]),e.m(" "),i("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[i("el-button",{on:{click:e.handleClose}},[e.m("取消")]),e.m(" "),i("el-button",{staticStyle:{color:"#fff"},attrs:{type:"primary"},on:{click:e.handleSave}},[e.m("保存")])],1)])],1)},staticRenderFns:[],name:"LongVariableViewer",props:{visible:{type:Boolean,default:!1},values:{type:Array,default(){return[]}},menus:{type:Array,default(){return[]}}},data:()=>({dialogVisible:!1,leftKeyword:"",rightKeyword:"",allVariables:[],selectedVariables:[],configValues:{},configChangeTimer:null}),computed:{filteredLeftVariables(){return this.leftKeyword?this.allVariables.filter(e=>e.field.toLowerCase().includes(this.leftKeyword.toLowerCase())):this.allVariables},filteredRightVariables(){return this.rightKeyword?this.selectedVariables.filter(e=>e.field.toLowerCase().includes(this.rightKeyword.toLowerCase())):this.selectedVariables},selectedAllCount(){return this.allVariables.filter(e=>e.checked).length},selectedRightCount(){return this.selectedVariables.filter(e=>e.checked).length},hasLeftSelected(){return this.allVariables.some(e=>e.checked)},hasRightSelected(){return this.selectedVariables.some(e=>e.checked)},leftSelectAll:{get(){const e=this.filteredLeftVariables;return 0!==e.length&&e.every(e=>e.checked)},set(){}},leftIndeterminate(){const e=this.filteredLeftVariables;if(0===e.length)return!1;const t=e.filter(e=>e.checked).length;return t>0&&t<e.length},rightSelectAll:{get(){const e=this.filteredRightVariables;return 0!==e.length&&e.every(e=>e.checked)},set(){}},rightIndeterminate(){const e=this.filteredRightVariables;if(0===e.length)return!1;const t=e.filter(e=>e.checked).length;return t>0&&t<e.length},flatMenuItems(){if(!this.menus||0===this.menus.length)return[];const e=[],t=(i,a=[])=>{const l=[...a,i.label];if(i.children&&0!==i.children.length)i.children&&i.children.length>0&&i.children.forEach(e=>{t(e,l)});else{const t=l.join("/");e.push({label:i.label,path:l,pathString:t,isLeaf:!0,id:i.id,fieldName:i.fieldName,required:i.required,nullable:i.nullable,multiple:i.multiple,originalMenu:i})}};return this.menus.forEach(e=>{t(e)}),e},tableData(){const e=[];return Object.keys(this.configValues).forEach(t=>{const i=this.configValues[t];if(!i||Array.isArray(i)&&0===i.length)return;const a=this.flatMenuItems.find(e=>e.pathString===t);if(!a)return;const l=a.pathString;(Array.isArray(i)?i:[i]).forEach(t=>{const i=t+"";i&&e.push({field:i,fullPath:l,varType:a.path&&a.path.length>0?a.path[0]:l,attr:a.path&&a.path.length>0?a.path[a.path.length-1]:""})})}),e}},watch:{visible:{handler(e){this.dialogVisible=e},immediate:!0},dialogVisible(e){this.$emit("update:visible",e)},values:{handler(e){this.handleValuesChange(e)},immediate:!0,deep:!0},selectedVariables:{handler(){const e=this.selectedVariables.map(e=>e.field),t={...this.configValues};let i=!1;Object.keys(t).forEach(a=>{const l=t[a];if(Array.isArray(l)){const s=l.filter(t=>e.includes(t));s.length!==l.length&&(t[a]=s,i=!0)}else l&&!e.includes(l)&&(t[a]="",i=!0)}),i&&(this.configValues=t)},deep:!0},configValues:{handler(){this.configChangeTimer&&clearTimeout(this.configChangeTimer),this.configChangeTimer=setTimeout(()=>{this.$nextTick(()=>{this.$emit("config-changed",this.tableData)})},100)},deep:!0}},methods:{handleValuesChange(e){if(!e||0===e.length)return this.allVariables=[],this.selectedVariables=[],void 0;const t=[];if(e.length>0){const i=e[0];"object"==typeof i&&null!==i&&t.push(...Object.keys(i))}this.allVariables=t.map(e=>({field:e,checked:!1})),this.selectedVariables=[]},handleLeftSearch(){},handleRightSearch(){},handleLeftCheckChange(){},handleRightCheckChange(){},handleLeftSelectAll(e){this.filteredLeftVariables.forEach(t=>{t.checked=e})},handleRightSelectAll(e){this.filteredRightVariables.forEach(t=>{t.checked=e})},moveToRight(){const e=this.allVariables.filter(e=>e.checked);0!==e.length&&(e.forEach(e=>{e.checked=!1,this.selectedVariables.find(t=>t.field===e.field)||this.selectedVariables.push({field:e.field,checked:!1})}),this.allVariables=this.allVariables.filter(t=>!e.some(e=>e.field===t.field)))},moveToLeft(){const e=this.selectedVariables.filter(e=>e.checked);0!==e.length&&(e.forEach(e=>{e.checked=!1,this.allVariables.find(t=>t.field===e.field)||this.allVariables.push({field:e.field,checked:!1})}),this.selectedVariables=this.selectedVariables.filter(t=>!e.some(e=>e.field===t.field)))},handleClose(){this.dialogVisible=!1},getPlaceholder:e=>e.required?"必选":e.nullable?"请选择":"必选",getAvailableOptions(e,t=!1){const i=this.selectedVariables.map(e=>e.field),a=this.configValues[e],l=t?Array.isArray(a)?a:[]:a?[a]:[],s=[];return Object.keys(this.configValues).forEach(t=>{if(t!==e&&this.configValues[t]){const e=this.configValues[t];Array.isArray(e)?s.push(...e):s.push(e)}}),i.map(e=>l.includes(e)?{label:e,value:e,disabled:!1}:{label:e,value:e,disabled:s.includes(e)})},handleConfigChange(e,t){this.$set(this.configValues,e,t);const i=this.flatMenuItems.find(t=>t.pathString===e);i&&i.multiple&&!Array.isArray(t)&&this.$set(this.configValues,e,t?[t]:[])},generateConfigFromMenus(){return this.flatMenuItems.forEach(e=>{e.pathString in this.configValues||(e.multiple?this.$set(this.configValues,e.pathString,[]):this.$set(this.configValues,e.pathString,""))}),{...this.configValues}},handleSave(){const e={config:this.generateConfigFromMenus(),selectedVariables:this.selectedVariables.map(e=>e.field)};this.$emit("save",e),this.dialogVisible=!1},$restoreConfig(e){if(!e||"object"!=typeof e)return;const t=new Set;Object.keys(e).forEach(i=>{const a=e[i];a&&a.values&&Array.isArray(a.values)&&a.values.forEach(e=>t.add(e))}),t.forEach(e=>{this.selectedVariables.find(t=>t.field===e)||this.selectedVariables.push({field:e,checked:!1})}),this.configValues={},Object.keys(e).forEach(t=>{const i=e[t];if(!i||!i.values||!Array.isArray(i.values)||0===i.values.length)return;const a=this.flatMenuItems.filter(e=>e.fieldName===t);if(0!==a.length)if(1===a.length){const e=a[0],t=e.pathString;e.multiple?this.$set(this.configValues,t,[...i.values]):this.$set(this.configValues,t,i.values[0])}else{const e=a.filter(e=>!e.multiple),t=a.filter(e=>e.multiple);if(t.length>0){const e=t[0];this.$set(this.configValues,e.pathString,[...i.values])}else e.length>0&&i.values.forEach((t,i)=>{if(i<e.length){const a=e[i];this.$set(this.configValues,a.pathString,t)}})}})},$getValues(){const e={};return Object.keys(this.configValues).forEach(t=>{const i=this.configValues[t];if(!i||Array.isArray(i)&&0===i.length)return;const a=this.flatMenuItems.find(e=>e.pathString===t);if(!a||!a.fieldName)return;const l=a.fieldName;e[l]||(e[l]={values:[]}),(Array.isArray(i)?i:[i]).forEach(t=>{e[l].values.includes(t)||e[l].values.push(t)})}),e},$getTableData(){return this.generateConfigFromMenus(),void 0,this.tableData}},install(e){e.component(o.name,o)}};e(".long-excel-viewer :deep(.el-dialog__body){padding:0 10px 10px}");var n={render(){var e=this,t=e.$createElement,i=e.l.i||t;return i("div",{staticClass:"long-excel-viewer"},[i("el-dialog",{attrs:{visible:e.dialogVisible,title:"示例文件",width:"1000px"},on:{"update:visible"(t){e.dialogVisible=t},close:e.handleClose},scopedSlots:e.C([{key:"title",fn(){return[i("div",{staticStyle:{display:"flex","justify-content":"space-between"}},[i("div",{staticStyle:{display:"flex","align-items":"center",gap:"10px"}},[i("img",{attrs:{src:e.searchIcon}}),e.m(" "),i("div",{staticStyle:{"font-weight":"bold"}},[e.m("文件预览")])]),e.m(" "),i("div",{staticStyle:{"margin-right":"30px"}},[i("el-button",{attrs:{type:"primary",icon:"el-icon-download",size:"mini",disabled:!e.tableData.length||e.downloading,loading:e.downloading},on:{click:e.downloadExcel}},[e.m("下载")])],1)])]},proxy:!0}])},[e.m(" "),e.tableData.length?i("el-table",{staticStyle:{width:"100%","margin-top":"20px"},attrs:{data:e.tableData,border:"",height:"500px"}},e.h(e.columns,function(e){return i("el-table-column",{key:e,attrs:{prop:e,label:e}})}),1):e.k(),e.m(" "),e.pagination.total>0?i("el-pagination",{staticStyle:{"margin-top":"20px","text-align":"center"},attrs:{"current-page":e.pagination.current,"page-sizes":[10,20,50,100],"page-size":e.pagination.pageSize,layout:"total, sizes, prev, pager, next, jumper",total:e.pagination.total},on:{"size-change":e.handleSizeChange,"current-change":e.handleCurrentChange}}):e.k()],1)],1)},staticRenderFns:[],name:"LongExcelViewer",props:{visible:{type:Boolean,default:!1},url:{type:String,default:""}},data:()=>({searchIcon:l.default,tableData:[],columns:[],rawWorkbook:null,downloading:!1,VUE_APP_BASE_API:process.env.VUE_APP_BASE_API,pagination:{total:0,current:1,pageSize:20},queryParams:{fileId:"",pageNum:1,pageSize:20}}),computed:{dialogVisible:{get(){return this.visible},set(e){this.$emit("update:visible",e)}}},watch:{visible(e){e&&this.url&&this.loadExcelFromUrl()},url(e){e&&this.visible&&this.loadExcelFromUrl()}},methods:{async loadExcelFromUrl(){if(!this.url)return;const e=this.url.split("/").pop();this.queryParams.fileId=e;try{const e=await this.$api.dataAnalysis.filePreview(this.queryParams);void 0,e&&e.data&&e.data.records&&Array.isArray(e.data.records)?(this.processTableData(e.data.records),this.pagination.total=e.data.total||0,this.pagination.current=e.data.current||1,this.pagination.pageSize=e.data.size||20):this.$message.error("数据格式错误")}catch(t){void 0,this.$message.error("加载Excel文件失败: "+t.message)}},processTableData(e){const t=e[0];t&&t.headers&&t.data&&(1==this.pagination.current&&(this.columns=t.headers||[]),this.tableData=t.data||[])},processWorkbook(e){this.rawWorkbook=e;const t=e.Sheets[e.SheetNames[0]],a=i.utils.sheet_to_json(t,{header:1});a.length&&(this.columns=a[0],this.tableData=a.slice(1).map(e=>{const t={};return this.columns.forEach((i,a)=>{t[i]=e[a]}),t}))},handleFileChange(e){const t=new FileReader;return t.onload=e=>{const t=new Uint8Array(e.target.result),a=i.read(t,{type:"array"});this.processWorkbook(a)},t.readAsArrayBuffer(e.raw),!1},downloadExcel(){if(!this.url||this.downloading)return;this.downloading=!0;const e=require("axios").create({baseURL:this.VUE_APP_BASE_API,timeout:3e4,responseType:"blob"});e.interceptors.request.use(e=>{const t=this.$store.getters.token||localStorage.getItem("token");return t&&(e.headers.Authorization="Bearer "+t),e}),e.interceptors.response.use(e=>("blob"===e.config.responseType,e),e=>Promise.reject(e));const t=this.url.split("/").pop();e.get("/file/upload/"+t).then(e=>{const t=e.data;let i="示例文件.xlsx";const l=e.headers["content-disposition"];if(l){const e=l.match(/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/);if(e&&e[1]){i=e[1].replace(/['"]/g,"");try{i=decodeURIComponent(i)}catch(s){void 0}}}a.saveAs(t,i),this.$message.success("下载成功")}).catch(e=>{void 0,this.$message.error("下载失败,请重试")}).finally(()=>{this.downloading=!1})},closeDialog(){this.dialogVisible=!1},handleClose(){this.closeDialog(),this.tableData=[],this.columns=[],this.rawWorkbook=null},handleSizeChange(e){this.queryParams.pageSize=e,this.queryParams.pageNum=1,this.loadExcelFromUrl()},handleCurrentChange(e){this.queryParams.pageNum=e,this.loadExcelFromUrl()}},install(e){e.component(n.name,n)}};e("");var d={render(){var e=this,t=e.$createElement,i=e.l.i||t;return i("div",[i("el-button",{attrs:{size:"small",type:"primary",icon:"el-icon-setting"},on:{click:e.onAdjust}},[e.m("\n 调整变量\n ")]),e.m(" "),i("long-variable-viewer",{ref:"variableViewerRef",attrs:{visible:e.modalVisiable,values:e.values,menus:e.menus},on:{"update:visible"(t){e.modalVisiable=t},"config-changed":e.handleConfigChanged}})],1)},staticRenderFns:[],name:"LongVariableViewerButton",props:{values:{type:Array,default(){return[]}},menus:{type:Array,default(){return[]}}},data:()=>({modalVisiable:!1,tableDataCache:[],updateTimer:null,valuesUpdateTimer:null,menusUpdateTimer:null,updatingTableData:!1}),mounted(){void 0,this.$nextTick(()=>{this.updateTableData()})},beforeDestroy(){this.updateTimer&&clearInterval(this.updateTimer),this.valuesUpdateTimer&&clearTimeout(this.valuesUpdateTimer),this.menusUpdateTimer&&clearTimeout(this.menusUpdateTimer)},watch:{modalVisiable(e){e||(this.$emit("update:columns",this.$refs.variableViewerRef.$getValues()),this.$nextTick(()=>{this.updateTableData()}))},values:{handler(){this.valuesUpdateTimer&&clearTimeout(this.valuesUpdateTimer),this.valuesUpdateTimer=setTimeout(()=>{this.updateTableData()},300)},deep:!0},menus:{handler(){this.menusUpdateTimer&&clearTimeout(this.menusUpdateTimer),this.menusUpdateTimer=setTimeout(()=>{this.updateTableData()},300)},deep:!0}},computed:{tableData(){return this.tableDataCache}},methods:{onAdjust(){this.modalVisiable=!0},$getValues(){return this.$refs.variableViewerRef.$getValues()},$triggerUpdate(){this.$emit("update:columns",this.$getValues()),this.$nextTick(()=>{this.updateTableData()})},$restoreConfig(e){this.$refs.variableViewerRef&&this.$refs.variableViewerRef.$restoreConfig&&(this.$refs.variableViewerRef.$restoreConfig(e),this.$nextTick(()=>{this.updateTableData()}))},handleConfigChanged(e){Array.isArray(e)&&(this.tableDataCache=e,this.$emit("table-data-updated",e))},updateTableData(){if(!this.updatingTableData)if(this.updatingTableData=!0,this.$refs.variableViewerRef&&this.$refs.variableViewerRef.$getTableData){const e=this.$refs.variableViewerRef.$getTableData()||[],t=JSON.parse(JSON.stringify(e)),i=JSON.parse(JSON.stringify(this.tableDataCache));JSON.stringify(t)!==JSON.stringify(i)?(this.tableDataCache=e,this.$nextTick(()=>{this.$emit("table-data-updated",e),this.updatingTableData=!1})):this.updatingTableData=!1}else this.tableDataCache.length>0&&(this.tableDataCache=[]),this.updatingTableData=!1}},install(e){e.component(d.name,d)}};e("");var c={render(){var e=this,t=e.$createElement,i=e.l.i||t;return i("div",{staticStyle:{display:"inline-block","margin-left":"4px"},on:{click(e){e.stopPropagation()}}},[i("el-button",{attrs:{type:"text",size:"small",icon:"el-icon-document"},on:{click:e.onExample}},[e.m("示例文件")]),e.m(" "),i("long-excel-viewer",{attrs:{visible:e.modalVisiable,url:e.url},on:{"update:visible"(t){e.modalVisiable=t}}})],1)},staticRenderFns:[],name:"LongExcelViewerButton",props:{url:{type:String,default:""}},data:()=>({modalVisiable:!1}),methods:{onExample(e){e.stopPropagation(),e.preventDefault(),this.modalVisiable=!0}},install(e){e.component(c.name,c)}};e(".long-uploader-wrapper .el-form-item{margin-bottom:0}.long-uploader-wrapper :deep(.el-upload) .el-upload-dragger{height:130px!important}.long-uploader-wrapper :deep(.el-upload) .el-upload-dragger .el-icon-upload{margin:8px 0}.variable-config-section{background-color:#f8f9fa;border:1px solid #e9ecef;border-radius:4px;margin-top:16px}.config-header{align-items:center;background-color:#e8e9f2;border-bottom:1px solid #e9ecef;cursor:pointer;display:flex;justify-content:space-between;padding:0 12px;transition:background-color .2s}.config-header:hover{background-color:#f0f0f0}.config-title{color:#303133;font-size:14px;margin:0}.collapse-arrow{color:#909399;font-size:12px;transition:transform .3s ease}.collapse-arrow.is-collapsed{transform:rotate(-90deg)}.config-content{padding:12px}.variable-config-section .el-table{font-size:12px}.variable-config-section .el-table th{background-color:#f5f7fa;color:#606266;font-weight:600}.variable-config-section .el-table td{padding:8px 0}.no-data{color:#909399;font-size:14px;padding:20px;text-align:center}");var p={render(){var e=this,t=e.$createElement,i=e.l.i||t;return i("div",{staticClass:"long-uploader-wrapper"},[i("div",[i("div",{staticStyle:{float:"right","margin-top":"-80px"}},[e.options.example&&e.options.example.value?i("long-excel-viewer-button",{attrs:{url:e.options.example.value}}):e.k()],1),e.m(" "),i("div",{staticStyle:{display:"flex","align-items":"center","justify-content":"space-between","margin-bottom":"12px"}},[i("div",{staticStyle:{display:"flex","align-items":"center",gap:"12px",position:"relative"}},[i("el-upload",{attrs:{action:e.uploadUrl,headers:{Authorization:"Bearer "+e.token},"on-preview":e.handlePreview,"on-remove":e.handleRemove,"before-remove":e.beforeRemove,"on-change":e.handleChange,"before-upload":e.beforeUpload,accept:e.fileType,drag:"","on-exceed":e.handleExceed,"file-list":e.fileList}},[i("i",{staticClass:"el-icon-upload",staticStyle:{color:"#6C1537"}}),e.m(" "),i("div",{staticClass:"el-upload__text"},[i("div",{staticStyle:{"line-height":"18px"}},[e.m("将文件拖到此处,或"),i("em",[e.m("点击上传")])]),e.m(" "),i("div",{staticStyle:{"line-height":"18px"}},[e.m("\n 支持上传"),i("em",[e.m("xlsx")]),e.m("、"),i("em",[e.m("xls")]),e.m("、"),i("em",[e.m("csv")])])])])],1)]),e.m(" "),e.fileList.length>0?i("div",{staticStyle:{"margin-top":"-20px"}},[e.S(0),e.m(" "),i("div",[e.h(e.fileList,function(t){return i("el-tag",{key:t.uid,staticStyle:{"margin-right":"8px",cursor:"pointer"},attrs:{closable:""},on:{close(i){return e.handleRemove(t)},click(i){return e.handleFileClick(t)}}},[e.m("\n "+e.v(t.name)+"\n ")])}),e.m(" "),e.fileList.length>0&&e.options.variable&&e.options.variable.enable?i("div",{staticStyle:{display:"flex","align-items":"center"}},[i("span",{staticStyle:{color:"#f56c6c","margin-right":"5px"}},[e.m("*")]),e.m(" "),i("long-variable-viewer-button",{ref:"variableViewerRef",attrs:{values:e.fileData,menus:e.options.variable.menus},on:{"update:columns":e.handleUpdateColumns,"table-data-updated":e.handleTableDataUpdated}})],1):e.k()],2)]):e.k()]),e.m(" "),e.fileList.length>0&&e.options.variable&&e.options.variable.enable&&e.hasConfiguredVariables?i("div",{staticClass:"variable-config-section"},[i("div",{staticClass:"config-header",on:{click:e.toggleCollapse}},[i("span",{staticClass:"config-title"},[e.m("当前变量配置")]),e.m(" "),i("i",{staticClass:"el-icon-caret-bottom collapse-arrow",class:{"is-collapsed":e.isCollapsed}})]),e.m(" "),i("div",{directives:[{name:"show",rawName:"v-show",value:!e.isCollapsed,expression:"!isCollapsed"}],staticClass:"config-content"},[0===e.currentVariableValues.length?i("div",{staticClass:"no-data"},[e.m("\n 暂无数据\n ")]):i("el-table",{staticStyle:{width:"100%"},attrs:{data:e.currentVariableValues,size:"mini","max-height":"300",border:""}},[i("el-table-column",{attrs:{prop:"field",label:"字段名","show-overflow-tooltip":""}}),e.m(" "),i("el-table-column",{attrs:{prop:"fullPath",label:"属性","show-overflow-tooltip":""}})],1),e.m(" "),i("div",{staticClass:"debug-info",staticStyle:{"margin-top":"8px","font-size":"12px",color:"#999"}},[e.m("\n 数据条数: "+e.v(e.currentVariableValues.length)+"\n ")])],1)]):e.k(),e.m(" "),i("long-excel-viewer",{attrs:{visible:e.previewVisible,url:e.previewUrl},on:{"update:visible"(t){e.previewVisible=t}}})],1)},staticRenderFns:[function(){var e=this,t=e.$createElement,i=e.l.i||t;return i("div",{staticStyle:{"font-size":"12px",color:"#999","line-height":"20px"}},[i("i",{staticClass:"el-icon-info",staticStyle:{"margin-right":"5px"}}),e.m(" "),i("span",[e.m("点击文件名称可预览文件")])])}],name:"LongUploader",props:{options:{type:Object,default(){return{variable:{enable:!1,values:[],menus:[]},example:{value:""},file:{id:"",name:""}}}},value:{type:Object,default(){return{fileId:"",columns:[],fileName:""}}},fileId:{type:String,default:""},limit:{type:Number,default:1},fileSize:{type:Number,default:3},fileType:{type:String,default:".xlsx,.xls,.csv"}},data:()=>({uploadUrl:process.env.VUE_APP_BASE_API+"/file/upload",fileList:[],token:"",fileData:[],fileToken:"",variableViewerRef:null,isCollapsed:!0,hasTriggerUpdate:!1,previewVisible:!1,previewUrl:"",tableDataCache:[]}),computed:{currentVariableValues(){return this.tableDataCache.map(e=>({field:e.field||"",fullPath:e.fullPath||"",varType:e.varType||"",attr:e.attr||""}))},hasConfiguredVariables(){return this.currentVariableValues.length>0}},created(){this.token=localStorage.getItem("token")},watch:{fileId:{handler(e){this.fileToken=e},immediate:!0,deep:!0},value:{handler(e,t){void 0,!e||!e.fileId||t&&t.fileId===e.fileId||(this.fileToken=e.fileId,this.downloadFile(e.fileId,e.columns||{})),!e||!e.fileName||t&&t.fileName===e.fileName||(this.fileList=[{name:e.fileName,uid:e.fileId}])},immediate:!0,deep:!0}},methods:{downloadFile(e,t={}){this.$api.dataAnalysis.filePreview({fileId:e}).then(e=>{if(e&&e.data&&e.data.records&&e.data.records.length>0){const i=e.data.records[0].headers||[];this.$emit("update:headers",i);const a=this.options.variable.menus||[],l={};i.forEach(e=>{l[e]={field:e,varType:"",attr:""}}),t&&"object"==typeof t&&Object.keys(t).forEach(e=>{const i=t[e];if(void 0,i&&i.values&&Array.isArray(i.values)){const t=a.find(t=>t.fieldName===e);void 0,t&&i.values.forEach(i=>{l[i]&&(l[i]={field:i,varType:t.label||e,attr:t.label||e})})}}),this.fileData=[{...l}],this.$nextTick(()=>{if(this.$refs.variableViewerRef&&t&&Object.keys(t).length>0&&"function"==typeof this.$refs.variableViewerRef.$restoreConfig&&(this.$refs.variableViewerRef.$restoreConfig(t),this.$nextTick(()=>{this.$refs.variableViewerRef&&"function"==typeof this.$refs.variableViewerRef.updateTableData&&this.$refs.variableViewerRef.updateTableData()})),this.$route.query.id){if(this.hasTriggerUpdate)return;"function"==typeof this.$refs.variableViewerRef.$triggerUpdate&&this.$refs.variableViewerRef.$triggerUpdate(),this.hasTriggerUpdate=!0}})}}).catch(e=>{this.$message.error(e.message||"数据文件内容不匹配,请重新上传")}).finally(()=>{this.loading=!1})},handleColumns(e=[]){const t=this.options.variable.menus||[];void 0,0!=t.length&&e.forEach(e=>{void 0;const i=t.find(t=>t.fieldName==e.fieldName);void 0,e.varType=i.label,e.attr=i.attr})},handleTableDataUpdated(e){Array.isArray(e)&&(this.tableDataCache=e)},handleUpdateColumns(e){void 0,this.$emit("update:columns",e)},beforeUpload(e){if(void 0,e.size>1048576*this.fileSize)return this.$message.error(`上传文件大小不能超过 ${this.fileSize} MB!`),!1;const t=e.type,i=e.name.toLowerCase();return!!(["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.ms-excel","text/csv"].includes(t)||i.endsWith(".xlsx")||i.endsWith(".xls")||i.endsWith(".csv"))||(this.$message.error("只支持上传 xlsx、xls、csv 格式的文件!"),!1)},handleChange(e,t){if(t.length>1?this.fileList=[t[t.length-1]]:this.fileList=t.filter(e=>void 0!==e.raw),"success"===e.status){const t=e.response;t&&200===t.code&&(this.fileToken=t.data.id,this.$emit("update:fileId",this.fileToken),this.loadFromUrl(this.fileToken))}},loadFromUrl(e){this.$api.dataAnalysis.filePreview({fileId:e}).then(e=>{if(e&&e.data&&e.data.records&&e.data.records.length>0){const t=(e.data.records[0]||{data:[],headers:[]}).headers||[];if(t.length>0){this.$emit("update:headers",t);const e={};t.forEach(t=>{e[t]={field:t,varType:"",attr:""}}),this.fileData=[{...e}]}else this.$emit("update:headers",[]),this.fileData=[]}})},handleRemove(e){this.fileList=this.fileList.filter(t=>t.uid!==e.uid),this.fileToken="",this.fileData=[],this.$emit("update:fileId",""),this.$emit("update:headers",[])},onAdjust(){this.$emit("adjust")},handleRemove1(e,t){void 0},handlePreview(e){void 0},handleExceed(e,t){this.$message.warning(`上传文件数量不能超过 ${this.limit} 个!`),t.length>this.limit&&(this.fileList=t.slice(-this.limit))},beforeRemove:()=>!0,toggleCollapse(){this.isCollapsed=!this.isCollapsed},handleFileClick(){event.stopPropagation(),this.fileToken?(this.previewUrl=`${process.env.VUE_APP_BASE_API}/file/preview/${this.fileToken}`,this.previewVisible=!0):this.$message.warning("文件ID不存在,无法预览")}},install(e){e.component(p.name,p)}};e(".long-radio-wrapper{display:flex;flex-wrap:wrap}.long-radio-wrapper ::v-deep .el-radio{line-height:24px;margin-bottom:0}.long-radio-wrapper ::v-deep .el-radio__label{display:inline-block;vertical-align:middle;white-space:normal;word-break:break-all}.long-radio-item{margin:4px 12px 4px 0;width:100px}");var h={render(){var e=this,t=e.$createElement,i=e.l.i||t;return i("el-radio-group",e.o(e.p({staticClass:"long-radio-wrapper"},"el-radio-group",e.$attrs,!1),e.$listeners),e.h(e.options,function(t,a){return i("el-radio",{key:a,staticClass:"long-radio-item",attrs:{label:t[e.valueKey],disabled:t[e.disabledOption]}},[e.m("\n "+e.v(t[e.labelKey])+"\n ")])}),1)},staticRenderFns:[],name:"LongRadio",props:{dataList:{type:Array,default(){return[]}},disabledOption:{type:[Boolean,Number],default:!1},valueKey:{type:[String,Number],default:"value"},labelKey:{type:[String,Number],default:"label"},mode:{type:String,default:"local"},dict:{type:String,default:""},url:{type:String,default:""},requestParams:{type:Object,default(){}},placeholder:{type:String,default:"请选择"}},data:()=>({options:[]}),watch:{dataList:{deep:!0,immediate:!0,handler(e){"local"===this.mode&&(this.options=e)}},dict:{deep:!0,handler(e){this.init()}}},created(){this.init()},methods:{init(){"remote"===this.mode&&this.dict&&this.getDicts(this.dict).then(e=>{this.options=(e.data||[]).map(e=>({[this.valueKey]:e.dictCode,[this.labelKey]:e.dictLabel}))})}},install(e){e.component(h.name,h)}};e(".long-group{background-color:#f8f8f8;box-sizing:border-box;height:100%;padding:10px;width:100%}.long-group .group-header{color:#333;font-size:14px;font-weight:700}");var u={render(){var e=this,t=e.$createElement,i=e.l.i||t;return i("div",{staticClass:"long-group"},[i("div",{staticClass:"group-header"},[e.m(e.v(e.label))]),e.m(" "),e.u("default")],2)},staticRenderFns:[],name:"LongGroup",props:{label:{type:String,default:""}},install(e){e.component(u.name,u)}};e(".long-color-picker{width:200px}.long-color-picker .el-color-picker__trigger{width:100%}.long-color-picker .el-color-picker__trigger .el-color-picker__icon{left:unset!important;right:5px!important;width:unset!important}");var f={render(){var e=this,t=e.$createElement;return(e.l.i||t)("el-color-picker",e.o(e.p({staticClass:"long-color-picker"},"el-color-picker",e.$attrs,!1),e.$listeners))},staticRenderFns:[],name:"LongColorPicker",install(e){e.component(f.name,f)}};e("");var g={render(){var e=this,t=e.$createElement;return(e.l.i||t)("el-input-number",e.o(e.p({staticClass:"long-number-input",attrs:{"controls-position":"right",step:e.stepValue,value:e.value,max:e.maxValue,min:e.minValue},on:{input(t){return e.$emit("input",t)}}},"el-input-number",e.$attrs,!1),e.$listeners))},staticRenderFns:[],name:"LongNumberInput",props:{value:{type:[String,Number],default:0},placeholder:{type:String,default:"请输入"},max:{type:[Number,String],default:""},min:{type:[Number,String],default:""},step:{type:[Number,String],default:1}},data(){return{maxValue:""===this.max?Number.MAX_SAFE_INTEGER:+this.max,minValue:""===this.min?Number.MIN_SAFE_INTEGER:+this.min,stepValue:+this.step}},watch:{max:{handler(e){this.maxValue=""===e?Number.MAX_SAFE_INTEGER:+e},immediate:!0},min:{handler(e){this.minValue=""===e?Number.MIN_SAFE_INTEGER:+e},immediate:!0},step:{handler(e){this.stepValue=+e},immediate:!0}},install(e){e.component(g.name,g)}};e(".long-checkbox-wrapper{display:flex;flex-wrap:wrap}.long-checkbox-wrapper ::v-deep .el-checkbox{line-height:24px;margin-bottom:0}.long-checkbox-item{margin:1px 6px 1px 0;min-width:50px}");var b={render(){var e=this,t=e.$createElement,i=e.l.i||t;return i("el-checkbox-group",e.o(e.p({staticClass:"long-checkbox-wrapper",attrs:{value:e.value},on:{change:e.handleInput}},"el-checkbox-group",e.$attrs,!1),e.$listeners),e.h(e.options,function(t,a){return i("el-checkbox",{key:a,staticClass:"long-checkbox-item",attrs:{label:t[e.valueKey],disabled:e.getDisabled(t)}},[e.m("\n "+e.v(t[e.labelKey])+"\n ")])}),1)},staticRenderFns:[],name:"LongCheckBox",props:{value:{type:Array,default(){return[]}},dataList:{type:Array,default(){return[]}},disabledOption:{type:[String,Boolean,Number],default:!1},valueKey:{type:[String,Number],default:"value"},labelKey:{type:[String,Number],default:"label"},mode:{type:String,default:"local"},dict:{type:String,default:""},url:{type:String,default:""},requestParams:{type:Object,default(){}},placeholder:{type:String,default:"请选择"}},data:()=>({options:[]}),watch:{dataList:{deep:!0,immediate:!0,handler(e){"local"===this.mode&&(this.options=e)}},dict:{deep:!0,handler(e){this.init()}}},created(){this.init()},methods:{init(){"remote"===this.mode&&this.dict&&this.getDicts(this.dict).then(e=>{this.options=(e.data||[]).map(e=>({[this.valueKey]:e.dictCode,[this.labelKey]:e.dictLabel}))})},handleInput(e){this.$emit("input",e),this.$emit("change",e)},getDisabled(e){return"string"==typeof this.disabledOption?e[this.disabledOption]||!1:"boolean"==typeof this.disabledOption?this.disabledOption:"number"==typeof this.disabledOption&&e[this.disabledOption]||!1}},install(e){e.component(b.name,b)}},m=[s,r,o,n,d,c,p,h,u,f,g,b],x=function(e){if(!x.installed){x.installed=!0;var i=["ElInput","ElSelect","ElOption","ElCheckbox","ElCheckboxGroup","ElRadio","ElRadioGroup","ElButton","ElDialog","ElTable","ElTableColumn","ElUpload","ElTag","ElPagination","ElInputNumber","ElColorPicker","ElForm","ElFormItem","ElIcon"];i.forEach(function(i){var a=e.options.components[i];if(!a){var l=t(i);a=e.options.components[l]}if(a){var s=t(i);s&&s!==i&&(e.options.components[s]||e.component(s,a)),e.options.components[i]||e.component(i,a)}else"production"!==process.env.NODE_ENV,0}),e.nextTick(function(){i.forEach(function(i){var a=e.options.components[i];if(a){var l=t(i);l&&l!==i&&(e.options.components[l]||e.component(l,a))}})}),m.forEach(function(i){if(i){var a=i.name||i.options&&i.options.name;if(a){e.component(a,i);var l=t(a);l&&l!==a&&e.component(l,i)}}})}};"undefined"!=typeof window&&window.Vue&&x(window.Vue);var v={version:"1.0.0",install:x,Input:s,Select:r,VariableViewer:o,ExcelViewer:n,VariableViewerButton:d,ExcelViewerButton:c,Uploader:p,Radio:h,Group:u,ColorPicker:f,NumberInput:g,CheckBox:b};exports.CheckBox=b,exports.ColorPicker=f,exports.ExcelViewer=n,exports.ExcelViewerButton=c,exports.Group=u,exports.Input=s,exports.NumberInput=g,exports.Radio=h,exports.Select=r,exports.Uploader=p,exports.VariableViewer=o,exports.VariableViewerButton=d,exports.default=v;
|
package/lib/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e,t;e=this,t=function(e,t,i,a){"use strict";function l(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var a=document.head||document.getElementsByTagName("head")[0],l=document.createElement("style");l.type="text/css","top"===i&&a.firstChild?a.insertBefore(l,a.firstChild):a.appendChild(l),l.styleSheet?l.styleSheet.cssText=e:l.appendChild(document.createTextNode(e))}}function s(e){return e?e.replace(/([A-Z])/g,"-$1").toLowerCase().replace(/^-/,""):e}var o=function(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}(a);l(".long-input-wrapper{background-color:#fff;border:1px solid #e0e0e0;border-radius:4px;padding:8px}.intTxt{width:80%}");var r={render(){var e=this,t=e.$createElement;return(e.i.t||t)("el-input",e.l(e.o({staticClass:"intTxt",attrs:{"show-word-limit":e.showWordLimit,placeholder:e.placeholder,"auto-complete":"new-password",disabled:e.disabled},on:{input:t=>e.$emit("input",t)}},"el-input",e.$attrs,!1),e.$listeners),[e.p(Object.keys(this.$slots),function(t){return e.h(t,null,{slot:t})})],2)},staticRenderFns:[],name:"LongInput",props:{showWordLimit:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},placeholder:{type:String,default:"请输入"}},install(e){e.component(r.name,r)}};l("");var n={render(){var e=this,t=e.$createElement,i=e.i.t||t;return i("el-select",e.l(e.o({attrs:{value:e.value,placeholder:e.placeholder}},"el-select",e.$attrs,!1),e.$listeners),[e.h("unshift"),e.u(" "),e.h("default",function(){return e.p(e.options,function(t,a){return i("el-option",{key:a,attrs:{value:t[e.valueKey],label:t[e.labelKey],disabled:t[e.disabledOption]}})})},{slot:"default"}),e.u(" "),e.h("prefix",null,{slot:"prefix"}),e.u(" "),e.h("empty",null,{slot:"empty"})],2)},staticRenderFns:[],name:"LongSelect",props:{value:{type:[String,Number],default:""},dataList:{type:Array,default:()=>[]},disabledOption:{type:[Boolean,Number],default:!1},valueKey:{type:[String,Number],default:"value"},labelKey:{type:[String,Number],default:"label"},mode:{type:String,default:"local"},dict:{type:String,default:""},url:{type:String,default:""},requestParams:{type:Object,default(){}},placeholder:{type:String,default:"请选择"}},data(){return{options:[]}},watch:{dataList:{deep:!0,immediate:!0,handler(e){"local"===this.mode&&(this.options=e)}},dict:{deep:!0,handler(e){this.init()}}},created(){this.init()},methods:{init(){"remote"===this.mode&&this.dict&&this.getDicts(this.dict).then(e=>{this.options=(e.data||[]).map(e=>({[this.valueKey]:e.dictCode,[this.labelKey]:e.dictLabel}))})}},install(e){e.component(n.name,n)}};l(".variable-config-dialog :deep(.el-dialog__body){padding:20px}.variable-config-dialog :deep(.el-dialog__header){padding:20px 20px 10px}.dialog-title{align-items:center;color:#303133;display:flex;font-size:16px;font-weight:700;gap:24px;padding:0 20px}.dialog-title .title-left{color:#303133;flex:1;min-width:500px}.dialog-title .title-separator{color:#dcdfe6;flex-shrink:0;font-weight:400}.dialog-title .title-right{color:#303133;flex:1;min-width:400px}.dialog-body{display:flex;gap:24px;min-height:500px}.left-section{flex:1;min-width:500px}.section-title{color:#303133;font-size:16px;font-weight:700;margin-bottom:16px}.variable-selector{align-items:flex-start;display:flex;gap:16px}.variable-panel{border:1px solid #dcdfe6;border-radius:4px;display:flex;flex:1;flex-direction:column;height:500px;overflow:hidden}.panel-header{align-items:center;background:#f5f7fa;border-bottom:1px solid #dcdfe6;display:flex;justify-content:space-between;padding:12px 16px}.select-all-checkbox :deep(.el-checkbox__label){padding-left:8px}.panel-title{color:#303133;font-weight:500}.panel-count{color:#909399;font-size:12px}.panel-search{border-bottom:1px solid #dcdfe6;padding:12px}.panel-list{flex:1;overflow-y:auto;padding:8px}.variable-item{border-radius:4px;cursor:pointer;padding:8px 12px;transition:background-color .2s}.variable-item:hover{background-color:#f5f7fa}.variable-item :deep(.el-checkbox){width:100%}.variable-item :deep(.el-checkbox__label){width:100%}.arrow-buttons{display:flex;flex-direction:column;gap:12px;justify-content:center;padding-top:100px}.arrow-buttons .el-button{margin-left:0!important}.right-section{display:flex;flex:1;flex-direction:column;min-width:400px;overflow:hidden}.config-desc{color:#909399;flex-shrink:0;font-size:13px;line-height:1.5;margin-bottom:24px}.config-group{margin-bottom:32px}.config-group:last-child{margin-bottom:0}.config-label{color:#303133;font-size:14px;font-weight:500;margin-bottom:12px}.config-options{display:flex;flex:1;flex-direction:column;gap:16px;margin-top:16px;overflow-x:hidden;overflow-y:auto;padding-right:8px}.config-options::-webkit-scrollbar{width:6px}.config-options::-webkit-scrollbar-track{background:#f1f1f1;border-radius:3px}.config-options::-webkit-scrollbar-thumb{background:#c1c1c1;border-radius:3px}.config-options::-webkit-scrollbar-thumb:hover{background:#a8a8a8}.config-option-row{align-items:center;display:flex;gap:12px;margin-bottom:8px}.config-option-row.is-parent .option-label{color:#303133;font-weight:500}.config-option-row.is-leaf .option-label{color:#606266}.option-label{color:#606266;flex:1;font-size:13px;min-width:0;white-space:normal;word-break:break-all}.option-label.required{color:#303133;font-weight:500}.option-label .required-mark{color:#f56c6c;margin-left:2px}.config-select{flex-shrink:0;width:350px}.non-leaf-label{color:#909399;font-size:13px;font-style:italic}.disabled-option{cursor:not-allowed!important}.disabled-option,.disabled-text{color:#c0c4cc!important}:deep(.el-select-dropdown__item.is-disabled){color:#c0c4cc!important;cursor:not-allowed!important}:deep(.el-select-dropdown__item.is-disabled) span{color:#c0c4cc!important}.checkbox-list{border:1px solid #dcdfe6;border-radius:4px;display:flex;flex:1;flex-direction:column;gap:8px;max-height:200px;overflow-y:auto;padding:8px}.dialog-footer{text-align:right}");var d={render(){var e=this,t=e.$createElement,i=e.i.t||t;return i("div",[i("el-dialog",{staticClass:"variable-config-dialog",staticStyle:{"max-height":"90vh"},attrs:{visible:e.dialogVisible,width:"1200px"},on:{"update:visible"(t){e.dialogVisible=t},close:e.handleClose}},[i("div",{staticClass:"dialog-title",attrs:{slot:"title"},slot:"title"},[i("span",{staticClass:"title-left"},[e.u("选择分析变量")]),e.u(" "),i("span",{staticClass:"title-separator"},[e.u("|")]),e.u(" "),i("span",{staticClass:"title-right"},[e.u("配置变量")])]),e.u(" "),i("div",{staticClass:"dialog-body"},[i("div",{staticClass:"left-section"},[i("div",{staticClass:"variable-selector"},[i("div",{staticClass:"variable-panel"},[i("div",{staticClass:"panel-header"},[i("el-checkbox",{staticClass:"select-all-checkbox",attrs:{indeterminate:e.leftIndeterminate},on:{change:e.handleLeftSelectAll},model:{value:e.leftSelectAll,callback(t){e.leftSelectAll=t},expression:"leftSelectAll"}},[i("span",{staticClass:"panel-title"},[e.u("全选")])]),e.u(" "),i("span",{staticClass:"panel-count"},[e.u(e.m(e.selectedAllCount)+"/"+e.m(e.allVariables.length))])],1),e.u(" "),i("div",{staticClass:"panel-search"},[i("el-input",{attrs:{placeholder:"请输入关键字","suffix-icon":"el-icon-search",size:"small"},on:{input:e.handleLeftSearch},model:{value:e.leftKeyword,callback(t){e.leftKeyword=t},expression:"leftKeyword"}})],1),e.u(" "),i("div",{staticClass:"panel-list"},e.p(e.filteredLeftVariables,function(t){return i("div",{key:t.field,staticClass:"variable-item"},[i("el-checkbox",{on:{change:i=>e.handleLeftCheckChange(t)},model:{value:t.checked,callback(i){e.$set(t,"checked",i)},expression:"item.checked"}},[e.u("\n "+e.m(t.field)+"\n ")])],1)}),0)]),e.u(" "),i("div",{staticClass:"arrow-buttons"},[i("el-button",{attrs:{type:"primary",icon:"el-icon-arrow-right",size:"small",disabled:!e.hasLeftSelected},on:{click:e.moveToRight}}),e.u(" "),i("el-button",{attrs:{type:"danger",icon:"el-icon-arrow-left",size:"small",disabled:!e.hasRightSelected},on:{click:e.moveToLeft}})],1),e.u(" "),i("div",{staticClass:"variable-panel"},[i("div",{staticClass:"panel-header"},[i("el-checkbox",{staticClass:"select-all-checkbox",attrs:{indeterminate:e.rightIndeterminate},on:{change:e.handleRightSelectAll},model:{value:e.rightSelectAll,callback(t){e.rightSelectAll=t},expression:"rightSelectAll"}},[i("span",{staticClass:"panel-title"},[e.u("已选")])]),e.u(" "),i("span",{staticClass:"panel-count"},[e.u(e.m(e.selectedRightCount)+"/"+e.m(e.selectedVariables.length))])],1),e.u(" "),i("div",{staticClass:"panel-search"},[i("el-input",{attrs:{placeholder:"请输入关键字","suffix-icon":"el-icon-search",size:"small"},on:{input:e.handleRightSearch},model:{value:e.rightKeyword,callback(t){e.rightKeyword=t},expression:"rightKeyword"}})],1),e.u(" "),i("div",{staticClass:"panel-list"},e.p(e.filteredRightVariables,function(t){return i("div",{key:t.field,staticClass:"variable-item"},[i("el-checkbox",{on:{change:i=>e.handleRightCheckChange(t)},model:{value:t.checked,callback(i){e.$set(t,"checked",i)},expression:"item.checked"}},[e.u("\n "+e.m(t.field)+"\n ")])],1)}),0)])])]),e.u(" "),i("div",{staticClass:"right-section"},[i("div",{staticClass:"config-desc"},[e.u("\n 数据文件中因变量的值,需赋予参考值,方便精准进行数据分析。\n ")]),e.u(" "),i("div",{staticClass:"config-options"},e.p(e.flatMenuItems,function(t){return i("div",{key:t.pathString,staticClass:"config-option-row"},[i("span",{staticClass:"option-label",class:{required:t.required}},[e.u("\n "+e.m(t.pathString)+"\n "),t.required?i("span",{staticClass:"required-mark"},[e.u("*")]):e.v()]),e.u(" "),i("el-select",{staticClass:"config-select",attrs:{placeholder:e.getPlaceholder(t),clearable:t.nullable,multiple:t.multiple},on:{change:i=>e.handleConfigChange(t.pathString,i)},model:{value:e.configValues[t.pathString],callback(i){e.$set(e.configValues,t.pathString,i)},expression:"configValues[menuItem.pathString]"}},e.p(e.getAvailableOptions(t.pathString,t.multiple),function(t){return i("el-option",{key:t.value,class:{"disabled-option":t.disabled},attrs:{label:t.label,value:t.value,disabled:t.disabled}},[i("span",{class:{"disabled-text":t.disabled}},[e.u(e.m(t.label))])])}),1)],1)}),0)])]),e.u(" "),i("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[i("el-button",{on:{click:e.handleClose}},[e.u("取消")]),e.u(" "),i("el-button",{staticStyle:{color:"#fff"},attrs:{type:"primary"},on:{click:e.handleSave}},[e.u("保存")])],1)])],1)},staticRenderFns:[],name:"LongVariableViewer",props:{visible:{type:Boolean,default:!1},values:{type:Array,default:()=>[]},menus:{type:Array,default:()=>[]}},data(){return{dialogVisible:!1,leftKeyword:"",rightKeyword:"",allVariables:[],selectedVariables:[],configValues:{},configChangeTimer:null}},computed:{filteredLeftVariables(){return this.leftKeyword?this.allVariables.filter(e=>e.field.toLowerCase().includes(this.leftKeyword.toLowerCase())):this.allVariables},filteredRightVariables(){return this.rightKeyword?this.selectedVariables.filter(e=>e.field.toLowerCase().includes(this.rightKeyword.toLowerCase())):this.selectedVariables},selectedAllCount(){return this.allVariables.filter(e=>e.checked).length},selectedRightCount(){return this.selectedVariables.filter(e=>e.checked).length},hasLeftSelected(){return this.allVariables.some(e=>e.checked)},hasRightSelected(){return this.selectedVariables.some(e=>e.checked)},leftSelectAll:{get(){const e=this.filteredLeftVariables;return 0!==e.length&&e.every(e=>e.checked)},set(){}},leftIndeterminate(){const e=this.filteredLeftVariables;if(0===e.length)return!1;const t=e.filter(e=>e.checked).length;return t>0&&t<e.length},rightSelectAll:{get(){const e=this.filteredRightVariables;return 0!==e.length&&e.every(e=>e.checked)},set(){}},rightIndeterminate(){const e=this.filteredRightVariables;if(0===e.length)return!1;const t=e.filter(e=>e.checked).length;return t>0&&t<e.length},flatMenuItems(){if(!this.menus||0===this.menus.length)return[];const e=[],t=(i,a=[])=>{const l=[...a,i.label];if(i.children&&0!==i.children.length)i.children&&i.children.length>0&&i.children.forEach(e=>{t(e,l)});else{const t=l.join("/");e.push({label:i.label,path:l,pathString:t,isLeaf:!0,id:i.id,fieldName:i.fieldName,required:i.required,nullable:i.nullable,multiple:i.multiple,originalMenu:i})}};return this.menus.forEach(e=>{t(e)}),e},tableData(){const e=[];return Object.keys(this.configValues).forEach(t=>{const i=this.configValues[t];if(!i||Array.isArray(i)&&0===i.length)return;const a=this.flatMenuItems.find(e=>e.pathString===t);if(!a)return;const l=a.pathString;(Array.isArray(i)?i:[i]).forEach(t=>{const i=t+"";i&&e.push({field:i,fullPath:l,varType:a.path&&a.path.length>0?a.path[0]:l,attr:a.path&&a.path.length>0?a.path[a.path.length-1]:""})})}),e}},watch:{visible:{handler(e){this.dialogVisible=e},immediate:!0},dialogVisible(e){this.$emit("update:visible",e)},values:{handler(e){this.handleValuesChange(e)},immediate:!0,deep:!0},selectedVariables:{handler(){const e=this.selectedVariables.map(e=>e.field),t={...this.configValues};let i=!1;Object.keys(t).forEach(a=>{const l=t[a];if(Array.isArray(l)){const s=l.filter(t=>e.includes(t));s.length!==l.length&&(t[a]=s,i=!0)}else l&&!e.includes(l)&&(t[a]="",i=!0)}),i&&(this.configValues=t)},deep:!0},configValues:{handler(){this.configChangeTimer&&clearTimeout(this.configChangeTimer),this.configChangeTimer=setTimeout(()=>{this.$nextTick(()=>{this.$emit("config-changed",this.tableData)})},100)},deep:!0}},methods:{handleValuesChange(e){if(!e||0===e.length)return this.allVariables=[],this.selectedVariables=[],void 0;const t=[];if(e.length>0){const i=e[0];"object"==typeof i&&null!==i&&t.push(...Object.keys(i))}this.allVariables=t.map(e=>({field:e,checked:!1})),this.selectedVariables=[]},handleLeftSearch(){},handleRightSearch(){},handleLeftCheckChange(){},handleRightCheckChange(){},handleLeftSelectAll(e){this.filteredLeftVariables.forEach(t=>{t.checked=e})},handleRightSelectAll(e){this.filteredRightVariables.forEach(t=>{t.checked=e})},moveToRight(){const e=this.allVariables.filter(e=>e.checked);0!==e.length&&(e.forEach(e=>{e.checked=!1,this.selectedVariables.find(t=>t.field===e.field)||this.selectedVariables.push({field:e.field,checked:!1})}),this.allVariables=this.allVariables.filter(t=>!e.some(e=>e.field===t.field)))},moveToLeft(){const e=this.selectedVariables.filter(e=>e.checked);0!==e.length&&(e.forEach(e=>{e.checked=!1,this.allVariables.find(t=>t.field===e.field)||this.allVariables.push({field:e.field,checked:!1})}),this.selectedVariables=this.selectedVariables.filter(t=>!e.some(e=>e.field===t.field)))},handleClose(){this.dialogVisible=!1},getPlaceholder(e){return e.required?"必选":e.nullable?"请选择":"必选"},getAvailableOptions(e,t=!1){const i=this.selectedVariables.map(e=>e.field),a=this.configValues[e],l=t?Array.isArray(a)?a:[]:a?[a]:[],s=[];return Object.keys(this.configValues).forEach(t=>{if(t!==e&&this.configValues[t]){const e=this.configValues[t];Array.isArray(e)?s.push(...e):s.push(e)}}),i.map(e=>l.includes(e)?{label:e,value:e,disabled:!1}:{label:e,value:e,disabled:s.includes(e)})},handleConfigChange(e,t){this.$set(this.configValues,e,t);const i=this.flatMenuItems.find(t=>t.pathString===e);i&&i.multiple&&!Array.isArray(t)&&this.$set(this.configValues,e,t?[t]:[])},generateConfigFromMenus(){return this.flatMenuItems.forEach(e=>{e.pathString in this.configValues||(e.multiple?this.$set(this.configValues,e.pathString,[]):this.$set(this.configValues,e.pathString,""))}),{...this.configValues}},handleSave(){const e={config:this.generateConfigFromMenus(),selectedVariables:this.selectedVariables.map(e=>e.field)};this.$emit("save",e),this.dialogVisible=!1},$restoreConfig(e){if(!e||"object"!=typeof e)return;const t=new Set;Object.keys(e).forEach(i=>{const a=e[i];a&&a.values&&Array.isArray(a.values)&&a.values.forEach(e=>t.add(e))}),t.forEach(e=>{this.selectedVariables.find(t=>t.field===e)||this.selectedVariables.push({field:e,checked:!1})}),this.configValues={},Object.keys(e).forEach(t=>{const i=e[t];if(!i||!i.values||!Array.isArray(i.values)||0===i.values.length)return;const a=this.flatMenuItems.filter(e=>e.fieldName===t);if(0!==a.length)if(1===a.length){const e=a[0],t=e.pathString;e.multiple?this.$set(this.configValues,t,[...i.values]):this.$set(this.configValues,t,i.values[0])}else{const e=a.filter(e=>!e.multiple),t=a.filter(e=>e.multiple);if(t.length>0){const e=t[0];this.$set(this.configValues,e.pathString,[...i.values])}else e.length>0&&i.values.forEach((t,i)=>{if(i<e.length){const a=e[i];this.$set(this.configValues,a.pathString,t)}})}})},$getValues(){const e={};return Object.keys(this.configValues).forEach(t=>{const i=this.configValues[t];if(!i||Array.isArray(i)&&0===i.length)return;const a=this.flatMenuItems.find(e=>e.pathString===t);if(!a||!a.fieldName)return;const l=a.fieldName;e[l]||(e[l]={values:[]}),(Array.isArray(i)?i:[i]).forEach(t=>{e[l].values.includes(t)||e[l].values.push(t)})}),e},$getTableData(){return this.generateConfigFromMenus(),void 0,this.tableData}},install(e){e.component(d.name,d)}};l(".long-excel-viewer :deep(.el-dialog__body){padding:0 10px 10px}");var c={render(){var e=this,t=e.$createElement,i=e.i.t||t;return i("div",{staticClass:"long-excel-viewer"},[i("el-dialog",{attrs:{visible:e.dialogVisible,title:"示例文件",width:"1000px"},on:{"update:visible"(t){e.dialogVisible=t},close:e.handleClose},scopedSlots:e.k([{key:"title",fn:()=>[i("div",{staticStyle:{display:"flex","justify-content":"space-between"}},[i("div",{staticStyle:{display:"flex","align-items":"center",gap:"10px"}},[i("img",{attrs:{src:e.searchIcon}}),e.u(" "),i("div",{staticStyle:{"font-weight":"bold"}},[e.u("文件预览")])]),e.u(" "),i("div",{staticStyle:{"margin-right":"30px"}},[i("el-button",{attrs:{type:"primary",icon:"el-icon-download",size:"mini",disabled:!e.tableData.length||e.downloading,loading:e.downloading},on:{click:e.downloadExcel}},[e.u("下载")])],1)])],proxy:!0}])},[e.u(" "),e.tableData.length?i("el-table",{staticStyle:{width:"100%","margin-top":"20px"},attrs:{data:e.tableData,border:"",height:"500px"}},e.p(e.columns,function(e){return i("el-table-column",{key:e,attrs:{prop:e,label:e}})}),1):e.v(),e.u(" "),e.pagination.total>0?i("el-pagination",{staticStyle:{"margin-top":"20px","text-align":"center"},attrs:{"current-page":e.pagination.current,"page-sizes":[10,20,50,100],"page-size":e.pagination.pageSize,layout:"total, sizes, prev, pager, next, jumper",total:e.pagination.total},on:{"size-change":e.handleSizeChange,"current-change":e.handleCurrentChange}}):e.v()],1)],1)},staticRenderFns:[],name:"LongExcelViewer",props:{visible:{type:Boolean,default:!1},url:{type:String,default:""}},data(){return{searchIcon:o.default,tableData:[],columns:[],rawWorkbook:null,downloading:!1,VUE_APP_BASE_API:process.env.VUE_APP_BASE_API,pagination:{total:0,current:1,pageSize:20},queryParams:{fileId:"",pageNum:1,pageSize:20}}},computed:{dialogVisible:{get(){return this.visible},set(e){this.$emit("update:visible",e)}}},watch:{visible(e){e&&this.url&&this.loadExcelFromUrl()},url(e){e&&this.visible&&this.loadExcelFromUrl()}},methods:{async loadExcelFromUrl(){if(!this.url)return;const e=this.url.split("/").pop();this.queryParams.fileId=e;try{const e=await this.$api.dataAnalysis.filePreview(this.queryParams);void 0,e&&e.data&&e.data.records&&Array.isArray(e.data.records)?(this.processTableData(e.data.records),this.pagination.total=e.data.total||0,this.pagination.current=e.data.current||1,this.pagination.pageSize=e.data.size||20):this.$message.error("数据格式错误")}catch(t){void 0,this.$message.error("加载Excel文件失败: "+t.message)}},processTableData(e){const t=e[0];t&&t.headers&&t.data&&(1==this.pagination.current&&(this.columns=t.headers||[]),this.tableData=t.data||[])},processWorkbook(e){this.rawWorkbook=e;const i=e.Sheets[e.SheetNames[0]],a=t.utils.sheet_to_json(i,{header:1});a.length&&(this.columns=a[0],this.tableData=a.slice(1).map(e=>{const t={};return this.columns.forEach((i,a)=>{t[i]=e[a]}),t}))},handleFileChange(e){const i=new FileReader;return i.onload=e=>{const i=new Uint8Array(e.target.result),a=t.read(i,{type:"array"});this.processWorkbook(a)},i.readAsArrayBuffer(e.raw),!1},downloadExcel(){if(!this.url||this.downloading)return;this.downloading=!0;const e=require("axios").create({baseURL:this.VUE_APP_BASE_API,timeout:3e4,responseType:"blob"});e.interceptors.request.use(e=>{const t=this.$store.getters.token||localStorage.getItem("token");return t&&(e.headers.Authorization="Bearer "+t),e}),e.interceptors.response.use(e=>("blob"===e.config.responseType,e),e=>Promise.reject(e));const t=this.url.split("/").pop();e.get("/file/upload/"+t).then(e=>{const t=e.data;let a="示例文件.xlsx";const l=e.headers["content-disposition"];if(l){const e=l.match(/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/);if(e&&e[1]){a=e[1].replace(/['"]/g,"");try{a=decodeURIComponent(a)}catch(s){void 0}}}i.saveAs(t,a),this.$message.success("下载成功")}).catch(e=>{void 0,this.$message.error("下载失败,请重试")}).finally(()=>{this.downloading=!1})},closeDialog(){this.dialogVisible=!1},handleClose(){this.closeDialog(),this.tableData=[],this.columns=[],this.rawWorkbook=null},handleSizeChange(e){this.queryParams.pageSize=e,this.queryParams.pageNum=1,this.loadExcelFromUrl()},handleCurrentChange(e){this.queryParams.pageNum=e,this.loadExcelFromUrl()}},install(e){e.component(c.name,c)}};l("");var p={render(){var e=this,t=e.$createElement,i=e.i.t||t;return i("div",[i("el-button",{attrs:{size:"small",type:"primary",icon:"el-icon-setting"},on:{click:e.onAdjust}},[e.u("\n 调整变量\n ")]),e.u(" "),i("long-variable-viewer",{ref:"variableViewerRef",attrs:{visible:e.modalVisiable,values:e.values,menus:e.menus},on:{"update:visible"(t){e.modalVisiable=t},"config-changed":e.handleConfigChanged}})],1)},staticRenderFns:[],name:"LongVariableViewerButton",props:{values:{type:Array,default:()=>[]},menus:{type:Array,default:()=>[]}},data(){return{modalVisiable:!1,tableDataCache:[],updateTimer:null,valuesUpdateTimer:null,menusUpdateTimer:null,updatingTableData:!1}},mounted(){void 0,this.$nextTick(()=>{this.updateTableData()})},beforeDestroy(){this.updateTimer&&clearInterval(this.updateTimer),this.valuesUpdateTimer&&clearTimeout(this.valuesUpdateTimer),this.menusUpdateTimer&&clearTimeout(this.menusUpdateTimer)},watch:{modalVisiable(e){e||(this.$emit("update:columns",this.$refs.variableViewerRef.$getValues()),this.$nextTick(()=>{this.updateTableData()}))},values:{handler(){this.valuesUpdateTimer&&clearTimeout(this.valuesUpdateTimer),this.valuesUpdateTimer=setTimeout(()=>{this.updateTableData()},300)},deep:!0},menus:{handler(){this.menusUpdateTimer&&clearTimeout(this.menusUpdateTimer),this.menusUpdateTimer=setTimeout(()=>{this.updateTableData()},300)},deep:!0}},computed:{tableData(){return this.tableDataCache}},methods:{onAdjust(){this.modalVisiable=!0},$getValues(){return this.$refs.variableViewerRef.$getValues()},$triggerUpdate(){this.$emit("update:columns",this.$getValues()),this.$nextTick(()=>{this.updateTableData()})},$restoreConfig(e){this.$refs.variableViewerRef&&this.$refs.variableViewerRef.$restoreConfig&&(this.$refs.variableViewerRef.$restoreConfig(e),this.$nextTick(()=>{this.updateTableData()}))},handleConfigChanged(e){Array.isArray(e)&&(this.tableDataCache=e,this.$emit("table-data-updated",e))},updateTableData(){if(!this.updatingTableData)if(this.updatingTableData=!0,this.$refs.variableViewerRef&&this.$refs.variableViewerRef.$getTableData){const e=this.$refs.variableViewerRef.$getTableData()||[],t=JSON.parse(JSON.stringify(e)),i=JSON.parse(JSON.stringify(this.tableDataCache));JSON.stringify(t)!==JSON.stringify(i)?(this.tableDataCache=e,this.$nextTick(()=>{this.$emit("table-data-updated",e),this.updatingTableData=!1})):this.updatingTableData=!1}else this.tableDataCache.length>0&&(this.tableDataCache=[]),this.updatingTableData=!1}},install(e){e.component(p.name,p)}};l("");var h={render(){var e=this,t=e.$createElement,i=e.i.t||t;return i("div",{staticStyle:{display:"inline-block","margin-left":"4px"},on:{click(e){e.stopPropagation()}}},[i("el-button",{attrs:{type:"text",size:"small",icon:"el-icon-document"},on:{click:e.onExample}},[e.u("示例文件")]),e.u(" "),i("long-excel-viewer",{attrs:{visible:e.modalVisiable,url:e.url},on:{"update:visible"(t){e.modalVisiable=t}}})],1)},staticRenderFns:[],name:"LongExcelViewerButton",props:{url:{type:String,default:""}},data(){return{modalVisiable:!1}},methods:{onExample(e){e.stopPropagation(),e.preventDefault(),this.modalVisiable=!0}},install(e){e.component(h.name,h)}};l(".long-uploader-wrapper .el-form-item{margin-bottom:0}.long-uploader-wrapper :deep(.el-upload) .el-upload-dragger{height:130px!important}.long-uploader-wrapper :deep(.el-upload) .el-upload-dragger .el-icon-upload{margin:8px 0}.variable-config-section{background-color:#f8f9fa;border:1px solid #e9ecef;border-radius:4px;margin-top:16px}.config-header{align-items:center;background-color:#e8e9f2;border-bottom:1px solid #e9ecef;cursor:pointer;display:flex;justify-content:space-between;padding:0 12px;transition:background-color .2s}.config-header:hover{background-color:#f0f0f0}.config-title{color:#303133;font-size:14px;margin:0}.collapse-arrow{color:#909399;font-size:12px;transition:transform .3s ease}.collapse-arrow.is-collapsed{transform:rotate(-90deg)}.config-content{padding:12px}.variable-config-section .el-table{font-size:12px}.variable-config-section .el-table th{background-color:#f5f7fa;color:#606266;font-weight:600}.variable-config-section .el-table td{padding:8px 0}.no-data{color:#909399;font-size:14px;padding:20px;text-align:center}");var u={render(){var e=this,t=e.$createElement,i=e.i.t||t;return i("div",{staticClass:"long-uploader-wrapper"},[i("div",[i("div",{staticStyle:{float:"right","margin-top":"-80px"}},[e.options.example&&e.options.example.value?i("long-excel-viewer-button",{attrs:{url:e.options.example.value}}):e.v()],1),e.u(" "),i("div",{staticStyle:{display:"flex","align-items":"center","justify-content":"space-between","margin-bottom":"12px"}},[i("div",{staticStyle:{display:"flex","align-items":"center",gap:"12px",position:"relative"}},[i("el-upload",{attrs:{action:e.uploadUrl,headers:{Authorization:"Bearer "+e.token},"on-preview":e.handlePreview,"on-remove":e.handleRemove,"before-remove":e.beforeRemove,"on-change":e.handleChange,"before-upload":e.beforeUpload,accept:e.fileType,drag:"","on-exceed":e.handleExceed,"file-list":e.fileList}},[i("i",{staticClass:"el-icon-upload",staticStyle:{color:"#6C1537"}}),e.u(" "),i("div",{staticClass:"el-upload__text"},[i("div",{staticStyle:{"line-height":"18px"}},[e.u("将文件拖到此处,或"),i("em",[e.u("点击上传")])]),e.u(" "),i("div",{staticStyle:{"line-height":"18px"}},[e.u("\n 支持上传"),i("em",[e.u("xlsx")]),e.u("、"),i("em",[e.u("xls")]),e.u("、"),i("em",[e.u("csv")])])])])],1)]),e.u(" "),e.fileList.length>0?i("div",{staticStyle:{"margin-top":"-20px"}},[e.C(0),e.u(" "),i("div",[e.p(e.fileList,function(t){return i("el-tag",{key:t.uid,staticStyle:{"margin-right":"8px",cursor:"pointer"},attrs:{closable:""},on:{close:i=>e.handleRemove(t),click:i=>e.handleFileClick(t)}},[e.u("\n "+e.m(t.name)+"\n ")])}),e.u(" "),e.fileList.length>0&&e.options.variable&&e.options.variable.enable?i("div",{staticStyle:{display:"flex","align-items":"center"}},[i("span",{staticStyle:{color:"#f56c6c","margin-right":"5px"}},[e.u("*")]),e.u(" "),i("long-variable-viewer-button",{ref:"variableViewerRef",attrs:{values:e.fileData,menus:e.options.variable.menus},on:{"update:columns":e.handleUpdateColumns,"table-data-updated":e.handleTableDataUpdated}})],1):e.v()],2)]):e.v()]),e.u(" "),e.fileList.length>0&&e.options.variable&&e.options.variable.enable&&e.hasConfiguredVariables?i("div",{staticClass:"variable-config-section"},[i("div",{staticClass:"config-header",on:{click:e.toggleCollapse}},[i("span",{staticClass:"config-title"},[e.u("当前变量配置")]),e.u(" "),i("i",{staticClass:"el-icon-caret-bottom collapse-arrow",class:{"is-collapsed":e.isCollapsed}})]),e.u(" "),i("div",{directives:[{name:"show",rawName:"v-show",value:!e.isCollapsed,expression:"!isCollapsed"}],staticClass:"config-content"},[0===e.currentVariableValues.length?i("div",{staticClass:"no-data"},[e.u("\n 暂无数据\n ")]):i("el-table",{staticStyle:{width:"100%"},attrs:{data:e.currentVariableValues,size:"mini","max-height":"300",border:""}},[i("el-table-column",{attrs:{prop:"field",label:"字段名","show-overflow-tooltip":""}}),e.u(" "),i("el-table-column",{attrs:{prop:"fullPath",label:"属性","show-overflow-tooltip":""}})],1),e.u(" "),i("div",{staticClass:"debug-info",staticStyle:{"margin-top":"8px","font-size":"12px",color:"#999"}},[e.u("\n 数据条数: "+e.m(e.currentVariableValues.length)+"\n ")])],1)]):e.v(),e.u(" "),i("long-excel-viewer",{attrs:{visible:e.previewVisible,url:e.previewUrl},on:{"update:visible"(t){e.previewVisible=t}}})],1)},staticRenderFns:[function(){var e=this,t=e.$createElement,i=e.i.t||t;return i("div",{staticStyle:{"font-size":"12px",color:"#999","line-height":"20px"}},[i("i",{staticClass:"el-icon-info",staticStyle:{"margin-right":"5px"}}),e.u(" "),i("span",[e.u("点击文件名称可预览文件")])])}],name:"LongUploader",props:{options:{type:Object,default:()=>({variable:{enable:!1,values:[],menus:[]},example:{value:""},file:{id:"",name:""}})},value:{type:Object,default:()=>({fileId:"",columns:[],fileName:""})},fileId:{type:String,default:""},limit:{type:Number,default:1},fileSize:{type:Number,default:3},fileType:{type:String,default:".xlsx,.xls,.csv"}},data(){return{uploadUrl:process.env.VUE_APP_BASE_API+"/file/upload",fileList:[],token:"",fileData:[],fileToken:"",variableViewerRef:null,isCollapsed:!0,hasTriggerUpdate:!1,previewVisible:!1,previewUrl:"",tableDataCache:[]}},computed:{currentVariableValues(){return this.tableDataCache.map(e=>({field:e.field||"",fullPath:e.fullPath||"",varType:e.varType||"",attr:e.attr||""}))},hasConfiguredVariables(){return this.currentVariableValues.length>0}},created(){this.token=localStorage.getItem("token")},watch:{fileId:{handler(e){this.fileToken=e},immediate:!0,deep:!0},value:{handler(e,t){void 0,!e||!e.fileId||t&&t.fileId===e.fileId||(this.fileToken=e.fileId,this.downloadFile(e.fileId,e.columns||{})),!e||!e.fileName||t&&t.fileName===e.fileName||(this.fileList=[{name:e.fileName,uid:e.fileId}])},immediate:!0,deep:!0}},methods:{downloadFile(e,t={}){this.$api.dataAnalysis.filePreview({fileId:e}).then(e=>{if(e&&e.data&&e.data.records&&e.data.records.length>0){const i=e.data.records[0].headers||[];this.$emit("update:headers",i);const a=this.options.variable.menus||[],l={};i.forEach(e=>{l[e]={field:e,varType:"",attr:""}}),t&&"object"==typeof t&&Object.keys(t).forEach(e=>{const i=t[e];if(void 0,i&&i.values&&Array.isArray(i.values)){const t=a.find(t=>t.fieldName===e);void 0,t&&i.values.forEach(i=>{l[i]&&(l[i]={field:i,varType:t.label||e,attr:t.label||e})})}}),this.fileData=[{...l}],this.$nextTick(()=>{if(this.$refs.variableViewerRef&&t&&Object.keys(t).length>0&&"function"==typeof this.$refs.variableViewerRef.$restoreConfig&&(this.$refs.variableViewerRef.$restoreConfig(t),this.$nextTick(()=>{this.$refs.variableViewerRef&&"function"==typeof this.$refs.variableViewerRef.updateTableData&&this.$refs.variableViewerRef.updateTableData()})),this.$route.query.id){if(this.hasTriggerUpdate)return;"function"==typeof this.$refs.variableViewerRef.$triggerUpdate&&this.$refs.variableViewerRef.$triggerUpdate(),this.hasTriggerUpdate=!0}})}}).catch(e=>{this.$message.error(e.message||"数据文件内容不匹配,请重新上传")}).finally(()=>{this.loading=!1})},handleColumns(e=[]){const t=this.options.variable.menus||[];void 0,0!=t.length&&e.forEach(e=>{void 0;const i=t.find(t=>t.fieldName==e.fieldName);void 0,e.varType=i.label,e.attr=i.attr})},handleTableDataUpdated(e){Array.isArray(e)&&(this.tableDataCache=e)},handleUpdateColumns(e){void 0,this.$emit("update:columns",e)},beforeUpload(e){if(void 0,e.size>1048576*this.fileSize)return this.$message.error(`上传文件大小不能超过 ${this.fileSize} MB!`),!1;const t=e.type,i=e.name.toLowerCase();return!!(["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.ms-excel","text/csv"].includes(t)||i.endsWith(".xlsx")||i.endsWith(".xls")||i.endsWith(".csv"))||(this.$message.error("只支持上传 xlsx、xls、csv 格式的文件!"),!1)},handleChange(e,t){if(t.length>1?this.fileList=[t[t.length-1]]:this.fileList=t.filter(e=>void 0!==e.raw),"success"===e.status){const t=e.response;t&&200===t.code&&(this.fileToken=t.data.id,this.$emit("update:fileId",this.fileToken),this.loadFromUrl(this.fileToken))}},loadFromUrl(e){this.$api.dataAnalysis.filePreview({fileId:e}).then(e=>{if(e&&e.data&&e.data.records&&e.data.records.length>0){const t=(e.data.records[0]||{data:[],headers:[]}).headers||[];if(t.length>0){this.$emit("update:headers",t);const e={};t.forEach(t=>{e[t]={field:t,varType:"",attr:""}}),this.fileData=[{...e}]}else this.$emit("update:headers",[]),this.fileData=[]}})},handleRemove(e){this.fileList=this.fileList.filter(t=>t.uid!==e.uid),this.fileToken="",this.fileData=[],this.$emit("update:fileId",""),this.$emit("update:headers",[])},onAdjust(){this.$emit("adjust")},handleRemove1(e,t){void 0},handlePreview(e){void 0},handleExceed(e,t){this.$message.warning(`上传文件数量不能超过 ${this.limit} 个!`),t.length>this.limit&&(this.fileList=t.slice(-this.limit))},beforeRemove(){return!0},toggleCollapse(){this.isCollapsed=!this.isCollapsed},handleFileClick(){event.stopPropagation(),this.fileToken?(this.previewUrl=`${process.env.VUE_APP_BASE_API}/file/preview/${this.fileToken}`,this.previewVisible=!0):this.$message.warning("文件ID不存在,无法预览")}},install(e){e.component(u.name,u)}};l(".long-radio-wrapper{display:flex;flex-wrap:wrap}.long-radio-wrapper ::v-deep .el-radio{line-height:24px;margin-bottom:0}.long-radio-wrapper ::v-deep .el-radio__label{display:inline-block;vertical-align:middle;white-space:normal;word-break:break-all}.long-radio-item{margin:4px 12px 4px 0;width:100px}");var f={render(){var e=this,t=e.$createElement,i=e.i.t||t;return i("el-radio-group",e.l(e.o({staticClass:"long-radio-wrapper"},"el-radio-group",e.$attrs,!1),e.$listeners),e.p(e.options,function(t,a){return i("el-radio",{key:a,staticClass:"long-radio-item",attrs:{label:t[e.valueKey],disabled:t[e.disabledOption]}},[e.u("\n "+e.m(t[e.labelKey])+"\n ")])}),1)},staticRenderFns:[],name:"LongRadio",props:{dataList:{type:Array,default:()=>[]},disabledOption:{type:[Boolean,Number],default:!1},valueKey:{type:[String,Number],default:"value"},labelKey:{type:[String,Number],default:"label"},mode:{type:String,default:"local"},dict:{type:String,default:""},url:{type:String,default:""},requestParams:{type:Object,default(){}},placeholder:{type:String,default:"请选择"}},data(){return{options:[]}},watch:{dataList:{deep:!0,immediate:!0,handler(e){"local"===this.mode&&(this.options=e)}},dict:{deep:!0,handler(e){this.init()}}},created(){this.init()},methods:{init(){"remote"===this.mode&&this.dict&&this.getDicts(this.dict).then(e=>{this.options=(e.data||[]).map(e=>({[this.valueKey]:e.dictCode,[this.labelKey]:e.dictLabel}))})}},install(e){e.component(f.name,f)}};l(".long-group{background-color:#f8f8f8;box-sizing:border-box;height:100%;padding:10px;width:100%}.long-group .group-header{color:#333;font-size:14px;font-weight:700}");var g={render(){var e=this,t=e.$createElement,i=e.i.t||t;return i("div",{staticClass:"long-group"},[i("div",{staticClass:"group-header"},[e.u(e.m(e.label))]),e.u(" "),e.h("default")],2)},staticRenderFns:[],name:"LongGroup",props:{label:{type:String,default:""}},install(e){e.component(g.name,g)}};l(".long-color-picker{width:200px}.long-color-picker .el-color-picker__trigger{width:100%}.long-color-picker .el-color-picker__trigger .el-color-picker__icon{left:unset!important;right:5px!important;width:unset!important}");var b={render(){var e=this,t=e.$createElement;return(e.i.t||t)("el-color-picker",e.l(e.o({staticClass:"long-color-picker"},"el-color-picker",e.$attrs,!1),e.$listeners))},staticRenderFns:[],name:"LongColorPicker",install(e){e.component(b.name,b)}};l("");var m={render(){var e=this,t=e.$createElement;return(e.i.t||t)("el-input-number",e.l(e.o({staticClass:"long-number-input",attrs:{"controls-position":"right",step:e.stepValue,value:e.value,max:e.maxValue,min:e.minValue},on:{input:t=>e.$emit("input",t)}},"el-input-number",e.$attrs,!1),e.$listeners))},staticRenderFns:[],name:"LongNumberInput",props:{value:{type:[String,Number],default:0},placeholder:{type:String,default:"请输入"},max:{type:[Number,String],default:""},min:{type:[Number,String],default:""},step:{type:[Number,String],default:1}},data(){return{maxValue:""===this.max?Number.MAX_SAFE_INTEGER:+this.max,minValue:""===this.min?Number.MIN_SAFE_INTEGER:+this.min,stepValue:+this.step}},watch:{max:{handler(e){this.maxValue=""===e?Number.MAX_SAFE_INTEGER:+e},immediate:!0},min:{handler(e){this.minValue=""===e?Number.MIN_SAFE_INTEGER:+e},immediate:!0},step:{handler(e){this.stepValue=+e},immediate:!0}},install(e){e.component(m.name,m)}};l(".long-checkbox-wrapper{display:flex;flex-wrap:wrap}.long-checkbox-wrapper ::v-deep .el-checkbox{line-height:24px;margin-bottom:0}.long-checkbox-item{margin:1px 6px 1px 0;min-width:50px}");var x={render(){var e=this,t=e.$createElement,i=e.i.t||t;return i("el-checkbox-group",e.l(e.o({staticClass:"long-checkbox-wrapper",attrs:{value:e.value},on:{change:e.handleInput}},"el-checkbox-group",e.$attrs,!1),e.$listeners),e.p(e.options,function(t,a){return i("el-checkbox",{key:a,staticClass:"long-checkbox-item",attrs:{label:t[e.valueKey],disabled:e.getDisabled(t)}},[e.u("\n "+e.m(t[e.labelKey])+"\n ")])}),1)},staticRenderFns:[],name:"LongCheckBox",props:{value:{type:Array,default:()=>[]},dataList:{type:Array,default:()=>[]},disabledOption:{type:[String,Boolean,Number],default:!1},valueKey:{type:[String,Number],default:"value"},labelKey:{type:[String,Number],default:"label"},mode:{type:String,default:"local"},dict:{type:String,default:""},url:{type:String,default:""},requestParams:{type:Object,default(){}},placeholder:{type:String,default:"请选择"}},data(){return{options:[]}},watch:{dataList:{deep:!0,immediate:!0,handler(e){"local"===this.mode&&(this.options=e)}},dict:{deep:!0,handler(e){this.init()}}},created(){this.init()},methods:{init(){"remote"===this.mode&&this.dict&&this.getDicts(this.dict).then(e=>{this.options=(e.data||[]).map(e=>({[this.valueKey]:e.dictCode,[this.labelKey]:e.dictLabel}))})},handleInput(e){this.$emit("input",e),this.$emit("change",e)},getDisabled(e){return"string"==typeof this.disabledOption?e[this.disabledOption]||!1:"boolean"==typeof this.disabledOption?this.disabledOption:"number"==typeof this.disabledOption&&e[this.disabledOption]||!1}},install(e){e.component(x.name,x)}},v=[r,n,d,c,p,h,u,f,g,b,m,x],y=function(e){y.installed||(y.installed=!0,["ElInput","ElSelect","ElOption","ElCheckbox","ElCheckboxGroup","ElRadio","ElRadioGroup","ElButton","ElDialog","ElTable","ElTableColumn","ElUpload","ElTag","ElPagination","ElInputNumber","ElColorPicker","ElForm","ElFormItem","ElIcon"].forEach(function(t){var i=e.options.components[t];if(i){var a=s(t);a&&a!==t&&(e.options.components[a]||e.component(a,i))}}),v.forEach(function(t){if(t){var i=t.name||t.options&&t.options.name;if(i){e.component(i,t);var a=s(i);a&&a!==i&&e.component(a,t)}}}))};"undefined"!=typeof window&&window.Vue&&y(window.Vue);var w={version:"1.0.0",install:y,Input:r,Select:n,VariableViewer:d,ExcelViewer:c,VariableViewerButton:p,ExcelViewerButton:h,Uploader:u,Radio:f,Group:g,ColorPicker:b,NumberInput:m,CheckBox:x};e.CheckBox=x,e.ColorPicker=b,e.ExcelViewer=c,e.ExcelViewerButton=h,e.Group=g,e.Input=r,e.NumberInput=m,e.Radio=f,e.Select=n,e.Uploader=u,e.VariableViewer=d,e.VariableViewerButton=p,e.default=w,Object.defineProperty(e,"S",{value:!0})},void("object"==typeof exports&&"undefined"!=typeof module?t(exports,require("xlsx"),require("file-saver"),require("@/assets/icon-search.png")):"function"==typeof define&&define.amd?define(["exports","xlsx","file-saver","@/assets/icon-search.png"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).WiserComponents={},e.xlsx,e.fileSaver,e.searchIcon));
|
|
1
|
+
var e,t;e=this,t=function(e,t,i,a){"use strict";function l(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var a=document.head||document.getElementsByTagName("head")[0],l=document.createElement("style");l.type="text/css","top"===i&&a.firstChild?a.insertBefore(l,a.firstChild):a.appendChild(l),l.styleSheet?l.styleSheet.cssText=e:l.appendChild(document.createTextNode(e))}}function s(e){return e?e.replace(/([A-Z])/g,"-$1").toLowerCase().replace(/^-/,""):e}var o=function(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}(a);l(".long-input-wrapper{background-color:#fff;border:1px solid #e0e0e0;border-radius:4px;padding:8px}.intTxt{width:80%}");var r={render(){var e=this,t=e.$createElement;return(e.i.t||t)("el-input",e.l(e.o({staticClass:"intTxt",attrs:{"show-word-limit":e.showWordLimit,placeholder:e.placeholder,"auto-complete":"new-password",disabled:e.disabled},on:{input:t=>e.$emit("input",t)}},"el-input",e.$attrs,!1),e.$listeners),[e.p(Object.keys(this.$slots),function(t){return e.h(t,null,{slot:t})})],2)},staticRenderFns:[],name:"LongInput",props:{showWordLimit:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},placeholder:{type:String,default:"请输入"}},install(e){e.component(r.name,r)}};l("");var n={render(){var e=this,t=e.$createElement,i=e.i.t||t;return i("el-select",e.l(e.o({attrs:{value:e.value,placeholder:e.placeholder}},"el-select",e.$attrs,!1),e.$listeners),[e.h("unshift"),e.u(" "),e.h("default",function(){return e.p(e.options,function(t,a){return i("el-option",{key:a,attrs:{value:t[e.valueKey],label:t[e.labelKey],disabled:t[e.disabledOption]}})})},{slot:"default"}),e.u(" "),e.h("prefix",null,{slot:"prefix"}),e.u(" "),e.h("empty",null,{slot:"empty"})],2)},staticRenderFns:[],name:"LongSelect",props:{value:{type:[String,Number],default:""},dataList:{type:Array,default:()=>[]},disabledOption:{type:[Boolean,Number],default:!1},valueKey:{type:[String,Number],default:"value"},labelKey:{type:[String,Number],default:"label"},mode:{type:String,default:"local"},dict:{type:String,default:""},url:{type:String,default:""},requestParams:{type:Object,default(){}},placeholder:{type:String,default:"请选择"}},data(){return{options:[]}},watch:{dataList:{deep:!0,immediate:!0,handler(e){"local"===this.mode&&(this.options=e)}},dict:{deep:!0,handler(e){this.init()}}},created(){this.init()},methods:{init(){"remote"===this.mode&&this.dict&&this.getDicts(this.dict).then(e=>{this.options=(e.data||[]).map(e=>({[this.valueKey]:e.dictCode,[this.labelKey]:e.dictLabel}))})}},install(e){e.component(n.name,n)}};l(".variable-config-dialog :deep(.el-dialog__body){padding:20px}.variable-config-dialog :deep(.el-dialog__header){padding:20px 20px 10px}.dialog-title{align-items:center;color:#303133;display:flex;font-size:16px;font-weight:700;gap:24px;padding:0 20px}.dialog-title .title-left{color:#303133;flex:1;min-width:500px}.dialog-title .title-separator{color:#dcdfe6;flex-shrink:0;font-weight:400}.dialog-title .title-right{color:#303133;flex:1;min-width:400px}.dialog-body{display:flex;gap:24px;min-height:500px}.left-section{flex:1;min-width:500px}.section-title{color:#303133;font-size:16px;font-weight:700;margin-bottom:16px}.variable-selector{align-items:flex-start;display:flex;gap:16px}.variable-panel{border:1px solid #dcdfe6;border-radius:4px;display:flex;flex:1;flex-direction:column;height:500px;overflow:hidden}.panel-header{align-items:center;background:#f5f7fa;border-bottom:1px solid #dcdfe6;display:flex;justify-content:space-between;padding:12px 16px}.select-all-checkbox :deep(.el-checkbox__label){padding-left:8px}.panel-title{color:#303133;font-weight:500}.panel-count{color:#909399;font-size:12px}.panel-search{border-bottom:1px solid #dcdfe6;padding:12px}.panel-list{flex:1;overflow-y:auto;padding:8px}.variable-item{border-radius:4px;cursor:pointer;padding:8px 12px;transition:background-color .2s}.variable-item:hover{background-color:#f5f7fa}.variable-item :deep(.el-checkbox){width:100%}.variable-item :deep(.el-checkbox__label){width:100%}.arrow-buttons{display:flex;flex-direction:column;gap:12px;justify-content:center;padding-top:100px}.arrow-buttons .el-button{margin-left:0!important}.right-section{display:flex;flex:1;flex-direction:column;min-width:400px;overflow:hidden}.config-desc{color:#909399;flex-shrink:0;font-size:13px;line-height:1.5;margin-bottom:24px}.config-group{margin-bottom:32px}.config-group:last-child{margin-bottom:0}.config-label{color:#303133;font-size:14px;font-weight:500;margin-bottom:12px}.config-options{display:flex;flex:1;flex-direction:column;gap:16px;margin-top:16px;overflow-x:hidden;overflow-y:auto;padding-right:8px}.config-options::-webkit-scrollbar{width:6px}.config-options::-webkit-scrollbar-track{background:#f1f1f1;border-radius:3px}.config-options::-webkit-scrollbar-thumb{background:#c1c1c1;border-radius:3px}.config-options::-webkit-scrollbar-thumb:hover{background:#a8a8a8}.config-option-row{align-items:center;display:flex;gap:12px;margin-bottom:8px}.config-option-row.is-parent .option-label{color:#303133;font-weight:500}.config-option-row.is-leaf .option-label{color:#606266}.option-label{color:#606266;flex:1;font-size:13px;min-width:0;white-space:normal;word-break:break-all}.option-label.required{color:#303133;font-weight:500}.option-label .required-mark{color:#f56c6c;margin-left:2px}.config-select{flex-shrink:0;width:350px}.non-leaf-label{color:#909399;font-size:13px;font-style:italic}.disabled-option{cursor:not-allowed!important}.disabled-option,.disabled-text{color:#c0c4cc!important}:deep(.el-select-dropdown__item.is-disabled){color:#c0c4cc!important;cursor:not-allowed!important}:deep(.el-select-dropdown__item.is-disabled) span{color:#c0c4cc!important}.checkbox-list{border:1px solid #dcdfe6;border-radius:4px;display:flex;flex:1;flex-direction:column;gap:8px;max-height:200px;overflow-y:auto;padding:8px}.dialog-footer{text-align:right}");var d={render(){var e=this,t=e.$createElement,i=e.i.t||t;return i("div",[i("el-dialog",{staticClass:"variable-config-dialog",staticStyle:{"max-height":"90vh"},attrs:{visible:e.dialogVisible,width:"1200px"},on:{"update:visible"(t){e.dialogVisible=t},close:e.handleClose}},[i("div",{staticClass:"dialog-title",attrs:{slot:"title"},slot:"title"},[i("span",{staticClass:"title-left"},[e.u("选择分析变量")]),e.u(" "),i("span",{staticClass:"title-separator"},[e.u("|")]),e.u(" "),i("span",{staticClass:"title-right"},[e.u("配置变量")])]),e.u(" "),i("div",{staticClass:"dialog-body"},[i("div",{staticClass:"left-section"},[i("div",{staticClass:"variable-selector"},[i("div",{staticClass:"variable-panel"},[i("div",{staticClass:"panel-header"},[i("el-checkbox",{staticClass:"select-all-checkbox",attrs:{indeterminate:e.leftIndeterminate},on:{change:e.handleLeftSelectAll},model:{value:e.leftSelectAll,callback(t){e.leftSelectAll=t},expression:"leftSelectAll"}},[i("span",{staticClass:"panel-title"},[e.u("全选")])]),e.u(" "),i("span",{staticClass:"panel-count"},[e.u(e.m(e.selectedAllCount)+"/"+e.m(e.allVariables.length))])],1),e.u(" "),i("div",{staticClass:"panel-search"},[i("el-input",{attrs:{placeholder:"请输入关键字","suffix-icon":"el-icon-search",size:"small"},on:{input:e.handleLeftSearch},model:{value:e.leftKeyword,callback(t){e.leftKeyword=t},expression:"leftKeyword"}})],1),e.u(" "),i("div",{staticClass:"panel-list"},e.p(e.filteredLeftVariables,function(t){return i("div",{key:t.field,staticClass:"variable-item"},[i("el-checkbox",{on:{change:i=>e.handleLeftCheckChange(t)},model:{value:t.checked,callback(i){e.$set(t,"checked",i)},expression:"item.checked"}},[e.u("\n "+e.m(t.field)+"\n ")])],1)}),0)]),e.u(" "),i("div",{staticClass:"arrow-buttons"},[i("el-button",{attrs:{type:"primary",icon:"el-icon-arrow-right",size:"small",disabled:!e.hasLeftSelected},on:{click:e.moveToRight}}),e.u(" "),i("el-button",{attrs:{type:"danger",icon:"el-icon-arrow-left",size:"small",disabled:!e.hasRightSelected},on:{click:e.moveToLeft}})],1),e.u(" "),i("div",{staticClass:"variable-panel"},[i("div",{staticClass:"panel-header"},[i("el-checkbox",{staticClass:"select-all-checkbox",attrs:{indeterminate:e.rightIndeterminate},on:{change:e.handleRightSelectAll},model:{value:e.rightSelectAll,callback(t){e.rightSelectAll=t},expression:"rightSelectAll"}},[i("span",{staticClass:"panel-title"},[e.u("已选")])]),e.u(" "),i("span",{staticClass:"panel-count"},[e.u(e.m(e.selectedRightCount)+"/"+e.m(e.selectedVariables.length))])],1),e.u(" "),i("div",{staticClass:"panel-search"},[i("el-input",{attrs:{placeholder:"请输入关键字","suffix-icon":"el-icon-search",size:"small"},on:{input:e.handleRightSearch},model:{value:e.rightKeyword,callback(t){e.rightKeyword=t},expression:"rightKeyword"}})],1),e.u(" "),i("div",{staticClass:"panel-list"},e.p(e.filteredRightVariables,function(t){return i("div",{key:t.field,staticClass:"variable-item"},[i("el-checkbox",{on:{change:i=>e.handleRightCheckChange(t)},model:{value:t.checked,callback(i){e.$set(t,"checked",i)},expression:"item.checked"}},[e.u("\n "+e.m(t.field)+"\n ")])],1)}),0)])])]),e.u(" "),i("div",{staticClass:"right-section"},[i("div",{staticClass:"config-desc"},[e.u("\n 数据文件中因变量的值,需赋予参考值,方便精准进行数据分析。\n ")]),e.u(" "),i("div",{staticClass:"config-options"},e.p(e.flatMenuItems,function(t){return i("div",{key:t.pathString,staticClass:"config-option-row"},[i("span",{staticClass:"option-label",class:{required:t.required}},[e.u("\n "+e.m(t.pathString)+"\n "),t.required?i("span",{staticClass:"required-mark"},[e.u("*")]):e.v()]),e.u(" "),i("el-select",{staticClass:"config-select",attrs:{placeholder:e.getPlaceholder(t),clearable:t.nullable,multiple:t.multiple},on:{change:i=>e.handleConfigChange(t.pathString,i)},model:{value:e.configValues[t.pathString],callback(i){e.$set(e.configValues,t.pathString,i)},expression:"configValues[menuItem.pathString]"}},e.p(e.getAvailableOptions(t.pathString,t.multiple),function(t){return i("el-option",{key:t.value,class:{"disabled-option":t.disabled},attrs:{label:t.label,value:t.value,disabled:t.disabled}},[i("span",{class:{"disabled-text":t.disabled}},[e.u(e.m(t.label))])])}),1)],1)}),0)])]),e.u(" "),i("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[i("el-button",{on:{click:e.handleClose}},[e.u("取消")]),e.u(" "),i("el-button",{staticStyle:{color:"#fff"},attrs:{type:"primary"},on:{click:e.handleSave}},[e.u("保存")])],1)])],1)},staticRenderFns:[],name:"LongVariableViewer",props:{visible:{type:Boolean,default:!1},values:{type:Array,default:()=>[]},menus:{type:Array,default:()=>[]}},data(){return{dialogVisible:!1,leftKeyword:"",rightKeyword:"",allVariables:[],selectedVariables:[],configValues:{},configChangeTimer:null}},computed:{filteredLeftVariables(){return this.leftKeyword?this.allVariables.filter(e=>e.field.toLowerCase().includes(this.leftKeyword.toLowerCase())):this.allVariables},filteredRightVariables(){return this.rightKeyword?this.selectedVariables.filter(e=>e.field.toLowerCase().includes(this.rightKeyword.toLowerCase())):this.selectedVariables},selectedAllCount(){return this.allVariables.filter(e=>e.checked).length},selectedRightCount(){return this.selectedVariables.filter(e=>e.checked).length},hasLeftSelected(){return this.allVariables.some(e=>e.checked)},hasRightSelected(){return this.selectedVariables.some(e=>e.checked)},leftSelectAll:{get(){const e=this.filteredLeftVariables;return 0!==e.length&&e.every(e=>e.checked)},set(){}},leftIndeterminate(){const e=this.filteredLeftVariables;if(0===e.length)return!1;const t=e.filter(e=>e.checked).length;return t>0&&t<e.length},rightSelectAll:{get(){const e=this.filteredRightVariables;return 0!==e.length&&e.every(e=>e.checked)},set(){}},rightIndeterminate(){const e=this.filteredRightVariables;if(0===e.length)return!1;const t=e.filter(e=>e.checked).length;return t>0&&t<e.length},flatMenuItems(){if(!this.menus||0===this.menus.length)return[];const e=[],t=(i,a=[])=>{const l=[...a,i.label];if(i.children&&0!==i.children.length)i.children&&i.children.length>0&&i.children.forEach(e=>{t(e,l)});else{const t=l.join("/");e.push({label:i.label,path:l,pathString:t,isLeaf:!0,id:i.id,fieldName:i.fieldName,required:i.required,nullable:i.nullable,multiple:i.multiple,originalMenu:i})}};return this.menus.forEach(e=>{t(e)}),e},tableData(){const e=[];return Object.keys(this.configValues).forEach(t=>{const i=this.configValues[t];if(!i||Array.isArray(i)&&0===i.length)return;const a=this.flatMenuItems.find(e=>e.pathString===t);if(!a)return;const l=a.pathString;(Array.isArray(i)?i:[i]).forEach(t=>{const i=t+"";i&&e.push({field:i,fullPath:l,varType:a.path&&a.path.length>0?a.path[0]:l,attr:a.path&&a.path.length>0?a.path[a.path.length-1]:""})})}),e}},watch:{visible:{handler(e){this.dialogVisible=e},immediate:!0},dialogVisible(e){this.$emit("update:visible",e)},values:{handler(e){this.handleValuesChange(e)},immediate:!0,deep:!0},selectedVariables:{handler(){const e=this.selectedVariables.map(e=>e.field),t={...this.configValues};let i=!1;Object.keys(t).forEach(a=>{const l=t[a];if(Array.isArray(l)){const s=l.filter(t=>e.includes(t));s.length!==l.length&&(t[a]=s,i=!0)}else l&&!e.includes(l)&&(t[a]="",i=!0)}),i&&(this.configValues=t)},deep:!0},configValues:{handler(){this.configChangeTimer&&clearTimeout(this.configChangeTimer),this.configChangeTimer=setTimeout(()=>{this.$nextTick(()=>{this.$emit("config-changed",this.tableData)})},100)},deep:!0}},methods:{handleValuesChange(e){if(!e||0===e.length)return this.allVariables=[],this.selectedVariables=[],void 0;const t=[];if(e.length>0){const i=e[0];"object"==typeof i&&null!==i&&t.push(...Object.keys(i))}this.allVariables=t.map(e=>({field:e,checked:!1})),this.selectedVariables=[]},handleLeftSearch(){},handleRightSearch(){},handleLeftCheckChange(){},handleRightCheckChange(){},handleLeftSelectAll(e){this.filteredLeftVariables.forEach(t=>{t.checked=e})},handleRightSelectAll(e){this.filteredRightVariables.forEach(t=>{t.checked=e})},moveToRight(){const e=this.allVariables.filter(e=>e.checked);0!==e.length&&(e.forEach(e=>{e.checked=!1,this.selectedVariables.find(t=>t.field===e.field)||this.selectedVariables.push({field:e.field,checked:!1})}),this.allVariables=this.allVariables.filter(t=>!e.some(e=>e.field===t.field)))},moveToLeft(){const e=this.selectedVariables.filter(e=>e.checked);0!==e.length&&(e.forEach(e=>{e.checked=!1,this.allVariables.find(t=>t.field===e.field)||this.allVariables.push({field:e.field,checked:!1})}),this.selectedVariables=this.selectedVariables.filter(t=>!e.some(e=>e.field===t.field)))},handleClose(){this.dialogVisible=!1},getPlaceholder(e){return e.required?"必选":e.nullable?"请选择":"必选"},getAvailableOptions(e,t=!1){const i=this.selectedVariables.map(e=>e.field),a=this.configValues[e],l=t?Array.isArray(a)?a:[]:a?[a]:[],s=[];return Object.keys(this.configValues).forEach(t=>{if(t!==e&&this.configValues[t]){const e=this.configValues[t];Array.isArray(e)?s.push(...e):s.push(e)}}),i.map(e=>l.includes(e)?{label:e,value:e,disabled:!1}:{label:e,value:e,disabled:s.includes(e)})},handleConfigChange(e,t){this.$set(this.configValues,e,t);const i=this.flatMenuItems.find(t=>t.pathString===e);i&&i.multiple&&!Array.isArray(t)&&this.$set(this.configValues,e,t?[t]:[])},generateConfigFromMenus(){return this.flatMenuItems.forEach(e=>{e.pathString in this.configValues||(e.multiple?this.$set(this.configValues,e.pathString,[]):this.$set(this.configValues,e.pathString,""))}),{...this.configValues}},handleSave(){const e={config:this.generateConfigFromMenus(),selectedVariables:this.selectedVariables.map(e=>e.field)};this.$emit("save",e),this.dialogVisible=!1},$restoreConfig(e){if(!e||"object"!=typeof e)return;const t=new Set;Object.keys(e).forEach(i=>{const a=e[i];a&&a.values&&Array.isArray(a.values)&&a.values.forEach(e=>t.add(e))}),t.forEach(e=>{this.selectedVariables.find(t=>t.field===e)||this.selectedVariables.push({field:e,checked:!1})}),this.configValues={},Object.keys(e).forEach(t=>{const i=e[t];if(!i||!i.values||!Array.isArray(i.values)||0===i.values.length)return;const a=this.flatMenuItems.filter(e=>e.fieldName===t);if(0!==a.length)if(1===a.length){const e=a[0],t=e.pathString;e.multiple?this.$set(this.configValues,t,[...i.values]):this.$set(this.configValues,t,i.values[0])}else{const e=a.filter(e=>!e.multiple),t=a.filter(e=>e.multiple);if(t.length>0){const e=t[0];this.$set(this.configValues,e.pathString,[...i.values])}else e.length>0&&i.values.forEach((t,i)=>{if(i<e.length){const a=e[i];this.$set(this.configValues,a.pathString,t)}})}})},$getValues(){const e={};return Object.keys(this.configValues).forEach(t=>{const i=this.configValues[t];if(!i||Array.isArray(i)&&0===i.length)return;const a=this.flatMenuItems.find(e=>e.pathString===t);if(!a||!a.fieldName)return;const l=a.fieldName;e[l]||(e[l]={values:[]}),(Array.isArray(i)?i:[i]).forEach(t=>{e[l].values.includes(t)||e[l].values.push(t)})}),e},$getTableData(){return this.generateConfigFromMenus(),void 0,this.tableData}},install(e){e.component(d.name,d)}};l(".long-excel-viewer :deep(.el-dialog__body){padding:0 10px 10px}");var c={render(){var e=this,t=e.$createElement,i=e.i.t||t;return i("div",{staticClass:"long-excel-viewer"},[i("el-dialog",{attrs:{visible:e.dialogVisible,title:"示例文件",width:"1000px"},on:{"update:visible"(t){e.dialogVisible=t},close:e.handleClose},scopedSlots:e.k([{key:"title",fn:()=>[i("div",{staticStyle:{display:"flex","justify-content":"space-between"}},[i("div",{staticStyle:{display:"flex","align-items":"center",gap:"10px"}},[i("img",{attrs:{src:e.searchIcon}}),e.u(" "),i("div",{staticStyle:{"font-weight":"bold"}},[e.u("文件预览")])]),e.u(" "),i("div",{staticStyle:{"margin-right":"30px"}},[i("el-button",{attrs:{type:"primary",icon:"el-icon-download",size:"mini",disabled:!e.tableData.length||e.downloading,loading:e.downloading},on:{click:e.downloadExcel}},[e.u("下载")])],1)])],proxy:!0}])},[e.u(" "),e.tableData.length?i("el-table",{staticStyle:{width:"100%","margin-top":"20px"},attrs:{data:e.tableData,border:"",height:"500px"}},e.p(e.columns,function(e){return i("el-table-column",{key:e,attrs:{prop:e,label:e}})}),1):e.v(),e.u(" "),e.pagination.total>0?i("el-pagination",{staticStyle:{"margin-top":"20px","text-align":"center"},attrs:{"current-page":e.pagination.current,"page-sizes":[10,20,50,100],"page-size":e.pagination.pageSize,layout:"total, sizes, prev, pager, next, jumper",total:e.pagination.total},on:{"size-change":e.handleSizeChange,"current-change":e.handleCurrentChange}}):e.v()],1)],1)},staticRenderFns:[],name:"LongExcelViewer",props:{visible:{type:Boolean,default:!1},url:{type:String,default:""}},data(){return{searchIcon:o.default,tableData:[],columns:[],rawWorkbook:null,downloading:!1,VUE_APP_BASE_API:process.env.VUE_APP_BASE_API,pagination:{total:0,current:1,pageSize:20},queryParams:{fileId:"",pageNum:1,pageSize:20}}},computed:{dialogVisible:{get(){return this.visible},set(e){this.$emit("update:visible",e)}}},watch:{visible(e){e&&this.url&&this.loadExcelFromUrl()},url(e){e&&this.visible&&this.loadExcelFromUrl()}},methods:{async loadExcelFromUrl(){if(!this.url)return;const e=this.url.split("/").pop();this.queryParams.fileId=e;try{const e=await this.$api.dataAnalysis.filePreview(this.queryParams);void 0,e&&e.data&&e.data.records&&Array.isArray(e.data.records)?(this.processTableData(e.data.records),this.pagination.total=e.data.total||0,this.pagination.current=e.data.current||1,this.pagination.pageSize=e.data.size||20):this.$message.error("数据格式错误")}catch(t){void 0,this.$message.error("加载Excel文件失败: "+t.message)}},processTableData(e){const t=e[0];t&&t.headers&&t.data&&(1==this.pagination.current&&(this.columns=t.headers||[]),this.tableData=t.data||[])},processWorkbook(e){this.rawWorkbook=e;const i=e.Sheets[e.SheetNames[0]],a=t.utils.sheet_to_json(i,{header:1});a.length&&(this.columns=a[0],this.tableData=a.slice(1).map(e=>{const t={};return this.columns.forEach((i,a)=>{t[i]=e[a]}),t}))},handleFileChange(e){const i=new FileReader;return i.onload=e=>{const i=new Uint8Array(e.target.result),a=t.read(i,{type:"array"});this.processWorkbook(a)},i.readAsArrayBuffer(e.raw),!1},downloadExcel(){if(!this.url||this.downloading)return;this.downloading=!0;const e=require("axios").create({baseURL:this.VUE_APP_BASE_API,timeout:3e4,responseType:"blob"});e.interceptors.request.use(e=>{const t=this.$store.getters.token||localStorage.getItem("token");return t&&(e.headers.Authorization="Bearer "+t),e}),e.interceptors.response.use(e=>("blob"===e.config.responseType,e),e=>Promise.reject(e));const t=this.url.split("/").pop();e.get("/file/upload/"+t).then(e=>{const t=e.data;let a="示例文件.xlsx";const l=e.headers["content-disposition"];if(l){const e=l.match(/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/);if(e&&e[1]){a=e[1].replace(/['"]/g,"");try{a=decodeURIComponent(a)}catch(s){void 0}}}i.saveAs(t,a),this.$message.success("下载成功")}).catch(e=>{void 0,this.$message.error("下载失败,请重试")}).finally(()=>{this.downloading=!1})},closeDialog(){this.dialogVisible=!1},handleClose(){this.closeDialog(),this.tableData=[],this.columns=[],this.rawWorkbook=null},handleSizeChange(e){this.queryParams.pageSize=e,this.queryParams.pageNum=1,this.loadExcelFromUrl()},handleCurrentChange(e){this.queryParams.pageNum=e,this.loadExcelFromUrl()}},install(e){e.component(c.name,c)}};l("");var p={render(){var e=this,t=e.$createElement,i=e.i.t||t;return i("div",[i("el-button",{attrs:{size:"small",type:"primary",icon:"el-icon-setting"},on:{click:e.onAdjust}},[e.u("\n 调整变量\n ")]),e.u(" "),i("long-variable-viewer",{ref:"variableViewerRef",attrs:{visible:e.modalVisiable,values:e.values,menus:e.menus},on:{"update:visible"(t){e.modalVisiable=t},"config-changed":e.handleConfigChanged}})],1)},staticRenderFns:[],name:"LongVariableViewerButton",props:{values:{type:Array,default:()=>[]},menus:{type:Array,default:()=>[]}},data(){return{modalVisiable:!1,tableDataCache:[],updateTimer:null,valuesUpdateTimer:null,menusUpdateTimer:null,updatingTableData:!1}},mounted(){void 0,this.$nextTick(()=>{this.updateTableData()})},beforeDestroy(){this.updateTimer&&clearInterval(this.updateTimer),this.valuesUpdateTimer&&clearTimeout(this.valuesUpdateTimer),this.menusUpdateTimer&&clearTimeout(this.menusUpdateTimer)},watch:{modalVisiable(e){e||(this.$emit("update:columns",this.$refs.variableViewerRef.$getValues()),this.$nextTick(()=>{this.updateTableData()}))},values:{handler(){this.valuesUpdateTimer&&clearTimeout(this.valuesUpdateTimer),this.valuesUpdateTimer=setTimeout(()=>{this.updateTableData()},300)},deep:!0},menus:{handler(){this.menusUpdateTimer&&clearTimeout(this.menusUpdateTimer),this.menusUpdateTimer=setTimeout(()=>{this.updateTableData()},300)},deep:!0}},computed:{tableData(){return this.tableDataCache}},methods:{onAdjust(){this.modalVisiable=!0},$getValues(){return this.$refs.variableViewerRef.$getValues()},$triggerUpdate(){this.$emit("update:columns",this.$getValues()),this.$nextTick(()=>{this.updateTableData()})},$restoreConfig(e){this.$refs.variableViewerRef&&this.$refs.variableViewerRef.$restoreConfig&&(this.$refs.variableViewerRef.$restoreConfig(e),this.$nextTick(()=>{this.updateTableData()}))},handleConfigChanged(e){Array.isArray(e)&&(this.tableDataCache=e,this.$emit("table-data-updated",e))},updateTableData(){if(!this.updatingTableData)if(this.updatingTableData=!0,this.$refs.variableViewerRef&&this.$refs.variableViewerRef.$getTableData){const e=this.$refs.variableViewerRef.$getTableData()||[],t=JSON.parse(JSON.stringify(e)),i=JSON.parse(JSON.stringify(this.tableDataCache));JSON.stringify(t)!==JSON.stringify(i)?(this.tableDataCache=e,this.$nextTick(()=>{this.$emit("table-data-updated",e),this.updatingTableData=!1})):this.updatingTableData=!1}else this.tableDataCache.length>0&&(this.tableDataCache=[]),this.updatingTableData=!1}},install(e){e.component(p.name,p)}};l("");var h={render(){var e=this,t=e.$createElement,i=e.i.t||t;return i("div",{staticStyle:{display:"inline-block","margin-left":"4px"},on:{click(e){e.stopPropagation()}}},[i("el-button",{attrs:{type:"text",size:"small",icon:"el-icon-document"},on:{click:e.onExample}},[e.u("示例文件")]),e.u(" "),i("long-excel-viewer",{attrs:{visible:e.modalVisiable,url:e.url},on:{"update:visible"(t){e.modalVisiable=t}}})],1)},staticRenderFns:[],name:"LongExcelViewerButton",props:{url:{type:String,default:""}},data(){return{modalVisiable:!1}},methods:{onExample(e){e.stopPropagation(),e.preventDefault(),this.modalVisiable=!0}},install(e){e.component(h.name,h)}};l(".long-uploader-wrapper .el-form-item{margin-bottom:0}.long-uploader-wrapper :deep(.el-upload) .el-upload-dragger{height:130px!important}.long-uploader-wrapper :deep(.el-upload) .el-upload-dragger .el-icon-upload{margin:8px 0}.variable-config-section{background-color:#f8f9fa;border:1px solid #e9ecef;border-radius:4px;margin-top:16px}.config-header{align-items:center;background-color:#e8e9f2;border-bottom:1px solid #e9ecef;cursor:pointer;display:flex;justify-content:space-between;padding:0 12px;transition:background-color .2s}.config-header:hover{background-color:#f0f0f0}.config-title{color:#303133;font-size:14px;margin:0}.collapse-arrow{color:#909399;font-size:12px;transition:transform .3s ease}.collapse-arrow.is-collapsed{transform:rotate(-90deg)}.config-content{padding:12px}.variable-config-section .el-table{font-size:12px}.variable-config-section .el-table th{background-color:#f5f7fa;color:#606266;font-weight:600}.variable-config-section .el-table td{padding:8px 0}.no-data{color:#909399;font-size:14px;padding:20px;text-align:center}");var u={render(){var e=this,t=e.$createElement,i=e.i.t||t;return i("div",{staticClass:"long-uploader-wrapper"},[i("div",[i("div",{staticStyle:{float:"right","margin-top":"-80px"}},[e.options.example&&e.options.example.value?i("long-excel-viewer-button",{attrs:{url:e.options.example.value}}):e.v()],1),e.u(" "),i("div",{staticStyle:{display:"flex","align-items":"center","justify-content":"space-between","margin-bottom":"12px"}},[i("div",{staticStyle:{display:"flex","align-items":"center",gap:"12px",position:"relative"}},[i("el-upload",{attrs:{action:e.uploadUrl,headers:{Authorization:"Bearer "+e.token},"on-preview":e.handlePreview,"on-remove":e.handleRemove,"before-remove":e.beforeRemove,"on-change":e.handleChange,"before-upload":e.beforeUpload,accept:e.fileType,drag:"","on-exceed":e.handleExceed,"file-list":e.fileList}},[i("i",{staticClass:"el-icon-upload",staticStyle:{color:"#6C1537"}}),e.u(" "),i("div",{staticClass:"el-upload__text"},[i("div",{staticStyle:{"line-height":"18px"}},[e.u("将文件拖到此处,或"),i("em",[e.u("点击上传")])]),e.u(" "),i("div",{staticStyle:{"line-height":"18px"}},[e.u("\n 支持上传"),i("em",[e.u("xlsx")]),e.u("、"),i("em",[e.u("xls")]),e.u("、"),i("em",[e.u("csv")])])])])],1)]),e.u(" "),e.fileList.length>0?i("div",{staticStyle:{"margin-top":"-20px"}},[e.C(0),e.u(" "),i("div",[e.p(e.fileList,function(t){return i("el-tag",{key:t.uid,staticStyle:{"margin-right":"8px",cursor:"pointer"},attrs:{closable:""},on:{close:i=>e.handleRemove(t),click:i=>e.handleFileClick(t)}},[e.u("\n "+e.m(t.name)+"\n ")])}),e.u(" "),e.fileList.length>0&&e.options.variable&&e.options.variable.enable?i("div",{staticStyle:{display:"flex","align-items":"center"}},[i("span",{staticStyle:{color:"#f56c6c","margin-right":"5px"}},[e.u("*")]),e.u(" "),i("long-variable-viewer-button",{ref:"variableViewerRef",attrs:{values:e.fileData,menus:e.options.variable.menus},on:{"update:columns":e.handleUpdateColumns,"table-data-updated":e.handleTableDataUpdated}})],1):e.v()],2)]):e.v()]),e.u(" "),e.fileList.length>0&&e.options.variable&&e.options.variable.enable&&e.hasConfiguredVariables?i("div",{staticClass:"variable-config-section"},[i("div",{staticClass:"config-header",on:{click:e.toggleCollapse}},[i("span",{staticClass:"config-title"},[e.u("当前变量配置")]),e.u(" "),i("i",{staticClass:"el-icon-caret-bottom collapse-arrow",class:{"is-collapsed":e.isCollapsed}})]),e.u(" "),i("div",{directives:[{name:"show",rawName:"v-show",value:!e.isCollapsed,expression:"!isCollapsed"}],staticClass:"config-content"},[0===e.currentVariableValues.length?i("div",{staticClass:"no-data"},[e.u("\n 暂无数据\n ")]):i("el-table",{staticStyle:{width:"100%"},attrs:{data:e.currentVariableValues,size:"mini","max-height":"300",border:""}},[i("el-table-column",{attrs:{prop:"field",label:"字段名","show-overflow-tooltip":""}}),e.u(" "),i("el-table-column",{attrs:{prop:"fullPath",label:"属性","show-overflow-tooltip":""}})],1),e.u(" "),i("div",{staticClass:"debug-info",staticStyle:{"margin-top":"8px","font-size":"12px",color:"#999"}},[e.u("\n 数据条数: "+e.m(e.currentVariableValues.length)+"\n ")])],1)]):e.v(),e.u(" "),i("long-excel-viewer",{attrs:{visible:e.previewVisible,url:e.previewUrl},on:{"update:visible"(t){e.previewVisible=t}}})],1)},staticRenderFns:[function(){var e=this,t=e.$createElement,i=e.i.t||t;return i("div",{staticStyle:{"font-size":"12px",color:"#999","line-height":"20px"}},[i("i",{staticClass:"el-icon-info",staticStyle:{"margin-right":"5px"}}),e.u(" "),i("span",[e.u("点击文件名称可预览文件")])])}],name:"LongUploader",props:{options:{type:Object,default:()=>({variable:{enable:!1,values:[],menus:[]},example:{value:""},file:{id:"",name:""}})},value:{type:Object,default:()=>({fileId:"",columns:[],fileName:""})},fileId:{type:String,default:""},limit:{type:Number,default:1},fileSize:{type:Number,default:3},fileType:{type:String,default:".xlsx,.xls,.csv"}},data(){return{uploadUrl:process.env.VUE_APP_BASE_API+"/file/upload",fileList:[],token:"",fileData:[],fileToken:"",variableViewerRef:null,isCollapsed:!0,hasTriggerUpdate:!1,previewVisible:!1,previewUrl:"",tableDataCache:[]}},computed:{currentVariableValues(){return this.tableDataCache.map(e=>({field:e.field||"",fullPath:e.fullPath||"",varType:e.varType||"",attr:e.attr||""}))},hasConfiguredVariables(){return this.currentVariableValues.length>0}},created(){this.token=localStorage.getItem("token")},watch:{fileId:{handler(e){this.fileToken=e},immediate:!0,deep:!0},value:{handler(e,t){void 0,!e||!e.fileId||t&&t.fileId===e.fileId||(this.fileToken=e.fileId,this.downloadFile(e.fileId,e.columns||{})),!e||!e.fileName||t&&t.fileName===e.fileName||(this.fileList=[{name:e.fileName,uid:e.fileId}])},immediate:!0,deep:!0}},methods:{downloadFile(e,t={}){this.$api.dataAnalysis.filePreview({fileId:e}).then(e=>{if(e&&e.data&&e.data.records&&e.data.records.length>0){const i=e.data.records[0].headers||[];this.$emit("update:headers",i);const a=this.options.variable.menus||[],l={};i.forEach(e=>{l[e]={field:e,varType:"",attr:""}}),t&&"object"==typeof t&&Object.keys(t).forEach(e=>{const i=t[e];if(void 0,i&&i.values&&Array.isArray(i.values)){const t=a.find(t=>t.fieldName===e);void 0,t&&i.values.forEach(i=>{l[i]&&(l[i]={field:i,varType:t.label||e,attr:t.label||e})})}}),this.fileData=[{...l}],this.$nextTick(()=>{if(this.$refs.variableViewerRef&&t&&Object.keys(t).length>0&&"function"==typeof this.$refs.variableViewerRef.$restoreConfig&&(this.$refs.variableViewerRef.$restoreConfig(t),this.$nextTick(()=>{this.$refs.variableViewerRef&&"function"==typeof this.$refs.variableViewerRef.updateTableData&&this.$refs.variableViewerRef.updateTableData()})),this.$route.query.id){if(this.hasTriggerUpdate)return;"function"==typeof this.$refs.variableViewerRef.$triggerUpdate&&this.$refs.variableViewerRef.$triggerUpdate(),this.hasTriggerUpdate=!0}})}}).catch(e=>{this.$message.error(e.message||"数据文件内容不匹配,请重新上传")}).finally(()=>{this.loading=!1})},handleColumns(e=[]){const t=this.options.variable.menus||[];void 0,0!=t.length&&e.forEach(e=>{void 0;const i=t.find(t=>t.fieldName==e.fieldName);void 0,e.varType=i.label,e.attr=i.attr})},handleTableDataUpdated(e){Array.isArray(e)&&(this.tableDataCache=e)},handleUpdateColumns(e){void 0,this.$emit("update:columns",e)},beforeUpload(e){if(void 0,e.size>1048576*this.fileSize)return this.$message.error(`上传文件大小不能超过 ${this.fileSize} MB!`),!1;const t=e.type,i=e.name.toLowerCase();return!!(["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.ms-excel","text/csv"].includes(t)||i.endsWith(".xlsx")||i.endsWith(".xls")||i.endsWith(".csv"))||(this.$message.error("只支持上传 xlsx、xls、csv 格式的文件!"),!1)},handleChange(e,t){if(t.length>1?this.fileList=[t[t.length-1]]:this.fileList=t.filter(e=>void 0!==e.raw),"success"===e.status){const t=e.response;t&&200===t.code&&(this.fileToken=t.data.id,this.$emit("update:fileId",this.fileToken),this.loadFromUrl(this.fileToken))}},loadFromUrl(e){this.$api.dataAnalysis.filePreview({fileId:e}).then(e=>{if(e&&e.data&&e.data.records&&e.data.records.length>0){const t=(e.data.records[0]||{data:[],headers:[]}).headers||[];if(t.length>0){this.$emit("update:headers",t);const e={};t.forEach(t=>{e[t]={field:t,varType:"",attr:""}}),this.fileData=[{...e}]}else this.$emit("update:headers",[]),this.fileData=[]}})},handleRemove(e){this.fileList=this.fileList.filter(t=>t.uid!==e.uid),this.fileToken="",this.fileData=[],this.$emit("update:fileId",""),this.$emit("update:headers",[])},onAdjust(){this.$emit("adjust")},handleRemove1(e,t){void 0},handlePreview(e){void 0},handleExceed(e,t){this.$message.warning(`上传文件数量不能超过 ${this.limit} 个!`),t.length>this.limit&&(this.fileList=t.slice(-this.limit))},beforeRemove(){return!0},toggleCollapse(){this.isCollapsed=!this.isCollapsed},handleFileClick(){event.stopPropagation(),this.fileToken?(this.previewUrl=`${process.env.VUE_APP_BASE_API}/file/preview/${this.fileToken}`,this.previewVisible=!0):this.$message.warning("文件ID不存在,无法预览")}},install(e){e.component(u.name,u)}};l(".long-radio-wrapper{display:flex;flex-wrap:wrap}.long-radio-wrapper ::v-deep .el-radio{line-height:24px;margin-bottom:0}.long-radio-wrapper ::v-deep .el-radio__label{display:inline-block;vertical-align:middle;white-space:normal;word-break:break-all}.long-radio-item{margin:4px 12px 4px 0;width:100px}");var f={render(){var e=this,t=e.$createElement,i=e.i.t||t;return i("el-radio-group",e.l(e.o({staticClass:"long-radio-wrapper"},"el-radio-group",e.$attrs,!1),e.$listeners),e.p(e.options,function(t,a){return i("el-radio",{key:a,staticClass:"long-radio-item",attrs:{label:t[e.valueKey],disabled:t[e.disabledOption]}},[e.u("\n "+e.m(t[e.labelKey])+"\n ")])}),1)},staticRenderFns:[],name:"LongRadio",props:{dataList:{type:Array,default:()=>[]},disabledOption:{type:[Boolean,Number],default:!1},valueKey:{type:[String,Number],default:"value"},labelKey:{type:[String,Number],default:"label"},mode:{type:String,default:"local"},dict:{type:String,default:""},url:{type:String,default:""},requestParams:{type:Object,default(){}},placeholder:{type:String,default:"请选择"}},data(){return{options:[]}},watch:{dataList:{deep:!0,immediate:!0,handler(e){"local"===this.mode&&(this.options=e)}},dict:{deep:!0,handler(e){this.init()}}},created(){this.init()},methods:{init(){"remote"===this.mode&&this.dict&&this.getDicts(this.dict).then(e=>{this.options=(e.data||[]).map(e=>({[this.valueKey]:e.dictCode,[this.labelKey]:e.dictLabel}))})}},install(e){e.component(f.name,f)}};l(".long-group{background-color:#f8f8f8;box-sizing:border-box;height:100%;padding:10px;width:100%}.long-group .group-header{color:#333;font-size:14px;font-weight:700}");var g={render(){var e=this,t=e.$createElement,i=e.i.t||t;return i("div",{staticClass:"long-group"},[i("div",{staticClass:"group-header"},[e.u(e.m(e.label))]),e.u(" "),e.h("default")],2)},staticRenderFns:[],name:"LongGroup",props:{label:{type:String,default:""}},install(e){e.component(g.name,g)}};l(".long-color-picker{width:200px}.long-color-picker .el-color-picker__trigger{width:100%}.long-color-picker .el-color-picker__trigger .el-color-picker__icon{left:unset!important;right:5px!important;width:unset!important}");var b={render(){var e=this,t=e.$createElement;return(e.i.t||t)("el-color-picker",e.l(e.o({staticClass:"long-color-picker"},"el-color-picker",e.$attrs,!1),e.$listeners))},staticRenderFns:[],name:"LongColorPicker",install(e){e.component(b.name,b)}};l("");var m={render(){var e=this,t=e.$createElement;return(e.i.t||t)("el-input-number",e.l(e.o({staticClass:"long-number-input",attrs:{"controls-position":"right",step:e.stepValue,value:e.value,max:e.maxValue,min:e.minValue},on:{input:t=>e.$emit("input",t)}},"el-input-number",e.$attrs,!1),e.$listeners))},staticRenderFns:[],name:"LongNumberInput",props:{value:{type:[String,Number],default:0},placeholder:{type:String,default:"请输入"},max:{type:[Number,String],default:""},min:{type:[Number,String],default:""},step:{type:[Number,String],default:1}},data(){return{maxValue:""===this.max?Number.MAX_SAFE_INTEGER:+this.max,minValue:""===this.min?Number.MIN_SAFE_INTEGER:+this.min,stepValue:+this.step}},watch:{max:{handler(e){this.maxValue=""===e?Number.MAX_SAFE_INTEGER:+e},immediate:!0},min:{handler(e){this.minValue=""===e?Number.MIN_SAFE_INTEGER:+e},immediate:!0},step:{handler(e){this.stepValue=+e},immediate:!0}},install(e){e.component(m.name,m)}};l(".long-checkbox-wrapper{display:flex;flex-wrap:wrap}.long-checkbox-wrapper ::v-deep .el-checkbox{line-height:24px;margin-bottom:0}.long-checkbox-item{margin:1px 6px 1px 0;min-width:50px}");var x={render(){var e=this,t=e.$createElement,i=e.i.t||t;return i("el-checkbox-group",e.l(e.o({staticClass:"long-checkbox-wrapper",attrs:{value:e.value},on:{change:e.handleInput}},"el-checkbox-group",e.$attrs,!1),e.$listeners),e.p(e.options,function(t,a){return i("el-checkbox",{key:a,staticClass:"long-checkbox-item",attrs:{label:t[e.valueKey],disabled:e.getDisabled(t)}},[e.u("\n "+e.m(t[e.labelKey])+"\n ")])}),1)},staticRenderFns:[],name:"LongCheckBox",props:{value:{type:Array,default:()=>[]},dataList:{type:Array,default:()=>[]},disabledOption:{type:[String,Boolean,Number],default:!1},valueKey:{type:[String,Number],default:"value"},labelKey:{type:[String,Number],default:"label"},mode:{type:String,default:"local"},dict:{type:String,default:""},url:{type:String,default:""},requestParams:{type:Object,default(){}},placeholder:{type:String,default:"请选择"}},data(){return{options:[]}},watch:{dataList:{deep:!0,immediate:!0,handler(e){"local"===this.mode&&(this.options=e)}},dict:{deep:!0,handler(e){this.init()}}},created(){this.init()},methods:{init(){"remote"===this.mode&&this.dict&&this.getDicts(this.dict).then(e=>{this.options=(e.data||[]).map(e=>({[this.valueKey]:e.dictCode,[this.labelKey]:e.dictLabel}))})},handleInput(e){this.$emit("input",e),this.$emit("change",e)},getDisabled(e){return"string"==typeof this.disabledOption?e[this.disabledOption]||!1:"boolean"==typeof this.disabledOption?this.disabledOption:"number"==typeof this.disabledOption&&e[this.disabledOption]||!1}},install(e){e.component(x.name,x)}},v=[r,n,d,c,p,h,u,f,g,b,m,x],y=function(e){if(!y.installed){y.installed=!0;var t=["ElInput","ElSelect","ElOption","ElCheckbox","ElCheckboxGroup","ElRadio","ElRadioGroup","ElButton","ElDialog","ElTable","ElTableColumn","ElUpload","ElTag","ElPagination","ElInputNumber","ElColorPicker","ElForm","ElFormItem","ElIcon"];t.forEach(function(t){var i=e.options.components[t];if(!i){var a=s(t);i=e.options.components[a]}if(i){var l=s(t);l&&l!==t&&(e.options.components[l]||e.component(l,i)),e.options.components[t]||e.component(t,i)}else"production"!==process.env.NODE_ENV,0}),e.nextTick(function(){t.forEach(function(t){var i=e.options.components[t];if(i){var a=s(t);a&&a!==t&&(e.options.components[a]||e.component(a,i))}})}),v.forEach(function(t){if(t){var i=t.name||t.options&&t.options.name;if(i){e.component(i,t);var a=s(i);a&&a!==i&&e.component(a,t)}}})}};"undefined"!=typeof window&&window.Vue&&y(window.Vue);var w={version:"1.0.0",install:y,Input:r,Select:n,VariableViewer:d,ExcelViewer:c,VariableViewerButton:p,ExcelViewerButton:h,Uploader:u,Radio:f,Group:g,ColorPicker:b,NumberInput:m,CheckBox:x};e.CheckBox=x,e.ColorPicker=b,e.ExcelViewer=c,e.ExcelViewerButton=h,e.Group=g,e.Input=r,e.NumberInput=m,e.Radio=f,e.Select=n,e.Uploader=u,e.VariableViewer=d,e.VariableViewerButton=p,e.default=w,Object.defineProperty(e,"S",{value:!0})},void("object"==typeof exports&&"undefined"!=typeof module?t(exports,require("xlsx"),require("file-saver"),require("@/assets/icon-search.png")):"function"==typeof define&&define.amd?define(["exports","xlsx","file-saver","@/assets/icon-search.png"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).WiserComponents={},e.xlsx,e.fileSaver,e.searchIcon));
|