| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594 |
- <template>
- <div class="home-container">
- <el-card class="home-container__card">
- <div>
- <div class="content" v-loading="loading">
- <avue-crud :data="tableData" :option="option" :key="key" ref="crud" @refresh-change="refresh"
- @resetColumn="resetColumn"
- @saveColumn="saveColumn">
- <template slot="menuLeft">
- <span>今日业务详情(集装箱)</span>
- </template>
- <template slot="billNo" slot-scope="{row}">
- <span class="el-button--text" style="cursor: pointer"
- @click="openTrack(row,0)">{{ row.billNo }}</span>
- </template>
- <template slot="plateNo" slot-scope="{row}">
- <span class="el-button--text" style="cursor: pointer"
- @click="openTrack(row,1)">{{ row.plateNo }}</span>
- </template>
- <template slot="addressDetail" slot-scope="{ row,index}">
- <el-tooltip class="item" effect="dark" placement="top">
- <div v-html="ToBreak(row.addressDetail)" slot="content"></div>
- <div style="overflow: hidden;white-space: nowrap;text-overflow: ellipsis;">{{ row.addressDetail }}</div>
- </el-tooltip>
- </template>
- <template slot="status" slot-scope="{row}">
- <span v-if="row.status == 0" style="color: #E45656;">未调度</span>
- <span v-if="row.status == 1" style="color: #F56C6C;">未派车</span>
- <span v-if="row.status == 2" style="color: #F1A532;">未受理</span>
- <span v-if="row.status == 3" style="color: #53C21D;">未完工</span>
- <span v-if="row.status == 5" style="color: #F56C6C;">未到厂</span>
- <span v-if="row.status == 4" style="color: #3C9CFF;">工单关闭</span>
- <span v-if="row.status == 6" style="color: #3C9CFF;">未提箱</span>
- </template>
- </avue-crud>
- </div>
- </div>
- </el-card>
- <el-dialog
- title="车辆轨迹"
- append-to-body
- custom-class="dialog_two"
- :visible.sync="dialogVisible"
- lock-scroll
- width="80%">
- <div id="container"></div>
- </el-dialog>
- </div>
- </template>
- <script>
- import {active} from "@/api/wel";
- import {gaude, location} from "@/api/gaude";
- import data from "@/views/util/data";
- export default {
- name: "basicContainer",
- props: {
- sysType: Number
- },
- data() {
- return {
- entrustTimer:null,
- roleName: localStorage.getItem("roleName").split(','),
- dialogVisible: false,
- loading: false,
- tableData: [],
- map: null,
- infoWindow: null,
- marker: null,
- lineArr: [],
- key: 0,
- option: {},
- optionList: {
- stripe: true,
- index: true,
- menu: false,
- refreshBtn: true,
- addBtn: false,
- height: 390,
- align: 'center',
- column: [
- {
- label: '货运日期',
- prop: 'arrivalTime',
- type: "date",
- format: "yyyy-MM-dd HH:mm",
- index: 1,
- width: 150,
- overHidden: true,
- },
- {
- label: '货运地点',
- prop: 'addressDetail',
- index: 3,
- width: 100
- },
- {
- label: '票据号',
- prop: 'receiptNo',
- index: 4,
- width: 100,
- overHidden: true,
- },
- {
- label: '提单号',
- prop: 'billNo',
- index: 5,
- width: 140,
- overHidden: true,
- },
- {
- label: '场站',
- prop: 'station',
- index: 6,
- width: 100,
- overHidden: true,
- },
- {
- label: '箱型箱量',
- prop: 'ctnDetail',
- index: 7,
- width: 100,
- overHidden: true,
- },
- {
- label: '车队',
- prop: 'fleetShortName',
- index: 11,
- width: 100,
- overHidden: true,
- },
- {
- label: '车号',
- prop: 'plateNo',
- index: 12,
- width: 100,
- overHidden: true,
- },
- {
- label: '状态',
- prop: 'status',
- type: 'select',
- dicUrl: "/api/blade-system/dict-biz/dictionary?code=land_order_status",
- props: {
- label: "dictValue",
- value: "dictKey"
- },
- dataType: "string",
- index: 13,
- width: 100,
- overHidden: true,
- }, {
- label: '备注',
- prop: 'remarks',
- index: 17,
- width: 100,
- overHidden: true,
- },
- ]
- },
- };
- },
- async mounted() {
- this.option = await this.getColumnData(this.getColumnName(140), this.optionList);
- this.key++
- this.init();
- if (this.roleName.indexOf('平台') !== -1||this.roleName.indexOf('总调度') !== -1||this.roleName.indexOf('分管调度') !== -1) {
- for (let item of this.option.column) {
- if (item.prop === 'extraAmountC') return
- }
- this.option.column.push(
- {
- label: '业务员',
- prop: 'salesmanName',
- index: 2,
- width: 60,
- overHidden: true,
- },{
- label: '运输调度',
- prop: 'dispatcherName',
- overHidden: true,
- index: 2,
- width: 100,
- },
- {
- label: '客户名称',
- prop: 'corpShortName',
- index: 16,
- width: 100,
- overHidden: true,
- },{
- label: '应付杂费',
- prop: 'extraAmountC',
- index: 14,
- width: 100,
- overHidden: true
- },
- {
- label: '应收运费',
- prop: 'landAmountD',
- index: 13,
- width: 100,
- overHidden: true,
- },
- {
- label: '应收杂费',
- prop: 'extraAmountD',
- index: 13,
- width: 100,
- overHidden: true,
- }
- )
- }
- if (this.roleName.indexOf('车队') !== -1) {
- for (let item of this.option.column) {
- if (item.prop === 'extraAmountC') return
- }
- this.option.column.push(
- {
- label: '物流运输',
- prop: 'dispatchDeptName',
- overHidden: true,
- index: 1,
- width: 100
- }, {
- label: '运输调度',
- prop: 'dispatcherName',
- overHidden: true,
- index: 1,
- width: 100,
- }, {
- label: '应付运费',
- prop: 'landAmountC',
- index: 13,
- width: 100,
- overHidden: true,
- },{
- label: '应付杂费',
- prop: 'extraAmountC',
- index: 13,
- width: 100,
- overHidden: true
- }
- )
- }
- if (this.roleName.indexOf('客户') !== -1) {
- for (let item of this.option.column) {
- if (item.prop === 'salesmanName') return
- }
- this.option.column.push(
- {
- label: '业务员',
- prop: 'salesmanName',
- index: 2,
- width: 60,
- overHidden: true,
- },{
- label: '物流运输',
- prop: 'dispatchDeptName',
- overHidden: true,
- index: 2,
- width: 100
- },
- {
- label: '客户名称',
- prop: 'corpShortName',
- index: 16,
- width: 100,
- overHidden: true,
- },
- {
- label: '应收运费',
- prop: 'landAmountD',
- index: 14,
- width: 100,
- overHidden: true,
- },
- {
- label: '应收杂费',
- prop: 'extraAmountD',
- index: 15,
- width: 100,
- overHidden: true,
- }
- )
- }
- },
- beforeDestroy() {
- this.map && this.map.destroy();
- clearInterval(this.entrustTimer); //关闭
- },
- methods: {
- //自定义列保存
- async saveColumn() {
- /**
- * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
- * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
- * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
- */
- const inSave = await this.saveColumnData(this.getColumnName(140), this.option);
- if (inSave) {
- this.$message.success("保存成功");
- //关闭窗口
- this.$refs.crud.$refs.dialogColumn.columnBox = false;
- }
- },
- //自定义列重置
- async resetColumn() {
- this.option = this.optionList;
- const inSave = await this.delColumnData(this.getColumnName(140), this.optionList);
- if (inSave) {
- this.$message.success("重置成功");
- //关闭窗口
- this.$refs.crud.$refs.dialogColumn.columnBox = false;
- this.key++
- if (this.roleName.indexOf('平台') !== -1||this.roleName.indexOf('总调度') !== -1||this.roleName.indexOf('分管调度') !== -1) {
- for (let item of this.option.column) {
- if (item.prop === 'extraAmountC') return
- }
- this.option.column.push(
- {
- label: '业务员',
- prop: 'salesmanName',
- index: 2,
- width: 60,
- overHidden: true,
- },{
- label: '运输调度',
- prop: 'dispatcherName',
- overHidden: true,
- index: 2,
- width: 100,
- },
- {
- label: '客户名称',
- prop: 'corpShortName',
- index: 16,
- width: 100,
- overHidden: true,
- },{
- label: '应付杂费',
- prop: 'extraAmountC',
- index: 14,
- width: 100,
- overHidden: true
- },
- {
- label: '应收运费',
- prop: 'landAmountD',
- index: 13,
- width: 100,
- overHidden: true,
- },
- {
- label: '应收杂费',
- prop: 'extraAmountD',
- index: 13,
- width: 100,
- overHidden: true,
- }
- )
- }
- if (this.roleName.indexOf('车队') !== -1) {
- for (let item of this.option.column) {
- if (item.prop === 'extraAmountC') return
- }
- this.option.column.push(
- {
- label: '物流运输',
- prop: 'dispatchDeptName',
- overHidden: true,
- index: 1,
- width: 100
- }, {
- label: '运输调度',
- prop: 'dispatcherName',
- overHidden: true,
- index: 1,
- width: 100,
- }, {
- label: '应付运费',
- prop: 'landAmountC',
- index: 13,
- width: 100,
- overHidden: true,
- },{
- label: '应付杂费',
- prop: 'extraAmountC',
- index: 13,
- width: 100,
- overHidden: true
- }
- )
- }
- if (this.roleName.indexOf('客户') !== -1) {
- for (let item of this.option.column) {
- if (item.prop === 'salesmanName') return
- }
- this.option.column.push(
- {
- label: '业务员',
- prop: 'salesmanName',
- index: 2,
- width: 60,
- overHidden: true,
- },{
- label: '物流运输',
- prop: 'dispatchDeptName',
- overHidden: true,
- index: 2,
- width: 100
- },
- {
- label: '客户名称',
- prop: 'corpShortName',
- index: 16,
- width: 100,
- overHidden: true,
- },
- {
- label: '应收运费',
- prop: 'landAmountD',
- index: 14,
- width: 100,
- overHidden: true,
- },
- {
- label: '应收杂费',
- prop: 'extraAmountD',
- index: 15,
- width: 100,
- overHidden: true,
- }
- )
- }
- }
- },
- openTrack(row, index) {
- if (index == 0) {
- this.$router.push({
- path: '/landTransportation/placeAnOrder/index',
- query: {id: row.orderId},
- });
- } else {
- // gaude({itemId: row.itemId, plateNo: row.plateNo, tenantId: '234557',color:'2'}).then(res => {
- // this.lineArr = res.data.data
- // this.dialogVisible = true
- // let this_ = this
- // setTimeout(function () {
- // this_.initMap();
- // }, 100)
- // })
- location({itemId: row.itemId, plateNo: row.plateNo, tenantId: '234557', color: '2'}).then(res => {
- console.log(res.data.data)
- console.log(this.lineArr[this.lineArr.length - 1])
- this.dialogVisible = true
- let this_ = this
- setTimeout(function () {
- this_.initMap(res.data.data, row.plateNo);
- }, 1000)
- })
- }
- },
- markerClick(e) {
- this.infoWindow.setContent(e.target.content);
- this.infoWindow.open(this.map, e.target.getPosition());
- },
- initMap(data, plateNo) {
- this.map = new AMap.Map("container", {resizeEnable: true});
- this.infoWindow = new AMap.InfoWindow({
- ffset: new AMap.Pixel(0, -30),
- offset: new AMap.Pixel(0, -30)
- });
- let icon = new AMap.Icon({
- size: new AMap.Size(52, 26), // 图标尺寸
- image: 'https://trade.tubaosoft.com/file/bladex/000000/1123598821738675201/che.png',
- imageSize: new AMap.Size(52, 26), // 根据所设置的大小拉伸或压缩图片
- });
- this.marker = new AMap.Marker({
- position: data.location,
- map: this.map,
- icon: icon,
- markerMeta: new AMap.Size(28, 28),
- offset: new AMap.Pixel(-26, -15),
- autoRotation: true,
- angle: -15
- });
- this.marker.content = '<div style="width: 300px;">'
- + '<p style="font-size: 22px;font-weight: bold;background-color: #2d8cf0;color: #fff;">' + plateNo + '</p>'
- + '<p style="padding: 5px 0"><span style="color: #a0a0a0">最后上报时间:</span>' + new Date(Number(data.time) + 8 * 60 * 60 * 1000).toJSON().split('T').join(' ').substr(0, 19) + '</p>'
- + '<div style="width: 150px;float: left;">'
- + '<p style="padding: 5px 0"><span style="color: #a0a0a0">车辆状态:</span>' + (data.speed > 0 ? '行驶中' : '停车') + '</p>'
- + '</div>'
- + '<div style="width: 150px;float: right;">'
- + '<p style="padding: 5px 0"><span style="color: #a0a0a0">速度:</span>' + data.speed + 'km/h</p>'
- + '</div>'
- + '<p><span style="color: #a0a0a0">当前位置:</span>' + data.address + '</p>'
- + '<p style="padding: 5px 0"><span style="color: #a0a0a0">经纬度:</span>' + data.location.join(',') + '</p>'
- + '</div>'
- this.infoWindow.open(this.map, this.map.getCenter());
- this.marker.on('click', this.markerClick);
- this.marker.emit('click', {target: this.marker});
- this.map.setFitView();
- },
- init() {
- this.getsalesTrend();
- let this_ = this
- this_.entrustTimer = setInterval(function () {
- if (JSON.parse(localStorage.getItem("saber-token")).content) {
- this_.getsalesTrend();
- }
- }, 60000)
- },
- query(data) {
- this.getsalesTrend(data)
- },
- getsalesTrend(data = {status: 0, mold: 0}) {
- this.loading = true;
- active(data).then(res => {
- this.tableData = res.data.data
- this.loading = false;
- })
- },
- ToBreak(val) {
- if (val) return val.replace(/\n/g, '<br/>')
- },
- refresh() {
- this.getsalesTrend()
- }
- }
- };
- </script>
- <style scoped src="../../../../../styles/demo-center.css"></style>
- <style scoped>
- #container {
- height: 80vh;
- width: 100%;
- }
- .input-card .btn {
- margin-right: 1.2rem;
- width: 9rem;
- }
- .input-card .btn:last-child {
- margin-right: 0;
- }
- </style>
- <style lang="scss" scoped>
- .home-container {
- padding: 0px 5px 5px 0px;
- box-sizing: border-box;
- height: 100%;
- ::v-deep .el-card__body {
- padding: 10px 15px;
- font-size: 14px;
- }
- &__card {
- width: 100%;
- height: 100%;
- }
- .title {
- display: flex;
- justify-content: space-between;
- }
- }
- .content {
- }
- ::v-deep .el-dialog {
- margin-top: 5vh !important;
- margin-bottom: 0 !important;
- }
- ::v-deep .el-dialog__body {
- padding: 0 20px 10px 20px !important;
- }
- ::v-deep .amap-info-close {
- right: 10px !important;
- top: 12px !important;
- }
- ::v-deep .amap-info-content {
- padding: 5px 5px 5px 5px !important;
- }
- </style>
|