index.blade.php 117 KB

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