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