index.blade.php 106 KB

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