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

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

@ -5,7 +5,7 @@
<template> <template>
<div class="search"> <div class="search">
<Card> <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"> <Form ref="searchForm" :model="searchForm" inline :label-width="100">
<FormItem label="物流公司名称" prop="companyName"> <FormItem label="物流公司名称" prop="companyName">
<Input type="text" v-model="searchForm.companyName" clearable placeholder="请输入公司名称" <Input type="text" v-model="searchForm.companyName" clearable placeholder="请输入公司名称"
@ -28,33 +28,15 @@
</a> </a>
</FormItem> </FormItem>
</Form> </Form>
</Row> </Row> -->
<Row align="middle" justify="space-between" class="operation"> <Row align="middle" justify="space-between" class="operation">
<div> <div>
<Button @click="add" type="primary" icon="md-add">添加</Button> <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>
<div class="icons"> <div class="icons">
<Tooltip content="刷新" placement="top" transfer> <Tooltip content="刷新" placement="top" transfer>
<Icon type="md-refresh" size="18" class="item" @click="getDataList" /> <Icon type="md-refresh" size="18" class="item" @click="getDataList" />
</Tooltip> </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> <Tooltip content="表格密度" placement="top" transfer>
<Dropdown @on-click="changeTableSize" trigger="click"> <Dropdown @on-click="changeTableSize" trigger="click">
<Icon type="md-list" size="18" class="item" /> <Icon type="md-list" size="18" class="item" />
@ -67,131 +49,48 @@
</Tooltip> </Tooltip>
</div> </div>
</Row> </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" <Table :loading="loading" border :columns="columns" :data="data" :size="tableSize" sortable="custom"
@on-sort-change="changeSort" @on-selection-change="showSelect" ref="table"></Table> ref="table"></Table>
<Row type="flex" justify="end" class="page"> <!-- <Row type="flex" justify="end" class="page">
<Page :current="searchForm.pageNumber" :total="total" :page-size="searchForm.pageSize" <Page :current="searchForm.pageNumber" :total="total" :page-size="searchForm.pageSize"
@on-change="changePage" @on-page-size-change="changePageSize" :page-size-opts="[10, 20, 50]" @on-change="changePage" @on-page-size-change="changePageSize" :page-size-opts="[10, 20, 50]"
size="small" show-total show-elevator show-sizer></Page> size="small" show-total show-elevator show-sizer></Page>
</Row> </Row> -->
</Card> </Card>
<Modal :title="线路维护" v-model="Visiable" :mask-closable="false" :scrollabele="true" :width="1000"> <Modal :title="商品列表" v-model="Visiable" :mask-closable="false" :scrollabele="true" :width="1000">
<logistics-address v-if="Visiable" ref="dialog"></logistics-address> <goodsList v-if="Visiable" ref="goodsPage"></goodsList>
<div slot="footer" v-show=Visiable> <div slot="footer" v-show=Visiable>
<Button type="text" @click="Visiable = false">关闭</Button> <Button type="text" @click="Visiable = false">关闭</Button>
</div> </div>
</Modal> </Modal>
<Modal :title="线路绑定" v-model="bindingVisiable" :mask-closable="false" :scrollabele="true" :width="1000"> <addEdit :data="form" :type="showType" v-model="showCompany" @on-submit="getDataList" />
<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>
</div> </div>
</template> </template>
<script> <script>
import { import {
getAllLogiticsCompanyData, seckillList,
deleteLogiticsCompany, addSeckill,
onLineCompany, editSeckill,
offLineCompany delSeckill,
} from "@/api/app"; } from "@/api/app";
import { import addEdit from "./addEdit.vue";
shortcuts import goodsList from "./dictManage.vue";
} 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";
export default { export default {
name: "logiticsCompany", name: "logiticsCompany",
components: { components: {
logisticsAddress, addEdit,
rechargeOne, goodsList
lineBinding
}, },
data() { data() {
return { return {
tableSize: "default", tableSize: "default",
message: "",
selectIndex: "",
currentRow: {},
height: 510,
showCompany: false, showCompany: false,
bindingVisiable:false,
showType: "0", showType: "0",
openSearch: true,
openTip: true,
loading: true, loading: true,
reading: false,
loadingExport: true,
exportModalVisible: false,
importModalVisible: false,
deployModalVisible: false,
uploadfile: {
name: "",
},
drop: false, 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: {}, form: {},
columns: [{ columns: [
type: "selection",
width: 60,
align: "center",
fixed: "left",
},
{ {
type: "index", type: "index",
width: 60, width: 60,
@ -199,161 +98,51 @@
fixed: "left", fixed: "left",
}, },
{ {
title: "公司名称", title: "分类名称",
key: "companyName", key: "categoryName",
minWidth: 100, minWidth: 125,
sortable: true,
fixed: "left", fixed: "left",
render: (h, params) => {
return h(
"a", {
on: {
click: () => {
this.showDetail(params.row);
},
},
},
params.row.companyName
);
},
}, },
{ {
title: "上线状态", title: "分类图标",
key: "isOnLine", key: "categoryIcon",
minWidth: 160, minWidth: 120,
sortable: true,
//fixed: "left",
render: (h, params) => {
let re = "",
color = "";
if (params.row.isOnLine == 1) {
re = "上线";
color = "green";
} else if (params.row.isOnLine == 0) {
re = "下线";
color = "#D3D3D3";
}
return h("div", [
h(
"Tag", {
props: {
color: color,
},
},
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: "公司电话", title: "排序",
key: "companyTel", key: "sort",
minWidth: 150, minWidth: 120,
sortable: true,
}, },
{ {
title: "公司邮箱", title: "状态",
key: "companyEmail", key: "status",
minWidth: 250, minWidth: 120,
}, render: (h, params) => {
{ let re = ""
title: "联系人", if (params.row.position == '0') {
key: "contacts", re = "禁用";
width: 100, } else if (params.row.position == '1') {
re = "启用";
}
return h(
"div",
re
);
}
}, },
{ {
title: "手机号", title: "备注",
key: "mobile", key: "remark",
width: 150, minWidth: 120,
}, },
{ {
title: "操作", title: "操作",
key: "action", key: "action",
width: 200, width: 170,
align: "center", align: "center",
fixed: "right", fixed: "right",
render: (h, params) => { render: (h, params) => {
return h("div", [
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",
},
}),
h( h(
"a", { "a", {
on: { on: {
@ -364,11 +153,6 @@
}, },
"编辑" "编辑"
), ),
h("Divider", {
props: {
type: "vertical",
},
}),
h( h(
"a", { "a", {
on: { on: {
@ -383,51 +167,28 @@
props: { props: {
type: "vertical", type: "vertical",
}, },
}), h( }),
h(
"a", { "a", {
on: { on: {
click: () => { click: () => {
this.findRechargeLog(params.row); this.goodsList(params.row);
}, },
}, },
}, },
"充值记录查询" "管理商品"
), ),
]); ]);
}, },
}, },
], ],
exportColumns: exportColumn,
chooseColumns: [],
filename: "公司数据",
exportTitle: "确认导出",
exportType: "",
data: [], data: [],
exportData: [],
total: 0,
Visiable: false, Visiable: false,
rechargeVisiable: false,
}; };
}, },
methods: { methods: {
init() { init() {
this.getDataList(); 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) { findAllRecord(v) {
this.Visiable = true; this.Visiable = true;
@ -436,58 +197,7 @@
this.$refs.dialog.initRecharge(v); 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) { changePage(v) {
this.searchForm.pageNumber = v;
this.getDataList(); this.getDataList();
this.clearSelectAll(); this.clearSelectAll();
}, },
@ -495,32 +205,31 @@
this.tableSize = v; this.tableSize = v;
}, },
changePageSize(v) { changePageSize(v) {
this.searchForm.pageSize = v;
this.getDataList(); this.getDataList();
}, },
selectDateRange(v) {
if (v) {
this.searchForm.startDate = v[0];
this.searchForm.endDate = v[1];
}
},
getDataList() { getDataList() {
// //
this.loading = true; 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() { handleSearch() {
this.searchForm.pageNumber = 1;
this.searchForm.pageSize = 10;
this.getDataList(); this.getDataList();
}, },
handleReset() { handleReset() {
this.$refs.searchForm.resetFields(); this.$refs.searchForm.resetFields();
this.searchForm.pageNumber = 1;
this.searchForm.pageSize = 10;
this.selectDate = null;
this.searchForm.startDate = "";
this.searchForm.endDate = "";
// //
this.getDataList(); this.getDataList();
}, },
@ -532,58 +241,6 @@
} }
this.getDataList(); 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) { showDetail(v) {
// null"" // null""
for (let attr in v) { for (let attr in v) {
@ -636,53 +293,11 @@
dropDown() { dropDown() {
this.drop = !this.drop; 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() { clearSelectAll() {
this.$refs.table.selectAll(false); 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() { mounted() {
//
this.height = Number(document.documentElement.clientHeight - 230);
this.init(); this.init();
}, },
}; };

Loading…
Cancel
Save