index.blade.php 109 KB

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