index.blade.php 111 KB

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