index.blade.php 114 KB

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