index.blade.php 81 KB

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