index.blade.php 107 KB

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