index.blade.php 81 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240
  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. console.log($event,daily_id,processDailyParticipant_name,isConfirmBtn);
  750. if (!isConfirmBtn) {
  751. this.processDailyParticipants.every(function (processDailyParticipant) {
  752. if(processDailyParticipant.daily_id==daily_id){
  753. processDailyParticipant.isConfirmBtn=true; //放出隐藏确定按钮
  754. return false;
  755. }
  756. return true;
  757. });
  758. }
  759. let _this=this;
  760. this.processDailyParticipants.every(function (processDailyParticipant,i) {
  761. if(processDailyParticipant.daily_id==daily_id){
  762. if (!processDailyParticipant_name&&_this.processDailyParticipants[i+1]&&_this.processDailyParticipants[i+1].daily_id)return false;
  763. if (!_this.processDailyParticipants[i+1])return false;
  764. _this.processDailyParticipants[i+1].rowspan=(processDailyParticipant.rowspan)-1;
  765. _this.processDailyParticipants[i+1].daily_id=processDailyParticipant.daily_id;
  766. _this.processDailyParticipants[i+1].date=processDailyParticipant.date;
  767. _this.processDailyParticipants[i+1].output=processDailyParticipant.output;
  768. _this.processDailyParticipants[i+1].remain=processDailyParticipant.remain;
  769. _this.processDailyParticipants[i+1].submitOutput=processDailyParticipant.submitOutput;
  770. _this.processDailyParticipants.splice(i,1);
  771. return false;
  772. }
  773. return true;
  774. });
  775. _this.isShow.isAddProcessDailyParticipant=true;
  776. },
  777. //驳回
  778. processReject(id){
  779. if(!confirm('确定驳回该单吗?')){return};
  780. let url="{{url('process/reject')}}"+"/"+id;
  781. let _this=this;
  782. axios.post(url)
  783. .then(function (response) {
  784. _this.processes.every(function (process) {
  785. if (process.id==response.data.id){
  786. process.status=response.data.status;
  787. return false;
  788. }
  789. return true;
  790. });
  791. tempTip.setDuration(3000);
  792. tempTip.showSuccess('驳回成功!');
  793. }).catch(function (err) {
  794. tempTip.setDuration(5000);
  795. tempTip.show('驳回二次加工单发生了一些严重错误:'+err);
  796. })
  797. },
  798. //接单
  799. processReceive(id){
  800. let url="{{url('process/receive')}}"+"/"+id;
  801. let _this=this;
  802. axios.post(url)
  803. .then(function (response) {
  804. _this.processes.every(function (process) {
  805. if (process.id==response.data.id){
  806. process.status=response.data.status;
  807. return false;
  808. }
  809. return true;
  810. });
  811. tempTip.setDuration(3000);
  812. tempTip.showSuccess('接单成功!');
  813. }).catch(function (err) {
  814. tempTip.setDuration(5000);
  815. tempTip.show('接单时发生了一些严重错误:'+err);
  816. })
  817. },
  818. //完成
  819. processAccomplish(id){
  820. if(!confirm('确定完成验收吗?')){return};
  821. let url="{{url('process/accomplish')}}"+"/"+id;
  822. let _this=this;
  823. axios.post(url)
  824. .then(function (response) {
  825. _this.processes.every(function (process) {
  826. if (process.id==response.data.id){
  827. process.status=response.data.status;
  828. process.completed_amount=response.data.completed_amount;
  829. return false;
  830. }
  831. return true;
  832. });
  833. tempTip.setDuration(3000);
  834. tempTip.showSuccess('验收完成!');
  835. }).catch(function (err) {
  836. tempTip.setDuration(5000);
  837. tempTip.show('验收时发生了一些严重错误:'+err);
  838. })
  839. },
  840. //定位客户
  841. owner_seek:function (e) {
  842. let _this=this;
  843. let $val=e.target.value;
  844. if($val==='')_this.filterData.owner_id='';
  845. else
  846. _this.owners.forEach(function (owner) {
  847. if (owner.name.includes($val)){
  848. _this.filterData.owner_id=owner.id;
  849. }
  850. });
  851. },
  852. //修改每日产量
  853. submitOutputData(daily_id,data,id){
  854. let url="{{url('process/updateDailyOutput')}}";
  855. let _this=this;
  856. axios.post(url,{id:daily_id,output:data})
  857. .then(function (response) {
  858. if (response.data.status=="error"){
  859. tempTip.setDuration(3000);
  860. tempTip.show('输入有误:'+response.data.data.output);
  861. }
  862. if (response.data.status=="success"){
  863. let processDailies=response.data.data;
  864. _this.processDailyParticipants.every(function (processDailyParticipant) {
  865. if (processDailyParticipant.id==id) {
  866. processDailyParticipant.readonly=true;
  867. }
  868. processDailies.every(function (processDaily) {
  869. if (processDailyParticipant.date==processDaily.date){
  870. processDailyParticipant.output=processDaily.output;
  871. processDailyParticipant.remain=processDaily.remain;
  872. return false;
  873. }
  874. return true;
  875. });
  876. return true;
  877. });
  878. if (response.data.process) {
  879. _this.processes.every(function (process) {
  880. if(process.id==response.data.process){
  881. process.status="待验收";
  882. return false;
  883. }
  884. return true;
  885. });
  886. }
  887. tempTip.setDuration(3000);
  888. tempTip.showSuccess('每日产量修改成功!');
  889. }
  890. }).catch(function (err) {
  891. tempTip.setDuration(5000);
  892. tempTip.show('修改每日产量发生了一些严重错误:'+err);
  893. });
  894. },
  895. //验证临时工
  896. verifyUserName(e,daily_id,isConfirmBtn){
  897. let user=e.target.value;
  898. let _this=this;
  899. axios.post('{{url('process/verifyUserName')}}',{userName:user})
  900. .then(function (response) {
  901. //修改时验证
  902. if (!daily_id){
  903. //验证失败
  904. if(response.data.length<1){
  905. _this.isShow.isUpdateConfirmBtn=false;
  906. _this.errors['user_id']="查无此人,请检查您的输入";
  907. return;
  908. }
  909. //验证成功且结果仅有一个
  910. if (response.data.user_id){
  911. _this.isShow.isUpdateConfirmBtn=true;
  912. _this.errors['user_id']="";
  913. _this.processDailyParticipantOne.user_id=response.data.user_id;
  914. return;
  915. }
  916. //验证成功多结果
  917. if (response.data.length>1){
  918. _this.userLabors=response.data;
  919. $("#myModal").modal('show');
  920. return;
  921. }
  922. }
  923. //验证失败
  924. if(response.data.length<1){
  925. _this.processDailyParticipants.every(function (processDailyParticipant) {
  926. if(processDailyParticipant.daily_id==daily_id){
  927. _this.errors['user_id']="查无此人,请检查您的输入";
  928. setTimeout(function(){
  929. $(".tooltipTargetError").tooltip('show');
  930. },1);
  931. processDailyParticipant.isConfirmBtn=false; //验证失败隐藏确定按钮
  932. return false;
  933. }
  934. return true;
  935. });
  936. return;
  937. }
  938. //按钮被隐藏则放出
  939. if (!isConfirmBtn){
  940. _this.processDailyParticipants.every(function (processDailyParticipant) {
  941. if(processDailyParticipant.daily_id==daily_id){
  942. processDailyParticipant.isConfirmBtn=true; //验证失败隐藏确定按钮
  943. return false;
  944. }
  945. return true;
  946. });
  947. }
  948. _this.modalDaily_id=daily_id;
  949. //验证成功且结果仅有一个
  950. if (response.data.user_id){
  951. _this.errors['user_id']="";
  952. $("#"+daily_id+"user_id").val(response.data.user_id);
  953. $("#"+daily_id+"hour_price").val(response.data.user_labor.default_hour_price);
  954. }
  955. //验证成功多结果
  956. if (response.data.length>1){
  957. _this.userLabors=response.data;
  958. $("#myModal").modal('show');
  959. }
  960. }).catch(function (err) {
  961. tempTip.setDuration(5000);
  962. tempTip.show('验证临时工发生了一些严重错误:'+err);
  963. })
  964. },
  965. //验证时间合法性
  966. hourFilter(e){
  967. datetimeRelating.verifyTime(e);
  968. },
  969. //提交参与人
  970. submitProcessDailyParticipant(e){
  971. let request={};
  972. request['user_id']=$("#"+e+"user_id").val();
  973. request['started_at']=$("#"+e+"started_at").val();
  974. request['ended_at']=$("#"+e+"ended_at").val();
  975. let hour_price=$("#"+e+"hour_price").val();
  976. if (hour_price) request['hour_price']=hour_price;
  977. let unit_price=$("#"+e+"unit_price").val();
  978. if (unit_price) request['unit_price']=unit_price;
  979. let dinner_duration=$("#"+e+"dinner_duration").val();
  980. if (dinner_duration) request['dinner_duration']=dinner_duration;
  981. let hour_count=$("#"+e+"hour_count").val();
  982. if (hour_count) request['hour_count']=hour_count;
  983. let unit_count=$("#"+e+"unit_count").val();
  984. if (unit_count) request['unit_count']=unit_count;
  985. let remark=$("#"+e+"remark").val();
  986. if (remark) request['remark']=remark;
  987. request['daily_id']=this.modalDaily_id;
  988. let _this=this;
  989. axios.post("{{url('process/shortProcessDailyParticipant')}}", request)
  990. .then(function (response) {
  991. if (response.data.status=="error"){
  992. tempTip.setDuration(3000);
  993. _this.errors=response.data.data;
  994. setTimeout(function(){
  995. $(".tooltipTargetError").tooltip('show');
  996. },1);
  997. return;
  998. }
  999. if (response.data.status=="success"){
  1000. _this.processDailyParticipants.every(function (processDailyParticipant) {
  1001. if (processDailyParticipant.daily_id==e){
  1002. processDailyParticipant.id=response.data.data.id;
  1003. processDailyParticipant.status=response.data.data.status;
  1004. processDailyParticipant.user_detail_full_name=response.data.data.user_detail_full_name;
  1005. processDailyParticipant.user_id=response.data.data.user_id;
  1006. processDailyParticipant.started_at=response.data.data.started_at;
  1007. processDailyParticipant.ended_at=response.data.data.ended_at;
  1008. processDailyParticipant.hour_price=response.data.data.hour_price;
  1009. processDailyParticipant.unit_price=response.data.data.unit_price;
  1010. processDailyParticipant.dinner_duration=response.data.data.dinner_duration;
  1011. processDailyParticipant.hour_count=response.data.data.hour_count;
  1012. processDailyParticipant.unit_count=response.data.data.unit_count;
  1013. processDailyParticipant.remark=response.data.data.remark;
  1014. processDailyParticipant.hour=response.data.data.hour;
  1015. processDailyParticipant.diff=response.data.data.diff;
  1016. processDailyParticipant.billingHour=response.data.data.billingHour;
  1017. processDailyParticipant.isAddProcessDailyParticipant=true;
  1018. _this.isShow.isAddProcessDailyParticipant=true;
  1019. return false;
  1020. }
  1021. return true;
  1022. });
  1023. if (response.data.process){
  1024. _this.processes.every(function (process) {
  1025. if (process.id==response.data.process){
  1026. process.status="加工中";
  1027. return false;
  1028. }
  1029. return true;
  1030. });
  1031. }
  1032. tempTip.setDuration(3000);
  1033. tempTip.showSuccess('参与人新增成功!');
  1034. }
  1035. }).catch(function (err) {
  1036. tempTip.setDuration(5000);
  1037. tempTip.show('新增参与人发生了一些严重错误:'+err);
  1038. })
  1039. },
  1040. //同名临时工选择
  1041. selectedUser(user_id,hour_price){
  1042. $("#myModal").modal('hide');
  1043. this.errors['user_id']="";
  1044. this.processDailyParticipantOne['user_id']=user_id;
  1045. this.processDailyParticipantOne['hour_price']=hour_price;
  1046. this.isShow.isUpdateConfirmBtn=true;
  1047. $("#"+this.modalDaily_id+"user_id").val(user_id);
  1048. $("#"+this.modalDaily_id+"hour_price").val(hour_price);
  1049. },
  1050. //修改参与人
  1051. updateProcessDailyParticipant(processDailyParticipant){
  1052. this.errors={};
  1053. this.processDailyParticipantOne['id']=processDailyParticipant.id;
  1054. this.processDailyParticipantOne['user_detail_full_name']=processDailyParticipant.user_detail_full_name;
  1055. this.processDailyParticipantOne['user_id']=processDailyParticipant.user_id;
  1056. this.processDailyParticipantOne['started_at']=processDailyParticipant.started_at;
  1057. this.processDailyParticipantOne['ended_at']=processDailyParticipant.ended_at;
  1058. this.processDailyParticipantOne['hour_price']=processDailyParticipant.hour_price;
  1059. this.processDailyParticipantOne['unit_price']=processDailyParticipant.unit_price;
  1060. this.processDailyParticipantOne['dinner_duration']=processDailyParticipant.dinner_duration;
  1061. this.processDailyParticipantOne['hour_count']=processDailyParticipant.hour_count;
  1062. this.processDailyParticipantOne['unit_count']=processDailyParticipant.unit_count;
  1063. this.processDailyParticipantOne['remark']=processDailyParticipant.remark;
  1064. $("#updateModal").modal('show');
  1065. },
  1066. //提交修改
  1067. submitUpdateProcessDailyParticipant(){
  1068. let _this=this;
  1069. axios.post("{{url('process/updateProcessDailyParticipant')}}",this.processDailyParticipantOne)
  1070. .then(function (response) {
  1071. if (response.data.status=="error"){
  1072. tempTip.setDuration(3000);
  1073. _this.errors=response.data.data;
  1074. }
  1075. if (response.data.status=="success"){
  1076. _this.processDailyParticipants.every(function (processDailyParticipant) {
  1077. if (processDailyParticipant.id==response.data.data.id){
  1078. processDailyParticipant.status=response.data.data.status;
  1079. processDailyParticipant.user_detail_full_name=response.data.data.user_detail_full_name;
  1080. processDailyParticipant.started_at=response.data.data.started_at;
  1081. processDailyParticipant.ended_at=response.data.data.ended_at;
  1082. processDailyParticipant.hour_price=response.data.data.hour_price;
  1083. processDailyParticipant.unit_price=response.data.data.unit_price;
  1084. processDailyParticipant.dinner_duration=response.data.data.dinner_duration;
  1085. processDailyParticipant.hour_count=response.data.data.hour_count;
  1086. processDailyParticipant.unit_count=response.data.data.unit_count;
  1087. processDailyParticipant.remark=response.data.data.remark;
  1088. processDailyParticipant.hour=response.data.data.hour;
  1089. processDailyParticipant.diff=response.data.data.diff;
  1090. processDailyParticipant.billingHour=response.data.data.billingHour;
  1091. processDailyParticipant.isAddProcessDailyParticipant=true;
  1092. return false;
  1093. }
  1094. return true;
  1095. });
  1096. tempTip.setDuration(3000);
  1097. tempTip.showSuccess('参与人修改成功!');
  1098. $("#updateModal").modal('hide');
  1099. }
  1100. }).catch(function (err) {
  1101. tempTip.setDuration(5000);
  1102. tempTip.show('修改参与人发生了一些严重错误:'+err);
  1103. })
  1104. },
  1105. //登记工时参与人审核
  1106. processDailyParticipantAudit(id){
  1107. if(!confirm('审核后不能撤销及修改,确定通过审核吗?')){return};
  1108. let _this=this;
  1109. axios.post("{{url('process/processDailyParticipantAudit')}}"+"/"+id)
  1110. .then(function (response) {
  1111. if (response.data.success){
  1112. _this.processDailyParticipants.every(function (processDailyParticipant) {
  1113. if (processDailyParticipant.id==response.data.processDailyParticipant.id){
  1114. processDailyParticipant.status=response.data.processDailyParticipant.status;
  1115. return false;
  1116. }
  1117. return true;
  1118. });
  1119. tempTip.setDuration(3000);
  1120. tempTip.showSuccess('参与人审核通过!');
  1121. return;
  1122. }
  1123. tempTip.setDuration(3000);
  1124. tempTip.show('参与人失败!');
  1125. }).catch(function (err) {
  1126. tempTip.setDuration(5000);
  1127. tempTip.show('审核参与人发生了一些严重错误:'+err);
  1128. });
  1129. },
  1130. //临时工详情
  1131. showUserDetail(id){
  1132. window.open("{{url('maintenance/userLabor')}}/"+id);
  1133. },
  1134. //显示教程
  1135. showTutorial(id) {
  1136. axios.post('{{url('maintenance/tutorial/showContent')}}'+"/"+id)
  1137. .then(function (response) {
  1138. if (response.data.success){
  1139. $("#content").html(response.data.data);
  1140. $("#showTutorial").modal('show');
  1141. }
  1142. }).catch(function (err) {
  1143. tempTip.setDuration(3000);
  1144. tempTip.show('获取教程失败!'+'网络错误:' + err);
  1145. });
  1146. },
  1147. //新增教程
  1148. addTutorials(id,owner_id){
  1149. let _this=this;
  1150. axios.post('{{url('process/getTutorials')}}'+"/"+id)
  1151. .then(function (response) {
  1152. if(response.data.success){
  1153. _this.processTutorial.id=id;
  1154. _this.processTutorial.owner_id=owner_id;
  1155. _this.processTutorial.tutorials=response.data.data;
  1156. $("#addTutorial").modal("show");
  1157. return;
  1158. }
  1159. tempTip.setDuration(3000);
  1160. tempTip.show('获取教程失败!未知错误:'+response.data );
  1161. }).catch(function (err) {
  1162. tempTip.setDuration(3000);
  1163. tempTip.show('获取教程失败!'+'网络错误:' + err);
  1164. });
  1165. },
  1166. //选择教程
  1167. selectedTutorial(process_id,tutorial_id){
  1168. let _this=this;
  1169. axios.post('{{url('process/selectedTutorial')}}',{process_id:process_id,tutorial_id,tutorial_id})
  1170. .then(function (response) {
  1171. if (response.data.success){
  1172. _this.processes.every(function (process) {
  1173. if (process.id==process_id){
  1174. process.tutorials.push(response.data.data);
  1175. return false;
  1176. }
  1177. return true;
  1178. });
  1179. $("#addTutorial").modal("hide");
  1180. tempTip.setDuration(3000);
  1181. tempTip.showSuccess('添加成功!');
  1182. return;
  1183. }
  1184. tempTip.setDuration(3000);
  1185. tempTip.show('添加教程失败!发生错误:' + response.data.data);
  1186. }).catch(function (err) {
  1187. tempTip.setDuration(3000);
  1188. tempTip.show('添加教程失败!'+'网络错误:' + err);
  1189. });
  1190. },
  1191. //删除教程
  1192. deleteTutorials(process_id,tutorial_id){
  1193. let _this=this;
  1194. axios.post('{{url('process/deleteTutorial')}}',{process_id:process_id,tutorial_id,tutorial_id})
  1195. .then(function (response) {
  1196. if (response.data.success){
  1197. _this.processes.every(function (process) {
  1198. if (process.id==process_id){
  1199. process.tutorials.every(function (tutorial,i) {
  1200. if (tutorial.id==tutorial_id) {
  1201. process.tutorials.splice(i,1)
  1202. return false;
  1203. }
  1204. return true;
  1205. });
  1206. return false;
  1207. }
  1208. return true;
  1209. });
  1210. tempTip.setDuration(3000);
  1211. tempTip.showSuccess('删除成功!');
  1212. return;
  1213. }
  1214. tempTip.setDuration(3000);
  1215. tempTip.show('删除教程失败!发生错误:' + response.data.data);
  1216. }).catch(function (err) {
  1217. tempTip.setDuration(3000);
  1218. tempTip.show('删除教程失败!'+'网络错误:' + err);
  1219. } );
  1220. },
  1221. processEdit(id){
  1222. location.href = "{{url('process')}}/"+id+"/edit";
  1223. },
  1224. //去往新增教程
  1225. addTutorial(){
  1226. window.open("{{url('maintenance/tutorial/create?owner_id=')}}"+this.processTutorial.owner_id);
  1227. }
  1228. },
  1229. });
  1230. </script>
  1231. @endsection