index.blade.php 114 KB

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