index.blade.php 107 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520
  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: 200px">本单数量</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: 190px" class="text-muted" :class="processesContent.type=='原料单'?'td-warm':'td-cool'">@{{ processesContent.wms_code }}</td>
  378. <td style="width: 200px" 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>日期</td><td>当日产量</td>
  427. <td>当日剩余</td>
  428. <td colspan="2">操作</td>
  429. <td>参与者</td>
  430. <td>开始时间</td>
  431. <td>结束时间</td>
  432. <td>计时工资</td>
  433. <td>计件工资</td>
  434. <td>晚饭时间</td>
  435. <td>计时工时</td>
  436. <td>计件数量</td>
  437. <td>备注</td>
  438. <td>打卡工时</td>
  439. <td>工时差</td>
  440. <td>计费工时</td>
  441. <td>审核</td>
  442. <td>详情</td>
  443. </tr>
  444. <tr v-for="processDailyParticipant in processDailyParticipants" :id="'processDailyParticipant'+processDailyParticipant.id">
  445. <td v-if="processDailyParticipant.rowspan" :rowspan="processDailyParticipant.rowspan"><p >@{{ processDailyParticipant.date }}</p></td>
  446. <td v-if="processDailyParticipant.rowspan" :rowspan="processDailyParticipant.rowspan">
  447. <div class="form-inline">
  448. <input :readonly="processDailyParticipant.readonly" v-model="processDailyParticipant.submitOutput"
  449. class="form-control col-sm-5 " @click="processDailyParticipant.id?processDailyParticipant.readonly=false:processDailyParticipant.readonly=true" type="text" />
  450. @can("二次加工管理-登记工时")<button class="btn btn-sm btn-success" v-if="! processDailyParticipant.readonly" @click="submitOutputData(processDailyParticipant.daily_id,processDailyParticipant.submitOutput,processDailyParticipant.id)">确定</button>
  451. <button class="btn btn-sm btn-danger" v-if="! processDailyParticipant.readonly" @click="processDailyParticipant.readonly=true;processDailyParticipant.submitOutput=processDailyParticipant.output">取消</button>
  452. @endcan
  453. </div>
  454. </td>
  455. <td v-if="processDailyParticipant.rowspan" :rowspan="processDailyParticipant.rowspan"><p >@{{ processDailyParticipant.remain }}</p></td>
  456. <td v-if="processDailyParticipant.rowspan" :rowspan="processDailyParticipant.rowspan">
  457. @can("二次加工管理-登记工时")<button v-if="processDailyParticipant.isAddProcessDailyParticipant && isShow.isAddProcessDailyParticipant" class="btn btn-sm btn-outline-info" @click="addProcessDailyParticipant(processDailyParticipant);processDailyParticipant.isAddProcessDailyParticipant=false;">新增</button>
  458. <button v-if="!processDailyParticipant.isAddProcessDailyParticipant" class="btn btn-sm btn-danger"
  459. @click="deleteProcessDailyParticipant($event,processDailyParticipant.daily_id,processDailyParticipant.user_detail_full_name,processDailyParticipant.isConfirmBtn);processDailyParticipant.isAddProcessDailyParticipant=true;">取消</button>
  460. @endcan
  461. </td>
  462. <td>
  463. @can("二次加工管理-登记工时")<button v-if="!processDailyParticipant.isAddProcessDailyParticipant && processDailyParticipant.isConfirmBtn" class="btn btn-sm btn-success" @click="submitProcessDailyParticipant(processDailyParticipant.daily_id)">确定</button>
  464. <button v-if="processDailyParticipant.id && processDailyParticipant.status=='未审核'" class="btn btn-sm btn-outline-info" @click="updateProcessDailyParticipant(processDailyParticipant)">改</button>
  465. @endcan
  466. </td>
  467. <td>
  468. <span v-if="!processDailyParticipant.user_detail_full_name && processDailyParticipant.isAddProcessDailyParticipant==false" >
  469. <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)">
  470. <input hidden :id="processDailyParticipant.daily_id+'user_id'"/>
  471. </span><span v-else>@{{ processDailyParticipant.user_detail_full_name }}</span></td>
  472. <td>
  473. <span v-if="!processDailyParticipant.user_detail_full_name && processDailyParticipant.isAddProcessDailyParticipant==false" >
  474. <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)">
  475. </span><span v-else> @{{ processDailyParticipant.started_at }}</span></td>
  476. <td>
  477. <span v-if="!processDailyParticipant.user_detail_full_name && processDailyParticipant.isAddProcessDailyParticipant==false" >
  478. <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)">
  479. </span><span v-else> @{{ processDailyParticipant.ended_at }}</span></td>
  480. <td><span v-if="!processDailyParticipant.user_detail_full_name && processDailyParticipant.isAddProcessDailyParticipant==false">
  481. <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">
  482. </span><span v-else>@{{ processDailyParticipant.hour_price }}</span></td>
  483. <td>
  484. <span v-if="!processDailyParticipant.user_detail_full_name && processDailyParticipant.isAddProcessDailyParticipant==false">
  485. <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">
  486. </span><span v-else>@{{ processDailyParticipant.unit_price }}</span></td>
  487. <td>
  488. <span v-if="!processDailyParticipant.user_detail_full_name && processDailyParticipant.isAddProcessDailyParticipant==false">
  489. <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">
  490. <option value="0">无</option>
  491. <option value="30">30分钟</option>
  492. <option value="60">60分钟</option>
  493. </select>
  494. </span><span v-else>@{{ processDailyParticipant.dinner_duration }}</span></td>
  495. <td>
  496. <span v-if="!processDailyParticipant.user_detail_full_name && processDailyParticipant.isAddProcessDailyParticipant==false">
  497. <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" >
  498. </span><span v-else>@{{ processDailyParticipant.hour_count }}</span></td>
  499. <td>
  500. <span v-if="!processDailyParticipant.user_detail_full_name && processDailyParticipant.isAddProcessDailyParticipant==false">
  501. <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">
  502. </span><span v-else>@{{ processDailyParticipant.unit_count }}</span></td>
  503. <td>
  504. <span v-if="!processDailyParticipant.user_detail_full_name && processDailyParticipant.isAddProcessDailyParticipant==false">
  505. <input :id="processDailyParticipant.daily_id+'remark'" class="form-control" style="width: 100px" type="text">
  506. </span><span v-else>@{{ processDailyParticipant.remark }}</span></td>
  507. <td class="text-danger">@{{ processDailyParticipant.hour }}</td>
  508. <td class="text-danger">@{{ processDailyParticipant.diff }}</td>
  509. <td class="text-danger">@{{ processDailyParticipant.billingHour }}</td>
  510. <td class="text-danger">
  511. @can("人事管理-任务审核")<button @click="processDailyParticipantAudit(processDailyParticipant.id)" v-if="processDailyParticipant.status=='未审核'" class="btn btn-sm btn-outline-success">审核</button>@endcan
  512. <b v-else class="text-success">@{{ processDailyParticipant.status }}</b>
  513. </td>
  514. @can("二次加工管理-临时工资料管理")<td class="text-info"><u v-if="processDailyParticipant.user_detail_full_name" style="cursor:pointer" @click="showUserDetail(processDailyParticipant.user_id)">详情</u></td>@endcan
  515. </tr>
  516. </table>
  517. </td>
  518. </tr>
  519. </template>
  520. </table>
  521. {{$processes->appends($request)->links()}}
  522. </div>
  523. </div>
  524. </div>
  525. @endsection
  526. @section('lastScript')
  527. <script>
  528. new Vue({
  529. el:"#process",
  530. data:{
  531. participantInputting:{},
  532. processes:[
  533. @foreach($processes as $processOne)
  534. {id:'{{$processOne->id}}',code:'{{$processOne->code}}',owner_name:'{{$processOne->owner_name}}',owner_id:'{{$processOne->owner_id}}',operatorLogs:{!! $processOne->operatorLogs !!},
  535. process_method_name:'{{$processOne->process_method_name}}',amount:'{{$processOne->amount}}',type:'{{$processOne->type}}',signs:{!!$processOne->signs !!}
  536. ,tutorials:{!! $processOne->tutorials !!},processesContents:{!! $processOne->processesContents !!},unit_price:'{{$processOne->unit_price}}',created_at:'{{$processOne->created_at}}',
  537. 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,
  538. buttonTexts:{'审核':'审','回滚':'回','编辑':'编','接单':'接','驳回':'驳','质量验收':'验','完成':'完','交接完成':'交','查看单据':'查','登记工时':'登'},
  539. },
  540. @endforeach
  541. ],
  542. processesList:[],
  543. owners:[
  544. @foreach($owners as $owner)
  545. {!! $owner !!},
  546. @endforeach
  547. ],
  548. errors:{},
  549. checkData:[],
  550. filterData:{paginate:50,date_start:'',date_end:'',owner_id:'',commodity_barcode:'',wms_code:'',status:'',is_accomplish:''},
  551. processDailies:[],
  552. processDailyParticipants:[],
  553. isShow:{
  554. isOpenProcessHour:false,isAddProcessDailyParticipant:true,isUpdateConfirmBtn:true,
  555. },
  556. userLabors:[],
  557. modalDaily_id:'',
  558. processDailyParticipantOne:{id:'',user_id:'',user_detail_full_name:'',started_at:"",ended_at:"",
  559. hour_price:'',unit_price:'',dinner_duration:'',hour_count:'',unit_count:'',remark:''},
  560. processTutorial:{id:'',owner_id:'',tutorials:[],},
  561. processUnfold:[],
  562. processFullSum:[],
  563. signs:[],
  564. },
  565. watch:{
  566. checkData:{
  567. handler(){
  568. if (this.checkData.length === this.processes.length){
  569. document.querySelector('#all').checked = true;
  570. }else {
  571. document.querySelector('#all').checked = false;
  572. }
  573. },
  574. deep:true
  575. }
  576. },
  577. computed:{
  578. isBeingFilterConditions:function(){
  579. for(let key in this.filterData){
  580. if(this.filterData[key]){
  581. if(key==='paginate' || key==='is_accomplish')continue;
  582. return true
  583. }
  584. }
  585. return false;
  586. },
  587. },
  588. mounted:function () {
  589. this.initInputs();
  590. this.resetProcessData();
  591. $(".tooltipTarget").tooltip({'trigger':'hover'});
  592. $('#process').removeClass('d-none');
  593. },
  594. methods: {
  595. arrayFilter: function (processesContents, process) {
  596. if (!process.is_multi_row && process.id) return processesContents;
  597. let array = [];
  598. let type = '成品单';
  599. if (process.id) type = '原料单';
  600. processesContents.forEach(function (processesContent) {
  601. if (processesContent.type === type) array.push(processesContent);
  602. });
  603. return array;
  604. },
  605. //重组数据
  606. resetProcessData: function () {
  607. let _this = this;
  608. let indexs = [];
  609. for (let i = 0; i < this.processes.length; i++) {
  610. let process = this.processes[i];
  611. _this.$set(_this.signs,process.code,[]);
  612. process.signs.forEach(function (sign) {
  613. _this.$set(_this.signs[process.code],sign.mark,true);
  614. });
  615. process.serial_number = i + 1;
  616. process.processesContents.every(function (processesContent) {
  617. if (processesContent.type === '成品单') _this.$set(_this.processFullSum, process.code, _this.processFullSum[process.code] ? _this.processFullSum[process.code] + 1 : 1);
  618. return true;
  619. });
  620. if (_this.processFullSum[process.code] && _this.processFullSum[process.code] !== 0 && _this.processFullSum[process.code] !== process.processesContents.length) {
  621. indexs.unshift(i);
  622. process.is_multi_row = true;
  623. }
  624. }
  625. indexs.forEach(function (index) {
  626. let processTemp = Object.assign({}, _this.processes[index]);
  627. processTemp.id = '';
  628. processTemp.is_multi_row = false;
  629. _this.processes.splice(index + 1, 0, processTemp);
  630. });
  631. },
  632. //回显条件参数
  633. initInputs: function () {
  634. let data = this;
  635. let uriParts = decodeURI(location.href).split("?");
  636. if (uriParts.length > 1) {
  637. let params = uriParts[1].split('&');
  638. params.forEach(function (paramPair) {
  639. let pair = paramPair.split('=');
  640. let key = pair[0], val = pair[1];
  641. if (val !== "+") {
  642. $('input[name="' + key + '"]').val(val);
  643. $('select[name="' + key + '"]').val(val);
  644. decodeURI(data.filterData[key] = val);
  645. }
  646. });
  647. }
  648. },
  649. //提交表单
  650. submit: function () {
  651. let form = $("#optionSubmit");
  652. form.submit();
  653. },
  654. //全选事件
  655. checkAll(e) {
  656. if (e.target.checked) {
  657. this.processes.forEach((el, i) => {
  658. if (this.checkData.indexOf(el.id) == '-1') {
  659. this.checkData.push(el.id);
  660. }
  661. });
  662. } else {
  663. this.checkData = [];
  664. }
  665. },
  666. //导出excel,因同步问题不使用formData
  667. processExport(e) {
  668. let val = e;
  669. let data = this.filterData;
  670. if (val == 1) {
  671. if (this.checkData && this.checkData.length <= 0) {
  672. tempTip.setDuration(4000);
  673. tempTip.showSuccess('没有勾选任何记录');
  674. } else {
  675. location.href = "{{url('process?checkSign=')}}" + this.checkData;
  676. }
  677. } else {
  678. location.href = "{{url('process?checkSign=-1&date_start=')}}" +
  679. data.date_start + "&date_end=" + data.date_end + "&owner_id=" +
  680. data.owner_id + "&commodity_barcode=" + data.commodity_barcode + "&wms_code=" + data.wms_code +
  681. "&status=" + data.status+"$is_accomplish="+data.is_accomplish;
  682. }
  683. },
  684. //获取登记工时
  685. openProcessHour(process) {
  686. let e = process.id;
  687. let _this = this;
  688. if (_this.isShow.isOpenProcessHour) {
  689. _this.processes.every(function (process) {
  690. if (process.openProcessHour) {
  691. process.openProcessHour = false;
  692. _this.processDailies = [];
  693. _this.processDailyParticipants = [];
  694. return false;
  695. }
  696. return true;
  697. });
  698. } else {
  699. _this.isShow.isOpenProcessHour = true;
  700. }
  701. axios.post("{{url("process/getDailyParticipant")}}", {id: e, amount: process.amount})
  702. .then(function (response) {
  703. let processDailies = response.data;
  704. for (let i = 0; i < processDailies.length; i++) {
  705. let processDailyParticipants = processDailies[i].process_daily_participants;
  706. if (processDailyParticipants.length <= 0) {
  707. let data = {};
  708. data['daily_id'] = processDailies[i].id;
  709. data['date'] = processDailies[i].date;
  710. data['output'] = processDailies[i].output;
  711. data['remain'] = processDailies[i].remain;
  712. data['rowspan'] = 1;
  713. data['readonly'] = "true";
  714. data['isAddProcessDailyParticipant'] = "true";
  715. data['isConfirmBtn'] = "true";
  716. data['submitOutput'] = processDailies[i].output;
  717. _this.processDailyParticipants.push(data);
  718. continue;
  719. }
  720. for (let j = 0; j < processDailyParticipants.length; j++) {
  721. let data = {};
  722. data['id'] = processDailyParticipants[j].id;
  723. data['status'] = processDailyParticipants[j].status;
  724. data['started_at'] = processDailyParticipants[j].started_at;
  725. data['user_detail_full_name'] = processDailyParticipants[j].user_detail_full_name;
  726. data['user_id'] = processDailyParticipants[j].user_id;
  727. data['ended_at'] = processDailyParticipants[j].ended_at;
  728. data['hour_price'] = processDailyParticipants[j].hour_price;
  729. data['unit_price'] = processDailyParticipants[j].unit_price;
  730. data['dinner_duration'] = processDailyParticipants[j].dinner_duration;
  731. data['hour_count'] = processDailyParticipants[j].hour_count;
  732. data['remark'] = processDailyParticipants[j].remark;
  733. data['hour'] = processDailyParticipants[j].hour;
  734. data['diff'] = processDailyParticipants[j].diff;
  735. data['billingHour'] = processDailyParticipants[j].billingHour;
  736. data['unit_count'] = processDailyParticipants[j].unit_count;
  737. data['process_id'] = processDailies[i].process_id;
  738. data['readonly'] = "true";
  739. if (!_this.processDailies[processDailies[i].id]) {
  740. data['rowspan'] = processDailyParticipants.length;
  741. data['daily_id'] = processDailies[i].id;
  742. data['date'] = processDailies[i].date;
  743. data['output'] = processDailies[i].output;
  744. data['remain'] = processDailies[i].remain;
  745. data['submitOutput'] = processDailies[i].output;
  746. data['isAddProcessDailyParticipant'] = "true";
  747. data['isConfirmBtn'] = "true";
  748. _this.processDailies[processDailies[i].id] = processDailies[i].id;
  749. }
  750. _this.processDailyParticipants.push(data);
  751. }
  752. }
  753. }).catch(function (err) {
  754. tempTip.setDuration(5000);
  755. tempTip.show('获取登记工时数据发生了一些严重错误:' + err);
  756. });
  757. let processDailyParticipantsHtml = $("#addProcessDailyParticipants");
  758. if (process.is_multi_row) $("#" + e + "-2").after(processDailyParticipantsHtml);
  759. else $("#" + e).after(processDailyParticipantsHtml)
  760. },
  761. //删除工时显示
  762. closeProcessHour(e) {
  763. this.processDailies = [];
  764. this.processDailyParticipants = [];
  765. },
  766. //新增参与人
  767. addProcessDailyParticipant(processDailyParticipantOne) {
  768. let id = processDailyParticipantOne.id;
  769. if (!id) return;
  770. let _this = this;
  771. _this.errors = {};
  772. this.processDailyParticipants.every(function (processDailyParticipant, i) {
  773. if (processDailyParticipant.id == id) {
  774. processDailyParticipant.rowspan++;
  775. let data = {};
  776. data['readonly'] = "true";
  777. data['isAddProcessDailyParticipant'] = "true";
  778. data['isConfirmBtn'] = "true";
  779. data['id'] = processDailyParticipant.id;
  780. data['user_id'] = processDailyParticipant.user_id;
  781. data['status'] = processDailyParticipant.status;
  782. data['started_at'] = processDailyParticipant.started_at;
  783. data['user_detail_full_name'] = processDailyParticipant.user_detail_full_name;
  784. data['ended_at'] = processDailyParticipant.ended_at;
  785. data['hour_price'] = processDailyParticipant.hour_price;
  786. data['unit_price'] = processDailyParticipant.unit_price;
  787. data['dinner_duration'] = processDailyParticipant.dinner_duration;
  788. data['hour_count'] = processDailyParticipant.hour_count;
  789. data['remark'] = processDailyParticipant.remark;
  790. data['hour'] = processDailyParticipant.hour;
  791. data['diff'] = processDailyParticipant.diff;
  792. data['billingHour'] = processDailyParticipant.billingHour;
  793. data['unit_count'] = processDailyParticipant.unit_count;
  794. data['process_id'] = processDailyParticipant.process_id;
  795. _this.processDailyParticipants.splice(i + 1, 0, data);
  796. processDailyParticipant.id = '';
  797. processDailyParticipant.status = '';
  798. processDailyParticipant.started_at = '';
  799. processDailyParticipant.user_detail_full_name = '';
  800. processDailyParticipant.ended_at = '';
  801. processDailyParticipant.hour_price = '';
  802. processDailyParticipant.unit_price = '';
  803. processDailyParticipant.dinner_duration = '';
  804. processDailyParticipant.hour_count = '';
  805. processDailyParticipant.remark = '';
  806. processDailyParticipant.hour = '';
  807. processDailyParticipant.diff = '';
  808. processDailyParticipant.billingHour = '';
  809. processDailyParticipant.unit_count = '';
  810. processDailyParticipant.process_id = '';
  811. return false;
  812. }
  813. return true;
  814. });
  815. _this.isShow.isAddProcessDailyParticipant = false;
  816. },
  817. //取消录入参与人
  818. deleteProcessDailyParticipant($event, daily_id, processDailyParticipant_name, isConfirmBtn) {
  819. console.log($event, daily_id, processDailyParticipant_name, isConfirmBtn);
  820. if (!isConfirmBtn) {
  821. this.processDailyParticipants.every(function (processDailyParticipant) {
  822. if (processDailyParticipant.daily_id == daily_id) {
  823. processDailyParticipant.isConfirmBtn = true; //放出隐藏确定按钮
  824. return false;
  825. }
  826. return true;
  827. });
  828. }
  829. let _this = this;
  830. this.processDailyParticipants.every(function (processDailyParticipant, i) {
  831. if (processDailyParticipant.daily_id == daily_id) {
  832. if (!processDailyParticipant_name && _this.processDailyParticipants[i + 1] && _this.processDailyParticipants[i + 1].daily_id) return false;
  833. if (!_this.processDailyParticipants[i + 1]) return false;
  834. _this.processDailyParticipants[i + 1].rowspan = (processDailyParticipant.rowspan) - 1;
  835. _this.processDailyParticipants[i + 1].daily_id = processDailyParticipant.daily_id;
  836. _this.processDailyParticipants[i + 1].date = processDailyParticipant.date;
  837. _this.processDailyParticipants[i + 1].output = processDailyParticipant.output;
  838. _this.processDailyParticipants[i + 1].remain = processDailyParticipant.remain;
  839. _this.processDailyParticipants[i + 1].submitOutput = processDailyParticipant.submitOutput;
  840. _this.processDailyParticipants.splice(i, 1);
  841. return false;
  842. }
  843. return true;
  844. });
  845. _this.isShow.isAddProcessDailyParticipant = true;
  846. },
  847. //驳回
  848. processReject(id) {
  849. if (!confirm('确定驳回该单吗?')) {
  850. return
  851. }
  852. ;
  853. let url = "{{url('process/reject')}}" + "/" + id;
  854. let _this = this;
  855. axios.post(url)
  856. .then(function (response) {
  857. _this.processes.every(function (process) {
  858. if (process.id == response.data.id) {
  859. process.status = response.data.status;
  860. return false;
  861. }
  862. return true;
  863. });
  864. tempTip.setDuration(3000);
  865. tempTip.showSuccess('驳回成功!');
  866. }).catch(function (err) {
  867. tempTip.setDuration(5000);
  868. tempTip.show('驳回二次加工单发生了一些严重错误:' + err);
  869. })
  870. },
  871. //接单
  872. processReceive(id) {
  873. let url = "{{url('process/receive')}}" + "/" + id;
  874. let _this = this;
  875. axios.post(url)
  876. .then(function (response) {
  877. _this.processes.every(function (process) {
  878. if (process.id == response.data.id) {
  879. process.status = response.data.status;
  880. return false;
  881. }
  882. return true;
  883. });
  884. tempTip.setDuration(3000);
  885. tempTip.showSuccess('接单成功!');
  886. }).catch(function (err) {
  887. tempTip.setDuration(5000);
  888. tempTip.show('接单时发生了一些严重错误:' + err);
  889. })
  890. },
  891. //完成
  892. processAccomplish(process) {
  893. if (!confirm('确定标记为加工完成吗?')) {
  894. return
  895. }
  896. ;
  897. axios.post('{{url('process/processAccomplish')}}', {id: process.id})
  898. .then(function (response) {
  899. if (response.data.success) {
  900. process.status = response.data.data;
  901. tempTip.setDuration(2000);
  902. tempTip.showSuccess('“' + process.code + '”已被标记为加工完成!');
  903. return;
  904. }
  905. tempTip.setDuration(3000);
  906. tempTip.show('未知错误,联系管理员解决!');
  907. }).catch(function (err) {
  908. tempTip.setDuration(3000);
  909. tempTip.show('网络错误:' + err);
  910. })
  911. },
  912. accomplish(process) {
  913. if (!confirm('确定“' + process.code + '”交接完成吗?')) {
  914. return
  915. }
  916. ;
  917. let url = "{{url('process/accomplish')}}";
  918. axios.post(url, {id: process.id})
  919. .then(function (response) {
  920. if (response.data.success) {
  921. process.status = response.data.data;
  922. tempTip.setDuration(2000);
  923. tempTip.showSuccess('交接完成!');
  924. return;
  925. }
  926. tempTip.setDuration(3000);
  927. tempTip.show(response.data.data);
  928. }).catch(function (err) {
  929. tempTip.setDuration(3000);
  930. tempTip.show('网络错误:' + err);
  931. })
  932. },
  933. //定位客户
  934. owner_seek: function (e) {
  935. let _this = this;
  936. let $val = e.target.value;
  937. if ($val === '') _this.filterData.owner_id = '';
  938. else
  939. _this.owners.forEach(function (owner) {
  940. if (owner.name.includes($val)) {
  941. _this.filterData.owner_id = owner.id;
  942. }
  943. });
  944. },
  945. //修改每日产量
  946. submitOutputData(daily_id, data, id) {
  947. let url = "{{url('process/updateDailyOutput')}}";
  948. let _this = this;
  949. axios.post(url, {id: daily_id, output: data})
  950. .then(function (response) {
  951. if (response.data.status == "error") {
  952. tempTip.setDuration(3000);
  953. tempTip.show('输入有误:' + response.data.data.output);
  954. }
  955. if (response.data.status == "success") {
  956. let processDailies = response.data.data;
  957. _this.processDailyParticipants.every(function (processDailyParticipant) {
  958. if (processDailyParticipant.id == id) {
  959. processDailyParticipant.readonly = true;
  960. }
  961. processDailies.every(function (processDaily) {
  962. if (processDailyParticipant.date == processDaily.date) {
  963. processDailyParticipant.output = processDaily.output;
  964. processDailyParticipant.remain = processDaily.remain;
  965. return false;
  966. }
  967. return true;
  968. });
  969. return true;
  970. });
  971. if (response.data.process) {
  972. _this.processes.every(function (process) {
  973. if (process.id == response.data.process) {
  974. process.status = "待验收";
  975. return false;
  976. }
  977. return true;
  978. });
  979. }
  980. tempTip.setDuration(3000);
  981. tempTip.showSuccess('每日产量修改成功!');
  982. }
  983. }).catch(function (err) {
  984. tempTip.setDuration(5000);
  985. tempTip.show('修改每日产量发生了一些严重错误:' + err);
  986. });
  987. },
  988. //验证临时工
  989. verifyUserName(e, daily_id, isConfirmBtn) {
  990. let user = e.target.value;
  991. let _this = this;
  992. axios.post('{{url('process/verifyUserName')}}', {userName: user})
  993. .then(function (response) {
  994. //修改时验证
  995. if (!daily_id) {
  996. //验证失败
  997. if (response.data.length < 1) {
  998. _this.isShow.isUpdateConfirmBtn = false;
  999. _this.errors['user_id'] = "查无此人,请检查您的输入";
  1000. return;
  1001. }
  1002. //验证成功且结果仅有一个
  1003. if (response.data.user_id) {
  1004. _this.isShow.isUpdateConfirmBtn = true;
  1005. _this.errors['user_id'] = "";
  1006. _this.processDailyParticipantOne.user_id = response.data.user_id;
  1007. return;
  1008. }
  1009. //验证成功多结果
  1010. if (response.data.length > 1) {
  1011. _this.userLabors = response.data;
  1012. $("#myModal").modal('show');
  1013. return;
  1014. }
  1015. }
  1016. //验证失败
  1017. if (response.data.length < 1) {
  1018. _this.processDailyParticipants.every(function (processDailyParticipant) {
  1019. if (processDailyParticipant.daily_id == daily_id) {
  1020. _this.errors['user_id'] = "查无此人,请检查您的输入";
  1021. setTimeout(function () {
  1022. $(".tooltipTargetError").tooltip('show');
  1023. }, 1);
  1024. processDailyParticipant.isConfirmBtn = false; //验证失败隐藏确定按钮
  1025. return false;
  1026. }
  1027. return true;
  1028. });
  1029. return;
  1030. }
  1031. //按钮被隐藏则放出
  1032. if (!isConfirmBtn) {
  1033. _this.processDailyParticipants.every(function (processDailyParticipant) {
  1034. if (processDailyParticipant.daily_id == daily_id) {
  1035. processDailyParticipant.isConfirmBtn = true; //验证失败隐藏确定按钮
  1036. return false;
  1037. }
  1038. return true;
  1039. });
  1040. }
  1041. _this.modalDaily_id = daily_id;
  1042. //验证成功且结果仅有一个
  1043. if (response.data.user_id) {
  1044. _this.errors['user_id'] = "";
  1045. $("#" + daily_id + "user_id").val(response.data.user_id);
  1046. $("#" + daily_id + "hour_price").val(response.data.user_labor.default_hour_price);
  1047. }
  1048. //验证成功多结果
  1049. if (response.data.length > 1) {
  1050. _this.userLabors = response.data;
  1051. $("#myModal").modal('show');
  1052. }
  1053. }).catch(function (err) {
  1054. tempTip.setDuration(5000);
  1055. tempTip.show('验证临时工发生了一些严重错误:' + err);
  1056. })
  1057. },
  1058. //验证时间合法性
  1059. hourFilter(processDailyParticipant, is_create) {
  1060. let start = new Date('2020/1/1 12:00:00').getTime();
  1061. let end = new Date('2020/1/1 13:00:00').getTime();
  1062. if (is_create) {
  1063. let started_at = new Date('2020/1/1 ' + $('#' + processDailyParticipant + 'started_at')[0].value).getTime();
  1064. let ended_at = new Date('2020/1/1 ' + $('#' + processDailyParticipant + 'ended_at')[0].value).getTime();
  1065. let hour_count = (ended_at - started_at) / 3600000;
  1066. if (started_at < start && ended_at > end) hour_count -= 1;
  1067. $('#' + processDailyParticipant + 'hour_count')[0].value = hour_count;
  1068. return;
  1069. }
  1070. let started_at = new Date('2020/1/1 ' + processDailyParticipant.started_at).getTime();
  1071. let ended_at = new Date('2020/1/1 ' + processDailyParticipant.ended_at).getTime();
  1072. let hour_count = (ended_at - started_at) / 3600000;
  1073. if (started_at < start && ended_at > end) hour_count -= 1;
  1074. processDailyParticipant.hour_count = hour_count;
  1075. },
  1076. //提交参与人
  1077. submitProcessDailyParticipant(e) {
  1078. let request = {};
  1079. request['user_id'] = $("#" + e + "user_id").val();
  1080. request['started_at'] = $("#" + e + "started_at").val();
  1081. request['ended_at'] = $("#" + e + "ended_at").val();
  1082. let hour_price = $("#" + e + "hour_price").val();
  1083. if (hour_price) request['hour_price'] = hour_price;
  1084. let unit_price = $("#" + e + "unit_price").val();
  1085. if (unit_price) request['unit_price'] = unit_price;
  1086. let dinner_duration = $("#" + e + "dinner_duration").val();
  1087. if (dinner_duration) request['dinner_duration'] = dinner_duration;
  1088. let hour_count = $("#" + e + "hour_count").val();
  1089. if (hour_count) request['hour_count'] = hour_count;
  1090. let unit_count = $("#" + e + "unit_count").val();
  1091. if (unit_count) request['unit_count'] = unit_count;
  1092. let remark = $("#" + e + "remark").val();
  1093. if (remark) request['remark'] = remark;
  1094. request['daily_id'] = this.modalDaily_id;
  1095. let _this = this;
  1096. axios.post("{{url('process/shortProcessDailyParticipant')}}", request)
  1097. .then(function (response) {
  1098. if (response.data.status == "error") {
  1099. tempTip.setDuration(3000);
  1100. _this.errors = response.data.data;
  1101. setTimeout(function () {
  1102. $(".tooltipTargetError").tooltip('show');
  1103. }, 1);
  1104. setTimeout(function () {
  1105. $(".tooltipTargetError").tooltip('hide');
  1106. }, 3000);
  1107. return;
  1108. }
  1109. if (response.data.status == "success") {
  1110. _this.processDailyParticipants.every(function (processDailyParticipant) {
  1111. if (processDailyParticipant.daily_id == e) {
  1112. processDailyParticipant.id = response.data.data.id;
  1113. processDailyParticipant.status = response.data.data.status;
  1114. processDailyParticipant.user_detail_full_name = response.data.data.user_detail_full_name;
  1115. processDailyParticipant.user_id = response.data.data.user_id;
  1116. processDailyParticipant.started_at = response.data.data.started_at;
  1117. processDailyParticipant.ended_at = response.data.data.ended_at;
  1118. processDailyParticipant.hour_price = response.data.data.hour_price;
  1119. processDailyParticipant.unit_price = response.data.data.unit_price;
  1120. processDailyParticipant.dinner_duration = response.data.data.dinner_duration;
  1121. processDailyParticipant.hour_count = response.data.data.hour_count;
  1122. processDailyParticipant.unit_count = response.data.data.unit_count;
  1123. processDailyParticipant.remark = response.data.data.remark;
  1124. processDailyParticipant.hour = response.data.data.hour;
  1125. processDailyParticipant.diff = response.data.data.diff;
  1126. processDailyParticipant.billingHour = response.data.data.billingHour;
  1127. processDailyParticipant.isAddProcessDailyParticipant = true;
  1128. _this.isShow.isAddProcessDailyParticipant = true;
  1129. return false;
  1130. }
  1131. return true;
  1132. });
  1133. if (response.data.process) {
  1134. _this.processes.every(function (process) {
  1135. if (process.id == response.data.process) {
  1136. process.status = "加工中";
  1137. return false;
  1138. }
  1139. return true;
  1140. });
  1141. }
  1142. tempTip.setDuration(3000);
  1143. tempTip.showSuccess('参与人新增成功!');
  1144. }
  1145. }).catch(function (err) {
  1146. tempTip.setDuration(5000);
  1147. tempTip.show('新增参与人发生了一些严重错误:' + err);
  1148. })
  1149. },
  1150. //同名临时工选择
  1151. selectedUser(user_id, hour_price) {
  1152. $("#myModal").modal('hide');
  1153. this.errors['user_id'] = "";
  1154. this.processDailyParticipantOne['user_id'] = user_id;
  1155. this.processDailyParticipantOne['hour_price'] = hour_price;
  1156. this.isShow.isUpdateConfirmBtn = true;
  1157. $("#" + this.modalDaily_id + "user_id").val(user_id);
  1158. $("#" + this.modalDaily_id + "hour_price").val(hour_price);
  1159. },
  1160. //修改参与人
  1161. updateProcessDailyParticipant(processDailyParticipant) {
  1162. this.errors = {};
  1163. this.processDailyParticipantOne['id'] = processDailyParticipant.id;
  1164. this.processDailyParticipantOne['user_detail_full_name'] = processDailyParticipant.user_detail_full_name;
  1165. this.processDailyParticipantOne['user_id'] = processDailyParticipant.user_id;
  1166. this.processDailyParticipantOne['started_at'] = processDailyParticipant.started_at;
  1167. this.processDailyParticipantOne['ended_at'] = processDailyParticipant.ended_at;
  1168. this.processDailyParticipantOne['hour_price'] = processDailyParticipant.hour_price;
  1169. this.processDailyParticipantOne['unit_price'] = processDailyParticipant.unit_price;
  1170. this.processDailyParticipantOne['dinner_duration'] = processDailyParticipant.dinner_duration;
  1171. this.processDailyParticipantOne['hour_count'] = processDailyParticipant.hour_count;
  1172. this.processDailyParticipantOne['unit_count'] = processDailyParticipant.unit_count;
  1173. this.processDailyParticipantOne['remark'] = processDailyParticipant.remark;
  1174. $("#updateModal").modal('show');
  1175. },
  1176. //提交修改
  1177. submitUpdateProcessDailyParticipant() {
  1178. let _this = this;
  1179. axios.post("{{url('process/updateProcessDailyParticipant')}}", this.processDailyParticipantOne)
  1180. .then(function (response) {
  1181. if (response.data.status == "error") {
  1182. tempTip.setDuration(3000);
  1183. _this.errors = response.data.data;
  1184. }
  1185. if (response.data.status == "success") {
  1186. _this.processDailyParticipants.every(function (processDailyParticipant) {
  1187. if (processDailyParticipant.id == response.data.data.id) {
  1188. processDailyParticipant.status = response.data.data.status;
  1189. processDailyParticipant.user_detail_full_name = response.data.data.user_detail_full_name;
  1190. processDailyParticipant.started_at = response.data.data.started_at;
  1191. processDailyParticipant.ended_at = response.data.data.ended_at;
  1192. processDailyParticipant.hour_price = response.data.data.hour_price;
  1193. processDailyParticipant.unit_price = response.data.data.unit_price;
  1194. processDailyParticipant.dinner_duration = response.data.data.dinner_duration;
  1195. processDailyParticipant.hour_count = response.data.data.hour_count;
  1196. processDailyParticipant.unit_count = response.data.data.unit_count;
  1197. processDailyParticipant.remark = response.data.data.remark;
  1198. processDailyParticipant.hour = response.data.data.hour;
  1199. processDailyParticipant.diff = response.data.data.diff;
  1200. processDailyParticipant.billingHour = response.data.data.billingHour;
  1201. processDailyParticipant.isAddProcessDailyParticipant = true;
  1202. return false;
  1203. }
  1204. return true;
  1205. });
  1206. tempTip.setDuration(3000);
  1207. tempTip.showSuccess('参与人修改成功!');
  1208. $("#updateModal").modal('hide');
  1209. }
  1210. }).catch(function (err) {
  1211. tempTip.setDuration(5000);
  1212. tempTip.show('修改参与人发生了一些严重错误:' + err);
  1213. })
  1214. },
  1215. //登记工时参与人审核
  1216. processDailyParticipantAudit(id) {
  1217. if (!confirm('审核后不能撤销及修改,确定通过审核吗?')) {
  1218. return
  1219. }
  1220. ;
  1221. let _this = this;
  1222. axios.post("{{url('process/processDailyParticipantAudit')}}" + "/" + id)
  1223. .then(function (response) {
  1224. if (response.data.success) {
  1225. _this.processDailyParticipants.every(function (processDailyParticipant) {
  1226. if (processDailyParticipant.id == response.data.processDailyParticipant.id) {
  1227. processDailyParticipant.status = response.data.processDailyParticipant.status;
  1228. return false;
  1229. }
  1230. return true;
  1231. });
  1232. tempTip.setDuration(3000);
  1233. tempTip.showSuccess('参与人审核通过!');
  1234. return;
  1235. }
  1236. tempTip.setDuration(3000);
  1237. tempTip.show('参与人失败!');
  1238. }).catch(function (err) {
  1239. tempTip.setDuration(5000);
  1240. tempTip.show('审核参与人发生了一些严重错误:' + err);
  1241. });
  1242. },
  1243. //临时工详情
  1244. showUserDetail(id) {
  1245. window.open("{{url('maintenance/userLabor')}}/" + id);
  1246. },
  1247. //显示教程
  1248. showTutorial(id) {
  1249. axios.post('{{url('maintenance/tutorial/showContent')}}' + "/" + id)
  1250. .then(function (response) {
  1251. if (response.data.success) {
  1252. $("#content").html(response.data.data);
  1253. $("#showTutorial").modal('show');
  1254. }
  1255. }).catch(function (err) {
  1256. tempTip.setDuration(3000);
  1257. tempTip.show('获取教程失败!' + '网络错误:' + err);
  1258. });
  1259. },
  1260. //新增教程
  1261. addTutorials(id, owner_id) {
  1262. let _this = this;
  1263. axios.post('{{url('process/getTutorials')}}' + "/" + id)
  1264. .then(function (response) {
  1265. if (response.data.success) {
  1266. _this.processTutorial.id = id;
  1267. _this.processTutorial.owner_id = owner_id;
  1268. _this.processTutorial.tutorials = response.data.data;
  1269. $("#addTutorial").modal("show");
  1270. return;
  1271. }
  1272. tempTip.setDuration(3000);
  1273. tempTip.show('获取教程失败!未知错误:' + response.data);
  1274. }).catch(function (err) {
  1275. tempTip.setDuration(3000);
  1276. tempTip.show('获取教程失败!' + '网络错误:' + err);
  1277. });
  1278. },
  1279. //选择教程
  1280. selectedTutorial(process_id, tutorial_id) {
  1281. let _this = this;
  1282. axios.post('{{url('process/selectedTutorial')}}', {
  1283. process_id: process_id,
  1284. tutorial_id:tutorial_id
  1285. })
  1286. .then(function (response) {
  1287. if (response.data.success) {
  1288. _this.processes.every(function (process) {
  1289. if (process.id == process_id) {
  1290. process.tutorials.push(response.data.data);
  1291. return false;
  1292. }
  1293. return true;
  1294. });
  1295. $("#addTutorial").modal("hide");
  1296. tempTip.setDuration(3000);
  1297. tempTip.showSuccess('添加成功!');
  1298. return;
  1299. }
  1300. tempTip.setDuration(3000);
  1301. tempTip.show('添加教程失败!发生错误:' + response.data.data);
  1302. }).catch(function (err) {
  1303. tempTip.setDuration(3000);
  1304. tempTip.show('添加教程失败!' + '网络错误:' + err);
  1305. });
  1306. },
  1307. //删除教程
  1308. deleteTutorials(process_id, tutorial_id) {
  1309. let _this = this;
  1310. axios.post('{{url('process/deleteTutorial')}}', {process_id: process_id, tutorial_id, tutorial_id})
  1311. .then(function (response) {
  1312. if (response.data.success) {
  1313. _this.processes.every(function (process) {
  1314. if (process.id == process_id) {
  1315. process.tutorials.every(function (tutorial, i) {
  1316. if (tutorial.id == tutorial_id) {
  1317. process.tutorials.splice(i, 1)
  1318. return false;
  1319. }
  1320. return true;
  1321. });
  1322. return false;
  1323. }
  1324. return true;
  1325. });
  1326. tempTip.setDuration(3000);
  1327. tempTip.showSuccess('删除成功!');
  1328. return;
  1329. }
  1330. tempTip.setDuration(3000);
  1331. tempTip.show('删除教程失败!发生错误:' + response.data.data);
  1332. }).catch(function (err) {
  1333. tempTip.setDuration(3000);
  1334. tempTip.show('删除教程失败!' + '网络错误:' + err);
  1335. });
  1336. },
  1337. processEdit(id) {
  1338. location.href = "{{url('process')}}/" + id + "/edit";
  1339. },
  1340. //去往新增教程
  1341. addTutorial() {
  1342. window.open("{{url('maintenance/tutorial/create?owner_id=')}}" + this.processTutorial.owner_id);
  1343. },
  1344. //展开内容单
  1345. unfold(code, id, type) {
  1346. this.$set(this.processUnfold, code + id, type);
  1347. },
  1348. close(code, id) {
  1349. this.$delete(this.processUnfold, code + id);
  1350. },
  1351. rollback(id) {
  1352. if (!confirm('确定要回滚至上一阶段吗?')) return;
  1353. if (!id) return;
  1354. let _this = this;
  1355. axios.post('{{url('process/rollback')}}', {id: id})
  1356. .then(function (response) {
  1357. if (response.data.success) {
  1358. _this.processes.every(function (process) {
  1359. if (process.id === id) {
  1360. process.status = response.data.data;
  1361. return false
  1362. }
  1363. return true;
  1364. });
  1365. tempTip.setDuration(2000);
  1366. tempTip.showSuccess('回滚成功!');
  1367. return;
  1368. }
  1369. tempTip.setDuration(3000);
  1370. tempTip.show('回滚失败!未知错误!');
  1371. }).catch(function (err) {
  1372. tempTip.setDuration(3000);
  1373. tempTip.show('回滚失败!网络错误:' + err);
  1374. })
  1375. },
  1376. //vue绑定的name type:移入移出类型
  1377. changeStyle(name, type) {
  1378. let domList = document.getElementsByName(name);
  1379. let color = '';
  1380. if (type) color = 'rgba(0, 0, 0, 0.15)';
  1381. for (let i = 0; i < domList.length; i++) {
  1382. domList[i].style.backgroundColor = color;
  1383. }
  1384. },
  1385. destroy(code, id) {
  1386. if (!confirm('确定要删除“' + code + "”吗?")) return;
  1387. let _this = this;
  1388. let delArr = [];
  1389. axios.delete('{{url('process')}}/' + id)
  1390. .then(function (response) {
  1391. tempTip.setDuration(3000);
  1392. if (response.data.success) {
  1393. _this.processes.forEach(function (process, i) {
  1394. if (process.code === code)
  1395. delArr.unshift(i);
  1396. });
  1397. delArr.forEach(function (del) {
  1398. _this.$delete(_this.processes, del);
  1399. });
  1400. tempTip.showSuccess('删除“' + code + '”成功!');
  1401. return;
  1402. }
  1403. tempTip.show('删除“' + code + '”失败!该单已不存在')
  1404. }).catch(function (err) {
  1405. tempTip.setDuration(4000);
  1406. tempTip.show("网络错误:" + err);
  1407. })
  1408. },
  1409. //审核
  1410. audit(process) {
  1411. if (!confirm('确定要通过“' + process.code + "”的审核吗?")) return;
  1412. axios.post('{{url('process/audit')}}', {id: process.id})
  1413. .then(function (response) {
  1414. if (response.data.success) {
  1415. process.status = '待接单';
  1416. tempTip.setDuration(2000);
  1417. tempTip.showSuccess('“' + process.code + "”的审核通过!");
  1418. return;
  1419. }
  1420. tempTip.setDuration(3000);
  1421. tempTip.show('审核失败:未知错误,请联系管理员!');
  1422. }).catch(function (err) {
  1423. tempTip.setDuration(3000);
  1424. tempTip.showSuccess('审核失败,网络错误:' + err);
  1425. })
  1426. },
  1427. checkAndAccept(process) {
  1428. if (!confirm('确定要验收“' + process.code + "”吗?")) return;
  1429. axios.post('{{url('process/checkAndAccept')}}', {id: process.id})
  1430. .then(function (response) {
  1431. if (response.data.success) {
  1432. process.status = response.data.data;
  1433. tempTip.setDuration(2000);
  1434. tempTip.showSuccess('“' + process.code + "”验收完成!");
  1435. return;
  1436. }
  1437. tempTip.setDuration(3000);
  1438. tempTip.show('未知错误,请联系管理员!')
  1439. }).catch(function (err) {
  1440. tempTip.setDuration(3000);
  1441. tempTip.show('网络错误:' + err)
  1442. })
  1443. },
  1444. show(id) {
  1445. window.location.href = '{{url('process')}}/' + id;
  1446. },
  1447. //修改价格
  1448. updateUnitPrice(process) {
  1449. if (!confirm('确定要修改“' + process.code + "”的单价吗?")) return;
  1450. let unit_price = $('#unit_price_' + process.id)[0].value;
  1451. if (!unit_price || isNaN(unit_price)) {
  1452. tempTip.setDuration(3000);
  1453. tempTip.show('请输入正确的价格!');
  1454. return;
  1455. }
  1456. axios.post('{{url('process/updateUnitPrice')}}', {id: process.id, unit_price: unit_price})
  1457. .then(function (response) {
  1458. if (response.data.success) {
  1459. process.unit_price = response.data.data;
  1460. process.signs.push(response.data.sign);
  1461. process.is_update_unit_price = false;
  1462. tempTip.setDuration(2000);
  1463. tempTip.showSuccess('“' + process.code + "”价格修改成功!");
  1464. return;
  1465. }
  1466. tempTip.setDuration(3000);
  1467. tempTip.show(response.data.data);
  1468. }).catch(function (err) {
  1469. tempTip.setDuration(3000);
  1470. tempTip.show('网络错误:' + err);
  1471. })
  1472. },
  1473. //组长或财务确认
  1474. verify(process, type) {
  1475. if (!confirm('确定要通过“'+process.code+"”的审核吗"))return;
  1476. let url = '{{url('process/workGroupVerify')}}';
  1477. let msg = '二次加工组';
  1478. if (type === 'accountant') {
  1479. url = '{{url('process/accountantVerify')}}';
  1480. msg = '财务';
  1481. }
  1482. let _this=this;
  1483. axios.post(url, {id: process.id})
  1484. .then(function (response) {
  1485. if (response.data.success) {
  1486. if (response.data.data){
  1487. process.signs.push(response.data.data);
  1488. _this.$set(_this.signs[process.code],response.data.data.mark,true);
  1489. }else{
  1490. _this.signs[process.code]=[];
  1491. process.signs=[];
  1492. }
  1493. tempTip.setDuration(2000);
  1494. tempTip.showSuccess('“' + process.code + "”新价格通过" + msg + "审核!");
  1495. return;
  1496. }
  1497. tempTip.setDuration(3000);
  1498. tempTip.show(response.data.data);
  1499. }).catch(function (err) {
  1500. tempTip.setDuration(3000);
  1501. tempTip.show('网络错误:' + err);
  1502. })
  1503. },
  1504. is_checked(e){
  1505. if (e.target.checked) this.filterData.is_accomplish=e.target.checked;
  1506. else this.filterData.is_accomplish='';
  1507. setTimeout( res=>{
  1508. this.submit();
  1509. },1);
  1510. }
  1511. },
  1512. });
  1513. </script>
  1514. @endsection