index.blade.php 82 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226
  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>
  10. <form method="GET" action="{{url('process/')}}" id="optionSubmit">
  11. <table class="table table-sm table-bordered text-nowrap mb-0">
  12. <tr v-if="isBeingFilterConditions">
  13. <td colspan="10">
  14. <div class="col" style="padding:0">
  15. <a href="{{url('process')}}"><span class="btn btn-warning text-dark">清除过滤条件</span></a>
  16. </div></td>
  17. </tr>
  18. <tr>
  19. <td colspan="9">
  20. <select name="paginate" v-model="filterData.paginate" class="tooltipTarget form-control form-control-sm" style="vertical-align: middle;max-width: 100px" @change="submit">
  21. <option value="50">50行</option>
  22. <option value="100">100行</option>
  23. <option value="200">200行</option>
  24. <option value="500">500行</option>
  25. <option value="1000">1000行</option>
  26. </select></td>
  27. </tr>
  28. <tr>
  29. <td >
  30. <input id="date_start" name="date_start" style="max-width: 200px" v-model="filterData.date_start" :class="filterData.date_start?'bg-warning':''" type="date" class="form-control form-control-sm tooltipTarget" title="选择显示指定日期的起始时间">
  31. </td>
  32. <td >
  33. <div class="form-inline">
  34. <input type="text" class="form-control form-control-sm tooltipTarget" placeholder="客户"
  35. style="width:70px" @input="owner_seek"
  36. title="输入关键词快速定位下拉列表,回车确定">
  37. <select name="owner_id" v-model="filterData.owner_id" @change="submit" class="form-control form-control-sm tooltipTarget" title="选择要显示的客户" :class="filterData.owner_id?'bg-warning':''">
  38. <option > </option>
  39. <option v-for="owner in owners" :value="owner.id">@{{owner.name}}</option>
  40. </select></div>
  41. </td>
  42. <td>
  43. <input id="wms_code" name="wms_code" style="max-width: 200px" title="单据号:支持15内模糊搜索与15天外精确搜索" v-model="filterData.wms_code" class="form-control form-control-sm tooltipTarget" placeholder="单据号" :class="filterData.wms_code?'bg-warning':''">
  44. </td>
  45. <td colspan="6"></td>
  46. </tr>
  47. <tr>
  48. <td >
  49. <input id="date_end" name="date_end" style="max-width: 200px" v-model="filterData.date_end" type="date" class="form-control form-control-sm tooltipTarget" title="选择显示指定日期的结束时间" :class="filterData.date_end?'bg-warning':''">
  50. </td>
  51. <td>
  52. <input name="commodity_barcode" style="max-width: 200px" title="商品条码:支持15内模糊搜索与15天外精确搜索" v-model="filterData.commodity_barcode" class="form-control form-control-sm tooltipTarget" placeholder="商品条码" :class="filterData.commodity_barcode?'bg-warning':''">
  53. </td>
  54. <td >
  55. <select id="status" name="status" v-model="filterData.status" @change="submit" style="max-width: 100px" class="form-control form-control-sm tooltipTarget" :class="filterData.status?'bg-warning':''" >
  56. <option value="" selected>状态</option>
  57. <option value="待接单">待接单</option>
  58. <option value="待加工">待加工</option>
  59. <option value="驳回">驳回</option>
  60. <option value="加工中">加工中</option>
  61. <option value="待验收">待验收</option>
  62. <option value="已完成">已完成</option>
  63. </select>
  64. </td>
  65. <td colspan="6">
  66. <input hidden type="submit" >
  67. </td>
  68. </tr>
  69. <tr>
  70. <td colspan="9">
  71. <span class="dropdown">
  72. <button class="btn btn-outline-dark btn-sm form-control-sm dropdown-toggle tooltipTarget" :class="[checkData.length>0?'btn-dark text-light':'']"
  73. data-toggle="dropdown" title="导出所有页将会以搜索条件得到的过滤结果,将其全部记录(每一页)导出">
  74. 导出Excel
  75. </button>
  76. <div class="dropdown-menu">
  77. <a class="dropdown-item" @click="processExport(1)" href="javascript:">导出勾选内容</a>
  78. <a class="dropdown-item" @click="processExport(2)" href="javascript:">导出所有页</a>
  79. </div>
  80. </span>
  81. </td>
  82. </tr>
  83. </table>
  84. </form>
  85. </div>
  86. <!--新增教程关联-->
  87. <div style="top:25%" class="modal fade" id="addTutorial" tabindex="-1" role="dialog" aria-labelledby="addTutorial" aria-hidden="true">
  88. <div class="modal-dialog">
  89. <div class="modal-content">
  90. <div class="modal-header m-1 p-0">
  91. <button type="button" class="close pr-4" data-dismiss="modal" aria-hidden="true">&times;</button>
  92. </div>
  93. <div class="modal-body m-auto">
  94. <table class="table-sm">
  95. <tr>
  96. <th>标题</th>
  97. <th><button class="btn btn-sm btn-outline-primary" @click="addTutorial()">新增教程</button></th>
  98. </tr>
  99. <tr v-for="tutorial in processTutorial.tutorials">
  100. <td><div style="cursor:pointer;overflow: hidden;width: 200px" @click="showTutorial(tutorial.id)" :title="tutorial.name" class="text-primary">@{{tutorial.name}}</div></td>
  101. @can("二次加工管理-教程管理")<td><button @click="selectedTutorial(processTutorial.id,tutorial.id)" class="btn btn-sm btn-success pull-right">选择</button></td>@endcan
  102. </tr>
  103. </table>
  104. </div>
  105. </div><!-- /.modal-content -->
  106. </div><!-- /.modal -->
  107. </div>
  108. <!-- 显示教程-->
  109. <div class="modal fade" id="showTutorial" tabindex="-1" role="dialog" aria-labelledby="showTutorial" aria-hidden="true">
  110. <div class="modal-dialog">
  111. <div class="modal-content">
  112. <div class="modal-header">
  113. <button type="button" class="close pull-right" data-dismiss="modal" aria-hidden="true">&times;</button>
  114. </div>
  115. <div class="modal-body custom-rich-text-content" id="content"></div>
  116. <div class="modal-footer">
  117. <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
  118. </div>
  119. </div><!-- /.modal-content -->
  120. </div><!-- /.modal -->
  121. </div>
  122. <!-- 修改modal -->
  123. <div data-backdrop="static" class="modal fade" id="updateModal" tabindex="-1" role="dialog" aria-labelledby="updateModalLabel" aria-hidden="true">
  124. <div class="modal-dialog modal-dialog-centered" role="document">
  125. <div class="modal-content">
  126. <div class="modal-body">
  127. <div v-if="errors.user_id" class="row"><label class="col-3"></label><small class="text-danger col-7">@{{ errors.user_id }}</small></div>
  128. <div class="form-group row">
  129. <label for="initial_weight" class="col-3 col-form-label text-right">参与者</label>
  130. <div class="col-7">
  131. <input :class="{ 'is-invalid' : errors.user_id }" @change="verifyUserName($event,null,null)" type="text" class="form-control" autocomplete="off" v-model="processDailyParticipantOne.user_detail_full_name" >
  132. </div>
  133. </div>
  134. <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>
  135. <div class="form-group row">
  136. <label for="initial_weight" class="col-3 col-form-label text-right">开始时间</label>
  137. <div class="col-7">
  138. <input :class="{ 'is-invalid' : errors.started_at }" type="text" @input="hourFilter($event)" class="form-control" autocomplete="off" v-model="processDailyParticipantOne.started_at" >
  139. </div>
  140. </div>
  141. <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>
  142. <div class="form-group row">
  143. <label for="initial_weight" class="col-3 col-form-label text-right">结束时间</label>
  144. <div class="col-7">
  145. <input :class="{ 'is-invalid' : errors.ended_at }" type="text" @input="hourFilter($event)" class="form-control" autocomplete="off" v-model="processDailyParticipantOne.ended_at" >
  146. </div>
  147. </div>
  148. <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>
  149. <div class="form-group row">
  150. <label for="initial_weight" class="col-3 col-form-label text-right">计时工资</label>
  151. <div class="col-7">
  152. <input :class="{ 'is-invalid' : errors.hour_price }" type="text" class="form-control" autocomplete="off" v-model="processDailyParticipantOne.hour_price" >
  153. </div>
  154. </div>
  155. <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>
  156. <div class="form-group row">
  157. <label for="initial_weight" class="col-3 col-form-label text-right">计件工资</label>
  158. <div class="col-7">
  159. <input :class="{ 'is-invalid' : errors.unit_price }" type="text" class="form-control" autocomplete="off" v-model="processDailyParticipantOne.unit_price" >
  160. </div>
  161. </div>
  162. <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>
  163. <div class="form-group row">
  164. <label for="initial_weight" class="col-3 col-form-label text-right">晚饭时间</label>
  165. <div class="col-7">
  166. <select :class="{ 'is-invalid' : errors.dinner_duration }" v-model="processDailyParticipantOne.dinner_duration" class="form-control">
  167. <option value="0">无</option>
  168. <option value="30">30分钟</option>
  169. <option value="60">60分钟</option>
  170. </select>
  171. </div>
  172. </div>
  173. <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>
  174. <div class="form-group row">
  175. <label for="initial_weight" class="col-3 col-form-label text-right">计时工时</label>
  176. <div class="col-7">
  177. <input :class="{ 'is-invalid' : errors.hour_count }" type="text" class="form-control" autocomplete="off" v-model="processDailyParticipantOne.hour_count" >
  178. </div>
  179. </div>
  180. <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>
  181. <div class="form-group row">
  182. <label for="initial_weight" class="col-3 col-form-label text-right">计件数量</label>
  183. <div class="col-7">
  184. <input :class="{ 'is-invalid' : errors.unit_count }" type="text" class="form-control" autocomplete="off" v-model="processDailyParticipantOne.unit_count" >
  185. </div>
  186. </div>
  187. <div class="form-group row">
  188. <label for="initial_weight" class="col-3 col-form-label text-right">备注</label>
  189. <div class="col-7">
  190. <input type="text" class="form-control" autocomplete="off" v-model="processDailyParticipantOne.remark" >
  191. </div>
  192. </div>
  193. </div>
  194. <div class="modal-footer">
  195. <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
  196. @can("二次加工管理-登记工时")<button v-if="isShow.isUpdateConfirmBtn" @click="submitUpdateProcessDailyParticipant()" class="btn btn-primary">提交更改</button>@endcan
  197. </div>
  198. </div><!-- /.modal-content -->
  199. </div><!-- /.modal -->
  200. </div>
  201. <!-- 多临时工选择(Modal) -->
  202. <div data-backdrop="static" style="top:25%" class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  203. <div class="modal-dialog">
  204. <div class="modal-content" style="background-color: #d6e9f8">
  205. <div class="modal-body m-auto">
  206. <table class="table-sm">
  207. <tr>
  208. <th>姓名</th>
  209. <th>性别</th>
  210. <th>电话</th>
  211. <th>最近打卡时间</th>
  212. <th></th>
  213. </tr>
  214. <tr v-for="userLabor in userLabors" v-if="userLabor.user_labor">
  215. <td>@{{ userLabor.full_name }}</td>
  216. <td>@{{ userLabor.gender }}</td>
  217. <td>@{{ userLabor.mobile_phone }}</td>
  218. <td>@{{ userLabor.checked_at }}</td>
  219. <td><button @click="selectedUser(userLabor.user_id,userLabor.user_labor.default_hour_price)" class="btn btn-sm btn-success">选择</button></td>
  220. </tr>
  221. </table>
  222. </div>
  223. </div><!-- /.modal-content -->
  224. </div><!-- /.modal -->
  225. </div>
  226. <table class="table table-striped table-sm text-nowrap table-hover">
  227. <tr>
  228. <th>
  229. <label for="all">
  230. <input id="all" type="checkbox" @click="checkAll($event)">全选
  231. </label>
  232. </th>
  233. <th>序号</th>
  234. <th >操作</th>
  235. <th>任务号</th>
  236. <th>货主</th>
  237. <th>加工类型</th>
  238. <th>预期数量</th>
  239. <th class="text-center">教程</th>
  240. <th>单价</th>
  241. <th>完成数量</th>
  242. <th>提交日期</th>
  243. <th>状态</th>
  244. <th>备注</th>
  245. <th>单据类型</th>
  246. <th>单据号</th>
  247. <th>本单数量</th>
  248. <th>商品条码</th>
  249. <th>商品名称 </th>
  250. </tr>
  251. <template>
  252. <tr v-for="(processOne,i) in processes" :id="processOne.afterLocation?processOne.afterLocation:processOne.id">
  253. <td :rowspan="processOne.rowspan" v-if="processOne.id">
  254. <input class="checkItem" type="checkbox" :value="processOne.id" v-model="checkData">
  255. </td>
  256. <td :rowspan="processOne.rowspan" v-if="processOne.id" class="text-muted">@{{ i+1 }}</td>
  257. <td :rowspan="processOne.rowspan" v-if="processOne.id" style="min-width:150px" >
  258. <p v-if="!processOne.openProcessHour && processOne.status=='驳回'" class="text-muted">已驳回</p>
  259. <p v-if="!processOne.openProcessHour && processOne.status=='已完成'" class="text-success">已完成</p>
  260. @can("二次加工管理-接单与驳回")
  261. <button v-if="!processOne.openProcessHour && processOne.status=='待接单'" @click="processEdit(processOne.id)" class="btn btn-sm btn-outline-info pull-left">编辑</button>
  262. <button v-if="!processOne.openProcessHour && processOne.status=='待接单'" @click="processReject(processOne.id)" class="btn btn-sm btn-outline-dark pull-left">驳回</button>
  263. <button v-if="!processOne.openProcessHour && processOne.status=='待接单'" @click="processReceive(processOne.id)" class="btn btn-sm btn-outline-primary pull-left">接单</button>@endcan
  264. @can("二次加工管理-登记工时")<button v-if="(processOne.status=='加工中' || processOne.status=='待加工') && !processOne.openProcessHour"
  265. class="btn btn-sm btn-outline-info pull-left" @click="openProcessHour(processOne);processOne.openProcessHour=true;processOne.detailFolding=false">登记工时</button>
  266. <button v-if="processOne.openProcessHour" @click="closeProcessHour(processOne.id);processOne.openProcessHour=false" class="btn btn-sm btn-dark pull-left">收起登记工时</button>@endcan
  267. @can("二次加工管理-验收完成")<button v-if="!processOne.openProcessHour && processOne.status=='待验收'" @click="processAccomplish(processOne.id)" class="btn btn-sm btn-outline-success pull-left">完成</button>@endcan
  268. </td>
  269. <td :rowspan="processOne.rowspan" v-if="processOne.id" class="text-muted">@{{ processOne.code }}</td>
  270. <td :rowspan="processOne.rowspan" v-if="processOne.id" class="text-muted">@{{ processOne.owner_name }}</td>
  271. <td :rowspan="processOne.rowspan" v-if="processOne.id">@{{ processOne.process_method_name }}</td>
  272. <td :rowspan="processOne.rowspan" v-if="processOne.id">@{{ processOne.amount }}</td>
  273. <td :rowspan="processOne.rowspan" v-if="processOne.id" >
  274. <div class="" v-if="processOne.tutorials" {{--style="width: 200px;overflow:auto;"--}}>
  275. <div v-if=" processOne.tutorials.length>0">
  276. <u v-if="!processOne.detailFolding" @click="showTutorial(processOne.tutorials[0].id)" class="text-info" style="cursor:pointer;">@{{processOne.tutorials[0].name}}</u>
  277. <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>
  278. <div v-else><button class="btn btn-sm btn-outline-dark pull-left" href="javascript:;" @click="processOne.detailFolding=false" >收起编辑</button>
  279. <button @click="addTutorials(processOne.id,processOne.owner_id)" class="btn btn-sm btn-outline-info pull-left">新增关联教程</button></div>
  280. <table class="table table-sm" v-if="processOne.detailFolding">
  281. <tr>
  282. <th>标题</th>
  283. <th>操作</th>
  284. <th>创建时间</th>
  285. </tr>
  286. <tr v-for="(tutorial,i) in processOne.tutorials">
  287. <td class="text-info"><u :title="tutorial.name" @click="showTutorial(tutorial.id)" style="cursor:pointer;">@{{tutorial.name}}</u></td>
  288. <td>@can('二次加工管理-教程管理')
  289. <button @click="deleteTutorials(processOne.id,tutorial.id)" class="btn btn-sm btn-outline-danger pull-left" >删</button>
  290. @endcan</td>
  291. <td >@{{tutorial.created_at}}</td>
  292. </tr>
  293. </table>
  294. </div>
  295. <div v-if="processOne.tutorials.length<1">
  296. <button @click="addTutorials(processOne.id,processOne.owner_id)" class="btn btn-sm btn-outline-info pull-left" >新增关联教程</button>
  297. </div>
  298. </div>
  299. </td>
  300. <td :rowspan="processOne.rowspan" v-if="processOne.id" class="text-muted">@{{ processOne.unit_price }}</td>
  301. <td :rowspan="processOne.rowspan" v-if="processOne.id">@{{ processOne.completed_amount }}</td>
  302. <td :rowspan="processOne.rowspan" v-if="processOne.id">@{{ processOne.created_at }}</td>
  303. <td :rowspan="processOne.rowspan" v-if="processOne.id" class="text-muted">@{{ processOne.status }}</td>
  304. <td :rowspan="processOne.rowspan" v-if="processOne.id" class="text-muted">@{{ processOne.remark }}</td>
  305. <td class="text-muted">@{{ processOne.bill_type }}</td>
  306. <td class="text-muted">@{{ processOne.wms_code }}</td>
  307. <td class="text-muted">@{{ processOne.thisAmount }}</td>
  308. <td class="text-muted">
  309. <ul class="p-0 m-0 list-unstyled list-inline" v-if="processOne.commodity_barcodes">
  310. <li v-for="barcode in processOne.commodity_barcodes"><small>@{{ barcode.code }}</small></li>
  311. </ul>
  312. </td>
  313. <td class="text-muted">@{{ processOne.commodity_name }}</td>
  314. </tr>
  315. <tr id="addProcessDailyParticipants" v-show="processDailyParticipants.length>0">
  316. <td colspan="2"></td>
  317. <td colspan="16">
  318. <table class="table-sm table-bordered table-condensed">
  319. <tr class="text-success">
  320. <td>日期</td><td>当日产量</td>
  321. <td>当日剩余</td>
  322. <td colspan="2">操作</td>
  323. <td>参与者</td>
  324. <td>开始时间</td>
  325. <td>结束时间</td>
  326. <td>计时工资</td>
  327. <td>计件工资</td>
  328. <td>晚饭时间</td>
  329. <td>计时工时</td>
  330. <td>计件数量</td>
  331. <td>备注</td>
  332. <td>打卡工时</td>
  333. <td>工时差</td>
  334. <td>计费工时</td>
  335. <td>审核</td>
  336. <td>详情</td>
  337. </tr>
  338. <tr v-for="processDailyParticipant in processDailyParticipants" :id="'processDailyParticipant'+processDailyParticipant.id">
  339. <td v-if="processDailyParticipant.rowspan" :rowspan="processDailyParticipant.rowspan"><p >@{{ processDailyParticipant.date }}</p></td>
  340. <td v-if="processDailyParticipant.rowspan" :rowspan="processDailyParticipant.rowspan">
  341. <div class="form-inline">
  342. <input :readonly="processDailyParticipant.readonly" v-model="processDailyParticipant.submitOutput"
  343. class="form-control col-sm-5 " @click="processDailyParticipant.id?processDailyParticipant.readonly=false:processDailyParticipant.readonly=true" type="text" />
  344. @can("二次加工管理-登记工时")<button class="btn btn-sm btn-success" v-if="! processDailyParticipant.readonly" @click="submitOutputData(processDailyParticipant.daily_id,processDailyParticipant.submitOutput,processDailyParticipant.id)">确定</button>
  345. <button class="btn btn-sm btn-danger" v-if="! processDailyParticipant.readonly" @click="processDailyParticipant.readonly=true;processDailyParticipant.submitOutput=processDailyParticipant.output">取消</button>
  346. @endcan
  347. </div>
  348. </td>
  349. <td v-if="processDailyParticipant.rowspan" :rowspan="processDailyParticipant.rowspan"><p >@{{ processDailyParticipant.remain }}</p></td>
  350. <td v-if="processDailyParticipant.rowspan" :rowspan="processDailyParticipant.rowspan">
  351. @can("二次加工管理-登记工时")<button v-if="processDailyParticipant.isAddProcessDailyParticipant && isShow.isAddProcessDailyParticipant" class="btn btn-sm btn-info" @click="addProcessDailyParticipant(processDailyParticipant);processDailyParticipant.isAddProcessDailyParticipant=false;">新增</button>
  352. <button v-if="!processDailyParticipant.isAddProcessDailyParticipant" class="btn btn-sm btn-danger"
  353. @click="deleteProcessDailyParticipant($event,processDailyParticipant.daily_id,processDailyParticipant.user_detail_full_name,processDailyParticipant.isConfirmBtn);processDailyParticipant.isAddProcessDailyParticipant=true;">取消</button>
  354. @endcan
  355. </td>
  356. <td>
  357. @can("二次加工管理-登记工时")<button v-if="!processDailyParticipant.isAddProcessDailyParticipant && processDailyParticipant.isConfirmBtn" class="btn btn-sm btn-success" @click="submitProcessDailyParticipant(processDailyParticipant.daily_id)">确定</button>
  358. <button v-if="processDailyParticipant.id && processDailyParticipant.status=='未审核'" class="btn btn-sm btn-outline-info" @click="updateProcessDailyParticipant(processDailyParticipant)">改</button>
  359. @endcan
  360. </td>
  361. <td>
  362. <span v-if="!processDailyParticipant.user_detail_full_name && processDailyParticipant.isAddProcessDailyParticipant==false" >
  363. <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)">
  364. <input hidden :id="processDailyParticipant.daily_id+'user_id'"/>
  365. </span><span v-else>@{{ processDailyParticipant.user_detail_full_name }}</span></td>
  366. <td>
  367. <span v-if="!processDailyParticipant.user_detail_full_name && processDailyParticipant.isAddProcessDailyParticipant==false" >
  368. <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:70px" type="text" @input="hourFilter($event)">
  369. </span><span v-else> @{{ processDailyParticipant.started_at }}</span></td>
  370. <td>
  371. <span v-if="!processDailyParticipant.user_detail_full_name && processDailyParticipant.isAddProcessDailyParticipant==false" >
  372. <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:70px" type="text" @input="hourFilter($event)">
  373. </span><span v-else> @{{ processDailyParticipant.ended_at }}</span></td>
  374. <td><span v-if="!processDailyParticipant.user_detail_full_name && processDailyParticipant.isAddProcessDailyParticipant==false">
  375. <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">
  376. </span><span v-else>@{{ processDailyParticipant.hour_price }}</span></td>
  377. <td>
  378. <span v-if="!processDailyParticipant.user_detail_full_name && processDailyParticipant.isAddProcessDailyParticipant==false">
  379. <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">
  380. </span><span v-else>@{{ processDailyParticipant.unit_price }}</span></td>
  381. <td>
  382. <span v-if="!processDailyParticipant.user_detail_full_name && processDailyParticipant.isAddProcessDailyParticipant==false">
  383. <select :class="{ 'is-invalid' : errors.dinner_duration }" :data-original-title="errors.dinner_duration ? errors.dinner_duration[0] : ''" :id="processDailyParticipant.daily_id+'dinner_duration'" class="form-control tooltipTargetError" style="width:80px">
  384. <option value="0">无</option>
  385. <option value="30">30分钟</option>
  386. <option value="60">60分钟</option>
  387. </select>
  388. </span><span v-else>@{{ processDailyParticipant.dinner_duration }}</span></td>
  389. <td>
  390. <span v-if="!processDailyParticipant.user_detail_full_name && processDailyParticipant.isAddProcessDailyParticipant==false">
  391. <input :class="{ 'is-invalid' : errors.hour_count }" :data-original-title="errors.hour_count ? errors.hour_count[0] : ''" :id="processDailyParticipant.daily_id+'hour_count'" value="8" class="form-control tooltipTargetError" style="width:70px" type="text" >
  392. </span><span v-else>@{{ processDailyParticipant.hour_count }}</span></td>
  393. <td>
  394. <span v-if="!processDailyParticipant.user_detail_full_name && processDailyParticipant.isAddProcessDailyParticipant==false">
  395. <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">
  396. </span><span v-else>@{{ processDailyParticipant.unit_count }}</span></td>
  397. <td>
  398. <span v-if="!processDailyParticipant.user_detail_full_name && processDailyParticipant.isAddProcessDailyParticipant==false">
  399. <input :id="processDailyParticipant.daily_id+'remark'" class="form-control" style="width: 100px" type="text">
  400. </span><span v-else>@{{ processDailyParticipant.remark }}</span></td>
  401. <td class="text-danger">@{{ processDailyParticipant.hour }}</td>
  402. <td class="text-danger">@{{ processDailyParticipant.diff }}</td>
  403. <td class="text-danger">@{{ processDailyParticipant.billingHour }}</td>
  404. <td class="text-danger">
  405. @can("人事管理-任务审核")<button @click="processDailyParticipantAudit(processDailyParticipant.id)" v-if="processDailyParticipant.status=='未审核'" class="btn btn-sm btn-outline-success">审核</button>@endcan
  406. <b v-else class="text-success">@{{ processDailyParticipant.status }}</b>
  407. </td>
  408. @can("二次加工管理-临时工资料管理")<td class="text-info"><u v-if="processDailyParticipant.user_detail_full_name" style="cursor:pointer" @click="showUserDetail(processDailyParticipant.user_id)">详情</u></td>@endcan
  409. </tr>
  410. </table>
  411. </td>
  412. </tr>
  413. </template>
  414. </table>
  415. {{$processes->appends($request)->links()}}
  416. </div>
  417. </div>
  418. </div>
  419. @endsection
  420. @section('lastScript')
  421. <script>
  422. new Vue({
  423. el:"#process",
  424. data:{
  425. participantInputting:{},
  426. processesContents:[
  427. @foreach($processes as $processOne)
  428. {id:'{{$processOne->id}}',code:'{{$processOne->code}}',owner_name:'{{$processOne->owner_name}}',owner_id:'{{$processOne->owner_id}}',
  429. process_method_name:'{{$processOne->process_method_name}}',amount:'{{$processOne->amount}}'
  430. ,tutorials:{!! $processOne->tutorials !!},processesContents:{!! $processOne->processesContents !!},unit_price:'{{$processOne->unit_price}}',created_at:'{{$processOne->created_at}}',
  431. completed_amount:'{{$processOne->completed_amount}}',status:'{{$processOne->status}}',remark:'{{$processOne->remark}}',detailFolding:false,openProcessHour:false,},
  432. @endforeach
  433. ],
  434. processes:[],
  435. processesList:[],
  436. owners:[
  437. @foreach($owners as $owner)
  438. {!! $owner !!},
  439. @endforeach
  440. ],
  441. errors:{},
  442. checkData:[],
  443. filterData:{paginate:50,date_start:'',date_end:'',owner_id:'',commodity_barcode:'',wms_code:'',status:''},
  444. processDailies:[],
  445. processDailyParticipants:[],
  446. isShow:{
  447. isOpenProcessHour:false,isAddProcessDailyParticipant:true,isUpdateConfirmBtn:true,
  448. },
  449. userLabors:[],
  450. modalDaily_id:'',
  451. processDailyParticipantOne:{id:'',user_id:'',user_detail_full_name:'',started_at:"",ended_at:"",
  452. hour_price:'',unit_price:'',dinner_duration:'',hour_count:'',unit_count:'',remark:''},
  453. processTutorial:{id:'',owner_id:'',tutorials:[],},
  454. },
  455. watch:{
  456. checkData:{
  457. handler(){
  458. if (this.checkData.length === this.processes.length){
  459. document.querySelector('#all').checked = true;
  460. }else {
  461. document.querySelector('#all').checked = false;
  462. }
  463. },
  464. deep:true
  465. }
  466. },
  467. computed:{
  468. isBeingFilterConditions:function(){
  469. for(let key in this.filterData){
  470. if(this.filterData[key]){
  471. if(key==='paginate')continue;
  472. return true
  473. }
  474. }
  475. return false;
  476. },
  477. },
  478. mounted:function () {
  479. this.initInputs();
  480. this.resetProcessData();
  481. $(".tooltipTarget").tooltip({'trigger':'hover'});
  482. $('#process').removeClass('d-none');
  483. },
  484. methods:{
  485. //重组数据
  486. resetProcessData:function(){
  487. let _this=this;
  488. for (let i=0;i<this.processesContents.length;i++){
  489. let process=this.processesContents[i];
  490. if (process.processesContents.length<1){
  491. let processOne={};
  492. processOne['id']=process.id;
  493. processOne['code']=process.code;
  494. processOne['owner_name']=process.owner_name;
  495. processOne['process_method_name']=process.process_method_name;
  496. processOne['amount']=process.amount;
  497. processOne['tutorials']=process.tutorials;
  498. processOne['unit_price']=process.unit_price;
  499. processOne['created_at']=process.created_at;
  500. processOne['status']=process.status;
  501. processOne['remark']=process.remark;
  502. processOne['completed_amount']=process.completed_amount;
  503. processOne['detailFolding']=false;
  504. processOne['openProcessHour']=false;
  505. this.processes.push(processOne);
  506. continue;
  507. }
  508. process.processesContents.every(function (processesContent,count) {
  509. let processOne={};
  510. if ((count+1)==process.processesContents.length){
  511. processOne['afterLocation'] = process.id+"-"+process.processesContents.length;
  512. }
  513. if (_this.processesList[process.code]) {
  514. processOne['bill_type'] = processesContent.bill_type;
  515. processOne['wms_code'] = processesContent.wms_code;
  516. processOne['thisAmount']=processesContent.amount;
  517. processOne['commodity_barcodes'] = processesContent.commodity ? processesContent.commodity.barcodes:'';
  518. processOne['commodity_name'] = processesContent.commodity_name;
  519. _this.processes.push(processOne);
  520. }else{
  521. _this.processesList[process.code]=process.id;
  522. processOne['rowspan']=process.processesContents.length;
  523. processOne['id']=process.id;
  524. processOne['code']=process.code;
  525. processOne['owner_name']=process.owner_name;
  526. processOne['owner_id']=process.owner_id;
  527. processOne['process_method_name']=process.process_method_name;
  528. processOne['tutorials']=process.tutorials;
  529. processOne['amount']=process.amount;
  530. processOne['unit_price']=process.unit_price;
  531. processOne['created_at']=process.created_at;
  532. processOne['status']=process.status;
  533. processOne['remark']=process.remark;
  534. processOne['completed_amount']=process.completed_amount;
  535. processOne['detailFolding']=false;
  536. processOne['openProcessHour']=false;
  537. processOne['bill_type']=processesContent.bill_type;
  538. processOne['wms_code']=processesContent.wms_code;
  539. processOne['thisAmount']=processesContent.amount;
  540. processOne['commodity_barcodes']=processesContent.commodity ? processesContent.commodity.barcodes:'';
  541. processOne['commodity_name']=processesContent.commodity_name;
  542. processOne['count']=process.processesContents.length;
  543. _this.processes.push(processOne);
  544. }
  545. return true;
  546. });
  547. }
  548. },
  549. //回显条件参数
  550. initInputs:function(){
  551. let data=this;
  552. let uriParts =decodeURI(location.href).split("?");
  553. if(uriParts.length>1){
  554. let params = uriParts[1].split('&');
  555. params.forEach(function(paramPair){
  556. let pair=paramPair.split('=');
  557. let key = pair[0], val = pair[1];
  558. if (val!=="+"){
  559. $('input[name="'+key+'"]').val(val);
  560. $('select[name="'+key+'"]').val(val);
  561. decodeURI(data.filterData[key]=val);
  562. }
  563. });
  564. }
  565. },
  566. //提交表单
  567. submit:function(){
  568. let form = $("#optionSubmit");
  569. form.submit();
  570. },
  571. //全选事件
  572. checkAll(e){
  573. if (e.target.checked){
  574. this.processes.forEach((el,i)=>{
  575. if (this.checkData.indexOf(el.id) == '-1'){
  576. this.checkData.push(el.id);
  577. }
  578. });
  579. }else {
  580. this.checkData = [];
  581. }
  582. },
  583. //导出excel,因同步问题不使用formData
  584. processExport(e){
  585. let val=e;
  586. let data=this.filterData;
  587. if (val==1){
  588. if (this.checkData&&this.checkData.length<=0){
  589. tempTip.setDuration(4000);
  590. tempTip.showSuccess('没有勾选任何记录');
  591. }else{
  592. location.href="{{url('process?checkSign=')}}"+this.checkData;
  593. }
  594. } else {
  595. location.href="{{url('process?checkSign=-1&date_start=')}}"+
  596. data.date_start+"&date_end="+data.date_end+"&owner_id="+
  597. data.owner_id+"&commodity_barcode="+data.commodity_barcode+"&wms_code="+data.wms_code+
  598. "&status="+data.status;
  599. }
  600. },
  601. //获取登记工时
  602. openProcessHour(process){
  603. let e=process.id;
  604. let _this=this;
  605. if (_this.isShow.isOpenProcessHour){
  606. _this.processes.every(function (process) {
  607. if (process.openProcessHour){
  608. process.openProcessHour=false;
  609. _this.processDailies=[];
  610. _this.processDailyParticipants=[];
  611. return false;
  612. }
  613. return true;
  614. });
  615. }else{
  616. _this.isShow.isOpenProcessHour=true;
  617. }
  618. axios.post("{{url("process/getDailyParticipant")}}",{id:e,amount:process.amount})
  619. .then(function (response) {
  620. let processDailies=response.data;
  621. for (let i=0;i<processDailies.length;i++){
  622. let processDailyParticipants=processDailies[i].process_daily_participants;
  623. if (processDailyParticipants.length<=0){
  624. let data={};
  625. data['daily_id']=processDailies[i].id;
  626. data['date']=processDailies[i].date;
  627. data['output']=processDailies[i].output;
  628. data['remain']=processDailies[i].remain;
  629. data['rowspan']=1;
  630. data['readonly']="true";
  631. data['isAddProcessDailyParticipant']="true";
  632. data['isConfirmBtn']="true";
  633. data['submitOutput']=processDailies[i].output;
  634. _this.processDailyParticipants.push(data);
  635. continue;
  636. }
  637. for (let j=0;j<processDailyParticipants.length;j++){
  638. let data={};
  639. data['id']=processDailyParticipants[j].id;
  640. data['status']=processDailyParticipants[j].status;
  641. data['started_at']=processDailyParticipants[j].started_at;
  642. data['user_detail_full_name']=processDailyParticipants[j].user_detail_full_name;
  643. data['user_id']=processDailyParticipants[j].user_id;
  644. data['ended_at']=processDailyParticipants[j].ended_at;
  645. data['hour_price']=processDailyParticipants[j].hour_price;
  646. data['unit_price']=processDailyParticipants[j].unit_price;
  647. data['dinner_duration']=processDailyParticipants[j].dinner_duration;
  648. data['hour_count']=processDailyParticipants[j].hour_count;
  649. data['remark']=processDailyParticipants[j].remark;
  650. data['hour']=processDailyParticipants[j].hour;
  651. data['diff']=processDailyParticipants[j].diff;
  652. data['billingHour']=processDailyParticipants[j].billingHour;
  653. data['unit_count']=processDailyParticipants[j].unit_count;
  654. data['process_id']=processDailies[i].process_id;
  655. data['readonly']="true";
  656. if (!_this.processDailies[processDailies[i].id]){
  657. data['rowspan']=processDailyParticipants.length;
  658. data['daily_id']=processDailies[i].id;
  659. data['date']=processDailies[i].date;
  660. data['output']=processDailies[i].output;
  661. data['remain']=processDailies[i].remain;
  662. data['submitOutput']=processDailies[i].output;
  663. data['isAddProcessDailyParticipant']="true";
  664. data['isConfirmBtn']="true";
  665. _this.processDailies[processDailies[i].id]=processDailies[i].id;
  666. }
  667. _this.processDailyParticipants.push(data);
  668. }
  669. }
  670. }).catch(function (err) {
  671. tempTip.setDuration(5000);
  672. tempTip.show('获取登记工时数据发生了一些严重错误:'+err);
  673. });
  674. let processDailyParticipantsHtml=$("#addProcessDailyParticipants");
  675. if (process.count) $("#"+e+"-"+process.count).after(processDailyParticipantsHtml);
  676. else $("#"+e).after(processDailyParticipantsHtml)
  677. },
  678. //删除工时显示
  679. closeProcessHour(e){
  680. this.processDailies=[];
  681. this.processDailyParticipants=[];
  682. },
  683. //新增参与人
  684. addProcessDailyParticipant(processDailyParticipantOne){
  685. let id=processDailyParticipantOne.id;
  686. if (!id) return;
  687. let _this=this;
  688. _this.errors={};
  689. this.processDailyParticipants.every(function (processDailyParticipant,i) {
  690. if (processDailyParticipant.id==id){
  691. processDailyParticipant.rowspan++;
  692. let data={};
  693. data['readonly']="true";
  694. data['isAddProcessDailyParticipant']="true";
  695. data['isConfirmBtn']="true";
  696. data['id']=processDailyParticipant.id;
  697. data['user_id']=processDailyParticipant.user_id;
  698. data['status']=processDailyParticipant.status;
  699. data['started_at']=processDailyParticipant.started_at;
  700. data['user_detail_full_name']=processDailyParticipant.user_detail_full_name;
  701. data['ended_at']=processDailyParticipant.ended_at;
  702. data['hour_price']=processDailyParticipant.hour_price;
  703. data['unit_price']=processDailyParticipant.unit_price;
  704. data['dinner_duration']=processDailyParticipant.dinner_duration;
  705. data['hour_count']=processDailyParticipant.hour_count;
  706. data['remark']=processDailyParticipant.remark;
  707. data['hour']=processDailyParticipant.hour;
  708. data['diff']=processDailyParticipant.diff;
  709. data['billingHour']=processDailyParticipant.billingHour;
  710. data['unit_count']=processDailyParticipant.unit_count;
  711. data['process_id']=processDailyParticipant.process_id;
  712. _this.processDailyParticipants.splice(i+1,0,data);
  713. processDailyParticipant.id='';
  714. processDailyParticipant.status='';
  715. processDailyParticipant.started_at='';
  716. processDailyParticipant.user_detail_full_name='';
  717. processDailyParticipant.ended_at='';
  718. processDailyParticipant.hour_price='';
  719. processDailyParticipant.unit_price='';
  720. processDailyParticipant.dinner_duration='';
  721. processDailyParticipant.hour_count='';
  722. processDailyParticipant.remark='';
  723. processDailyParticipant.hour='';
  724. processDailyParticipant.diff='';
  725. processDailyParticipant.billingHour='';
  726. processDailyParticipant.unit_count='';
  727. processDailyParticipant.process_id='';
  728. return false;
  729. }
  730. return true;
  731. });
  732. _this.isShow.isAddProcessDailyParticipant=false;
  733. },
  734. //取消录入参与人
  735. deleteProcessDailyParticipant($event,daily_id,processDailyParticipant_name,isConfirmBtn){
  736. console.log($event,daily_id,processDailyParticipant_name,isConfirmBtn);
  737. if (!isConfirmBtn) {
  738. this.processDailyParticipants.every(function (processDailyParticipant) {
  739. if(processDailyParticipant.daily_id==daily_id){
  740. processDailyParticipant.isConfirmBtn=true; //放出隐藏确定按钮
  741. return false;
  742. }
  743. return true;
  744. });
  745. }
  746. let _this=this;
  747. this.processDailyParticipants.every(function (processDailyParticipant,i) {
  748. if(processDailyParticipant.daily_id==daily_id){
  749. if (!processDailyParticipant_name&&_this.processDailyParticipants[i+1]&&_this.processDailyParticipants[i+1].daily_id)return false;
  750. if (!_this.processDailyParticipants[i+1])return false;
  751. _this.processDailyParticipants[i+1].rowspan=(processDailyParticipant.rowspan)-1;
  752. _this.processDailyParticipants[i+1].daily_id=processDailyParticipant.daily_id;
  753. _this.processDailyParticipants[i+1].date=processDailyParticipant.date;
  754. _this.processDailyParticipants[i+1].output=processDailyParticipant.output;
  755. _this.processDailyParticipants[i+1].remain=processDailyParticipant.remain;
  756. _this.processDailyParticipants[i+1].submitOutput=processDailyParticipant.submitOutput;
  757. _this.processDailyParticipants.splice(i,1);
  758. return false;
  759. }
  760. return true;
  761. });
  762. _this.isShow.isAddProcessDailyParticipant=true;
  763. },
  764. //驳回
  765. processReject(id){
  766. if(!confirm('确定驳回该单吗?')){return};
  767. let url="{{url('process/reject')}}"+"/"+id;
  768. let _this=this;
  769. axios.post(url)
  770. .then(function (response) {
  771. _this.processes.every(function (process) {
  772. if (process.id==response.data.id){
  773. process.status=response.data.status;
  774. return false;
  775. }
  776. return true;
  777. });
  778. tempTip.setDuration(3000);
  779. tempTip.showSuccess('驳回成功!');
  780. }).catch(function (err) {
  781. tempTip.setDuration(5000);
  782. tempTip.show('驳回二次加工单发生了一些严重错误:'+err);
  783. })
  784. },
  785. //接单
  786. processReceive(id){
  787. let url="{{url('process/receive')}}"+"/"+id;
  788. let _this=this;
  789. axios.post(url)
  790. .then(function (response) {
  791. _this.processes.every(function (process) {
  792. if (process.id==response.data.id){
  793. process.status=response.data.status;
  794. return false;
  795. }
  796. return true;
  797. });
  798. tempTip.setDuration(3000);
  799. tempTip.showSuccess('接单成功!');
  800. }).catch(function (err) {
  801. tempTip.setDuration(5000);
  802. tempTip.show('接单时发生了一些严重错误:'+err);
  803. })
  804. },
  805. //完成
  806. processAccomplish(id){
  807. if(!confirm('确定完成验收吗?')){return};
  808. let url="{{url('process/accomplish')}}"+"/"+id;
  809. let _this=this;
  810. axios.post(url)
  811. .then(function (response) {
  812. _this.processes.every(function (process) {
  813. if (process.id==response.data.id){
  814. process.status=response.data.status;
  815. process.completed_amount=response.data.completed_amount;
  816. return false;
  817. }
  818. return true;
  819. });
  820. tempTip.setDuration(3000);
  821. tempTip.showSuccess('验收完成!');
  822. }).catch(function (err) {
  823. tempTip.setDuration(5000);
  824. tempTip.show('验收时发生了一些严重错误:'+err);
  825. })
  826. },
  827. //定位客户
  828. owner_seek:function (e) {
  829. let _this=this;
  830. let $val=e.target.value;
  831. if($val==='')_this.filterData.owner_id='';
  832. else
  833. _this.owners.forEach(function (owner) {
  834. if (owner.name.includes($val)){
  835. _this.filterData.owner_id=owner.id;
  836. }
  837. });
  838. },
  839. //修改每日产量
  840. submitOutputData(daily_id,data,id){
  841. let url="{{url('process/updateDailyOutput')}}";
  842. let _this=this;
  843. axios.post(url,{id:daily_id,output:data})
  844. .then(function (response) {
  845. if (response.data.status=="error"){
  846. tempTip.setDuration(3000);
  847. tempTip.show('输入有误:'+response.data.data.output);
  848. }
  849. if (response.data.status=="success"){
  850. let processDailies=response.data.data;
  851. _this.processDailyParticipants.every(function (processDailyParticipant) {
  852. if (processDailyParticipant.id==id) {
  853. processDailyParticipant.readonly=true;
  854. }
  855. processDailies.every(function (processDaily) {
  856. if (processDailyParticipant.date==processDaily.date){
  857. processDailyParticipant.output=processDaily.output;
  858. processDailyParticipant.remain=processDaily.remain;
  859. return false;
  860. }
  861. return true;
  862. });
  863. return true;
  864. });
  865. if (response.data.process) {
  866. _this.processes.every(function (process) {
  867. if(process.id==response.data.process){
  868. process.status="待验收";
  869. return false;
  870. }
  871. return true;
  872. });
  873. }
  874. tempTip.setDuration(3000);
  875. tempTip.showSuccess('每日产量修改成功!');
  876. }
  877. }).catch(function (err) {
  878. tempTip.setDuration(5000);
  879. tempTip.show('修改每日产量发生了一些严重错误:'+err);
  880. });
  881. },
  882. //验证临时工
  883. verifyUserName(e,daily_id,isConfirmBtn){
  884. let user=e.target.value;
  885. let _this=this;
  886. axios.post('{{url('process/verifyUserName')}}',{userName:user})
  887. .then(function (response) {
  888. //修改时验证
  889. if (!daily_id){
  890. //验证失败
  891. if(response.data.length<1){
  892. _this.isShow.isUpdateConfirmBtn=false;
  893. _this.errors['user_id']="查无此人,请检查您的输入";
  894. return;
  895. }
  896. //验证成功且结果仅有一个
  897. if (response.data.user_id){
  898. _this.isShow.isUpdateConfirmBtn=true;
  899. _this.errors['user_id']="";
  900. _this.processDailyParticipantOne.user_id=response.data.user_id;
  901. return;
  902. }
  903. //验证成功多结果
  904. if (response.data.length>1){
  905. _this.userLabors=response.data;
  906. $("#myModal").modal('show');
  907. return;
  908. }
  909. }
  910. //验证失败
  911. if(response.data.length<1){
  912. _this.processDailyParticipants.every(function (processDailyParticipant) {
  913. if(processDailyParticipant.daily_id==daily_id){
  914. _this.errors['user_id']="查无此人,请检查您的输入";
  915. setTimeout(function(){
  916. $(".tooltipTargetError").tooltip('show');
  917. },1);
  918. processDailyParticipant.isConfirmBtn=false; //验证失败隐藏确定按钮
  919. return false;
  920. }
  921. return true;
  922. });
  923. return;
  924. }
  925. //按钮被隐藏则放出
  926. if (!isConfirmBtn){
  927. _this.processDailyParticipants.every(function (processDailyParticipant) {
  928. if(processDailyParticipant.daily_id==daily_id){
  929. processDailyParticipant.isConfirmBtn=true; //验证失败隐藏确定按钮
  930. return false;
  931. }
  932. return true;
  933. });
  934. }
  935. _this.modalDaily_id=daily_id;
  936. //验证成功且结果仅有一个
  937. if (response.data.user_id){
  938. _this.errors['user_id']="";
  939. $("#"+daily_id+"user_id").val(response.data.user_id);
  940. $("#"+daily_id+"hour_price").val(response.data.user_labor.default_hour_price);
  941. }
  942. //验证成功多结果
  943. if (response.data.length>1){
  944. _this.userLabors=response.data;
  945. $("#myModal").modal('show');
  946. }
  947. }).catch(function (err) {
  948. tempTip.setDuration(5000);
  949. tempTip.show('验证临时工发生了一些严重错误:'+err);
  950. })
  951. },
  952. //验证时间合法性
  953. hourFilter(e){
  954. datetimeRelating.verifyTime(e);
  955. },
  956. //提交参与人
  957. submitProcessDailyParticipant(e){
  958. let request={};
  959. request['user_id']=$("#"+e+"user_id").val();
  960. request['started_at']=$("#"+e+"started_at").val();
  961. request['ended_at']=$("#"+e+"ended_at").val();
  962. let hour_price=$("#"+e+"hour_price").val();
  963. if (hour_price) request['hour_price']=hour_price;
  964. let unit_price=$("#"+e+"unit_price").val();
  965. if (unit_price) request['unit_price']=unit_price;
  966. let dinner_duration=$("#"+e+"dinner_duration").val();
  967. if (dinner_duration) request['dinner_duration']=dinner_duration;
  968. let hour_count=$("#"+e+"hour_count").val();
  969. if (hour_count) request['hour_count']=hour_count;
  970. let unit_count=$("#"+e+"unit_count").val();
  971. if (unit_count) request['unit_count']=unit_count;
  972. let remark=$("#"+e+"remark").val();
  973. if (remark) request['remark']=remark;
  974. request['daily_id']=this.modalDaily_id;
  975. let _this=this;
  976. axios.post("{{url('process/shortProcessDailyParticipant')}}", request)
  977. .then(function (response) {
  978. if (response.data.status=="error"){
  979. tempTip.setDuration(3000);
  980. _this.errors=response.data.data;
  981. setTimeout(function(){
  982. $(".tooltipTargetError").tooltip('show');
  983. },1);
  984. return;
  985. }
  986. if (response.data.status=="success"){
  987. _this.processDailyParticipants.every(function (processDailyParticipant) {
  988. if (processDailyParticipant.daily_id==e){
  989. processDailyParticipant.id=response.data.data.id;
  990. processDailyParticipant.status=response.data.data.status;
  991. processDailyParticipant.user_detail_full_name=response.data.data.user_detail_full_name;
  992. processDailyParticipant.user_id=response.data.data.user_id;
  993. processDailyParticipant.started_at=response.data.data.started_at;
  994. processDailyParticipant.ended_at=response.data.data.ended_at;
  995. processDailyParticipant.hour_price=response.data.data.hour_price;
  996. processDailyParticipant.unit_price=response.data.data.unit_price;
  997. processDailyParticipant.dinner_duration=response.data.data.dinner_duration;
  998. processDailyParticipant.hour_count=response.data.data.hour_count;
  999. processDailyParticipant.unit_count=response.data.data.unit_count;
  1000. processDailyParticipant.remark=response.data.data.remark;
  1001. processDailyParticipant.hour=response.data.data.hour;
  1002. processDailyParticipant.diff=response.data.data.diff;
  1003. processDailyParticipant.billingHour=response.data.data.billingHour;
  1004. processDailyParticipant.isAddProcessDailyParticipant=true;
  1005. _this.isShow.isAddProcessDailyParticipant=true;
  1006. return false;
  1007. }
  1008. return true;
  1009. });
  1010. if (response.data.process){
  1011. _this.processes.every(function (process) {
  1012. if (process.id==response.data.process){
  1013. process.status="加工中";
  1014. return false;
  1015. }
  1016. return true;
  1017. });
  1018. }
  1019. tempTip.setDuration(3000);
  1020. tempTip.showSuccess('参与人新增成功!');
  1021. }
  1022. }).catch(function (err) {
  1023. tempTip.setDuration(5000);
  1024. tempTip.show('新增参与人发生了一些严重错误:'+err);
  1025. })
  1026. },
  1027. //同名临时工选择
  1028. selectedUser(user_id,hour_price){
  1029. $("#myModal").modal('hide');
  1030. this.errors['user_id']="";
  1031. this.processDailyParticipantOne['user_id']=user_id;
  1032. this.processDailyParticipantOne['hour_price']=hour_price;
  1033. this.isShow.isUpdateConfirmBtn=true;
  1034. $("#"+this.modalDaily_id+"user_id").val(user_id);
  1035. $("#"+this.modalDaily_id+"hour_price").val(hour_price);
  1036. },
  1037. //修改参与人
  1038. updateProcessDailyParticipant(processDailyParticipant){
  1039. this.errors={};
  1040. this.processDailyParticipantOne['id']=processDailyParticipant.id;
  1041. this.processDailyParticipantOne['user_detail_full_name']=processDailyParticipant.user_detail_full_name;
  1042. this.processDailyParticipantOne['user_id']=processDailyParticipant.user_id;
  1043. this.processDailyParticipantOne['started_at']=processDailyParticipant.started_at;
  1044. this.processDailyParticipantOne['ended_at']=processDailyParticipant.ended_at;
  1045. this.processDailyParticipantOne['hour_price']=processDailyParticipant.hour_price;
  1046. this.processDailyParticipantOne['unit_price']=processDailyParticipant.unit_price;
  1047. this.processDailyParticipantOne['dinner_duration']=processDailyParticipant.dinner_duration;
  1048. this.processDailyParticipantOne['hour_count']=processDailyParticipant.hour_count;
  1049. this.processDailyParticipantOne['unit_count']=processDailyParticipant.unit_count;
  1050. this.processDailyParticipantOne['remark']=processDailyParticipant.remark;
  1051. $("#updateModal").modal('show');
  1052. },
  1053. //提交修改
  1054. submitUpdateProcessDailyParticipant(){
  1055. let _this=this;
  1056. axios.post("{{url('process/updateProcessDailyParticipant')}}",this.processDailyParticipantOne)
  1057. .then(function (response) {
  1058. if (response.data.status=="error"){
  1059. tempTip.setDuration(3000);
  1060. _this.errors=response.data.data;
  1061. }
  1062. if (response.data.status=="success"){
  1063. _this.processDailyParticipants.every(function (processDailyParticipant) {
  1064. if (processDailyParticipant.id==response.data.data.id){
  1065. processDailyParticipant.status=response.data.data.status;
  1066. processDailyParticipant.user_detail_full_name=response.data.data.user_detail_full_name;
  1067. processDailyParticipant.started_at=response.data.data.started_at;
  1068. processDailyParticipant.ended_at=response.data.data.ended_at;
  1069. processDailyParticipant.hour_price=response.data.data.hour_price;
  1070. processDailyParticipant.unit_price=response.data.data.unit_price;
  1071. processDailyParticipant.dinner_duration=response.data.data.dinner_duration;
  1072. processDailyParticipant.hour_count=response.data.data.hour_count;
  1073. processDailyParticipant.unit_count=response.data.data.unit_count;
  1074. processDailyParticipant.remark=response.data.data.remark;
  1075. processDailyParticipant.hour=response.data.data.hour;
  1076. processDailyParticipant.diff=response.data.data.diff;
  1077. processDailyParticipant.billingHour=response.data.data.billingHour;
  1078. processDailyParticipant.isAddProcessDailyParticipant=true;
  1079. return false;
  1080. }
  1081. return true;
  1082. });
  1083. tempTip.setDuration(3000);
  1084. tempTip.showSuccess('参与人修改成功!');
  1085. $("#updateModal").modal('hide');
  1086. }
  1087. }).catch(function (err) {
  1088. tempTip.setDuration(5000);
  1089. tempTip.show('修改参与人发生了一些严重错误:'+err);
  1090. })
  1091. },
  1092. //登记工时参与人审核
  1093. processDailyParticipantAudit(id){
  1094. if(!confirm('审核后不能撤销及修改,确定通过审核吗?')){return};
  1095. let _this=this;
  1096. axios.post("{{url('process/processDailyParticipantAudit')}}"+"/"+id)
  1097. .then(function (response) {
  1098. if (response.data.success){
  1099. _this.processDailyParticipants.every(function (processDailyParticipant) {
  1100. if (processDailyParticipant.id==response.data.processDailyParticipant.id){
  1101. processDailyParticipant.status=response.data.processDailyParticipant.status;
  1102. return false;
  1103. }
  1104. return true;
  1105. });
  1106. tempTip.setDuration(3000);
  1107. tempTip.showSuccess('参与人审核通过!');
  1108. return;
  1109. }
  1110. tempTip.setDuration(3000);
  1111. tempTip.show('参与人失败!');
  1112. }).catch(function (err) {
  1113. tempTip.setDuration(5000);
  1114. tempTip.show('审核参与人发生了一些严重错误:'+err);
  1115. });
  1116. },
  1117. //临时工详情
  1118. showUserDetail(id){
  1119. window.open("{{url('maintenance/userLabor')}}/"+id);
  1120. },
  1121. //显示教程
  1122. showTutorial(id) {
  1123. axios.post('{{url('maintenance/tutorial/showContent')}}'+"/"+id)
  1124. .then(function (response) {
  1125. if (response.data.success){
  1126. $("#content").html(response.data.data);
  1127. $("#showTutorial").modal('show');
  1128. }
  1129. }).catch(function (err) {
  1130. tempTip.setDuration(3000);
  1131. tempTip.show('获取教程失败!'+'网络错误:' + err);
  1132. });
  1133. },
  1134. //新增教程
  1135. addTutorials(id,owner_id){
  1136. let _this=this;
  1137. axios.post('{{url('process/getTutorials')}}'+"/"+id)
  1138. .then(function (response) {
  1139. if(response.data.success){
  1140. _this.processTutorial.id=id;
  1141. _this.processTutorial.owner_id=owner_id;
  1142. _this.processTutorial.tutorials=response.data.data;
  1143. $("#addTutorial").modal("show");
  1144. return;
  1145. }
  1146. tempTip.setDuration(3000);
  1147. tempTip.show('获取教程失败!未知错误:'+response.data );
  1148. }).catch(function (err) {
  1149. tempTip.setDuration(3000);
  1150. tempTip.show('获取教程失败!'+'网络错误:' + err);
  1151. });
  1152. },
  1153. //选择教程
  1154. selectedTutorial(process_id,tutorial_id){
  1155. let _this=this;
  1156. axios.post('{{url('process/selectedTutorial')}}',{process_id:process_id,tutorial_id,tutorial_id})
  1157. .then(function (response) {
  1158. if (response.data.success){
  1159. _this.processes.every(function (process) {
  1160. if (process.id==process_id){
  1161. process.tutorials.push(response.data.data);
  1162. return false;
  1163. }
  1164. return true;
  1165. });
  1166. $("#addTutorial").modal("hide");
  1167. tempTip.setDuration(3000);
  1168. tempTip.showSuccess('添加成功!');
  1169. return;
  1170. }
  1171. tempTip.setDuration(3000);
  1172. tempTip.show('添加教程失败!发生错误:' + response.data.data);
  1173. }).catch(function (err) {
  1174. tempTip.setDuration(3000);
  1175. tempTip.show('添加教程失败!'+'网络错误:' + err);
  1176. });
  1177. },
  1178. //删除教程
  1179. deleteTutorials(process_id,tutorial_id){
  1180. let _this=this;
  1181. axios.post('{{url('process/deleteTutorial')}}',{process_id:process_id,tutorial_id,tutorial_id})
  1182. .then(function (response) {
  1183. if (response.data.success){
  1184. _this.processes.every(function (process) {
  1185. if (process.id==process_id){
  1186. process.tutorials.every(function (tutorial,i) {
  1187. if (tutorial.id==tutorial_id) {
  1188. process.tutorials.splice(i,1)
  1189. return false;
  1190. }
  1191. return true;
  1192. });
  1193. return false;
  1194. }
  1195. return true;
  1196. });
  1197. tempTip.setDuration(3000);
  1198. tempTip.showSuccess('删除成功!');
  1199. return;
  1200. }
  1201. tempTip.setDuration(3000);
  1202. tempTip.show('删除教程失败!发生错误:' + response.data.data);
  1203. }).catch(function (err) {
  1204. tempTip.setDuration(3000);
  1205. tempTip.show('删除教程失败!'+'网络错误:' + err);
  1206. } );
  1207. },
  1208. processEdit(id){
  1209. location.href = "{{url('process')}}/"+id+"/edit";
  1210. },
  1211. //去往新增教程
  1212. addTutorial(){
  1213. window.open("{{url('maintenance/tutorial/create?owner_id=')}}"+this.processTutorial.owner_id);
  1214. }
  1215. },
  1216. });
  1217. </script>
  1218. @endsection