index.blade.php 114 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586
  1. @extends('layouts.app')
  2. @section('title')查询-二次加工管理@endsection
  3. @section('content')
  4. <span id="nav2">
  5. @component('process.menu')@endcomponent
  6. </span>
  7. <div class="d-none" id="process">
  8. <div class="container-fluid">
  9. <div id="form_div"></div>
  10. <span class="dropdown">
  11. <button class="btn btn-outline-dark btn-sm form-control-sm dropdown-toggle tooltipTarget"
  12. data-toggle="dropdown" title="导出所有页将会以搜索条件得到的筛选结果,将其全部记录(每一页)导出">
  13. 导出Excel
  14. </button>
  15. <div class="dropdown-menu">
  16. <a class="dropdown-item" @click="processExport(false)" href="javascript:">导出勾选内容</a>
  17. <a class="dropdown-item" @click="processExport(true)" href="javascript:">导出所有页</a>
  18. </div>
  19. </span>
  20. <!--新增教程关联-->
  21. <div style="top:25%" class="modal fade" id="addTutorial" tabindex="-1" role="dialog" aria-labelledby="addTutorial" aria-hidden="true">
  22. <div class="modal-dialog">
  23. <div class="modal-content">
  24. <div class="modal-header m-1 p-0">
  25. <button type="button" class="close pr-4" data-dismiss="modal" aria-hidden="true">&times;</button>
  26. </div>
  27. <div class="modal-body m-auto">
  28. <table class="table-sm">
  29. <tr>
  30. <th>标题</th>
  31. <th><button class="btn btn-sm btn-outline-primary" @click="addTutorial()">新增教程</button></th>
  32. </tr>
  33. <tr v-for="tutorial in processTutorial.tutorials">
  34. <td><div style="cursor:pointer;overflow: hidden;width: 200px" @click="showTutorial(tutorial.id)" :title="tutorial.name" class="text-primary">@{{tutorial.name}}</div></td>
  35. @can("二次加工管理-教程管理")<td><button @click="selectedTutorial(processTutorial.id,tutorial.id)" class="btn btn-sm btn-success pull-right">选择</button></td>@endcan
  36. </tr>
  37. </table>
  38. </div>
  39. </div><!-- /.modal-content -->
  40. </div><!-- /.modal -->
  41. </div>
  42. <!-- 显示教程-->
  43. <div class="modal fade" id="showTutorial" tabindex="-1" role="dialog" aria-labelledby="showTutorial" aria-hidden="true">
  44. <div class="modal-dialog">
  45. <div class="modal-content">
  46. <div class="modal-header">
  47. <button type="button" class="close pull-right" data-dismiss="modal" aria-hidden="true">&times;</button>
  48. </div>
  49. <div class="modal-body custom-rich-text-content" id="content"></div>
  50. <div class="modal-footer">
  51. <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
  52. </div>
  53. </div><!-- /.modal-content -->
  54. </div><!-- /.modal -->
  55. </div>
  56. <!-- 修改modal -->
  57. <div data-backdrop="static" class="modal fade" id="updateModal" tabindex="-1" role="dialog" aria-labelledby="updateModalLabel" aria-hidden="true">
  58. <div class="modal-dialog modal-dialog-centered" role="document">
  59. <div class="modal-content">
  60. <div class="modal-body">
  61. <div v-if="errors.user_id" class="row"><label class="col-3"></label><small class="text-danger col-7">@{{ errors.user_id }}</small></div>
  62. <div class="form-group row">
  63. <label for="initial_weight" class="col-3 col-form-label text-right">参与者</label>
  64. <div class="col-7">
  65. <input :class="{ 'is-invalid' : errors.user_id }" @change="verifyUserName($event,null,null,processDailyParticipantOne)" type="text" class="form-control" autocomplete="off" v-model="processDailyParticipantOne.user_detail_full_name" >
  66. </div>
  67. </div>
  68. <div v-if="errors.started_at" class="row"><label class="col-3"></label><small class="text-danger col-7">@{{ errors.started_at[0] }}</small></div>
  69. <div class="form-group row">
  70. <label for="initial_weight" class="col-3 col-form-label text-right">开始时间</label>
  71. <div class="col-7">
  72. <input :class="{ 'is-invalid' : errors.started_at }" type="time" @input="hourFilter(processDailyParticipantOne,false)" class="form-control" autocomplete="off" v-model="processDailyParticipantOne.started_at" >
  73. </div>
  74. </div>
  75. <div v-if="errors.ended_at" class="row"><label class="col-3"></label><small class="text-danger col-7">@{{ errors.ended_at[0] }}</small></div>
  76. <div class="form-group row">
  77. <label for="initial_weight" class="col-3 col-form-label text-right">结束时间</label>
  78. <div class="col-7">
  79. <input :class="{ 'is-invalid' : errors.ended_at }" type="time" @input="hourFilter(processDailyParticipantOne,false)" class="form-control" autocomplete="off" v-model="processDailyParticipantOne.ended_at" >
  80. </div>
  81. </div>
  82. <div v-if="errors.hour_price" class="row"><label class="col-3"></label><small class="text-danger col-7">@{{ errors.hour_price[0] }}</small></div>
  83. <div class="form-group row">
  84. <label for="initial_weight" class="col-3 col-form-label text-right">计时单价</label>
  85. <div class="col-7">
  86. <input :class="{ 'is-invalid' : errors.hour_price }" type="text" class="form-control" autocomplete="off" v-model="processDailyParticipantOne.hour_price" >
  87. </div>
  88. </div>
  89. <div v-if="errors.unit_price" class="row"><label class="col-3"></label><small class="text-danger col-7">@{{ errors.unit_price[0] }}</small></div>
  90. <div class="form-group row">
  91. <label for="initial_weight" class="col-3 col-form-label text-right">计件单价</label>
  92. <div class="col-7">
  93. <input :class="{ 'is-invalid' : errors.unit_price }" type="text" class="form-control" autocomplete="off" v-model="processDailyParticipantOne.unit_price" >
  94. </div>
  95. </div>
  96. <div v-if="errors.dinner_duration" class="row"><label class="col-3"></label><small class="text-danger col-7">@{{ errors.dinner_duration[0] }}</small></div>
  97. <div class="form-group row">
  98. <label for="initial_weight" class="col-3 col-form-label text-right">晚饭时间</label>
  99. <div class="col-7">
  100. <select :class="{ 'is-invalid' : errors.dinner_duration }" :data-old-value="processDailyParticipantOne.dinner_duration" v-model="processDailyParticipantOne.dinner_duration"
  101. @change="updateDinnerDuration(processDailyParticipantOne,$event)" class="form-control">
  102. <option value="0">无</option>
  103. <option value="30">30分钟</option>
  104. <option value="60">60分钟</option>
  105. </select>
  106. </div>
  107. </div>
  108. <div v-if="errors.hour_count" class="row"><label class="col-3"></label><small class="text-danger col-7">@{{ errors.hour_count[0] }}</small></div>
  109. <div class="form-group row">
  110. <label for="initial_weight" class="col-3 col-form-label text-right">计时工时</label>
  111. <div class="col-7">
  112. <input :class="{ 'is-invalid' : errors.hour_count }" type="text" class="form-control" autocomplete="off" v-model="processDailyParticipantOne.hour_count" >
  113. </div>
  114. </div>
  115. <div v-if="errors.unit_count" class="row"><label class="col-3"></label><small class="text-danger col-7">@{{ errors.unit_count[0] }}</small></div>
  116. <div class="form-group row">
  117. <label for="initial_weight" class="col-3 col-form-label text-right">计件数量</label>
  118. <div class="col-7">
  119. <input :class="{ 'is-invalid' : errors.unit_count }" type="text" class="form-control" autocomplete="off" v-model="processDailyParticipantOne.unit_count" >
  120. </div>
  121. </div>
  122. <div class="form-group row">
  123. <label for="initial_weight" class="col-3 col-form-label text-right">备注</label>
  124. <div class="col-7">
  125. <input type="text" class="form-control" autocomplete="off" v-model="processDailyParticipantOne.remark" >
  126. </div>
  127. </div>
  128. </div>
  129. <div class="modal-footer">
  130. <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
  131. @can("二次加工管理-登记工时")<button v-if="isShow.isUpdateConfirmBtn" @click="submitUpdateProcessDailyParticipant()" class="btn btn-primary">提交更改</button>@endcan
  132. </div>
  133. </div><!-- /.modal-content -->
  134. </div><!-- /.modal -->
  135. </div>
  136. <!-- 多临时工选择(Modal) -->
  137. <div data-backdrop="static" style="top:25%" class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  138. <div class="modal-dialog">
  139. <div class="modal-content" style="background-color: #d6e9f8">
  140. <div class="modal-body m-auto">
  141. <table class="table-sm">
  142. <tr>
  143. <th>姓名</th>
  144. <th>性别</th>
  145. <th>电话</th>
  146. <th>最近打卡时间</th>
  147. <th></th>
  148. </tr>
  149. <tr v-for="userLabor in userLabors" v-if="userLabor.user_labor">
  150. <td>@{{ userLabor.full_name }}</td>
  151. <td>@{{ userLabor.gender }}</td>
  152. <td>@{{ userLabor.mobile_phone }}</td>
  153. <td>@{{ userLabor.checked_at }}</td>
  154. <td><button @click="selectedUser(userLabor)" class="btn btn-sm btn-success">选择</button></td>
  155. </tr>
  156. </table>
  157. </div>
  158. </div><!-- /.modal-content -->
  159. </div><!-- /.modal -->
  160. </div>
  161. <table class="table table-sm text-nowrap table-bordered td-min-width-80" id="table">
  162. <template>
  163. <tr v-for="(processOne,i) in processes" :class="[(count(i,processes)%2===0?'row-even':'' ),selectTr===i+1?'focusing':'']" :id="processOne.id?processOne.id:processes[i-1].id+'-2'"
  164. :name="'process_table_'+count(i,processes)" @mouseover="changeStyle('process_table_'+count(i,processes),true)"
  165. @mouseout="changeStyle('process_table_'+count(i,processes),false)"
  166. @click="selectTr===i+1?(selectTr=0):selectTr=i+1">
  167. <td v-if="processOne.id" :rowspan="processOne.is_multi_row?2:''">
  168. <input class="checkItem" type="checkbox" :value="processOne.id">
  169. </td>
  170. <td v-if="processOne.id" class="text-muted" :rowspan="processOne.is_multi_row?2:''" >@{{ count(i,processes) }}</td>
  171. <td v-if="processOne.id" style="min-width:200px;" :rowspan="processOne.is_multi_row?2:''">
  172. @can("二次加工管理-审核")
  173. <button v-if="!processOne.openProcessHour && (processOne.status=='待审核' || processOne.status=='已驳回')" @mouseenter="processOne.buttonTexts.审核='审核'" @mouseleave="processOne.buttonTexts.审核='审'" class="btn btn-sm btn-outline-success" @click="audit(processOne)"><span>@{{ processOne.buttonTexts.审核 }}</span></button>@endcan
  174. @can("二次加工管理-回滚")
  175. <button v-if="!processOne.openProcessHour && processOne.status!='交接完成' && processOne.status!='待审核'" class="btn btn-sm btn-outline-dark" style="opacity: 0.65" @click="rollback(processOne.id)" @mouseenter="processOne.buttonTexts.回滚='回滚'" @mouseleave="processOne.buttonTexts.回滚='回'">@{{ processOne.buttonTexts.回滚 }}</button>@endcan
  176. @can("二次加工管理-质量验收")
  177. <button v-if="!processOne.openProcessHour && processOne.status=='待验收'" class="btn btn-sm btn-outline-success" @click="checkAndAccept(processOne)" @mouseenter="processOne.buttonTexts.质量验收='质量验收'" @mouseleave="processOne.buttonTexts.质量验收='验'">@{{processOne.buttonTexts.质量验收}}</button>@endcan
  178. @can("二次加工管理-接单与驳回")
  179. <button v-if="!processOne.openProcessHour && processOne.status=='待接单'" @click="processReject(processOne.id)" class="btn btn-sm btn-outline-dark" @mouseenter="processOne.buttonTexts.驳回='驳回'" @mouseleave="processOne.buttonTexts.驳回='驳'">@{{processOne.buttonTexts.驳回}}</button>
  180. <button v-if="(!processOne.openProcessHour && processOne.status=='待接单') && ((!processOne.designate_id) || processOne.designate_id==userId)" @click="processReceive(processOne.id,i)" class="btn btn-sm btn-outline-primary" @mouseenter="processOne.buttonTexts.接单='接单'" @mouseleave="processOne.buttonTexts.接单='接'">@{{processOne.buttonTexts.接单}}</button>@endcan
  181. @can("二次加工管理-登记工时")<button :style="[{opacity:processOne.status=='交接完成'?'0.7':''},{transform:processOne.status=='交接完成'?'scale(0.85)':''}]" v-if="(processOne.status!='待审核' && processOne.status!='已驳回' && processOne.status!='待接单') && !processOne.openProcessHour"
  182. class="btn btn-sm btn-outline-info" @click="openProcessHour(processOne);processOne.openProcessHour=true;processOne.detailFolding=false" @mouseenter="processOne.buttonTexts.登记工时='登记工时'" @mouseleave="processOne.buttonTexts.登记工时='登'">@{{processOne.buttonTexts.登记工时}}</button>
  183. <button v-if="processOne.openProcessHour" @click="closeProcessHour(processOne.id);processOne.openProcessHour=false" class="btn btn-sm btn-dark">收起登记工时</button>
  184. <button v-if="!processOne.openProcessHour && processOne.status=='加工中'" @click="processAccomplish(processOne)" class="btn btn-sm btn-outline-success" style="opacity: 0.7" @mouseenter="processOne.buttonTexts.完成='完成'" @mouseleave="processOne.buttonTexts.完成='完'">@{{processOne.buttonTexts.完成}}</button>@endcan
  185. @can("二次加工管理-交接完成")<button v-if="!processOne.openProcessHour && processOne.status=='待交接'" @click="accomplish(processOne)" class="btn btn-sm btn-outline-success" @mouseenter="processOne.buttonTexts.交接完成='交接完成'" @mouseleave="processOne.buttonTexts.交接完成='交'">@{{processOne.buttonTexts.交接完成}}</button>@endcan
  186. @can("二次加工管理-编辑")
  187. <button v-if="!processOne.openProcessHour && (processOne.status=='待审核' ||processOne.status=='待接单' || processOne.status=='已驳回' || processOne.status=='加工中' || processOne.status=='待加工')" @click="processEdit(processOne.id)" class="btn btn-sm btn-outline-info" @mouseenter="processOne.buttonTexts.编辑='编辑'"
  188. @mouseleave="processOne.buttonTexts.编辑='编'" style="opacity: 0.6">@{{processOne.buttonTexts.编辑}}</button>
  189. @endcan
  190. </td>
  191. <td v-if="processOne.id" :rowspan="processOne.is_multi_row?2:''"
  192. :class="processOne.status==='已驳回' ? 'text-danger' : (processOne.status==='交接完成' ? 'text-success font-weight-bold' : 'text-muted')">@{{ processOne.status }}</td>
  193. <td v-if="processOne.id" class="text-muted" :rowspan="processOne.is_multi_row?2:''">
  194. <button style="transform: scale(0.85);opacity: 0.8;" class="btn btn-sm btn-info" @click="show(processOne.id)" @mouseenter="processOne.buttonTexts.查看单据='查看单据'" @mouseleave="processOne.buttonTexts.查看单据='查'">@{{ processOne.buttonTexts.查看单据 }}</button>
  195. @{{ processOne.code }}
  196. </td>
  197. <td v-if="processOne.id" class="text-muted" :rowspan="processOne.is_multi_row?2:''">
  198. <a href="#" v-if="processOne.operatorLogs.length>0" class="dropdown-toggle" data-toggle="dropdown">
  199. @{{ processOne.operatorLogs[0].user_name }}<b class="caret"></b>
  200. </a>
  201. <div style="position: absolute;width:320px;margin-left:-100px;background-color: white;max-height:150px ;overflow-y:auto" class="small mt-0 dropdown-menu">
  202. <table class="table table-sm table-striped table-bordered">
  203. <tr>
  204. <th>经手人</th>
  205. <th>操作</th>
  206. <th>时间</th>
  207. </tr>
  208. <tr v-for="operatorLog in processOne.operatorLogs">
  209. <td>@{{ operatorLog.user_name }}</td>
  210. <td class="text-danger font-weight-bold">@{{ operatorLog.operation }}</td>
  211. <td>@{{ operatorLog.created_at }}</td>
  212. </tr>
  213. </table>
  214. </div>
  215. </td>
  216. <td v-if="processOne.id" class="text-muted" :rowspan="processOne.is_multi_row?2:''">@{{ processOne.owner_name }}</td>
  217. <td v-if="processOne.id" :rowspan="processOne.is_multi_row?2:''" class="font-weight-bold text-danger">@{{ processOne.process_method_name }}</td>
  218. <td v-if="processOne.id" :rowspan="processOne.is_multi_row?2:''">@{{ processOne.amount }}</td>
  219. <td v-if="processOne.id" :rowspan="processOne.is_multi_row?2:''">
  220. <div class="" v-if="processOne.tutorials" {{--style="width: 200px;overflow:auto;"--}}>
  221. <div v-if=" processOne.tutorials.length>0">
  222. <u v-if="!processOne.detailFolding" @click="showTutorial(processOne.tutorials[0].id)" class="text-info" style="cursor:pointer;">@{{processOne.tutorials[0].name}}</u>
  223. <button href="javascript:;" class="btn btn-sm btn-outline-primary" @click="processOne.detailFolding=true;processOne.openProcessHour=false;closeProcessHour(processOne.id)" v-if="!processOne.detailFolding"><a v-if="processOne.tutorials.length>1">@{{processOne.tutorials.length}}条,展开</a><a v-else>编辑</a></button>
  224. <div v-else><button class="btn btn-sm btn-outline-dark pull-left" href="javascript:;" @click="processOne.detailFolding=false" >收起编辑</button>
  225. <button @click="addTutorials(processOne.id,processOne.owner_id)" class="btn btn-sm btn-outline-info pull-left">新增关联教程</button></div>
  226. <table class="table table-sm" v-if="processOne.detailFolding">
  227. <tr>
  228. <th>标题</th>
  229. <th>操作</th>
  230. <th>创建时间</th>
  231. </tr>
  232. <tr v-for="(tutorial,i) in processOne.tutorials">
  233. <td class="text-info"><u :title="tutorial.name" @click="showTutorial(tutorial.id)" style="cursor:pointer;">@{{tutorial.name}}</u></td>
  234. <td>@can('二次加工管理-教程管理')
  235. <button @click="deleteTutorials(processOne.id,tutorial.id)" class="btn btn-sm btn-outline-danger pull-left" >删</button>
  236. @endcan</td>
  237. <td >@{{tutorial.created_at}}</td>
  238. </tr>
  239. </table>
  240. </div>
  241. <div v-if="processOne.tutorials.length<1">
  242. <button @click="addTutorials(processOne.id,processOne.owner_id)" class="btn btn-sm btn-outline-info pull-left" >新增关联教程</button>
  243. </div>
  244. </div>
  245. </td>
  246. <td v-if="processOne.id" class="text-muted" :rowspan="processOne.is_multi_row?2:''">
  247. @can('二次加工管理-修改价格')
  248. <div v-if="processOne.status=='交接完成'">
  249. <div v-if="processOne.signs.length<=0">
  250. <div v-if="processOne.is_update_unit_price" >
  251. <input type="text" :value="processOne.unit_price"
  252. :id="'unit_price_'+processOne.id" class="form-control form-control-sm" style="min-width: 50px;">
  253. <button type="button" class="btn btn-sm btn-outline-success" @click="updateUnitPrice(processOne)">确定</button>
  254. <button type="button" class="btn btn-sm btn-outline-danger" @click="processOne.is_update_unit_price=false;">取消</button>
  255. </div>
  256. <input readonly @click="processOne.is_update_unit_price=true;" v-else style="cursor: pointer;min-width: 50px" :value="processOne.unit_price" class="form-control form-control-sm">
  257. </div>
  258. <div v-else @mouseleave="processOne.is_update_unit_price=false;" @mouseenter="processOne.is_update_unit_price=true;">
  259. <span class="flicker" style="cursor: move">@{{ processOne.signUnitPrice ? processOne.signUnitPrice : processOne.unit_price }}</span>
  260. <div v-if="processOne.is_update_unit_price" style="position: absolute;width: 150px;background-color: white;white-space: normal;margin-left: -50px"
  261. @mouseleave="processOne.is_update_unit_price=false;" @mouseenter="processOne.is_update_unit_price=true;">
  262. <p class="text-center text-dark font-weight-bold">待确认</p>
  263. @can('二次加工管理-组长确认')<button v-if="!signs[processOne.code]['二次加工组确认']" class="btn btn-sm btn-outline-success" @click="verify(processOne,'workGroup')">组长确认</button>@endcan
  264. @can('二次加工管理-财务确认')<button v-if="!signs[processOne.code]['财务确认']" class="btn btn-sm btn-outline-success" @click="verify(processOne,'accountant')">财务确认</button>@endcan
  265. </div>
  266. </div>
  267. </div>
  268. <div v-else>@{{ processOne.unit_price }} </div>
  269. @endcan
  270. @cannot('二次加工管理-修改价格') @{{ processOne.unit_price }}@endcannot
  271. </td>
  272. <td v-if="processOne.id" :rowspan="processOne.is_multi_row?2:''">@{{ processOne.completed_amount }}</td>
  273. <td v-if="processOne.id" :rowspan="processOne.is_multi_row?2:''">@{{ processOne.created_at }}</td>
  274. <td style="margin:0;padding:0;position: relative;min-width: 900px">
  275. <div class="w-100" v-if="processUnfold[processOne.code+processOne.id] || processOne.processesContents.length==1 ||
  276. (processOne.is_multi_row && (processOne.processesContents.length)-(processFullSum[processOne.code])==1) || (!processOne.id && processFullSum[processOne.code]==1)">
  277. <div class="row" v-for="processesContent in processOne.processesContents"
  278. v-if="processOne.is_multi_row || !processOne.id ? !processOne.id ? processesContent.type=='成品单' :processesContent.type=='原料单' : true">
  279. <div class="col-2">@{{ processesContent.bill_type }} <span style="opacity: 0.75">(@{{ processesContent.type }})</span></div>
  280. <div class="col-2">@{{ processesContent.wms_code }}</div>
  281. <div class="col-2">@{{ processesContent.amount }}</div>
  282. <div class="col-3">
  283. <ul class="p-0 m-0 list-unstyled list-inline" v-if="processesContent.commodity && !processesContent.sign_commodity_barcode_mark">
  284. <li v-for="barcode in processesContent.commodity.barcodes"><small>@{{ barcode.code }}</small></li>
  285. </ul>
  286. <span v-if="processesContent.sign_commodity_barcode_mark">@{{ processesContent.sign_commodity_barcode_mark }}</span>
  287. </div>
  288. <div :title="processesContent.sign_commodity_name_mark?processesContent.sign_commodity_name_mark:processesContent.commodity_name" class="text-muted tooltipTarget col-3">
  289. <div style="white-space: normal">@{{ processesContent.sign_commodity_name_mark?processesContent.sign_commodity_name_mark:processesContent.commodity_name }}</div>
  290. </div>
  291. </div>
  292. <div class="row">
  293. <div class="text-center col-12 cursor-pointer">
  294. <b v-if="processUnfold[processOne.code+processOne.id]=='原料单'" @click="close(processOne.code,processOne.id)">点击关闭原料单</b>
  295. <b v-if="processUnfold[processOne.code+processOne.id]=='成品单'" @click="close(processOne.code,processOne.id)">点击关闭成品单</b></div>
  296. </div>
  297. </div>
  298. {{--<table class="table table-sm table-striped" style="margin:0;padding:0;" v-if="processUnfold[processOne.code+processOne.id] || processOne.processesContents.length==1 ||
  299. (processOne.is_multi_row && (processOne.processesContents.length)-(processFullSum[processOne.code])==1) || (!processOne.id && processFullSum[processOne.code]==1)">
  300. <tr v-for="processesContent in processOne.processesContents"
  301. v-if="processOne.is_multi_row || !processOne.id ? !processOne.id ? processesContent.type=='成品单' :processesContent.type=='原料单' : true">
  302. <td style="width: 190px" class="text-muted" :class="processesContent.type=='原料单'?'td-warm':'td-cool'">@{{ processesContent.bill_type }} <span style="opacity: 0.75">(@{{ processesContent.type }})</span></td>
  303. <td style="width: 210px" class="text-muted" :class="processesContent.type=='原料单'?'td-warm':'td-cool'">@{{ processesContent.wms_code }}</td>
  304. <td style="width: 100px" class="text-muted" :class="processesContent.type=='原料单'?'td-warm':'td-cool'">@{{ processesContent.amount }}</td>
  305. <td style="width: 180px" class="text-muted" :class="processesContent.type=='原料单'?'td-warm':'td-cool'">
  306. <ul class="p-0 m-0 list-unstyled list-inline" v-if="processesContent.commodity && !processesContent.sign_commodity_barcode_mark">
  307. <li v-for="barcode in processesContent.commodity.barcodes"><small>@{{ barcode.code }}</small></li>
  308. </ul>
  309. <span v-if="processesContent.sign_commodity_barcode_mark">@{{ processesContent.sign_commodity_barcode_mark }}</span>
  310. </td>
  311. <td :title="processesContent.sign_commodity_name_mark?processesContent.sign_commodity_name_mark:processesContent.commodity_name" class="text-muted tooltipTarget" :class="processesContent.type=='原料单'?'td-warm':'td-cool'">
  312. <div style="width: 180px;white-space: normal" :class="processesContent.bill_type=='原料单'?'td-warm':'td-cool'">@{{ processesContent.sign_commodity_name_mark?processesContent.sign_commodity_name_mark:processesContent.commodity_name }}</div></td>
  313. </tr>
  314. <tr v-if="processUnfold[processOne.code+processOne.id]">
  315. <td colspan="5">
  316. <div class="text-center">
  317. <b v-if="processUnfold[processOne.code+processOne.id]=='原料单'" style="cursor:pointer;" @click="close(processOne.code,processOne.id)">点击关闭原料单</b>
  318. <b v-if="processUnfold[processOne.code+processOne.id]=='成品单'" style="cursor:pointer;" @click="close(processOne.code,processOne.id)">点击关闭成品单</b></div>
  319. </td>
  320. </tr>
  321. </table>--}}
  322. <div v-else :style="[{background: (!processOne.id || processOne.is_multi_row) ? (!processOne.id) ? '#e8eef6' :'rgb(246, 238, 232)' : (processOne.processesContents.length>0 ? ((processOne.processesContents[0].type=='成品单') ? '#e8eef6' : 'rgb(246, 238, 232)') :'')}
  323. ,{'-webkit-transform':'scale('+(1/Math.ceil(arrayFilter(processOne.processesContents,processOne).length/2))+')'},{height: (35*Math.ceil(arrayFilter(processOne.processesContents,processOne).length/2))+'px'}
  324. ,{width: (100*Math.ceil(arrayFilter(processOne.processesContents,processOne).length/2))+'%'},{'margin-left': (-100*((Math.ceil(arrayFilter(processOne.processesContents,processOne).length/2))-1)/2)+'%'}
  325. ,{'margin-top': (-35*((Math.ceil(arrayFilter(processOne.processesContents,processOne).length/2))-1)/2)+'px'},{'margin-bottom': (-35*((Math.ceil(arrayFilter(processOne.processesContents,processOne).length/2))-1)/2)+'px'}]">
  326. <div v-for="(processesContent,i) in arrayFilter(processOne.processesContents,processOne)" class=" row p-1" style="float: left;margin-right: 10px;-webkit-transform-origin: 0" :style="[{opacity:1/0.7},
  327. {'margin-left': arrayFilter(processOne.processesContents,processOne).length >3 ? (1*parseInt(arrayFilter(processOne.processesContents,processOne).length/3))+'px' : '0px'}]">
  328. <span>@{{ processesContent.bill_type }}</span>&nbsp;&nbsp;
  329. <span>@{{ processesContent.wms_code }}</span>&nbsp;&nbsp;
  330. <span>@{{ processesContent.amount }}</span>&nbsp;&nbsp;
  331. <span v-if="processesContent.sign_commodity_barcode_mark">
  332. @{{ processesContent.sign_commodity_barcode_mark }}
  333. </span>
  334. <span v-if="!processesContent.sign_commodity_barcode_mark &&
  335. processesContent.commodity && processesContent.commodity.barcodes.length>0">
  336. @{{ processesContent.commodity.barcodes[0].code }}
  337. </span>&nbsp;&nbsp;
  338. <span :title="processesContent.sign_commodity_name_mark?processesContent.sign_commodity_name_mark:processesContent.commodity_name" class="text-muted tooltipTarget" style="max-width:100px;overflow:hidden;">@{{ processesContent.sign_commodity_name_mark?processesContent.sign_commodity_name_mark:processesContent.commodity_name }}</span>
  339. </div>
  340. </div>
  341. <div style="overflow: auto;zoom:1;position:absolute;margin-top: -35px;left:calc(50% - 50px);background-color: white" v-if="!processUnfold[processOne.code+processOne.id] && processOne.processesContents.length>1 &&
  342. ((processFullSum[processOne.code]!=processOne.processesContents.length && (processOne.processesContents.length)-(processFullSum[processOne.code])!=1 && ((processOne.is_multi_row || !processOne.id) ? (!processOne.id ? false :true) : true)) ||
  343. processFullSum[processOne.code] && processFullSum[processOne.code]>1 && ((processOne.is_multi_row || !processOne.id) ? (!processOne.id ? true :false) : true))" class="text-center">
  344. <button type="button" class="btn btn-sm btn-outline-primary" v-if="processFullSum[processOne.code]!=processOne.processesContents.length && (processOne.processesContents.length)-(processFullSum[processOne.code])!=1 && ((processOne.is_multi_row || !processOne.id) ? (!processOne.id ? false :true) : true)" @click="unfold(processOne.code,processOne.id,'原料单')">点击展开原料单</button>
  345. <button type="button" class="btn btn-sm btn-outline-primary" v-if="processFullSum[processOne.code] && processFullSum[processOne.code]>1 && ((processOne.is_multi_row || !processOne.id) ? (!processOne.id ? true :false) : true)" @click="unfold(processOne.code,processOne.id,'成品单')">点击展开成品单</button></div>
  346. </td>
  347. <td v-if="processOne.id" class="text-muted" :rowspan="processOne.is_multi_row?2:''"><div style="min-width: 250px;white-space: normal">@{{ processOne.remark }}</div></td>
  348. <td v-if="processOne.id" class="text-muted" :rowspan="processOne.is_multi_row?2:''"><div style="min-width: 250px;white-space: normal">@{{ processOne.balance_remark }}</div></td>
  349. <td v-if="processOne.id" class="text-muted" :rowspan="processOne.is_multi_row?2:''">
  350. @can('二次加工管理-删除')<button type="button" class="btn btn-sm btn-outline-danger" @click="destroy(processOne.code,processOne.id)">删</button>@endcan
  351. </td>
  352. </tr>
  353. <tr id="addProcessDailyParticipants" v-show="processDailyParticipants.length>0">
  354. <td colspan="2"></td>
  355. <td colspan="16">
  356. <table class="table-sm table-bordered table-condensed">
  357. <tr class="text-success">
  358. <td>
  359. <button v-if="!is_update_date" @click="is_update_date='start_date';date=''"
  360. @mouseenter="dateTextMap.start_date='设定起始日期'" @mouseleave="dateTextMap.start_date='起'"
  361. type="button" class="btn btn-sm btn-outline-primary">@{{ dateTextMap.start_date }}</button>
  362. <button v-if="!is_update_date" @click="is_update_date='end_date';date=''" type="button"
  363. @mouseenter="dateTextMap.end_date='设定终止日期'" @mouseleave="dateTextMap.end_date='终'"
  364. class="btn btn-sm btn-outline-dark">@{{ dateTextMap.end_date }}</button>
  365. <div v-if="is_update_date">
  366. <input type="date" class="form-control form-control-sm" :class="is_update_date=='start_date' ? 'text-info border-info':''"
  367. style="width: 137px" v-model="date" :max="is_update_date=='start_date'&&processDailyParticipants.length>0 ? processDailyParticipants[0].date : ''"
  368. :min="is_update_date=='end_date'&&processDailyParticipants.length>0 ? processDailyParticipants[(processDailyParticipants.length)-1].date : ''">
  369. <button type="button" @click="update_process_date(processDailyParticipants[0])" class="btn btn-sm btn-outline-success">确定</button>
  370. <button type="button" @click="is_update_date='';dateTextMap.end_date='终';dateTextMap.start_date='起'" class="btn btn-sm btn-outline-danger">取消</button>
  371. </div>
  372. </td>
  373. <td>当日产量</td>
  374. <td>当日剩余</td>
  375. <td colspan="2">操作</td>
  376. <td>参与者</td>
  377. <td>开始时间</td>
  378. <td>结束时间</td>
  379. <td>计时单价</td>
  380. <td>计件单价</td>
  381. <td>晚饭时间</td>
  382. <td>计时工时</td>
  383. <td>计件数量</td>
  384. <td>备注</td>
  385. <td>当日工资</td>
  386. {{--<td>审核</td>--}}
  387. <td>操作</td>
  388. </tr>
  389. <tr v-for="(processDailyParticipant,i) in processDailyParticipants" :id="'processDailyParticipant'+processDailyParticipant.id">
  390. <td v-if="processDailyParticipant.rowspan" :rowspan="processDailyParticipant.rowspan"><p >@{{ processDailyParticipant.date }}</p></td>
  391. <td v-if="processDailyParticipant.rowspan" :rowspan="processDailyParticipant.rowspan">
  392. <div class="form-inline">
  393. <input :readonly="processDailyParticipant.readonly" v-model="processDailyParticipant.submitOutput"
  394. class="form-control col-sm-5 " @click="updateOutput(processDailyParticipant)" type="text" />
  395. @can("二次加工管理-登记工时")<button class="btn btn-sm btn-success" v-if="! processDailyParticipant.readonly" @click="submitOutputData(processDailyParticipant.daily_id,processDailyParticipant.submitOutput,processDailyParticipant.id)">确定</button>
  396. <button class="btn btn-sm btn-danger" v-if="! processDailyParticipant.readonly" @click="processDailyParticipant.readonly=true;processDailyParticipant.submitOutput=processDailyParticipant.output">取消</button>
  397. @endcan
  398. </div>
  399. </td>
  400. <td v-if="processDailyParticipant.rowspan" :rowspan="processDailyParticipant.rowspan"><p >@{{ processDailyParticipant.remain }}</p></td>
  401. <td v-if="processDailyParticipant.rowspan" :rowspan="processDailyParticipant.rowspan">
  402. @can("二次加工管理-登记工时")<button v-if="processDailyParticipant.isAddProcessDailyParticipant && isShow.isAddProcessDailyParticipant" class="btn btn-sm btn-outline-info" @click="addProcessDailyParticipant(processDailyParticipant);processDailyParticipant.isAddProcessDailyParticipant=false;">新增</button>
  403. <button v-if="!processDailyParticipant.isAddProcessDailyParticipant" class="btn btn-sm btn-danger"
  404. @click="deleteProcessDailyParticipant($event,processDailyParticipant.daily_id,processDailyParticipant.user_detail_full_name,processDailyParticipant.isConfirmBtn);processDailyParticipant.isAddProcessDailyParticipant=true;">取消</button>
  405. @endcan
  406. </td>
  407. <td>
  408. @can("二次加工管理-登记工时")<button v-if="!processDailyParticipant.isAddProcessDailyParticipant && processDailyParticipant.isConfirmBtn" class="btn btn-sm btn-success" @click="submitProcessDailyParticipant(processDailyParticipant.daily_id)">确定</button>
  409. <button v-if="processDailyParticipant.id" class="btn btn-sm btn-outline-info" @click="updateProcessDailyParticipant(processDailyParticipant)">改</button>
  410. @endcan
  411. </td>
  412. <td>
  413. <span v-if="!processDailyParticipant.user_detail_full_name && processDailyParticipant.isAddProcessDailyParticipant==false" >
  414. <input :class="{ 'is-invalid' : errors.user_id }" :data-original-title="errors.user_id ? errors.user_id : ''" :id="processDailyParticipant.daily_id+'user_detail_full_name'" class="form-control tooltipTargetError" style="width: 100px" type="text" @change="verifyUserName($event,processDailyParticipant.daily_id,processDailyParticipant.isConfirmBtn,processDailyParticipant)">
  415. <input hidden :id="processDailyParticipant.daily_id+'user_id'"/>
  416. </span><span v-else>@{{ processDailyParticipant.user_detail_full_name }}</span></td>
  417. <td>
  418. <span v-if="!processDailyParticipant.user_detail_full_name && processDailyParticipant.isAddProcessDailyParticipant==false" >
  419. <input :class="{ 'is-invalid' : errors.started_at }" :data-original-title="errors.started_at ? errors.started_at[0] : ''" :id="processDailyParticipant.daily_id+'started_at'" value="09:00" class="form-control tooltipTargetError" style="width:120px" type="time" @input="hourFilter(processDailyParticipant.daily_id,true)">
  420. </span><span v-else> @{{ processDailyParticipant.started_at }}</span></td>
  421. <td>
  422. <span v-if="!processDailyParticipant.user_detail_full_name && processDailyParticipant.isAddProcessDailyParticipant==false" >
  423. <input :class="{ 'is-invalid' : errors.ended_at }" :data-original-title="errors.ended_at ? errors.ended_at[0] : ''" :id="processDailyParticipant.daily_id+'ended_at'" value="18:00" class="form-control tooltipTargetError" style="width:120px" type="time" @input="hourFilter(processDailyParticipant.daily_id,true)">
  424. </span><span v-else> @{{ processDailyParticipant.ended_at }}</span></td>
  425. <td><span v-if="!processDailyParticipant.user_detail_full_name && processDailyParticipant.isAddProcessDailyParticipant==false">
  426. <input :class="{ 'is-invalid' : errors.hour_price }" :data-original-title="errors.hour_price ? errors.hour_price[0] : ''" :id="processDailyParticipant.daily_id+'hour_price'" class="form-control tooltipTargetError" style="width:70px" type="text">
  427. </span><span v-else>@{{ processDailyParticipant.hour_price }}</span></td>
  428. <td>
  429. <span v-if="!processDailyParticipant.user_detail_full_name && processDailyParticipant.isAddProcessDailyParticipant==false">
  430. <input :class="{ 'is-invalid' : errors.unit_price }" :data-original-title="errors.unit_price ? errors.unit_price[0] : ''" :id="processDailyParticipant.daily_id+'unit_price'" class="form-control tooltipTargetError" style="width:70px" type="text">
  431. </span><span v-else>@{{ processDailyParticipant.unit_price }}</span></td>
  432. <td>
  433. <span v-if="!processDailyParticipant.user_detail_full_name && processDailyParticipant.isAddProcessDailyParticipant==false">
  434. <select :class="{ 'is-invalid' : errors.dinner_duration }" @input="hourFilter(processDailyParticipant.daily_id,true)" :data-original-title="errors.dinner_duration ? errors.dinner_duration[0] : ''"
  435. :id="processDailyParticipant.daily_id+'dinner_duration'" class="form-control tooltipTargetError" style="width:80px">
  436. <option value="0">无</option>
  437. <option value="30">30分钟</option>
  438. <option value="60">60分钟</option>
  439. </select>
  440. </span><span v-else>@{{ processDailyParticipant.dinner_duration }}</span></td>
  441. <td>
  442. <span v-if="!processDailyParticipant.user_detail_full_name && processDailyParticipant.isAddProcessDailyParticipant==false">
  443. <input :class="{ 'is-invalid' : errors.hour_count }" :data-original-title="errors.hour_count ? errors.hour_count[0] : ''" :id="processDailyParticipant.daily_id+'hour_count'" :value="processDailyParticipant.hour_count?processDailyParticipant.hour_count:8" class="form-control tooltipTargetError" style="width:70px" type="text" >
  444. </span><span v-else>@{{ processDailyParticipant.hour_count }}</span></td>
  445. <td>
  446. <span v-if="!processDailyParticipant.user_detail_full_name && processDailyParticipant.isAddProcessDailyParticipant==false">
  447. <input :class="{ 'is-invalid' : errors.unit_count }" :data-original-title="errors.unit_count ? errors.unit_count[0] : ''" :id="processDailyParticipant.daily_id+'unit_count'" class="form-control tooltipTargetError" style="width:70px" type="text">
  448. </span><span v-else>@{{ processDailyParticipant.unit_count }}</span></td>
  449. <td>
  450. <span v-if="!processDailyParticipant.user_detail_full_name && processDailyParticipant.isAddProcessDailyParticipant==false">
  451. <input :id="processDailyParticipant.daily_id+'remark'" class="form-control" style="width: 100px" type="text">
  452. </span><span v-else>@{{ processDailyParticipant.remark }}</span></td>
  453. <td class="text-danger">
  454. <div v-if="processDailyParticipant.unit_count || processDailyParticipant.hour_count">
  455. <span v-if="processDailyParticipant.unit_count">@{{ (processDailyParticipant.unit_count)*(processDailyParticipant.unit_price) }}</span>
  456. <span v-else>@{{ (processDailyParticipant.hour_count)*(processDailyParticipant.hour_price) }}</span>
  457. </div>
  458. </td>
  459. <td>
  460. <div v-if="processDailyParticipant.user_detail_full_name">
  461. @can("二次加工管理-临时工资料管理")<u class="text-info" style="cursor:pointer"
  462. @click="showUserDetail(processDailyParticipant.user_id)">详情</u>@endcan
  463. <button class="btn btn-sm btn-outline-danger" @click="deleteDailyParticipant(i)">删</button>
  464. </div>
  465. </td>
  466. </tr>
  467. </table>
  468. </td>
  469. </tr>
  470. </template>
  471. </table>
  472. {{$processes->appends($paginateParams)->links()}}
  473. </div>
  474. </div>
  475. @endsection
  476. @section('lastScript')
  477. <script type="text/javascript" src="{{mix('js/queryForm/export.js')}}"></script>
  478. <script type="text/javascript" src="{{mix('js/queryForm/queryForm.js')}}"></script>
  479. <script type="text/javascript" src="{{mix('js/queryForm/header.js')}}"></script>{{--新版2--}}
  480. <script>
  481. let vue = new Vue({
  482. el:"#process",
  483. data:{
  484. participantInputting:{},
  485. processes:[
  486. @foreach($processes as $processOne)
  487. {id:'{{$processOne->id}}',code:'{{$processOne->code}}',owner_name:'{{$processOne->owner_name}}',owner_id:'{{$processOne->owner_id}}',operatorLogs:{!! $processOne->operatorLogs !!},
  488. process_method_name:'{{$processOne->process_method_name}}',amount:'{{$processOne->amount}}',type:'{{$processOne->type}}',signs:{!!$processOne->signs !!},signUnitPrice:'{{$processOne->signUnitPrice ? $processOne->signUnitPrice->mark :''}}'
  489. ,tutorials:{!! $processOne->tutorials !!},processesContents:{!! $processOne->processesContents !!},unit_price:'{{$processOne->unit_price}}',created_at:'{{$processOne->created_at}}',
  490. completed_amount:'{{$processOne->completed_amount}}',status:'{{$processOne->status}}',remark:'{{preg_replace("/\s/",' ',$processOne->remark)}}',
  491. balance_remark:'{{preg_replace("/\s/",' ',$processOne->balance_remark)}}',
  492. designate_id:"{{$processOne->designate_id}}",
  493. detailFolding:false,openProcessHour:false,is_multi_row:false,is_verifier_show:false,is_update_unit_price:false,
  494. buttonTexts:{'审核':'审','回滚':'回','编辑':'编','接单':'接','驳回':'驳','质量验收':'验','完成':'完','交接完成':'交','查看单据':'查','登记工时':'登'},
  495. },
  496. @endforeach
  497. ],
  498. userId:"{{\Illuminate\Support\Facades\Auth::id()}}",
  499. processesList:[],
  500. owners:[
  501. @foreach($owners as $owner)
  502. { name:'{{$owner->id}}',value:'{{$owner->name}}'},
  503. @endforeach
  504. ],
  505. status:[
  506. {name:'待审核',value:'待审核'},{name:'待接单',value:'待接单'},{name:'待加工',value:'待加工'},
  507. {name:'已驳回',value:'已驳回'},{name:'加工中',value:'加工中'},{name:'待验收',value:'待验收'},
  508. {name:'交接完成',value:'交接完成'},
  509. ],
  510. errors:{},
  511. processDailies:[],
  512. processDailyParticipants:[],
  513. isShow:{
  514. isOpenProcessHour:false,isAddProcessDailyParticipant:true,isUpdateConfirmBtn:true,
  515. },
  516. userLabors:[],
  517. modalDaily_id:'',
  518. processDailyParticipantOne:{id:'',user_id:'',user_detail_full_name:'',started_at:"",ended_at:"",
  519. hour_price:'',unit_price:'',dinner_duration:'',hour_count:'',unit_count:'',remark:''},
  520. processTutorial:{id:'',owner_id:'',tutorials:[],},
  521. processUnfold:[],
  522. processFullSum:[],
  523. signs:[],
  524. is_update_date:false,
  525. date:'',
  526. dateTextMap:{'start_date':'起','end_date':'终'},
  527. sum:{!! $processes->total() !!},
  528. selectTr:''
  529. },
  530. mounted:function () {
  531. this.resetProcessData();
  532. $(".tooltipTarget").tooltip({'trigger': 'hover'});
  533. $('#process').removeClass('d-none');
  534. let data=[
  535. [
  536. {name: 'date_start', type: 'dateTime', tip: '选择显示指定日期的起始时间'},
  537. {
  538. name: 'owner_id', type: 'select_multiple_select', tip: ['输入关键词快速定位下拉列表,回车确定', '选择要显示的客户'],
  539. placeholder: ['货主', '定位或多选货主'], data: this.owners
  540. },
  541. {name: 'wms_code', type: 'input', tip: '可支持多单据号,模糊搜索可在两侧增加百分号(%)进行', placeholder: '单据号'},
  542. {name: 'status', type: 'select', placeholder: '状态', data: this.status},
  543. ],
  544. [
  545. {name: 'date_end', type: 'dateTime', tip: '选择显示指定日期的结束时间'},
  546. {name: 'commodity_barcode', type: 'input', tip: '可支持多商品条码,模糊搜索可在两侧增加百分号(%)进行', placeholder: '商品条码'},
  547. {name: 'code', type: 'input', tip: '可支持多任务号,模糊搜索可在两侧增加百分号(%)进行', placeholder: '任务号'},
  548. {name: 'is_accomplish', type: 'checkbox', data: [{name: 'sign', value: '显示交接完成的记录'}]},
  549. ],
  550. ];
  551. this.form = new query({
  552. el: "#form_div",
  553. condition: data,
  554. });
  555. this.form.init();
  556. let column = [
  557. {name:'index',value: '序号', neglect: true},
  558. {name:'operation',value: '操作', neglect: true},
  559. {name: 'status', value: '状态'},
  560. {name: 'code', value: '任务号'},
  561. {name:'person',value: '经手人', neglect: true},
  562. {name: 'owner_name', value: '货主'},
  563. {name: 'process_method_name', value: '加工类型'},
  564. {name: 'amount', value: '预期数量'},
  565. {name:'tutorial',value: '教程', neglect: true},
  566. {name: 'unit_price', value: '单价'},
  567. {name: 'completed_amount', value: '完成数量'},
  568. {name: 'created_at', value: '提交日期'},
  569. {name:"items",type:"multi",title:"单据信息",rows:[
  570. {value:"单据类型",col:"2"},
  571. {value:"单据号",col:"2"},
  572. {value:"本单数量",col:"2"},
  573. {value:"商品条码",col:"3"},
  574. {value:"商品名称",col:"3"},
  575. ]},
  576. {name:'remark', value: '加工备注'},
  577. {name:'balance_remark', value: '结算备注'},
  578. {name:'remove',value: '', neglect: true},
  579. ];
  580. new Header({
  581. el: "table",
  582. name: "process",
  583. column: column,
  584. data: this.processes,
  585. restorationColumn: 'serial_number',
  586. fixedTop:($('#form_div').height())+2,
  587. is_restorationColumn_asc :true,
  588. isForbidDrag:true,
  589. }).init();
  590. },
  591. methods: {
  592. arrayFilter: function (processesContents, process) {
  593. if (!process.is_multi_row && process.id) return processesContents;
  594. let array = [];
  595. let type = '成品单';
  596. if (process.id) type = '原料单';
  597. processesContents.forEach(function (processesContent) {
  598. if (processesContent.type === type) array.push(processesContent);
  599. });
  600. return array;
  601. },
  602. //重组数据
  603. resetProcessData: function () {
  604. let _this = this;
  605. let indexs = [];
  606. let count = 0;
  607. for (let i = 0; i < this.processes.length; i++) {
  608. let process = this.processes[i];
  609. _this.$set(_this.signs,process.code,[]);
  610. process.signs.forEach(function (sign) {
  611. _this.$set(_this.signs[process.code],sign.mark,true);
  612. });
  613. process.serial_number = count;
  614. process.processesContents.every(function (processesContent) {
  615. if (processesContent.type === '成品单') _this.$set(_this.processFullSum, process.code, _this.processFullSum[process.code] ? _this.processFullSum[process.code] + 1 : 1);
  616. return true;
  617. });
  618. if (_this.processFullSum[process.code] && _this.processFullSum[process.code] !== 0 && _this.processFullSum[process.code] !== process.processesContents.length) {
  619. indexs.unshift(i);
  620. count++;
  621. process.is_multi_row = true;
  622. }
  623. count++;
  624. }
  625. indexs.forEach(function (index) {
  626. let processTemp = Object.assign({}, _this.processes[index]);
  627. processTemp.id = '';
  628. processTemp.is_multi_row = false;count++;
  629. processTemp.serial_number = _this.processes[index].serial_number + 1;
  630. _this.processes.splice(index + 1, 0, processTemp);
  631. });
  632. },
  633. //导出excel
  634. processExport(checkAllSign) {
  635. let url = '{{url('process/export')}}';
  636. let token='{{ csrf_token() }}';
  637. //excelExport 定义在 js/queryForm/export.js
  638. excelExport(checkAllSign,checkData,url,this.sum,token);
  639. },
  640. //获取登记工时
  641. openProcessHour(process) {
  642. let e = process.id;
  643. let _this = this;
  644. if (_this.isShow.isOpenProcessHour) {
  645. _this.processes.every(function (process) {
  646. if (process.openProcessHour) {
  647. process.openProcessHour = false;
  648. return false;
  649. }
  650. return true;
  651. });
  652. } else {
  653. _this.isShow.isOpenProcessHour = true;
  654. }
  655. axios.post("{{url("process/getDailyParticipant")}}", {id: e, amount: process.amount})
  656. .then(function (response) {
  657. let processDailies = response.data;
  658. _this.resetProcessDaily(processDailies,e);
  659. }).catch(function (err) {
  660. tempTip.setDuration(5000);
  661. tempTip.show('获取登记工时数据发生了一些严重错误:' + err);
  662. });
  663. let processDailyParticipantsHtml = $("#addProcessDailyParticipants");
  664. if (process.is_multi_row) $("#" + e + "-2").after(processDailyParticipantsHtml);
  665. else $("#" + e).after(processDailyParticipantsHtml)
  666. },
  667. //重组加工单加工日记录数据
  668. resetProcessDaily(processDailies,process_id){
  669. let _this=this;
  670. _this.processDailies = [];
  671. _this.processDailyParticipants = [];
  672. for (let i = 0; i < processDailies.length; i++) {
  673. let processDailyParticipants = processDailies[i].process_daily_participants;
  674. if (processDailyParticipants.length <= 0) {
  675. let data = {};
  676. data['process_id'] = process_id;
  677. data['daily_id'] = processDailies[i].id;
  678. data['date'] = processDailies[i].date;
  679. data['output'] = processDailies[i].output;
  680. data['remain'] = processDailies[i].remain;
  681. data['rowspan'] = 1;
  682. data['readonly'] = "true";
  683. data['isAddProcessDailyParticipant'] = "true";
  684. data['isConfirmBtn'] = "true";
  685. data['submitOutput'] = processDailies[i].output;
  686. _this.processDailyParticipants.push(data);
  687. continue;
  688. }
  689. for (let j = 0; j < processDailyParticipants.length; j++) {
  690. let data = {};
  691. data['id'] = processDailyParticipants[j].id;
  692. data['status'] = processDailyParticipants[j].status;
  693. data['started_at'] = processDailyParticipants[j].started_at;
  694. data['user_detail_full_name'] = processDailyParticipants[j].user_detail_full_name;
  695. data['user_id'] = processDailyParticipants[j].user_id;
  696. data['ended_at'] = processDailyParticipants[j].ended_at;
  697. data['hour_price'] = processDailyParticipants[j].hour_price;
  698. data['unit_price'] = processDailyParticipants[j].unit_price;
  699. data['dinner_duration'] = processDailyParticipants[j].dinner_duration;
  700. data['hour_count'] = processDailyParticipants[j].hour_count;
  701. data['remark'] = processDailyParticipants[j].remark;
  702. data['hour'] = processDailyParticipants[j].hour;
  703. data['diff'] = processDailyParticipants[j].diff;
  704. data['billingHour'] = processDailyParticipants[j].billingHour;
  705. data['unit_count'] = processDailyParticipants[j].unit_count;
  706. data['process_id'] = processDailies[i].process_id;
  707. data['readonly'] = "true";
  708. if (!_this.processDailies[processDailies[i].id]) {
  709. data['rowspan'] = processDailyParticipants.length;
  710. data['process_id'] = process_id;
  711. data['daily_id'] = processDailies[i].id;
  712. data['date'] = processDailies[i].date;
  713. data['output'] = processDailies[i].output;
  714. data['remain'] = processDailies[i].remain;
  715. data['submitOutput'] = processDailies[i].output;
  716. data['isAddProcessDailyParticipant'] = "true";
  717. data['isConfirmBtn'] = "true";
  718. _this.processDailies[processDailies[i].id] = processDailies[i].id;
  719. }
  720. _this.processDailyParticipants.push(data);
  721. }
  722. }
  723. },
  724. //删除工时显示
  725. closeProcessHour(e) {
  726. this.processDailies = [];
  727. this.processDailyParticipants = [];
  728. },
  729. //新增参与人
  730. addProcessDailyParticipant(processDailyParticipantOne) {
  731. let id = processDailyParticipantOne.id;
  732. if (!id) return;
  733. let _this = this;
  734. _this.errors = {};
  735. this.processDailyParticipants.every(function (processDailyParticipant, i) {
  736. if (processDailyParticipant.id == id) {
  737. processDailyParticipant.rowspan++;
  738. let data = {};
  739. data['readonly'] = "true";
  740. data['isAddProcessDailyParticipant'] = "true";
  741. data['isConfirmBtn'] = "true";
  742. data['id'] = processDailyParticipant.id;
  743. data['user_id'] = processDailyParticipant.user_id;
  744. data['status'] = processDailyParticipant.status;
  745. data['started_at'] = processDailyParticipant.started_at;
  746. data['user_detail_full_name'] = processDailyParticipant.user_detail_full_name;
  747. data['ended_at'] = processDailyParticipant.ended_at;
  748. data['hour_price'] = processDailyParticipant.hour_price;
  749. data['unit_price'] = processDailyParticipant.unit_price;
  750. data['dinner_duration'] = processDailyParticipant.dinner_duration;
  751. data['hour_count'] = processDailyParticipant.hour_count;
  752. data['remark'] = processDailyParticipant.remark;
  753. data['hour'] = processDailyParticipant.hour;
  754. data['diff'] = processDailyParticipant.diff;
  755. data['billingHour'] = processDailyParticipant.billingHour;
  756. data['unit_count'] = processDailyParticipant.unit_count;
  757. data['process_id'] = processDailyParticipant.process_id;
  758. _this.processDailyParticipants.splice(i + 1, 0, data);
  759. processDailyParticipant.id = '';
  760. processDailyParticipant.status = '';
  761. processDailyParticipant.started_at = '';
  762. processDailyParticipant.user_detail_full_name = '';
  763. processDailyParticipant.ended_at = '';
  764. processDailyParticipant.hour_price = '';
  765. processDailyParticipant.unit_price = '';
  766. processDailyParticipant.dinner_duration = '';
  767. processDailyParticipant.hour_count = '';
  768. processDailyParticipant.remark = '';
  769. processDailyParticipant.hour = '';
  770. processDailyParticipant.diff = '';
  771. processDailyParticipant.billingHour = '';
  772. processDailyParticipant.unit_count = '';
  773. processDailyParticipant.process_id = '';
  774. return false;
  775. }
  776. return true;
  777. });
  778. _this.isShow.isAddProcessDailyParticipant = false;
  779. },
  780. //取消录入参与人
  781. deleteProcessDailyParticipant($event, daily_id, processDailyParticipant_name, isConfirmBtn) {
  782. if (!isConfirmBtn) {
  783. this.processDailyParticipants.every(function (processDailyParticipant) {
  784. if (processDailyParticipant.daily_id == daily_id) {
  785. processDailyParticipant.isConfirmBtn = true; //放出隐藏确定按钮
  786. return false;
  787. }
  788. return true;
  789. });
  790. }
  791. let _this = this;
  792. this.processDailyParticipants.every(function (processDailyParticipant, i) {
  793. if (processDailyParticipant.daily_id == daily_id) {
  794. if (!processDailyParticipant_name && _this.processDailyParticipants[i + 1] && _this.processDailyParticipants[i + 1].daily_id) return false;
  795. if (!_this.processDailyParticipants[i + 1]) return false;
  796. _this.processDailyParticipants[i + 1].rowspan = (processDailyParticipant.rowspan) - 1;
  797. _this.processDailyParticipants[i + 1].daily_id = processDailyParticipant.daily_id;
  798. _this.processDailyParticipants[i + 1].date = processDailyParticipant.date;
  799. _this.processDailyParticipants[i + 1].output = processDailyParticipant.output;
  800. _this.processDailyParticipants[i + 1].remain = processDailyParticipant.remain;
  801. _this.processDailyParticipants[i + 1].submitOutput = processDailyParticipant.submitOutput;
  802. _this.processDailyParticipants.splice(i, 1);
  803. return false;
  804. }
  805. return true;
  806. });
  807. _this.isShow.isAddProcessDailyParticipant = true;
  808. },
  809. //驳回
  810. processReject(id) {
  811. if (!confirm('确定驳回该单吗?')) {
  812. return
  813. }
  814. ;
  815. let url = "{{url('process/reject')}}" + "/" + id;
  816. let _this = this;
  817. axios.post(url)
  818. .then(function (response) {
  819. _this.processes.every(function (process) {
  820. if (process.id == response.data.id) {
  821. process.status = response.data.status;
  822. return false;
  823. }
  824. return true;
  825. });
  826. tempTip.setDuration(3000);
  827. tempTip.showSuccess('驳回成功!');
  828. }).catch(function (err) {
  829. tempTip.setDuration(5000);
  830. tempTip.show('驳回二次加工单发生了一些严重错误:' + err);
  831. })
  832. },
  833. //接单
  834. processReceive(id,index) {
  835. let url = "{{url('process/receive')}}" + "/" + id;
  836. window.tempTip.postBasicRequest(url,{},res=>{
  837. this.processes[index].status = res;
  838. return "接单成功";
  839. });
  840. },
  841. //完成
  842. processAccomplish(process) {
  843. if (!confirm('确定标记为加工完成吗?'))return
  844. axios.post('{{url('process/processAccomplish')}}', {id: process.id})
  845. .then(function (response) {
  846. if (response.data.success) {
  847. process.status = response.data.data;
  848. tempTip.setDuration(2000);
  849. tempTip.showSuccess('“' + process.code + '”已被标记为加工完成!');
  850. return;
  851. }
  852. tempTip.setDuration(3000);
  853. tempTip.show('未知错误,联系管理员解决!');
  854. }).catch(function (err) {
  855. tempTip.setDuration(3000);
  856. tempTip.show('网络错误:' + err);
  857. })
  858. },
  859. accomplish(process) {
  860. if (!confirm('确定“' + process.code + '”交接完成吗?')) {
  861. return
  862. }
  863. ;
  864. let url = "{{url('process/accomplish')}}";
  865. axios.post(url, {id: process.id})
  866. .then(function (response) {
  867. if (response.data.success) {
  868. process.status = response.data.data;
  869. tempTip.setDuration(2000);
  870. tempTip.showSuccess('交接完成!');
  871. return;
  872. }
  873. tempTip.setDuration(3000);
  874. tempTip.show(response.data.data);
  875. }).catch(function (err) {
  876. tempTip.setDuration(3000);
  877. tempTip.show('网络错误:' + err);
  878. })
  879. },
  880. //修改每日产量
  881. submitOutputData(daily_id, data, id) {
  882. let url = "{{url('process/updateDailyOutput')}}";
  883. let _this = this;
  884. axios.post(url, {id: daily_id, output: data})
  885. .then(function (response) {
  886. if (response.data.status == "error") {
  887. tempTip.setDuration(3000);
  888. tempTip.show('输入有误:' + response.data.data.output);
  889. }
  890. if (response.data.status == "success") {
  891. let processDailies = response.data.data;
  892. _this.processDailyParticipants.every(function (processDailyParticipant) {
  893. if (processDailyParticipant.id == id) {
  894. processDailyParticipant.readonly = true;
  895. }
  896. processDailies.every(function (processDaily) {
  897. if (processDailyParticipant.date == processDaily.date) {
  898. processDailyParticipant.output = processDaily.output;
  899. processDailyParticipant.remain = processDaily.remain;
  900. return false;
  901. }
  902. return true;
  903. });
  904. return true;
  905. });
  906. if (response.data.process) {
  907. _this.processes.every(function (process) {
  908. if (process.id == response.data.process) {
  909. process.status = "待验收";
  910. return false;
  911. }
  912. return true;
  913. });
  914. }
  915. tempTip.setDuration(3000);
  916. tempTip.showSuccess('每日产量修改成功!');
  917. }
  918. }).catch(function (err) {
  919. tempTip.setDuration(5000);
  920. tempTip.show('修改每日产量发生了一些严重错误:' + err);
  921. });
  922. },
  923. //验证临时工
  924. verifyUserName(e, daily_id, isConfirmBtn,processDailyParticipant) {
  925. let user = e.target.value;
  926. let _this = this;
  927. axios.post('{{url('process/verifyUserName')}}',
  928. {userName: user,id:processDailyParticipant.id,date:processDailyParticipant.date})
  929. .then(function (response) {
  930. if (!response.data.success){
  931. tempTip.setDuration(3000);
  932. tempTip.show(response.data.data);
  933. return;
  934. }
  935. //修改时验证
  936. if (!daily_id) {
  937. //验证失败
  938. if (response.data.data.length < 1) {
  939. _this.isShow.isUpdateConfirmBtn = false;
  940. _this.errors['user_id'] = "查无此人,请检查您的输入";
  941. return;
  942. }
  943. //验证成功且结果仅有一个
  944. if (response.data.data.user_id) {
  945. _this.isShow.isUpdateConfirmBtn = true;
  946. _this.errors['user_id'] = "";
  947. _this.processDailyParticipantOne.user_id = response.data.data.user_id;
  948. _this.processDailyParticipantOne.started_at = response.data.data.started_at;
  949. _this.processDailyParticipantOne.ended_at = response.data.data.ended_at;
  950. _this.hourFilter(_this.processDailyParticipantOne,false);
  951. return;
  952. }
  953. //验证成功多结果
  954. if (response.data.data.length > 1) {
  955. _this.userLabors = response.data.data;
  956. $("#myModal").modal('show');
  957. return;
  958. }
  959. }
  960. //验证失败
  961. if (response.data.data.length < 1) {
  962. _this.processDailyParticipants.every(function (processDailyParticipant) {
  963. if (processDailyParticipant.daily_id == daily_id) {
  964. _this.errors['user_id'] = "查无此人,请检查您的输入";
  965. setTimeout(function () {
  966. $(".tooltipTargetError").tooltip('show');
  967. }, 1);
  968. processDailyParticipant.isConfirmBtn = false; //验证失败隐藏确定按钮
  969. return false;
  970. }
  971. return true;
  972. });
  973. return;
  974. }
  975. //按钮被隐藏则放出
  976. if (!isConfirmBtn) {
  977. _this.processDailyParticipants.every(function (processDailyParticipant) {
  978. if (processDailyParticipant.daily_id == daily_id) {
  979. processDailyParticipant.isConfirmBtn = true; //验证失败隐藏确定按钮
  980. return false;
  981. }
  982. return true;
  983. });
  984. }
  985. _this.modalDaily_id = daily_id;
  986. //验证成功且结果仅有一个
  987. if (response.data.data.user_id) {
  988. _this.errors['user_id'] = "";
  989. $("#" + daily_id + "user_id").val(response.data.data.user_id);
  990. $("#" + daily_id + "hour_price").val(response.data.data.user_labor.default_hour_price);
  991. if (response.data.data.started_at) $("#" + daily_id + "started_at").val(response.data.data.started_at);
  992. if (response.data.data.ended_at) $("#" + daily_id + "ended_at").val(response.data.data.ended_at);
  993. _this.hourFilter(daily_id,true);
  994. }
  995. //验证成功多结果
  996. if (response.data.data.length > 1) {
  997. _this.userLabors = response.data.data;
  998. $("#myModal").modal('show');
  999. }
  1000. }).catch(function (err) {
  1001. tempTip.setDuration(5000);
  1002. tempTip.show('验证临时工发生了一些严重错误:' + err);
  1003. })
  1004. },
  1005. //验证时间合法性
  1006. hourFilter(processDailyParticipant, is_create) {
  1007. let start = new Date('2020/1/1 12:00:00').getTime();
  1008. let end = new Date('2020/1/1 13:00:00').getTime();
  1009. if (is_create) {
  1010. let started_at = new Date('2020/1/1 ' + $('#' + processDailyParticipant + 'started_at')[0].value).getTime();
  1011. let ended_at = new Date('2020/1/1 ' + $('#' + processDailyParticipant + 'ended_at')[0].value).getTime();
  1012. let hour_count = (ended_at - started_at) / 3600000;
  1013. if (started_at < start && ended_at > end) hour_count -= 1;
  1014. let dinner_duration=Number($('#' + processDailyParticipant + 'dinner_duration')[0].value)/60;
  1015. $('#' + processDailyParticipant + 'hour_count')[0].value = (hour_count - dinner_duration).toFixed(1);
  1016. return;
  1017. }
  1018. let started_at = new Date('2020/1/1 ' + processDailyParticipant.started_at).getTime();
  1019. let ended_at = new Date('2020/1/1 ' + processDailyParticipant.ended_at).getTime();
  1020. let hour_count = (ended_at - started_at) / 3600000;
  1021. if (started_at < start && ended_at > end) hour_count -= 1;
  1022. let dinner_duration=Number(processDailyParticipant.dinner_duration) / 60;
  1023. processDailyParticipant.hour_count = (hour_count - dinner_duration).toFixed(1);
  1024. },
  1025. //提交参与人
  1026. submitProcessDailyParticipant(e) {
  1027. let request = {};
  1028. request['user_id'] = $("#" + e + "user_id").val();
  1029. request['started_at'] = $("#" + e + "started_at").val();
  1030. request['ended_at'] = $("#" + e + "ended_at").val();
  1031. let hour_price = $("#" + e + "hour_price").val();
  1032. if (hour_price) request['hour_price'] = hour_price;
  1033. let unit_price = $("#" + e + "unit_price").val();
  1034. if (unit_price) request['unit_price'] = unit_price;
  1035. let dinner_duration = $("#" + e + "dinner_duration").val();
  1036. if (dinner_duration) request['dinner_duration'] = dinner_duration;
  1037. let hour_count = $("#" + e + "hour_count").val();
  1038. if (hour_count) request['hour_count'] = hour_count;
  1039. let unit_count = $("#" + e + "unit_count").val();
  1040. if (unit_count) request['unit_count'] = unit_count;
  1041. let remark = $("#" + e + "remark").val();
  1042. if (remark) request['remark'] = remark;
  1043. request['daily_id'] = this.modalDaily_id;
  1044. let _this = this;
  1045. axios.post("{{url('process/storeProcessDailyParticipant')}}", request)
  1046. .then(function (response) {
  1047. if (response.data.status === 'warning'){
  1048. tempTip.setDuration(3000);
  1049. tempTip.show(response.data.data);
  1050. return;
  1051. }
  1052. if (response.data.status === "error") {
  1053. _this.errors = response.data.data;
  1054. setTimeout(function () {
  1055. $(".tooltipTargetError").tooltip('show');
  1056. }, 1);
  1057. setTimeout(function () {
  1058. $(".tooltipTargetError").tooltip('hide');
  1059. }, 3000);
  1060. return;
  1061. }
  1062. if (response.data.status == "success") {
  1063. _this.processDailyParticipants.every(function (processDailyParticipant) {
  1064. if (processDailyParticipant.daily_id == e) {
  1065. processDailyParticipant.id = response.data.data.id;
  1066. processDailyParticipant.status = response.data.data.status;
  1067. processDailyParticipant.user_detail_full_name = response.data.data.user_detail_full_name;
  1068. processDailyParticipant.user_id = response.data.data.user_id;
  1069. processDailyParticipant.started_at = response.data.data.started_at;
  1070. processDailyParticipant.ended_at = response.data.data.ended_at;
  1071. processDailyParticipant.hour_price = response.data.data.hour_price;
  1072. processDailyParticipant.unit_price = response.data.data.unit_price;
  1073. processDailyParticipant.dinner_duration = response.data.data.dinner_duration;
  1074. processDailyParticipant.hour_count = response.data.data.hour_count;
  1075. processDailyParticipant.unit_count = response.data.data.unit_count;
  1076. processDailyParticipant.remark = response.data.data.remark;
  1077. processDailyParticipant.hour = response.data.data.hour;
  1078. processDailyParticipant.diff = response.data.data.diff;
  1079. processDailyParticipant.billingHour = response.data.data.billingHour;
  1080. processDailyParticipant.isAddProcessDailyParticipant = true;
  1081. _this.isShow.isAddProcessDailyParticipant = true;
  1082. return false;
  1083. }
  1084. return true;
  1085. });
  1086. if (response.data.process) {
  1087. _this.processes.every(function (process) {
  1088. if (process.id == response.data.process) {
  1089. process.status = "加工中";
  1090. return false;
  1091. }
  1092. return true;
  1093. });
  1094. }
  1095. tempTip.setDuration(3000);
  1096. tempTip.showSuccess('参与人新增成功!');
  1097. }
  1098. }).catch(function (err) {
  1099. tempTip.setDuration(5000);
  1100. tempTip.show('新增参与人发生了一些严重错误:' + err);
  1101. })
  1102. },
  1103. //同名临时工选择
  1104. selectedUser(userLabor) { // 此处如返回开始与结束时间 计时工时并不会发生改变
  1105. $("#myModal").modal('hide');
  1106. this.errors['user_id'] = "";
  1107. this.processDailyParticipantOne['user_id'] = userLabor.user_id;
  1108. this.processDailyParticipantOne['hour_price'] = userLabor.user_labor.default_hour_price;
  1109. this.processDailyParticipantOne['started_at'] = userLabor.started_at;
  1110. this.processDailyParticipantOne['ended_at'] = userLabor.ended_at;
  1111. this.isShow.isUpdateConfirmBtn = true;
  1112. $("#" + this.modalDaily_id + "user_id").val(userLabor.user_id);
  1113. $("#" + this.modalDaily_id + "hour_price").val(userLabor.user_labor.default_hour_price);
  1114. $("#" + this.modalDaily_id + "started_at").val(userLabor.started_at);
  1115. $("#" + this.modalDaily_id + "ended_at").val(userLabor.ended_at);
  1116. },
  1117. //修改参与人
  1118. updateProcessDailyParticipant(processDailyParticipant) {
  1119. this.errors = {};
  1120. this.processDailyParticipantOne['id'] = processDailyParticipant.id;
  1121. this.processDailyParticipantOne['user_detail_full_name'] = processDailyParticipant.user_detail_full_name;
  1122. this.processDailyParticipantOne['user_id'] = processDailyParticipant.user_id;
  1123. this.processDailyParticipantOne['started_at'] = processDailyParticipant.started_at;
  1124. this.processDailyParticipantOne['ended_at'] = processDailyParticipant.ended_at;
  1125. this.processDailyParticipantOne['hour_price'] = processDailyParticipant.hour_price;
  1126. this.processDailyParticipantOne['unit_price'] = processDailyParticipant.unit_price;
  1127. this.processDailyParticipantOne['dinner_duration'] = processDailyParticipant.dinner_duration;
  1128. this.processDailyParticipantOne['hour_count'] = processDailyParticipant.hour_count;
  1129. this.processDailyParticipantOne['unit_count'] = processDailyParticipant.unit_count;
  1130. this.processDailyParticipantOne['remark'] = processDailyParticipant.remark;
  1131. $("#updateModal").modal('show');
  1132. },
  1133. //提交修改
  1134. submitUpdateProcessDailyParticipant() {
  1135. let _this = this;
  1136. axios.post("{{url('process/updateProcessDailyParticipant')}}", this.processDailyParticipantOne)
  1137. .then(function (response) {
  1138. if (!response.data.success) {
  1139. if (response.data.data.length>0){
  1140. _this.errors = response.data.data;
  1141. }
  1142. else {
  1143. tempTip.setDuration(3000);
  1144. tempTip.show(response.data.data);
  1145. }
  1146. return;
  1147. }
  1148. _this.processDailyParticipants.every(function (processDailyParticipant) {
  1149. if (processDailyParticipant.id == response.data.data.id) {
  1150. processDailyParticipant.status = response.data.data.status;
  1151. processDailyParticipant.user_detail_full_name = response.data.data.user_detail_full_name;
  1152. processDailyParticipant.started_at = response.data.data.started_at;
  1153. processDailyParticipant.ended_at = response.data.data.ended_at;
  1154. processDailyParticipant.hour_price = response.data.data.hour_price;
  1155. processDailyParticipant.unit_price = response.data.data.unit_price;
  1156. processDailyParticipant.dinner_duration = response.data.data.dinner_duration;
  1157. processDailyParticipant.hour_count = response.data.data.hour_count;
  1158. processDailyParticipant.unit_count = response.data.data.unit_count;
  1159. processDailyParticipant.remark = response.data.data.remark;
  1160. processDailyParticipant.hour = response.data.data.hour;
  1161. processDailyParticipant.diff = response.data.data.diff;
  1162. processDailyParticipant.billingHour = response.data.data.billingHour;
  1163. processDailyParticipant.isAddProcessDailyParticipant = true;
  1164. return false;
  1165. }
  1166. return true;
  1167. });
  1168. tempTip.setDuration(3000);
  1169. tempTip.showSuccess('参与人修改成功!');
  1170. $("#updateModal").modal('hide');
  1171. }).catch(function (err) {
  1172. tempTip.setDuration(5000);
  1173. tempTip.show('修改参与人发生了一些严重错误:' + err);
  1174. })
  1175. },
  1176. {{--//登记工时参与人审核
  1177. processDailyParticipantAudit(id) {
  1178. if (!confirm('审核后不能撤销及修改,确定通过审核吗?')) {
  1179. return
  1180. }
  1181. ;
  1182. let _this = this;
  1183. axios.post("{{url('process/processDailyParticipantAudit')}}" + "/" + id)
  1184. .then(function (response) {
  1185. if (response.data.success) {
  1186. _this.processDailyParticipants.every(function (processDailyParticipant) {
  1187. if (processDailyParticipant.id == response.data.processDailyParticipant.id) {
  1188. processDailyParticipant.status = response.data.processDailyParticipant.status;
  1189. return false;
  1190. }
  1191. return true;
  1192. });
  1193. tempTip.setDuration(3000);
  1194. tempTip.showSuccess('参与人审核通过!');
  1195. return;
  1196. }
  1197. tempTip.setDuration(3000);
  1198. tempTip.show('参与人失败!');
  1199. }).catch(function (err) {
  1200. tempTip.setDuration(5000);
  1201. tempTip.show('审核参与人发生了一些严重错误:' + err);
  1202. });
  1203. },--}}
  1204. //临时工详情
  1205. showUserDetail(id) {
  1206. window.open("{{url('maintenance/userLabor')}}/" + id);
  1207. },
  1208. //显示教程
  1209. showTutorial(id) {
  1210. axios.post('{{url('maintenance/tutorial/showContent')}}' + "/" + id)
  1211. .then(function (response) {
  1212. if (response.data.success) {
  1213. $("#content").html(response.data.data);
  1214. $("#showTutorial").modal('show');
  1215. }
  1216. }).catch(function (err) {
  1217. tempTip.setDuration(3000);
  1218. tempTip.show('获取教程失败!' + '网络错误:' + err);
  1219. });
  1220. },
  1221. //新增教程
  1222. addTutorials(id, owner_id) {
  1223. let _this = this;
  1224. axios.post('{{url('process/getTutorials')}}' + "/" + id)
  1225. .then(function (response) {
  1226. if (response.data.success) {
  1227. _this.processTutorial.id = id;
  1228. _this.processTutorial.owner_id = owner_id;
  1229. _this.processTutorial.tutorials = response.data.data;
  1230. $("#addTutorial").modal("show");
  1231. return;
  1232. }
  1233. tempTip.setDuration(3000);
  1234. tempTip.show('获取教程失败!未知错误:' + response.data);
  1235. }).catch(function (err) {
  1236. tempTip.setDuration(3000);
  1237. tempTip.show('获取教程失败!' + '网络错误:' + err);
  1238. });
  1239. },
  1240. //选择教程
  1241. selectedTutorial(process_id, tutorial_id) {
  1242. let _this = this;
  1243. axios.post('{{url('process/selectedTutorial')}}', {
  1244. process_id: process_id,
  1245. tutorial_id:tutorial_id
  1246. })
  1247. .then(function (response) {
  1248. if (response.data.success) {
  1249. _this.processes.every(function (process) {
  1250. if (process.id == process_id) {
  1251. process.tutorials.push(response.data.data);
  1252. return false;
  1253. }
  1254. return true;
  1255. });
  1256. $("#addTutorial").modal("hide");
  1257. tempTip.setDuration(3000);
  1258. tempTip.showSuccess('添加成功!');
  1259. return;
  1260. }
  1261. tempTip.setDuration(3000);
  1262. tempTip.show('添加教程失败!发生错误:' + response.data.data);
  1263. }).catch(function (err) {
  1264. tempTip.setDuration(3000);
  1265. tempTip.show('添加教程失败!' + '网络错误:' + err);
  1266. });
  1267. },
  1268. //删除教程
  1269. deleteTutorials(process_id, tutorial_id) {
  1270. let _this = this;
  1271. axios.post('{{url('process/deleteTutorial')}}', {process_id: process_id, tutorial_id, tutorial_id})
  1272. .then(function (response) {
  1273. if (response.data.success) {
  1274. _this.processes.every(function (process) {
  1275. if (process.id == process_id) {
  1276. process.tutorials.every(function (tutorial, i) {
  1277. if (tutorial.id == tutorial_id) {
  1278. process.tutorials.splice(i, 1)
  1279. return false;
  1280. }
  1281. return true;
  1282. });
  1283. return false;
  1284. }
  1285. return true;
  1286. });
  1287. tempTip.setDuration(3000);
  1288. tempTip.showSuccess('删除成功!');
  1289. return;
  1290. }
  1291. tempTip.setDuration(3000);
  1292. tempTip.show('删除教程失败!发生错误:' + response.data.data);
  1293. }).catch(function (err) {
  1294. tempTip.setDuration(3000);
  1295. tempTip.show('删除教程失败!' + '网络错误:' + err);
  1296. });
  1297. },
  1298. processEdit(id) {
  1299. location.href = "{{url('process')}}/" + id + "/edit";
  1300. },
  1301. //去往新增教程
  1302. addTutorial() {
  1303. window.open("{{url('maintenance/tutorial/create?owner_id=')}}" + this.processTutorial.owner_id);
  1304. },
  1305. //展开内容单
  1306. unfold(code, id, type) {
  1307. this.$set(this.processUnfold, code + id, type);
  1308. },
  1309. close(code, id) {
  1310. this.$delete(this.processUnfold, code + id);
  1311. },
  1312. rollback(id) {
  1313. if (!confirm('确定要回滚至上一阶段吗?')) return;
  1314. if (!id) return;
  1315. let _this = this;
  1316. axios.post('{{url('process/rollback')}}', {id: id})
  1317. .then(function (response) {
  1318. if (response.data.success) {
  1319. _this.processes.every(function (process) {
  1320. if (process.id === id) {
  1321. process.status = response.data.data;
  1322. return false
  1323. }
  1324. return true;
  1325. });
  1326. tempTip.setDuration(2000);
  1327. tempTip.showSuccess('回滚成功!');
  1328. return;
  1329. }
  1330. tempTip.setDuration(3000);
  1331. tempTip.show('回滚失败!未知错误!');
  1332. }).catch(function (err) {
  1333. tempTip.setDuration(3000);
  1334. tempTip.show('回滚失败!网络错误:' + err);
  1335. })
  1336. },
  1337. //vue绑定的name type:移入移出类型
  1338. changeStyle(name, type) {
  1339. let domList = document.getElementsByName(name);
  1340. let color = '';
  1341. if (type) color = 'rgba(0, 0, 0, 0.15)';
  1342. for (let i = 0; i < domList.length; i++) {
  1343. domList[i].style.backgroundColor = color;
  1344. }
  1345. },
  1346. destroy(code, id) {
  1347. if (!confirm('确定要删除“' + code + "”吗?")) return;
  1348. let _this = this;
  1349. let delArr = [];
  1350. axios.delete('{{url('process')}}/' + id)
  1351. .then(function (response) {
  1352. tempTip.setDuration(3000);
  1353. if (response.data.success) {
  1354. _this.processes.forEach(function (process, i) {
  1355. if (process.code === code)
  1356. delArr.unshift(i);
  1357. });
  1358. delArr.forEach(function (del) {
  1359. _this.$delete(_this.processes, del);
  1360. });
  1361. tempTip.showSuccess('删除“' + code + '”成功!');
  1362. return;
  1363. }
  1364. tempTip.show('删除“' + code + '”失败!该单已不存在')
  1365. }).catch(function (err) {
  1366. tempTip.setDuration(4000);
  1367. tempTip.show("网络错误:" + err);
  1368. })
  1369. },
  1370. //审核
  1371. audit(process) {
  1372. if (!confirm('确定要通过“' + process.code + "”的审核吗?")) return;
  1373. axios.post('{{url('process/audit')}}', {id: process.id})
  1374. .then(function (response) {
  1375. if (response.data.success) {
  1376. process.status = '待接单';
  1377. tempTip.setDuration(2000);
  1378. tempTip.showSuccess('“' + process.code + "”的审核通过!");
  1379. return;
  1380. }
  1381. tempTip.setDuration(3000);
  1382. tempTip.show('审核失败:未知错误,请联系管理员!');
  1383. }).catch(function (err) {
  1384. tempTip.setDuration(3000);
  1385. tempTip.showSuccess('审核失败,网络错误:' + err);
  1386. })
  1387. },
  1388. checkAndAccept(process) {
  1389. if (!confirm('确定要验收“' + process.code + "”吗?")) return;
  1390. axios.post('{{url('process/checkAndAccept')}}', {id: process.id})
  1391. .then(function (response) {
  1392. if (response.data.success) {
  1393. process.status = response.data.data;
  1394. tempTip.setDuration(2000);
  1395. tempTip.showSuccess('“' + process.code + "”验收完成!");
  1396. return;
  1397. }
  1398. tempTip.setDuration(3000);
  1399. tempTip.show(response.data.data)
  1400. }).catch(function (err) {
  1401. tempTip.setDuration(3000);
  1402. tempTip.show('网络错误:' + err)
  1403. })
  1404. },
  1405. show(id) {
  1406. {{--window.location.href = '{{url('process')}}/' + id;--}}
  1407. window.open('{{url('process')}}/' + id,'_blank') ;
  1408. },
  1409. //修改价格
  1410. updateUnitPrice(process) {
  1411. if (!confirm('确定要修改“' + process.code + "”的单价吗?")) return;
  1412. let unit_price = $('#unit_price_' + process.id)[0].value;
  1413. if (!unit_price || isNaN(unit_price)) {
  1414. tempTip.setDuration(3000);
  1415. tempTip.show('请输入正确的价格!');
  1416. return;
  1417. }
  1418. axios.post('{{url('process/updateUnitPrice')}}', {id: process.id, unit_price: unit_price})
  1419. .then(function (response) {
  1420. if (response.data.success) {
  1421. process.signs.push(response.data.sign);
  1422. process.is_update_unit_price = false;
  1423. process.signUnitPrice = unit_price;
  1424. tempTip.setDuration(2000);
  1425. tempTip.showSuccess('“' + process.code + "”价格修改成功,确认通过后生效!");
  1426. return;
  1427. }
  1428. tempTip.setDuration(3000);
  1429. tempTip.show(response.data.data);
  1430. }).catch(function (err) {
  1431. tempTip.setDuration(3000);
  1432. tempTip.show('网络错误:' + err);
  1433. })
  1434. },
  1435. //组长或财务确认
  1436. verify(process, type) {
  1437. if (!confirm('确定要通过“'+process.code+"”的审核吗"))return;
  1438. let url = '{{url('process/workGroupVerify')}}';
  1439. let msg = '二次加工组';
  1440. if (type === 'accountant') {
  1441. url = '{{url('process/accountantVerify')}}';
  1442. msg = '财务';
  1443. }
  1444. let _this=this;
  1445. axios.post(url, {id: process.id})
  1446. .then(function (response) {
  1447. if (response.data.success) {
  1448. if (response.data.data){
  1449. process.signs.push(response.data.data);
  1450. _this.$set(_this.signs[process.code],response.data.data.mark,true);
  1451. }else{
  1452. _this.signs[process.code]=[];
  1453. process.signs=[];
  1454. process.unit_price = process.signUnitPrice;
  1455. process.signUnitPrice = '';
  1456. }
  1457. if (process.is_update_unit_price)process.is_update_unit_price = false;
  1458. tempTip.setDuration(2000);
  1459. tempTip.showSuccess('“' + process.code + "”新价格通过" + msg + "审核!");
  1460. return;
  1461. }
  1462. tempTip.setDuration(3000);
  1463. tempTip.show(response.data.data);
  1464. }).catch(function (err) {
  1465. tempTip.setDuration(3000);
  1466. tempTip.show('网络错误:' + err);
  1467. })
  1468. },
  1469. update_process_date(processDailyParticipant){
  1470. let date=this.date;
  1471. let is_update_date=this.is_update_date;
  1472. let _this=this;
  1473. if (is_update_date==='start_date') _this.dateTextMap.start_date='起';
  1474. else _this.dateTextMap.end_date='终';
  1475. if (!date){
  1476. tempTip.show('未输入日期!');
  1477. return;
  1478. }
  1479. let url='';
  1480. if (is_update_date==='start_date'){
  1481. if (!confirm('确定要设定“'+date+'”为新的起始日期吗?以往记录将被删除!'))return;
  1482. url='{{url('process/updateStartDate')}}';
  1483. }
  1484. else{
  1485. if (!confirm('确定要设定“'+date+'”为新的终止日期吗?'))return;
  1486. url='{{url('process/updateEndDate')}}';
  1487. }
  1488. axios.post(url,{process_id:processDailyParticipant.process_id,date:date})
  1489. .then(function (response) {
  1490. if(response.data.success){
  1491. _this.resetProcessDaily(response.data.data,processDailyParticipant.process_id);
  1492. _this.is_update_date='';
  1493. tempTip.setDuration(2000);
  1494. tempTip.showSuccess('成功修改“'+date+'”为新的'+(is_update_date==='start_date' ? '起始时间' :'终止时间')+'!');
  1495. return;
  1496. }
  1497. tempTip.setDuration(3000);
  1498. tempTip.show(response.data.data);
  1499. }).catch(function (err) {
  1500. tempTip.setDuration(3000);
  1501. tempTip.show('网络错误:'+err);
  1502. })
  1503. },
  1504. resetProcessDailyParticipants(index){
  1505. if (this.processDailyParticipants[index].daily_id){
  1506. if (this.processDailyParticipants[index+1] && !this.processDailyParticipants[index+1].daily_id){
  1507. this.processDailyParticipants[index+1].daily_id=this.processDailyParticipants[index].daily_id;
  1508. this.processDailyParticipants[index+1].date=this.processDailyParticipants[index].date;
  1509. this.processDailyParticipants[index+1].isAddProcessDailyParticipant=this.processDailyParticipants[index].isAddProcessDailyParticipant;
  1510. this.processDailyParticipants[index+1].isConfirmBtn=this.processDailyParticipants[index].isConfirmBtn;
  1511. this.processDailyParticipants[index+1].output=this.processDailyParticipants[index].output;
  1512. this.processDailyParticipants[index+1].process_id=this.processDailyParticipants[index].process_id;
  1513. this.processDailyParticipants[index+1].readonly=this.processDailyParticipants[index].readonly;
  1514. this.processDailyParticipants[index+1].remain=this.processDailyParticipants[index].remain;
  1515. this.processDailyParticipants[index+1].rowspan=this.processDailyParticipants[index].rowspan - 1;
  1516. this.processDailyParticipants[index+1].submitOutput=this.processDailyParticipants[index].submitOutput;
  1517. this.$delete(this.processDailyParticipants,index);
  1518. }else{
  1519. let processDailyParticipant = {
  1520. 'daily_id': this.processDailyParticipants[index].daily_id,
  1521. 'date': this.processDailyParticipants[index].date,
  1522. 'isAddProcessDailyParticipant': this.processDailyParticipants[index].isAddProcessDailyParticipant,
  1523. 'isConfirmBtn': this.processDailyParticipants[index].isConfirmBtn,
  1524. 'output': this.processDailyParticipants[index].output,
  1525. 'process_id': this.processDailyParticipants[index].process_id,
  1526. 'readonly': this.processDailyParticipants[index].readonly,
  1527. 'remain': this.processDailyParticipants[index].remain,
  1528. 'rowspan': this.processDailyParticipants[index].rowspan,
  1529. 'submitOutput': this.processDailyParticipants[index].submitOutput,
  1530. };
  1531. this.$set(this.processDailyParticipants,index,processDailyParticipant);
  1532. }
  1533. }
  1534. else this.$delete(this.processDailyParticipants,index);
  1535. },
  1536. deleteDailyParticipant(index){
  1537. let _this=this;
  1538. if (!confirm('确定要删除“' + _this.processDailyParticipants[index].user_detail_full_name + "”的工作记录吗?"))return;
  1539. axios.delete('{{url('process/destroyDailyParticipant')}}/'+_this.processDailyParticipants[index].id)
  1540. .then(res=>{
  1541. if (res.data.success){
  1542. _this.resetProcessDailyParticipants(index);
  1543. tempTip.setDuration(2000);
  1544. tempTip.showSuccess('删除“'+_this.processDailyParticipants[index].user_detail_full_name+'”的工作记录成功!');
  1545. return;
  1546. }
  1547. tempTip.setDuration(3000);
  1548. tempTip.show(res.data.data);
  1549. }).catch(err=>{
  1550. tempTip.setDuration(4000);
  1551. tempTip.show('网络错误:'+err);
  1552. })
  1553. },
  1554. //修改时的晚饭时间改变计时工时
  1555. updateDinnerDuration(processDailyParticipantOne,e){
  1556. let oldValue=Number(e.target.dataset.oldValue) / 60;
  1557. let newValue=Number(processDailyParticipantOne.dinner_duration) / 60;
  1558. processDailyParticipantOne.hour_count += (oldValue-newValue);
  1559. },
  1560. //修改每日产量
  1561. updateOutput(processDailyParticipant){
  1562. if (processDailyParticipant.id) processDailyParticipant.readonly=false;
  1563. else {
  1564. tempTip.setDuration(3000);
  1565. tempTip.show('该日无参与人加工信息,请先录入参与人加工信息!');
  1566. processDailyParticipant.readonly=true;
  1567. }
  1568. },
  1569. count(value,processes){
  1570. let count=0;
  1571. processes.every(function (process,i) {
  1572. if (process.id)count++;
  1573. if (i == value) return false;
  1574. return true;
  1575. });
  1576. return count;
  1577. }
  1578. },
  1579. });
  1580. </script>
  1581. @endsection