index.blade.php 113 KB

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