index.blade.php 81 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234
  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></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-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-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-sm btn-outline-info pull-left">编辑</button>
  275. <button v-if="!processOne.openProcessHour && processOne.status=='待接单'" @click="processReject(processOne.id)" class="btn-sm btn-outline-dark pull-left">驳回</button>
  276. <button v-if="!processOne.openProcessHour && processOne.status=='待接单'" @click="processReceive(processOne.id)" class="btn-sm btn-outline-primary pull-left">接单</button>@endcan
  277. @can("二次加工管理-登记工时")<button v-if="(processOne.status=='加工中' || processOne.status=='待加工') && !processOne.openProcessHour"
  278. class="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-sm btn-dark pull-left">收起登记工时</button>@endcan
  280. @can("二次加工管理-验收完成")<button v-if="!processOne.openProcessHour && processOne.status=='待验收'" @click="processAccomplish(processOne.id)" class="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-sm btn-outline-dark pull-left" href="javascript:;" @click="processOne.detailFolding=false" >收起编辑</button>
  291. <button @click="addTutorials(processOne.id)" class="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-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)" class="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-sm btn-success" v-if="! processDailyParticipant.readonly" @click="submitOutputData(processDailyParticipant.daily_id,processDailyParticipant.submitOutput,processDailyParticipant.id)">确定</button>
  360. <button class="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-sm btn-success" @click="submitProcessDailyParticipant(processDailyParticipant.daily_id)">确定</button>
  373. <button v-if="processDailyParticipant.id && processDailyParticipant.status=='未审核'" class="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-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}}',
  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:'',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['process_method_name']=process.process_method_name;
  541. processOne['tutorials']=process.tutorials;
  542. processOne['amount']=process.amount;
  543. processOne['unit_price']=process.unit_price;
  544. processOne['created_at']=process.created_at;
  545. processOne['status']=process.status;
  546. processOne['completed_amount']=process.completed_amount;
  547. processOne['detailFolding']=false;
  548. processOne['openProcessHour']=false;
  549. processOne['bill_type']=processesContent.bill_type;
  550. processOne['wms_code']=processesContent.wms_code;
  551. processOne['thisAmount']=processesContent.amount;
  552. processOne['commodity_barcodes']=processesContent.commodity ? processesContent.commodity.barcodes:'';
  553. processOne['commodity_name']=processesContent.commodity_name;
  554. processOne['count']=process.processesContents.length;
  555. _this.processes.push(processOne);
  556. }
  557. return true;
  558. });
  559. }
  560. },
  561. //回显条件参数
  562. initInputs:function(){
  563. let data=this;
  564. let uriParts =decodeURI(location.href).split("?");
  565. if(uriParts.length>1){
  566. let params = uriParts[1].split('&');
  567. params.forEach(function(paramPair){
  568. let pair=paramPair.split('=');
  569. let key = pair[0], val = pair[1];
  570. if (val!=="+"){
  571. $('input[name="'+key+'"]').val(val);
  572. $('select[name="'+key+'"]').val(val);
  573. decodeURI(data.filterData[key]=val);
  574. }
  575. });
  576. }
  577. },
  578. //提交表单
  579. submit:function(){
  580. let form = $("#optionSubmit");
  581. form.submit();
  582. },
  583. //全选事件
  584. checkAll(e){
  585. if (e.target.checked){
  586. this.processes.forEach((el,i)=>{
  587. if (this.checkData.indexOf(el.id) == '-1'){
  588. this.checkData.push(el.id);
  589. }
  590. });
  591. }else {
  592. this.checkData = [];
  593. }
  594. },
  595. //导出excel,因同步问题不使用formData
  596. processExport(e){
  597. let val=e;
  598. let data=this.filterData;
  599. if (val==1){
  600. if (this.checkData&&this.checkData.length<=0){
  601. tempTip.setDuration(4000);
  602. tempTip.showSuccess('没有勾选任何记录');
  603. }else{
  604. location.href="{{url('process?checkSign=')}}"+this.checkData;
  605. }
  606. } else {
  607. location.href="{{url('process?checkSign=-1&date_start=')}}"+
  608. data.date_start+"&date_end="+data.date_end+"&owner_id="+
  609. data.owner_id+"&commodity_barcode="+data.commodity_barcode+"&wms_code="+data.wms_code+
  610. "&status="+data.status;
  611. }
  612. },
  613. //获取登记工时
  614. openProcessHour(process){
  615. let e=process.id;
  616. let _this=this;
  617. if (_this.isShow.isOpenProcessHour){
  618. _this.processes.every(function (process) {
  619. if (process.openProcessHour){
  620. process.openProcessHour=false;
  621. _this.processDailies=[];
  622. _this.processDailyParticipants=[];
  623. return false;
  624. }
  625. return true;
  626. });
  627. }else{
  628. _this.isShow.isOpenProcessHour=true;
  629. }
  630. axios.post("{{url("process/getDailyParticipant")}}",{id:e,amount:process.amount})
  631. .then(function (response) {
  632. let processDailies=response.data;
  633. for (let i=0;i<processDailies.length;i++){
  634. let processDailyParticipants=processDailies[i].process_daily_participants;
  635. if (processDailyParticipants.length<=0){
  636. let data={};
  637. data['daily_id']=processDailies[i].id;
  638. data['date']=processDailies[i].date;
  639. data['output']=processDailies[i].output;
  640. data['remain']=processDailies[i].remain;
  641. data['rowspan']=1;
  642. data['readonly']="true";
  643. data['isAddProcessDailyParticipant']="true";
  644. data['isConfirmBtn']="true";
  645. data['submitOutput']=processDailies[i].output;
  646. _this.processDailyParticipants.push(data);
  647. continue;
  648. }
  649. for (let j=0;j<processDailyParticipants.length;j++){
  650. let data={};
  651. data['id']=processDailyParticipants[j].id;
  652. data['status']=processDailyParticipants[j].status;
  653. data['started_at']=processDailyParticipants[j].started_at;
  654. data['user_detail_full_name']=processDailyParticipants[j].user_detail_full_name;
  655. data['user_id']=processDailyParticipants[j].user_id;
  656. data['ended_at']=processDailyParticipants[j].ended_at;
  657. data['hour_price']=processDailyParticipants[j].hour_price;
  658. data['unit_price']=processDailyParticipants[j].unit_price;
  659. data['dinner_duration']=processDailyParticipants[j].dinner_duration;
  660. data['hour_count']=processDailyParticipants[j].hour_count;
  661. data['remark']=processDailyParticipants[j].remark;
  662. data['hour']=processDailyParticipants[j].hour;
  663. data['diff']=processDailyParticipants[j].diff;
  664. data['billingHour']=processDailyParticipants[j].billingHour;
  665. data['unit_count']=processDailyParticipants[j].unit_count;
  666. data['process_id']=processDailies[i].process_id;
  667. data['readonly']="true";
  668. if (!_this.processDailies[processDailies[i].id]){
  669. data['rowspan']=processDailyParticipants.length;
  670. data['daily_id']=processDailies[i].id;
  671. data['date']=processDailies[i].date;
  672. data['output']=processDailies[i].output;
  673. data['remain']=processDailies[i].remain;
  674. data['submitOutput']=processDailies[i].output;
  675. data['isAddProcessDailyParticipant']="true";
  676. data['isConfirmBtn']="true";
  677. _this.processDailies[processDailies[i].id]=processDailies[i].id;
  678. }
  679. _this.processDailyParticipants.push(data);
  680. }
  681. }
  682. }).catch(function (err) {
  683. tempTip.setDuration(5000);
  684. tempTip.show('获取登记工时数据发生了一些严重错误:'+err);
  685. });
  686. let processDailyParticipantsHtml=$("#addProcessDailyParticipants");
  687. if (process.count) $("#"+e+"-"+process.count).after(processDailyParticipantsHtml);
  688. else $("#"+e).after(processDailyParticipantsHtml)
  689. },
  690. //删除工时显示
  691. closeProcessHour(e){
  692. this.processDailies=[];
  693. this.processDailyParticipants=[];
  694. },
  695. //新增参与人
  696. addProcessDailyParticipant(processDailyParticipantOne){
  697. let id=processDailyParticipantOne.id;
  698. if (!id) return;
  699. let _this=this;
  700. _this.errors={};
  701. this.processDailyParticipants.every(function (processDailyParticipant,i) {
  702. if (processDailyParticipant.id==id){
  703. processDailyParticipant.rowspan++;
  704. let data={};
  705. data['readonly']="true";
  706. data['isAddProcessDailyParticipant']="true";
  707. data['isConfirmBtn']="true";
  708. data['id']=processDailyParticipant.id;
  709. data['user_id']=processDailyParticipant.user_id;
  710. data['status']=processDailyParticipant.status;
  711. data['started_at']=processDailyParticipant.started_at;
  712. data['user_detail_full_name']=processDailyParticipant.user_detail_full_name;
  713. data['ended_at']=processDailyParticipant.ended_at;
  714. data['hour_price']=processDailyParticipant.hour_price;
  715. data['unit_price']=processDailyParticipant.unit_price;
  716. data['dinner_duration']=processDailyParticipant.dinner_duration;
  717. data['hour_count']=processDailyParticipant.hour_count;
  718. data['remark']=processDailyParticipant.remark;
  719. data['hour']=processDailyParticipant.hour;
  720. data['diff']=processDailyParticipant.diff;
  721. data['billingHour']=processDailyParticipant.billingHour;
  722. data['unit_count']=processDailyParticipant.unit_count;
  723. data['process_id']=processDailyParticipant.process_id;
  724. _this.processDailyParticipants.splice(i+1,0,data);
  725. processDailyParticipant.id='';
  726. processDailyParticipant.status='';
  727. processDailyParticipant.started_at='';
  728. processDailyParticipant.user_detail_full_name='';
  729. processDailyParticipant.ended_at='';
  730. processDailyParticipant.hour_price='';
  731. processDailyParticipant.unit_price='';
  732. processDailyParticipant.dinner_duration='';
  733. processDailyParticipant.hour_count='';
  734. processDailyParticipant.remark='';
  735. processDailyParticipant.hour='';
  736. processDailyParticipant.diff='';
  737. processDailyParticipant.billingHour='';
  738. processDailyParticipant.unit_count='';
  739. processDailyParticipant.process_id='';
  740. return false;
  741. }
  742. return true;
  743. });
  744. _this.isShow.isAddProcessDailyParticipant=false;
  745. },
  746. //取消录入参与人
  747. deleteProcessDailyParticipant($event,daily_id,processDailyParticipant_name,isConfirmBtn){
  748. if (!isConfirmBtn) {
  749. this.processDailyParticipants.every(function (processDailyParticipant) {
  750. if(processDailyParticipant.daily_id==daily_id){
  751. processDailyParticipant.isConfirmBtn=true; //放出隐藏确定按钮
  752. return false;
  753. }
  754. return true;
  755. });
  756. }
  757. let _this=this;
  758. this.processDailyParticipants.every(function (processDailyParticipant,i) {
  759. if(processDailyParticipant.daily_id==daily_id){
  760. if (!processDailyParticipant_name&&_this.processDailyParticipants[i+1].daily_id)return false;
  761. _this.processDailyParticipants[i+1].rowspan=(processDailyParticipant.rowspan)-1;
  762. _this.processDailyParticipants[i+1].daily_id=processDailyParticipant.daily_id;
  763. _this.processDailyParticipants[i+1].date=processDailyParticipant.date;
  764. _this.processDailyParticipants[i+1].output=processDailyParticipant.output;
  765. _this.processDailyParticipants[i+1].remain=processDailyParticipant.remain;
  766. _this.processDailyParticipants[i+1].submitOutput=processDailyParticipant.submitOutput;
  767. _this.processDailyParticipants.splice(i,1);
  768. return false;
  769. }
  770. return true;
  771. });
  772. _this.isShow.isAddProcessDailyParticipant=true;
  773. },
  774. //驳回
  775. processReject(id){
  776. if(!confirm('确定驳回该单吗?')){return};
  777. let url="{{url('process/reject')}}"+"/"+id;
  778. let _this=this;
  779. axios.post(url)
  780. .then(function (response) {
  781. _this.processes.every(function (process) {
  782. if (process.id==response.data.id){
  783. process.status=response.data.status;
  784. return false;
  785. }
  786. return true;
  787. });
  788. tempTip.setDuration(3000);
  789. tempTip.showSuccess('驳回成功!');
  790. }).catch(function (err) {
  791. tempTip.setDuration(5000);
  792. tempTip.show('驳回二次加工单发生了一些严重错误:'+err);
  793. })
  794. },
  795. //接单
  796. processReceive(id){
  797. let url="{{url('process/receive')}}"+"/"+id;
  798. let _this=this;
  799. axios.post(url)
  800. .then(function (response) {
  801. _this.processes.every(function (process) {
  802. if (process.id==response.data.id){
  803. process.status=response.data.status;
  804. return false;
  805. }
  806. return true;
  807. });
  808. tempTip.setDuration(3000);
  809. tempTip.showSuccess('接单成功!');
  810. }).catch(function (err) {
  811. tempTip.setDuration(5000);
  812. tempTip.show('接单时发生了一些严重错误:'+err);
  813. })
  814. },
  815. //完成
  816. processAccomplish(id){
  817. if(!confirm('确定完成验收吗?')){return};
  818. let url="{{url('process/accomplish')}}"+"/"+id;
  819. let _this=this;
  820. axios.post(url)
  821. .then(function (response) {
  822. _this.processes.every(function (process) {
  823. if (process.id==response.data.id){
  824. process.status=response.data.status;
  825. process.completed_amount=response.data.completed_amount;
  826. return false;
  827. }
  828. return true;
  829. });
  830. tempTip.setDuration(3000);
  831. tempTip.showSuccess('验收完成!');
  832. }).catch(function (err) {
  833. tempTip.setDuration(5000);
  834. tempTip.show('验收时发生了一些严重错误:'+err);
  835. })
  836. },
  837. //定位客户
  838. owner_seek:function (e) {
  839. let _this=this;
  840. let $val=e.target.value;
  841. if($val==='')_this.filterData.owner_id='';
  842. else
  843. _this.owners.forEach(function (owner) {
  844. if (owner.name.includes($val)){
  845. _this.filterData.owner_id=owner.id;
  846. }
  847. });
  848. },
  849. //修改每日产量
  850. submitOutputData(daily_id,data,id){
  851. let url="{{url('process/updateDailyOutput')}}";
  852. let _this=this;
  853. axios.post(url,{id:daily_id,output:data})
  854. .then(function (response) {
  855. if (response.data.status=="error"){
  856. tempTip.setDuration(3000);
  857. tempTip.show('输入有误:'+response.data.data.output);
  858. }
  859. if (response.data.status=="success"){
  860. let processDailies=response.data.data;
  861. _this.processDailyParticipants.every(function (processDailyParticipant) {
  862. if (processDailyParticipant.id==id) {
  863. processDailyParticipant.readonly=true;
  864. }
  865. processDailies.every(function (processDaily) {
  866. if (processDailyParticipant.date==processDaily.date){
  867. processDailyParticipant.output=processDaily.output;
  868. processDailyParticipant.remain=processDaily.remain;
  869. return false;
  870. }
  871. return true;
  872. });
  873. return true;
  874. });
  875. if (response.data.process) {
  876. _this.processes.every(function (process) {
  877. if(process.id==response.data.process){
  878. process.status="待验收";
  879. return false;
  880. }
  881. return true;
  882. });
  883. }
  884. tempTip.setDuration(3000);
  885. tempTip.showSuccess('每日产量修改成功!');
  886. }
  887. }).catch(function (err) {
  888. tempTip.setDuration(5000);
  889. tempTip.show('修改每日产量发生了一些严重错误:'+err);
  890. });
  891. },
  892. //验证临时工
  893. verifyUserName(e,daily_id,isConfirmBtn){
  894. let user=e.target.value;
  895. let _this=this;
  896. axios.post('{{url('process/verifyUserName')}}',{userName:user})
  897. .then(function (response) {
  898. //修改时验证
  899. if (!daily_id){
  900. //验证失败
  901. if(response.data.length<1){
  902. _this.isShow.isUpdateConfirmBtn=false;
  903. _this.errors['user_id']="查无此人,请检查您的输入";
  904. return;
  905. }
  906. //验证成功且结果仅有一个
  907. if (response.data.user_id){
  908. _this.isShow.isUpdateConfirmBtn=true;
  909. _this.errors['user_id']="";
  910. _this.processDailyParticipantOne.user_id=response.data.user_id;
  911. return;
  912. }
  913. //验证成功多结果
  914. if (response.data.length>1){
  915. _this.userLabors=response.data;
  916. $("#myModal").modal('show');
  917. return;
  918. }
  919. }
  920. //验证失败
  921. if(response.data.length<1){
  922. _this.processDailyParticipants.every(function (processDailyParticipant) {
  923. if(processDailyParticipant.daily_id==daily_id){
  924. _this.errors['user_id']="查无此人,请检查您的输入";
  925. setTimeout(function(){
  926. $(".tooltipTargetError").tooltip('show');
  927. },1);
  928. processDailyParticipant.isConfirmBtn=false; //验证失败隐藏确定按钮
  929. return false;
  930. }
  931. return true;
  932. });
  933. return;
  934. }
  935. //按钮被隐藏则放出
  936. if (!isConfirmBtn){
  937. _this.processDailyParticipants.every(function (processDailyParticipant) {
  938. if(processDailyParticipant.daily_id==daily_id){
  939. processDailyParticipant.isConfirmBtn=true; //验证失败隐藏确定按钮
  940. return false;
  941. }
  942. return true;
  943. });
  944. }
  945. _this.modalDaily_id=daily_id;
  946. //验证成功且结果仅有一个
  947. if (response.data.user_id){
  948. _this.errors['user_id']="";
  949. $("#"+daily_id+"user_id").val(response.data.user_id);
  950. $("#"+daily_id+"hour_price").val(response.data.user_labor.default_hour_price);
  951. }
  952. //验证成功多结果
  953. if (response.data.length>1){
  954. _this.userLabors=response.data;
  955. $("#myModal").modal('show');
  956. }
  957. }).catch(function (err) {
  958. tempTip.setDuration(5000);
  959. tempTip.show('验证临时工发生了一些严重错误:'+err);
  960. })
  961. },
  962. //验证时间合法性
  963. hourFilter(e){
  964. datetimeRelating.verifyTime(e);
  965. },
  966. //提交参与人
  967. submitProcessDailyParticipant(e){
  968. let request={};
  969. request['user_id']=$("#"+e+"user_id").val();
  970. request['started_at']=$("#"+e+"started_at").val();
  971. request['ended_at']=$("#"+e+"ended_at").val();
  972. let hour_price=$("#"+e+"hour_price").val();
  973. if (hour_price) request['hour_price']=hour_price;
  974. let unit_price=$("#"+e+"unit_price").val();
  975. if (unit_price) request['unit_price']=unit_price;
  976. let dinner_duration=$("#"+e+"dinner_duration").val();
  977. if (dinner_duration) request['dinner_duration']=dinner_duration;
  978. let hour_count=$("#"+e+"hour_count").val();
  979. if (hour_count) request['hour_count']=hour_count;
  980. let unit_count=$("#"+e+"unit_count").val();
  981. if (unit_count) request['unit_count']=unit_count;
  982. let remark=$("#"+e+"remark").val();
  983. if (remark) request['remark']=remark;
  984. request['daily_id']=this.modalDaily_id;
  985. let _this=this;
  986. axios.post("{{url('process/shortProcessDailyParticipant')}}", request)
  987. .then(function (response) {
  988. if (response.data.status=="error"){
  989. tempTip.setDuration(3000);
  990. _this.errors=response.data.data;
  991. setTimeout(function(){
  992. $(".tooltipTargetError").tooltip('show');
  993. },1);
  994. return;
  995. }
  996. if (response.data.status=="success"){
  997. _this.processDailyParticipants.every(function (processDailyParticipant) {
  998. if (processDailyParticipant.daily_id==e){
  999. processDailyParticipant.id=response.data.data.id;
  1000. processDailyParticipant.status=response.data.data.status;
  1001. processDailyParticipant.user_detail_full_name=response.data.data.user_detail_full_name;
  1002. processDailyParticipant.user_id=response.data.data.user_id;
  1003. processDailyParticipant.started_at=response.data.data.started_at;
  1004. processDailyParticipant.ended_at=response.data.data.ended_at;
  1005. processDailyParticipant.hour_price=response.data.data.hour_price;
  1006. processDailyParticipant.unit_price=response.data.data.unit_price;
  1007. processDailyParticipant.dinner_duration=response.data.data.dinner_duration;
  1008. processDailyParticipant.hour_count=response.data.data.hour_count;
  1009. processDailyParticipant.unit_count=response.data.data.unit_count;
  1010. processDailyParticipant.remark=response.data.data.remark;
  1011. processDailyParticipant.hour=response.data.data.hour;
  1012. processDailyParticipant.diff=response.data.data.diff;
  1013. processDailyParticipant.billingHour=response.data.data.billingHour;
  1014. processDailyParticipant.isAddProcessDailyParticipant=true;
  1015. _this.isShow.isAddProcessDailyParticipant=true;
  1016. return false;
  1017. }
  1018. return true;
  1019. });
  1020. if (response.data.process){
  1021. _this.processes.every(function (process) {
  1022. if (process.id==response.data.process){
  1023. process.status="加工中";
  1024. return false;
  1025. }
  1026. return true;
  1027. });
  1028. }
  1029. tempTip.setDuration(3000);
  1030. tempTip.showSuccess('参与人新增成功!');
  1031. }
  1032. }).catch(function (err) {
  1033. tempTip.setDuration(5000);
  1034. tempTip.show('新增参与人发生了一些严重错误:'+err);
  1035. })
  1036. },
  1037. //同名临时工选择
  1038. selectedUser(user_id,hour_price){
  1039. $("#myModal").modal('hide');
  1040. this.errors['user_id']="";
  1041. this.processDailyParticipantOne['user_id']=user_id;
  1042. this.processDailyParticipantOne['hour_price']=hour_price;
  1043. this.isShow.isUpdateConfirmBtn=true;
  1044. $("#"+this.modalDaily_id+"user_id").val(user_id);
  1045. $("#"+this.modalDaily_id+"hour_price").val(hour_price);
  1046. },
  1047. //修改参与人
  1048. updateProcessDailyParticipant(processDailyParticipant){
  1049. this.errors={};
  1050. this.processDailyParticipantOne['id']=processDailyParticipant.id;
  1051. this.processDailyParticipantOne['user_detail_full_name']=processDailyParticipant.user_detail_full_name;
  1052. this.processDailyParticipantOne['user_id']=processDailyParticipant.user_id;
  1053. this.processDailyParticipantOne['started_at']=processDailyParticipant.started_at;
  1054. this.processDailyParticipantOne['ended_at']=processDailyParticipant.ended_at;
  1055. this.processDailyParticipantOne['hour_price']=processDailyParticipant.hour_price;
  1056. this.processDailyParticipantOne['unit_price']=processDailyParticipant.unit_price;
  1057. this.processDailyParticipantOne['dinner_duration']=processDailyParticipant.dinner_duration;
  1058. this.processDailyParticipantOne['hour_count']=processDailyParticipant.hour_count;
  1059. this.processDailyParticipantOne['unit_count']=processDailyParticipant.unit_count;
  1060. this.processDailyParticipantOne['remark']=processDailyParticipant.remark;
  1061. $("#updateModal").modal('show');
  1062. },
  1063. //提交修改
  1064. submitUpdateProcessDailyParticipant(){
  1065. let _this=this;
  1066. axios.post("{{url('process/updateProcessDailyParticipant')}}",this.processDailyParticipantOne)
  1067. .then(function (response) {
  1068. if (response.data.status=="error"){
  1069. tempTip.setDuration(3000);
  1070. _this.errors=response.data.data;
  1071. }
  1072. if (response.data.status=="success"){
  1073. _this.processDailyParticipants.every(function (processDailyParticipant) {
  1074. if (processDailyParticipant.id==response.data.data.id){
  1075. processDailyParticipant.status=response.data.data.status;
  1076. processDailyParticipant.user_detail_full_name=response.data.data.user_detail_full_name;
  1077. processDailyParticipant.started_at=response.data.data.started_at;
  1078. processDailyParticipant.ended_at=response.data.data.ended_at;
  1079. processDailyParticipant.hour_price=response.data.data.hour_price;
  1080. processDailyParticipant.unit_price=response.data.data.unit_price;
  1081. processDailyParticipant.dinner_duration=response.data.data.dinner_duration;
  1082. processDailyParticipant.hour_count=response.data.data.hour_count;
  1083. processDailyParticipant.unit_count=response.data.data.unit_count;
  1084. processDailyParticipant.remark=response.data.data.remark;
  1085. processDailyParticipant.hour=response.data.data.hour;
  1086. processDailyParticipant.diff=response.data.data.diff;
  1087. processDailyParticipant.billingHour=response.data.data.billingHour;
  1088. processDailyParticipant.isAddProcessDailyParticipant=true;
  1089. return false;
  1090. }
  1091. return true;
  1092. });
  1093. tempTip.setDuration(3000);
  1094. tempTip.showSuccess('参与人修改成功!');
  1095. $("#updateModal").modal('hide');
  1096. }
  1097. }).catch(function (err) {
  1098. tempTip.setDuration(5000);
  1099. tempTip.show('修改参与人发生了一些严重错误:'+err);
  1100. })
  1101. },
  1102. //登记工时参与人审核
  1103. processDailyParticipantAudit(id){
  1104. if(!confirm('审核后不能撤销及修改,确定通过审核吗?')){return};
  1105. let _this=this;
  1106. axios.post("{{url('process/processDailyParticipantAudit')}}"+"/"+id)
  1107. .then(function (response) {
  1108. if (response.data.success){
  1109. _this.processDailyParticipants.every(function (processDailyParticipant) {
  1110. if (processDailyParticipant.id==response.data.processDailyParticipant.id){
  1111. processDailyParticipant.status=response.data.processDailyParticipant.status;
  1112. return false;
  1113. }
  1114. return true;
  1115. });
  1116. tempTip.setDuration(3000);
  1117. tempTip.showSuccess('参与人审核通过!');
  1118. return;
  1119. }
  1120. tempTip.setDuration(3000);
  1121. tempTip.show('参与人失败!');
  1122. }).catch(function (err) {
  1123. tempTip.setDuration(5000);
  1124. tempTip.show('审核参与人发生了一些严重错误:'+err);
  1125. });
  1126. },
  1127. //临时工详情
  1128. showUserDetail(id){
  1129. window.open("{{url('maintenance/userLabor')}}/"+id);
  1130. },
  1131. //显示教程
  1132. showTutorial(id) {
  1133. axios.post('{{url('maintenance/tutorial/showContent')}}'+"/"+id)
  1134. .then(function (response) {
  1135. if (response.data.success){
  1136. $("#content").html(response.data.data);
  1137. $("#showTutorial").modal('show');
  1138. }
  1139. }).catch(function (err) {
  1140. tempTip.setDuration(3000);
  1141. tempTip.show('获取教程失败!'+'网络错误:' + err);
  1142. });
  1143. },
  1144. //新增教程
  1145. addTutorials(id){
  1146. let _this=this;
  1147. axios.post('{{url('process/getTutorials')}}'+"/"+id)
  1148. .then(function (response) {
  1149. console.log(response.data);
  1150. if(response.data.success){
  1151. _this.processTutorial.id=id;
  1152. _this.processTutorial.tutorials=response.data.data;
  1153. $("#addTutorial").modal("show");
  1154. return;
  1155. }
  1156. tempTip.setDuration(3000);
  1157. tempTip.show('获取教程失败!未知错误:'+response.data );
  1158. }).catch(function (err) {
  1159. tempTip.setDuration(3000);
  1160. tempTip.show('获取教程失败!'+'网络错误:' + err);
  1161. });
  1162. },
  1163. //选择教程
  1164. selectedTutorial(process_id,tutorial_id){
  1165. let _this=this;
  1166. axios.post('{{url('process/selectedTutorial')}}',{process_id:process_id,tutorial_id,tutorial_id})
  1167. .then(function (response) {
  1168. if (response.data.success){
  1169. _this.processes.every(function (process) {
  1170. if (process.id==process_id){
  1171. process.tutorials.push(response.data.data);
  1172. return false;
  1173. }
  1174. return true;
  1175. });
  1176. $("#addTutorial").modal("hide");
  1177. tempTip.setDuration(3000);
  1178. tempTip.showSuccess('添加成功!');
  1179. return;
  1180. }
  1181. tempTip.setDuration(3000);
  1182. tempTip.show('添加教程失败!发生错误:' + response.data.data);
  1183. }).catch(function (err) {
  1184. tempTip.setDuration(3000);
  1185. tempTip.show('添加教程失败!'+'网络错误:' + err);
  1186. });
  1187. },
  1188. //删除教程
  1189. deleteTutorials(process_id,tutorial_id){
  1190. let _this=this;
  1191. axios.post('{{url('process/deleteTutorial')}}',{process_id:process_id,tutorial_id,tutorial_id})
  1192. .then(function (response) {
  1193. if (response.data.success){
  1194. _this.processes.every(function (process) {
  1195. if (process.id==process_id){
  1196. process.tutorials.every(function (tutorial,i) {
  1197. if (tutorial.id==tutorial_id) {
  1198. process.tutorials.splice(i,1)
  1199. return false;
  1200. }
  1201. return true;
  1202. });
  1203. return false;
  1204. }
  1205. return true;
  1206. });
  1207. tempTip.setDuration(3000);
  1208. tempTip.showSuccess('删除成功!');
  1209. return;
  1210. }
  1211. tempTip.setDuration(3000);
  1212. tempTip.show('删除教程失败!发生错误:' + response.data.data);
  1213. }).catch(function (err) {
  1214. tempTip.setDuration(3000);
  1215. tempTip.show('删除教程失败!'+'网络错误:' + err);
  1216. } );
  1217. },
  1218. processEdit(id){
  1219. location.href = "{{url('process')}}/"+id+"/edit";
  1220. }
  1221. },
  1222. });
  1223. </script>
  1224. @endsection