index.blade.php 111 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582
  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 colspan="9">
  20. <select name="paginate" v-model="filterData.paginate" class="tooltipTarget form-control form-control-sm" style="vertical-align: middle;max-width: 100px" @change="submit">
  21. <option value="50">50行</option>
  22. <option value="100">100行</option>
  23. <option value="200">200行</option>
  24. <option value="500">500行</option>
  25. <option value="1000">1000行</option>
  26. </select></td>
  27. </tr>
  28. <tr>
  29. <td >
  30. <input id="date_start" name="date_start" style="max-width: 200px" v-model="filterData.date_start" :class="filterData.date_start?'bg-warning':''" type="date" class="form-control form-control-sm tooltipTarget" title="选择显示指定日期的起始时间">
  31. </td>
  32. <td >
  33. <div class="form-inline">
  34. <input type="text" class="form-control form-control-sm tooltipTarget" placeholder="客户"
  35. style="width:70px" @input="owner_seek"
  36. title="输入关键词快速定位下拉列表,回车确定">
  37. <select name="owner_id" v-model="filterData.owner_id" @change="submit" class="form-control form-control-sm tooltipTarget" title="选择要显示的客户" :class="filterData.owner_id?'bg-warning':''">
  38. <option > </option>
  39. <option v-for="owner in owners" :value="owner.id">@{{owner.name}}</option>
  40. </select></div>
  41. </td>
  42. <td>
  43. <input id="wms_code" name="wms_code" style="max-width: 200px" title="单据号:支持15内模糊搜索与15天外精确搜索" v-model="filterData.wms_code" class="form-control form-control-sm tooltipTarget" placeholder="单据号" :class="filterData.wms_code?'bg-warning':''">
  44. </td>
  45. <td colspan="6"></td>
  46. </tr>
  47. <tr>
  48. <td >
  49. <input id="date_end" name="date_end" style="max-width: 200px" v-model="filterData.date_end" type="date" class="form-control form-control-sm tooltipTarget" title="选择显示指定日期的结束时间" :class="filterData.date_end?'bg-warning':''">
  50. </td>
  51. <td>
  52. <input name="commodity_barcode" style="max-width: 200px" title="商品条码:支持15内模糊搜索与15天外精确搜索" v-model="filterData.commodity_barcode" class="form-control form-control-sm tooltipTarget" placeholder="商品条码" :class="filterData.commodity_barcode?'bg-warning':''">
  53. </td>
  54. <td >
  55. <div class="form-inline">
  56. <select id="status" name="status" v-model="filterData.status" @change="submit" style="max-width: 100px" class="form-control form-control-sm tooltipTarget" :class="filterData.status?'bg-warning':''" >
  57. <option value="" selected>状态</option>
  58. <option value="待审核">待审核</option>
  59. <option value="待接单">待接单</option>
  60. <option value="待加工">待加工</option>
  61. <option value="已驳回">已驳回</option>
  62. <option value="加工中">加工中</option>
  63. <option value="待验收">待验收</option>
  64. <option value="交接完成">交接完成</option>
  65. </select>
  66. <input hidden name="is_accomplish" v-model="filterData.is_accomplish">
  67. <button class="btn btn-sm btn-outline-dark pull-left ml-5" type="submit">按条件搜索</button></div>
  68. </td>
  69. <td colspan="6"></td>
  70. </tr>
  71. <tr>
  72. <td colspan="9">
  73. <div class="form-inline">
  74. <span class="dropdown">
  75. <button class="btn btn-outline-dark btn-sm form-control-sm dropdown-toggle tooltipTarget" :class="[checkData.length>0?'btn-dark text-light':'']"
  76. data-toggle="dropdown" title="导出所有页将会以搜索条件得到的过滤结果,将其全部记录(每一页)导出">
  77. 导出Excel
  78. </button>
  79. <div class="dropdown-menu">
  80. <a class="dropdown-item" @click="processExport(1)" href="javascript:">导出勾选内容</a>
  81. <a class="dropdown-item" @click="processExport(2)" href="javascript:">导出所有页</a>
  82. </div>
  83. </span>
  84. <div class="form-check ml-4">
  85. <label class="form-check-label text-muted">
  86. <input v-if="filterData.is_accomplish" checked @click="is_checked($event)" type="checkbox" class="form-check-input">
  87. <input v-else @click="is_checked($event)" type="checkbox" class="form-check-input">显示交接完成的记录
  88. </label>
  89. </div>
  90. </div>
  91. </td>
  92. </tr>
  93. </table>
  94. </form>
  95. </div>
  96. <!--新增教程关联-->
  97. <div style="top:25%" class="modal fade" id="addTutorial" tabindex="-1" role="dialog" aria-labelledby="addTutorial" aria-hidden="true">
  98. <div class="modal-dialog">
  99. <div class="modal-content">
  100. <div class="modal-header m-1 p-0">
  101. <button type="button" class="close pr-4" data-dismiss="modal" aria-hidden="true">&times;</button>
  102. </div>
  103. <div class="modal-body m-auto">
  104. <table class="table-sm">
  105. <tr>
  106. <th>标题</th>
  107. <th><button class="btn btn-sm btn-outline-primary" @click="addTutorial()">新增教程</button></th>
  108. </tr>
  109. <tr v-for="tutorial in processTutorial.tutorials">
  110. <td><div style="cursor:pointer;overflow: hidden;width: 200px" @click="showTutorial(tutorial.id)" :title="tutorial.name" class="text-primary">@{{tutorial.name}}</div></td>
  111. @can("二次加工管理-教程管理")<td><button @click="selectedTutorial(processTutorial.id,tutorial.id)" class="btn btn-sm btn-success pull-right">选择</button></td>@endcan
  112. </tr>
  113. </table>
  114. </div>
  115. </div><!-- /.modal-content -->
  116. </div><!-- /.modal -->
  117. </div>
  118. <!-- 显示教程-->
  119. <div class="modal fade" id="showTutorial" tabindex="-1" role="dialog" aria-labelledby="showTutorial" aria-hidden="true">
  120. <div class="modal-dialog">
  121. <div class="modal-content">
  122. <div class="modal-header">
  123. <button type="button" class="close pull-right" data-dismiss="modal" aria-hidden="true">&times;</button>
  124. </div>
  125. <div class="modal-body custom-rich-text-content" id="content"></div>
  126. <div class="modal-footer">
  127. <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
  128. </div>
  129. </div><!-- /.modal-content -->
  130. </div><!-- /.modal -->
  131. </div>
  132. <!-- 修改modal -->
  133. <div data-backdrop="static" class="modal fade" id="updateModal" tabindex="-1" role="dialog" aria-labelledby="updateModalLabel" aria-hidden="true">
  134. <div class="modal-dialog modal-dialog-centered" role="document">
  135. <div class="modal-content">
  136. <div class="modal-body">
  137. <div v-if="errors.user_id" class="row"><label class="col-3"></label><small class="text-danger col-7">@{{ errors.user_id }}</small></div>
  138. <div class="form-group row">
  139. <label for="initial_weight" class="col-3 col-form-label text-right">参与者</label>
  140. <div class="col-7">
  141. <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" >
  142. </div>
  143. </div>
  144. <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>
  145. <div class="form-group row">
  146. <label for="initial_weight" class="col-3 col-form-label text-right">开始时间</label>
  147. <div class="col-7">
  148. <input :class="{ 'is-invalid' : errors.started_at }" type="time" @input="hourFilter(processDailyParticipantOne,false)" class="form-control" autocomplete="off" v-model="processDailyParticipantOne.started_at" >
  149. </div>
  150. </div>
  151. <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>
  152. <div class="form-group row">
  153. <label for="initial_weight" class="col-3 col-form-label text-right">结束时间</label>
  154. <div class="col-7">
  155. <input :class="{ 'is-invalid' : errors.ended_at }" type="time" @input="hourFilter(processDailyParticipantOne,false)" class="form-control" autocomplete="off" v-model="processDailyParticipantOne.ended_at" >
  156. </div>
  157. </div>
  158. <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>
  159. <div class="form-group row">
  160. <label for="initial_weight" class="col-3 col-form-label text-right">计时工资</label>
  161. <div class="col-7">
  162. <input :class="{ 'is-invalid' : errors.hour_price }" type="text" class="form-control" autocomplete="off" v-model="processDailyParticipantOne.hour_price" >
  163. </div>
  164. </div>
  165. <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>
  166. <div class="form-group row">
  167. <label for="initial_weight" class="col-3 col-form-label text-right">计件工资</label>
  168. <div class="col-7">
  169. <input :class="{ 'is-invalid' : errors.unit_price }" type="text" class="form-control" autocomplete="off" v-model="processDailyParticipantOne.unit_price" >
  170. </div>
  171. </div>
  172. <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>
  173. <div class="form-group row">
  174. <label for="initial_weight" class="col-3 col-form-label text-right">晚饭时间</label>
  175. <div class="col-7">
  176. <select :class="{ 'is-invalid' : errors.dinner_duration }" v-model="processDailyParticipantOne.dinner_duration" class="form-control">
  177. <option value="0">无</option>
  178. <option value="30">30分钟</option>
  179. <option value="60">60分钟</option>
  180. </select>
  181. </div>
  182. </div>
  183. <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>
  184. <div class="form-group row">
  185. <label for="initial_weight" class="col-3 col-form-label text-right">计时工时</label>
  186. <div class="col-7">
  187. <input :class="{ 'is-invalid' : errors.hour_count }" type="text" class="form-control" autocomplete="off" v-model="processDailyParticipantOne.hour_count" >
  188. </div>
  189. </div>
  190. <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>
  191. <div class="form-group row">
  192. <label for="initial_weight" class="col-3 col-form-label text-right">计件数量</label>
  193. <div class="col-7">
  194. <input :class="{ 'is-invalid' : errors.unit_count }" type="text" class="form-control" autocomplete="off" v-model="processDailyParticipantOne.unit_count" >
  195. </div>
  196. </div>
  197. <div class="form-group row">
  198. <label for="initial_weight" class="col-3 col-form-label text-right">备注</label>
  199. <div class="col-7">
  200. <input type="text" class="form-control" autocomplete="off" v-model="processDailyParticipantOne.remark" >
  201. </div>
  202. </div>
  203. </div>
  204. <div class="modal-footer">
  205. <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
  206. @can("二次加工管理-登记工时")<button v-if="isShow.isUpdateConfirmBtn" @click="submitUpdateProcessDailyParticipant()" class="btn btn-primary">提交更改</button>@endcan
  207. </div>
  208. </div><!-- /.modal-content -->
  209. </div><!-- /.modal -->
  210. </div>
  211. <!-- 多临时工选择(Modal) -->
  212. <div data-backdrop="static" style="top:25%" class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  213. <div class="modal-dialog">
  214. <div class="modal-content" style="background-color: #d6e9f8">
  215. <div class="modal-body m-auto">
  216. <table class="table-sm">
  217. <tr>
  218. <th>姓名</th>
  219. <th>性别</th>
  220. <th>电话</th>
  221. <th>最近打卡时间</th>
  222. <th></th>
  223. </tr>
  224. <tr v-for="userLabor in userLabors" v-if="userLabor.user_labor">
  225. <td>@{{ userLabor.full_name }}</td>
  226. <td>@{{ userLabor.gender }}</td>
  227. <td>@{{ userLabor.mobile_phone }}</td>
  228. <td>@{{ userLabor.checked_at }}</td>
  229. <td><button @click="selectedUser(userLabor.user_id,userLabor.user_labor.default_hour_price)" class="btn btn-sm btn-success">选择</button></td>
  230. </tr>
  231. </table>
  232. </div>
  233. </div><!-- /.modal-content -->
  234. </div><!-- /.modal -->
  235. </div>
  236. <table class="table table-sm text-nowrap">
  237. <tr class="row-even">
  238. <th>
  239. <label for="all">
  240. <input id="all" type="checkbox" @click="checkAll($event)">全选
  241. </label>
  242. </th>
  243. <th>序号</th>
  244. <th>操作</th>
  245. <th>状态</th>
  246. <th>任务号</th>
  247. <th>经手人</th>
  248. <th>货主</th>
  249. <th>加工类型</th>
  250. <th>预期数量</th>
  251. <th class="text-center">教程</th>
  252. <th>单价</th>
  253. <th>完成数量</th>
  254. <th>提交日期</th>
  255. <th style="min-width: 200px">单据类型</th>
  256. <th style="min-width: 200px">单据号</th>
  257. <th style="min-width: 100px">本单数量</th>
  258. <th style="min-width: 200px">商品条码</th>
  259. <th style="min-width: 200px">商品名称 </th>
  260. <th>备注</th>
  261. <th></th>
  262. </tr>
  263. <template>
  264. <tr v-for="(processOne,i) in processes" :class="processOne.serial_number%2==0?'row-even':''" :id="processOne.id?processOne.id:processes[i-1].id+'-2'" :name="'process_table_'+processOne.serial_number" @mouseover="changeStyle('process_table_'+processOne.serial_number,true)" @mouseout="changeStyle('process_table_'+processOne.serial_number,false)">
  265. <td v-if="processOne.id" :rowspan="processOne.is_multi_row?2:''">
  266. <input class="checkItem" type="checkbox" :value="processOne.id" v-model="checkData">
  267. </td>
  268. <td v-if="processOne.id" class="text-muted" :rowspan="processOne.is_multi_row?2:''">@{{ processOne.serial_number }}</td>
  269. <td v-if="processOne.id" style="min-width:200px;" :rowspan="processOne.is_multi_row?2:''">
  270. @can("二次加工管理-审核")
  271. <button v-if="!processOne.openProcessHour && (processOne.status=='待审核' || processOne.status=='已驳回')" @mouseenter="processOne.buttonTexts.审核='审核'" @mouseleave="processOne.buttonTexts.审核='审'" class="btn btn-sm btn-outline-success" @click="audit(processOne)"><span>@{{ processOne.buttonTexts.审核 }}</span></button>@endcan
  272. @can("二次加工管理-回滚")
  273. <button v-if="!processOne.openProcessHour && processOne.status!='交接完成' && processOne.status!='待审核'" class="btn btn-sm btn-outline-dark" style="opacity: 0.65" @click="rollback(processOne.id)" @mouseenter="processOne.buttonTexts.回滚='回滚'" @mouseleave="processOne.buttonTexts.回滚='回'">@{{ processOne.buttonTexts.回滚 }}</button>@endcan
  274. @can("二次加工管理-质量验收")
  275. <button v-if="!processOne.openProcessHour && processOne.status=='待验收'" class="btn btn-sm btn-outline-success" @click="checkAndAccept(processOne)" @mouseenter="processOne.buttonTexts.质量验收='质量验收'" @mouseleave="processOne.buttonTexts.质量验收='验'">@{{processOne.buttonTexts.质量验收}}</button>@endcan
  276. @can("二次加工管理-接单与驳回")
  277. <button v-if="!processOne.openProcessHour && processOne.status=='待接单'" @click="processReject(processOne.id)" class="btn btn-sm btn-outline-dark" @mouseenter="processOne.buttonTexts.驳回='驳回'" @mouseleave="processOne.buttonTexts.驳回='驳'">@{{processOne.buttonTexts.驳回}}</button>
  278. <button v-if="!processOne.openProcessHour && processOne.status=='待接单'" @click="processReceive(processOne.id)" class="btn btn-sm btn-outline-primary" @mouseenter="processOne.buttonTexts.接单='接单'" @mouseleave="processOne.buttonTexts.接单='接'">@{{processOne.buttonTexts.接单}}</button>@endcan
  279. @can("二次加工管理-登记工时")<button :style="[{opacity:processOne.status=='交接完成'?'0.7':''},{transform:processOne.status=='交接完成'?'scale(0.85)':''}]" v-if="(processOne.status!='待审核' && processOne.status!='已驳回' && processOne.status!='待接单') && !processOne.openProcessHour"
  280. class="btn btn-sm btn-outline-info" @click="openProcessHour(processOne);processOne.openProcessHour=true;processOne.detailFolding=false" @mouseenter="processOne.buttonTexts.登记工时='登记工时'" @mouseleave="processOne.buttonTexts.登记工时='登'">@{{processOne.buttonTexts.登记工时}}</button>
  281. <button v-if="processOne.openProcessHour" @click="closeProcessHour(processOne.id);processOne.openProcessHour=false" class="btn btn-sm btn-dark">收起登记工时</button>
  282. <button v-if="!processOne.openProcessHour && processOne.status=='加工中'" @click="processAccomplish(processOne)" class="btn btn-sm btn-outline-success" style="opacity: 0.7" @mouseenter="processOne.buttonTexts.完成='完成'" @mouseleave="processOne.buttonTexts.完成='完'">@{{processOne.buttonTexts.完成}}</button>@endcan
  283. @can("二次加工管理-交接完成")<button v-if="!processOne.openProcessHour && processOne.status=='待交接'" @click="accomplish(processOne)" class="btn btn-sm btn-outline-success" @mouseenter="processOne.buttonTexts.交接完成='交接完成'" @mouseleave="processOne.buttonTexts.交接完成='交'">@{{processOne.buttonTexts.交接完成}}</button>@endcan
  284. @can("二次加工管理-编辑")
  285. <button v-if="!processOne.openProcessHour && (processOne.status=='待审核' ||processOne.status=='待接单' || processOne.status=='已驳回' || processOne.status=='加工中' || processOne.status=='待加工')" @click="processEdit(processOne.id)" class="btn btn-sm btn-outline-info" @mouseenter="processOne.buttonTexts.编辑='编辑'"
  286. @mouseleave="processOne.buttonTexts.编辑='编'" style="opacity: 0.6">@{{processOne.buttonTexts.编辑}}</button>
  287. @endcan
  288. </td>
  289. <td v-if="processOne.id" :rowspan="processOne.is_multi_row?2:''"
  290. :class="processOne.status==='已驳回' ? 'text-danger' : (processOne.status==='交接完成' ? 'text-success font-weight-bold' : 'text-muted')">@{{ processOne.status }}</td>
  291. <td v-if="processOne.id" class="text-muted" :rowspan="processOne.is_multi_row?2:''">
  292. <button style="transform: scale(0.85);opacity: 0.8;" class="btn btn-sm btn-info" @click="show(processOne.id)" @mouseenter="processOne.buttonTexts.查看单据='查看单据'" @mouseleave="processOne.buttonTexts.查看单据='查'">@{{ processOne.buttonTexts.查看单据 }}</button>
  293. @{{ processOne.code }}
  294. </td>
  295. <td v-if="processOne.id" class="text-muted" :rowspan="processOne.is_multi_row?2:''">
  296. <a href="#" v-if="processOne.operatorLogs.length>0" class="dropdown-toggle" data-toggle="dropdown">
  297. @{{ processOne.operatorLogs[0].user_name }}<b class="caret"></b>
  298. </a>
  299. <div style="position: absolute;width:320px;margin-left:-100px;background-color: white;max-height:150px ;overflow-y:auto" class="small mt-0 dropdown-menu">
  300. <table class="table table-sm table-striped table-bordered">
  301. <tr>
  302. <th>经手人</th>
  303. <th>操作</th>
  304. <th>时间</th>
  305. </tr>
  306. <tr v-for="operatorLog in processOne.operatorLogs">
  307. <td>@{{ operatorLog.user_name }}</td>
  308. <td class="text-danger font-weight-bold">@{{ operatorLog.operation }}</td>
  309. <td>@{{ operatorLog.created_at }}</td>
  310. </tr>
  311. </table>
  312. </div>
  313. </td>
  314. <td v-if="processOne.id" class="text-muted" :rowspan="processOne.is_multi_row?2:''">@{{ processOne.owner_name }}</td>
  315. <td v-if="processOne.id" :rowspan="processOne.is_multi_row?2:''" class="font-weight-bold text-danger">@{{ processOne.process_method_name }}</td>
  316. <td v-if="processOne.id" :rowspan="processOne.is_multi_row?2:''">@{{ processOne.amount }}</td>
  317. <td v-if="processOne.id" :rowspan="processOne.is_multi_row?2:''">
  318. <div class="" v-if="processOne.tutorials" {{--style="width: 200px;overflow:auto;"--}}>
  319. <div v-if=" processOne.tutorials.length>0">
  320. <u v-if="!processOne.detailFolding" @click="showTutorial(processOne.tutorials[0].id)" class="text-info" style="cursor:pointer;">@{{processOne.tutorials[0].name}}</u>
  321. <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>
  322. <div v-else><button class="btn btn-sm btn-outline-dark pull-left" href="javascript:;" @click="processOne.detailFolding=false" >收起编辑</button>
  323. <button @click="addTutorials(processOne.id,processOne.owner_id)" class="btn btn-sm btn-outline-info pull-left">新增关联教程</button></div>
  324. <table class="table table-sm" v-if="processOne.detailFolding">
  325. <tr>
  326. <th>标题</th>
  327. <th>操作</th>
  328. <th>创建时间</th>
  329. </tr>
  330. <tr v-for="(tutorial,i) in processOne.tutorials">
  331. <td class="text-info"><u :title="tutorial.name" @click="showTutorial(tutorial.id)" style="cursor:pointer;">@{{tutorial.name}}</u></td>
  332. <td>@can('二次加工管理-教程管理')
  333. <button @click="deleteTutorials(processOne.id,tutorial.id)" class="btn btn-sm btn-outline-danger pull-left" >删</button>
  334. @endcan</td>
  335. <td >@{{tutorial.created_at}}</td>
  336. </tr>
  337. </table>
  338. </div>
  339. <div v-if="processOne.tutorials.length<1">
  340. <button @click="addTutorials(processOne.id,processOne.owner_id)" class="btn btn-sm btn-outline-info pull-left" >新增关联教程</button>
  341. </div>
  342. </div>
  343. </td>
  344. <td v-if="processOne.id" class="text-muted" :rowspan="processOne.is_multi_row?2:''">
  345. @can('二次加工管理-修改价格')
  346. <div v-if="processOne.status=='交接完成'">
  347. <div v-if="processOne.signs.length<=0">
  348. <div v-if="processOne.is_update_unit_price" >
  349. <input type="text" :value="processOne.unit_price" :id="'unit_price_'+processOne.id" class="form-control form-control-sm" style="min-width: 50px;">
  350. <button type="button" class="btn btn-sm btn-outline-success" @click="updateUnitPrice(processOne)">确定</button>
  351. <button type="button" class="btn btn-sm btn-outline-danger" @click="processOne.is_update_unit_price=false;">取消</button>
  352. </div>
  353. <input readonly @click="processOne.is_update_unit_price=true;" v-else style="cursor: pointer;min-width: 50px" :value="processOne.unit_price" class="form-control form-control-sm">
  354. </div>
  355. <div v-else @mouseleave="processOne.is_update_unit_price=false;" @mouseenter="processOne.is_update_unit_price=true;">
  356. <span class="flicker" style="cursor: move">@{{ processOne.unit_price }}</span>
  357. <div v-if="processOne.is_update_unit_price" style="position: absolute;width: 150px;background-color: white;white-space: normal;margin-left: -50px"
  358. @mouseleave="processOne.is_update_unit_price=false;" @mouseenter="processOne.is_update_unit_price=true;">
  359. <p class="text-center text-dark font-weight-bold">待确认</p>
  360. @can('二次加工管理-组长确认')<button v-if="!signs[processOne.code]['二次加工组确认']" class="btn btn-sm btn-outline-success" @click="verify(processOne,'workGroup')">组长确认</button>@endcan
  361. @can('二次加工管理-财务确认')<button v-if="!signs[processOne.code]['财务确认']" class="btn btn-sm btn-outline-success" @click="verify(processOne,'accountant')">财务确认</button>@endcan
  362. </div>
  363. </div>
  364. </div>
  365. <div v-else>@{{ processOne.unit_price }} </div>
  366. @endcan
  367. @cannot('二次加工管理-修改价格') @{{ processOne.unit_price }}@endcannot
  368. </td>
  369. <td v-if="processOne.id" :rowspan="processOne.is_multi_row?2:''">@{{ processOne.completed_amount }}</td>
  370. <td v-if="processOne.id" :rowspan="processOne.is_multi_row?2:''">@{{ processOne.created_at }}</td>
  371. <td colspan="5" style="margin:0;padding:0;position: relative">
  372. <table class="table table-sm table-striped" style="margin:0;padding:0;" v-if="processUnfold[processOne.code+processOne.id] || processOne.processesContents.length==1 ||
  373. (processOne.is_multi_row && (processOne.processesContents.length)-(processFullSum[processOne.code])==1) || (!processOne.id && processFullSum[processOne.code]==1)">
  374. <tr v-for="processesContent in processOne.processesContents"
  375. v-if="processOne.is_multi_row || !processOne.id ? !processOne.id ? processesContent.type=='成品单' :processesContent.type=='原料单' : true">
  376. <td style="width: 190px" class="text-muted" :class="processesContent.type=='原料单'?'td-warm':'td-cool'">@{{ processesContent.bill_type }} <span style="opacity: 0.75">(@{{ processesContent.type }})</span></td>
  377. <td style="width: 210px" class="text-muted" :class="processesContent.type=='原料单'?'td-warm':'td-cool'">@{{ processesContent.wms_code }}</td>
  378. <td style="width: 100px" class="text-muted" :class="processesContent.type=='原料单'?'td-warm':'td-cool'">@{{ processesContent.amount }}</td>
  379. <td style="width: 180px" class="text-muted" :class="processesContent.type=='原料单'?'td-warm':'td-cool'">
  380. <ul class="p-0 m-0 list-unstyled list-inline" v-if="processesContent.commodity">
  381. <li v-for="barcode in processesContent.commodity.barcodes"><small>@{{ barcode.code }}</small></li>
  382. </ul>
  383. </td>
  384. <td :title="processesContent.sign_mark?processesContent.sign_mark:processesContent.commodity_name" class="text-muted tooltipTarget" :class="processesContent.type=='原料单'?'td-warm':'td-cool'">
  385. <div style="width: 180px;overflow:hidden" :class="processesContent.bill_type=='原料单'?'td-warm':'td-cool'">@{{ processesContent.sign_mark?processesContent.sign_mark:processesContent.commodity_name }}</div></td>
  386. </tr>
  387. <tr v-if="processUnfold[processOne.code+processOne.id]">
  388. <td colspan="5">
  389. <div class="text-center">
  390. <b v-if="processUnfold[processOne.code+processOne.id]=='原料单'" style="cursor:pointer;color: #aaaaaa;text-decoration:underline" @click="close(processOne.code,processOne.id)">点击关闭原料单</b>
  391. <b v-if="processUnfold[processOne.code+processOne.id]=='成品单'" style="cursor:pointer;color: #aaaaaa;text-decoration:underline" @click="close(processOne.code,processOne.id)">点击关闭成品单</b></div>
  392. </td>
  393. </tr>
  394. </table>
  395. <div v-else :style="[{background: (!processOne.id || processOne.is_multi_row) ? (!processOne.id) ? '#e8eef6' :'rgb(246, 238, 232)' : (processOne.processesContents.length>0 ? ((processOne.processesContents[0].type=='成品单') ? '#e8eef6' : 'rgb(246, 238, 232)') :'')}
  396. ,{'-webkit-transform':'scale('+(1/Math.ceil(arrayFilter(processOne.processesContents,processOne).length/3))+')'},{height: (35*Math.ceil(arrayFilter(processOne.processesContents,processOne).length/3))+'px'}
  397. ,{width: (100*Math.ceil(arrayFilter(processOne.processesContents,processOne).length/3))+'%'},{'margin-left': (-100*((Math.ceil(arrayFilter(processOne.processesContents,processOne).length/3))-1)/2)+'%'}
  398. ,{'margin-top': (-35*((Math.ceil(arrayFilter(processOne.processesContents,processOne).length/3))-1)/2)+'px'},{'margin-bottom': (-35*((Math.ceil(arrayFilter(processOne.processesContents,processOne).length/3))-1)/2)+'px'}]">
  399. <div v-for="(processesContent,i) in arrayFilter(processOne.processesContents,processOne)" class=" row p-0" style="float: left;margin-right: 20px;-webkit-transform-origin: 0" :style="[{opacity:1/0.7},
  400. {'margin-left': arrayFilter(processOne.processesContents,processOne).length >3 ? (1*parseInt(arrayFilter(processOne.processesContents,processOne).length/3))+'px' : '0px'}]">
  401. <span>@{{ processesContent.bill_type }}</span>&nbsp;&nbsp;
  402. <span>@{{ processesContent.wms_code }}</span>&nbsp;&nbsp;
  403. <span>@{{ processesContent.amount }}</span>&nbsp;&nbsp;
  404. <span v-if="processesContent.commodity && processesContent.commodity.barcodes.length>0">
  405. @{{ processesContent.commodity.barcodes[0].code }}
  406. </span>&nbsp;&nbsp;
  407. <span :title="processesContent.sign_mark?processesContent.sign_mark:processesContent.commodity_name" class="text-muted tooltipTarget" style="max-width:100px;overflow:hidden;">@{{ processesContent.sign_mark?processesContent.sign_mark:processesContent.commodity_name }}</span>
  408. </div>
  409. </div>
  410. <div style="overflow: auto;zoom:1;position:absolute;margin-top: -35px;left:calc(50% - 50px);background-color: white" v-if="!processUnfold[processOne.code+processOne.id] && processOne.processesContents.length>1 &&
  411. ((processFullSum[processOne.code]!=processOne.processesContents.length && (processOne.processesContents.length)-(processFullSum[processOne.code])!=1 && ((processOne.is_multi_row || !processOne.id) ? (!processOne.id ? false :true) : true)) ||
  412. processFullSum[processOne.code] && processFullSum[processOne.code]>1 && ((processOne.is_multi_row || !processOne.id) ? (!processOne.id ? true :false) : true))" class="text-center">
  413. <button type="button" class="btn btn-sm btn-outline-primary" v-if="processFullSum[processOne.code]!=processOne.processesContents.length && (processOne.processesContents.length)-(processFullSum[processOne.code])!=1 && ((processOne.is_multi_row || !processOne.id) ? (!processOne.id ? false :true) : true)" @click="unfold(processOne.code,processOne.id,'原料单')">点击展开原料单</button>
  414. <button type="button" class="btn btn-sm btn-outline-primary" v-if="processFullSum[processOne.code] && processFullSum[processOne.code]>1 && ((processOne.is_multi_row || !processOne.id) ? (!processOne.id ? true :false) : true)" @click="unfold(processOne.code,processOne.id,'成品单')">点击展开成品单</button></div>
  415. </td>
  416. <td v-if="processOne.id" class="text-muted" :rowspan="processOne.is_multi_row?2:''"><div style="min-width: 500px;white-space: normal">@{{ processOne.remark }}</div></td>
  417. <td v-if="processOne.id" class="text-muted" :rowspan="processOne.is_multi_row?2:''">
  418. @can('二次加工管理-删除')<button type="button" class="btn btn-sm btn-outline-danger" @click="destroy(processOne.code,processOne.id)">删</button>@endcan
  419. </td>
  420. </tr>
  421. <tr id="addProcessDailyParticipants" v-show="processDailyParticipants.length>0">
  422. <td colspan="2"></td>
  423. <td colspan="16">
  424. <table class="table-sm table-bordered table-condensed">
  425. <tr class="text-success">
  426. <td>
  427. <button v-if="!is_update_date && dateTextMap.end_date==='终'" @click="is_update_date='start_date';date=''"
  428. @mouseenter="dateTextMap.start_date='设定起始日期'" @mouseleave="dateTextMap.start_date='起'"
  429. type="button" class="btn btn-sm btn-outline-primary">@{{ dateTextMap.start_date }}</button>
  430. <button v-if="!is_update_date && dateTextMap.start_date==='起'" @click="is_update_date='end_date';date=''" type="button"
  431. @mouseenter="dateTextMap.end_date='设定终止日期'" @mouseleave="dateTextMap.end_date='终'"
  432. class="btn btn-sm btn-outline-dark">@{{ dateTextMap.end_date }}</button>
  433. <div v-if="is_update_date">
  434. <input type="date" class="form-control form-control-sm" :class="is_update_date=='start_date' ? 'text-info border-info':''"
  435. style="width: 137px" v-model="date" :max="today"
  436. :min="is_update_date=='end_date' ? processDailyParticipants[(processDailyParticipants.length)-1].date : ''">
  437. <button type="button" @click="update_process_date(processDailyParticipants[0])" class="btn btn-sm btn-outline-success">确定</button>
  438. <button type="button" @click="is_update_date='';dateTextMap.end_date='终';dateTextMap.start_date='起'" class="btn btn-sm btn-outline-danger">取消</button>
  439. </div>
  440. </td>
  441. <td>当日产量</td>
  442. <td>当日剩余</td>
  443. <td colspan="2">操作</td>
  444. <td>参与者</td>
  445. <td>开始时间</td>
  446. <td>结束时间</td>
  447. <td>计时工资</td>
  448. <td>计件工资</td>
  449. <td>晚饭时间</td>
  450. <td>计时工时</td>
  451. <td>计件数量</td>
  452. <td>备注</td>
  453. <td>打卡工时</td>
  454. <td>工时差</td>
  455. <td>计费工时</td>
  456. <td>审核</td>
  457. <td>详情</td>
  458. </tr>
  459. <tr v-for="processDailyParticipant in processDailyParticipants" :id="'processDailyParticipant'+processDailyParticipant.id">
  460. <td v-if="processDailyParticipant.rowspan" :rowspan="processDailyParticipant.rowspan"><p >@{{ processDailyParticipant.date }}</p></td>
  461. <td v-if="processDailyParticipant.rowspan" :rowspan="processDailyParticipant.rowspan">
  462. <div class="form-inline">
  463. <input :readonly="processDailyParticipant.readonly" v-model="processDailyParticipant.submitOutput"
  464. class="form-control col-sm-5 " @click="processDailyParticipant.id?processDailyParticipant.readonly=false:processDailyParticipant.readonly=true" type="text" />
  465. @can("二次加工管理-登记工时")<button class="btn btn-sm btn-success" v-if="! processDailyParticipant.readonly" @click="submitOutputData(processDailyParticipant.daily_id,processDailyParticipant.submitOutput,processDailyParticipant.id)">确定</button>
  466. <button class="btn btn-sm btn-danger" v-if="! processDailyParticipant.readonly" @click="processDailyParticipant.readonly=true;processDailyParticipant.submitOutput=processDailyParticipant.output">取消</button>
  467. @endcan
  468. </div>
  469. </td>
  470. <td v-if="processDailyParticipant.rowspan" :rowspan="processDailyParticipant.rowspan"><p >@{{ processDailyParticipant.remain }}</p></td>
  471. <td v-if="processDailyParticipant.rowspan" :rowspan="processDailyParticipant.rowspan">
  472. @can("二次加工管理-登记工时")<button v-if="processDailyParticipant.isAddProcessDailyParticipant && isShow.isAddProcessDailyParticipant" class="btn btn-sm btn-outline-info" @click="addProcessDailyParticipant(processDailyParticipant);processDailyParticipant.isAddProcessDailyParticipant=false;">新增</button>
  473. <button v-if="!processDailyParticipant.isAddProcessDailyParticipant" class="btn btn-sm btn-danger"
  474. @click="deleteProcessDailyParticipant($event,processDailyParticipant.daily_id,processDailyParticipant.user_detail_full_name,processDailyParticipant.isConfirmBtn);processDailyParticipant.isAddProcessDailyParticipant=true;">取消</button>
  475. @endcan
  476. </td>
  477. <td>
  478. @can("二次加工管理-登记工时")<button v-if="!processDailyParticipant.isAddProcessDailyParticipant && processDailyParticipant.isConfirmBtn" class="btn btn-sm btn-success" @click="submitProcessDailyParticipant(processDailyParticipant.daily_id)">确定</button>
  479. <button v-if="processDailyParticipant.id && processDailyParticipant.status=='未审核'" class="btn btn-sm btn-outline-info" @click="updateProcessDailyParticipant(processDailyParticipant)">改</button>
  480. @endcan
  481. </td>
  482. <td>
  483. <span v-if="!processDailyParticipant.user_detail_full_name && processDailyParticipant.isAddProcessDailyParticipant==false" >
  484. <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)">
  485. <input hidden :id="processDailyParticipant.daily_id+'user_id'"/>
  486. </span><span v-else>@{{ processDailyParticipant.user_detail_full_name }}</span></td>
  487. <td>
  488. <span v-if="!processDailyParticipant.user_detail_full_name && processDailyParticipant.isAddProcessDailyParticipant==false" >
  489. <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:120px" type="time" @input="hourFilter(processDailyParticipant.daily_id,true)">
  490. </span><span v-else> @{{ processDailyParticipant.started_at }}</span></td>
  491. <td>
  492. <span v-if="!processDailyParticipant.user_detail_full_name && processDailyParticipant.isAddProcessDailyParticipant==false" >
  493. <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:120px" type="time" @input="hourFilter(processDailyParticipant.daily_id,true)">
  494. </span><span v-else> @{{ processDailyParticipant.ended_at }}</span></td>
  495. <td><span v-if="!processDailyParticipant.user_detail_full_name && processDailyParticipant.isAddProcessDailyParticipant==false">
  496. <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">
  497. </span><span v-else>@{{ processDailyParticipant.hour_price }}</span></td>
  498. <td>
  499. <span v-if="!processDailyParticipant.user_detail_full_name && processDailyParticipant.isAddProcessDailyParticipant==false">
  500. <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">
  501. </span><span v-else>@{{ processDailyParticipant.unit_price }}</span></td>
  502. <td>
  503. <span v-if="!processDailyParticipant.user_detail_full_name && processDailyParticipant.isAddProcessDailyParticipant==false">
  504. <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">
  505. <option value="0">无</option>
  506. <option value="30">30分钟</option>
  507. <option value="60">60分钟</option>
  508. </select>
  509. </span><span v-else>@{{ processDailyParticipant.dinner_duration }}</span></td>
  510. <td>
  511. <span v-if="!processDailyParticipant.user_detail_full_name && processDailyParticipant.isAddProcessDailyParticipant==false">
  512. <input :class="{ 'is-invalid' : errors.hour_count }" :data-original-title="errors.hour_count ? errors.hour_count[0] : ''" :id="processDailyParticipant.daily_id+'hour_count'" :value="processDailyParticipant.hour_count?processDailyParticipant.hour_count:8" class="form-control tooltipTargetError" style="width:70px" type="text" >
  513. </span><span v-else>@{{ processDailyParticipant.hour_count }}</span></td>
  514. <td>
  515. <span v-if="!processDailyParticipant.user_detail_full_name && processDailyParticipant.isAddProcessDailyParticipant==false">
  516. <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">
  517. </span><span v-else>@{{ processDailyParticipant.unit_count }}</span></td>
  518. <td>
  519. <span v-if="!processDailyParticipant.user_detail_full_name && processDailyParticipant.isAddProcessDailyParticipant==false">
  520. <input :id="processDailyParticipant.daily_id+'remark'" class="form-control" style="width: 100px" type="text">
  521. </span><span v-else>@{{ processDailyParticipant.remark }}</span></td>
  522. <td class="text-danger">@{{ processDailyParticipant.hour }}</td>
  523. <td class="text-danger">@{{ processDailyParticipant.diff }}</td>
  524. <td class="text-danger">@{{ processDailyParticipant.billingHour }}</td>
  525. <td class="text-danger">
  526. @can("人事管理-任务审核")<button @click="processDailyParticipantAudit(processDailyParticipant.id)" v-if="processDailyParticipant.status=='未审核'" class="btn btn-sm btn-outline-success">审核</button>@endcan
  527. <b v-else class="text-success">@{{ processDailyParticipant.status }}</b>
  528. </td>
  529. @can("二次加工管理-临时工资料管理")<td class="text-info"><u v-if="processDailyParticipant.user_detail_full_name" style="cursor:pointer" @click="showUserDetail(processDailyParticipant.user_id)">详情</u></td>@endcan
  530. </tr>
  531. </table>
  532. </td>
  533. </tr>
  534. </template>
  535. </table>
  536. {{$processes->appends($request)->links()}}
  537. </div>
  538. </div>
  539. @endsection
  540. @section('lastScript')
  541. <script>
  542. new Vue({
  543. el:"#process",
  544. data:{
  545. participantInputting:{},
  546. processes:[
  547. @foreach($processes as $processOne)
  548. {id:'{{$processOne->id}}',code:'{{$processOne->code}}',owner_name:'{{$processOne->owner_name}}',owner_id:'{{$processOne->owner_id}}',operatorLogs:{!! $processOne->operatorLogs !!},
  549. process_method_name:'{{$processOne->process_method_name}}',amount:'{{$processOne->amount}}',type:'{{$processOne->type}}',signs:{!!$processOne->signs !!}
  550. ,tutorials:{!! $processOne->tutorials !!},processesContents:{!! $processOne->processesContents !!},unit_price:'{{$processOne->unit_price}}',created_at:'{{$processOne->created_at}}',
  551. completed_amount:'{{$processOne->completed_amount}}',status:'{{$processOne->status}}',remark:'{{$processOne->remark}}',detailFolding:false,openProcessHour:false,is_multi_row:false,is_verifier_show:false,is_update_unit_price:false,
  552. buttonTexts:{'审核':'审','回滚':'回','编辑':'编','接单':'接','驳回':'驳','质量验收':'验','完成':'完','交接完成':'交','查看单据':'查','登记工时':'登'},
  553. },
  554. @endforeach
  555. ],
  556. processesList:[],
  557. owners:[
  558. @foreach($owners as $owner)
  559. {!! $owner !!},
  560. @endforeach
  561. ],
  562. errors:{},
  563. checkData:[],
  564. filterData:{paginate:50,date_start:'',date_end:'',owner_id:'',commodity_barcode:'',wms_code:'',status:'',is_accomplish:''},
  565. processDailies:[],
  566. processDailyParticipants:[],
  567. isShow:{
  568. isOpenProcessHour:false,isAddProcessDailyParticipant:true,isUpdateConfirmBtn:true,
  569. },
  570. userLabors:[],
  571. modalDaily_id:'',
  572. processDailyParticipantOne:{id:'',user_id:'',user_detail_full_name:'',started_at:"",ended_at:"",
  573. hour_price:'',unit_price:'',dinner_duration:'',hour_count:'',unit_count:'',remark:''},
  574. processTutorial:{id:'',owner_id:'',tutorials:[],},
  575. processUnfold:[],
  576. processFullSum:[],
  577. signs:[],
  578. is_update_date:false,
  579. date:'',
  580. today:'',
  581. dateTextMap:{'start_date':'起','end_date':'终'},
  582. },
  583. watch:{
  584. checkData:{
  585. handler(){
  586. if (this.checkData.length === this.processes.length){
  587. document.querySelector('#all').checked = true;
  588. }else {
  589. document.querySelector('#all').checked = false;
  590. }
  591. },
  592. deep:true
  593. }
  594. },
  595. computed:{
  596. isBeingFilterConditions:function(){
  597. for(let key in this.filterData){
  598. if(this.filterData[key]){
  599. if(key==='paginate' || key==='is_accomplish')continue;
  600. return true
  601. }
  602. }
  603. return false;
  604. },
  605. },
  606. mounted:function () {
  607. this.initInputs();
  608. this.resetProcessData();
  609. $(".tooltipTarget").tooltip({'trigger':'hover'});
  610. $('#process').removeClass('d-none');
  611. var today=new Date();
  612. this.today = today.getFullYear() + "-" + ((today.getMonth() + 1) < 10 ? "0"+(today.getMonth() + 1) : (today.getMonth() + 1)) + "-" + today.getDate();
  613. },
  614. methods: {
  615. arrayFilter: function (processesContents, process) {
  616. if (!process.is_multi_row && process.id) return processesContents;
  617. let array = [];
  618. let type = '成品单';
  619. if (process.id) type = '原料单';
  620. processesContents.forEach(function (processesContent) {
  621. if (processesContent.type === type) array.push(processesContent);
  622. });
  623. return array;
  624. },
  625. //重组数据
  626. resetProcessData: function () {
  627. let _this = this;
  628. let indexs = [];
  629. for (let i = 0; i < this.processes.length; i++) {
  630. let process = this.processes[i];
  631. _this.$set(_this.signs,process.code,[]);
  632. process.signs.forEach(function (sign) {
  633. _this.$set(_this.signs[process.code],sign.mark,true);
  634. });
  635. process.serial_number = i + 1;
  636. process.processesContents.every(function (processesContent) {
  637. if (processesContent.type === '成品单') _this.$set(_this.processFullSum, process.code, _this.processFullSum[process.code] ? _this.processFullSum[process.code] + 1 : 1);
  638. return true;
  639. });
  640. if (_this.processFullSum[process.code] && _this.processFullSum[process.code] !== 0 && _this.processFullSum[process.code] !== process.processesContents.length) {
  641. indexs.unshift(i);
  642. process.is_multi_row = true;
  643. }
  644. }
  645. indexs.forEach(function (index) {
  646. let processTemp = Object.assign({}, _this.processes[index]);
  647. processTemp.id = '';
  648. processTemp.is_multi_row = false;
  649. _this.processes.splice(index + 1, 0, processTemp);
  650. });
  651. },
  652. //回显条件参数
  653. initInputs: function () {
  654. let data = this;
  655. let uriParts = decodeURI(location.href).split("?");
  656. if (uriParts.length > 1) {
  657. let params = uriParts[1].split('&');
  658. params.forEach(function (paramPair) {
  659. let pair = paramPair.split('=');
  660. let key = pair[0], val = pair[1];
  661. if (val !== "+") {
  662. $('input[name="' + key + '"]').val(val);
  663. $('select[name="' + key + '"]').val(val);
  664. decodeURI(data.filterData[key] = val);
  665. }
  666. });
  667. }
  668. },
  669. //提交表单
  670. submit: function () {
  671. let form = $("#optionSubmit");
  672. form.submit();
  673. },
  674. //全选事件
  675. checkAll(e) {
  676. if (e.target.checked) {
  677. this.processes.forEach((el, i) => {
  678. if (this.checkData.indexOf(el.id) == '-1') {
  679. this.checkData.push(el.id);
  680. }
  681. });
  682. } else {
  683. this.checkData = [];
  684. }
  685. },
  686. //导出excel,因同步问题不使用formData
  687. processExport(e) {
  688. let val = e;
  689. let data = this.filterData;
  690. if (val == 1) {
  691. if (this.checkData && this.checkData.length <= 0) {
  692. tempTip.setDuration(4000);
  693. tempTip.showSuccess('没有勾选任何记录');
  694. } else {
  695. location.href = "{{url('process?checkSign=')}}" + this.checkData;
  696. }
  697. } else {
  698. location.href = "{{url('process?checkSign=-1&date_start=')}}" +
  699. data.date_start + "&date_end=" + data.date_end + "&owner_id=" +
  700. data.owner_id + "&commodity_barcode=" + data.commodity_barcode + "&wms_code=" + data.wms_code +
  701. "&status=" + data.status+"$is_accomplish="+data.is_accomplish;
  702. }
  703. },
  704. //获取登记工时
  705. openProcessHour(process) {
  706. let e = process.id;
  707. let _this = this;
  708. if (_this.isShow.isOpenProcessHour) {
  709. _this.processes.every(function (process) {
  710. if (process.openProcessHour) {
  711. process.openProcessHour = false;
  712. return false;
  713. }
  714. return true;
  715. });
  716. } else {
  717. _this.isShow.isOpenProcessHour = true;
  718. }
  719. axios.post("{{url("process/getDailyParticipant")}}", {id: e, amount: process.amount})
  720. .then(function (response) {
  721. let processDailies = response.data;
  722. _this.resetProcessDaily(processDailies,e);
  723. }).catch(function (err) {
  724. tempTip.setDuration(5000);
  725. tempTip.show('获取登记工时数据发生了一些严重错误:' + err);
  726. });
  727. let processDailyParticipantsHtml = $("#addProcessDailyParticipants");
  728. if (process.is_multi_row) $("#" + e + "-2").after(processDailyParticipantsHtml);
  729. else $("#" + e).after(processDailyParticipantsHtml)
  730. },
  731. //重组加工单加工日记录数据
  732. resetProcessDaily(processDailies,process_id){
  733. let _this=this;
  734. _this.processDailies = [];
  735. _this.processDailyParticipants = [];
  736. for (let i = 0; i < processDailies.length; i++) {
  737. let processDailyParticipants = processDailies[i].process_daily_participants;
  738. if (processDailyParticipants.length <= 0) {
  739. let data = {};
  740. data['process_id'] = process_id;
  741. data['daily_id'] = processDailies[i].id;
  742. data['date'] = processDailies[i].date;
  743. data['output'] = processDailies[i].output;
  744. data['remain'] = processDailies[i].remain;
  745. data['rowspan'] = 1;
  746. data['readonly'] = "true";
  747. data['isAddProcessDailyParticipant'] = "true";
  748. data['isConfirmBtn'] = "true";
  749. data['submitOutput'] = processDailies[i].output;
  750. _this.processDailyParticipants.push(data);
  751. continue;
  752. }
  753. for (let j = 0; j < processDailyParticipants.length; j++) {
  754. let data = {};
  755. data['id'] = processDailyParticipants[j].id;
  756. data['status'] = processDailyParticipants[j].status;
  757. data['started_at'] = processDailyParticipants[j].started_at;
  758. data['user_detail_full_name'] = processDailyParticipants[j].user_detail_full_name;
  759. data['user_id'] = processDailyParticipants[j].user_id;
  760. data['ended_at'] = processDailyParticipants[j].ended_at;
  761. data['hour_price'] = processDailyParticipants[j].hour_price;
  762. data['unit_price'] = processDailyParticipants[j].unit_price;
  763. data['dinner_duration'] = processDailyParticipants[j].dinner_duration;
  764. data['hour_count'] = processDailyParticipants[j].hour_count;
  765. data['remark'] = processDailyParticipants[j].remark;
  766. data['hour'] = processDailyParticipants[j].hour;
  767. data['diff'] = processDailyParticipants[j].diff;
  768. data['billingHour'] = processDailyParticipants[j].billingHour;
  769. data['unit_count'] = processDailyParticipants[j].unit_count;
  770. data['process_id'] = processDailies[i].process_id;
  771. data['readonly'] = "true";
  772. if (!_this.processDailies[processDailies[i].id]) {
  773. data['rowspan'] = processDailyParticipants.length;
  774. data['process_id'] = process_id;
  775. data['daily_id'] = processDailies[i].id;
  776. data['date'] = processDailies[i].date;
  777. data['output'] = processDailies[i].output;
  778. data['remain'] = processDailies[i].remain;
  779. data['submitOutput'] = processDailies[i].output;
  780. data['isAddProcessDailyParticipant'] = "true";
  781. data['isConfirmBtn'] = "true";
  782. _this.processDailies[processDailies[i].id] = processDailies[i].id;
  783. }
  784. _this.processDailyParticipants.push(data);
  785. }
  786. }
  787. },
  788. //删除工时显示
  789. closeProcessHour(e) {
  790. this.processDailies = [];
  791. this.processDailyParticipants = [];
  792. },
  793. //新增参与人
  794. addProcessDailyParticipant(processDailyParticipantOne) {
  795. let id = processDailyParticipantOne.id;
  796. if (!id) return;
  797. let _this = this;
  798. _this.errors = {};
  799. this.processDailyParticipants.every(function (processDailyParticipant, i) {
  800. if (processDailyParticipant.id == id) {
  801. processDailyParticipant.rowspan++;
  802. let data = {};
  803. data['readonly'] = "true";
  804. data['isAddProcessDailyParticipant'] = "true";
  805. data['isConfirmBtn'] = "true";
  806. data['id'] = processDailyParticipant.id;
  807. data['user_id'] = processDailyParticipant.user_id;
  808. data['status'] = processDailyParticipant.status;
  809. data['started_at'] = processDailyParticipant.started_at;
  810. data['user_detail_full_name'] = processDailyParticipant.user_detail_full_name;
  811. data['ended_at'] = processDailyParticipant.ended_at;
  812. data['hour_price'] = processDailyParticipant.hour_price;
  813. data['unit_price'] = processDailyParticipant.unit_price;
  814. data['dinner_duration'] = processDailyParticipant.dinner_duration;
  815. data['hour_count'] = processDailyParticipant.hour_count;
  816. data['remark'] = processDailyParticipant.remark;
  817. data['hour'] = processDailyParticipant.hour;
  818. data['diff'] = processDailyParticipant.diff;
  819. data['billingHour'] = processDailyParticipant.billingHour;
  820. data['unit_count'] = processDailyParticipant.unit_count;
  821. data['process_id'] = processDailyParticipant.process_id;
  822. _this.processDailyParticipants.splice(i + 1, 0, data);
  823. processDailyParticipant.id = '';
  824. processDailyParticipant.status = '';
  825. processDailyParticipant.started_at = '';
  826. processDailyParticipant.user_detail_full_name = '';
  827. processDailyParticipant.ended_at = '';
  828. processDailyParticipant.hour_price = '';
  829. processDailyParticipant.unit_price = '';
  830. processDailyParticipant.dinner_duration = '';
  831. processDailyParticipant.hour_count = '';
  832. processDailyParticipant.remark = '';
  833. processDailyParticipant.hour = '';
  834. processDailyParticipant.diff = '';
  835. processDailyParticipant.billingHour = '';
  836. processDailyParticipant.unit_count = '';
  837. processDailyParticipant.process_id = '';
  838. return false;
  839. }
  840. return true;
  841. });
  842. _this.isShow.isAddProcessDailyParticipant = false;
  843. },
  844. //取消录入参与人
  845. deleteProcessDailyParticipant($event, daily_id, processDailyParticipant_name, isConfirmBtn) {
  846. console.log($event, daily_id, processDailyParticipant_name, isConfirmBtn);
  847. if (!isConfirmBtn) {
  848. this.processDailyParticipants.every(function (processDailyParticipant) {
  849. if (processDailyParticipant.daily_id == daily_id) {
  850. processDailyParticipant.isConfirmBtn = true; //放出隐藏确定按钮
  851. return false;
  852. }
  853. return true;
  854. });
  855. }
  856. let _this = this;
  857. this.processDailyParticipants.every(function (processDailyParticipant, i) {
  858. if (processDailyParticipant.daily_id == daily_id) {
  859. if (!processDailyParticipant_name && _this.processDailyParticipants[i + 1] && _this.processDailyParticipants[i + 1].daily_id) return false;
  860. if (!_this.processDailyParticipants[i + 1]) return false;
  861. _this.processDailyParticipants[i + 1].rowspan = (processDailyParticipant.rowspan) - 1;
  862. _this.processDailyParticipants[i + 1].daily_id = processDailyParticipant.daily_id;
  863. _this.processDailyParticipants[i + 1].date = processDailyParticipant.date;
  864. _this.processDailyParticipants[i + 1].output = processDailyParticipant.output;
  865. _this.processDailyParticipants[i + 1].remain = processDailyParticipant.remain;
  866. _this.processDailyParticipants[i + 1].submitOutput = processDailyParticipant.submitOutput;
  867. _this.processDailyParticipants.splice(i, 1);
  868. return false;
  869. }
  870. return true;
  871. });
  872. _this.isShow.isAddProcessDailyParticipant = true;
  873. },
  874. //驳回
  875. processReject(id) {
  876. if (!confirm('确定驳回该单吗?')) {
  877. return
  878. }
  879. ;
  880. let url = "{{url('process/reject')}}" + "/" + id;
  881. let _this = this;
  882. axios.post(url)
  883. .then(function (response) {
  884. _this.processes.every(function (process) {
  885. if (process.id == response.data.id) {
  886. process.status = response.data.status;
  887. return false;
  888. }
  889. return true;
  890. });
  891. tempTip.setDuration(3000);
  892. tempTip.showSuccess('驳回成功!');
  893. }).catch(function (err) {
  894. tempTip.setDuration(5000);
  895. tempTip.show('驳回二次加工单发生了一些严重错误:' + err);
  896. })
  897. },
  898. //接单
  899. processReceive(id) {
  900. let url = "{{url('process/receive')}}" + "/" + id;
  901. let _this = this;
  902. axios.post(url)
  903. .then(function (response) {
  904. _this.processes.every(function (process) {
  905. if (process.id == response.data.id) {
  906. process.status = response.data.status;
  907. return false;
  908. }
  909. return true;
  910. });
  911. tempTip.setDuration(3000);
  912. tempTip.showSuccess('接单成功!');
  913. }).catch(function (err) {
  914. tempTip.setDuration(5000);
  915. tempTip.show('接单时发生了一些严重错误:' + err);
  916. })
  917. },
  918. //完成
  919. processAccomplish(process) {
  920. if (!confirm('确定标记为加工完成吗?')) {
  921. return
  922. }
  923. ;
  924. axios.post('{{url('process/processAccomplish')}}', {id: process.id})
  925. .then(function (response) {
  926. if (response.data.success) {
  927. process.status = response.data.data;
  928. tempTip.setDuration(2000);
  929. tempTip.showSuccess('“' + process.code + '”已被标记为加工完成!');
  930. return;
  931. }
  932. tempTip.setDuration(3000);
  933. tempTip.show('未知错误,联系管理员解决!');
  934. }).catch(function (err) {
  935. tempTip.setDuration(3000);
  936. tempTip.show('网络错误:' + err);
  937. })
  938. },
  939. accomplish(process) {
  940. if (!confirm('确定“' + process.code + '”交接完成吗?')) {
  941. return
  942. }
  943. ;
  944. let url = "{{url('process/accomplish')}}";
  945. axios.post(url, {id: process.id})
  946. .then(function (response) {
  947. if (response.data.success) {
  948. process.status = response.data.data;
  949. tempTip.setDuration(2000);
  950. tempTip.showSuccess('交接完成!');
  951. return;
  952. }
  953. tempTip.setDuration(3000);
  954. tempTip.show(response.data.data);
  955. }).catch(function (err) {
  956. tempTip.setDuration(3000);
  957. tempTip.show('网络错误:' + err);
  958. })
  959. },
  960. //定位客户
  961. owner_seek: function (e) {
  962. let _this = this;
  963. let $val = e.target.value;
  964. if ($val === '') _this.filterData.owner_id = '';
  965. else
  966. _this.owners.forEach(function (owner) {
  967. if (owner.name.includes($val)) {
  968. _this.filterData.owner_id = owner.id;
  969. }
  970. });
  971. },
  972. //修改每日产量
  973. submitOutputData(daily_id, data, id) {
  974. let url = "{{url('process/updateDailyOutput')}}";
  975. let _this = this;
  976. axios.post(url, {id: daily_id, output: data})
  977. .then(function (response) {
  978. if (response.data.status == "error") {
  979. tempTip.setDuration(3000);
  980. tempTip.show('输入有误:' + response.data.data.output);
  981. }
  982. if (response.data.status == "success") {
  983. let processDailies = response.data.data;
  984. _this.processDailyParticipants.every(function (processDailyParticipant) {
  985. if (processDailyParticipant.id == id) {
  986. processDailyParticipant.readonly = true;
  987. }
  988. processDailies.every(function (processDaily) {
  989. if (processDailyParticipant.date == processDaily.date) {
  990. processDailyParticipant.output = processDaily.output;
  991. processDailyParticipant.remain = processDaily.remain;
  992. return false;
  993. }
  994. return true;
  995. });
  996. return true;
  997. });
  998. if (response.data.process) {
  999. _this.processes.every(function (process) {
  1000. if (process.id == response.data.process) {
  1001. process.status = "待验收";
  1002. return false;
  1003. }
  1004. return true;
  1005. });
  1006. }
  1007. tempTip.setDuration(3000);
  1008. tempTip.showSuccess('每日产量修改成功!');
  1009. }
  1010. }).catch(function (err) {
  1011. tempTip.setDuration(5000);
  1012. tempTip.show('修改每日产量发生了一些严重错误:' + err);
  1013. });
  1014. },
  1015. //验证临时工
  1016. verifyUserName(e, daily_id, isConfirmBtn) {
  1017. let user = e.target.value;
  1018. let _this = this;
  1019. axios.post('{{url('process/verifyUserName')}}', {userName: user})
  1020. .then(function (response) {
  1021. //修改时验证
  1022. if (!daily_id) {
  1023. //验证失败
  1024. if (response.data.length < 1) {
  1025. _this.isShow.isUpdateConfirmBtn = false;
  1026. _this.errors['user_id'] = "查无此人,请检查您的输入";
  1027. return;
  1028. }
  1029. //验证成功且结果仅有一个
  1030. if (response.data.user_id) {
  1031. _this.isShow.isUpdateConfirmBtn = true;
  1032. _this.errors['user_id'] = "";
  1033. _this.processDailyParticipantOne.user_id = response.data.user_id;
  1034. return;
  1035. }
  1036. //验证成功多结果
  1037. if (response.data.length > 1) {
  1038. _this.userLabors = response.data;
  1039. $("#myModal").modal('show');
  1040. return;
  1041. }
  1042. }
  1043. //验证失败
  1044. if (response.data.length < 1) {
  1045. _this.processDailyParticipants.every(function (processDailyParticipant) {
  1046. if (processDailyParticipant.daily_id == daily_id) {
  1047. _this.errors['user_id'] = "查无此人,请检查您的输入";
  1048. setTimeout(function () {
  1049. $(".tooltipTargetError").tooltip('show');
  1050. }, 1);
  1051. processDailyParticipant.isConfirmBtn = false; //验证失败隐藏确定按钮
  1052. return false;
  1053. }
  1054. return true;
  1055. });
  1056. return;
  1057. }
  1058. //按钮被隐藏则放出
  1059. if (!isConfirmBtn) {
  1060. _this.processDailyParticipants.every(function (processDailyParticipant) {
  1061. if (processDailyParticipant.daily_id == daily_id) {
  1062. processDailyParticipant.isConfirmBtn = true; //验证失败隐藏确定按钮
  1063. return false;
  1064. }
  1065. return true;
  1066. });
  1067. }
  1068. _this.modalDaily_id = daily_id;
  1069. //验证成功且结果仅有一个
  1070. if (response.data.user_id) {
  1071. _this.errors['user_id'] = "";
  1072. $("#" + daily_id + "user_id").val(response.data.user_id);
  1073. $("#" + daily_id + "hour_price").val(response.data.user_labor.default_hour_price);
  1074. }
  1075. //验证成功多结果
  1076. if (response.data.length > 1) {
  1077. _this.userLabors = response.data;
  1078. $("#myModal").modal('show');
  1079. }
  1080. }).catch(function (err) {
  1081. tempTip.setDuration(5000);
  1082. tempTip.show('验证临时工发生了一些严重错误:' + err);
  1083. })
  1084. },
  1085. //验证时间合法性
  1086. hourFilter(processDailyParticipant, is_create) {
  1087. let start = new Date('2020/1/1 12:00:00').getTime();
  1088. let end = new Date('2020/1/1 13:00:00').getTime();
  1089. if (is_create) {
  1090. let started_at = new Date('2020/1/1 ' + $('#' + processDailyParticipant + 'started_at')[0].value).getTime();
  1091. let ended_at = new Date('2020/1/1 ' + $('#' + processDailyParticipant + 'ended_at')[0].value).getTime();
  1092. let hour_count = (ended_at - started_at) / 3600000;
  1093. if (started_at < start && ended_at > end) hour_count -= 1;
  1094. $('#' + processDailyParticipant + 'hour_count')[0].value = hour_count;
  1095. return;
  1096. }
  1097. let started_at = new Date('2020/1/1 ' + processDailyParticipant.started_at).getTime();
  1098. let ended_at = new Date('2020/1/1 ' + processDailyParticipant.ended_at).getTime();
  1099. let hour_count = (ended_at - started_at) / 3600000;
  1100. if (started_at < start && ended_at > end) hour_count -= 1;
  1101. processDailyParticipant.hour_count = hour_count;
  1102. },
  1103. //提交参与人
  1104. submitProcessDailyParticipant(e) {
  1105. let request = {};
  1106. request['user_id'] = $("#" + e + "user_id").val();
  1107. request['started_at'] = $("#" + e + "started_at").val();
  1108. request['ended_at'] = $("#" + e + "ended_at").val();
  1109. let hour_price = $("#" + e + "hour_price").val();
  1110. if (hour_price) request['hour_price'] = hour_price;
  1111. let unit_price = $("#" + e + "unit_price").val();
  1112. if (unit_price) request['unit_price'] = unit_price;
  1113. let dinner_duration = $("#" + e + "dinner_duration").val();
  1114. if (dinner_duration) request['dinner_duration'] = dinner_duration;
  1115. let hour_count = $("#" + e + "hour_count").val();
  1116. if (hour_count) request['hour_count'] = hour_count;
  1117. let unit_count = $("#" + e + "unit_count").val();
  1118. if (unit_count) request['unit_count'] = unit_count;
  1119. let remark = $("#" + e + "remark").val();
  1120. if (remark) request['remark'] = remark;
  1121. request['daily_id'] = this.modalDaily_id;
  1122. let _this = this;
  1123. axios.post("{{url('process/shortProcessDailyParticipant')}}", request)
  1124. .then(function (response) {
  1125. if (response.data.status == "error") {
  1126. tempTip.setDuration(3000);
  1127. _this.errors = response.data.data;
  1128. setTimeout(function () {
  1129. $(".tooltipTargetError").tooltip('show');
  1130. }, 1);
  1131. setTimeout(function () {
  1132. $(".tooltipTargetError").tooltip('hide');
  1133. }, 3000);
  1134. return;
  1135. }
  1136. if (response.data.status == "success") {
  1137. _this.processDailyParticipants.every(function (processDailyParticipant) {
  1138. if (processDailyParticipant.daily_id == e) {
  1139. processDailyParticipant.id = response.data.data.id;
  1140. processDailyParticipant.status = response.data.data.status;
  1141. processDailyParticipant.user_detail_full_name = response.data.data.user_detail_full_name;
  1142. processDailyParticipant.user_id = response.data.data.user_id;
  1143. processDailyParticipant.started_at = response.data.data.started_at;
  1144. processDailyParticipant.ended_at = response.data.data.ended_at;
  1145. processDailyParticipant.hour_price = response.data.data.hour_price;
  1146. processDailyParticipant.unit_price = response.data.data.unit_price;
  1147. processDailyParticipant.dinner_duration = response.data.data.dinner_duration;
  1148. processDailyParticipant.hour_count = response.data.data.hour_count;
  1149. processDailyParticipant.unit_count = response.data.data.unit_count;
  1150. processDailyParticipant.remark = response.data.data.remark;
  1151. processDailyParticipant.hour = response.data.data.hour;
  1152. processDailyParticipant.diff = response.data.data.diff;
  1153. processDailyParticipant.billingHour = response.data.data.billingHour;
  1154. processDailyParticipant.isAddProcessDailyParticipant = true;
  1155. _this.isShow.isAddProcessDailyParticipant = true;
  1156. return false;
  1157. }
  1158. return true;
  1159. });
  1160. if (response.data.process) {
  1161. _this.processes.every(function (process) {
  1162. if (process.id == response.data.process) {
  1163. process.status = "加工中";
  1164. return false;
  1165. }
  1166. return true;
  1167. });
  1168. }
  1169. tempTip.setDuration(3000);
  1170. tempTip.showSuccess('参与人新增成功!');
  1171. }
  1172. }).catch(function (err) {
  1173. tempTip.setDuration(5000);
  1174. tempTip.show('新增参与人发生了一些严重错误:' + err);
  1175. })
  1176. },
  1177. //同名临时工选择
  1178. selectedUser(user_id, hour_price) {
  1179. $("#myModal").modal('hide');
  1180. this.errors['user_id'] = "";
  1181. this.processDailyParticipantOne['user_id'] = user_id;
  1182. this.processDailyParticipantOne['hour_price'] = hour_price;
  1183. this.isShow.isUpdateConfirmBtn = true;
  1184. $("#" + this.modalDaily_id + "user_id").val(user_id);
  1185. $("#" + this.modalDaily_id + "hour_price").val(hour_price);
  1186. },
  1187. //修改参与人
  1188. updateProcessDailyParticipant(processDailyParticipant) {
  1189. this.errors = {};
  1190. this.processDailyParticipantOne['id'] = processDailyParticipant.id;
  1191. this.processDailyParticipantOne['user_detail_full_name'] = processDailyParticipant.user_detail_full_name;
  1192. this.processDailyParticipantOne['user_id'] = processDailyParticipant.user_id;
  1193. this.processDailyParticipantOne['started_at'] = processDailyParticipant.started_at;
  1194. this.processDailyParticipantOne['ended_at'] = processDailyParticipant.ended_at;
  1195. this.processDailyParticipantOne['hour_price'] = processDailyParticipant.hour_price;
  1196. this.processDailyParticipantOne['unit_price'] = processDailyParticipant.unit_price;
  1197. this.processDailyParticipantOne['dinner_duration'] = processDailyParticipant.dinner_duration;
  1198. this.processDailyParticipantOne['hour_count'] = processDailyParticipant.hour_count;
  1199. this.processDailyParticipantOne['unit_count'] = processDailyParticipant.unit_count;
  1200. this.processDailyParticipantOne['remark'] = processDailyParticipant.remark;
  1201. $("#updateModal").modal('show');
  1202. },
  1203. //提交修改
  1204. submitUpdateProcessDailyParticipant() {
  1205. let _this = this;
  1206. axios.post("{{url('process/updateProcessDailyParticipant')}}", this.processDailyParticipantOne)
  1207. .then(function (response) {
  1208. if (response.data.status == "error") {
  1209. tempTip.setDuration(3000);
  1210. _this.errors = response.data.data;
  1211. }
  1212. if (response.data.status == "success") {
  1213. _this.processDailyParticipants.every(function (processDailyParticipant) {
  1214. if (processDailyParticipant.id == response.data.data.id) {
  1215. processDailyParticipant.status = response.data.data.status;
  1216. processDailyParticipant.user_detail_full_name = response.data.data.user_detail_full_name;
  1217. processDailyParticipant.started_at = response.data.data.started_at;
  1218. processDailyParticipant.ended_at = response.data.data.ended_at;
  1219. processDailyParticipant.hour_price = response.data.data.hour_price;
  1220. processDailyParticipant.unit_price = response.data.data.unit_price;
  1221. processDailyParticipant.dinner_duration = response.data.data.dinner_duration;
  1222. processDailyParticipant.hour_count = response.data.data.hour_count;
  1223. processDailyParticipant.unit_count = response.data.data.unit_count;
  1224. processDailyParticipant.remark = response.data.data.remark;
  1225. processDailyParticipant.hour = response.data.data.hour;
  1226. processDailyParticipant.diff = response.data.data.diff;
  1227. processDailyParticipant.billingHour = response.data.data.billingHour;
  1228. processDailyParticipant.isAddProcessDailyParticipant = true;
  1229. return false;
  1230. }
  1231. return true;
  1232. });
  1233. tempTip.setDuration(3000);
  1234. tempTip.showSuccess('参与人修改成功!');
  1235. $("#updateModal").modal('hide');
  1236. }
  1237. }).catch(function (err) {
  1238. tempTip.setDuration(5000);
  1239. tempTip.show('修改参与人发生了一些严重错误:' + err);
  1240. })
  1241. },
  1242. //登记工时参与人审核
  1243. processDailyParticipantAudit(id) {
  1244. if (!confirm('审核后不能撤销及修改,确定通过审核吗?')) {
  1245. return
  1246. }
  1247. ;
  1248. let _this = this;
  1249. axios.post("{{url('process/processDailyParticipantAudit')}}" + "/" + id)
  1250. .then(function (response) {
  1251. if (response.data.success) {
  1252. _this.processDailyParticipants.every(function (processDailyParticipant) {
  1253. if (processDailyParticipant.id == response.data.processDailyParticipant.id) {
  1254. processDailyParticipant.status = response.data.processDailyParticipant.status;
  1255. return false;
  1256. }
  1257. return true;
  1258. });
  1259. tempTip.setDuration(3000);
  1260. tempTip.showSuccess('参与人审核通过!');
  1261. return;
  1262. }
  1263. tempTip.setDuration(3000);
  1264. tempTip.show('参与人失败!');
  1265. }).catch(function (err) {
  1266. tempTip.setDuration(5000);
  1267. tempTip.show('审核参与人发生了一些严重错误:' + err);
  1268. });
  1269. },
  1270. //临时工详情
  1271. showUserDetail(id) {
  1272. window.open("{{url('maintenance/userLabor')}}/" + id);
  1273. },
  1274. //显示教程
  1275. showTutorial(id) {
  1276. axios.post('{{url('maintenance/tutorial/showContent')}}' + "/" + id)
  1277. .then(function (response) {
  1278. if (response.data.success) {
  1279. $("#content").html(response.data.data);
  1280. $("#showTutorial").modal('show');
  1281. }
  1282. }).catch(function (err) {
  1283. tempTip.setDuration(3000);
  1284. tempTip.show('获取教程失败!' + '网络错误:' + err);
  1285. });
  1286. },
  1287. //新增教程
  1288. addTutorials(id, owner_id) {
  1289. let _this = this;
  1290. axios.post('{{url('process/getTutorials')}}' + "/" + id)
  1291. .then(function (response) {
  1292. if (response.data.success) {
  1293. _this.processTutorial.id = id;
  1294. _this.processTutorial.owner_id = owner_id;
  1295. _this.processTutorial.tutorials = response.data.data;
  1296. $("#addTutorial").modal("show");
  1297. return;
  1298. }
  1299. tempTip.setDuration(3000);
  1300. tempTip.show('获取教程失败!未知错误:' + response.data);
  1301. }).catch(function (err) {
  1302. tempTip.setDuration(3000);
  1303. tempTip.show('获取教程失败!' + '网络错误:' + err);
  1304. });
  1305. },
  1306. //选择教程
  1307. selectedTutorial(process_id, tutorial_id) {
  1308. let _this = this;
  1309. axios.post('{{url('process/selectedTutorial')}}', {
  1310. process_id: process_id,
  1311. tutorial_id:tutorial_id
  1312. })
  1313. .then(function (response) {
  1314. if (response.data.success) {
  1315. _this.processes.every(function (process) {
  1316. if (process.id == process_id) {
  1317. process.tutorials.push(response.data.data);
  1318. return false;
  1319. }
  1320. return true;
  1321. });
  1322. $("#addTutorial").modal("hide");
  1323. tempTip.setDuration(3000);
  1324. tempTip.showSuccess('添加成功!');
  1325. return;
  1326. }
  1327. tempTip.setDuration(3000);
  1328. tempTip.show('添加教程失败!发生错误:' + response.data.data);
  1329. }).catch(function (err) {
  1330. tempTip.setDuration(3000);
  1331. tempTip.show('添加教程失败!' + '网络错误:' + err);
  1332. });
  1333. },
  1334. //删除教程
  1335. deleteTutorials(process_id, tutorial_id) {
  1336. let _this = this;
  1337. axios.post('{{url('process/deleteTutorial')}}', {process_id: process_id, tutorial_id, tutorial_id})
  1338. .then(function (response) {
  1339. if (response.data.success) {
  1340. _this.processes.every(function (process) {
  1341. if (process.id == process_id) {
  1342. process.tutorials.every(function (tutorial, i) {
  1343. if (tutorial.id == tutorial_id) {
  1344. process.tutorials.splice(i, 1)
  1345. return false;
  1346. }
  1347. return true;
  1348. });
  1349. return false;
  1350. }
  1351. return true;
  1352. });
  1353. tempTip.setDuration(3000);
  1354. tempTip.showSuccess('删除成功!');
  1355. return;
  1356. }
  1357. tempTip.setDuration(3000);
  1358. tempTip.show('删除教程失败!发生错误:' + response.data.data);
  1359. }).catch(function (err) {
  1360. tempTip.setDuration(3000);
  1361. tempTip.show('删除教程失败!' + '网络错误:' + err);
  1362. });
  1363. },
  1364. processEdit(id) {
  1365. location.href = "{{url('process')}}/" + id + "/edit";
  1366. },
  1367. //去往新增教程
  1368. addTutorial() {
  1369. window.open("{{url('maintenance/tutorial/create?owner_id=')}}" + this.processTutorial.owner_id);
  1370. },
  1371. //展开内容单
  1372. unfold(code, id, type) {
  1373. this.$set(this.processUnfold, code + id, type);
  1374. },
  1375. close(code, id) {
  1376. this.$delete(this.processUnfold, code + id);
  1377. },
  1378. rollback(id) {
  1379. if (!confirm('确定要回滚至上一阶段吗?')) return;
  1380. if (!id) return;
  1381. let _this = this;
  1382. axios.post('{{url('process/rollback')}}', {id: id})
  1383. .then(function (response) {
  1384. if (response.data.success) {
  1385. _this.processes.every(function (process) {
  1386. if (process.id === id) {
  1387. process.status = response.data.data;
  1388. return false
  1389. }
  1390. return true;
  1391. });
  1392. tempTip.setDuration(2000);
  1393. tempTip.showSuccess('回滚成功!');
  1394. return;
  1395. }
  1396. tempTip.setDuration(3000);
  1397. tempTip.show('回滚失败!未知错误!');
  1398. }).catch(function (err) {
  1399. tempTip.setDuration(3000);
  1400. tempTip.show('回滚失败!网络错误:' + err);
  1401. })
  1402. },
  1403. //vue绑定的name type:移入移出类型
  1404. changeStyle(name, type) {
  1405. let domList = document.getElementsByName(name);
  1406. let color = '';
  1407. if (type) color = 'rgba(0, 0, 0, 0.15)';
  1408. for (let i = 0; i < domList.length; i++) {
  1409. domList[i].style.backgroundColor = color;
  1410. }
  1411. },
  1412. destroy(code, id) {
  1413. if (!confirm('确定要删除“' + code + "”吗?")) return;
  1414. let _this = this;
  1415. let delArr = [];
  1416. axios.delete('{{url('process')}}/' + id)
  1417. .then(function (response) {
  1418. tempTip.setDuration(3000);
  1419. if (response.data.success) {
  1420. _this.processes.forEach(function (process, i) {
  1421. if (process.code === code)
  1422. delArr.unshift(i);
  1423. });
  1424. delArr.forEach(function (del) {
  1425. _this.$delete(_this.processes, del);
  1426. });
  1427. tempTip.showSuccess('删除“' + code + '”成功!');
  1428. return;
  1429. }
  1430. tempTip.show('删除“' + code + '”失败!该单已不存在')
  1431. }).catch(function (err) {
  1432. tempTip.setDuration(4000);
  1433. tempTip.show("网络错误:" + err);
  1434. })
  1435. },
  1436. //审核
  1437. audit(process) {
  1438. if (!confirm('确定要通过“' + process.code + "”的审核吗?")) return;
  1439. axios.post('{{url('process/audit')}}', {id: process.id})
  1440. .then(function (response) {
  1441. if (response.data.success) {
  1442. process.status = '待接单';
  1443. tempTip.setDuration(2000);
  1444. tempTip.showSuccess('“' + process.code + "”的审核通过!");
  1445. return;
  1446. }
  1447. tempTip.setDuration(3000);
  1448. tempTip.show('审核失败:未知错误,请联系管理员!');
  1449. }).catch(function (err) {
  1450. tempTip.setDuration(3000);
  1451. tempTip.showSuccess('审核失败,网络错误:' + err);
  1452. })
  1453. },
  1454. checkAndAccept(process) {
  1455. if (!confirm('确定要验收“' + process.code + "”吗?")) return;
  1456. axios.post('{{url('process/checkAndAccept')}}', {id: process.id})
  1457. .then(function (response) {
  1458. if (response.data.success) {
  1459. process.status = response.data.data;
  1460. tempTip.setDuration(2000);
  1461. tempTip.showSuccess('“' + process.code + "”验收完成!");
  1462. return;
  1463. }
  1464. tempTip.setDuration(3000);
  1465. tempTip.show('未知错误,请联系管理员!')
  1466. }).catch(function (err) {
  1467. tempTip.setDuration(3000);
  1468. tempTip.show('网络错误:' + err)
  1469. })
  1470. },
  1471. show(id) {
  1472. window.location.href = '{{url('process')}}/' + id;
  1473. },
  1474. //修改价格
  1475. updateUnitPrice(process) {
  1476. if (!confirm('确定要修改“' + process.code + "”的单价吗?")) return;
  1477. let unit_price = $('#unit_price_' + process.id)[0].value;
  1478. if (!unit_price || isNaN(unit_price)) {
  1479. tempTip.setDuration(3000);
  1480. tempTip.show('请输入正确的价格!');
  1481. return;
  1482. }
  1483. axios.post('{{url('process/updateUnitPrice')}}', {id: process.id, unit_price: unit_price})
  1484. .then(function (response) {
  1485. if (response.data.success) {
  1486. process.signs.push(response.data.sign);
  1487. process.is_update_unit_price = false;
  1488. tempTip.setDuration(2000);
  1489. tempTip.showSuccess('“' + process.code + "”价格修改成功,确认通过后生效!");
  1490. return;
  1491. }
  1492. tempTip.setDuration(3000);
  1493. tempTip.show(response.data.data);
  1494. }).catch(function (err) {
  1495. tempTip.setDuration(3000);
  1496. tempTip.show('网络错误:' + err);
  1497. })
  1498. },
  1499. //组长或财务确认
  1500. verify(process, type) {
  1501. if (!confirm('确定要通过“'+process.code+"”的审核吗"))return;
  1502. let url = '{{url('process/workGroupVerify')}}';
  1503. let msg = '二次加工组';
  1504. if (type === 'accountant') {
  1505. url = '{{url('process/accountantVerify')}}';
  1506. msg = '财务';
  1507. }
  1508. let _this=this;
  1509. axios.post(url, {id: process.id})
  1510. .then(function (response) {
  1511. if (response.data.success) {
  1512. if (response.data.data){
  1513. process.signs.push(response.data.data);
  1514. _this.$set(_this.signs[process.code],response.data.data.mark,true);
  1515. }else{
  1516. _this.signs[process.code]=[];
  1517. process.signs=[];
  1518. }
  1519. tempTip.setDuration(2000);
  1520. tempTip.showSuccess('“' + process.code + "”新价格通过" + msg + "审核!");
  1521. return;
  1522. }
  1523. tempTip.setDuration(3000);
  1524. tempTip.show(response.data.data);
  1525. }).catch(function (err) {
  1526. tempTip.setDuration(3000);
  1527. tempTip.show('网络错误:' + err);
  1528. })
  1529. },
  1530. is_checked(e){
  1531. if (e.target.checked) this.filterData.is_accomplish=e.target.checked;
  1532. else this.filterData.is_accomplish='';
  1533. setTimeout( res=>{
  1534. this.submit();
  1535. },1);
  1536. },
  1537. update_process_date(processDailyParticipant){
  1538. let date=this.date;
  1539. let is_update_date=this.is_update_date;
  1540. let _this=this;
  1541. if (is_update_date==='start_date') _this.dateTextMap.start_date='起';
  1542. else _this.dateTextMap.end_date='终';
  1543. if (!date){
  1544. tempTip.show('未输入日期!');
  1545. return;
  1546. }
  1547. let url='';
  1548. if (is_update_date==='start_date'){
  1549. if (!confirm('确定要设定“'+date+'”为新的起始日期吗?以往记录将被删除!'))return;
  1550. url='{{url('process/updateStartDate')}}';
  1551. }
  1552. else{
  1553. if (!confirm('确定要设定“'+date+'”为新的终止日期吗?'))return;
  1554. url='{{url('process/updateEndDate')}}';
  1555. }
  1556. axios.post(url,{process_id:processDailyParticipant.process_id,date:date})
  1557. .then(function (response) {
  1558. if(response.data.success){
  1559. _this.resetProcessDaily(response.data.data,processDailyParticipant.process_id);
  1560. _this.is_update_date='';
  1561. tempTip.setDuration(2000);
  1562. tempTip.showSuccess('成功修改“'+date+'”为新的'+(is_update_date==='start_date' ? '起始时间' :'终止时间')+'!');
  1563. return;
  1564. }
  1565. tempTip.setDuration(3000);
  1566. tempTip.show(response.data.data);
  1567. }).catch(function (err) {
  1568. tempTip.setDuration(3000);
  1569. tempTip.show('网络错误:'+err);
  1570. })
  1571. },
  1572. },
  1573. });
  1574. </script>
  1575. @endsection