all-routes-list.vue 14 KB
Newer Older
lanbaoming's avatar
lanbaoming committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
<template>
  <div class="app-container">

    <!-- 搜索工作栏 -->
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="68px">

      <el-form-item :label="$t('运输方式')" prop="transportType">
        <dict-selector :type="DICT_TYPE.ECW_TRANSPORT_TYPE" v-model="queryParams.transportType" formatter="number"
                       clearable/>
      </el-form-item>
      <el-form-item>
        <el-form-item :label="$t('始发仓')" prop="startWarehouseId">
          <el-select multiple v-model="queryParams.startWarehouseIdList" :placeholder="$t('请选择始发仓')" clearable>
            <el-option v-for="item in exportWarehouseList" :label="$l(item, 'title')" :value="item.id"
                       :key="item.id"></el-option>
          </el-select>
        </el-form-item>
xiamw's avatar
xiamw committed
18

lanbaoming's avatar
lanbaoming committed
19 20 21 22 23 24
        <el-form-item :label="$t('出货渠道')" prop="shippingChannel">
          <el-select v-model="queryParams.channelId" :placeholder="$t('请选择出货渠道')" clearable>
            <el-option v-for="item in channelList" :label="item.nameZh" :value="item.channelId"
                       :key="item.channelId"></el-option>
          </el-select>
        </el-form-item>
xiamw's avatar
xiamw committed
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70

        <el-form-item :label="$t('目的国')" prop="destCountryId">
        <el-select
          v-model="destCountryId"
          multiple
          :label="destCountryId"
          clearable
          @change="handleQuery"
        >
          <el-option
            v-for="item in countryList"
            :key="item.id"
            :label="$l(item, 'title')"
            :value="item.id"
          >
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item :label="$t('目的地')" prop="destCityId">
        <el-select v-model="destCityId"
        multiple
        clearable
        @change="handleQuery">
          <el-option
            v-for="item in AddressCity"
            :key="item.shi"
            :label="item.shiName"
            :value="item.shi"
          ></el-option>
        </el-select>
      </el-form-item>

      <el-form-item :label="$t('目的仓')" prop="destWarehouseId">
        <el-select v-model="destWarehouseId"
          clearable
          multiple
          @change="handleQuery">
          <el-option
            v-for="item in AddressTown"
            :key="item.id"
            :label="item.titleZh"
            :value="item.id"
          ></el-option>
        </el-select>
      </el-form-item>

lanbaoming's avatar
lanbaoming committed
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133
        <el-button type="primary" icon="el-icon-search" @click="handleQuery">{{ $t('搜索') }}</el-button>
      </el-form-item>
    </el-form>
    <!-- 列表 -->
    <el-table v-loading="loading" :data="list">
      <el-table-column :label="$t('序号')" align="center" type="index"/>
      <el-table-column :label="$t('始发仓')" align="center">
        <template slot-scope="{row}">
          {{ $l(row, 'startWarehouseTitle') }}
        </template>
      </el-table-column>
      <el-table-column :label="$t('目的仓')" align="center">
        <template slot-scope="{row}">
          {{ $l(row, 'destWarehouseTitle') }}
        </template>
      </el-table-column>
      <el-table-column :label="$t('运输方式')" align="center">
        <template slot-scope="{row}">
          <dict-tag :type="DICT_TYPE.ECW_TRANSPORT_TYPE" :value="row.transportType"></dict-tag>
        </template>
      </el-table-column>
      <el-table-column :label="$t('目的仓国家')" align="center">
        <template slot-scope="{row}">
      {{$l(row, 'destCountryName')}}
        </template>
      </el-table-column>
      <el-table-column :label="$t('出货渠道')" align="center">
        <template slot-scope="{row}">
          {{ row.channelIds ? $l(row, 'channelNames') : '/' }}
        </template>
      </el-table-column>
      <el-table-column :label="$t('操作')" align="center">
        <template slot-scope="{row}">
          <el-button v-if="row.transportType === 3" type="text" @click="$router.push({
          path:'/offer/channel-route?id='+ row.id,
          query:{
            startWarehouseTitle:$l(row,'startWarehouseTitle'),
            destWarehouseTitle: $l(row, 'destWarehouseTitle'),
            destCountryName:$l(row,'destCountryName')
          }
          })">空运渠道包装清关费
          </el-button>
        </template>
      </el-table-column>
    </el-table>
    <!-- 分页组件 -->
    <pagination v-show="total > 0" :total="total" :page.sync="queryParams.page" :limit.sync="queryParams.rows"
                @pagination="getList"/>
  </div>
</template>

