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
11 KiB

import{_ as O,r as f,y as _,o as F,c as C,w as a,d as l,f as I,h as V,z as d,t as u,F as x,i as q,a2 as J,C as T,G as w,T as z,D as j,E,H as B,I as P,J as K,j as R,m as H,q as G,R as M,l as Q,Q as W}from"./index.58a4812e.js";/* empty css *//* empty css *//* empty css */import{u as X,i as Y,c as S,g as Z,h as $}from"./common.a907f978.js";import{c as tt,g as et}from"./factory.56670aad.js";/* empty css */const at={setup(){const o=f({}),e=f([]),s=f([]),t=f([]);return{factoryInfo:o,typeLists:e,stateLists:s,factoryLists:t}},props:{factoryInfoObj:{type:Object,default:()=>{}},typeList:{type:Array,default:()=>[]},stateList:{type:Array,default:()=>[]},factoryList:{type:Array,default:()=>[]}},mounted(){this.typeLists=JSON.parse(JSON.stringify(this.typeList)),this.stateLists=JSON.parse(JSON.stringify(this.stateList));let o=JSON.parse(JSON.stringify(this.factoryInfoObj));o.FName=o.FName||" ",o.FCode=o.FCode||" ",o.FType=(o.FType||"1")+"",o.FFactoryID=(o.FFactoryID||" ")+"",o.FState=(o.FState||"1")+"";let e=JSON.parse(JSON.stringify(this.factoryList));if(e=e.filter(s=>s.FType=="2"||s.FType==2)||[],o.FID&&o.FID>0){let s=e.find(t=>t.FID==o.FID);s!=null&&e.splice(e.indexOf(s),1)}this.factoryLists=e,this.factoryInfo=o,console.log(this.factoryInfo)},methods:{stopClick(){},cancelClick(){this.$emit("cancelClick",!1)},async submitClick(){if(this.factoryInfo.FName=this.factoryInfo.FName.trim(),this.factoryInfo.FCode=this.factoryInfo.FCode.trim(),this.factoryInfo.FFactoryID=this.factoryInfo.FFactoryID.trim(),this.factoryInfo.FFactoryID=="-1"&&(this.factoryInfo.FFactoryID=""),this.factoryInfo.FName==""||this.factoryInfo.FCode==""||this.factoryInfo.FType=="1"&&this.factoryInfo.FFactoryID=="")return!1;if(this.factoryInfo.FType!="1"&&(this.factoryInfo.FFactoryID="-1"),(await tt(this.factoryInfo.FID||-1,this.factoryInfo.FCode)||0)>0)return _.msg("\u5DE5\u5382\u7F16\u53F7\u91CD\u590D",{time:1e3,icon:3}),!1;let e=0;this.factoryInfo.FID&&this.factoryInfo.FID>0?e=await X(this.factoryInfo,"Factory")||0:(this.factoryInfo.FAddUser=-1,this.factoryInfo.FEditUser=-1,e=await Y(this.factoryInfo,"Factory")||0),e>0?(_.msg("\u64CD\u4F5C\u6210\u529F",{time:1500,icon:1}),this.$emit("cancelClick",!0)):_.msg("\u64CD\u4F5C\u5931\u8D25",{time:1e3,icon:2})}}},ot={required:"",key:"sIdx"},lt={required:"",key:"sIdx"};function nt(o,e,s,t,g,c){const y=T,r=w,h=z,L=j,k=E,m=B,b=P;return F(),C(b,{model:t.factoryInfo,style:{"max-width":"96%",margin:"30px 0"},onClick:J(c.stopClick,["stop"])},{default:a(()=>[l(r,{label:"\u5DE5\u5382\u540D\u79F0",prop:"FName",required:""},{default:a(()=>[l(y,{modelValue:t.factoryInfo.FName,"onUpdate:modelValue":e[0]||(e[0]=i=>t.factoryInfo.FName=i)},null,8,["modelValue"])]),_:1}),l(r,{label:"\u5DE5\u5382\u7F16\u53F7",prop:"FCode",required:""},{default:a(()=>[l(y,{modelValue:t.factoryInfo.FCode,"onUpdate:modelValue":e[1]||(e[1]=i=>t.factoryInfo.FCode=i)},null,8,["modelValue"])]),_:1}),l(r,{label:"\u5DE5\u5382\u6A21\u5F0F",prop:"FType",required:""},{default:a(()=>[(F(!0),I(x,null,V(t.typeLists,(i,p)=>(F(),I("view",ot,[l(h,{modelValue:t.factoryInfo.FType,"onUpdate:modelValue":e[2]||(e[2]=D=>t.factoryInfo.FType=D),name:"FState",value:i.FValue},{default:a(()=>[d(u(i.FName),1)]),_:2},1032,["modelValue","value"])]))),128))]),_:1}),t.factoryInfo.FType=="1"?(F(),C(r,{key:0,label:"\u59D4\u6258\u5DE5\u5382",prop:"FFactoryID",required:""},{default:a(()=>[l(k,{modelValue:t.factoryInfo.FFactoryID,"onUpdate:modelValue":e[3]||(e[3]=i=>t.factoryInfo.FFactoryID=i),required:""},{default:a(()=>[(F(!0),I(x,null,V(t.factoryLists,(i,p)=>(F(),C(L,{key:"fIdx",value:i.FID+"",label:i.FName+" - "+i.FCode},null,8,["value","label"]))),128))]),_:1},8,["modelValue"])]),_:1})):q("",!0),l(r,{label:"\u8D1F\u8D23\u4EBA",prop:"FChargePerson"},{default:a(()=>[l(y,{modelValue:t.factoryInfo.FChargePerson,"onUpdate:modelValue":e[4]||(e[4]=i=>t.factoryInfo.FChargePerson=i)},null,8,["modelValue"])]),_:1}),l(r,{label:"\u624B\u673A\u53F7",prop:"FPhone"},{default:a(()=>[l(y,{modelValue:t.factoryInfo.FPhone,"onUpdate:modelValue":e[5]||(e[5]=i=>t.factoryInfo.FPhone=i)},null,8,["modelValue"])]),_:1}),l(r,{label:"\u5DE5\u5382\u72B6\u6001",prop:"FState",required:""},{default:a(()=>[(F(!0),I(x,null,V(t.stateLists,(i,p)=>(F(),I("view",lt,[l(h,{modelValue:t.factoryInfo.FState,"onUpdate:modelValue":e[6]||(e[6]=D=>t.factoryInfo.FState=D),name:"FState",value:i.FValue},{default:a(()=>[d(u(i.FName),1)]),_:2},1032,["modelValue","value"])]))),128))]),_:1}),l(r,null,{default:a(()=>[l(m,{type:"normal",onClick:c.submitClick},{default:a(()=>[d(u(t.factoryInfo.FID?"\u4FEE\u6539":"\u65B0\u589E"),1)]),_:1},8,["onClick"]),l(m,{onClick:c.cancelClick},{default:a(()=>[d("\u53D6\u6D88")]),_:1},8,["onClick"])]),_:1})]),_:1},8,["model","onClick"])}var st=O(at,[["render",nt]]);const it={components:{EditFactory:st},setup(){let o=[{title:"\u6A21\u5F0F\u540D\u79F0",key:"FName"},{title:"\u7F16\u53F7",key:"FCode"},{title:"\u6A21\u5F0F\u7C7B\u578B",key:"FTypeName"},{title:"\u59D4\u6258\u5DE5\u5382",key:"FFactoryName"},{title:"\u72B6\u6001",key:"FStateName",width:"90px"},{title:"\u521B\u5EFA\u65F6\u95F4",key:"FAddDate",width:"126px"},{title:"\u6700\u540E\u4FEE\u6539\u65F6\u95F4",key:"FEditDate",width:"186px"},{title:"\u64CD\u4F5C",key:"operator",width:"148px"}];o.forEach(p=>{p.customSlot=p.key,p.align="center"});const e=f(["1"]),s=f(!1),t=f(!0),g=f(!1),c=f({}),y=f({total:0,limit:10,current:1}),r=f([]),h=f([]),L=f([]),k=f([]),m=f(""),b=f({}),i=f({});return{factoryInfoObj:c,editBoxTitle:m,showEditBox:g,selectedKeys:e,checkbox:s,defaultToolbar:t,dataColumn:o,dataList:r,typeList:h,factoryList:k,stateList:L,pageInfo:y,searchObj:b,postData:i}},mounted(){this._getBasicList1(),this._getBasicList2(),this._getFactoryList(),this._getPageList(!0)},methods:{changePage(o){this.pageInfo.current=o.current,this.pageInfo.limit=o.limit,this._getPageList()},async _getBasicList1(){this.stateList=await S(42)||[]},async _getBasicList2(){this.typeList=await S(31)||[]},async _getFactoryList(){this.factoryList=await et()||[]},async _getPageList(o,e){this.pageInfo.total=0,o&&(this.pageInfo.current=1,this.pageInfo.total=0),this.postData.FPageIndex=this.pageInfo.current,this.postData.FPageSize=this.pageInfo.limit;let s=await Z(this.postData,"Factory");s.Data.List=s.Data.List||[],s.Data.List.forEach(t=>{let g=this.stateList.find(y=>y.FValue==t.FState);t.FStateName=g==null?"":g.FName;let c=this.typeList.find(y=>y.FValue==t.FType);if(t.FTypeName=c==null?"":c.FName,t.FType=="1"||t.FType==1){let y=this.factoryList.find(r=>r.FID==t.FFactoryID);t.FFactoryName=y==null?"":y.FName}else t.FFactoryName="/";t.FAddDate=t.FAddDate==null?"":this.dateFormat(t.FAddDate).split(" ")[0],t.FEditDate=t.FEditDate==null?"":this.dateFormat(t.FEditDate)}),this.pageInfo.total=s.Data.Total||0,this.dataList=s.Data.List},dateFormat(o){return o.replace("T"," ").split(".")[0]},_deleteFactory(o){let e=this;_.confirm("\u4F60\u786E\u5B9A\u8981\u5220\u9664\u6B64\u5DE5\u5382\u5417\uFF1F",{btn:[{text:"\u786E\u5B9A",callback:function(s){e.__deleteFactory(s,o)}},{text:"\u53D6\u6D88",callback:function(s){_.close(s)}}]})},async __deleteFactory(o,e){let s=await $(e,"Factory");_.close(o),s&&s>0?_.msg("\u64CD\u4F5C\u6210\u529F",{time:1e3,icon:1}):_.msg("\u64CD\u4F5C\u5931\u8D25",{time:1e3,icon:2}),this._getFactoryList(),this._getPageList(!0)},_changeFactory(o){o?this.editBoxTitle="\u4FEE\u6539\u5DE5\u5382":this.editBoxTitle="\u6DFB\u52A0\u5DE5\u5382",this.showEditBox=!0,this.factoryInfoObj=o||{}},cancelClick(o){this.showEditBox=!1,o&&(this._getFactoryList(),this._getPageList(!0))},_clickSearch(){this.postData={};for(let o in this.searchObj){let e=this.searchObj[o];e!=null&&e!=""&&(this.postData[o]=e)}this._getPageList(!0)},_clickReset(){this.searchObj={},this._clickSearch()}}};function rt(o,e,s,t,g,c){const y=T,r=w,h=j,L=E,k=H,m=B,b=P,i=G,p=M,D=Q,U=K("EditFactory"),v=W,A=R;return F(),C(A,{fluid:"true",style:{padding:"10px"}},{default:a(()=>[l(k,{space:"10"},{default:a(()=>[l(D,{span:"24"},{default:a(()=>[l(p,null,{default:a(()=>[l(b,{model:t.searchObj,class:"search-box"},{default:a(()=>[l(k,{class:"search-items"},{default:a(()=>[l(r,{label:"\u6A21\u5F0F\u540D\u79F0",prop:"FName"},{default:a(()=>[l(y,{modelValue:t.searchObj.FName,"onUpdate:modelValue":e[0]||(e[0]=n=>t.searchObj.FName=n)},null,8,["modelValue"])]),_:1}),l(r,{label:"\u7F16\u53F7",prop:"FCode"},{default:a(()=>[l(y,{modelValue:t.searchObj.FCode,"onUpdate:modelValue":e[1]||(e[1]=n=>t.searchObj.FCode=n)},null,8,["modelValue"])]),_:1}),l(r,{label:"\u6A21\u5F0F\u7C7B\u578B",prop:"FType"},{default:a(()=>[l(L,{modelValue:t.searchObj.FType,"onUpdate:modelValue":e[2]||(e[2]=n=>t.searchObj.FType=n)},{default:a(()=>[(F(!0),I(x,null,V(t.typeList,(n,N)=>(F(),C(h,{key:N,value:n.FValue,label:n.FName},null,8,["value","label"]))),128))]),_:1},8,["modelValue"])]),_:1}),l(r,{label:"\u72B6\u6001",prop:"FState"},{default:a(()=>[l(L,{modelValue:t.searchObj.FState,"onUpdate:modelValue":e[3]||(e[3]=n=>t.searchObj.FState=n)},{default:a(()=>[(F(!0),I(x,null,V(t.stateList,(n,N)=>(F(),C(h,{key:N,value:n.FValue,label:n.FName},null,8,["value","label"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1}),l(r,{class:"search-btn"},{default:a(()=>[l(m,{size:"sm",type:"primary",onClick:c._clickSearch},{default:a(()=>[d("\u641C\u7D22")]),_:1},8,["onClick"]),l(m,{size:"sm",onClick:c._clickReset},{default:a(()=>[d("\u91CD\u7F6E")]),_:1},8,["onClick"])]),_:1})]),_:1},8,["model"]),l(i,{columns:t.dataColumn,id:"id",dataSource:t.dataList,selectedKeys:t.selectedKeys,"onUpdate:selectedKeys":e[6]||(e[6]=n=>t.selectedKeys=n),checkbox:t.checkbox,"default-toolbar":t.defaultToolbar,page:t.dataList.length>0?t.pageInfo:null,onChange:c.changePage},{toolbar:a(()=>[l(m,{size:"sm",onClick:e[4]||(e[4]=n=>c._getPageList(!1,!0))},{default:a(()=>[d("\u5237\u65B0")]),_:1}),l(m,{size:"sm",type:"normal",onClick:e[5]||(e[5]=n=>c._changeFactory())},{default:a(()=>[d("\u65B0\u589E")]),_:1})]),FName:a(({data:n})=>[d(u(n.FName),1)]),FCode:a(({data:n})=>[d(u(n.FCode),1)]),FTypeName:a(({data:n})=>[d(u(n.FTypeName),1)]),FFactoryName:a(({data:n})=>[d(u(n.FFactoryName),1)]),FStateName:a(({data:n})=>[d(u(n.FStateName),1)]),FAddDate:a(({data:n})=>[d(u(n.FAddDate),1)]),FEditDate:a(({data:n})=>[d(u(n.FEditDate),1)]),operator:a(({data:n})=>[l(m,{size:"xs",type:"primary",onClick:N=>c._changeFactory(n)},{default:a(()=>[d(" \u7F16\u8F91 ")]),_:2},1032,["onClick"]),l(m,{size:"xs",type:"danger",onClick:N=>c._deleteFactory(n.FID)},{default:a(()=>[d("\u5220\u9664")]),_:2},1032,["onClick"])]),_:1},8,["columns","dataSource","selectedKeys","checkbox","default-toolbar","page","onChange"])]),_:1})]),_:1})]),_:1}),l(v,{area:"50%",modelValue:t.showEditBox,"onUpdate:modelValue":e[7]||(e[7]=n=>t.showEditBox=n),title:t.editBoxTitle},{default:a(()=>[l(U,{factoryInfoObj:t.factoryInfoObj,typeList:t.typeList,stateList:t.stateList,factoryList:t.factoryList,onCancelClick:c.cancelClick},null,8,["factoryInfoObj","typeList","stateList","factoryList","onCancelClick"])]),_:1},8,["modelValue","title"])]),_:1})}var pt=O(it,[["render",rt]]);export{pt as default};