You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

1177 lines
33 KiB

<template>
<basic-container>
<avue-crud
:option="option"
v-model:search="search"
v-model:page="page"
v-model="form"
:table-loading="loading"
:data="data"
:permission="permissionList"
:before-open="beforeOpen"
ref="crud"
@row-update="rowUpdate"
@row-save="rowSave"
@row-del="rowDel"
@search-change="searchChange"
@search-reset="searchReset"
@selection-change="selectionChange"
@current-change="currentChange"
@size-change="sizeChange"
@refresh-change="refreshChange"
@on-load="onLoad"
>
<template #menu-left>
<el-button
type="danger"
icon="el-icon-delete"
plain
v-if="permission.warehouseWarehouse_delete"
@click="handleDelete"
>删 除
</el-button>
<!-- <el-button type="warning"-->
<!-- plain-->
<!-- icon="el-icon-download"-->
<!-- @click="handleExport">导 出-->
<!-- </el-button>-->
</template>
<!-- <template #menu="{size,row,index}">-->
<!--&lt;!&ndash; <el-button type="primary" text icon="el-icon-view" @click="editDeline(row)">查看地图</el-button>&ndash;&gt;-->
<!--&lt;!&ndash; <el-button type="primary" text @click="showDialog"> 弹窗表单</el-button>&ndash;&gt;-->
<!-- </template>-->
</avue-crud>
</basic-container>
</template>
<script>
import { getList, getDetail, add, update, remove } from '@/api/basicdata/basicdataWarehouse';
import { getDeptList } from '@/api/system/dept';
// import option from "@/option/basicdata/basicdataWarehouse";
import { mapGetters } from 'vuex';
import { exportBlob } from '@/api/common';
import { getToken } from '@/utils/auth';
import { downloadXls } from '@/utils/util';
import { dateNow } from '@/utils/date';
import NProgress from 'nprogress';
import 'nprogress/nprogress.css';
import { getListUser } from '@/api/distribution/distributionStockup';
import { getPostList } from '@/api/system/post';
export default {
data() {
return {
form: {},
query: {},
search: {},
loading: true,
page: {
pageSize: 30,
currentPage: 1,
total: 0,
},
selectionList: [],
department: '',
option: {
height: 'auto',
calcHeight: 30,
tip: false,
searchShow: true,
searchMenuSpan: 6,
border: true,
index: true,
menu: true,
viewBtn: true,
addBtn: true,
selection: true,
indexLabel: '序号',
indexWidth: '80',
dialogClickModal: false,
column: [
{
label: '租户号1',
prop: 'tenantId',
type: 'input',
addDisplay: false,
editDisplay: false,
viewDisplay: false,
hide: true,
},
{
label: '创建人',
prop: 'createUser',
type: 'input',
addDisplay: false,
editDisplay: false,
viewDisplay: false,
hide: true,
},
{
label: '创建时间',
prop: 'createTime',
type: 'input',
addDisplay: false,
editDisplay: false,
viewDisplay: false,
hide: true,
},
{
label: '更新人',
prop: 'updateUser',
type: 'input',
addDisplay: false,
editDisplay: false,
viewDisplay: false,
hide: true,
},
{
label: '更新时间',
prop: 'updateTime',
type: 'input',
addDisplay: false,
editDisplay: false,
viewDisplay: false,
hide: true,
},
{
label: '状态',
prop: 'status',
type: 'input',
addDisplay: false,
editDisplay: false,
viewDisplay: false,
hide: true,
},
{
label: '是否已删除',
prop: 'isDeleted',
type: 'input',
addDisplay: false,
editDisplay: false,
viewDisplay: false,
hide: true,
},
{
label: '创建部门',
prop: 'createDept',
type: 'input',
addDisplay: false,
editDisplay: false,
viewDisplay: false,
hide: true,
},
{
label: '主键',
prop: 'id',
type: 'input',
addDisplay: false,
editDisplay: false,
viewDisplay: false,
hide: true,
},
{
label: '预留1',
prop: 'reserve1',
type: 'input',
addDisplay: false,
editDisplay: false,
viewDisplay: false,
hide: true,
},
{
label: '预留2',
prop: 'reserve2',
type: 'input',
addDisplay: false,
editDisplay: false,
viewDisplay: false,
hide: true,
},
{
label: '预留3',
prop: 'reserve3',
type: 'input',
addDisplay: false,
editDisplay: false,
viewDisplay: false,
hide: true,
},
{
label: '预留4',
prop: 'reserve4',
type: 'input',
addDisplay: false,
editDisplay: false,
viewDisplay: false,
hide: true,
},
{
label: '预留5',
prop: 'reserve5',
type: 'input',
viewDisplay: false,
addDisplay: false,
editDisplay: false,
hide: true,
},
{
label: '仓库名称',
prop: 'name',
type: 'input',
search: true,
rules: [
{
required: true,
message: '请输入仓库名称',
trigger: 'blur',
},
],
span: 12,
labelWidth: '120',
width: '130',
},
{
label: '仓库编码',
prop: 'warehouseCode',
type: 'input',
rules: [
{
required: true,
message: '请输入仓库代码',
trigger: 'blur',
},
],
span: 12,
labelWidth: '120',
width: '130',
},
{
label: '仓库简称',
prop: 'abbreviation',
type: 'input',
labelWidth: '120',
width: '130',
},
{
label: '联系人',
prop: 'linkman',
type: 'input',
search: true,
span: 12,
labelWidth: '120',
width: '130',
rules: [
{
required: true,
message: '请填写联系人',
trigger: 'blur',
},
],
},
{
label: '联系电话',
prop: 'contactNumber',
type: 'input',
search: true,
rules: [
{
required: true,
message: '请填写联系电话',
trigger: 'blur',
},
],
span: 12,
labelWidth: '120',
width: '130',
},
{
label: '事业线',
prop: 'businessLine',
type: 'input',
search: false,
span: 12,
labelWidth: '120',
width: '90',
addDisplay: false,
editDisplay: false,
viewDisplay: false,
hide: true,
},
// {
// label: "配送商场",
// prop: "distributionMall",
// type: "input",
// span:12,
// labelWidth:'120',
// width:'100'
// },
{
label: '管理区域',
prop: 'administrativeAreas',
type: 'cascader',
search: true,
multiple: true,
span: 12,
placeholder: '省/市/区',
dicUrl: '/blade-system/region/lazy-listAll',
checkStrictly: true,
// dicData:dicData ,
props: {
label: 'label',
value: 'value',
children: 'children',
leaf: 'leaf',
},
labelWidth: '120',
width: '130',
},
{
label: '职能类型',
prop: 'functionType',
type: 'select',
span: 12,
labelWidth: '120',
width: '130',
search: true,
dicUrl: '/api/blade-system/dict-biz/dictionary?code=warehouse_function_type',
dataType: 'number',
props: {
label: 'dictValue',
value: 'dictKey',
},
},
{
label: '仓库地址',
prop: 'warehouseAddress',
type: 'input',
span: 12,
labelWidth: '120',
width: '130',
addDisplay: false,
editDisplay: false,
viewDisplay: false,
hide: false,
},
//数据库数据
{
label: '仓库地区',
prop: 'addressInfo',
type: 'cascader',
search: true,
labelWidth: '120',
width: '130',
clearable: true,
placeholder: '省/市/区',
dicUrl: '/blade-system/region/lazy-listAll',
checkStrictly: true,
// dicData:dicData ,
props: {
label: 'label',
value: 'value',
children: 'children',
leaf: 'leaf',
},
addDisplay: true,
editDisplay: false,
viewDisplay: true,
hide: false,
},
//表单数据
{
label: '仓库地址',
prop: 'address',
type: 'map',
span: 12,
labelWidth: '120',
width: '130',
params: {
zoom: 8,
//地图是否能够缩放
zoomEnable: true,
//地图是否能够鼠拖移
dragEnable: true,
value: '',
},
rules: [
{
required: true,
message: '请输入仓库地址',
trigger: 'change',
},
],
clearable: true,
addDisplay: true,
editDisplay: true,
hide: true,
},
{
label: '经度',
prop: 'longitude',
type: 'input',
span: 12,
labelWidth: '120',
width: '130',
addDisplay: false,
editDisplay: false,
hide: true,
},
{
label: '纬度',
prop: 'latitude',
type: 'input',
span: 12,
labelWidth: '120',
width: '130',
addDisplay: false,
editDisplay: false,
hide: true,
},
{
label: '所属部门',
prop: 'department',
type: 'input',
span: 12,
labelWidth: '120',
width: '130',
addDisplay: false,
editDisplay: false,
hide: true,
},
{
label: '所属部门',
prop: 'departmentName',
search: true,
type: 'tree',
span: 12,
labelWidth: '120',
width: '130',
dicUrl: '/api/blade-system/dept/lazy-tree?parentId=0',
props: {
label: 'title',
value: 'title',
},
hide: false,
addDisplay: true,
editDisplay: true,
viewDisplay: false,
lazy: true,
checkStrictly: true,
treeLoad: (node, resolve) => {
let stop_level = 3;
let level = node.level; // 0
let data = node.data || {};
let code = data.id;
let list = [];
let callback = () => {
this.department = data.id;
console.log('this.department>>>>>>>>>', this.department);
resolve(
(list || []).map(ele => {
return Object.assign(ele, {
leaf: level >= stop_level,
});
})
);
};
if (level == 0) {
axios.get(`/api/blade-system/dept/lazy-tree?parentId=0`).then(res => {
list = res.data.data;
callback();
});
}
if (level == 1) {
axios.get(`/api/blade-system/dept/lazy-tree?parentId=${code}`).then(res => {
list = res.data.data;
callback();
});
} else if (level == 2) {
axios.get(`/api/blade-system/dept/lazy-tree?parentId=${code}`).then(res => {
list = res.data.data;
callback();
});
} else if (level == 3) {
axios.get(`/api/blade-system/dept/lazy-tree?parentId=${code}`).then(res => {
list = res.data.data;
callback();
});
} else {
list = [];
callback();
}
},
},
{
label: '仓库类型',
prop: 'warehouseType',
type: 'select',
dicUrl: '/api/blade-system/dict-biz/dictionary?code=warehouse_type',
dataType: 'number',
props: {
label: 'dictValue',
value: 'dictKey',
},
search: true,
span: 12,
labelWidth: '120',
width: '130',
rules: [
{
required: true,
message: '请选择仓库类型',
trigger: 'change',
},
],
},
{
label: '消防等级',
prop: 'fireGrade',
type: 'select',
search: true,
dicUrl: '/api/blade-system/dict-biz/dictionary?code=warehouse_grade',
props: {
label: 'dictValue',
value: 'dictKey',
},
span: 12,
labelWidth: '120',
width: '130',
rules: [
{
required: true,
message: '请选择消防等级',
trigger: 'change',
},
],
},
{
label: '是否有消防等级',
prop: 'fireRatingNot',
type: 'select',
dicUrl: '/api/blade-system/dict-biz/dictionary?code=yes_no',
props: {
label: 'dictValue',
value: 'dictKey',
},
span: 12,
labelWidth: '120',
width: '130',
},
// {
// label: "商家仓",
// prop: "merchantFactory",
// type: "select",
// dicUrl: "/api/blade-system/dict-biz/dictionary?code=yes_no",
// props: {
// label: "dictValue",
// value: "dictKey"
// },
// span:12,
// labelWidth:'120',
// width:'90'
//
// },
{
label: '仓库结构',
prop: 'warehouseStructure',
type: 'select',
search: true,
dicUrl: '/api/blade-system/dict-biz/dictionary?code=warehouse_structure',
props: {
label: 'dictValue',
value: 'dictKey',
},
span: 12,
labelWidth: '120',
width: '130',
rules: [
{
required: true,
message: '请选择仓库结构',
trigger: 'change',
},
],
},
{
label: '是否高架',
prop: 'elevatedNot',
type: 'select',
dicUrl: '/api/blade-system/dict-biz/dictionary?code=yes_no',
props: {
label: 'dictValue',
value: 'dictKey',
},
span: 12,
labelWidth: '120',
width: '130',
rules: [
{
required: true,
message: '请选择是否为高架',
trigger: 'change',
},
],
},
{
label: '仓库层高',
prop: 'storeyHeight',
type: 'input',
span: 12,
labelWidth: '120',
width: '130',
},
{
label: '电力类型',
prop: 'powerCondition',
type: 'select',
span: 12,
labelWidth: '120',
search: true,
dicUrl: '/api/blade-system/dict-biz/dictionary?code=power_condition',
props: {
label: 'dictValue',
value: 'dictKey',
},
width: '130',
rules: [
{
required: true,
message: '请选择用电类型',
trigger: 'change',
},
],
},
{
label: '租金单价',
prop: 'unitPrice',
type: 'input',
span: 12,
labelWidth: '120',
width: '70',
},
{
label: '面积',
prop: 'acreage',
type: 'input',
span: 12,
labelWidth: '120',
width: '70',
},
{
label: '开始时间',
prop: 'startDate',
type: 'date',
format: 'YYYY-MM-DD',
valueFormat: 'YYYY-MM-DD',
placeholder: '请选择租赁开始时间',
span: 12,
labelWidth: '120',
width: '130',
viewDisplay: true,
addDisplay: false,
editDisplay: false,
hide: false,
},
{
label: '到期时间',
prop: 'endDate',
type: 'date',
format: 'YYYY-MM-DD',
valueFormat: 'YYYY-MM-DD',
placeholder: '请选择租赁结束时间',
span: 12,
labelWidth: '120',
width: '130',
viewDisplay: true,
addDisplay: false,
editDisplay: false,
hide: false,
},
{
label: '租金类型',
prop: 'rentType',
type: 'select',
search: true,
dicUrl: '/api/blade-system/dict-biz/dictionary?code=rent_type',
props: {
label: 'dictValue',
value: 'dictKey',
},
span: 12,
labelWidth: '120',
width: '130',
rules: [
{
required: true,
message: '请选择租金类型',
trigger: 'change',
},
],
},
{
label: '仓库等级',
prop: 'grade',
type: 'select',
search: true,
dicUrl: '/api/blade-system/dict-biz/dictionary?code=warehouse_grade',
props: {
label: 'dictValue',
value: 'dictKey',
},
span: 12,
labelWidth: '120',
width: '130',
rules: [
{
required: true,
message: '请选择仓库等级',
trigger: 'change',
},
],
},
{
label: '管理费',
prop: 'administrativeFee',
type: 'input',
span: 12,
labelWidth: '120',
width: '90',
},
{
label: '库位数',
prop: 'seating',
type: 'input',
span: 12,
labelWidth: '120',
width: '90',
},
{
label: '日期范围',
prop: 'daterange',
type: 'daterange',
format: 'YYYY-MM-DD',
valueFormat: 'YYYY-MM-DD',
startPlaceholder: '租赁开始日期',
endPlaceholder: '租赁结束日期',
span: 12,
labelWidth: '120',
width: '130',
search: true,
searchRange: true,
searchSpan: 12,
rules: [
{
required: true,
message: '请选择租赁时间',
trigger: 'change',
},
],
viewDisplay: false,
addDisplay: true,
editDisplay: true,
hide: true,
},
{
label: '备注',
prop: 'remarks',
type: 'input',
span: 12,
labelWidth: '120',
width: '70',
},
{
label: '收款码',
prop: 'paymentCodeUrl',
type: 'upload',
dataType: 'string',
listType: 'picture-img',
hide: true,
labelWidth: '150',
span: 11,
multiple: false,
width: '200px',
align: 'left',
action: '/blade-resource/oss/endpoint/put-file',
propsHttp: {
res: 'data',
url: 'link',
},
addDisplay: true,
viewDisplay: true,
editDisplay: true,
},
],
},
data: [],
//所属部门ID
deptList: [],
};
},
computed: {
...mapGetters(['permission']),
permissionList() {
return {
addBtn: this.validData(this.permission.warehouseWarehouse_add, false),
viewBtn: this.validData(this.permission.warehouseWarehouse_view, false),
delBtn: this.validData(this.permission.warehouseWarehouse_delete, false),
editBtn: this.validData(this.permission.warehouseWarehouse_edit, false),
};
},
ids() {
let ids = [];
this.selectionList.forEach(ele => {
ids.push(ele.id);
});
return ids.join(',');
},
},
methods: {
rowSave(row, done, loading) {
console.log('>>>>>>', row);
let a = [];
//解析地址,添加精度、维度、详细地址
if (!!row.address) {
a = row.address;
row.longitude = a[0];
row.latitude = a[1];
row.warehouseAddress = a[2];
}
//解析租赁日期为租赁开始日期、租赁到期日期
if (this.form.daterange) {
let date = this.form.daterange;
row.startDate = date[0];
row.endDate = date[1];
}
//解析所在地区为省级划分、市级划分、区级划分,支持单点
if (!!this.form.addressInfo) {
let code = this.form.addressInfo;
if (code.length === 1) {
row.provinceCode = code[0];
} else if (code.length === 2) {
row.provinceCode = code[0];
row.cityCode = code[1];
} else {
row.provinceCode = code[0];
row.cityCode = code[1];
row.code = code[2];
}
}
// 解析管理区域为省级划分、市级划分、区级划分,支持单点
if (!!this.form.administrativeAreas) {
console.log();
let str = [];
let kk = this.form.administrativeAreas;
kk.forEach(a => {
str.push(a[a.length - 1]);
});
row.administrativeAreas = str.join(',');
}
console.log('-------------->this.form.departmentName', this.form.departmentName);
console.log('-------------->this.department', this.department);
if (row.departmentName) {
row.department = this.department;
}
console.log('-------------->row', row);
add(row).then(
() => {
this.onLoad(this.page);
this.$message({
type: 'success',
message: '操作成功!',
});
done();
},
error => {
loading();
window.console.log(error);
}
);
},
rowUpdate(row, index, done, loading) {
//解析租赁日期,为开始租赁日期和租赁结束日期
let aa = this.form.administrativeAreas;
console.log('!!!!!!!!!', aa);
if (this.form.daterange) {
let date = this.form.daterange;
row.startDate = date[0];
row.endDate = date[1];
}
let a = [];
//解析仓库地址
if (!!this.form.address) {
a = this.form.address;
row.longitude = a[0];
row.latitude = a[1];
row.warehouseAddress = a[2];
}
//解析地区
if (!!this.form.addressInfo) {
let code = this.form.addressInfo;
if (code.length === 1) {
row.provinceCode = code[0];
} else if (code.length === 2) {
row.provinceCode = code[0];
row.cityCode = code[1];
} else {
row.provinceCode = code[0];
row.cityCode = code[1];
row.code = code[2];
}
}
// row.administrativeAreas = str.join(",");
console.log(this.form.administrativeAreas);
// 解析管理区域为省级划分、市级划分、区级划分,支持单点
console.log('>>>>>>>>>', row);
if (!!this.form.administrativeAreas) {
let str = [];
this.form.administrativeAreas.forEach(a => {
str.push(a[a.length - 1]);
});
row.administrativeAreas = str.join(',');
}
if (row.departmentName) {
row.department = this.department;
}
update(row).then(
() => {
this.onLoad(this.page);
this.$message({
type: 'success',
message: '操作成功!',
});
done();
},
error => {
loading();
console.log(error);
}
);
},
rowDel(row) {
this.$confirm('确定将选择数据删除?', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
return remove(row.id);
})
.then(() => {
this.onLoad(this.page);
this.$message({
type: 'success',
message: '操作成功!',
});
});
},
handleDelete() {
if (this.selectionList.length === 0) {
this.$message.warning('请选择至少一条数据');
return;
}
this.$confirm('确定将选择数据删除?', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
return remove(this.ids);
})
.then(() => {
this.onLoad(this.page);
this.$message({
type: 'success',
message: '操作成功!',
});
this.$refs.crud.toggleSelection();
});
},
handleExport() {
let downloadUrl = `/blade-basicdataWarehouse/warehouseWarehouse/export-warehouseWarehouse?${
this.website.tokenHeader
}=${getToken()}`;
const {} = this.query;
let values = {};
this.$confirm('是否导出数据?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}).then(() => {
NProgress.start();
exportBlob(downloadUrl, values).then(res => {
downloadXls(res.data, `仓库${dateNow()}.xlsx`);
NProgress.done();
});
});
},
beforeOpen(done, type) {
if (['edit', 'view'].includes(type)) {
let a = [];
getDetail(this.form.id).then(res => {
if (!!res.data.data.longitude && !!res.data.data.latitude) {
//控制编辑和查看弹窗地址回显
a.push(res.data.data.longitude);
a.push(res.data.data.latitude);
a.push(res.data.data.warehouseAddress);
// this.form.address=res.data.data.longitude+","+res.data.data.latitude+","+res.data.data.warehouseAddress;
this.form.address = a;
}
const data = res.data.data;
//日期回显
if (!!data.startDate && !!data.endDate) {
this.form.daterange.push(res.data.data.startDate, res.data.data.endDate);
}
if (!!data.administrativeAreas) {
data.administrativeAreas = data.administrativeAreas.split(',');
}
this.form = res.data.data;
});
}
done();
},
searchReset() {
this.query = {};
this.onLoad(this.page);
},
searchChange(params, done) {
this.query = params;
this.page.currentPage = 1;
this.onLoad(this.page, params);
done();
},
selectionChange(list) {
this.selectionList = list;
},
selectionClear() {
this.selectionList = [];
this.$refs.crud.toggleSelection();
},
currentChange(currentPage) {
this.page.currentPage = currentPage;
},
sizeChange(pageSize) {
this.page.pageSize = pageSize;
},
refreshChange() {
this.onLoad(this.page, this.query);
},
editDeline(row) {
console.log(row);
this.$DialogForm.show({});
},
onLoad(page, params = {}) {
this.loading = true;
console.log('this.query>>>', this.query);
const {
name,
linkman,
contactNumber,
businessLine,
warehouseAddress,
warehouseType,
fireRatingNot,
fireGrade,
warehouseStructure,
powerCondition,
grade,
// daterange,
// addressInfo,
// administrativeAreas
} = this.query;
let values = {
name: name,
linkman: linkman,
contactNumber: contactNumber,
businessLine: businessLine,
warehouseAddress: warehouseAddress,
warehouseType: warehouseType,
fireGrade: fireGrade,
fireRatingNot: fireRatingNot,
warehouseStructure: warehouseStructure,
powerCondition: powerCondition,
grade: grade,
};
if (this.query.daterange) {
values.startDate = this.query.daterange[0];
values.endDate = this.query.daterange[1];
}
if (this.query.addressInfo) {
let code = this.query.addressInfo;
if (code.length === 1) {
values.provinceCode = code[0];
} else if (code.length === 2) {
values.provinceCode = code[0];
values.cityCode = code[1];
} else {
values.provinceCode = code[0];
values.cityCode = code[1];
values.code = code[2];
}
}
if (this.query.administrativeAreas) {
let code = this.query.addressInfo;
if (code.length === 1) {
values.manageProvinceCode = code[0];
} else if (code.length === 2) {
values.manageProvinceCode = code[0];
values.manageCityCode = code[1];
} else {
values.manageProvinceCode = code[0];
values.manageCityCode = code[1];
values.manageCode = code[2];
}
}
console.log('values>>>>>>>', values);
getList(page.currentPage, page.pageSize, values).then(res => {
const data = res.data.data;
this.page.total = data.total;
//这里对管理区域进行数据拼接进行回显
data.records.forEach(item => {
let b = [];
item.administrativeAreas = item.administrativeAreas.split(',');
console.log('=============>', item.administrativeAreas);
if (item.provinceCode) {
b.push(item.provinceCode);
}
if (item.cityCode) {
b.push(item.cityCode);
}
if (item.code) {
b.push(item.code);
}
b.join(',');
item.addressInfo = b;
if (item.department) {
//这里请求部门
}
});
console.log('data>>>>>>>>>>>>>', data);
this.data = data.records;
this.loading = false;
this.selectionClear();
});
},
},
};
</script>
<style>
/*.avue-input-map__content-box {*/
/* position: relative;*/
/* z-index: -1;*/
/*}*/
/*.amap-ui-poi-picker-search-results-container, .amap-ui-poi-picker-sugg-container {*/
/* position: absolute;*/
/* -webkit-box-sizing: border-box;*/
/* box-sizing: border-box;*/
/* width: 100%;*/
/* padding: 0;*/
/* overflow: auto;*/
/* z-index: 999;*/
/* position: relative;*/
/*}*/
.avue-form .avue-date .el-date-editor,
.avue-form .avue-time .el-date-editor {
height: 32px !important;
}
</style>