import{N as t,F as e,v as s,d as l,w as o,i,o as a,e as r,I as n,J as u,K as d,f as c,x as m,t as p,H as h,h as f}from"./index-zLEn-L9B.js";import{_ as w}from"./u-icon.B04er4rD.js";import{r as _}from"./uni-app.es.qL3OKTvR.js";import{_ as k,a as g}from"./u-cell-group.Bch0yDmb.js";import{_ as y,a as b}from"./u-dropdown.CcXgIniB.js";import{_ as C}from"./index.CKaoucWw.js";import{_ as x,a as j}from"./u-form.BjPZHPaC.js";import{_ as T}from"./u-button.ByM3avjB.js";import{_ as $,a as D}from"./uni-swipe-action.N7z0v5hR.js";import{_ as I}from"./mescroll-uni.BSPc31N_.js";import{_ as v}from"./u-picker.CnU2nvxF.js";import{r as S}from"./resources.DipqUmnN.js";import{M as F}from"./mescroll-mixins.C12t-s_D.js";import{b as V,D as P}from"./order.DB5QiOhY.js";import{j as U,a as B}from"./flowEngine.CrTCOGy1.js";import{_ as L}from"./_plugin-vue_export-helper.BCo6x5W8.js";import"./u-input.B153yE02.js";import"./emitter.DrjJCwnj.js";import"./u-popup.CloszGaz.js";const Q=L({mixins:[F],data:()=>({selector:[],show:!1,activeFlow:{},templateList:[],sortValue:0,sortOptions:[{label:"单据升序",value:1},{label:"单据降序",value:2},{label:"日期升序",value:3},{label:"日期降序",value:4}],upOption:{page:{num:0,size:20,time:null},empty:{icon:S.message.nodata,tip:"暂无数据",top:"300rpx"},textNoMore:"没有更多数据",toTop:{bottom:250}},list:[],listQuery:{sort:"desc",sidx:"",keyword:"",startTime:"",endTime:""},options:[{text:"删除",style:{backgroundColor:"#dd524d"}}],menuId:"",flowId:"",key:+new Date}),computed:{showAddBtn(){return this.$permission.hasBtnP("btn_add",this.menuId)}},onLoad(t){this.menuId=t.menuId,this.getFlowIdByCode()},onShow(){this.$nextTick((()=>{this.list=[],this.mescroll.resetUpScroll()}))},onUnload(){t("refresh")},methods:{confirm(t){this.activeFlow=this.templateList[t[0]],this.jumPage()},getFlowIdByCode(){U("crmOrder").then((t=>{this.flowId=t.data,this.getFlowJsonList()}))},getFlowJsonList(){B(this.flowId,"1").then((t=>{this.templateList=t.data}))},upCallback(t){let e={currentPage:t.num,pageSize:t.size,...this.listQuery};V(e,{load:1==t.num}).then((e=>{1==t.num&&(this.list=[]),this.mescroll.endSuccess(e.data.list.length);const s=e.data.list.map((t=>({show:!1,...t})));this.list=this.list.concat(s),this.$nextTick((()=>{this.key=+new Date}))})).catch((()=>{this.mescroll.endErr()}))},handleClick(t,e){const s=this.list[t];return[1,2,3,5].includes(s.currentState)?(this.$u.toast("流程正在审核,请勿删除"),void(this.list[t].show=!1)):this.$permission.hasBtnP("btn_remove",this.menuId)?(P(s.id).then((e=>{this.$u.toast(e.msg),this.list.splice(t,1),this.list.length||this.mescroll.resetUpScroll()})),void this.$nextTick((()=>{this.key=+new Date}))):this.$u.toast("未开启删除权限")},open(t){this.list[t].show=!0,this.list.map(((e,s)=>{t!=s&&(this.list[s].show=!1)}))},search(){this.searchTimer&&clearTimeout(this.searchTimer),this.searchTimer=setTimeout((()=>{this.list=[],this.mescroll.resetUpScroll()}),300)},addPage(){this.templateList.length?this.templateList.length>1?(this.show=!0,this.selector=this.templateList):(this.activeFlow=this.templateList[0],this.jumPage()):this.$u.toast("流程不存在"),this.$nextTick((()=>{this.key=+new Date}))},jumPage(t,s,l){let o="-1";[1,2,4,5,6].includes(s)&&(o=0);const i={id:t,flowId:l||this.activeFlow.id,opType:o,status:s};e({url:"/pages/workFlow/flowBefore/index?config="+this.jnpf.base64.encode(JSON.stringify(i))})},goDetail(t,e,s){(this.$permission.hasBtnP("btn_edit",this.menuId)||3!=e)&&(!this.$permission.hasBtnP("btn_detail",this.menuId)&&[1,2,4,5,6].includes(e)||this.jumPage(t,e,s))},getFlowStatus(t){let e;switch(t){case 0:default:e={text:"等待提交",statusCss:"u-type-info"};break;case 1:e={text:"等待审核",statusCss:"u-type-primary"};break;case 2:e={text:"审核通过",statusCss:"u-type-success"};break;case 3:e={text:"审核退回",statusCss:"u-type-error"};break;case 4:case 7:e={text:"流程撤回",statusCss:"u-type-warning"};break;case 5:e={text:"审核终止",statusCss:"u-type-info"}}return e},cellClick(t){this.listQuery.sort=1==t||3==t?"asc":"desc",this.listQuery.sidx=1==t||2==t?"orderCode":"orderDate",this.sortValue=t,this.$refs.uDropdown.close(),this.$nextTick((()=>{this.list=[],this.mescroll.resetUpScroll()}))},reset(){this.listQuery.startTime="",this.listQuery.endTime=""},closeDropdown(){this.$refs.uDropdown.close(),this.$nextTick((()=>{this.list=[],this.mescroll.resetUpScroll()}))}}},[["render",function(t,e,S,F,V,P){const U=_(s("u-icon"),w),B=_(s("u-cell-item"),k),L=_(s("u-cell-group"),g),Q=i,O=_(s("u-dropdown-item"),y),N=_(s("JnpfDatePicker"),C),z=_(s("u-form-item"),x),J=_(s("u-form"),j),A=_(s("u-button"),T),M=_(s("u-dropdown"),b),E=f,R=_(s("uni-swipe-action-item"),$),H=_(s("uni-swipe-action"),D),K=_(s("mescroll-uni"),I),q=_(s("u-picker"),v);return a(),l(Q,{class:"order-v"},{default:o((()=>[r(Q,{class:"head-warp com-dropdown"},{default:o((()=>[r(M,{class:"u-dropdown",ref:"uDropdown"},{default:o((()=>[r(O,{title:"排序",options:V.sortOptions},{default:o((()=>[r(Q,{class:"dropdown-slot-content"},{default:o((()=>[r(Q,{class:"dropdown-slot-content-main"},{default:o((()=>[r(L,null,{default:o((()=>[(a(!0),n(d,null,u(V.sortOptions,((t,e)=>(a(),l(B,{onClick:e=>P.cellClick(t.value),arrow:!1,title:t.label,key:e,"title-style":{color:V.sortValue==t.value?"#2979ff":"#606266"}},{default:o((()=>[V.sortValue==t.value?(a(),l(U,{key:0,name:"checkbox-mark",color:"#2979ff",size:"32"})):m("",!0)])),_:2},1032,["onClick","title","title-style"])))),128))])),_:1})])),_:1}),r(Q,{class:"dropdown-slot-bg",onClick:e[0]||(e[0]=e=>t.$refs.uDropdown.close())})])),_:1})])),_:1},8,["options"]),r(O,{title:"筛选"},{default:o((()=>[r(Q,{class:"dropdown-slot-content"},{default:o((()=>[r(Q,{class:"dropdown-slot-content-main"},{default:o((()=>[r(Q,{class:"u-p-l-32 u-p-r-32"},{default:o((()=>[r(J,{"label-position":"left","label-width":"150","label-align":"left"},{default:o((()=>[r(z,{label:"起始日期",prop:"startTime"},{default:o((()=>[r(N,{modelValue:V.listQuery.startTime,"onUpdate:modelValue":e[1]||(e[1]=t=>V.listQuery.startTime=t)},null,8,["modelValue"])])),_:1}),r(z,{label:"结束日期",prop:"endTime"},{default:o((()=>[r(N,{modelValue:V.listQuery.endTime,"onUpdate:modelValue":e[2]||(e[2]=t=>V.listQuery.endTime=t)},null,8,["modelValue"])])),_:1})])),_:1})])),_:1}),r(Q,{class:"buttom-actions"},{default:o((()=>[r(A,{class:"buttom-btn",onClick:P.reset},{default:o((()=>[c("重置")])),_:1},8,["onClick"]),r(A,{class:"buttom-btn",type:"primary",onClick:P.closeDropdown},{default:o((()=>[c("检索")])),_:1},8,["onClick"])])),_:1})])),_:1}),r(Q,{class:"dropdown-slot-bg",onClick:e[3]||(e[3]=e=>t.$refs.uDropdown.close())})])),_:1})])),_:1})])),_:1},512)])),_:1}),r(Q,{class:"list-warp"},{default:o((()=>[r(K,{ref:"mescrollRef",onInit:t.mescrollInit,onDown:t.downCallback,onUp:P.upCallback,top:"100",up:V.upOption},{default:o((()=>[r(Q,{class:"flow-list"},{default:o((()=>[r(H,{ref:"swipeAction"},{default:o((()=>[(a(!0),n(d,null,u(V.list,((e,s)=>(a(),l(R,{key:e.id,"right-options":V.options,onClick:t=>P.handleClick(s)},{default:o((()=>[r(Q,{class:"order-item",onClick:t=>P.goDetail(e.id,e.currentState,e.flowId),id:"item"+s},{default:o((()=>[r(Q,{class:"order-item-title u-border-bottom"},{default:o((()=>[r(E,{class:"order-title u-line-1"},{default:o((()=>[c(p(e.customerName),1)])),_:2},1024)])),_:2},1024),r(Q,{class:"order-item-down"},{default:o((()=>[r(Q,{class:"order-item-cell u-flex"},{default:o((()=>[r(E,{class:"time"},{default:o((()=>[c(p(e.orderCode),1)])),_:2},1024),r(E,{class:h("status "+P.getFlowStatus(e.currentState).statusCss)},{default:o((()=>[c(p(P.getFlowStatus(e.currentState).text),1)])),_:2},1032,["class"])])),_:2},1024),r(Q,{class:"order-item-cell u-flex"},{default:o((()=>[r(E,{class:"time"},{default:o((()=>[c(p(e.salesmanName),1)])),_:2},1024),r(E,{class:"time"},{default:o((()=>[c(p(t.$u.timeFormat(e.orderDate,"yyyy-mm-dd")),1)])),_:2},1024)])),_:2},1024)])),_:2},1024)])),_:2},1032,["onClick","id"])])),_:2},1032,["right-options","onClick"])))),128))])),_:1},512)])),_:1})])),_:1},8,["onInit","onDown","onUp","up"])])),_:1}),P.showAddBtn?(a(),l(Q,{key:0,class:"com-addBtn",onClick:e[4]||(e[4]=t=>P.addPage())},{default:o((()=>[r(U,{name:"plus",size:"60",color:"#fff"})])),_:1})):m("",!0),r(q,{mode:"selector",modelValue:V.show,"onUpdate:modelValue":e[5]||(e[5]=t=>V.show=t),"default-selector":[0],title:"请选择流程",range:V.selector,"range-key":"fullName",onConfirm:P.confirm},null,8,["modelValue","range","onConfirm"])])),_:1})}],["__scopeId","data-v-3b7275e5"]]);export{Q as default};