index.blade.php 106 KB

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