<template>
|
<div class="page-list-container">
|
<!-- 数据Table -->
|
<yrt-data-list :ref="dataListRef" :editor-ref="editorRef" :data-options="dataOptions" :fields.sync="dataListOptions.fields" :buttons="dataListOptions.buttons" :button-click="buttonClick" :data-list-selections.sync="dataListSelections" :auth-nodes="authNodes">
|
<template slot="common-column-slot" slot-scope="{row, col}">
|
<template v-if="col.prop==dataOptions.linkColumn">
|
<el-link type="primary" @click.native="()=>{linkEditor(row[dataOptions.idField], row);}">
|
<template v-if="['date', 'datetime'].indexOf(col.dataType)>=0 && col.formatter">
|
{{ common.formatDate(row[col.prop], col.formatter) }}
|
</template>
|
<template v-else-if="['byte', 'int32', 'int64', 'decimal', 'double'].indexOf(col.dataType)>=0 && col.formatter">
|
{{ common.formatNumber(row[col.prop], col.formatter) }}
|
</template>
|
<template v-else>
|
{{ row[col.prop] }}
|
</template>
|
</el-link>
|
</template>
|
<!-- 自定义地址显示 -->
|
<template v-else-if="col.prop === 'address'">
|
<template>
|
<el-tag v-if="row[col.prop]==0" color="#ffff33" style="color:black;border:0">
|
{{ $refs[dataListRef].translateText(col.prop, row[col.prop], col.dropdown_Id) }}
|
</el-tag>
|
<el-tag v-else-if="row[col.prop]==1" color="#ff0033" style="color:white;border:0">
|
{{ $refs[dataListRef].translateText(col.prop, row[col.prop], col.dropdown_Id) }}
|
</el-tag>
|
<el-tag v-else-if="row[col.prop]==2" color="#33cc33" style="color:black;border:0;color:#fff;">
|
{{ $refs[dataListRef].translateText(col.prop, row[col.prop], col.dropdown_Id) }}
|
</el-tag>
|
<span v-else>
|
{{ row[col.prop] }}
|
</span>
|
</template>
|
</template>
|
<!-- 自定义地址显示 -->
|
<template v-else-if="col.prop === 'type ','stats'">
|
<template>
|
<el-tag v-if="row[col.prop]=='配送单'" color="#00cc00" style="color:white;border:0">
|
{{ row[col.prop] }}
|
</el-tag>
|
<el-tag v-else-if="row[col.prop]=='待接单'" color="#ffff33" style="color:black;border:0">
|
{{ row[col.prop] }}
|
</el-tag>
|
<el-tag v-else-if="row[col.prop]=='已签收'" color="#00cc00" style="color:white;border:0">
|
{{ row[col.prop] }}
|
</el-tag>
|
<span v-else>
|
{{ row[col.prop] }}
|
</span>
|
</template>
|
</template>
|
<template v-else>
|
<template v-if="['date', 'datetime'].indexOf(col.dataType)>=0 && col.formatter">
|
{{ common.formatDate(row[col.prop], col.formatter) }}
|
</template>
|
<template v-else-if="['byte', 'int32', 'int64', 'decimal', 'double'].indexOf(col.dataType)>=0 && col.formatter">
|
{{ common.formatNumber(row[col.prop], col.formatter) }}
|
</template>
|
<template v-else>
|
<template v-if="['date','datetime'].indexOf(col.dataType)>=0 && col.formatter">
|
{{ common.formatDate(row[col.prop], col.formatter) }}
|
</template>
|
<template v-else-if="['byte', 'int32', 'int64', 'decimal', 'double'].indexOf(col.dataType)>=0 && col.formatter">
|
{{ common.formatNumber(row[col.prop], col.formatter) }}
|
</template>
|
<template v-else>
|
{{ row[col.prop] }}
|
</template>
|
</template>
|
</template>
|
</template>
|
</yrt-data-list>
|
<!--数据编辑器Editor-->
|
<yrt-editor :ref="editorRef" :use-detail-slot="['stats']" :edit-button-click="editButtonClick" :data-list-ref="dataListRef" v-bind="editorOptions" :data-options="dataOptions" :action.sync="editorOptions.action" :top.sync="editorOptions.top" :visible.sync="editorOptions.config.visible" :detail-button-click="detailButtonClick" :auth-nodes="authNodes" :btn-read-only="btnReadOnly" @on-edit-load-after="onEditLoadAfter">
|
<template slot="detail-column-slot" slot-scope="{ row, col }">
|
<template v-if="col.prop == 'stats'">
|
<el-tag v-if="row[col.prop]=='配送中'" color="#00cc00" style="color:black;border:0">
|
{{ row[col.prop] }}
|
</el-tag>
|
</template>
|
</template>
|
</yrt-editor>
|
</div>
|
</template>
|
<script>
|
import baseLayout from "@/components/common/base-layout.vue";
|
export default {
|
name: "tms-biz-tms-distribution",
|
components: {},
|
mixins: [baseLayout],
|
data() {
|
return {};
|
},
|
methods: {
|
editButtonClick() {},
|
onEditLoadAfter() {},
|
buttonClick(authNode) {
|
switch (authNode) {
|
case "receiving":
|
// 接单
|
this.receiving();
|
return true;
|
case "start":
|
// 装车完成
|
this.start();
|
return true;
|
case "sign":
|
// 签收
|
this.sign();
|
return true;
|
}
|
},
|
// 接单
|
receiving() {
|
// 获取选择框选中的长度
|
const ids = this.dataList.dataListSelections.map(item => item.distribution_Id);
|
if (!ids.length) {
|
this.$message.error("至少选择一行!");
|
return;
|
}
|
const url = "/api/tms/distribution/receiving";
|
const params = {
|
distribution_Ids: ids
|
};
|
const callback = res => {
|
this.common.showMsg(res);
|
if (res.result) {
|
// 成功后返回true
|
this.dataList.reload();
|
}
|
};
|
this.common.ajax(url, params, callback);
|
},
|
// 装车完成
|
start() {
|
const ids = this.dataList.dataListSelections.map(item => item.distribution_Id);
|
if (!ids.length) {
|
this.$message.error("至少选择一行!");
|
return;
|
}
|
const url = "/api/tms/distribution/start";
|
const params = {
|
distribution_Ids: ids
|
};
|
const callback = res => {
|
this.common.showMsg(res);
|
if (res.result) {
|
// 成功后返回true
|
this.dataList.reload();
|
}
|
};
|
this.common.ajax(url, params, callback);
|
},
|
// 签收
|
sign() {
|
const ids = this.dataList.dataListSelections.map(item => item.distribution_Id);
|
if (!ids.length) {
|
this.$message.error("至少选择一行!");
|
return;
|
}
|
const url = "/api/tms/distribution/sign";
|
const params = {
|
distribution_Ids: ids
|
};
|
const callback = res => {
|
this.common.showMsg(res);
|
if (res.result) {
|
// 成功后返回true
|
this.dataList.reload();
|
}
|
};
|
this.common.ajax(url, params, callback);
|
}
|
}
|
};
|
</script>
|