index.blade.php 84 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247
  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>
  10. <form method="GET" action="{{url('process/')}}" id="optionSubmit">
  11. <table class="table table-sm table-bordered text-nowrap mb-0">
  12. <tr v-if="isBeingFilterConditions">
  13. <td colspan="10">
  14. <div class="col" style="padding:0">
  15. <a href="{{url('process')}}"><span class="btn btn-warning text-dark">清除过滤条件</span></a>
  16. </div></td>
  17. </tr>
  18. <tr>
  19. <td colspan="9">
  20. <select name="paginate" v-model="filterData.paginate" class="tooltipTarget form-control form-control-sm" style="vertical-align: middle;max-width: 100px" @change="submit">
  21. <option value="50">50行</option>
  22. <option value="100">100行</option>
  23. <option value="200">200行</option>
  24. <option value="500">500行</option>
  25. <option value="1000">1000行</option>
  26. </select></td>
  27. </tr>
  28. <tr>
  29. <td >
  30. <input id="date_start" name="date_start" style="max-width: 200px" v-model="filterData.date_start" :class="filterData.date_start?'bg-warning':''" type="date" class="form-control form-control-sm tooltipTarget" title="选择显示指定日期的起始时间">
  31. </td>
  32. <td >
  33. <div class="form-inline">
  34. <input type="text" class="form-control form-control-sm tooltipTarget" placeholder="客户"
  35. style="width:70px" @input="owner_seek"
  36. title="输入关键词快速定位下拉列表,回车确定">
  37. <select name="owner_id" v-model="filterData.owner_id" @change="submit" class="form-control form-control-sm tooltipTarget" title="选择要显示的客户" :class="filterData.owner_id?'bg-warning':''">
  38. <option > </option>
  39. <option v-for="owner in owners" :value="owner.id">@{{owner.name}}</option>
  40. </select></div>
  41. </td>
  42. <td>
  43. <input id="wms_code" name="wms_code" style="max-width: 200px" title="单据号:支持15内模糊搜索与15天外精确搜索" v-model="filterData.wms_code" class="form-control form-control-sm tooltipTarget" placeholder="单据号" :class="filterData.wms_code?'bg-warning':''">
  44. </td>
  45. <td colspan="6"></td>
  46. </tr>
  47. <tr>
  48. <td >
  49. <input id="date_end" name="date_end" style="max-width: 200px" v-model="filterData.date_end" type="date" class="form-control form-control-sm tooltipTarget" title="选择显示指定日期的结束时间" :class="filterData.date_end?'bg-warning':''">
  50. </td>
  51. <td>
  52. <input name="commodity_barcode" style="max-width: 200px" title="商品条码:支持15内模糊搜索与15天外精确搜索" v-model="filterData.commodity_barcode" class="form-control form-control-sm tooltipTarget" placeholder="商品条码" :class="filterData.commodity_barcode?'bg-warning':''">
  53. </td>
  54. <td >
  55. <div class="form-inline">
  56. <select id="status" name="status" v-model="filterData.status" @change="submit" style="max-width: 100px" class="form-control form-control-sm tooltipTarget" :class="filterData.status?'bg-warning':''" >
  57. <option value="" selected>状态</option>
  58. <option value="待接单">待接单</option>
  59. <option value="待加工">待加工</option>
  60. <option value="驳回">驳回</option>
  61. <option value="加工中">加工中</option>
  62. <option value="待验收">待验收</option>
  63. <option value="已完成">已完成</option>
  64. </select>
  65. <button class="btn btn-sm btn-outline-dark pull-left ml-5" type="submit">按条件搜索</button></div>
  66. </td>
  67. <td colspan="6"></td>
  68. </tr>
  69. <tr>
  70. <td colspan="9">
  71. <span class="dropdown">
  72. <button class="btn btn-outline-dark btn-sm form-control-sm dropdown-toggle tooltipTarget" :class="[checkData.length>0?'btn-dark text-light':'']"
  73. data-toggle="dropdown" title="导出所有页将会以搜索条件得到的过滤结果,将其全部记录(每一页)导出">
  74. 导出Excel
  75. </button>
  76. <div class="dropdown-menu">
  77. <a class="dropdown-item" @click="processExport(1)" href="javascript:">导出勾选内容</a>
  78. <a class="dropdown-item" @click="processExport(2)" href="javascript:">导出所有页</a>
  79. </div>
  80. </span>
  81. </td>
  82. </tr>
  83. </table>
  84. </form>
  85. </div>
  86. <!--新增教程关联-->
  87. <div style="top:25%" class="modal fade" id="addTutorial" tabindex="-1" role="dialog" aria-labelledby="addTutorial" aria-hidden="true">
  88. <div class="modal-dialog">
  89. <div class="modal-content">
  90. <div class="modal-header m-1 p-0">
  91. <button type="button" class="close pr-4" data-dismiss="modal" aria-hidden="true">&times;</button>
  92. </div>
  93. <div class="modal-body m-auto">
  94. <table class="table-sm">
  95. <tr>
  96. <th>标题</th>
  97. <th><button class="btn btn-sm btn-outline-primary" @click="addTutorial()">新增教程</button></th>
  98. </tr>
  99. <tr v-for="tutorial in processTutorial.tutorials">
  100. <td><div style="cursor:pointer;overflow: hidden;width: 200px" @click="showTutorial(tutorial.id)" :title="tutorial.name" class="text-primary">@{{tutorial.name}}</div></td>
  101. @can("二次加工管理-教程管理")<td><button @click="selectedTutorial(processTutorial.id,tutorial.id)" class="btn btn-sm btn-success pull-right">选择</button></td>@endcan
  102. </tr>
  103. </table>
  104. </div>
  105. </div><!-- /.modal-content -->
  106. </div><!-- /.modal -->
  107. </div>
  108. <!-- 显示教程-->
  109. <div class="modal fade" id="showTutorial" tabindex="-1" role="dialog" aria-labelledby="showTutorial" aria-hidden="true">
  110. <div class="modal-dialog">
  111. <div class="modal-content">
  112. <div class="modal-header">
  113. <button type="button" class="close pull-right" data-dismiss="modal" aria-hidden="true">&times;</button>
  114. </div>
  115. <div class="modal-body custom-rich-text-content" id="content"></div>
  116. <div class="modal-footer">
  117. <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
  118. </div>
  119. </div><!-- /.modal-content -->
  120. </div><!-- /.modal -->
  121. </div>
  122. <!-- 修改modal -->
  123. <div data-backdrop="static" class="modal fade" id="updateModal" tabindex="-1" role="dialog" aria-labelledby="updateModalLabel" aria-hidden="true">
  124. <div class="modal-dialog modal-dialog-centered" role="document">
  125. <div class="modal-content">
  126. <div class="modal-body">
  127. <div v-if="errors.user_id" class="row"><label class="col-3"></label><small class="text-danger col-7">@{{ errors.user_id }}</small></div>
  128. <div class="form-group row">
  129. <label for="initial_weight" class="col-3 col-form-label text-right">参与者</label>
  130. <div class="col-7">
  131. <input :class="{ 'is-invalid' : errors.user_id }" @change="verifyUserName($event,null,null)" type="text" class="form-control" autocomplete="off" v-model="processDailyParticipantOne.user_detail_full_name" >
  132. </div>
  133. </div>
  134. <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>
  135. <div class="form-group row">
  136. <label for="initial_weight" class="col-3 col-form-label text-right">开始时间</label>
  137. <div class="col-7">
  138. <input :class="{ 'is-invalid' : errors.started_at }" type="text" @input="hourFilter($event)" class="form-control" autocomplete="off" v-model="processDailyParticipantOne.started_at" >
  139. </div>
  140. </div>
  141. <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>
  142. <div class="form-group row">
  143. <label for="initial_weight" class="col-3 col-form-label text-right">结束时间</label>
  144. <div class="col-7">
  145. <input :class="{ 'is-invalid' : errors.ended_at }" type="text" @input="hourFilter($event)" class="form-control" autocomplete="off" v-model="processDailyParticipantOne.ended_at" >
  146. </div>
  147. </div>
  148. <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>
  149. <div class="form-group row">
  150. <label for="initial_weight" class="col-3 col-form-label text-right">计时工资</label>
  151. <div class="col-7">
  152. <input :class="{ 'is-invalid' : errors.hour_price }" type="text" class="form-control" autocomplete="off" v-model="processDailyParticipantOne.hour_price" >
  153. </div>
  154. </div>
  155. <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>
  156. <div class="form-group row">
  157. <label for="initial_weight" class="col-3 col-form-label text-right">计件工资</label>
  158. <div class="col-7">
  159. <input :class="{ 'is-invalid' : errors.unit_price }" type="text" class="form-control" autocomplete="off" v-model="processDailyParticipantOne.unit_price" >
  160. </div>
  161. </div>
  162. <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>
  163. <div class="form-group row">
  164. <label for="initial_weight" class="col-3 col-form-label text-right">晚饭时间</label>
  165. <div class="col-7">
  166. <select :class="{ 'is-invalid' : errors.dinner_duration }" v-model="processDailyParticipantOne.dinner_duration" class="form-control">
  167. <option value="0">无</option>
  168. <option value="30">30分钟</option>
  169. <option value="60">60分钟</option>
  170. </select>
  171. </div>
  172. </div>
  173. <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>
  174. <div class="form-group row">
  175. <label for="initial_weight" class="col-3 col-form-label text-right">计时工时</label>
  176. <div class="col-7">
  177. <input :class="{ 'is-invalid' : errors.hour_count }" type="text" class="form-control" autocomplete="off" v-model="processDailyParticipantOne.hour_count" >
  178. </div>
  179. </div>
  180. <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>
  181. <div class="form-group row">
  182. <label for="initial_weight" class="col-3 col-form-label text-right">计件数量</label>
  183. <div class="col-7">
  184. <input :class="{ 'is-invalid' : errors.unit_count }" type="text" class="form-control" autocomplete="off" v-model="processDailyParticipantOne.unit_count" >
  185. </div>
  186. </div>
  187. <div class="form-group row">
  188. <label for="initial_weight" class="col-3 col-form-label text-right">备注</label>
  189. <div class="col-7">
  190. <input type="text" class="form-control" autocomplete="off" v-model="processDailyParticipantOne.remark" >
  191. </div>
  192. </div>
  193. </div>
  194. <div class="modal-footer">
  195. <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
  196. @can("二次加工管理-登记工时")<button v-if="isShow.isUpdateConfirmBtn" @click="submitUpdateProcessDailyParticipant()" class="btn btn-primary">提交更改</button>@endcan
  197. </div>
  198. </div><!-- /.modal-content -->
  199. </div><!-- /.modal -->
  200. </div>
  201. <!-- 多临时工选择(Modal) -->
  202. <div data-backdrop="static" style="top:25%" class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  203. <div class="modal-dialog">
  204. <div class="modal-content" style="background-color: #d6e9f8">
  205. <div class="modal-body m-auto">
  206. <table class="table-sm">
  207. <tr>
  208. <th>姓名</th>
  209. <th>性别</th>
  210. <th>电话</th>
  211. <th>最近打卡时间</th>
  212. <th></th>
  213. </tr>
  214. <tr v-for="userLabor in userLabors" v-if="userLabor.user_labor">
  215. <td>@{{ userLabor.full_name }}</td>
  216. <td>@{{ userLabor.gender }}</td>
  217. <td>@{{ userLabor.mobile_phone }}</td>
  218. <td>@{{ userLabor.checked_at }}</td>
  219. <td><button @click="selectedUser(userLabor.user_id,userLabor.user_labor.default_hour_price)" class="btn btn-sm btn-success">选择</button></td>
  220. </tr>
  221. </table>
  222. </div>
  223. </div><!-- /.modal-content -->
  224. </div><!-- /.modal -->
  225. </div>
  226. <table class="table table-striped table-sm text-nowrap table-hover">
  227. <tr>
  228. <th>
  229. <label for="all">
  230. <input id="all" type="checkbox" @click="checkAll($event)">全选
  231. </label>
  232. </th>
  233. <th>序号</th>
  234. <th >操作</th>
  235. <th>任务号</th>
  236. <th>货主</th>
  237. <th>加工类型</th>
  238. <th>预期数量</th>
  239. <th class="text-center">教程</th>
  240. <th>单价</th>
  241. <th>完成数量</th>
  242. <th>提交日期</th>
  243. <th>状态</th>
  244. <th>备注</th>
  245. <th style="min-width: 200px">单据类型</th>
  246. <th style="min-width: 200px">单据号</th>
  247. <th style="min-width: 200px">本单数量</th>
  248. <th style="min-width: 200px">商品条码</th>
  249. <th style="min-width: 200px">商品名称 </th>
  250. </tr>
  251. <template>
  252. <tr v-for="(processOne,i) in processesContents" :id="processOne.afterLocation?processOne.afterLocation:processOne.id">
  253. <td v-if="processOne.id">
  254. <input class="checkItem" type="checkbox" :value="processOne.id" v-model="checkData">
  255. </td>
  256. <td v-if="processOne.id" class="text-muted">@{{ i+1 }}</td>
  257. <td v-if="processOne.id" style="min-width:150px" >
  258. <p v-if="!processOne.openProcessHour && processOne.status=='驳回'" class="text-muted">已驳回</p>
  259. <p v-if="!processOne.openProcessHour && processOne.status=='已完成'" class="text-success">已完成</p>
  260. @can("二次加工管理-接单与驳回")
  261. <button v-if="!processOne.openProcessHour && processOne.status=='待接单'" @click="processEdit(processOne.id)" class="btn btn-sm btn-outline-info pull-left">编辑</button>
  262. <button v-if="!processOne.openProcessHour && processOne.status=='待接单'" @click="processReject(processOne.id)" class="btn btn-sm btn-outline-dark pull-left">驳回</button>
  263. <button v-if="!processOne.openProcessHour && processOne.status=='待接单'" @click="processReceive(processOne.id)" class="btn btn-sm btn-outline-primary pull-left">接单</button>@endcan
  264. @can("二次加工管理-登记工时")<button v-if="(processOne.status=='加工中' || processOne.status=='待加工') && !processOne.openProcessHour"
  265. class="btn btn-sm btn-outline-info pull-left" @click="openProcessHour(processOne);processOne.openProcessHour=true;processOne.detailFolding=false">登记工时</button>
  266. <button v-if="processOne.openProcessHour" @click="closeProcessHour(processOne.id);processOne.openProcessHour=false" class="btn btn-sm btn-dark pull-left">收起登记工时</button>@endcan
  267. @can("二次加工管理-验收完成")<button v-if="!processOne.openProcessHour && processOne.status=='待验收'" @click="processAccomplish(processOne.id)" class="btn btn-sm btn-outline-success pull-left">完成</button>@endcan
  268. </td>
  269. <td v-if="processOne.id" class="text-muted">@{{ processOne.code }}</td>
  270. <td v-if="processOne.id" class="text-muted">@{{ processOne.owner_name }}</td>
  271. <td v-if="processOne.id">@{{ processOne.process_method_name }}</td>
  272. <td v-if="processOne.id">@{{ processOne.amount }}</td>
  273. <td v-if="processOne.id" >
  274. <div class="" v-if="processOne.tutorials" {{--style="width: 200px;overflow:auto;"--}}>
  275. <div v-if=" processOne.tutorials.length>0">
  276. <u v-if="!processOne.detailFolding" @click="showTutorial(processOne.tutorials[0].id)" class="text-info" style="cursor:pointer;">@{{processOne.tutorials[0].name}}</u>
  277. <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>
  278. <div v-else><button class="btn btn-sm btn-outline-dark pull-left" href="javascript:;" @click="processOne.detailFolding=false" >收起编辑</button>
  279. <button @click="addTutorials(processOne.id,processOne.owner_id)" class="btn btn-sm btn-outline-info pull-left">新增关联教程</button></div>
  280. <table class="table table-sm" v-if="processOne.detailFolding">
  281. <tr>
  282. <th>标题</th>
  283. <th>操作</th>
  284. <th>创建时间</th>
  285. </tr>
  286. <tr v-for="(tutorial,i) in processOne.tutorials">
  287. <td class="text-info"><u :title="tutorial.name" @click="showTutorial(tutorial.id)" style="cursor:pointer;">@{{tutorial.name}}</u></td>
  288. <td>@can('二次加工管理-教程管理')
  289. <button @click="deleteTutorials(processOne.id,tutorial.id)" class="btn btn-sm btn-outline-danger pull-left" >删</button>
  290. @endcan</td>
  291. <td >@{{tutorial.created_at}}</td>
  292. </tr>
  293. </table>
  294. </div>
  295. <div v-if="processOne.tutorials.length<1">
  296. <button @click="addTutorials(processOne.id,processOne.owner_id)" class="btn btn-sm btn-outline-info pull-left" >新增关联教程</button>
  297. </div>
  298. </div>
  299. </td>
  300. <td v-if="processOne.id" class="text-muted">@{{ processOne.unit_price }}</td>
  301. <td v-if="processOne.id">@{{ processOne.completed_amount }}</td>
  302. <td v-if="processOne.id">@{{ processOne.created_at }}</td>
  303. <td v-if="processOne.id" class="text-muted">@{{ processOne.status }}</td>
  304. <td v-if="processOne.id" class="text-muted">@{{ processOne.remark }}</td>
  305. <td colspan="5">
  306. <table class="table table-sm table-striped" v-if="processUnfold[processOne.code] || processOne.processesContents.length==1">
  307. <tr v-for="processesContent in processOne.processesContents" v-if="processUnfold[processOne.code] ? processesContent.is_full==processUnfold[processOne.code] :processOne.processesContents.length==1">
  308. <td style="width: 180px" class="text-muted">@{{ processesContent.bill_type }}</td>
  309. <td style="width: 180px" class="text-muted">@{{ processesContent.wms_code }}</td>
  310. <td style="width: 180px" class="text-muted">@{{ processesContent.amount }}</td>
  311. <td style="width: 180px" class="text-muted">
  312. <ul class="p-0 m-0 list-unstyled list-inline" v-if="processesContent.commodity">
  313. <li v-for="barcode in processesContent.commodity.barcodes"><small>@{{ barcode.code }}</small></li>
  314. </ul>
  315. </td>
  316. <td :title="processesContent.commodity_name" class="text-muted tooltipTarget"><div style="width: 180px;overflow:hidden" >@{{ processesContent.commodity_name }}</div></td>
  317. </tr>
  318. <tr v-if="processUnfold[processOne.code]">
  319. <td colspan="5">
  320. <div class="text-center">
  321. <b v-if="processUnfold[processOne.code]=='N'" style="cursor:pointer;color: #4aa0e6;text-decoration:underline" @click="processUnfold=[]">点击关闭原料单</b><br>
  322. <b v-if="processUnfold[processOne.code]=='Y'" style="cursor:pointer;color: #4aa0e6;text-decoration:underline" @click="processUnfold=[]">点击关闭成品单</b></div>
  323. </td>
  324. </tr>
  325. </table>
  326. <div v-if="!processUnfold[processOne.code] && processOne.processesContents.length>1" class="text-center">
  327. <b v-if="processFullSum[processOne.code]!=processOne.processesContents.length" style="cursor:pointer;color: #4aa0e6;text-decoration:underline" @click="unfold(processOne.code,'N')">点击展开原料单</b><br>
  328. <b v-if="processFullSum[processOne.code] && processFullSum[processOne.code]!=0" style="cursor:pointer;color: #4aa0e6;text-decoration:underline" @click="unfold(processOne.code,'Y')">点击展开成品单</b></div>
  329. </td>
  330. </tr>
  331. <tr id="addProcessDailyParticipants" v-show="processDailyParticipants.length>0">
  332. <td colspan="2"></td>
  333. <td colspan="16">
  334. <table class="table-sm table-bordered table-condensed">
  335. <tr class="text-success">
  336. <td>日期</td><td>当日产量</td>
  337. <td>当日剩余</td>
  338. <td colspan="2">操作</td>
  339. <td>参与者</td>
  340. <td>开始时间</td>
  341. <td>结束时间</td>
  342. <td>计时工资</td>
  343. <td>计件工资</td>
  344. <td>晚饭时间</td>
  345. <td>计时工时</td>
  346. <td>计件数量</td>
  347. <td>备注</td>
  348. <td>打卡工时</td>
  349. <td>工时差</td>
  350. <td>计费工时</td>
  351. <td>审核</td>
  352. <td>详情</td>
  353. </tr>
  354. <tr v-for="processDailyParticipant in processDailyParticipants" :id="'processDailyParticipant'+processDailyParticipant.id">
  355. <td v-if="processDailyParticipant.rowspan" :rowspan="processDailyParticipant.rowspan"><p >@{{ processDailyParticipant.date }}</p></td>
  356. <td v-if="processDailyParticipant.rowspan" :rowspan="processDailyParticipant.rowspan">
  357. <div class="form-inline">
  358. <input :readonly="processDailyParticipant.readonly" v-model="processDailyParticipant.submitOutput"
  359. class="form-control col-sm-5 " @click="processDailyParticipant.id?processDailyParticipant.readonly=false:processDailyParticipant.readonly=true" type="text" />
  360. @can("二次加工管理-登记工时")<button class="btn btn-sm btn-success" v-if="! processDailyParticipant.readonly" @click="submitOutputData(processDailyParticipant.daily_id,processDailyParticipant.submitOutput,processDailyParticipant.id)">确定</button>
  361. <button class="btn btn-sm btn-danger" v-if="! processDailyParticipant.readonly" @click="processDailyParticipant.readonly=true;processDailyParticipant.submitOutput=processDailyParticipant.output">取消</button>
  362. @endcan
  363. </div>
  364. </td>
  365. <td v-if="processDailyParticipant.rowspan" :rowspan="processDailyParticipant.rowspan"><p >@{{ processDailyParticipant.remain }}</p></td>
  366. <td v-if="processDailyParticipant.rowspan" :rowspan="processDailyParticipant.rowspan">
  367. @can("二次加工管理-登记工时")<button v-if="processDailyParticipant.isAddProcessDailyParticipant && isShow.isAddProcessDailyParticipant" class="btn btn-sm btn-info" @click="addProcessDailyParticipant(processDailyParticipant);processDailyParticipant.isAddProcessDailyParticipant=false;">新增</button>
  368. <button v-if="!processDailyParticipant.isAddProcessDailyParticipant" class="btn btn-sm btn-danger"
  369. @click="deleteProcessDailyParticipant($event,processDailyParticipant.daily_id,processDailyParticipant.user_detail_full_name,processDailyParticipant.isConfirmBtn);processDailyParticipant.isAddProcessDailyParticipant=true;">取消</button>
  370. @endcan
  371. </td>
  372. <td>
  373. @can("二次加工管理-登记工时")<button v-if="!processDailyParticipant.isAddProcessDailyParticipant && processDailyParticipant.isConfirmBtn" class="btn btn-sm btn-success" @click="submitProcessDailyParticipant(processDailyParticipant.daily_id)">确定</button>
  374. <button v-if="processDailyParticipant.id && processDailyParticipant.status=='未审核'" class="btn btn-sm btn-outline-info" @click="updateProcessDailyParticipant(processDailyParticipant)">改</button>
  375. @endcan
  376. </td>
  377. <td>
  378. <span v-if="!processDailyParticipant.user_detail_full_name && processDailyParticipant.isAddProcessDailyParticipant==false" >
  379. <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)">
  380. <input hidden :id="processDailyParticipant.daily_id+'user_id'"/>
  381. </span><span v-else>@{{ processDailyParticipant.user_detail_full_name }}</span></td>
  382. <td>
  383. <span v-if="!processDailyParticipant.user_detail_full_name && processDailyParticipant.isAddProcessDailyParticipant==false" >
  384. <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:70px" type="text" @input="hourFilter($event)">
  385. </span><span v-else> @{{ processDailyParticipant.started_at }}</span></td>
  386. <td>
  387. <span v-if="!processDailyParticipant.user_detail_full_name && processDailyParticipant.isAddProcessDailyParticipant==false" >
  388. <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:70px" type="text" @input="hourFilter($event)">
  389. </span><span v-else> @{{ processDailyParticipant.ended_at }}</span></td>
  390. <td><span v-if="!processDailyParticipant.user_detail_full_name && processDailyParticipant.isAddProcessDailyParticipant==false">
  391. <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">
  392. </span><span v-else>@{{ processDailyParticipant.hour_price }}</span></td>
  393. <td>
  394. <span v-if="!processDailyParticipant.user_detail_full_name && processDailyParticipant.isAddProcessDailyParticipant==false">
  395. <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">
  396. </span><span v-else>@{{ processDailyParticipant.unit_price }}</span></td>
  397. <td>
  398. <span v-if="!processDailyParticipant.user_detail_full_name && processDailyParticipant.isAddProcessDailyParticipant==false">
  399. <select :class="{ 'is-invalid' : errors.dinner_duration }" :data-original-title="errors.dinner_duration ? errors.dinner_duration[0] : ''" :id="processDailyParticipant.daily_id+'dinner_duration'" class="form-control tooltipTargetError" style="width:80px">
  400. <option value="0">无</option>
  401. <option value="30">30分钟</option>
  402. <option value="60">60分钟</option>
  403. </select>
  404. </span><span v-else>@{{ processDailyParticipant.dinner_duration }}</span></td>
  405. <td>
  406. <span v-if="!processDailyParticipant.user_detail_full_name && processDailyParticipant.isAddProcessDailyParticipant==false">
  407. <input :class="{ 'is-invalid' : errors.hour_count }" :data-original-title="errors.hour_count ? errors.hour_count[0] : ''" :id="processDailyParticipant.daily_id+'hour_count'" value="8" class="form-control tooltipTargetError" style="width:70px" type="text" >
  408. </span><span v-else>@{{ processDailyParticipant.hour_count }}</span></td>
  409. <td>
  410. <span v-if="!processDailyParticipant.user_detail_full_name && processDailyParticipant.isAddProcessDailyParticipant==false">
  411. <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">
  412. </span><span v-else>@{{ processDailyParticipant.unit_count }}</span></td>
  413. <td>
  414. <span v-if="!processDailyParticipant.user_detail_full_name && processDailyParticipant.isAddProcessDailyParticipant==false">
  415. <input :id="processDailyParticipant.daily_id+'remark'" class="form-control" style="width: 100px" type="text">
  416. </span><span v-else>@{{ processDailyParticipant.remark }}</span></td>
  417. <td class="text-danger">@{{ processDailyParticipant.hour }}</td>
  418. <td class="text-danger">@{{ processDailyParticipant.diff }}</td>
  419. <td class="text-danger">@{{ processDailyParticipant.billingHour }}</td>
  420. <td class="text-danger">
  421. @can("人事管理-任务审核")<button @click="processDailyParticipantAudit(processDailyParticipant.id)" v-if="processDailyParticipant.status=='未审核'" class="btn btn-sm btn-outline-success">审核</button>@endcan
  422. <b v-else class="text-success">@{{ processDailyParticipant.status }}</b>
  423. </td>
  424. @can("二次加工管理-临时工资料管理")<td class="text-info"><u v-if="processDailyParticipant.user_detail_full_name" style="cursor:pointer" @click="showUserDetail(processDailyParticipant.user_id)">详情</u></td>@endcan
  425. </tr>
  426. </table>
  427. </td>
  428. </tr>
  429. </template>
  430. </table>
  431. {{$processes->appends($request)->links()}}
  432. </div>
  433. </div>
  434. </div>
  435. @endsection
  436. @section('lastScript')
  437. <script>
  438. new Vue({
  439. el:"#process",
  440. data:{
  441. participantInputting:{},
  442. processesContents:[
  443. @foreach($processes as $processOne)
  444. {id:'{{$processOne->id}}',code:'{{$processOne->code}}',owner_name:'{{$processOne->owner_name}}',owner_id:'{{$processOne->owner_id}}',
  445. process_method_name:'{{$processOne->process_method_name}}',amount:'{{$processOne->amount}}',is_full:'{{$processOne->is_full}}'
  446. ,tutorials:{!! $processOne->tutorials !!},processesContents:{!! $processOne->processesContents !!},unit_price:'{{$processOne->unit_price}}',created_at:'{{$processOne->created_at}}',
  447. completed_amount:'{{$processOne->completed_amount}}',status:'{{$processOne->status}}',remark:'{{$processOne->remark}}',detailFolding:false,openProcessHour:false,},
  448. @endforeach
  449. ],
  450. processes:[],
  451. processesList:[],
  452. owners:[
  453. @foreach($owners as $owner)
  454. {!! $owner !!},
  455. @endforeach
  456. ],
  457. errors:{},
  458. checkData:[],
  459. filterData:{paginate:50,date_start:'',date_end:'',owner_id:'',commodity_barcode:'',wms_code:'',status:''},
  460. processDailies:[],
  461. processDailyParticipants:[],
  462. isShow:{
  463. isOpenProcessHour:false,isAddProcessDailyParticipant:true,isUpdateConfirmBtn:true,
  464. },
  465. userLabors:[],
  466. modalDaily_id:'',
  467. processDailyParticipantOne:{id:'',user_id:'',user_detail_full_name:'',started_at:"",ended_at:"",
  468. hour_price:'',unit_price:'',dinner_duration:'',hour_count:'',unit_count:'',remark:''},
  469. processTutorial:{id:'',owner_id:'',tutorials:[],},
  470. processUnfold:[],
  471. processFullSum:[],
  472. },
  473. watch:{
  474. checkData:{
  475. handler(){
  476. if (this.checkData.length === this.processes.length){
  477. document.querySelector('#all').checked = true;
  478. }else {
  479. document.querySelector('#all').checked = false;
  480. }
  481. },
  482. deep:true
  483. }
  484. },
  485. computed:{
  486. isBeingFilterConditions:function(){
  487. for(let key in this.filterData){
  488. if(this.filterData[key]){
  489. if(key==='paginate')continue;
  490. return true
  491. }
  492. }
  493. return false;
  494. },
  495. },
  496. mounted:function () {
  497. this.initInputs();
  498. this.resetProcessData();
  499. $(".tooltipTarget").tooltip({'trigger':'hover'});
  500. $('#process').removeClass('d-none');
  501. },
  502. methods:{
  503. //重组数据
  504. resetProcessData:function(){
  505. let _this=this;
  506. for (let i=0;i<this.processesContents.length;i++){
  507. let process=this.processesContents[i];
  508. if (process.processesContents.length<1){
  509. let processOne={};
  510. processOne['id']=process.id;
  511. processOne['code']=process.code;
  512. processOne['owner_name']=process.owner_name;
  513. processOne['process_method_name']=process.process_method_name;
  514. processOne['amount']=process.amount;
  515. processOne['tutorials']=process.tutorials;
  516. processOne['unit_price']=process.unit_price;
  517. processOne['created_at']=process.created_at;
  518. processOne['status']=process.status;
  519. processOne['remark']=process.remark;
  520. processOne['completed_amount']=process.completed_amount;
  521. processOne['detailFolding']=false;
  522. processOne['openProcessHour']=false;
  523. this.processes.push(processOne);
  524. continue;
  525. }
  526. process.processesContents.every(function (processesContent,count) {
  527. if (processesContent.is_full==='Y')_this.$set(_this.processFullSum,process.code,_this.processFullSum[process.code]?_this.processFullSum[process.code]+1:1);
  528. let processOne={};
  529. if ((count+1)==process.processesContents.length){
  530. processOne['afterLocation'] = process.id+"-"+process.processesContents.length;
  531. }
  532. if (_this.processesList[process.code]) {
  533. processOne['bill_type'] = processesContent.bill_type;
  534. processOne['wms_code'] = processesContent.wms_code;
  535. processOne['thisAmount']=processesContent.amount;
  536. processOne['commodity_barcodes'] = processesContent.commodity ? processesContent.commodity.barcodes:'';
  537. processOne['commodity_name'] = processesContent.commodity_name;
  538. _this.processes.push(processOne);
  539. }else{
  540. _this.processesList[process.code]=process.id;
  541. processOne['rowspan']=process.processesContents.length;
  542. processOne['id']=process.id;
  543. processOne['code']=process.code;
  544. processOne['owner_name']=process.owner_name;
  545. processOne['owner_id']=process.owner_id;
  546. processOne['process_method_name']=process.process_method_name;
  547. processOne['tutorials']=process.tutorials;
  548. processOne['amount']=process.amount;
  549. processOne['unit_price']=process.unit_price;
  550. processOne['created_at']=process.created_at;
  551. processOne['status']=process.status;
  552. processOne['remark']=process.remark;
  553. processOne['completed_amount']=process.completed_amount;
  554. processOne['detailFolding']=false;
  555. processOne['openProcessHour']=false;
  556. processOne['bill_type']=processesContent.bill_type;
  557. processOne['wms_code']=processesContent.wms_code;
  558. processOne['thisAmount']=processesContent.amount;
  559. processOne['commodity_barcodes']=processesContent.commodity ? processesContent.commodity.barcodes:'';
  560. processOne['commodity_name']=processesContent.commodity_name;
  561. processOne['count']=process.processesContents.length;
  562. _this.processes.push(processOne);
  563. }
  564. return true;
  565. });
  566. }
  567. },
  568. //回显条件参数
  569. initInputs:function(){
  570. let data=this;
  571. let uriParts =decodeURI(location.href).split("?");
  572. if(uriParts.length>1){
  573. let params = uriParts[1].split('&');
  574. params.forEach(function(paramPair){
  575. let pair=paramPair.split('=');
  576. let key = pair[0], val = pair[1];
  577. if (val!=="+"){
  578. $('input[name="'+key+'"]').val(val);
  579. $('select[name="'+key+'"]').val(val);
  580. decodeURI(data.filterData[key]=val);
  581. }
  582. });
  583. }
  584. },
  585. //提交表单
  586. submit:function(){
  587. let form = $("#optionSubmit");
  588. form.submit();
  589. },
  590. //全选事件
  591. checkAll(e){
  592. if (e.target.checked){
  593. this.processes.forEach((el,i)=>{
  594. if (this.checkData.indexOf(el.id) == '-1'){
  595. this.checkData.push(el.id);
  596. }
  597. });
  598. }else {
  599. this.checkData = [];
  600. }
  601. },
  602. //导出excel,因同步问题不使用formData
  603. processExport(e){
  604. let val=e;
  605. let data=this.filterData;
  606. if (val==1){
  607. if (this.checkData&&this.checkData.length<=0){
  608. tempTip.setDuration(4000);
  609. tempTip.showSuccess('没有勾选任何记录');
  610. }else{
  611. location.href="{{url('process?checkSign=')}}"+this.checkData;
  612. }
  613. } else {
  614. location.href="{{url('process?checkSign=-1&date_start=')}}"+
  615. data.date_start+"&date_end="+data.date_end+"&owner_id="+
  616. data.owner_id+"&commodity_barcode="+data.commodity_barcode+"&wms_code="+data.wms_code+
  617. "&status="+data.status;
  618. }
  619. },
  620. //获取登记工时
  621. openProcessHour(process){
  622. let e=process.id;
  623. let _this=this;
  624. if (_this.isShow.isOpenProcessHour){
  625. _this.processes.every(function (process) {
  626. if (process.openProcessHour){
  627. process.openProcessHour=false;
  628. _this.processDailies=[];
  629. _this.processDailyParticipants=[];
  630. return false;
  631. }
  632. return true;
  633. });
  634. }else{
  635. _this.isShow.isOpenProcessHour=true;
  636. }
  637. axios.post("{{url("process/getDailyParticipant")}}",{id:e,amount:process.amount})
  638. .then(function (response) {
  639. let processDailies=response.data;
  640. for (let i=0;i<processDailies.length;i++){
  641. let processDailyParticipants=processDailies[i].process_daily_participants;
  642. if (processDailyParticipants.length<=0){
  643. let data={};
  644. data['daily_id']=processDailies[i].id;
  645. data['date']=processDailies[i].date;
  646. data['output']=processDailies[i].output;
  647. data['remain']=processDailies[i].remain;
  648. data['rowspan']=1;
  649. data['readonly']="true";
  650. data['isAddProcessDailyParticipant']="true";
  651. data['isConfirmBtn']="true";
  652. data['submitOutput']=processDailies[i].output;
  653. _this.processDailyParticipants.push(data);
  654. continue;
  655. }
  656. for (let j=0;j<processDailyParticipants.length;j++){
  657. let data={};
  658. data['id']=processDailyParticipants[j].id;
  659. data['status']=processDailyParticipants[j].status;
  660. data['started_at']=processDailyParticipants[j].started_at;
  661. data['user_detail_full_name']=processDailyParticipants[j].user_detail_full_name;
  662. data['user_id']=processDailyParticipants[j].user_id;
  663. data['ended_at']=processDailyParticipants[j].ended_at;
  664. data['hour_price']=processDailyParticipants[j].hour_price;
  665. data['unit_price']=processDailyParticipants[j].unit_price;
  666. data['dinner_duration']=processDailyParticipants[j].dinner_duration;
  667. data['hour_count']=processDailyParticipants[j].hour_count;
  668. data['remark']=processDailyParticipants[j].remark;
  669. data['hour']=processDailyParticipants[j].hour;
  670. data['diff']=processDailyParticipants[j].diff;
  671. data['billingHour']=processDailyParticipants[j].billingHour;
  672. data['unit_count']=processDailyParticipants[j].unit_count;
  673. data['process_id']=processDailies[i].process_id;
  674. data['readonly']="true";
  675. if (!_this.processDailies[processDailies[i].id]){
  676. data['rowspan']=processDailyParticipants.length;
  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['submitOutput']=processDailies[i].output;
  682. data['isAddProcessDailyParticipant']="true";
  683. data['isConfirmBtn']="true";
  684. _this.processDailies[processDailies[i].id]=processDailies[i].id;
  685. }
  686. _this.processDailyParticipants.push(data);
  687. }
  688. }
  689. }).catch(function (err) {
  690. tempTip.setDuration(5000);
  691. tempTip.show('获取登记工时数据发生了一些严重错误:'+err);
  692. });
  693. let processDailyParticipantsHtml=$("#addProcessDailyParticipants");
  694. if (process.count) $("#"+e+"-"+process.count).after(processDailyParticipantsHtml);
  695. else $("#"+e).after(processDailyParticipantsHtml)
  696. },
  697. //删除工时显示
  698. closeProcessHour(e){
  699. this.processDailies=[];
  700. this.processDailyParticipants=[];
  701. },
  702. //新增参与人
  703. addProcessDailyParticipant(processDailyParticipantOne){
  704. let id=processDailyParticipantOne.id;
  705. if (!id) return;
  706. let _this=this;
  707. _this.errors={};
  708. this.processDailyParticipants.every(function (processDailyParticipant,i) {
  709. if (processDailyParticipant.id==id){
  710. processDailyParticipant.rowspan++;
  711. let data={};
  712. data['readonly']="true";
  713. data['isAddProcessDailyParticipant']="true";
  714. data['isConfirmBtn']="true";
  715. data['id']=processDailyParticipant.id;
  716. data['user_id']=processDailyParticipant.user_id;
  717. data['status']=processDailyParticipant.status;
  718. data['started_at']=processDailyParticipant.started_at;
  719. data['user_detail_full_name']=processDailyParticipant.user_detail_full_name;
  720. data['ended_at']=processDailyParticipant.ended_at;
  721. data['hour_price']=processDailyParticipant.hour_price;
  722. data['unit_price']=processDailyParticipant.unit_price;
  723. data['dinner_duration']=processDailyParticipant.dinner_duration;
  724. data['hour_count']=processDailyParticipant.hour_count;
  725. data['remark']=processDailyParticipant.remark;
  726. data['hour']=processDailyParticipant.hour;
  727. data['diff']=processDailyParticipant.diff;
  728. data['billingHour']=processDailyParticipant.billingHour;
  729. data['unit_count']=processDailyParticipant.unit_count;
  730. data['process_id']=processDailyParticipant.process_id;
  731. _this.processDailyParticipants.splice(i+1,0,data);
  732. processDailyParticipant.id='';
  733. processDailyParticipant.status='';
  734. processDailyParticipant.started_at='';
  735. processDailyParticipant.user_detail_full_name='';
  736. processDailyParticipant.ended_at='';
  737. processDailyParticipant.hour_price='';
  738. processDailyParticipant.unit_price='';
  739. processDailyParticipant.dinner_duration='';
  740. processDailyParticipant.hour_count='';
  741. processDailyParticipant.remark='';
  742. processDailyParticipant.hour='';
  743. processDailyParticipant.diff='';
  744. processDailyParticipant.billingHour='';
  745. processDailyParticipant.unit_count='';
  746. processDailyParticipant.process_id='';
  747. return false;
  748. }
  749. return true;
  750. });
  751. _this.isShow.isAddProcessDailyParticipant=false;
  752. },
  753. //取消录入参与人
  754. deleteProcessDailyParticipant($event,daily_id,processDailyParticipant_name,isConfirmBtn){
  755. console.log($event,daily_id,processDailyParticipant_name,isConfirmBtn);
  756. if (!isConfirmBtn) {
  757. this.processDailyParticipants.every(function (processDailyParticipant) {
  758. if(processDailyParticipant.daily_id==daily_id){
  759. processDailyParticipant.isConfirmBtn=true; //放出隐藏确定按钮
  760. return false;
  761. }
  762. return true;
  763. });
  764. }
  765. let _this=this;
  766. this.processDailyParticipants.every(function (processDailyParticipant,i) {
  767. if(processDailyParticipant.daily_id==daily_id){
  768. if (!processDailyParticipant_name&&_this.processDailyParticipants[i+1]&&_this.processDailyParticipants[i+1].daily_id)return false;
  769. if (!_this.processDailyParticipants[i+1])return false;
  770. _this.processDailyParticipants[i+1].rowspan=(processDailyParticipant.rowspan)-1;
  771. _this.processDailyParticipants[i+1].daily_id=processDailyParticipant.daily_id;
  772. _this.processDailyParticipants[i+1].date=processDailyParticipant.date;
  773. _this.processDailyParticipants[i+1].output=processDailyParticipant.output;
  774. _this.processDailyParticipants[i+1].remain=processDailyParticipant.remain;
  775. _this.processDailyParticipants[i+1].submitOutput=processDailyParticipant.submitOutput;
  776. _this.processDailyParticipants.splice(i,1);
  777. return false;
  778. }
  779. return true;
  780. });
  781. _this.isShow.isAddProcessDailyParticipant=true;
  782. },
  783. //驳回
  784. processReject(id){
  785. if(!confirm('确定驳回该单吗?')){return};
  786. let url="{{url('process/reject')}}"+"/"+id;
  787. let _this=this;
  788. axios.post(url)
  789. .then(function (response) {
  790. _this.processes.every(function (process) {
  791. if (process.id==response.data.id){
  792. process.status=response.data.status;
  793. return false;
  794. }
  795. return true;
  796. });
  797. tempTip.setDuration(3000);
  798. tempTip.showSuccess('驳回成功!');
  799. }).catch(function (err) {
  800. tempTip.setDuration(5000);
  801. tempTip.show('驳回二次加工单发生了一些严重错误:'+err);
  802. })
  803. },
  804. //接单
  805. processReceive(id){
  806. let url="{{url('process/receive')}}"+"/"+id;
  807. let _this=this;
  808. axios.post(url)
  809. .then(function (response) {
  810. _this.processes.every(function (process) {
  811. if (process.id==response.data.id){
  812. process.status=response.data.status;
  813. return false;
  814. }
  815. return true;
  816. });
  817. tempTip.setDuration(3000);
  818. tempTip.showSuccess('接单成功!');
  819. }).catch(function (err) {
  820. tempTip.setDuration(5000);
  821. tempTip.show('接单时发生了一些严重错误:'+err);
  822. })
  823. },
  824. //完成
  825. processAccomplish(id){
  826. if(!confirm('确定完成验收吗?')){return};
  827. let url="{{url('process/accomplish')}}"+"/"+id;
  828. let _this=this;
  829. axios.post(url)
  830. .then(function (response) {
  831. _this.processes.every(function (process) {
  832. if (process.id==response.data.id){
  833. process.status=response.data.status;
  834. process.completed_amount=response.data.completed_amount;
  835. return false;
  836. }
  837. return true;
  838. });
  839. tempTip.setDuration(3000);
  840. tempTip.showSuccess('验收完成!');
  841. }).catch(function (err) {
  842. tempTip.setDuration(5000);
  843. tempTip.show('验收时发生了一些严重错误:'+err);
  844. })
  845. },
  846. //定位客户
  847. owner_seek:function (e) {
  848. let _this=this;
  849. let $val=e.target.value;
  850. if($val==='')_this.filterData.owner_id='';
  851. else
  852. _this.owners.forEach(function (owner) {
  853. if (owner.name.includes($val)){
  854. _this.filterData.owner_id=owner.id;
  855. }
  856. });
  857. },
  858. //修改每日产量
  859. submitOutputData(daily_id,data,id){
  860. let url="{{url('process/updateDailyOutput')}}";
  861. let _this=this;
  862. axios.post(url,{id:daily_id,output:data})
  863. .then(function (response) {
  864. if (response.data.status=="error"){
  865. tempTip.setDuration(3000);
  866. tempTip.show('输入有误:'+response.data.data.output);
  867. }
  868. if (response.data.status=="success"){
  869. let processDailies=response.data.data;
  870. _this.processDailyParticipants.every(function (processDailyParticipant) {
  871. if (processDailyParticipant.id==id) {
  872. processDailyParticipant.readonly=true;
  873. }
  874. processDailies.every(function (processDaily) {
  875. if (processDailyParticipant.date==processDaily.date){
  876. processDailyParticipant.output=processDaily.output;
  877. processDailyParticipant.remain=processDaily.remain;
  878. return false;
  879. }
  880. return true;
  881. });
  882. return true;
  883. });
  884. if (response.data.process) {
  885. _this.processes.every(function (process) {
  886. if(process.id==response.data.process){
  887. process.status="待验收";
  888. return false;
  889. }
  890. return true;
  891. });
  892. }
  893. tempTip.setDuration(3000);
  894. tempTip.showSuccess('每日产量修改成功!');
  895. }
  896. }).catch(function (err) {
  897. tempTip.setDuration(5000);
  898. tempTip.show('修改每日产量发生了一些严重错误:'+err);
  899. });
  900. },
  901. //验证临时工
  902. verifyUserName(e,daily_id,isConfirmBtn){
  903. let user=e.target.value;
  904. let _this=this;
  905. axios.post('{{url('process/verifyUserName')}}',{userName:user})
  906. .then(function (response) {
  907. //修改时验证
  908. if (!daily_id){
  909. //验证失败
  910. if(response.data.length<1){
  911. _this.isShow.isUpdateConfirmBtn=false;
  912. _this.errors['user_id']="查无此人,请检查您的输入";
  913. return;
  914. }
  915. //验证成功且结果仅有一个
  916. if (response.data.user_id){
  917. _this.isShow.isUpdateConfirmBtn=true;
  918. _this.errors['user_id']="";
  919. _this.processDailyParticipantOne.user_id=response.data.user_id;
  920. return;
  921. }
  922. //验证成功多结果
  923. if (response.data.length>1){
  924. _this.userLabors=response.data;
  925. $("#myModal").modal('show');
  926. return;
  927. }
  928. }
  929. //验证失败
  930. if(response.data.length<1){
  931. _this.processDailyParticipants.every(function (processDailyParticipant) {
  932. if(processDailyParticipant.daily_id==daily_id){
  933. _this.errors['user_id']="查无此人,请检查您的输入";
  934. setTimeout(function(){
  935. $(".tooltipTargetError").tooltip('show');
  936. },1);
  937. processDailyParticipant.isConfirmBtn=false; //验证失败隐藏确定按钮
  938. return false;
  939. }
  940. return true;
  941. });
  942. return;
  943. }
  944. //按钮被隐藏则放出
  945. if (!isConfirmBtn){
  946. _this.processDailyParticipants.every(function (processDailyParticipant) {
  947. if(processDailyParticipant.daily_id==daily_id){
  948. processDailyParticipant.isConfirmBtn=true; //验证失败隐藏确定按钮
  949. return false;
  950. }
  951. return true;
  952. });
  953. }
  954. _this.modalDaily_id=daily_id;
  955. //验证成功且结果仅有一个
  956. if (response.data.user_id){
  957. _this.errors['user_id']="";
  958. $("#"+daily_id+"user_id").val(response.data.user_id);
  959. $("#"+daily_id+"hour_price").val(response.data.user_labor.default_hour_price);
  960. }
  961. //验证成功多结果
  962. if (response.data.length>1){
  963. _this.userLabors=response.data;
  964. $("#myModal").modal('show');
  965. }
  966. }).catch(function (err) {
  967. tempTip.setDuration(5000);
  968. tempTip.show('验证临时工发生了一些严重错误:'+err);
  969. })
  970. },
  971. //验证时间合法性
  972. hourFilter(e){
  973. datetimeRelating.verifyTime(e);
  974. },
  975. //提交参与人
  976. submitProcessDailyParticipant(e){
  977. let request={};
  978. request['user_id']=$("#"+e+"user_id").val();
  979. request['started_at']=$("#"+e+"started_at").val();
  980. request['ended_at']=$("#"+e+"ended_at").val();
  981. let hour_price=$("#"+e+"hour_price").val();
  982. if (hour_price) request['hour_price']=hour_price;
  983. let unit_price=$("#"+e+"unit_price").val();
  984. if (unit_price) request['unit_price']=unit_price;
  985. let dinner_duration=$("#"+e+"dinner_duration").val();
  986. if (dinner_duration) request['dinner_duration']=dinner_duration;
  987. let hour_count=$("#"+e+"hour_count").val();
  988. if (hour_count) request['hour_count']=hour_count;
  989. let unit_count=$("#"+e+"unit_count").val();
  990. if (unit_count) request['unit_count']=unit_count;
  991. let remark=$("#"+e+"remark").val();
  992. if (remark) request['remark']=remark;
  993. request['daily_id']=this.modalDaily_id;
  994. let _this=this;
  995. axios.post("{{url('process/shortProcessDailyParticipant')}}", request)
  996. .then(function (response) {
  997. if (response.data.status=="error"){
  998. tempTip.setDuration(3000);
  999. _this.errors=response.data.data;
  1000. setTimeout(function(){
  1001. $(".tooltipTargetError").tooltip('show');
  1002. },1);
  1003. return;
  1004. }
  1005. if (response.data.status=="success"){
  1006. _this.processDailyParticipants.every(function (processDailyParticipant) {
  1007. if (processDailyParticipant.daily_id==e){
  1008. processDailyParticipant.id=response.data.data.id;
  1009. processDailyParticipant.status=response.data.data.status;
  1010. processDailyParticipant.user_detail_full_name=response.data.data.user_detail_full_name;
  1011. processDailyParticipant.user_id=response.data.data.user_id;
  1012. processDailyParticipant.started_at=response.data.data.started_at;
  1013. processDailyParticipant.ended_at=response.data.data.ended_at;
  1014. processDailyParticipant.hour_price=response.data.data.hour_price;
  1015. processDailyParticipant.unit_price=response.data.data.unit_price;
  1016. processDailyParticipant.dinner_duration=response.data.data.dinner_duration;
  1017. processDailyParticipant.hour_count=response.data.data.hour_count;
  1018. processDailyParticipant.unit_count=response.data.data.unit_count;
  1019. processDailyParticipant.remark=response.data.data.remark;
  1020. processDailyParticipant.hour=response.data.data.hour;
  1021. processDailyParticipant.diff=response.data.data.diff;
  1022. processDailyParticipant.billingHour=response.data.data.billingHour;
  1023. processDailyParticipant.isAddProcessDailyParticipant=true;
  1024. _this.isShow.isAddProcessDailyParticipant=true;
  1025. return false;
  1026. }
  1027. return true;
  1028. });
  1029. if (response.data.process){
  1030. _this.processes.every(function (process) {
  1031. if (process.id==response.data.process){
  1032. process.status="加工中";
  1033. return false;
  1034. }
  1035. return true;
  1036. });
  1037. }
  1038. tempTip.setDuration(3000);
  1039. tempTip.showSuccess('参与人新增成功!');
  1040. }
  1041. }).catch(function (err) {
  1042. tempTip.setDuration(5000);
  1043. tempTip.show('新增参与人发生了一些严重错误:'+err);
  1044. })
  1045. },
  1046. //同名临时工选择
  1047. selectedUser(user_id,hour_price){
  1048. $("#myModal").modal('hide');
  1049. this.errors['user_id']="";
  1050. this.processDailyParticipantOne['user_id']=user_id;
  1051. this.processDailyParticipantOne['hour_price']=hour_price;
  1052. this.isShow.isUpdateConfirmBtn=true;
  1053. $("#"+this.modalDaily_id+"user_id").val(user_id);
  1054. $("#"+this.modalDaily_id+"hour_price").val(hour_price);
  1055. },
  1056. //修改参与人
  1057. updateProcessDailyParticipant(processDailyParticipant){
  1058. this.errors={};
  1059. this.processDailyParticipantOne['id']=processDailyParticipant.id;
  1060. this.processDailyParticipantOne['user_detail_full_name']=processDailyParticipant.user_detail_full_name;
  1061. this.processDailyParticipantOne['user_id']=processDailyParticipant.user_id;
  1062. this.processDailyParticipantOne['started_at']=processDailyParticipant.started_at;
  1063. this.processDailyParticipantOne['ended_at']=processDailyParticipant.ended_at;
  1064. this.processDailyParticipantOne['hour_price']=processDailyParticipant.hour_price;
  1065. this.processDailyParticipantOne['unit_price']=processDailyParticipant.unit_price;
  1066. this.processDailyParticipantOne['dinner_duration']=processDailyParticipant.dinner_duration;
  1067. this.processDailyParticipantOne['hour_count']=processDailyParticipant.hour_count;
  1068. this.processDailyParticipantOne['unit_count']=processDailyParticipant.unit_count;
  1069. this.processDailyParticipantOne['remark']=processDailyParticipant.remark;
  1070. $("#updateModal").modal('show');
  1071. },
  1072. //提交修改
  1073. submitUpdateProcessDailyParticipant(){
  1074. let _this=this;
  1075. axios.post("{{url('process/updateProcessDailyParticipant')}}",this.processDailyParticipantOne)
  1076. .then(function (response) {
  1077. if (response.data.status=="error"){
  1078. tempTip.setDuration(3000);
  1079. _this.errors=response.data.data;
  1080. }
  1081. if (response.data.status=="success"){
  1082. _this.processDailyParticipants.every(function (processDailyParticipant) {
  1083. if (processDailyParticipant.id==response.data.data.id){
  1084. processDailyParticipant.status=response.data.data.status;
  1085. processDailyParticipant.user_detail_full_name=response.data.data.user_detail_full_name;
  1086. processDailyParticipant.started_at=response.data.data.started_at;
  1087. processDailyParticipant.ended_at=response.data.data.ended_at;
  1088. processDailyParticipant.hour_price=response.data.data.hour_price;
  1089. processDailyParticipant.unit_price=response.data.data.unit_price;
  1090. processDailyParticipant.dinner_duration=response.data.data.dinner_duration;
  1091. processDailyParticipant.hour_count=response.data.data.hour_count;
  1092. processDailyParticipant.unit_count=response.data.data.unit_count;
  1093. processDailyParticipant.remark=response.data.data.remark;
  1094. processDailyParticipant.hour=response.data.data.hour;
  1095. processDailyParticipant.diff=response.data.data.diff;
  1096. processDailyParticipant.billingHour=response.data.data.billingHour;
  1097. processDailyParticipant.isAddProcessDailyParticipant=true;
  1098. return false;
  1099. }
  1100. return true;
  1101. });
  1102. tempTip.setDuration(3000);
  1103. tempTip.showSuccess('参与人修改成功!');
  1104. $("#updateModal").modal('hide');
  1105. }
  1106. }).catch(function (err) {
  1107. tempTip.setDuration(5000);
  1108. tempTip.show('修改参与人发生了一些严重错误:'+err);
  1109. })
  1110. },
  1111. //登记工时参与人审核
  1112. processDailyParticipantAudit(id){
  1113. if(!confirm('审核后不能撤销及修改,确定通过审核吗?')){return};
  1114. let _this=this;
  1115. axios.post("{{url('process/processDailyParticipantAudit')}}"+"/"+id)
  1116. .then(function (response) {
  1117. if (response.data.success){
  1118. _this.processDailyParticipants.every(function (processDailyParticipant) {
  1119. if (processDailyParticipant.id==response.data.processDailyParticipant.id){
  1120. processDailyParticipant.status=response.data.processDailyParticipant.status;
  1121. return false;
  1122. }
  1123. return true;
  1124. });
  1125. tempTip.setDuration(3000);
  1126. tempTip.showSuccess('参与人审核通过!');
  1127. return;
  1128. }
  1129. tempTip.setDuration(3000);
  1130. tempTip.show('参与人失败!');
  1131. }).catch(function (err) {
  1132. tempTip.setDuration(5000);
  1133. tempTip.show('审核参与人发生了一些严重错误:'+err);
  1134. });
  1135. },
  1136. //临时工详情
  1137. showUserDetail(id){
  1138. window.open("{{url('maintenance/userLabor')}}/"+id);
  1139. },
  1140. //显示教程
  1141. showTutorial(id) {
  1142. axios.post('{{url('maintenance/tutorial/showContent')}}'+"/"+id)
  1143. .then(function (response) {
  1144. if (response.data.success){
  1145. $("#content").html(response.data.data);
  1146. $("#showTutorial").modal('show');
  1147. }
  1148. }).catch(function (err) {
  1149. tempTip.setDuration(3000);
  1150. tempTip.show('获取教程失败!'+'网络错误:' + err);
  1151. });
  1152. },
  1153. //新增教程
  1154. addTutorials(id,owner_id){
  1155. let _this=this;
  1156. axios.post('{{url('process/getTutorials')}}'+"/"+id)
  1157. .then(function (response) {
  1158. if(response.data.success){
  1159. _this.processTutorial.id=id;
  1160. _this.processTutorial.owner_id=owner_id;
  1161. _this.processTutorial.tutorials=response.data.data;
  1162. $("#addTutorial").modal("show");
  1163. return;
  1164. }
  1165. tempTip.setDuration(3000);
  1166. tempTip.show('获取教程失败!未知错误:'+response.data );
  1167. }).catch(function (err) {
  1168. tempTip.setDuration(3000);
  1169. tempTip.show('获取教程失败!'+'网络错误:' + err);
  1170. });
  1171. },
  1172. //选择教程
  1173. selectedTutorial(process_id,tutorial_id){
  1174. let _this=this;
  1175. axios.post('{{url('process/selectedTutorial')}}',{process_id:process_id,tutorial_id,tutorial_id})
  1176. .then(function (response) {
  1177. if (response.data.success){
  1178. _this.processes.every(function (process) {
  1179. if (process.id==process_id){
  1180. process.tutorials.push(response.data.data);
  1181. return false;
  1182. }
  1183. return true;
  1184. });
  1185. $("#addTutorial").modal("hide");
  1186. tempTip.setDuration(3000);
  1187. tempTip.showSuccess('添加成功!');
  1188. return;
  1189. }
  1190. tempTip.setDuration(3000);
  1191. tempTip.show('添加教程失败!发生错误:' + response.data.data);
  1192. }).catch(function (err) {
  1193. tempTip.setDuration(3000);
  1194. tempTip.show('添加教程失败!'+'网络错误:' + err);
  1195. });
  1196. },
  1197. //删除教程
  1198. deleteTutorials(process_id,tutorial_id){
  1199. let _this=this;
  1200. axios.post('{{url('process/deleteTutorial')}}',{process_id:process_id,tutorial_id,tutorial_id})
  1201. .then(function (response) {
  1202. if (response.data.success){
  1203. _this.processes.every(function (process) {
  1204. if (process.id==process_id){
  1205. process.tutorials.every(function (tutorial,i) {
  1206. if (tutorial.id==tutorial_id) {
  1207. process.tutorials.splice(i,1)
  1208. return false;
  1209. }
  1210. return true;
  1211. });
  1212. return false;
  1213. }
  1214. return true;
  1215. });
  1216. tempTip.setDuration(3000);
  1217. tempTip.showSuccess('删除成功!');
  1218. return;
  1219. }
  1220. tempTip.setDuration(3000);
  1221. tempTip.show('删除教程失败!发生错误:' + response.data.data);
  1222. }).catch(function (err) {
  1223. tempTip.setDuration(3000);
  1224. tempTip.show('删除教程失败!'+'网络错误:' + err);
  1225. } );
  1226. },
  1227. processEdit(id){
  1228. location.href = "{{url('process')}}/"+id+"/edit";
  1229. },
  1230. //去往新增教程
  1231. addTutorial() {
  1232. window.open("{{url('maintenance/tutorial/create?owner_id=')}}" + this.processTutorial.owner_id);
  1233. },
  1234. //展开内容单
  1235. unfold(code,is_full){
  1236. this.processUnfold=[];
  1237. this.$set(this.processUnfold,code,is_full);
  1238. },
  1239. },
  1240. });
  1241. </script>
  1242. @endsection