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