index.blade.php 82 KB

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