index.blade.php 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467
  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 mt-3">
  9. <div>
  10. <form method="GET" action="{{url('process/')}}" style="margin-top: 1%" id="optionSubmit">
  11. <table class="table table-sm table-bordered text-nowrap ">
  12. <tr v-if="isBeingFilterConditions">
  13. <td colspan="10">
  14. <div class="col" style="padding:0">
  15. <a href="{{url('process')}}"><span class="btn btn-warning text-dark">清除过滤条件</span></a>
  16. </div></td>
  17. </tr>
  18. <tr>
  19. <td>
  20. <span class="text-muted">每页显示记录:</span>
  21. </td>
  22. <td colspan="9">
  23. <select name="paginate" v-model="filterData.paginate" class="tooltipTarget form-control-sm" style="vertical-align: middle" @change="submit">
  24. <option value="50">50行</option>
  25. <option value="100">100行</option>
  26. <option value="200">200行</option>
  27. <option value="500">500行</option>
  28. <option value="1000">1000行</option>
  29. </select></td>
  30. </tr>
  31. <tr>
  32. <td rowspan="2" >
  33. <span class="text-muted">根据条件过滤:</span>
  34. </td>
  35. <td >
  36. <label for="date_start" style="width: 35px">时间:</label>
  37. <input id="date_start" name="date_start" v-model="filterData.date_start" type="date" class="form-control-sm ">
  38. </td>
  39. <td >
  40. <label>&nbsp;客&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;户&nbsp;:</label>
  41. <input type="text" class="form-control-sm tooltipTarget" placeholder="查找"
  42. style="width:70px" {{--@input="owner_seek"--}}
  43. title="输入关键词快速定位下拉列表,回车确定">
  44. <select name="owner_id" v-model="filterData.owner_id" @change="submit" class="form-control-sm tooltipTarget">
  45. <option > </option>
  46. <option v-for="owner in owners" :value="owner.id">@{{owner.name}}</option>
  47. </select>
  48. </td>
  49. <td>
  50. <label for="wms_code">单据号:</label>
  51. <input id="wms_code" name="wms_code" v-model="filterData.wms_code" class="form-control-sm">
  52. </td>
  53. <td colspan="6"></td>
  54. </tr>
  55. <tr>
  56. <td >
  57. <label for="date_end" style="width: 35px"></label>
  58. <input id="date_end" name="date_end" v-model="filterData.date_end" type="date" class="form-control-sm ">
  59. </td>
  60. <td>
  61. <label>商品条码:</label>
  62. <input name="commodity_barcode" v-model="filterData.commodity_barcode" class="form-control-sm">
  63. </td>
  64. <td >
  65. <label for="status">&nbsp;状&nbsp;&nbsp;态&nbsp;:</label>
  66. <select id="status" name="status" v-model="filterData.status" @change="submit" class="form-control-sm tooltipTarget">
  67. <option > </option>
  68. <option value="待接单">待接单</option>
  69. <option value="待加工">待加工</option>
  70. <option value="驳回">驳回</option>
  71. <option value="加工中">加工中</option>
  72. <option value="待验收">待验收</option>
  73. <option value="已完成">已完成</option>
  74. </select>
  75. </td>
  76. <td colspan="6"></td>
  77. </tr>
  78. <tr>
  79. <td>
  80. <span class="text-muted">操作选定记录:</span>
  81. </td>
  82. <td colspan="9">
  83. <span class="dropdown">
  84. <button class="btn btn-outline-dark btn-sm form-control-sm dropdown-toggle tooltipTarget" :class="[checkData>0?'btn-dark text-light':'']"
  85. data-toggle="dropdown" title="导出所有页将会以搜索条件得到的过滤结果,将其全部记录(每一页)导出">
  86. 导出Excel
  87. </button>
  88. <div class="dropdown-menu">
  89. <a class="dropdown-item" @click="processExport(1)" href="javascript:">导出勾选内容</a>
  90. <a class="dropdown-item" @click="processExport(2)" href="javascript:">导出所有页</a>
  91. </div>
  92. </span>
  93. <input hidden type="submit" >
  94. </td>
  95. </tr>
  96. </table>
  97. </form>
  98. </div>
  99. <div>
  100. <table class="table table-striped table-sm text-nowrap table-hover">
  101. <tr>
  102. <th>
  103. <label for="all">
  104. <input id="all" type="checkbox" @click="checkAll($event)">全选
  105. </label>
  106. </th>
  107. <th>序号</th>
  108. <th >操作</th>
  109. <th>任务号</th>
  110. <th>货主</th>
  111. <th>单据类型</th>
  112. <th>单据号</th>
  113. <th>加工类型</th>
  114. <th>预期数量</th>
  115. <th class="text-center">教程</th>
  116. <th>单价</th>
  117. <th>提交日期</th>
  118. <th>商品编码</th>
  119. <th>商品名称 </th>
  120. <th>实际数量</th>
  121. <th>状态</th>
  122. </tr>
  123. <tr v-for="(processOne,i) in processes" :id="processOne.id">
  124. <td>
  125. <input class="checkItem" type="checkbox" :value="processOne.id" v-model="checkData">
  126. </td>
  127. <td class="text-muted">@{{ i+1 }}</td>
  128. <td >
  129. <p v-if="!processOne.openProcessHour && processOne.status=='驳回'" class="text-muted">已驳回</p>
  130. <p v-if="!processOne.openProcessHour && processOne.status=='已完成'" class="text-success">已完成</p>
  131. <button v-if="!processOne.openProcessHour && processOne.status=='待接单'" @click="processReject(processOne.id)" class="btn-sm btn-outline-dark pull-left">驳回</button>
  132. <button v-if="!processOne.openProcessHour && processOne.status=='待接单'" @click="processReceive(processOne.id)" class="btn-sm btn-outline-primary pull-left">接单</button>
  133. <button v-if="(processOne.status=='加工中' || processOne.status=='待加工') && !processOne.openProcessHour"
  134. class="btn-sm btn-outline-info pull-left" @click="openProcessHour(processOne.id);processOne.openProcessHour=true;processOne.detailFolding=false">登记工时</button>
  135. <button v-if="processOne.openProcessHour" @click="closeProcessHour(processOne.id);processOne.openProcessHour=false" class="btn-sm btn-dark pull-left">收起登记工时</button>
  136. <button v-if="!processOne.openProcessHour && processOne.status=='待验收'" @click="processAccomplish(processOne.id)" class="btn-sm btn-outline-success pull-left">完成</button>
  137. </td>
  138. <td class="text-muted">@{{ processOne.code }}</td>
  139. <td class="text-muted">@{{ processOne.owner_name }}</td>
  140. <td class="text-muted">@{{ processOne.bill_type }}</td>
  141. <td class="text-muted">@{{ processOne.wms_code }}</td>
  142. <td >@{{ processOne.process_method_name }}</td>
  143. <td>@{{ processOne.amount }}</td>
  144. <td>
  145. <div class="text-center">
  146. <div v-if=" processOne.tutorials.length>1">
  147. <a href="javascript:;" @click="processOne.detailFolding=true;processOne.openProcessHour=false;closeProcessHour(processOne.id)" v-if="!processOne.detailFolding">@{{processOne.tutorials.length}}个教程,点击展开明细</a>
  148. <button class="btn-sm btn-outline-dark pull-left" href="javascript:;" @click="processOne.detailFolding=false" v-else>收起编辑</button>
  149. <table class="table table-sm" v-if="processOne.detailFolding">
  150. <tr>
  151. <th>标题</th>
  152. <th>货主</th>
  153. <th>操作</th>
  154. <th>创建时间</th>
  155. </tr>
  156. <tr v-for="(tutorial,i) in processOne.tutorials">
  157. <td class="text-info">@{{tutorial.name}}</td>
  158. <td >@{{tutorial.owner_name}}</td>
  159. <td>@can('二次加工管理-教程管理')@endcan</td>
  160. <td >@{{tutorial.created_at}}</td>
  161. </tr>
  162. <tr>
  163. <td colspan="4">
  164. <button class="btn btn-info pull-left">新增或编辑关联教程</button>
  165. </td>
  166. </tr>
  167. </table>
  168. </div>
  169. <div v-if="processOne.tutorials.length==1 && !processOne.detailFolding">
  170. <a v-for="tutorial in processOne.tutorials" class="text-info">@{{tutorial.name}}</a>
  171. <button class="btn-sm btn-outline-info pull-right">改</button>
  172. <button class="btn-sm btn-outline-dark pull-right" >删</button>
  173. </div>
  174. </div>
  175. </td>
  176. <td class="text-muted">@{{ processOne.unit_price }}</td>
  177. <td>@{{ processOne.created_at }}</td>
  178. <td class="text-muted">@{{ processOne.commodity_barcode }}</td>
  179. <td class="text-muted">@{{ processOne.commodity_name }}</td>
  180. <td>@{{ processOne.completed_amount }}</td>
  181. <td class="text-muted">@{{ processOne.status }}</td>
  182. </tr>
  183. <tr v-if="processDailyParticipants.length>0">
  184. <td colspan="2"></td>
  185. <td colspan="16">
  186. <table class="table-sm table-bordered table-condensed">
  187. <tr class="bg-success">
  188. <td>日期</td><td>当日产量</td>
  189. <td>当日剩余</td>
  190. <td colspan="2">操作</td>
  191. <td>参与者</td>
  192. <td>开始时间</td>
  193. <td>结束时间</td>
  194. <td>计时工资</td>
  195. <td>计件工资</td>
  196. <td>晚饭时间</td>
  197. <td>计时工时</td>
  198. <td>备注</td>
  199. <td>打卡工时</td>
  200. <td>工时差</td>
  201. <td>计费工时</td>
  202. <td>计件数量</td>
  203. <td>审核</td>
  204. <td>详情</td>
  205. </tr>
  206. <tr v-for="processDaily in processDailyParticipants" :id="'processDaily'+processDaily.id">
  207. <td v-if="processDaily.rowspan" :rowspan="processDaily.rowspan"><p v-if="processDailies[processDaily.id]">@{{ processDailies[processDaily.id].time }}</p></td>
  208. <td v-if="processDaily.rowspan" :rowspan="processDaily.rowspan"><p v-if="processDailies[processDaily.id]">@{{ processDailies[processDaily.id].output }}</p></td>
  209. <td v-if="processDaily.rowspan" :rowspan="processDaily.rowspan"><p v-if="processDailies[processDaily.id]">@{{ processDailies[processDaily.id].remain }}</p></td>
  210. <td v-if="processDaily.rowspan" :rowspan="processDaily.rowspan">
  211. <button v-if="isAddProcessDailyParticipant" class="btn btn-sm btn-info" @click="addProcessDailyParticipant(processDaily.id);isAddProcessDailyParticipant=false;">新增</button>
  212. <button v-if="!isAddProcessDailyParticipant" class="btn btn-sm btn-info" @click="addProcessDailyParticipant(processDaily.id);isAddProcessDailyParticipant=true;">取消</button>
  213. </td>
  214. <td></td>
  215. <td>@{{ processDaily.user_name }}</td>
  216. <td>@{{ processDaily.started_at }}</td>
  217. <td>@{{ processDaily.ended_at }}</td>
  218. <td>@{{ processDaily.hour_price }}</td>
  219. <td>@{{ processDaily.unit_price }}</td>
  220. <td>@{{ processDaily.dinner_duration }}</td>
  221. <td>@{{ processDaily.hour_count }}</td>
  222. <td>@{{ processDaily.remark }}</td>
  223. <td>@{{ processDaily.hour }}</td>
  224. <td>@{{ processDaily.diff }}</td>
  225. <td>@{{ processDaily.billingHour }}</td>
  226. <td>@{{ processDaily.unit_count }}</td>
  227. <td>审核</td>
  228. <td>详情</td>
  229. </tr>
  230. </table>
  231. </td>
  232. </tr>
  233. </table>
  234. </div>
  235. </div>
  236. </div>
  237. @endsection
  238. @section('lastScript')
  239. <script>
  240. new Vue({
  241. el:"#process",
  242. data:{
  243. processes:[
  244. @foreach($processes as $processOne)
  245. {id:'{{$processOne->id}}',code:'{{$processOne->code}}',owner_name:'{{$processOne->owner_name}}',bill_type:'{{$processOne->bill_type}}'
  246. ,wms_code:'{{$processOne->wms_code}}',process_method_name:'{{$processOne->process_method_name}}',amount:'{{$processOne->amount}}'
  247. ,tutorials:{!! $processOne->tutorials !!},unit_price:'{{$processOne->unit_price}}',created_at:'{{$processOne->created_at}}'
  248. ,commodity_barcode:'{{$processOne->commodity_barcode}}',commodity_name:'{{$processOne->commodity_name}}',
  249. completed_amount:'{{$processOne->completed_amount}}',status:'{{$processOne->status}}',detailFolding:false,openProcessHour:false,},
  250. @endforeach
  251. ],
  252. owners:[
  253. @foreach($owners as $owner)
  254. {!! $owner !!},
  255. @endforeach
  256. ],
  257. checkData:[],
  258. filterData:{paginate:50,date_start:'',date_end:'',owner_id:'',commodity_barcode:'',wms_code:'',status:''},
  259. processDailies:[],
  260. processDailyParticipants:[],
  261. isAddProcessDailyParticipant:true,
  262. },
  263. watch:{
  264. checkData:{
  265. handler(){
  266. if (this.checkData.length === this.processes.length){
  267. document.querySelector('#all').checked = true;
  268. }else {
  269. document.querySelector('#all').checked = false;
  270. }
  271. },
  272. deep:true
  273. }
  274. },
  275. computed:{
  276. isBeingFilterConditions:function(){
  277. for(let key in this.filterData){
  278. if(this.filterData[key]){
  279. if(key==='paginate')continue;
  280. return true
  281. }
  282. }
  283. return false;
  284. },
  285. },
  286. mounted:function () {
  287. this.initInputs();
  288. $(".tooltipTarget").tooltip({'trigger':'hover'});
  289. $('#process').removeClass('d-none');
  290. },
  291. methods:{
  292. //回显条件参数
  293. initInputs:function(){
  294. let data=this;
  295. let uriParts =decodeURI(location.href).split("?");
  296. if(uriParts.length>1){
  297. let params = uriParts[1].split('&');
  298. params.forEach(function(paramPair){
  299. let pair=paramPair.split('=');
  300. let key = pair[0], val = pair[1];
  301. $('input[name="'+key+'"]').val(val);
  302. $('select[name="'+key+'"]').val(val);
  303. decodeURI(data.filterData[key]=val);
  304. });
  305. }
  306. },
  307. //提交表单
  308. submit:function(){
  309. let form = $("#optionSubmit");
  310. form.submit();
  311. },
  312. //全选事件
  313. checkAll(e){
  314. if (e.target.checked){
  315. this.processes.forEach((el,i)=>{
  316. if (this.checkData.indexOf(el.id) == '-1'){
  317. this.checkData.push(el.id);
  318. }
  319. });
  320. }else {
  321. this.checkData = [];
  322. }
  323. },
  324. //导出excel,因同步问题不使用formData
  325. processExport(e){
  326. let val=e;
  327. let data=this.filterData;
  328. if (val==1){
  329. if (this.checkData&&this.checkData.length<=0){
  330. tempTip.setDuration(4000);
  331. tempTip.showSuccess('没有勾选任何记录');
  332. }else{
  333. location.href="{{url('process?checkSign=')}}"+this.checkData;
  334. }
  335. } else {
  336. location.href="{{url('process?checkSign=-1&date_start=')}}"+
  337. data.date_start+"&date_end="+data.date_end+"&owner_id="+
  338. data.owner_id+"&commodity_barcode="+data.commodity_barcode+"&wms_code="+data.wms_code+
  339. "&status="+data.status;
  340. }
  341. },
  342. //获取登记工时
  343. openProcessHour(e){
  344. let _this=this;
  345. axios.post("{{url("process/getDailyParticipant")}}",{id:e})
  346. .then(function (response) {
  347. let processDailies=response.data;
  348. for (let i=0;i<processDailies.length;i++){
  349. let processDailyParticipants=processDailies[i].process_daily_participants;
  350. if (!processDailyParticipants)continue;
  351. for (let j=0;j<processDailyParticipants.length;j++){
  352. let data={};
  353. data['id']=processDailyParticipants[j].id;
  354. data['started_at']=processDailyParticipants[j].started_at;
  355. data['user_name']=processDailyParticipants[j].user_name;
  356. data['ended_at']=processDailyParticipants[j].ended_at;
  357. data['hour_price']=processDailyParticipants[j].hour_price;
  358. data['unit_price']=processDailyParticipants[j].unit_price;
  359. data['dinner_duration']=processDailyParticipants[j].dinner_duration;
  360. data['hour_count']=processDailyParticipants[j].hour_count;
  361. data['remark']=processDailyParticipants[j].remark;
  362. data['hour']=processDailyParticipants[j].hour;
  363. data['diff']=processDailyParticipants[j].diff;
  364. data['billingHour']=processDailyParticipants[j].billingHour;
  365. data['unit_count']=processDailyParticipants[j].unit_count;
  366. data['process_id']=processDailies[i].process_id;
  367. if (!_this.processDailies[processDailies[i].id]){
  368. data['daily']=processDailies[i].id;
  369. data['rowspan']=processDailyParticipants.length;
  370. let obj={};
  371. obj['time']=processDailies[i].time;
  372. obj['output']=processDailies[i].output;
  373. obj['remain']=processDailies[i].remain;
  374. _this.processDailies[processDailies[i].id]=obj;
  375. }
  376. _this.processDailyParticipants.push(data);
  377. }
  378. }
  379. console.log(_this.processDailyParticipants)
  380. }).catch(function (err) {
  381. console.log(err)
  382. });
  383. },
  384. //删除工时显示
  385. closeProcessHour(e){
  386. this.processDailies=[];
  387. this.processDailyParticipants=[];
  388. },
  389. //新增参与人
  390. addProcessDailyParticipant(e){
  391. let html='<tr><td></td><td>@{{ processDaily.user_name}}</td>' +
  392. '<td>@{{ processDaily.started_at }}</td><td>@{{ processDaily.ended_at }}</td>' +
  393. '<td>@{{ processDaily.hour_price }}</td><td>@{{ processDaily.unit_price }}</td>' +
  394. '<td>@{{ processDaily.dinner_duration }}</td><td>@{{ processDaily.hour_count }}</td>' +
  395. '<td>@{{ processDaily.remark }}</td><td>@{{ processDaily.hour }}</td>' +
  396. '<td>@{{ processDaily.diff }}</td><td>@{{ processDaily.billingHour }}</td>' +
  397. '<td>@{{ processDaily.unit_count }}</td><td>审核</td>' +
  398. '<td>详情</td></tr>';
  399. this.processDailyParticipants.every(function (processDailyParticipant) {
  400. if (processDailyParticipant.id==e){
  401. processDailyParticipant.rowspan=(processDailyParticipant.rowspan)+1;
  402. return false;
  403. }
  404. return true;
  405. });
  406. $("#processDaily"+e).after(html);
  407. },
  408. //驳回
  409. processReject(id){
  410. let url="{{url('process/reject')}}"+"/"+id;
  411. let _this=this;
  412. axios.post(url)
  413. .then(function (response) {
  414. _this.processes.every(function (process) {
  415. if (process.id==response.data.id){
  416. process.status=response.data.status;
  417. return false;
  418. }
  419. return true;
  420. });
  421. }).catch(function (err) {
  422. console.log(err)
  423. })
  424. },
  425. //接单
  426. processReceive(id){
  427. let url="{{url('process/receive')}}"+"/"+id;
  428. let _this=this;
  429. axios.post(url)
  430. .then(function (response) {
  431. _this.processes.every(function (process) {
  432. if (process.id==response.data.id){
  433. process.status=response.data.status;
  434. return false;
  435. }
  436. return true;
  437. });
  438. }).catch(function (err) {
  439. console.log(err)
  440. })
  441. },
  442. //完成
  443. processAccomplish(id){
  444. let url="{{url('process/accomplish')}}"+"/"+id;
  445. let _this=this;
  446. axios.post(url)
  447. .then(function (response) {
  448. _this.processes.every(function (process) {
  449. if (process.id==response.data.id){
  450. process.status=response.data.status;
  451. return false;
  452. }
  453. return true;
  454. });
  455. }).catch(function (err) {
  456. console.log(err)
  457. })
  458. }
  459. },
  460. });
  461. </script>
  462. @endsection