index.blade.php 114 KB

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