<script>
import {
  createDeptTarget,
  updateDeptTarget,
  deleteDeptTarget,
  getDeptTarget,
  getDeptTargetPage,
  exportDeptTargetExcel,
  getCreateInitData,
  getPersonTargetPage,
  myAchievementByPage
} from "@/api/ecw/deptTarget";
xiamw's avatar
xiamw committed
134
import { getRegionList } from "@/api/ecw/order";
lanbaoming's avatar
lanbaoming committed
135 136
import {listSimpleDepts} from "@/api/system/dept";
import {getChannelList} from '@/api/ecw/channel';
xiamw's avatar
xiamw committed
137 138
import { getTradeCityList, getListTree } from "@/api/ecw/region";
import { getCityList } from "@/api/ecw/region";
lanbaoming's avatar
lanbaoming committed
139 140 141 142 143 144 145 146 147 148 149 150
import dayjs from "dayjs";
import {listServiceUser} from "@/api/system/user";
import {getWarehouseList} from '@/api/ecw/warehouse'
import {DICT_TYPE} from "@/utils/dict";
import {warehouseLinePage} from "@/api/ecw/customerContacts";
import {getTradeCountryList} from "@/api/ecw/region";

export default {
  name: "EcwOfferAll-routes-list",
  components: {},
  data() {
    return {
xiamw's avatar
xiamw committed
151 152 153 154 155 156 157 158 159 160 161 162 163
      AddressCity: [], //目的城市
      AddressProvince: [], //省份
      AddressTown: [], //目的仓


      countryList: [], //目的国
      warehouseList: [], //目前仓

      destCountryId: [],
      destCityId: null,
      destWarehouseId: "",
      objectiveId: [],

lanbaoming's avatar
lanbaoming committed
164 165 166 167 168 169 170 171 172 173 174 175 176
      // 遮罩层
      loading: true,
      // 总条数
      total: 0,
      list: [],
      // 是否显示弹出层
      open: false,
      tableOpen: false,
      channelList: [],
      // 查询参数
      queryParams: {
        page: 1,
        rows: 10,
xiamw's avatar
xiamw committed
177 178 179 180
        destCityId: null, //目的城市
        destCountryId: null, //目的国
        destWarehouseId: null, //目的仓
        objectiveId: null,
lanbaoming's avatar
lanbaoming committed
181 182 183 184 185 186 187
      },

      // 表单校验
      myAchievementData: {},
      warehouseList: []
    };
  },
xiamw's avatar
xiamw committed
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349

  watch: {
    destCountryId: {
      //监听当前地区值的变化,于与上方地区值进行了双向绑定
      deep: true, //深度监听
      handler() {
        //每当值省份值改变时其下地区值进行清空
        this.AddressCity = [];
        this.AddressTown = [];
        this.destWarehouseId = "";
        this.destCityId = "";
        this.findByprovinceCode();
        if (this.destCountryId == "") {
          //1 是所有区域,2 国家,3是市,
          getRegionList(4, 4)
            .then(({ data }) => {
              this.AddressCity = data;
            })
            .catch((error) => {
              console.log(error);
            });

          getRegionList(5, 5)
            .then(({ data }) => {
              this.AddressTown = data;
            })
            .catch((error) => {
              console.log(error);
            });
        } else if (
          this.destCountryId != "" &&
          this.objectiveId == "" &&
          this.destWarehouseId == ""
        ) {
          getRegionList(2, this.destCountryId)
            .then(({ data }) => {
              this.AddressCity = data;
            })
            .catch((error) => {
              console.log(error);
            });
          getRegionList(5, 5)
            .then(({ data }) => {
              this.AddressTown = data;
            })
            .catch((error) => {
              console.log(error);
            });
        }
      },
    },
    destCityId: {
      deep: true, //深度监听 目的仓
      handler() {
        this.AddressTown = [];
        this.destWarehouseId = "";
        this.findBycityCode();
        if (
          this.destCityId != "" &&
          this.destCountryId != "" &&
          this.destWarehouseId == ""
        ) {
          //获取当前城市值id,获取该城市下区域
          getRegionList(3, this.destCityId)
            .then(({ data }) => {
              this.AddressTown = data;
            })
            .catch((error) => {
              console.log(error);
            });
        } else if (
          this.destCountryId == "" &&
          this.destCityId == "" &&
          this.destWarehouseId == ""
        ) {
          getRegionList(5, 5)
            .then(({ data }) => {
              this.AddressTown = data;
            })
            .catch((error) => {
              console.log(error);
            });
        } else if (
          this.destCountryId != "" &&
          this.destCityId == "" &&
          this.destWarehouseId == ""
        ) {
          getRegionList(2, this.destCountryId)
            .then(({ data }) => {
              this.AddressCity = data;
            })
            .catch((error) => {
              console.log(error);
            });
          getRegionList(5, 5)
            .then(({ data }) => {
              this.AddressTown = data;
            })
            .catch((error) => {
              console.log(error);
            });
        } else if (
          this.destCountryId == "" &&
          this.destCityId != "" &&
          this.destWarehouseId == ""
        ) {
          //获取当前城市值id,获取该城市下区域
          getRegionList(3, this.destCityId)
            .then(({ data }) => {
              this.AddressTown = data;
            })
            .catch((error) => {
              console.log(error);
            });
        }
      },
    },
    destWarehouseId: {
      deep: true, //深度监听
      handler() {
        if (
          this.destCountryId != "" &&
          this.destCityId != "" &&
          this.destWarehouseId == ""
        ) {
          //获取当前城市值id,获取该城市下区域
          getRegionList(3, this.destCityId)
            .then(({ data }) => {
              this.AddressTown = data;
            })
            .catch((error) => {
              console.log(error);
            });
        } else if (
          this.destCountryId != "" &&
          this.destCityId == "" &&
          this.destWarehouseId == ""
        ) {
          getRegionList(5, 5)
            .then(({ data }) => {
              this.AddressTown = data;
            })
            .catch((error) => {
              console.log(error);
            });
        } else if (
          this.destCountryId == "" &&
          this.destCityId != "" &&
          this.destWarehouseId == ""
        ) {
          getRegionList(3, this.destCityId)
            .then(({ data }) => {
              this.AddressTown = data;
            })
            .catch((error) => {
              console.log(error);
            });
        }
      },
    },

  },
lanbaoming's avatar
lanbaoming committed
350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371
  computed: {
    DICT_TYPE() {
      return DICT_TYPE
    },
    exportWarehouseList() {
      /* tradeType 1 进口,2出口,3进出口 */
      return this.warehouseList.filter(item => item.tradeType == 2 || item.tradeType == 3)
    },
    importWarehouseList() {
      return this.warehouseList.filter(item => item.tradeType == 1 || item.tradeType == 3)
    },
  },
  activated() {
    this.getChannelList();
    this.getList();
  },
  created() {
    getTradeCountryList().then(r => {
      this.countryList = r.data
    })
    this.getChannelList();
    this.getList();
xiamw's avatar
xiamw committed
372 373 374 375 376

    this.getData();
    //获取国家列表
    this.getCountryList();

lanbaoming's avatar
lanbaoming committed
377 378 379 380 381 382 383 384
    listServiceUser().then(r => {
      this.customerServiceList = r.data;
    })
    getWarehouseList().then(res => {
      this.warehouseList = res.data
    })
  },
  methods: {
xiamw's avatar
xiamw committed
385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440
    findByprovinceCode() {
      //获取当前省份值id,获取该省份下城市 destCountryId provinceCode
      getRegionList(2, this.destCountryId)
        .then(({ data }) => {
          this.AddressCity = data;
        })
        .catch((error) => {
          console.log(error);
        });
    },

    findBycityCode() {
      //获取当前城市值id,获取该城市下区域
      getRegionList(3, this.objectiveId)
        .then(({ data }) => {
          this.AddressTown = data;
        })
        .catch((error) => {
          console.log(error);
        });
    },

    getData() {
      //加载时发起请求获取所有省份值
      getRegionList(1, 1)
        .then(({ data }) => {
          this.AddressProvince = data;
        })
        .catch((error) => {
          console.log(error);
        });
      //目的城市
      getRegionList(4, 4)
        .then(({ data }) => {
          this.AddressCity = data;
        })
        .catch((error) => {
          console.log(error);
        });
      //目的仓
      getRegionList(5, 5)
        .then(({ data }) => {
          this.AddressTown = data;
        })
        .catch((error) => {
          console.log(error);
        });
    },

    /* 国家 */
    getCountryList() {
      getListTree({ treeType: 1 }).then((response) => {
        this.countryList = response.data;
      });
    },

lanbaoming's avatar
lanbaoming committed
441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465
    getChannelList() {
      getChannelList().then(res => this.channelList = res.data)
    },
    customerServiceFn(val) {
      if (this.customerServiceList.length > 0) {
        let index = this.customerServiceList.findIndex(item => item.id === val.userId);
        return index !== -1 ? this.customerServiceList[index]?.nickname : ''
      } else {
        return ''
      }
    },
    /** 查询列表 */
    getList() {
      this.loading = true;
      const params = {...this.queryParams}
      // 执行查询
      warehouseLinePage(params).then(r => {
        this.loading = false;
        this.list = r.data.list;
        this.total = r.data.total
      })
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.page = 1;
xiamw's avatar
xiamw committed
466 467 468 469 470 471 472

      //目的城市
      this.queryParams.destCityId = this.destCityId;
      //目的国
      this.queryParams.destCountryId = this.destCountryId;
      //目的仓
      this.queryParams.destWarehouseId = this.destWarehouseId;
lanbaoming's avatar
lanbaoming committed
473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493
      this.getList();
    },
  }
};
</script>


<style scoped>
.total_num {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 20px 0;
  font-size: 15px;
}

.total_num span {
  margin: 0 8px;
}
</style>