index.blade.php 114 KB

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