index.blade.php 112 KB

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