|
|
@@ -13,11 +13,11 @@
|
|
|
{{-- @endcan--}}
|
|
|
<div class="card-body">
|
|
|
<div class="row pull-left m-1">
|
|
|
- @can('基础设置-快递打印-打印机-添加')
|
|
|
+{{-- @can('基础设置-快递打印-打印机-添加')--}}
|
|
|
<button class="btn btn-outline-info mb-1 mr-3" @click="showCreatedModel"><span
|
|
|
class="fa fa-plus"></span> 新 增
|
|
|
</button>
|
|
|
- @endcan
|
|
|
+{{-- @endcan--}}
|
|
|
</div>
|
|
|
@include('maintenance.expressPrinting.setting.printer._table')
|
|
|
</div>
|
|
|
@@ -27,7 +27,7 @@
|
|
|
|
|
|
@section('lastScript')
|
|
|
<script>
|
|
|
- let list = new Vue({
|
|
|
+ var list = new Vue({
|
|
|
el: "#list",
|
|
|
data: {
|
|
|
printers: {!! $terminalPrinters->toJson() !!}['data'],
|
|
|
@@ -36,17 +36,22 @@
|
|
|
{id:'{{$terminal->id}}',name:'{{$terminal->name}}'},
|
|
|
@endforeach
|
|
|
],
|
|
|
- printer: {},
|
|
|
+ logistics:[
|
|
|
+ @foreach($logistics as $logistic)
|
|
|
+ {id:'{{$logistic->id}}',name:'{{$logistic->name}}'},
|
|
|
+ @endforeach
|
|
|
+ ],
|
|
|
+ printer: {
|
|
|
+ logistic_ids:[],
|
|
|
+ },
|
|
|
printerErrors: {},
|
|
|
terminalFilter:null,
|
|
|
+ filter:{
|
|
|
+ logistic:null, // 删选 logistic
|
|
|
+ printer_logistic:null, // 删选 printer->logistic
|
|
|
+ },
|
|
|
index: null,
|
|
|
selectTr: null,
|
|
|
- types: [
|
|
|
- {name: '0', value: '菜鸟'},
|
|
|
- {name: '1', value: '拼多多'},
|
|
|
- {name: '2', value: '顺丰'},
|
|
|
- {name: '3', value: '京东'},
|
|
|
- ]
|
|
|
},
|
|
|
mounted() {
|
|
|
$("#list").removeClass('d-none');
|
|
|
@@ -64,18 +69,42 @@
|
|
|
if (terminalFilter.length < this.terminals.length && terminalFilter.length>0)
|
|
|
this.printer.terminal_id = terminalFilter[0]['id'];
|
|
|
return terminalFilter;
|
|
|
- }
|
|
|
+ },
|
|
|
+
|
|
|
},
|
|
|
methods: {
|
|
|
+ includeLogistics(item){
|
|
|
+ let bool = !this.printer.logistic_ids.includes(item.id);
|
|
|
+ if (bool && this.filter.logistic !== null && this.filter.logistic.length > 0)
|
|
|
+ return item.name.includes(this.filter.logistic)
|
|
|
+ return bool;
|
|
|
+ },
|
|
|
+ includePrintLogistic(item){
|
|
|
+ if (this.printer.logistic_ids.length === 0) return false;
|
|
|
+ let bool = this.printer.logistic_ids.includes(item.id);
|
|
|
+ if (bool && this.filter.printer_logistic !== null && this.filter.printer_logistic.length > 0)
|
|
|
+ return item.name.includes(this.filter.printer_logistic)
|
|
|
+ return bool;
|
|
|
+ },
|
|
|
showCreatedModel() {
|
|
|
- this.printer = {};
|
|
|
+ this.printer.logistic_ids = [];
|
|
|
this.printerErrors = {};
|
|
|
+ this.filter.logistic = null;
|
|
|
+ this.filter.printer_logistic = null;
|
|
|
$('#create-printer').modal('show');
|
|
|
},
|
|
|
showEditModel(printer, index) {
|
|
|
- this.printer = JSON.parse(JSON.stringify(printer));
|
|
|
+ let data = JSON.parse(JSON.stringify(printer));
|
|
|
+ data.logistics = null;
|
|
|
+ data.logistic_ids = printer.logistics.map(item=>{
|
|
|
+ return ""+item.id;
|
|
|
+ });
|
|
|
+ this.printer = data;
|
|
|
+ this.$forceUpdate();
|
|
|
this.index = index;
|
|
|
this.printerErrors = {};
|
|
|
+ this.filter.logistic = null;
|
|
|
+ this.filter.printer_logistic = null;
|
|
|
$('#edit-printer').modal('show');
|
|
|
},
|
|
|
createPrinter() {
|
|
|
@@ -134,6 +163,14 @@
|
|
|
}).catch(err => {
|
|
|
window.tempTip.show('网络异常!' + err)
|
|
|
});
|
|
|
+ },
|
|
|
+ addToLogistics(logistic){
|
|
|
+ this.printer.logistic_ids.push(logistic.id)
|
|
|
+ },
|
|
|
+ removeToLogistics(logistic){
|
|
|
+ this.printer.logistic_ids = this.printer.logistic_ids.filter(item=>{
|
|
|
+ return item !== logistic.id;
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
})
|