index.blade.php 115 KB

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