|
@@ -25,8 +25,39 @@
|
|
|
<el-col class="card-header1" :span="24">线路:{{ getroute(item.route) }}</el-col>
|
|
|
</el-row>
|
|
|
</div>
|
|
|
- <data-table height="200px" :fields="fields" :data="item.split" :usePage="false" :opera="opera" @handleSelect="toSelect" :select="true">
|
|
|
- </data-table>
|
|
|
+ <!-- <data-table
|
|
|
+ height="200px"
|
|
|
+ :fields="fields"
|
|
|
+ :data="item.split"
|
|
|
+ :usePage="false"
|
|
|
+ :opera="opera"
|
|
|
+ @handleSelect="toSelect"
|
|
|
+ :select="true"
|
|
|
+ rowkey="_id"
|
|
|
+ >
|
|
|
+ </data-table> -->
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-table
|
|
|
+ :data="item.split"
|
|
|
+ border
|
|
|
+ height="200px"
|
|
|
+ @selection-change="
|
|
|
+ val => {
|
|
|
+ handleSelectionChange(val, index);
|
|
|
+ }
|
|
|
+ "
|
|
|
+ @select="onTableSelect"
|
|
|
+ >
|
|
|
+ <el-table-column type="selection" width="55"> </el-table-column>
|
|
|
+ <el-table-column prop="name" label="货物" sortable></el-table-column>
|
|
|
+ <el-table-column prop="number" label="数量" sortable></el-table-column>
|
|
|
+ <el-table-column prop="weight" label="重量" sortable></el-table-column>
|
|
|
+ <el-table-column prop="volume" label="体积" sortable></el-table-column>
|
|
|
+ <el-table-column prop="remark" label="备注" sortable></el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
</el-card>
|
|
|
</el-col>
|
|
|
<el-col :span="24" class="page">
|
|
@@ -156,6 +187,7 @@
|
|
|
// 分页
|
|
|
import page from '@f/components/pagination.vue';
|
|
|
import { mapState, createNamespacedHelpers } from 'vuex';
|
|
|
+const _ = require('lodash');
|
|
|
// 订单表
|
|
|
const { mapActions: order } = createNamespacedHelpers('order');
|
|
|
// 客户表
|
|
@@ -192,13 +224,13 @@ export default {
|
|
|
// 线路列表
|
|
|
routeList: [],
|
|
|
// 订单列表
|
|
|
- fields: [
|
|
|
- { label: '货物', model: 'name' },
|
|
|
- { label: '数量', model: 'number' },
|
|
|
- { label: '重量', model: 'weight' },
|
|
|
- { label: '体积', model: 'volume' },
|
|
|
- { label: '备注', model: 'remark' },
|
|
|
- ],
|
|
|
+ // fields: [
|
|
|
+ // { label: '货物', model: 'name' },
|
|
|
+ // { label: '数量', model: 'number' },
|
|
|
+ // { label: '重量', model: 'weight' },
|
|
|
+ // { label: '体积', model: 'volume' },
|
|
|
+ // { label: '备注', model: 'remark' },
|
|
|
+ // ],
|
|
|
list: [],
|
|
|
total: 0,
|
|
|
limit: 4,
|
|
@@ -238,6 +270,8 @@ export default {
|
|
|
taxesList: [],
|
|
|
// 当供应商类型为0,2时,路线在订单中直接获取
|
|
|
depositRoute: '',
|
|
|
+ num: true,
|
|
|
+ newObj: {},
|
|
|
};
|
|
|
},
|
|
|
async created() {
|
|
@@ -281,10 +315,12 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
// 选择货物
|
|
|
- toSelect(data) {
|
|
|
- let newData = data.concat(this.selected);
|
|
|
- this.$set(this, `selected`, newData);
|
|
|
- },
|
|
|
+ // toSelect(data) {
|
|
|
+ // console.log(data);
|
|
|
+ // let newData = data.concat(this.selected);
|
|
|
+ // this.$set(this, `selected`, newData);
|
|
|
+ // console.log(this.selected);
|
|
|
+ // },
|
|
|
// 发车
|
|
|
async toExport() {
|
|
|
let res = await this.transportNo();
|
|
@@ -327,6 +363,7 @@ export default {
|
|
|
// 生成装车单
|
|
|
async onSubmit() {
|
|
|
let data = this.form;
|
|
|
+ // console.log(data);
|
|
|
data.goods = this.goodsList;
|
|
|
let res = await this.transportCreate(data);
|
|
|
if (this.$checkRes(res)) {
|
|
@@ -440,6 +477,47 @@ export default {
|
|
|
this.$set(this, `carnoList`, res.data);
|
|
|
}
|
|
|
},
|
|
|
+ handleSelectionChange(val, index) {
|
|
|
+ // console.log(val, index);
|
|
|
+ let obj = this.newObj;
|
|
|
+ let numberIndex;
|
|
|
+ // console.log(obj);
|
|
|
+ if (val.length === 0) {
|
|
|
+ // console.log(index);
|
|
|
+ // console.log(this.selected);
|
|
|
+ // console.log(this.list[index].split);
|
|
|
+
|
|
|
+ let newArray = _.differenceWith(this.selected, this.list[index].split, _.isEqual);
|
|
|
+ this.$set(this, `selected`, newArray);
|
|
|
+ // console.log('全部取消');
|
|
|
+ } else {
|
|
|
+ if (this.num === false) {
|
|
|
+ numberIndex = _.findIndex(this.selected, function(o) {
|
|
|
+ return o._id == obj._id;
|
|
|
+ });
|
|
|
+ // console.log(numberIndex);
|
|
|
+ var newSelected = _.cloneDeep(this.selected);
|
|
|
+ newSelected.splice(numberIndex, 1);
|
|
|
+ this.$set(this, `selected`, newSelected);
|
|
|
+ // console.log('取消');
|
|
|
+ } else if (this.num === true || this.num === 0) {
|
|
|
+ // console.log(this.num);
|
|
|
+ let newArr = _.difference(val, this.selected);
|
|
|
+ let newData = newArr.concat(this.selected);
|
|
|
+ this.$set(this, `selected`, newData);
|
|
|
+ // console.log('选中');
|
|
|
+ // console.log(this.selected);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // console.log(this.selected);
|
|
|
+ },
|
|
|
+ onTableSelect(selection, row) {
|
|
|
+ // console.log(selection, row);
|
|
|
+ this.num = selection.length && selection.indexOf(row) !== -1;
|
|
|
+ // console.log('哈哈哈');
|
|
|
+ // console.log(this.num);
|
|
|
+ this.newObj = row;
|
|
|
+ },
|
|
|
},
|
|
|
computed: {
|
|
|
...mapState(['user']),
|