index.blade.php 111 KB

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