index.blade.php 106 KB

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