index.blade.php 108 KB

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