index.blade.php 114 KB

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