You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 lines
14 KiB

import{_ as Oe,u as Se,s as W,g as Ce,i as E,j as Ne,r as g,k as q,l as O,o as s,c as S,h as d,w as h,d as b,F as v,m as D,n as C,e as A,t as L,a as xe,E as k,p as u,q as V}from"./index-BO1j28mb.js";import{_ as ve,a as De,i as Be,b as ke,c as G,d as we,p as He,e as Ie,g as Te,f as Fe,h as Re,j as Pe,k as Ee,l as Ae,m as Le,n as Ve,o as Ue}from"./apiServeNames-DYIwj4Di.js";import{d as Ye}from"./download-DA4MPZiT.js";const Me={class:"app-container"},je=Object.assign({name:"ediTtablePage"},{__name:"index",props:{apiName:{type:String,default:null},detailColumName:{type:String,default:null},apiType:{type:String,default:null},hideSearch:{type:Boolean,default:!1},multipleTable:{type:Boolean,default:!1},showTableIndex:{type:Boolean,default:!0},leftOperation:{type:Object,default:null},rightOperation:{type:[Object,String],default:null},showApiRightOperation:{type:Object,default:null},apiRightHideConfig:{type:Object,default:{apiUpdate:{prop:"readState",ruleValue:!0},apiDelete:{prop:"readState",ruleValue:!0}}},tableColumns:{type:Object,default:null},searchOptions:{type:Object,default:[]},searchButtons:{type:Object,default:["search","export"]},searchFilter:{type:Object,default:{}},columnWidth:{type:Number,default:120},columnHeaderAlign:{type:String,default:"center"},columnAlign:{type:String,default:"center"},apiEditFormRules:{type:Object,default:null},tableFormRules:{type:Object,default:null},hideHeaderInfo:{type:Boolean,default:!1},editDisabledConfig:{type:Object,default:[{prop:"readState",ruleValue:!0}]}},emits:["leftOperationHadel","rightOperationHadel","tableSelectionHandle"],setup(K,{emit:Q}){const X=Se(),N=W.userStore().state,U=W.permissionStore(),t=Ce({loading:!1,detailLoading:!1,pageLoading:!1,searchBtnOptions:{search:{icon:"Search",auth:":page",label:"查询",type:null},create:{icon:"Plus",auth:":create",label:"新增",type:"primary"},import:{icon:"BottomRight",auth:":import",label:"导入",type:"warning"},export:{icon:"TopRight",auth:":export",label:"导出",type:"success"},custominvoke:{icon:"Position",auth:":custominvoke",label:"手动开关",type:"primary"},outputMany:{icon:"Position",auth:":outputMany",label:"手动传出",type:"primary"}},searchRightBtn:[{name:"pageSave",icon:"Check",auth:":pageSave",label:"保存页面",type:"warning"}],tableData:[],sortFilter:{sortBy:void 0,isAscending:void 0},pager:{page:1,pageSize:10,total:1},tableSelectList:[],leaveSaveTip:"此操作将重新渲染页面,检测有数据【未保存】,操作后将【清空未保存数据】,是否确定继续?",headerInfoData:[],currentDetailId:null,stage_tableData:[],stage_indexs:[],tableFormRulesData:null}),l=K;function w(){return l.tableColumns||G[l.apiName]}const H=Q;function Z(a){t.tableSelectList=a,H("tableSelectionHandle",a)}function ee(a,e){H("leftOperationHadel",a,e)}function te(){if(typeof l.rightOperation=="object"&&!l.showApiRightOperation)return l.rightOperation;if(typeof l.rightOperation=="object"&&l.showApiRightOperation||typeof l.rightOperation=="string"){let a=l.showApiRightOperation||l.rightOperation.split(","),e={apiUpdate:{label:"编辑",type:"warning"},apiDelete:{label:"删除",type:"danger"}},n=[];return a&&a.length>0&&a.forEach(r=>{n.push({label:e[r].label,name:r,link:!0,type:e[r].type,auth:l.apiName+":"+r,hide:(o,y)=>o[l.apiRightHideConfig[r].prop]==l.apiRightHideConfig[r].ruleValue})}),typeof l.rightOperation=="object"&&(n=[...n,...l.rightOperation]),n}}const m=E();function ae(a,e){if(a.name=="apiUpdate"){let r=w().filter(o=>!o.noEdit);m.value.open(r,e.row)}a.name=="apiDelete"&&k.confirm("是否确定删除?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then(()=>{t.loading=!0,we(l.apiName,e.row.uId).then(n=>{u.success("操作成功!"),p(1)}).catch(n=>{u.error("操作失败!")}).finally(()=>{t.loading=!1})}),H("rightOperationHadel",a,e)}const le=async(a,e,n)=>{m.value.validate(r=>{r&&(a=="create"?(e.hasOwnProperty("createUser")&&(e.createUser=N.realName),e.hasOwnProperty("createByUser")&&(e.createByUser=N.realName),e.hasOwnProperty("createTime")&&(e.createTime=V(new Date,"YY