tianyi 1 month ago
parent
commit
82e7d881cf
  1. 509
      src/views/app/business/logiticsCompany/logiticsCompany.vue

509
src/views/app/business/logiticsCompany/logiticsCompany.vue

@ -5,7 +5,7 @@
<template>
<div class="search">
<Card>
<Row v-show="openSearch" @keydown.enter.native="handleSearch">
<!-- <Row v-show="openSearch" @keydown.enter.native="handleSearch">
<Form ref="searchForm" :model="searchForm" inline :label-width="100">
<FormItem label="物流公司名称" prop="companyName">
<Input type="text" v-model="searchForm.companyName" clearable placeholder="请输入公司名称"
@ -28,33 +28,15 @@
</a>
</FormItem>
</Form>
</Row>
</Row> -->
<Row align="middle" justify="space-between" class="operation">
<div>
<Button @click="add" type="primary" icon="md-add">添加</Button>
<Button @click="delAll" icon="md-trash">批量删除</Button>
<Dropdown @on-click="handleDropdown">
<Button>
更多操作
<Icon type="md-arrow-dropdown" />
</Button>
<DropdownMenu slot="list">
<DropdownItem name="refresh">刷新</DropdownItem>
<DropdownItem name="exportData">导出所选数据</DropdownItem>
<DropdownItem name="exportAll">导出全部数据</DropdownItem>
</DropdownMenu>
</Dropdown>
</div>
<div class="icons">
<Tooltip content="刷新" placement="top" transfer>
<Icon type="md-refresh" size="18" class="item" @click="getDataList" />
</Tooltip>
<Tooltip :content="openSearch ? '关闭搜索' : '开启搜索'" placement="top" transfer>
<Icon type="ios-search" size="18" class="item tip" @click="openSearch = !openSearch" />
</Tooltip>
<Tooltip :content="openTip ? '关闭提示' : '开启提示'" placement="top" transfer>
<Icon type="md-bulb" size="18" class="item tip" @click="openTip = !openTip" />
</Tooltip>
<Tooltip content="表格密度" placement="top" transfer>
<Dropdown @on-click="changeTableSize" trigger="click">
<Icon type="md-list" size="18" class="item" />
@ -67,131 +49,48 @@
</Tooltip>
</div>
</Row>
<Alert show-icon v-show="openTip">
已选择
<span class="select-count">{{ selectList.length }}</span>
<a class="select-clear" @click="clearSelectAll">清空</a>
</Alert>
<Table :loading="loading" border :columns="columns" :data="data" :size="tableSize" sortable="custom"
@on-sort-change="changeSort" @on-selection-change="showSelect" ref="table"></Table>
<Row type="flex" justify="end" class="page">
ref="table"></Table>
<!-- <Row type="flex" justify="end" class="page">
<Page :current="searchForm.pageNumber" :total="total" :page-size="searchForm.pageSize"
@on-change="changePage" @on-page-size-change="changePageSize" :page-size-opts="[10, 20, 50]"
size="small" show-total show-elevator show-sizer></Page>
</Row>
</Row> -->
</Card>
<Modal :title="线路维护" v-model="Visiable" :mask-closable="false" :scrollabele="true" :width="1000">
<logistics-address v-if="Visiable" ref="dialog"></logistics-address>
<Modal :title="商品列表" v-model="Visiable" :mask-closable="false" :scrollabele="true" :width="1000">
<goodsList v-if="Visiable" ref="goodsPage"></goodsList>
<div slot="footer" v-show=Visiable>
<Button type="text" @click="Visiable = false">关闭</Button>
</div>
</Modal>
<Modal :title="线路绑定" v-model="bindingVisiable" :mask-closable="false" :scrollabele="true" :width="1000">
<line-binding v-if="bindingVisiable" ref="bindinglog"></line-binding>
<div slot="footer" v-show=bindingVisiable>
<Button type="text" @click="bindingVisiable = false">关闭</Button>
</div>
</Modal>
<Modal :title="充值记录明细" v-model="rechargeVisiable" :mask-closable="false" :scrollabele="true" :width="1000">
<recharge-one v-if="rechargeVisiable" ref="rechargelog"></recharge-one>
<div slot="footer" v-show=rechargeVisiable>
<Button type="text" @click="rechargeVisiable = false">关闭</Button>
</div>
</Modal>
<!-- 自定义导出数据 -->
<Modal v-model="exportModalVisible" :title="exportTitle" :loading="loadingExport" @on-ok="exportCustomData">
<Form ref="exportForm" :label-width="100">
<FormItem label="导出文件名">
<Input v-model="filename" />
</FormItem>
<FormItem label="自定义导出列">
<CheckboxGroup v-model="chooseColumns">
<Checkbox v-for="(item, i) in exportColumns" :label="item.title" :key="i" :value="item.checked"
:disabled="item.disabled"></Checkbox>
</CheckboxGroup>
</FormItem>
</Form>
</Modal>
<addEdit :data="form" :type="showType" v-model="showCompany" @on-submit="getDataList" />
</div>
</template>
<script>
import {
getAllLogiticsCompanyData,
deleteLogiticsCompany,
onLineCompany,
offLineCompany
seckillList,
addSeckill,
editSeckill,
delSeckill,
} from "@/api/app";
import {
shortcuts
} from "@/libs/shortcuts";
//
import {
exportColumn
} from "./exportColumn";
import excel from "@/libs/excel";
import logisticsAddress from "@/views/app/company/logisticsAddress.vue";
import lineBinding from "@/views/app/business/logiticsCompany/lineBinding.vue";
//
import rechargeOne from "@/views/app/business/recharge/rechargeOne.vue";
import {
offLineWorker,
onLineWorker
} from "@/api";
import addEdit from "./addEdit.vue";
import goodsList from "./dictManage.vue";
export default {
name: "logiticsCompany",
components: {
logisticsAddress,
rechargeOne,
lineBinding
addEdit,
goodsList
},
data() {
return {
tableSize: "default",
message: "",
selectIndex: "",
currentRow: {},
height: 510,
showCompany: false,
bindingVisiable:false,
showType: "0",
openSearch: true,
openTip: true,
loading: true,
reading: false,
loadingExport: true,
exportModalVisible: false,
importModalVisible: false,
deployModalVisible: false,
uploadfile: {
name: "",
},
drop: false,
selectList: [],
searchForm: {
id: "",
companyName: "",
contacts: "",
mobile: "",
pageNumber: 1,
pageSize: 10,
sort: "createTime",
order: "desc",
startDate: "",
endDate: "",
signCompany: "0",
},
selectDate: null,
options: {
shortcuts: shortcuts,
},
form: {},
columns: [{
type: "selection",
width: 60,
align: "center",
fixed: "left",
},
columns: [
{
type: "index",
width: 60,
@ -199,161 +98,51 @@
fixed: "left",
},
{
title: "公司名称",
key: "companyName",
minWidth: 100,
sortable: true,
title: "分类名称",
key: "categoryName",
minWidth: 125,
fixed: "left",
render: (h, params) => {
return h(
"a", {
on: {
click: () => {
this.showDetail(params.row);
},
},
{
title: "分类图标",
key: "categoryIcon",
minWidth: 120,
},
params.row.companyName
);
},
{
title: "排序",
key: "sort",
minWidth: 120,
},
{
title: "上线状态",
key: "isOnLine",
minWidth: 160,
sortable: true,
//fixed: "left",
title: "状态",
key: "status",
minWidth: 120,
render: (h, params) => {
let re = "",
color = "";
if (params.row.isOnLine == 1) {
re = "上线";
color = "green";
} else if (params.row.isOnLine == 0) {
re = "下线";
color = "#D3D3D3";
let re = ""
if (params.row.position == '0') {
re = "禁用";
} else if (params.row.position == '1') {
re = "启用";
}
return h("div", [
h(
"Tag", {
props: {
color: color,
},
},
return h(
"div",
re
),
]);
},
filters: [{
label: "上线",
value: 1,
},
{
label: "下线",
value: 0,
}
],
filterMultiple: false,
filterRemote: (e) => {
let v = "";
if (e.length > 0) {
v = e[0];
);
}
this.searchForm.isOnLine = v;
this.searchForm.pageNumber = 1;
this.getDataList();
},
},
{
title: "公司电话",
key: "companyTel",
minWidth: 150,
sortable: true,
},
{
title: "公司邮箱",
key: "companyEmail",
minWidth: 250,
},
{
title: "联系人",
key: "contacts",
width: 100,
},
{
title: "手机号",
key: "mobile",
width: 150,
title: "备注",
key: "remark",
minWidth: 120,
},
{
title: "操作",
key: "action",
width: 200,
width: 170,
align: "center",
fixed: "right",
render: (h, params) => {
let onOrOffLine = "";
if (params.row.isOnLine == 1) {
onOrOffLine = h(
"a", {
on: {
click: () => {
this.offLine(params.row);
},
},
},
"下线"
);
} else {
onOrOffLine = h(
"a", {
on: {
click: () => {
this.onLine(params.row);
},
},
},
"上线"
);
}
return h("div", [h(
"a", {
on: {
click: () => {
this.findAllRecord(params.row);
},
},
},
"线路维护"
),
h("Divider", {
props: {
type: "vertical",
},
}),
h(
"a", {
on: {
click: () => {
this.stationBinding(params.row);
},
},
},
"线路绑定"
),
h("Divider", {
props: {
type: "vertical",
},
}),
onOrOffLine,
h("Divider", {
props: {
type: "vertical",
},
}),
return h("div", [
h(
"a", {
on: {
@ -364,11 +153,6 @@
},
"编辑"
),
h("Divider", {
props: {
type: "vertical",
},
}),
h(
"a", {
on: {
@ -383,51 +167,28 @@
props: {
type: "vertical",
},
}), h(
}),
h(
"a", {
on: {
click: () => {
this.findRechargeLog(params.row);
this.goodsList(params.row);
},
},
},
"充值记录查询"
"管理商品"
),
]);
},
},
],
exportColumns: exportColumn,
chooseColumns: [],
filename: "公司数据",
exportTitle: "确认导出",
exportType: "",
data: [],
exportData: [],
total: 0,
Visiable: false,
rechargeVisiable: false,
};
},
methods: {
init() {
this.getDataList();
//
let array = [];
this.exportColumns.forEach((e) => {
//
if (
!this.getStore("roles").includes("ROLE_ADMIN") &&
e.key == "mobile"
) {
e.title = "[无权导出] " + e.title;
e.disabled = true;
} else {
e.disabled = false;
}
array.push(e.title);
});
this.chooseColumns = array;
},
findAllRecord(v) {
this.Visiable = true;
@ -436,58 +197,7 @@
this.$refs.dialog.initRecharge(v);
});
},
offLine(v) {
this.$Modal.confirm({
title: "确认下线",
content: "您确认要使 " + v.companyName + " 下线吗?",
loading: true,
onOk: () => {
offLineCompany({
id: v.id
}).then((res) => {
this.$Modal.remove();
if (res.success) {
this.$Message.success("操作成功");
this.getDataList();
}
});
},
});
},
onLine(v) {
this.$Modal.confirm({
title: "确认上线",
content: "您确认要使 " + v.companyName + " 上线吗?",
loading: true,
onOk: () => {
onLineCompany({
id: v.id
}).then((res) => {
this.$Modal.remove();
if (res.success) {
this.$Message.success("操作成功");
this.getDataList();
}
});
},
});
},
stationBinding(v) {
this.bindingVisiable = true;
console.log(v)
this.$nextTick(() => {
this.$refs.bindinglog.initRecharge(v);
});
},
findRechargeLog(v) {
this.rechargeVisiable = true;
console.log(v)
this.$nextTick(() => {
this.$refs.rechargelog.initRecharge(v);
});
},
changePage(v) {
this.searchForm.pageNumber = v;
this.getDataList();
this.clearSelectAll();
},
@ -495,32 +205,31 @@
this.tableSize = v;
},
changePageSize(v) {
this.searchForm.pageSize = v;
this.getDataList();
},
selectDateRange(v) {
if (v) {
this.searchForm.startDate = v[0];
this.searchForm.endDate = v[1];
}
},
getDataList() {
//
this.loading = true;
seckillList({
regionId: JSON.parse(this.getStore("user")).departmentId
}).then((res) => {
this.loading = false;
if (res.success) {
this.data = res.result.records;
}
});
},
goodsList(v){
this.Visiable = true;
this.$nextTick(() => {
this.$refs.goodsPage.init(v);
});
},
handleSearch() {
this.searchForm.pageNumber = 1;
this.searchForm.pageSize = 10;
this.getDataList();
},
handleReset() {
this.$refs.searchForm.resetFields();
this.searchForm.pageNumber = 1;
this.searchForm.pageSize = 10;
this.selectDate = null;
this.searchForm.startDate = "";
this.searchForm.endDate = "";
//
this.getDataList();
},
@ -532,58 +241,6 @@
}
this.getDataList();
},
handleDropdown(name) {
if (name == "refresh") {
this.getDataList();
} else if (name == "exportData") {
if (this.selectList.length <= 0) {
this.$Message.warning("您还未选择要导出的数据");
return;
}
this.exportType = "part";
this.exportModalVisible = true;
this.exportTitle = "确认导出 " + this.selectList.length + " 条数据";
} else if (name == "exportAll") {
this.exportType = "all";
this.exportModalVisible = true;
this.exportTitle = "确认导出全部 " + this.total + " 条数据";
getAllLogiticsCompanyData().then((res) => {
if (res.success) {
this.exportData = res.result;
}
});
}
},
exportCustomData() {
if (this.filename == "") {
this.filename = "公司数据";
}
//
let array = [];
this.exportColumns.forEach((e) => {
this.chooseColumns.forEach((c) => {
if (e.title == c && !e.disabled) {
array.push(e);
}
});
});
this.exportColumns = array;
this.exportModalVisible = false;
let title = [];
let key = [];
this.exportColumns.forEach((e) => {
title.push(e.title);
key.push(e.key);
});
const params = {
title: title,
key: key,
data: this.exportData,
autoWidth: true,
filename: this.filename,
};
excel.export_array_to_excel(params);
},
showDetail(v) {
// null""
for (let attr in v) {
@ -636,53 +293,11 @@
dropDown() {
this.drop = !this.drop;
},
showSelect(e) {
this.exportData = e;
this.selectList = e;
if (e.length === 1) {
const row = e[0];
this.selectIndex = row.id;
this.currentRow = row;
} else {
this.currentRow = {};
this.selectIndex = "";
}
},
clearSelectAll() {
this.$refs.table.selectAll(false);
},
delAll() {
if (this.selectList.length <= 0) {
this.$Message.warning("您还未选择要删除的数据");
return;
}
this.$Modal.confirm({
title: "确认删除",
content: "您确认要删除所选的 " + this.selectList.length + " 条数据?",
loading: true,
onOk: () => {
let ids = "";
this.selectList.forEach(function(e) {
ids += e.id + ",";
});
ids = ids.substring(0, ids.length - 1);
deleteLogiticsCompany({
ids: ids
}).then((res) => {
this.$Modal.remove();
if (res.success) {
this.$Message.success("删除成功");
this.clearSelectAll();
this.getDataList();
}
});
},
});
}
},
mounted() {
//
this.height = Number(document.documentElement.clientHeight - 230);
this.init();
},
};

Loading…
Cancel
Save