| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530 |
- @extends('layouts.app')
- @section('title')查询-二次加工管理@endsection
- @section('content')
- <div class="d-none" id="process">
- <div class="container-fluid">
- <div id="form_div"></div>
- <span class="dropdown">
- <button class="btn btn-outline-dark btn-sm form-control-sm dropdown-toggle tooltipTarget"
- data-toggle="dropdown" title="导出所有页将会以搜索条件得到的筛选结果,将其全部记录(每一页)导出">
- 导出Excel
- </button>
- <div class="dropdown-menu">
- <a class="dropdown-item" @click="processExport(false)" href="javascript:">导出勾选内容</a>
- <a class="dropdown-item" @click="processExport(true)" href="javascript:">导出所有页</a>
- </div>
- </span>
- <!--新增教程关联-->
- <div style="top:25%" class="modal fade" id="addTutorial" tabindex="-1" role="dialog" aria-labelledby="addTutorial" aria-hidden="true">
- <div class="modal-dialog">
- <div class="modal-content">
- <div class="modal-header m-1 p-0">
- <button type="button" class="close pr-4" data-dismiss="modal" aria-hidden="true">×</button>
- </div>
- <div class="modal-body m-auto">
- <table class="table-sm">
- <tr>
- <th>标题</th>
- <th><button class="btn btn-sm btn-outline-primary" @click="addTutorial()">新增教程</button></th>
- </tr>
- <tr v-for="tutorial in processTutorial.tutorials">
- <td><div style="cursor:pointer;overflow: hidden;width: 200px" @click="showTutorial(tutorial.id)" :title="tutorial.name" class="text-primary">@{{tutorial.name}}</div></td>
- @can("二次加工管理-教程管理")<td><button @click="selectedTutorial(processTutorial.id,tutorial.id)" class="btn btn-sm btn-success pull-right">选择</button></td>@endcan
- </tr>
- </table>
- </div>
- </div><!-- /.modal-content -->
- </div><!-- /.modal -->
- </div>
- <!-- 显示教程-->
- <div class="modal fade" id="showTutorial" tabindex="-1" role="dialog" aria-labelledby="showTutorial" aria-hidden="true">
- <div class="modal-dialog">
- <div class="modal-content">
- <div class="modal-header">
- <button type="button" class="close pull-right" data-dismiss="modal" aria-hidden="true">×</button>
- </div>
- <div class="modal-body custom-rich-text-content" id="content"></div>
- <div class="modal-footer">
- <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
- </div>
- </div><!-- /.modal-content -->
- </div><!-- /.modal -->
- </div>
- <!-- 修改modal -->
- <div data-backdrop="static" class="modal fade" id="updateModal" tabindex="-1" role="dialog" aria-labelledby="updateModalLabel" aria-hidden="true">
- <div class="modal-dialog modal-dialog-centered" role="document">
- <div class="modal-content">
- <div class="modal-body">
- <div v-if="errors.user_id" class="row"><label class="col-3"></label><small class="text-danger col-7">@{{ errors.user_id }}</small></div>
- <div class="form-group row">
- <label for="initial_weight" class="col-3 col-form-label text-right">参与者</label>
- <div class="col-7">
- <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" >
- </div>
- </div>
- <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>
- <div class="form-group row">
- <label for="initial_weight" class="col-3 col-form-label text-right">开始时间</label>
- <div class="col-7">
- <input :class="{ 'is-invalid' : errors.started_at }" type="time" @input="hourFilter(processDailyParticipantOne,false)" class="form-control" autocomplete="off" v-model="processDailyParticipantOne.started_at" >
- </div>
- </div>
- <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>
- <div class="form-group row">
- <label for="initial_weight" class="col-3 col-form-label text-right">结束时间</label>
- <div class="col-7">
- <input :class="{ 'is-invalid' : errors.ended_at }" type="time" @input="hourFilter(processDailyParticipantOne,false)" class="form-control" autocomplete="off" v-model="processDailyParticipantOne.ended_at" >
- </div>
- </div>
- <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>
- <div class="form-group row">
- <label for="initial_weight" class="col-3 col-form-label text-right">计时单价</label>
- <div class="col-7">
- <input :class="{ 'is-invalid' : errors.hour_price }" type="text" class="form-control" autocomplete="off" v-model="processDailyParticipantOne.hour_price" >
- </div>
- </div>
- <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>
- <div class="form-group row">
- <label for="initial_weight" class="col-3 col-form-label text-right">计件单价</label>
- <div class="col-7">
- <input :class="{ 'is-invalid' : errors.unit_price }" type="text" class="form-control" autocomplete="off" v-model="processDailyParticipantOne.unit_price" >
- </div>
- </div>
- <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>
- <div class="form-group row">
- <label for="initial_weight" class="col-3 col-form-label text-right">晚饭时间</label>
- <div class="col-7">
- <select :class="{ 'is-invalid' : errors.dinner_duration }" :data-old-value="processDailyParticipantOne.dinner_duration" v-model="processDailyParticipantOne.dinner_duration"
- @change="updateDinnerDuration(processDailyParticipantOne,$event)" class="form-control">
- <option value="0">无</option>
- <option value="30">30分钟</option>
- <option value="60">60分钟</option>
- </select>
- </div>
- </div>
- <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>
- <div class="form-group row">
- <label for="initial_weight" class="col-3 col-form-label text-right">计时工时</label>
- <div class="col-7">
- <input :class="{ 'is-invalid' : errors.hour_count }" type="text" class="form-control" autocomplete="off" v-model="processDailyParticipantOne.hour_count" >
- </div>
- </div>
- <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>
- <div class="form-group row">
- <label for="initial_weight" class="col-3 col-form-label text-right">计件数量</label>
- <div class="col-7">
- <input :class="{ 'is-invalid' : errors.unit_count }" type="text" class="form-control" autocomplete="off" v-model="processDailyParticipantOne.unit_count" >
- </div>
- </div>
- <div class="form-group row">
- <label for="initial_weight" class="col-3 col-form-label text-right">备注</label>
- <div class="col-7">
- <input type="text" class="form-control" autocomplete="off" v-model="processDailyParticipantOne.remark" >
- </div>
- </div>
- </div>
- <div class="modal-footer">
- <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
- @can("二次加工管理-登记工时")<button v-if="isShow.isUpdateConfirmBtn" @click="submitUpdateProcessDailyParticipant()" class="btn btn-primary">提交更改</button>@endcan
- </div>
- </div><!-- /.modal-content -->
- </div><!-- /.modal -->
- </div>
- <!-- 多临时工选择(Modal) -->
- <div data-backdrop="static" style="top:25%" class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
- <div class="modal-dialog">
- <div class="modal-content" style="background-color: #d6e9f8">
- <div class="modal-body m-auto">
- <table class="table-sm">
- <tr>
- <th>姓名</th>
- <th>性别</th>
- <th>电话</th>
- <th>最近打卡时间</th>
- <th></th>
- </tr>
- <tr v-for="userLabor in userLabors" v-if="userLabor.user_labor">
- <td>@{{ userLabor.full_name }}</td>
- <td>@{{ userLabor.gender }}</td>
- <td>@{{ userLabor.mobile_phone }}</td>
- <td>@{{ userLabor.checked_at }}</td>
- <td><button @click="selectedUser(userLabor)" class="btn btn-sm btn-success">选择</button></td>
- </tr>
- </table>
- </div>
- </div><!-- /.modal-content -->
- </div><!-- /.modal -->
- </div>
- <table class="table table-sm text-nowrap table-bordered td-min-width-80" id="table">
- <template>
- <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'"
- :name="'process_table_'+i" @click="selectTr===i+1?(selectTr=0):selectTr=i+1">
- <td v-if="processOne.id" :rowspan="processOne.is_multi_row?2:''">
- <input class="checkItem" type="checkbox" :value="processOne.id">
- </td>
- <td v-if="processOne.id" class="text-muted" :rowspan="processOne.is_multi_row?2:''" >@{{ i+1 }}</td>
- <td v-if="processOne.id" style="min-width:200px;" :rowspan="processOne.is_multi_row?2:''">
- @can("二次加工管理-审核")
- <button v-if="!processOne.openProcessHour && (processOne.status=='待审核' || processOne.status=='已驳回')" class="btn btn-sm btn-outline-success" @click="audit(processOne)"><span>审核</span></button>@endcan
- @can("二次加工管理-回滚")
- <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
- @can("二次加工管理-质量验收")
- <button v-if="!processOne.openProcessHour && processOne.status=='待验收'" class="btn btn-sm btn-outline-success" @click="checkAndAccept(processOne)">质量验收</button>@endcan
- @can("二次加工管理-接单与驳回")
- <button v-if="!processOne.openProcessHour && processOne.status=='待接单'" @click="processReject(processOne.id)" class="btn btn-sm btn-outline-dark">驳回</button>
- <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
- @can("二次加工管理-登记工时")<button :style="[{opacity:processOne.status=='交接完成'?'0.7':''},{transform:processOne.status=='交接完成'?'scale(0.85)':''}]" v-if="(processOne.status!='待审核' && processOne.status!='已驳回' && processOne.status!='待接单') && !processOne.openProcessHour"
- class="btn btn-sm btn-outline-info" @click="openProcessHour(processOne);processOne.openProcessHour=true;processOne.detailFolding=false">登记工时</button>
- <button v-if="processOne.openProcessHour" @click="closeProcessHour(processOne.id);processOne.openProcessHour=false" class="btn btn-sm btn-dark">收起登记工时</button>
- <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
- @can("二次加工管理-交接完成")<button v-if="!processOne.openProcessHour && processOne.status=='待交接'" @click="accomplish(processOne)" class="btn btn-sm btn-outline-success" >交接完成</button>@endcan
- @can("二次加工管理-编辑")
- <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"
- style="opacity: 0.6">编辑</button>
- @endcan
- </td>
- <td v-if="processOne.id" :rowspan="processOne.is_multi_row?2:''"
- :class="processOne.status==='已驳回' ? 'text-danger' : (processOne.status==='交接完成' ? 'text-success font-weight-bold' : 'text-muted')">@{{ processOne.status }}</td>
- <td v-if="processOne.id" class="text-muted" :rowspan="processOne.is_multi_row?2:''">
- <button style="transform: scale(0.85);opacity: 0.8;" class="btn btn-sm btn-info" @click="show(processOne.id)">查看单据</button>
- @{{ processOne.code }}
- </td>
- <td v-if="processOne.id" class="text-muted" :rowspan="processOne.is_multi_row?2:''">
- <a href="#" v-if="processOne.operatorLogs.length>0" class="dropdown-toggle" data-toggle="dropdown">
- @{{ processOne.operatorLogs[0].user_name }}<b class="caret"></b>
- </a>
- <div style="position: absolute;width:320px;margin-left:-100px;background-color: white;max-height:150px ;overflow-y:auto" class="small mt-0 dropdown-menu">
- <table class="table table-sm table-striped table-bordered">
- <tr>
- <th>经手人</th>
- <th>操作</th>
- <th>时间</th>
- </tr>
- <tr v-for="operatorLog in processOne.operatorLogs">
- <td>@{{ operatorLog.user_name }}</td>
- <td class="text-danger font-weight-bold">@{{ operatorLog.operation }}</td>
- <td>@{{ operatorLog.created_at }}</td>
- </tr>
- </table>
- </div>
- </td>
- <td v-if="processOne.id" class="text-muted" :rowspan="processOne.is_multi_row?2:''">
- @{{ processOne.designate }}</td>
- <td v-if="processOne.id" class="text-muted" :rowspan="processOne.is_multi_row?2:''">@{{ processOne.owner_name }}</td>
- <td v-if="processOne.id" :rowspan="processOne.is_multi_row?2:''" class="font-weight-bold text-danger">@{{ processOne.process_method_name }}</td>
- <td v-if="processOne.id" :rowspan="processOne.is_multi_row?2:''">@{{ processOne.amount }}</td>
- <td v-if="processOne.id" :rowspan="processOne.is_multi_row?2:''">
- <div class="" v-if="processOne.tutorials">
- <div v-if=" processOne.tutorials.length>0">
- <u v-if="!processOne.detailFolding" @click="showTutorial(processOne.tutorials[0].id)" class="text-info" style="cursor:pointer;">@{{processOne.tutorials[0].name}}</u>
- <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>
- <div v-else><button class="btn btn-sm btn-outline-dark pull-left" href="javascript:;" @click="processOne.detailFolding=false" >收起编辑</button>
- <button @click="addTutorials(processOne.id,processOne.owner_id)" class="btn btn-sm btn-outline-info pull-left">新增关联教程</button></div>
- <table class="table table-sm" v-if="processOne.detailFolding">
- <tr>
- <th>标题</th>
- <th>操作</th>
- <th>创建时间</th>
- </tr>
- <tr v-for="(tutorial,i) in processOne.tutorials">
- <td class="text-info"><u :title="tutorial.name" @click="showTutorial(tutorial.id)" style="cursor:pointer;">@{{tutorial.name}}</u></td>
- <td>@can('二次加工管理-教程管理')
- <button @click="deleteTutorials(processOne.id,tutorial.id)" class="btn btn-sm btn-outline-danger pull-left" >删</button>
- @endcan</td>
- <td >@{{tutorial.created_at}}</td>
- </tr>
- </table>
- </div>
- <div v-if="processOne.tutorials.length<1">
- <button @click="addTutorials(processOne.id,processOne.owner_id)" class="btn btn-sm btn-outline-info pull-left" >新增关联教程</button>
- </div>
- </div>
- </td>
- <td v-if="processOne.id" class="text-muted" :rowspan="processOne.is_multi_row?2:''">
- @can('二次加工管理-修改价格')
- <div v-if="processOne.status=='交接完成'">
- <div v-if="processOne.signs.length<=0">
- <div v-if="processOne.is_update_unit_price" >
- <input type="text" :value="processOne.unit_price"
- :id="'unit_price_'+processOne.id" class="form-control form-control-sm" style="min-width: 50px;">
- <button type="button" class="btn btn-sm btn-outline-success" @click="updateUnitPrice(processOne)">确定</button>
- <button type="button" class="btn btn-sm btn-outline-danger" @click="processOne.is_update_unit_price=false;">取消</button>
- </div>
- <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">
- </div>
- <div v-else @mouseleave="processOne.is_update_unit_price=false;" @mouseenter="processOne.is_update_unit_price=true;">
- <span class="flicker" style="cursor: move">@{{ processOne.signUnitPrice ? processOne.signUnitPrice : processOne.unit_price }}</span>
- <div v-if="processOne.is_update_unit_price" style="position: absolute;width: 150px;background-color: white;white-space: normal;margin-left: -50px"
- @mouseleave="processOne.is_update_unit_price=false;" @mouseenter="processOne.is_update_unit_price=true;">
- <p class="text-center text-dark font-weight-bold">待确认</p>
- @can('二次加工管理-组长确认')<button v-if="!signs[processOne.code]['二次加工组确认']" class="btn btn-sm btn-outline-success" @click="verify(processOne,'workGroup')">组长确认</button>@endcan
- @can('二次加工管理-财务确认')<button v-if="!signs[processOne.code]['财务确认']" class="btn btn-sm btn-outline-success" @click="verify(processOne,'accountant')">财务确认</button>@endcan
- </div>
- </div>
- </div>
- <div v-else>@{{ processOne.unit_price }} </div>
- @endcan
- @cannot('二次加工管理-修改价格') @{{ processOne.unit_price }}@endcannot
- </td>
- <td v-if="processOne.id" :rowspan="processOne.is_multi_row?2:''">@{{ processOne.completed_amount }}</td>
- <td v-if="processOne.id" :rowspan="processOne.is_multi_row?2:''">@{{ processOne.created_at }}</td>
- <td style="margin:0;padding:0;position: relative;min-width: 900px">
- <div class="w-100" v-if="processUnfold[processOne.code+processOne.id] || processOne.processesContents.length==1 ||
- (processOne.is_multi_row && (processOne.processesContents.length)-(processFullSum[processOne.code])==1) || (!processOne.id && processFullSum[processOne.code]==1)">
- <div class="row" v-for="processesContent in processOne.processesContents"
- v-if="processOne.is_multi_row || !processOne.id ? !processOne.id ? processesContent.type=='成品单' :processesContent.type=='原料单' : true">
- <div class="col-2">@{{ processesContent.bill_type }} <span style="opacity: 0.75">(@{{ processesContent.type }})</span></div>
- <div class="col-2">@{{ processesContent.wms_code }}</div>
- <div class="col-2">@{{ processesContent.amount }}</div>
- <div class="col-3">
- <ul class="p-0 m-0 list-unstyled list-inline" v-if="processesContent.commodity && !processesContent.sign_commodity_barcode_mark">
- <li v-for="barcode in processesContent.commodity.barcodes"><small>@{{ barcode.code }}</small></li>
- </ul>
- <span v-if="processesContent.sign_commodity_barcode_mark">@{{ processesContent.sign_commodity_barcode_mark }}</span>
- </div>
- <div :title="processesContent.sign_commodity_name_mark?processesContent.sign_commodity_name_mark:processesContent.commodity_name" class="text-muted tooltipTarget col-3">
- <div style="white-space: normal">@{{ processesContent.sign_commodity_name_mark?processesContent.sign_commodity_name_mark:processesContent.commodity_name }}</div>
- </div>
- </div>
- <div class="row">
- <div class="text-center col-12 cursor-pointer">
- <b v-if="processUnfold[processOne.code+processOne.id]==='原料单'" @click="close(processOne.code,processOne.id)">点击关闭原料单</b>
- <b v-if="processUnfold[processOne.code+processOne.id]==='成品单'" @click="close(processOne.code,processOne.id)">点击关闭成品单</b></div>
- </div>
- </div>
- <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)') :'')}
- ,{'-webkit-transform':'scale('+(1/Math.ceil(processOne.array.length/2))+')'},{height: (35*Math.ceil(processOne.array.length/2))+'px'}
- ,{width: (100*Math.ceil(processOne.array.length/2))+'%'},{'margin-left': (-100*((Math.ceil(processOne.array.length/2))-1)/2)+'%'}
- ,{'margin-top': (-35*((Math.ceil(processOne.array.length/2))-1)/2)+'px'},
- {'margin-bottom': (-35*((Math.ceil(processOne.array.length/2))-1)/2)+'px'}]">
- <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},
- {'margin-left': processOne.array.length >3 ? (parseInt(processOne.array.length/3))+'px' : '0px'}]">
- <span>@{{ processesContent.bill_type }}</span>
- <span>@{{ processesContent.wms_code }}</span>
- <span>@{{ processesContent.amount }}</span>
- <span v-if="processesContent.sign_commodity_barcode_mark">
- @{{ processesContent.sign_commodity_barcode_mark }}
- </span>
- <span v-if="!processesContent.sign_commodity_barcode_mark &&
- processesContent.commodity && processesContent.commodity.barcodes.length>0">
- @{{ processesContent.commodity.barcodes[0].code }}
- </span>
- <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>
- </div>
- </div>
- <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 &&
- ((processFullSum[processOne.code]!=processOne.processesContents.length && (processOne.processesContents.length)-(processFullSum[processOne.code])!=1 && ((processOne.is_multi_row || !processOne.id) ? (!processOne.id ? false :true) : true)) ||
- processFullSum[processOne.code] && processFullSum[processOne.code]>1 && ((processOne.is_multi_row || !processOne.id) ? (!processOne.id ? true :false) : true))" class="text-center">
- <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>
- <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>
- </td>
- <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>
- <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>
- <td v-if="processOne.id" class="text-muted" :rowspan="processOne.is_multi_row?2:''">
- @can('二次加工管理-删除')<button type="button" class="btn btn-sm btn-outline-danger" @click="destroy(processOne.code,processOne.id)">删</button>@endcan
- </td>
- </tr>
- <tr id="addProcessDailyParticipants" v-show="processDailyParticipants.length>0">
- <td colspan="2"></td>
- <td colspan="16">
- <table class="table-sm table-bordered table-condensed">
- <tr class="text-success">
- <td>
- <button v-if="!is_update_date" @click="is_update_date='start_date';date=''"
- @mouseenter="dateTextMap.start_date='设定起始日期'" @mouseleave="dateTextMap.start_date='起'"
- type="button" class="btn btn-sm btn-outline-primary">@{{ dateTextMap.start_date }}</button>
- <button v-if="!is_update_date" @click="is_update_date='end_date';date=''" type="button"
- @mouseenter="dateTextMap.end_date='设定终止日期'" @mouseleave="dateTextMap.end_date='终'"
- class="btn btn-sm btn-outline-dark">@{{ dateTextMap.end_date }}</button>
- <div v-if="is_update_date">
- <input type="date" class="form-control form-control-sm" :class="is_update_date=='start_date' ? 'text-info border-info':''"
- style="width: 137px" v-model="date" :max="is_update_date=='start_date'&&processDailyParticipants.length>0 ? processDailyParticipants[0].date : ''"
- :min="is_update_date=='end_date'&&processDailyParticipants.length>0 ? processDailyParticipants[(processDailyParticipants.length)-1].date : ''">
- <button type="button" @click="update_process_date(processDailyParticipants[0])" class="btn btn-sm btn-outline-success">确定</button>
- <button type="button" @click="is_update_date='';dateTextMap.end_date='终';dateTextMap.start_date='起'" class="btn btn-sm btn-outline-danger">取消</button>
- </div>
- </td>
- <td>当日产量</td>
- <td>当日剩余</td>
- <td colspan="2">操作</td>
- <td>参与者</td>
- <td>开始时间</td>
- <td>结束时间</td>
- <td>计时单价</td>
- <td>计件单价</td>
- <td>晚饭时间</td>
- <td>计时工时</td>
- <td>计件数量</td>
- <td>备注</td>
- <td>当日工资</td>
- {{--<td>审核</td>--}}
- <td>操作</td>
- </tr>
- <tr v-for="(processDailyParticipant,i) in processDailyParticipants" :id="'processDailyParticipant'+processDailyParticipant.id">
- <td v-if="processDailyParticipant.rowspan" :rowspan="processDailyParticipant.rowspan"><p >@{{ processDailyParticipant.date }}</p></td>
- <td v-if="processDailyParticipant.rowspan" :rowspan="processDailyParticipant.rowspan">
- <div class="form-inline">
- <input :readonly="processDailyParticipant.readonly" v-model="processDailyParticipant.submitOutput"
- class="form-control col-sm-5 " @click="updateOutput(processDailyParticipant)" type="text" />
- @can("二次加工管理-登记工时")<button class="btn btn-sm btn-success" v-if="! processDailyParticipant.readonly" @click="submitOutputData(processDailyParticipant.daily_id,processDailyParticipant.submitOutput,processDailyParticipant.id)">确定</button>
- <button class="btn btn-sm btn-danger" v-if="! processDailyParticipant.readonly" @click="processDailyParticipant.readonly=true;processDailyParticipant.submitOutput=processDailyParticipant.output">取消</button>
- @endcan
- </div>
- </td>
- <td v-if="processDailyParticipant.rowspan" :rowspan="processDailyParticipant.rowspan"><p >@{{ processDailyParticipant.remain }}</p></td>
- <td v-if="processDailyParticipant.rowspan" :rowspan="processDailyParticipant.rowspan">
- @can("二次加工管理-登记工时")<button v-if="processDailyParticipant.isAddProcessDailyParticipant && isShow.isAddProcessDailyParticipant" class="btn btn-sm btn-outline-info" @click="addProcessDailyParticipant(processDailyParticipant);processDailyParticipant.isAddProcessDailyParticipant=false;">新增</button>
- <button v-if="!processDailyParticipant.isAddProcessDailyParticipant" class="btn btn-sm btn-danger"
- @click="deleteProcessDailyParticipant($event,processDailyParticipant.daily_id,processDailyParticipant.user_detail_full_name,processDailyParticipant.isConfirmBtn);processDailyParticipant.isAddProcessDailyParticipant=true;">取消</button>
- @endcan
- </td>
- <td>
- @can("二次加工管理-登记工时")<button v-if="!processDailyParticipant.isAddProcessDailyParticipant && processDailyParticipant.isConfirmBtn" class="btn btn-sm btn-success" @click="submitProcessDailyParticipant(processDailyParticipant.daily_id)">确定</button>
- <button v-if="processDailyParticipant.id" class="btn btn-sm btn-outline-info" @click="updateProcessDailyParticipant(processDailyParticipant)">改</button>
- @endcan
- </td>
- <td>
- <span v-if="!processDailyParticipant.user_detail_full_name && processDailyParticipant.isAddProcessDailyParticipant==false" >
- <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)">
- <input hidden :id="processDailyParticipant.daily_id+'user_id'"/>
- </span><span v-else>@{{ processDailyParticipant.user_detail_full_name }}</span></td>
- <td>
- <span v-if="!processDailyParticipant.user_detail_full_name && processDailyParticipant.isAddProcessDailyParticipant==false" >
- <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)">
- </span><span v-else> @{{ processDailyParticipant.started_at }}</span></td>
- <td>
- <span v-if="!processDailyParticipant.user_detail_full_name && processDailyParticipant.isAddProcessDailyParticipant==false" >
- <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)">
- </span><span v-else> @{{ processDailyParticipant.ended_at }}</span></td>
- <td><span v-if="!processDailyParticipant.user_detail_full_name && processDailyParticipant.isAddProcessDailyParticipant==false">
- <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">
- </span><span v-else>@{{ processDailyParticipant.hour_price }}</span></td>
- <td>
- <span v-if="!processDailyParticipant.user_detail_full_name && processDailyParticipant.isAddProcessDailyParticipant==false">
- <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">
- </span><span v-else>@{{ processDailyParticipant.unit_price }}</span></td>
- <td>
- <span v-if="!processDailyParticipant.user_detail_full_name && processDailyParticipant.isAddProcessDailyParticipant==false">
- <select :class="{ 'is-invalid' : errors.dinner_duration }" @input="hourFilter(processDailyParticipant.daily_id,true)" :data-original-title="errors.dinner_duration ? errors.dinner_duration[0] : ''"
- :id="processDailyParticipant.daily_id+'dinner_duration'" class="form-control tooltipTargetError" style="width:80px">
- <option value="0">无</option>
- <option value="30">30分钟</option>
- <option value="60">60分钟</option>
- </select>
- </span><span v-else>@{{ processDailyParticipant.dinner_duration }}</span></td>
- <td>
- <span v-if="!processDailyParticipant.user_detail_full_name && processDailyParticipant.isAddProcessDailyParticipant==false">
- <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" >
- </span><span v-else>@{{ processDailyParticipant.hour_count }}</span></td>
- <td>
- <span v-if="!processDailyParticipant.user_detail_full_name && processDailyParticipant.isAddProcessDailyParticipant==false">
- <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">
- </span><span v-else>@{{ processDailyParticipant.unit_count }}</span></td>
- <td>
- <span v-if="!processDailyParticipant.user_detail_full_name && processDailyParticipant.isAddProcessDailyParticipant==false">
- <input :id="processDailyParticipant.daily_id+'remark'" class="form-control" style="width: 100px" type="text">
- </span><span v-else>@{{ processDailyParticipant.remark }}</span></td>
- <td class="text-danger">
- <div v-if="processDailyParticipant.unit_count || processDailyParticipant.hour_count">
- <span v-if="processDailyParticipant.unit_count">@{{ (processDailyParticipant.unit_count)*(processDailyParticipant.unit_price) }}</span>
- <span v-else>@{{ (processDailyParticipant.hour_count)*(processDailyParticipant.hour_price) }}</span>
- </div>
- </td>
- <td>
- <div v-if="processDailyParticipant.user_detail_full_name">
- @can("二次加工管理-临时工资料管理")<u class="text-info" style="cursor:pointer"
- @click="showUserDetail(processDailyParticipant.user_id)">详情</u>@endcan
- <button class="btn btn-sm btn-outline-danger" @click="deleteDailyParticipant(i)">删</button>
- </div>
- </td>
- </tr>
- </table>
- </td>
- </tr>
- </template>
- </table>
- {{$processes->appends($paginateParams)->links()}}
- </div>
- </div>
- @endsection
- @section('lastScript')
- <script type="text/javascript" src="{{mix('js/queryForm/export.js')}}"></script>
- <script type="text/javascript" src="{{mix('js/queryForm/queryForm.js')}}"></script>
- <script type="text/javascript" src="{{mix('js/queryForm/header.js')}}"></script>{{--新版2--}}
- <script>
- new Vue({
- el:"#process",
- data:{
- participantInputting:{},
- processes:[
- @foreach($processes as $processOne)
- {id:'{{$processOne->id}}',code:'{{$processOne->code}}',owner_name:'{{$processOne->owner_name}}',owner_id:'{{$processOne->owner_id}}',operatorLogs:{!! $processOne->operatorLogs !!},
- process_method_name:'{{$processOne->process_method_name}}',amount:'{{$processOne->amount}}',type:'{{$processOne->type}}',signs:{!!$processOne->signs !!},signUnitPrice:'{{$processOne->signUnitPrice ? $processOne->signUnitPrice->mark :''}}'
- ,tutorials:{!! $processOne->tutorials !!},processesContents:{!! $processOne->processesContents !!},unit_price:'{{$processOne->unit_price}}',created_at:'{{$processOne->created_at}}',
- completed_amount:'{{$processOne->completed_amount}}',status:'{{$processOne->status}}',remark:'{{preg_replace("/\s/",' ',$processOne->remark)}}',
- balance_remark:'{{preg_replace("/\s/",' ',$processOne->balance_remark)}}',
- designate_id:"{{$processOne->designate_id}}",designate: "{{$processOne->designate ? $processOne->designate->name :''}}",
- detailFolding:false,openProcessHour:false,is_multi_row:false,is_verifier_show:false,is_update_unit_price:false,
- array: []
- },
- @endforeach
- ],
- userId:"{{\Illuminate\Support\Facades\Auth::id()}}",
- processesList:[],
- owners:[
- @foreach($owners as $owner)
- { name:'{{$owner->id}}',value:'{{$owner->name}}'},
- @endforeach
- ],
- status:[
- {name:'待审核',value:'待审核'},{name:'待接单',value:'待接单'},{name:'待加工',value:'待加工'},
- {name:'已驳回',value:'已驳回'},{name:'加工中',value:'加工中'},{name:'待验收',value:'待验收'},
- {name:'交接完成',value:'交接完成'}
- ],
- errors:{},
- processDailies:[],
- processDailyParticipants:[],
- isShow:{
- isOpenProcessHour:false,isAddProcessDailyParticipant:true,isUpdateConfirmBtn:true,
- },
- userLabors:[],
- modalDaily_id:'',
- processDailyParticipantOne:{id:'',user_id:'',user_detail_full_name:'',started_at:"",ended_at:"",
- hour_price:'',unit_price:'',dinner_duration:'',hour_count:'',unit_count:'',remark:''},
- processTutorial:{id:'',owner_id:'',tutorials:[],},
- processUnfold:[],
- processFullSum:[],
- signs:[],
- is_update_date:false,
- date:'',
- dateTextMap:{'start_date':'起','end_date':'终'},
- sum:{!! $processes->total() !!},
- selectTr:''
- },
- mounted:function () {
- this.resetProcessData();
- $(".tooltipTarget").tooltip({'trigger': 'hover'});
- $('#process').removeClass('d-none');
- let data=[
- [
- {name: 'date_start', type: 'dateTime', tip: '选择显示指定日期的起始时间'},
- {
- name: 'owners', type: 'select_multiple_select', tip: ['输入关键词快速定位下拉列表,回车确定', '选择要显示的客户'],
- placeholder: ['货主', '定位或多选货主'], data: this.owners
- },
- {name: 'wms_code', type: 'input', tip: '可支持多单据号,模糊搜索可在两侧增加百分号(%)进行', placeholder: '单据号'},
- {name: 'status', type: 'select', placeholder: '状态', data: this.status},
- ],
- [
- {name: 'date_end', type: 'dateTime', tip: '选择显示指定日期的结束时间'},
- {name: 'commodity_barcode', type: 'input', tip: '可支持多商品条码,模糊搜索可在两侧增加百分号(%)进行', placeholder: '商品条码'},
- {name: 'code', type: 'input', tip: '可支持多任务号,模糊搜索可在两侧增加百分号(%)进行', placeholder: '任务号'},
- {name: 'is_accomplish', type: 'checkbox', data: [{name: 'sign', value: '显示交接完成的记录'}]},
- {name: 'designate', type: 'input', tip: '默认模糊', placeholder: '指定接单人'},
- ],
- ];
- this.form = new query({
- el: "#form_div",
- condition: data,
- });
- this.form.init();
- let column = [
- {name:'index',value: '序号', neglect: true},
- {name:'operation',value: '操作', neglect: true},
- {name: 'status', value: '状态'},
- {name: 'code', value: '任务号'},
- {name:'person',value: '经手人', neglect: true},
- {name:'designate',value: '接单人'},
- {name: 'owner_name', value: '货主'},
- {name: 'process_method_name', value: '加工类型'},
- {name: 'amount', value: '预期数量'},
- {name:'tutorial',value: '教程', neglect: true},
- {name: 'unit_price', value: '单价'},
- {name: 'completed_amount', value: '完成数量'},
- {name: 'created_at', value: '提交日期'},
- {name:"items",type:"multi",title:"单据信息",rows:[
- {value:"单据类型",col:"2"},
- {value:"单据号",col:"2"},
- {value:"本单数量",col:"2"},
- {value:"商品条码",col:"3"},
- {value:"商品名称",col:"3"},
- ]},
- {name:'remark', value: '加工备注'},
- {name:'balance_remark', value: '结算备注'},
- {name:'remove',value: '', neglect: true},
- ];
- new Header({
- el: "table",
- name: "process",
- column: column,
- data: this.processes,
- restorationColumn: 'serial_number',
- fixedTop:($('#form_div').height())+2,
- isRestorationColumnAsc :true,
- isForbidDrag:true,
- }).init();
- for (let i = 0; i < this.processes.length; i++) {
- this.processes[i].array = this.arrayFilter(this.processes[i]);
- }
- },
- methods: {
- arrayFilter: function (processOne) {
- console.log("arrayFilter")
- if (!processOne.is_multi_row && processOne.id) return processOne.processesContents;
- let array = [];
- let type = '成品单';
- if (processOne.id) type = '原料单';
- processOne.processesContents.forEach(function (processesContent) {
- if (processesContent.type === type) array.push(processesContent);
- });
- return array;
- },
- //重组数据
- resetProcessData: function () {
- console.log("resetProcessData")
- let indexs = [];
- let count = 0;
- for (let i = 0; i < this.processes.length; i++) {
- let process = this.processes[i];
- this.$set(this.signs,process.code,[]);
- process.signs.forEach(sign => {
- this.$set(this.signs[process.code],sign.mark,true);
- });
- process.serial_number = count;
- process.processesContents.every(processesContent => {
- if (processesContent.type === '成品单') this.$set(this.processFullSum, process.code, this.processFullSum[process.code] ? this.processFullSum[process.code] + 1 : 1);
- return true;
- });
- if (this.processFullSum[process.code] && this.processFullSum[process.code] !== 0 && this.processFullSum[process.code] !== process.processesContents.length) {
- indexs.unshift(i);
- count++;
- process.is_multi_row = true;
- }
- count++;
- }
- indexs.forEach(index => {
- let processTemp = Object.assign({}, this.processes[index]);
- processTemp.id = '';
- processTemp.is_multi_row = false;count++;
- processTemp.serial_number = this.processes[index].serial_number + 1;
- this.processes.splice(index + 1, 0, processTemp);
- });
- },
- //导出excel
- processExport(checkAllSign) {
- let url = '{{url('process/export')}}';
- let token='{{ csrf_token() }}';
- excelExport(checkAllSign,checkData,url,this.sum,token);
- },
- //获取登记工时
- openProcessHour(process) {
- let e = process.id;
- let _this = this;
- if (_this.isShow.isOpenProcessHour) {
- _this.processes.every(function (process) {
- if (process.openProcessHour) {
- process.openProcessHour = false;
- return false;
- }
- return true;
- });
- } else {
- _this.isShow.isOpenProcessHour = true;
- }
- axios.post("{{url("process/getDailyParticipant")}}", {id: e, amount: process.amount})
- .then(function (response) {
- let processDailies = response.data;
- _this.resetProcessDaily(processDailies,e);
- }).catch(function (err) {
- tempTip.setDuration(5000);
- tempTip.show('获取登记工时数据发生了一些严重错误:' + err);
- });
- let processDailyParticipantsHtml = $("#addProcessDailyParticipants");
- if (process.is_multi_row) $("#" + e + "-2").after(processDailyParticipantsHtml);
- else $("#" + e).after(processDailyParticipantsHtml)
- },
- //重组加工单加工日记录数据
- resetProcessDaily(processDailies,process_id){
- console.log("resetProcessDaily")
- let _this=this;
- _this.processDailies = [];
- _this.processDailyParticipants = [];
- for (let i = 0; i < processDailies.length; i++) {
- let processDailyParticipants = processDailies[i].process_daily_participants;
- if (processDailyParticipants.length <= 0) {
- let data = {};
- data['process_id'] = process_id;
- data['daily_id'] = processDailies[i].id;
- data['date'] = processDailies[i].date;
- data['output'] = processDailies[i].output;
- data['remain'] = processDailies[i].remain;
- data['rowspan'] = 1;
- data['readonly'] = "true";
- data['isAddProcessDailyParticipant'] = "true";
- data['isConfirmBtn'] = "true";
- data['submitOutput'] = processDailies[i].output;
- _this.processDailyParticipants.push(data);
- continue;
- }
- for (let j = 0; j < processDailyParticipants.length; j++) {
- let data = {};
- data['id'] = processDailyParticipants[j].id;
- data['status'] = processDailyParticipants[j].status;
- data['started_at'] = processDailyParticipants[j].started_at;
- data['user_detail_full_name'] = processDailyParticipants[j].user_detail_full_name;
- data['user_id'] = processDailyParticipants[j].user_id;
- data['ended_at'] = processDailyParticipants[j].ended_at;
- data['hour_price'] = processDailyParticipants[j].hour_price;
- data['unit_price'] = processDailyParticipants[j].unit_price;
- data['dinner_duration'] = processDailyParticipants[j].dinner_duration;
- data['hour_count'] = processDailyParticipants[j].hour_count;
- data['remark'] = processDailyParticipants[j].remark;
- data['hour'] = processDailyParticipants[j].hour;
- data['diff'] = processDailyParticipants[j].diff;
- data['billingHour'] = processDailyParticipants[j].billingHour;
- data['unit_count'] = processDailyParticipants[j].unit_count;
- data['process_id'] = processDailies[i].process_id;
- data['readonly'] = "true";
- if (!_this.processDailies[processDailies[i].id]) {
- data['rowspan'] = processDailyParticipants.length;
- data['process_id'] = process_id;
- data['daily_id'] = processDailies[i].id;
- data['date'] = processDailies[i].date;
- data['output'] = processDailies[i].output;
- data['remain'] = processDailies[i].remain;
- data['submitOutput'] = processDailies[i].output;
- data['isAddProcessDailyParticipant'] = "true";
- data['isConfirmBtn'] = "true";
- _this.processDailies[processDailies[i].id] = processDailies[i].id;
- }
- _this.processDailyParticipants.push(data);
- }
- }
- },
- //删除工时显示
- closeProcessHour(e) {
- this.processDailies = [];
- this.processDailyParticipants = [];
- },
- //新增参与人
- addProcessDailyParticipant(processDailyParticipantOne) {
- let id = processDailyParticipantOne.id;
- if (!id) return;
- let _this = this;
- _this.errors = {};
- this.processDailyParticipants.every(function (processDailyParticipant, i) {
- if (processDailyParticipant.id == id) {
- processDailyParticipant.rowspan++;
- let data = {};
- data['readonly'] = "true";
- data['isAddProcessDailyParticipant'] = "true";
- data['isConfirmBtn'] = "true";
- data['id'] = processDailyParticipant.id;
- data['user_id'] = processDailyParticipant.user_id;
- data['status'] = processDailyParticipant.status;
- data['started_at'] = processDailyParticipant.started_at;
- data['user_detail_full_name'] = processDailyParticipant.user_detail_full_name;
- data['ended_at'] = processDailyParticipant.ended_at;
- data['hour_price'] = processDailyParticipant.hour_price;
- data['unit_price'] = processDailyParticipant.unit_price;
- data['dinner_duration'] = processDailyParticipant.dinner_duration;
- data['hour_count'] = processDailyParticipant.hour_count;
- data['remark'] = processDailyParticipant.remark;
- data['hour'] = processDailyParticipant.hour;
- data['diff'] = processDailyParticipant.diff;
- data['billingHour'] = processDailyParticipant.billingHour;
- data['unit_count'] = processDailyParticipant.unit_count;
- data['process_id'] = processDailyParticipant.process_id;
- _this.processDailyParticipants.splice(i + 1, 0, data);
- processDailyParticipant.id = '';
- processDailyParticipant.status = '';
- processDailyParticipant.started_at = '';
- processDailyParticipant.user_detail_full_name = '';
- processDailyParticipant.ended_at = '';
- processDailyParticipant.hour_price = '';
- processDailyParticipant.unit_price = '';
- processDailyParticipant.dinner_duration = '';
- processDailyParticipant.hour_count = '';
- processDailyParticipant.remark = '';
- processDailyParticipant.hour = '';
- processDailyParticipant.diff = '';
- processDailyParticipant.billingHour = '';
- processDailyParticipant.unit_count = '';
- processDailyParticipant.process_id = '';
- return false;
- }
- return true;
- });
- _this.isShow.isAddProcessDailyParticipant = false;
- },
- //取消录入参与人
- deleteProcessDailyParticipant($event, daily_id, processDailyParticipant_name, isConfirmBtn) {
- if (!isConfirmBtn) {
- this.processDailyParticipants.every(function (processDailyParticipant) {
- if (processDailyParticipant.daily_id == daily_id) {
- processDailyParticipant.isConfirmBtn = true; //放出隐藏确定按钮
- return false;
- }
- return true;
- });
- }
- let _this = this;
- this.processDailyParticipants.every(function (processDailyParticipant, i) {
- if (processDailyParticipant.daily_id == daily_id) {
- if (!processDailyParticipant_name && _this.processDailyParticipants[i + 1] && _this.processDailyParticipants[i + 1].daily_id) return false;
- if (!_this.processDailyParticipants[i + 1]) return false;
- _this.processDailyParticipants[i + 1].rowspan = (processDailyParticipant.rowspan) - 1;
- _this.processDailyParticipants[i + 1].daily_id = processDailyParticipant.daily_id;
- _this.processDailyParticipants[i + 1].date = processDailyParticipant.date;
- _this.processDailyParticipants[i + 1].output = processDailyParticipant.output;
- _this.processDailyParticipants[i + 1].remain = processDailyParticipant.remain;
- _this.processDailyParticipants[i + 1].submitOutput = processDailyParticipant.submitOutput;
- _this.processDailyParticipants.splice(i, 1);
- return false;
- }
- return true;
- });
- _this.isShow.isAddProcessDailyParticipant = true;
- },
- //驳回
- processReject(id) {
- if (!confirm('确定驳回该单吗?')) {
- return
- }
- let url = "{{url('process/reject')}}" + "/" + id;
- let _this = this;
- axios.post(url)
- .then(function (response) {
- _this.processes.every(function (process) {
- if (process.id == response.data.id) {
- process.status = response.data.status;
- return false;
- }
- return true;
- });
- tempTip.setDuration(3000);
- tempTip.showSuccess('驳回成功!');
- }).catch(function (err) {
- tempTip.setDuration(5000);
- tempTip.show('驳回二次加工单发生了一些严重错误:' + err);
- })
- },
- //接单
- processReceive(id,index) {
- let url = "{{url('process/receive')}}" + "/" + id;
- window.tempTip.postBasicRequest(url,{},res=>{
- this.processes[index].status = res;
- return "接单成功";
- });
- },
- //完成
- processAccomplish(process) {
- if (!confirm('确定标记为加工完成吗?'))return
- axios.post('{{url('process/processAccomplish')}}', {id: process.id})
- .then(function (response) {
- if (response.data.success) {
- process.status = response.data.data;
- tempTip.setDuration(2000);
- tempTip.showSuccess('“' + process.code + '”已被标记为加工完成!');
- return;
- }
- tempTip.setDuration(3000);
- tempTip.show('未知错误,联系管理员解决!');
- }).catch(function (err) {
- tempTip.setDuration(3000);
- tempTip.show('网络错误:' + err);
- })
- },
- accomplish(process) {
- if (!confirm('确定“' + process.code + '”交接完成吗?')) {
- return
- }
- let url = "{{url('process/accomplish')}}";
- axios.post(url, {id: process.id})
- .then(function (response) {
- if (response.data.success) {
- process.status = response.data.data;
- tempTip.setDuration(2000);
- tempTip.showSuccess('交接完成!');
- return;
- }
- tempTip.setDuration(3000);
- tempTip.show(response.data.data);
- }).catch(function (err) {
- tempTip.setDuration(3000);
- tempTip.show('网络错误:' + err);
- })
- },
- //修改每日产量
- submitOutputData(daily_id, data, id) {
- let url = "{{url('process/updateDailyOutput')}}";
- let _this = this;
- axios.post(url, {id: daily_id, output: data})
- .then(function (response) {
- if (response.data.status == "error") {
- tempTip.setDuration(3000);
- tempTip.show('输入有误:' + response.data.data.output);
- }
- if (response.data.status == "success") {
- let processDailies = response.data.data;
- _this.processDailyParticipants.every(function (processDailyParticipant) {
- if (processDailyParticipant.id == id) {
- processDailyParticipant.readonly = true;
- }
- processDailies.every(function (processDaily) {
- if (processDailyParticipant.date == processDaily.date) {
- processDailyParticipant.output = processDaily.output;
- processDailyParticipant.remain = processDaily.remain;
- return false;
- }
- return true;
- });
- return true;
- });
- if (response.data.process) {
- _this.processes.every(function (process) {
- if (process.id == response.data.process) {
- process.status = "待验收";
- return false;
- }
- return true;
- });
- }
- tempTip.setDuration(3000);
- tempTip.showSuccess('每日产量修改成功!');
- }
- }).catch(function (err) {
- tempTip.setDuration(5000);
- tempTip.show('修改每日产量发生了一些严重错误:' + err);
- });
- },
- //验证临时工
- verifyUserName(e, daily_id, isConfirmBtn,processDailyParticipant) {
- let user = e.target.value;
- let _this = this;
- axios.post('{{url('process/verifyUserName')}}',
- {userName: user,id:processDailyParticipant.id,date:processDailyParticipant.date})
- .then(function (response) {
- if (!response.data.success){
- tempTip.setDuration(3000);
- tempTip.show(response.data.data);
- return;
- }
- //修改时验证
- if (!daily_id) {
- //验证失败
- if (response.data.data.length < 1) {
- _this.isShow.isUpdateConfirmBtn = false;
- _this.errors['user_id'] = "查无此人,请检查您的输入";
- return;
- }
- //验证成功且结果仅有一个
- if (response.data.data.user_id) {
- _this.isShow.isUpdateConfirmBtn = true;
- _this.errors['user_id'] = "";
- _this.processDailyParticipantOne.user_id = response.data.data.user_id;
- _this.processDailyParticipantOne.started_at = response.data.data.started_at;
- _this.processDailyParticipantOne.ended_at = response.data.data.ended_at;
- _this.hourFilter(_this.processDailyParticipantOne,false);
- return;
- }
- //验证成功多结果
- if (response.data.data.length > 1) {
- _this.userLabors = response.data.data;
- $("#myModal").modal('show');
- return;
- }
- }
- //验证失败
- if (response.data.data.length < 1) {
- _this.processDailyParticipants.every(function (processDailyParticipant) {
- if (processDailyParticipant.daily_id == daily_id) {
- _this.errors['user_id'] = "查无此人,请检查您的输入";
- setTimeout(function () {
- $(".tooltipTargetError").tooltip('show');
- }, 1);
- processDailyParticipant.isConfirmBtn = false; //验证失败隐藏确定按钮
- return false;
- }
- return true;
- });
- return;
- }
- //按钮被隐藏则放出
- if (!isConfirmBtn) {
- _this.processDailyParticipants.every(function (processDailyParticipant) {
- if (processDailyParticipant.daily_id == daily_id) {
- processDailyParticipant.isConfirmBtn = true; //验证失败隐藏确定按钮
- return false;
- }
- return true;
- });
- }
- _this.modalDaily_id = daily_id;
- //验证成功且结果仅有一个
- if (response.data.data.user_id) {
- _this.errors['user_id'] = "";
- $("#" + daily_id + "user_id").val(response.data.data.user_id);
- $("#" + daily_id + "hour_price").val(response.data.data.user_labor.default_hour_price);
- if (response.data.data.started_at) $("#" + daily_id + "started_at").val(response.data.data.started_at);
- if (response.data.data.ended_at) $("#" + daily_id + "ended_at").val(response.data.data.ended_at);
- _this.hourFilter(daily_id,true);
- }
- //验证成功多结果
- if (response.data.data.length > 1) {
- _this.userLabors = response.data.data;
- $("#myModal").modal('show');
- }
- }).catch(function (err) {
- tempTip.setDuration(5000);
- tempTip.show('验证临时工发生了一些严重错误:' + err);
- })
- },
- //验证时间合法性
- hourFilter(processDailyParticipant, is_create) {
- console.log("hourFilter")
- let start = new Date('2020/1/1 12:00:00').getTime();
- let end = new Date('2020/1/1 13:00:00').getTime();
- if (is_create) {
- let started_at = new Date('2020/1/1 ' + $('#' + processDailyParticipant + 'started_at')[0].value).getTime();
- let ended_at = new Date('2020/1/1 ' + $('#' + processDailyParticipant + 'ended_at')[0].value).getTime();
- let hour_count = (ended_at - started_at) / 3600000;
- if (started_at < start && ended_at > end) hour_count -= 1;
- let dinner_duration=Number($('#' + processDailyParticipant + 'dinner_duration')[0].value)/60;
- $('#' + processDailyParticipant + 'hour_count')[0].value = (hour_count - dinner_duration).toFixed(1);
- return;
- }
- let started_at = new Date('2020/1/1 ' + processDailyParticipant.started_at).getTime();
- let ended_at = new Date('2020/1/1 ' + processDailyParticipant.ended_at).getTime();
- let hour_count = (ended_at - started_at) / 3600000;
- if (started_at < start && ended_at > end) hour_count -= 1;
- let dinner_duration=Number(processDailyParticipant.dinner_duration) / 60;
- processDailyParticipant.hour_count = (hour_count - dinner_duration).toFixed(1);
- },
- //提交参与人
- submitProcessDailyParticipant(e) {
- console.log("submitProcessDailyParticipant")
- let request = {};
- request['user_id'] = $("#" + e + "user_id").val();
- request['started_at'] = $("#" + e + "started_at").val();
- request['ended_at'] = $("#" + e + "ended_at").val();
- let hour_price = $("#" + e + "hour_price").val();
- if (hour_price) request['hour_price'] = hour_price;
- let unit_price = $("#" + e + "unit_price").val();
- if (unit_price) request['unit_price'] = unit_price;
- let dinner_duration = $("#" + e + "dinner_duration").val();
- if (dinner_duration) request['dinner_duration'] = dinner_duration;
- let hour_count = $("#" + e + "hour_count").val();
- if (hour_count) request['hour_count'] = hour_count;
- let unit_count = $("#" + e + "unit_count").val();
- if (unit_count) request['unit_count'] = unit_count;
- let remark = $("#" + e + "remark").val();
- if (remark) request['remark'] = remark;
- request['daily_id'] = this.modalDaily_id;
- let _this = this;
- axios.post("{{url('process/storeProcessDailyParticipant')}}", request)
- .then(function (response) {
- if (response.data.status === 'warning'){
- tempTip.setDuration(3000);
- tempTip.show(response.data.data);
- return;
- }
- if (response.data.status === "error") {
- _this.errors = response.data.data;
- setTimeout(function () {
- $(".tooltipTargetError").tooltip('show');
- }, 1);
- setTimeout(function () {
- $(".tooltipTargetError").tooltip('hide');
- }, 3000);
- return;
- }
- if (response.data.status == "success") {
- _this.processDailyParticipants.every(function (processDailyParticipant) {
- if (processDailyParticipant.daily_id == e) {
- processDailyParticipant.id = response.data.data.id;
- processDailyParticipant.status = response.data.data.status;
- processDailyParticipant.user_detail_full_name = response.data.data.user_detail_full_name;
- processDailyParticipant.user_id = response.data.data.user_id;
- processDailyParticipant.started_at = response.data.data.started_at;
- processDailyParticipant.ended_at = response.data.data.ended_at;
- processDailyParticipant.hour_price = response.data.data.hour_price;
- processDailyParticipant.unit_price = response.data.data.unit_price;
- processDailyParticipant.dinner_duration = response.data.data.dinner_duration;
- processDailyParticipant.hour_count = response.data.data.hour_count;
- processDailyParticipant.unit_count = response.data.data.unit_count;
- processDailyParticipant.remark = response.data.data.remark;
- processDailyParticipant.hour = response.data.data.hour;
- processDailyParticipant.diff = response.data.data.diff;
- processDailyParticipant.billingHour = response.data.data.billingHour;
- processDailyParticipant.isAddProcessDailyParticipant = true;
- _this.isShow.isAddProcessDailyParticipant = true;
- return false;
- }
- return true;
- });
- if (response.data.process) {
- _this.processes.every(function (process) {
- if (process.id == response.data.process) {
- process.status = "加工中";
- return false;
- }
- return true;
- });
- }
- tempTip.setDuration(3000);
- tempTip.showSuccess('参与人新增成功!');
- }
- }).catch(function (err) {
- tempTip.setDuration(5000);
- tempTip.show('新增参与人发生了一些严重错误:' + err);
- })
- },
- //同名临时工选择
- selectedUser(userLabor) { // 此处如返回开始与结束时间 计时工时并不会发生改变
- $("#myModal").modal('hide');
- this.errors['user_id'] = "";
- this.processDailyParticipantOne['user_id'] = userLabor.user_id;
- this.processDailyParticipantOne['hour_price'] = userLabor.user_labor.default_hour_price;
- this.processDailyParticipantOne['started_at'] = userLabor.started_at;
- this.processDailyParticipantOne['ended_at'] = userLabor.ended_at;
- this.isShow.isUpdateConfirmBtn = true;
- $("#" + this.modalDaily_id + "user_id").val(userLabor.user_id);
- $("#" + this.modalDaily_id + "hour_price").val(userLabor.user_labor.default_hour_price);
- $("#" + this.modalDaily_id + "started_at").val(userLabor.started_at);
- $("#" + this.modalDaily_id + "ended_at").val(userLabor.ended_at);
- },
- //修改参与人
- updateProcessDailyParticipant(processDailyParticipant) {
- this.errors = {};
- this.processDailyParticipantOne['id'] = processDailyParticipant.id;
- this.processDailyParticipantOne['user_detail_full_name'] = processDailyParticipant.user_detail_full_name;
- this.processDailyParticipantOne['user_id'] = processDailyParticipant.user_id;
- this.processDailyParticipantOne['started_at'] = processDailyParticipant.started_at;
- this.processDailyParticipantOne['ended_at'] = processDailyParticipant.ended_at;
- this.processDailyParticipantOne['hour_price'] = processDailyParticipant.hour_price;
- this.processDailyParticipantOne['unit_price'] = processDailyParticipant.unit_price;
- this.processDailyParticipantOne['dinner_duration'] = processDailyParticipant.dinner_duration;
- this.processDailyParticipantOne['hour_count'] = processDailyParticipant.hour_count;
- this.processDailyParticipantOne['unit_count'] = processDailyParticipant.unit_count;
- this.processDailyParticipantOne['remark'] = processDailyParticipant.remark;
- $("#updateModal").modal('show');
- },
- //提交修改
- submitUpdateProcessDailyParticipant() {
- let _this = this;
- axios.post("{{url('process/updateProcessDailyParticipant')}}", this.processDailyParticipantOne)
- .then(function (response) {
- if (!response.data.success) {
- if (response.data.data.length>0){
- _this.errors = response.data.data;
- }
- else {
- tempTip.setDuration(3000);
- tempTip.show(response.data.data);
- }
- return;
- }
- _this.processDailyParticipants.every(function (processDailyParticipant) {
- if (processDailyParticipant.id == response.data.data.id) {
- processDailyParticipant.status = response.data.data.status;
- processDailyParticipant.user_detail_full_name = response.data.data.user_detail_full_name;
- processDailyParticipant.started_at = response.data.data.started_at;
- processDailyParticipant.ended_at = response.data.data.ended_at;
- processDailyParticipant.hour_price = response.data.data.hour_price;
- processDailyParticipant.unit_price = response.data.data.unit_price;
- processDailyParticipant.dinner_duration = response.data.data.dinner_duration;
- processDailyParticipant.hour_count = response.data.data.hour_count;
- processDailyParticipant.unit_count = response.data.data.unit_count;
- processDailyParticipant.remark = response.data.data.remark;
- processDailyParticipant.hour = response.data.data.hour;
- processDailyParticipant.diff = response.data.data.diff;
- processDailyParticipant.billingHour = response.data.data.billingHour;
- processDailyParticipant.isAddProcessDailyParticipant = true;
- return false;
- }
- return true;
- });
- tempTip.setDuration(3000);
- tempTip.showSuccess('参与人修改成功!');
- $("#updateModal").modal('hide');
- }).catch(function (err) {
- tempTip.setDuration(5000);
- tempTip.show('修改参与人发生了一些严重错误:' + err);
- })
- },
- //临时工详情
- showUserDetail(id) {
- window.open("{{url('maintenance/userLabor')}}/" + id);
- },
- //显示教程
- showTutorial(id) {
- axios.post('{{url('maintenance/tutorial/showContent')}}' + "/" + id)
- .then(function (response) {
- if (response.data.success) {
- $("#content").html(response.data.data);
- $("#showTutorial").modal('show');
- }
- }).catch(function (err) {
- tempTip.setDuration(3000);
- tempTip.show('获取教程失败!' + '网络错误:' + err);
- });
- },
- //新增教程
- addTutorials(id, owner_id) {
- let _this = this;
- axios.post('{{url('process/getTutorials')}}' + "/" + id)
- .then(function (response) {
- if (response.data.success) {
- _this.processTutorial.id = id;
- _this.processTutorial.owner_id = owner_id;
- _this.processTutorial.tutorials = response.data.data;
- $("#addTutorial").modal("show");
- return;
- }
- tempTip.setDuration(3000);
- tempTip.show('获取教程失败!未知错误:' + response.data);
- }).catch(function (err) {
- tempTip.setDuration(3000);
- tempTip.show('获取教程失败!' + '网络错误:' + err);
- });
- },
- //选择教程
- selectedTutorial(process_id, tutorial_id) {
- let _this = this;
- axios.post('{{url('process/selectedTutorial')}}', {
- process_id: process_id,
- tutorial_id:tutorial_id
- })
- .then(function (response) {
- if (response.data.success) {
- _this.processes.every(function (process) {
- if (process.id == process_id) {
- process.tutorials.push(response.data.data);
- return false;
- }
- return true;
- });
- $("#addTutorial").modal("hide");
- tempTip.setDuration(3000);
- tempTip.showSuccess('添加成功!');
- return;
- }
- tempTip.setDuration(3000);
- tempTip.show('添加教程失败!发生错误:' + response.data.data);
- }).catch(function (err) {
- tempTip.setDuration(3000);
- tempTip.show('添加教程失败!' + '网络错误:' + err);
- });
- },
- //删除教程
- deleteTutorials(process_id, tutorial_id) {
- let _this = this;
- axios.post('{{url('process/deleteTutorial')}}', {process_id: process_id, tutorial_id, tutorial_id})
- .then(function (response) {
- if (response.data.success) {
- _this.processes.every(function (process) {
- if (process.id == process_id) {
- process.tutorials.every(function (tutorial, i) {
- if (tutorial.id == tutorial_id) {
- process.tutorials.splice(i, 1)
- return false;
- }
- return true;
- });
- return false;
- }
- return true;
- });
- tempTip.setDuration(3000);
- tempTip.showSuccess('删除成功!');
- return;
- }
- tempTip.setDuration(3000);
- tempTip.show('删除教程失败!发生错误:' + response.data.data);
- }).catch(function (err) {
- tempTip.setDuration(3000);
- tempTip.show('删除教程失败!' + '网络错误:' + err);
- });
- },
- processEdit(id) {
- location.href = "{{url('process')}}/" + id + "/edit";
- },
- //去往新增教程
- addTutorial() {
- window.open("{{url('maintenance/tutorial/create?owner_id=')}}" + this.processTutorial.owner_id);
- },
- //展开内容单
- unfold(code, id, type) {
- this.$set(this.processUnfold, code + id, type);
- },
- close(code, id) {
- this.$delete(this.processUnfold, code + id);
- },
- rollback(id) {
- if (!confirm('确定要回滚至上一阶段吗?')) return;
- if (!id) return;
- let _this = this;
- axios.post('{{url('process/rollback')}}', {id: id})
- .then(function (response) {
- if (response.data.success) {
- _this.processes.every(function (process) {
- if (process.id === id) {
- process.status = response.data.data;
- return false
- }
- return true;
- });
- tempTip.setDuration(2000);
- tempTip.showSuccess('回滚成功!');
- return;
- }
- tempTip.setDuration(3000);
- tempTip.show('回滚失败!未知错误!');
- }).catch(function (err) {
- tempTip.setDuration(3000);
- tempTip.show('回滚失败!网络错误:' + err);
- })
- },
- destroy(code, id) {
- if (!confirm('确定要删除“' + code + "”吗?")) return;
- let _this = this;
- let delArr = [];
- axios.delete('{{url('process')}}/' + id)
- .then(function (response) {
- tempTip.setDuration(3000);
- if (response.data.success) {
- _this.processes.forEach(function (process, i) {
- if (process.code === code)
- delArr.unshift(i);
- });
- delArr.forEach(function (del) {
- _this.$delete(_this.processes, del);
- });
- tempTip.showSuccess('删除“' + code + '”成功!');
- return;
- }
- tempTip.show('删除“' + code + '”失败!该单已不存在')
- }).catch(function (err) {
- tempTip.setDuration(4000);
- tempTip.show("网络错误:" + err);
- })
- },
- //审核
- audit(process) {
- if (!confirm('确定要通过“' + process.code + "”的审核吗?")) return;
- axios.post('{{url('process/audit')}}', {id: process.id})
- .then(function (response) {
- if (response.data.success) {
- process.status = '待接单';
- tempTip.setDuration(2000);
- tempTip.showSuccess('“' + process.code + "”的审核通过!");
- return;
- }
- tempTip.setDuration(3000);
- tempTip.show('审核失败:未知错误,请联系管理员!');
- }).catch(function (err) {
- tempTip.setDuration(3000);
- tempTip.showSuccess('审核失败,网络错误:' + err);
- })
- },
- checkAndAccept(process) {
- if (!confirm('确定要验收“' + process.code + "”吗?")) return;
- axios.post('{{url('process/checkAndAccept')}}', {id: process.id})
- .then(function (response) {
- if (response.data.success) {
- process.status = response.data.data;
- tempTip.setDuration(2000);
- tempTip.showSuccess('“' + process.code + "”验收完成!");
- return;
- }
- tempTip.setDuration(3000);
- tempTip.show(response.data.data)
- }).catch(function (err) {
- tempTip.setDuration(3000);
- tempTip.show('网络错误:' + err)
- })
- },
- show(id) {
- {{--window.location.href = '{{url('process')}}/' + id;--}}
- window.open('{{url('process')}}/' + id,'_blank') ;
- },
- //修改价格
- updateUnitPrice(process) {
- if (!confirm('确定要修改“' + process.code + "”的单价吗?")) return;
- let unit_price = $('#unit_price_' + process.id)[0].value;
- if (!unit_price || isNaN(unit_price)) {
- tempTip.setDuration(3000);
- tempTip.show('请输入正确的价格!');
- return;
- }
- axios.post('{{url('process/updateUnitPrice')}}', {id: process.id, unit_price: unit_price})
- .then(function (response) {
- if (response.data.success) {
- process.signs.push(response.data.sign);
- process.is_update_unit_price = false;
- process.signUnitPrice = unit_price;
- tempTip.setDuration(2000);
- tempTip.showSuccess('“' + process.code + "”价格修改成功,确认通过后生效!");
- return;
- }
- tempTip.setDuration(3000);
- tempTip.show(response.data.data);
- }).catch(function (err) {
- tempTip.setDuration(3000);
- tempTip.show('网络错误:' + err);
- })
- },
- //组长或财务确认
- verify(process, type) {
- if (!confirm('确定要通过“'+process.code+"”的审核吗"))return;
- let url = '{{url('process/workGroupVerify')}}';
- let msg = '二次加工组';
- if (type === 'accountant') {
- url = '{{url('process/accountantVerify')}}';
- msg = '财务';
- }
- let _this=this;
- axios.post(url, {id: process.id})
- .then(function (response) {
- if (response.data.success) {
- if (response.data.data){
- process.signs.push(response.data.data);
- _this.$set(_this.signs[process.code],response.data.data.mark,true);
- }else{
- _this.signs[process.code]=[];
- process.signs=[];
- process.unit_price = process.signUnitPrice;
- process.signUnitPrice = '';
- }
- if (process.is_update_unit_price)process.is_update_unit_price = false;
- tempTip.setDuration(2000);
- tempTip.showSuccess('“' + process.code + "”新价格通过" + msg + "审核!");
- return;
- }
- tempTip.setDuration(3000);
- tempTip.show(response.data.data);
- }).catch(function (err) {
- tempTip.setDuration(3000);
- tempTip.show('网络错误:' + err);
- })
- },
- update_process_date(processDailyParticipant){
- let date=this.date;
- let is_update_date=this.is_update_date;
- let _this=this;
- if (is_update_date==='start_date') _this.dateTextMap.start_date='起';
- else _this.dateTextMap.end_date='终';
- if (!date){
- tempTip.show('未输入日期!');
- return;
- }
- let url='';
- if (is_update_date==='start_date'){
- if (!confirm('确定要设定“'+date+'”为新的起始日期吗?以往记录将被删除!'))return;
- url='{{url('process/updateStartDate')}}';
- }
- else{
- if (!confirm('确定要设定“'+date+'”为新的终止日期吗?'))return;
- url='{{url('process/updateEndDate')}}';
- }
- axios.post(url,{process_id:processDailyParticipant.process_id,date:date})
- .then(function (response) {
- if(response.data.success){
- _this.resetProcessDaily(response.data.data,processDailyParticipant.process_id);
- _this.is_update_date='';
- tempTip.setDuration(2000);
- tempTip.showSuccess('成功修改“'+date+'”为新的'+(is_update_date==='start_date' ? '起始时间' :'终止时间')+'!');
- return;
- }
- tempTip.setDuration(3000);
- tempTip.show(response.data.data);
- }).catch(function (err) {
- tempTip.setDuration(3000);
- tempTip.show('网络错误:'+err);
- })
- },
- resetProcessDailyParticipants(index){
- console.log("resetProcessDailyParticipants")
- if (this.processDailyParticipants[index].daily_id){
- if (this.processDailyParticipants[index+1] && !this.processDailyParticipants[index+1].daily_id){
- this.processDailyParticipants[index+1].daily_id=this.processDailyParticipants[index].daily_id;
- this.processDailyParticipants[index+1].date=this.processDailyParticipants[index].date;
- this.processDailyParticipants[index+1].isAddProcessDailyParticipant=this.processDailyParticipants[index].isAddProcessDailyParticipant;
- this.processDailyParticipants[index+1].isConfirmBtn=this.processDailyParticipants[index].isConfirmBtn;
- this.processDailyParticipants[index+1].output=this.processDailyParticipants[index].output;
- this.processDailyParticipants[index+1].process_id=this.processDailyParticipants[index].process_id;
- this.processDailyParticipants[index+1].readonly=this.processDailyParticipants[index].readonly;
- this.processDailyParticipants[index+1].remain=this.processDailyParticipants[index].remain;
- this.processDailyParticipants[index+1].rowspan=this.processDailyParticipants[index].rowspan - 1;
- this.processDailyParticipants[index+1].submitOutput=this.processDailyParticipants[index].submitOutput;
- this.$delete(this.processDailyParticipants,index);
- }else{
- let processDailyParticipant = {
- 'daily_id': this.processDailyParticipants[index].daily_id,
- 'date': this.processDailyParticipants[index].date,
- 'isAddProcessDailyParticipant': this.processDailyParticipants[index].isAddProcessDailyParticipant,
- 'isConfirmBtn': this.processDailyParticipants[index].isConfirmBtn,
- 'output': this.processDailyParticipants[index].output,
- 'process_id': this.processDailyParticipants[index].process_id,
- 'readonly': this.processDailyParticipants[index].readonly,
- 'remain': this.processDailyParticipants[index].remain,
- 'rowspan': this.processDailyParticipants[index].rowspan,
- 'submitOutput': this.processDailyParticipants[index].submitOutput,
- };
- this.$set(this.processDailyParticipants,index,processDailyParticipant);
- }
- }
- else this.$delete(this.processDailyParticipants,index);
- },
- deleteDailyParticipant(index){
- let _this=this;
- if (!confirm('确定要删除“' + _this.processDailyParticipants[index].user_detail_full_name + "”的工作记录吗?"))return;
- axios.delete('{{url('process/destroyDailyParticipant')}}/'+_this.processDailyParticipants[index].id)
- .then(res=>{
- if (res.data.success){
- _this.resetProcessDailyParticipants(index);
- tempTip.setDuration(2000);
- tempTip.showSuccess('删除“'+_this.processDailyParticipants[index].user_detail_full_name+'”的工作记录成功!');
- return;
- }
- tempTip.setDuration(3000);
- tempTip.show(res.data.data);
- }).catch(err=>{
- tempTip.setDuration(4000);
- tempTip.show('网络错误:'+err);
- })
- },
- //修改时的晚饭时间改变计时工时
- updateDinnerDuration(processDailyParticipantOne,e){
- let oldValue=Number(e.target.dataset.oldValue) / 60;
- let newValue=Number(processDailyParticipantOne.dinner_duration) / 60;
- processDailyParticipantOne.hour_count += (oldValue-newValue);
- },
- //修改每日产量
- updateOutput(processDailyParticipant){
- if (processDailyParticipant.id) processDailyParticipant.readonly=false;
- else {
- tempTip.setDuration(3000);
- tempTip.show('该日无参与人加工信息,请先录入参与人加工信息!');
- processDailyParticipant.readonly=true;
- }
- },
- count(value,processes){
- let count=0;
- processes.every(function (process,i) {
- if (process.id)count++;
- if (i == value) return false;
- return true;
- });
- return count;
- }
- },
- });
- </script>
- @endsection
|