index.blade.php 113 KB

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