1 |
- (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2d0e13d5"],{"7a1f":function(t,e,a){"use strict";a.r(e);a("99af"),a("13d5"),a("f4b3"),a("e9c4"),a("d3b7");var i=function(){var t=this,e=t._self._c;return t.table.id?e("div",[e("van-nav-bar",{staticClass:"shadow",attrs:{title:t.table.name,"left-text":"返回","left-arrow":""},on:{"click-left":function(e){return t.$router.back(-1)}}}),t.table.work_type_id?e("div",{staticClass:"shadow bg-white mb-5"},[t.table.worker_id?e("div",[e("van-cell",{attrs:{center:""},scopedSlots:t._u([{key:"title",fn:function(){return[e("div",{staticClass:"block"},[e("span",{staticStyle:{"margin-left":"6px"}},[t._v(t._s(t.table.worker_name))])])]},proxy:!0},{key:"label",fn:function(){return[e("div",{staticClass:"block"},[e("span",{staticStyle:{"margin-left":"6px"}},[t._v(t._s(t.table.work_type_name))])])]},proxy:!0},{key:"icon",fn:function(){return[e("div",{staticClass:"block"},[e("van-image",{attrs:{src:"https://image.nczyzs.com/zhiyuan-logo.png",width:"45px",height:"45px"}})],1)]},proxy:!0}],null,!1,2191901593)},[[e("span",[t._v(t._s(t.table.worker_phone)+" "),t.table.worker_phone?e("a",{attrs:{href:"tel:"+t.table.worker_phone}},[e("van-icon",{attrs:{name:"phone",size:"22",color:"#009688"}})],1):t._e()])]],2),e("div",{staticClass:"pb-2 px-4 text-right"},[e("van-button",{directives:[{name:"auth",rawName:"v-auth",value:["employee:worker:edit"],expression:"['employee:worker:edit']"}],attrs:{type:"info",size:"mini",to:"/worker/".concat(t.table.worker_id,"/edit")}},[t._v("工人信息")])],1)],1):e("van-cell",{directives:[{name:"auth",rawName:"v-auth",value:["work:dispatch:worker"],expression:"['work:dispatch:worker']"}],attrs:{to:"/table/".concat(t.table.id,"/worker?type=").concat(t.table.work_type_id)},scopedSlots:t._u([{key:"icon",fn:function(){return[e("van-icon",{staticClass:"text-gray-400",attrs:{name:"plus",size:"50px"}})]},proxy:!0}],null,!1,1374246615)},[e("div",{staticClass:"text-gray-400 text-center h-full flex justify-center items-center"},[e("span",[t._v("派单"+t._s(t.table.work_type_name))])])])],1):t._e(),e("div",{staticClass:"shadow bg-white px-5 pt-6 pb-10 leading-8"},[e("div",{staticClass:"flex flex-row"},[e("div",{staticClass:"flex-1"},[e("div",[t._v("进度: "+t._s(t.tableState[t.table.state]))])]),e("div",{staticClass:"flex-1"},[e("div",[t._v(" 合计金额: "+t._s(Math.round(t.items.reduce((function(t,e){return t+e.num*e.price}),0)))+" ")])])]),e("div",{staticClass:"flex flex-row mt-5"},[e("div",{staticClass:"flex-1"},[e("div",[t._v("工价: "+t._s(t.table.budget))])]),e("div",{staticClass:"flex-1"},[e("div",[0==t.table.state&&0!=t.table.worker_id&&0!=t.items.reduce((function(t,e){return t+e.num*e.price}),0)&&t.$store.getters.user_id==t.worksite.manager_id?e("van-button",{staticClass:"float-right ml-2",attrs:{round:"",type:"info",size:"small"},on:{click:function(e){return t.process(0)}}},[t._v("提交")]):t._e(),1==t.table.state&&t.$store.getters.user_id==t.worksite.project_leader_id?e("van-button",{staticClass:"float-right ml-2",attrs:{round:"",type:"info",size:"small"},on:{click:function(e){return t.process(1)}}},[t._v("工程队长审核")]):t._e(),0==t.table.state&&t.$store.getters.user_id==t.worksite.manager_id?e("van-button",{staticClass:"float-right ml-2",attrs:{round:"",type:"info",size:"small"},on:{click:t.addItem}},[t._v("添加项目")]):t._e()],1)])])]),e("van-tabs",{staticClass:"shadow bg-white mt-5",attrs:{swipeable:"",sticky:""},model:{value:t.activeTab,callback:function(e){t.activeTab=e},expression:"activeTab"}},[0!=t.jsonArray(t.table.image).length?e("van-tab",{attrs:{title:"详情"}},t._l(t.jsonArray(t.table.image),(function(t,a){return e("img",{key:a,attrs:{src:t}})})),0):t._e(),e("van-tab",{attrs:{title:"派单"}},[e("van-cell-group",t._l(t.orders,(function(a,i){return e("van-cell",{key:i},[[t._v(" "+t._s(t.orderState[a.state])+" ")],e("template",{slot:"title"},[t._v(" "+t._s(a.worker_name)+" ")]),e("template",{slot:"label"},[t._v(" "+t._s(a.worker_phone)+" ")])],2)})),1)],1),e("van-tab",{attrs:{title:"项目"}},[e("van-cell-group",t._l(t.items,(function(a,i){return e("van-cell",{key:i,on:{click:function(e){return t.editItem(a)}}},[[e("span",{staticClass:"block"},[t._v(t._s(a.price)+" 元/"+t._s(a.unit))]),e("span",{staticClass:"block"},[t._v("x"+t._s(a.num))])],e("template",{slot:"title"},[t._v(" "+t._s(a.name)+" ")]),e("template",{slot:"label"},[t._v(" "+t._s(a.remark)+" ")])],2)})),1)],1),0!=t.processs.length?e("van-tab",{attrs:{title:"流程"}},[e("van-cell-group",t._l(t.processs,(function(a,i){return e("van-cell",{key:i},[e("div",{staticClass:"flex justify-between items-center"},[e("div",[e("van-image",{attrs:{round:"",width:"3rem",height:"3rem",src:a.created_headimgurl?a.created_headimgurl:"https://image.nczyzs.com/zhiyuan-logo.png"}}),e("div",{staticClass:"inline-block align-top px-2"},[e("div",{staticClass:"text-base"},[t._v(t._s(a.created_name))]),e("div",{staticClass:"text-sm text-gray-400"},[t._v(" "+t._s(t.dateFormat("YYYY-mm-dd HH:MM",new Date(1e3*a.created_at)))+" ")])])],1),e("div",{staticClass:"text-right"},[e("div",{staticClass:"text-gray-600"},[t._v(" "+t._s(t.processType[a.type])+" ")]),a.type?e("div",{staticClass:"text-sm text-gray-400"},[t._v(" "+t._s(t.processState[a.state])+" ")]):t._e()])]),e("div",{staticClass:"flex justify-between items-end"},[e("div",{staticClass:"text-base text-gray-600 flex-1",staticStyle:{"white-space":"pre-wrap"}},[t._v(" "+t._s(a.explain)+" ")])]),a.signature?e("van-image",{attrs:{width:"100",height:"100",src:a.signature},on:{click:function(e){return t.openImage([a.signature])}}}):t._e(),a.pictures?e("UploadList",{attrs:{value:t.jsonArray(a.pictures),edit:!1}}):t._e()],1)})),1)],1):t._e()],1),e("van-popup",{attrs:{closeable:"",round:"",position:"bottom"},model:{value:t.itemShow,callback:function(e){t.itemShow=e},expression:"itemShow"}},[e("div",{staticClass:"mt-2 text-center leading-10 text-lg"},[t._v(" "+t._s(t.itemForm.id?"编辑项目":"添加项目")+" ")]),e("van-field",{attrs:{maxlength:"50",label:"项目名称"},model:{value:t.itemForm.name,callback:function(e){t.$set(t.itemForm,"name",e)},expression:"itemForm.name"}}),e("van-row",[e("van-col",{attrs:{span:"18"}},[e("van-field",{attrs:{type:"number",label:"单价"},model:{value:t.itemForm.price,callback:function(e){t.$set(t.itemForm,"price",e)},expression:"itemForm.price"}})],1),e("van-col",{attrs:{span:"6"}},[e("van-field",{attrs:{placeholder:"单位"},model:{value:t.itemForm.unit,callback:function(e){t.$set(t.itemForm,"unit",e)},expression:"itemForm.unit"}})],1)],1),e("van-field",{attrs:{type:"number",label:"数量"},model:{value:t.itemForm.num,callback:function(e){t.$set(t.itemForm,"num",e)},expression:"itemForm.num"}}),e("van-field",{attrs:{rows:"3",autosize:"",type:"textarea",placeholder:"请输入备注"},model:{value:t.itemForm.remark,callback:function(e){t.$set(t.itemForm,"remark",e)},expression:"itemForm.remark"}}),e("van-button",{attrs:{size:"large",type:"primary"},on:{click:t.saveItem}},[t._v("提交")])],1),e("van-popup",{attrs:{closeable:"",round:"",position:"bottom"},model:{value:t.processShow,callback:function(e){t.processShow=e},expression:"processShow"}},[e("div",{staticClass:"mt-2 text-center leading-10 text-lg"},[t._v(" "+t._s(0==t.processForm.type?"提交":"审核")+" ")]),t.processForm.type?e("van-cell",{attrs:{title:"审核"}},[e("div",{staticClass:"flex justify-end"},[e("van-radio-group",{attrs:{direction:"horizontal"},model:{value:t.processForm.state,callback:function(e){t.$set(t.processForm,"state",e)},expression:"processForm.state"}},[e("van-radio",{attrs:{name:0}},[t._v("同意")]),e("van-radio",{attrs:{name:1}},[t._v("驳回")])],1)],1)]):t._e(),e("div",{staticClass:"px-10 py-5"},[e("div",{ref:"canvasBox",staticClass:"w-full h-72 border-2 border-black"},[e("canvas",{attrs:{id:"sign"}})])]),e("van-field",{attrs:{autosize:"",type:"textarea",placeholder:"请输入说明"},model:{value:t.processForm.explain,callback:function(e){t.$set(t.processForm,"explain",e)},expression:"processForm.explain"}}),e("UploadList",{attrs:{value:t.jsonArray(t.processForm.pictures)},on:{input:function(e){t.$set(t.processForm,"pictures",JSON.stringify(e))}}}),e("van-button",{attrs:{size:"large",type:"info"},on:{click:t.saveProcess}},[t._v("提交")])],1)],1):t._e()},s=[],o=a("ade3"),n=(a("4662"),a("28a2")),r=(a("46de"),a("a822")),c=(a("4ddd"),a("9f14")),l=(a("a44c"),a("e27c")),d=(a("4d48"),a("d1e1")),m=(a("81e6"),a("9ffb")),u=(a("b64b"),a("e25e"),a("8b57")),p=a("b656"),h=a("05d8"),v=a("8941"),b=a("90e2"),f={components:Object(o["a"])(Object(o["a"])(Object(o["a"])(Object(o["a"])(Object(o["a"])(Object(o["a"])({UploadList:v["a"]},m["a"].name,m["a"]),d["a"].name,d["a"]),l["a"].name,l["a"]),c["a"].name,c["a"]),r["a"].name,r["a"]),n["a"].Component.name,n["a"].Component),data:function(){return{table:{},worksite:{},tableState:Object(o["a"])(Object(o["a"])(Object(o["a"])(Object(o["a"])(Object(o["a"])(Object(o["a"])(Object(o["a"])({},-1,"已驳回"),0,"待提交"),1,"工程队长审核"),2,"预审审核"),3,"店长审核"),4,"财务审核"),5,"已完成"),activeTab:0,items:[],itemShow:!1,itemForm:{},processs:[],processShow:!1,processForm:{},processState:{0:"通过",1:"驳回"},processType:{0:"提交",1:"工程队长审核",2:"预审审核",3:"店长审核",4:"财务审核"},orderState:{0:"待处理",1:"已接单",2:"已拒绝"},signaturePad:null,orders:[]}},created:function(){this.$route.params&&this.$route.params.id&&(this.id=parseInt(this.$route.params.id)),this.loadDispatchSiteTable(),this.loadDispatchSiteItem(),this.loadDispatchOrder()},mounted:function(){},methods:{checkAuth:p["a"],dateFormat:h["a"],formatSecond:h["b"],jsonArray:h["c"],loadDispatchOrder:function(){var t=this;this.$store.commit("loading/showLoading"),Object(u["o"])({table_id:this.id}).then((function(e){t.orders=e.data.list,t.$store.commit("loading/hideLoading")})).catch((function(){t.$store.commit("loading/hideLoading")}))},loadDispatchSiteTable:function(){var t=this;this.$store.commit("loading/showLoading"),Object(u["s"])(this.id).then((function(e){t.table=e.data,t.loadWorksite(),t.loadDispatchSiteProcess()})).catch((function(){t.$store.commit("loading/hideLoading")}))},loadDispatchSiteItem:function(){var t=this;this.$store.commit("loading/showLoading"),Object(u["p"])({table_id:this.id}).then((function(e){t.items=e.data.list,t.$store.commit("loading/hideLoading")})).catch((function(){t.$store.commit("loading/hideLoading")}))},loadDispatchSiteProcess:function(){var t=this;this.$store.commit("loading/showLoading"),Object(u["q"])({table_id:this.id,collect_id:this.table.collect_id}).then((function(e){t.processs=e.data.list,t.$store.commit("loading/hideLoading")})).catch((function(){t.$store.commit("loading/hideLoading")}))},loadWorksite:function(){var t=this;this.$store.commit("loading/showLoading"),Object(u["u"])(this.table.site_id).then((function(e){t.worksite=e.data,t.$store.commit("loading/hideLoading")})).catch((function(){t.$store.commit("loading/hideLoading")}))},addItem:function(){this.itemForm={table_id:this.id},this.itemShow=!0},editItem:function(t){0==this.table.state&&this.$store.getters.user_id==this.worksite.manager_id&&(this.itemForm=JSON.parse(JSON.stringify(t)),this.itemShow=!0)},process:function(t){var e=this;this.processForm={table_id:this.id,type:t,state:t?void 0:0},this.processShow=!0,null==this.signaturePad?this.$nextTick((function(){var t=document.getElementById("sign");e.signaturePad=new b["a"](t,{penColor:"#000000"}),t.height=e.$refs.canvasBox.clientHeight,t.width=e.$refs.canvasBox.clientWidth})):this.signaturePad.clear()},saveItem:function(){var t=this;this.$store.commit("loading/showLoading"),(this.itemForm.id?Object(u["k"])(this.itemForm.id,this.itemForm):Object(u["c"])(this.itemForm)).then((function(e){t.loadDispatchSiteItem(),t.itemShow=!1})).catch((function(){t.$store.commit("loading/hideLoading")}))},saveProcess:function(){var t=this;this.$store.commit("loading/showLoading"),Object(u["d"])(Object.assign({signature:this.signaturePad.isEmpty()?"":this.signaturePad.toDataURL()},this.processForm)).then((function(e){t.loadDispatchSiteTable(),t.processShow=!1})).catch((function(){t.$store.commit("loading/hideLoading")}))},openImage:function(t){Object(n["a"])({images:t,showIndex:!1,closeable:!0,overlayClass:"bg-white"})}}},g=f,_=a("2877"),w=Object(_["a"])(g,i,s,!1,null,null,null);e["default"]=w.exports}}]);
|