Commit 9d5192d1 authored by wanglianghe's avatar wanglianghe

文件上传,搜索条件

parent 3f68be88
...@@ -16,3 +16,11 @@ export function getFilePage(query) { ...@@ -16,3 +16,11 @@ export function getFilePage(query) {
params: query params: query
}) })
} }
export function uploadFile(data) {
return request({
url: '/infra/file/upload',
method: 'post',
data: data
})
}
<template> <template>
<div class="app-container"> <div class="app-container">
<!-- 搜索工作栏 -->
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<!-- <el-form-item label="中文名称" prop="titleZh">
<el-input v-model="queryParams.titleZh" placeholder="请输入中文名称" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="英文名称" prop="titleEn">
<el-input v-model="queryParams.titleEn" placeholder="请输入英文名称" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="排序" prop="sort">
<el-input v-model="queryParams.sort" placeholder="请输入排序" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="国家" prop="countryZh">
<el-input v-model="queryParams.countryZh" placeholder="请输入国家中文名称" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="省" prop="provinceZh">
<el-input v-model="queryParams.provinceZh" placeholder="请输入省中文名称" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="城市" prop="cityZh">
<el-input v-model="queryParams.cityZh" placeholder="请输入城市中文名称" clearable @keyup.enter.native="handleQuery"/>
</el-form-item> -->
<el-form-item label="码头编号" prop="number">
<el-input v-model="queryParams.number" placeholder="请输入码头编号" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="码头类型" prop="type">
<el-input v-model="queryParams.type" placeholder="请输入码头类型" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<!-- 操作工具栏 --> <!-- 操作工具栏 -->
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<el-col :span="1.5"> <el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
v-hasPermi="['ecw:dock:create']">新增</el-button> v-hasPermi="['ecw:dock:create']">新增</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <!-- <el-col :span="1.5">
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading" <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"
v-hasPermi="['ecw:dock:export']">导出</el-button> v-hasPermi="['ecw:dock:export']">导出</el-button>
</el-col> </el-col> -->
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row> </el-row>
...@@ -65,11 +26,6 @@ ...@@ -65,11 +26,6 @@
<el-table-column label="码头编号" align="center" prop="number" /> <el-table-column label="码头编号" align="center" prop="number" />
<el-table-column label="码头类型" align="center" prop="type" /> <el-table-column label="码头类型" align="center" prop="type" />
<el-table-column label="排序" align="center" prop="sort" /> <el-table-column label="排序" align="center" prop="sort" />
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
...@@ -163,7 +119,7 @@ export default { ...@@ -163,7 +119,7 @@ export default {
// 导出遮罩层 // 导出遮罩层
exportLoading: false, exportLoading: false,
// 显示搜索条件 // 显示搜索条件
showSearch: true, showSearch: false,
// 总条数 // 总条数
total: 0, total: 0,
// 码头信息列表 // 码头信息列表
......
...@@ -4,10 +4,10 @@ ...@@ -4,10 +4,10 @@
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="城市名称" prop="cityName"> <el-form-item label="城市名称" prop="cityName">
<el-input v-model="queryParams.number" placeholder="请输入城市名称" clearable @keyup.enter.native="handleQuery"/> <el-input v-model="queryParams.cityName" placeholder="请输入城市名称" clearable @keyup.enter.native="handleQuery"/>
</el-form-item> </el-form-item>
<el-form-item label="关键词" prop="keywords"> <el-form-item label="关键词" prop="keywords">
<el-input v-model="queryParams.keywordsZh" placeholder="请输入关键词" clearable @keyup.enter.native="handleQuery"/> <el-input v-model="queryParams.keywords" placeholder="请输入关键词" clearable @keyup.enter.native="handleQuery"/>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
...@@ -22,10 +22,10 @@ ...@@ -22,10 +22,10 @@
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
v-hasPermi="['ecw:node:create']">新增</el-button> v-hasPermi="['ecw:node:create']">新增</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <!-- <el-col :span="1.5">
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading" <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"
v-hasPermi="['ecw:node:export']">导出</el-button> v-hasPermi="['ecw:node:export']">导出</el-button>
</el-col> </el-col> -->
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row> </el-row>
......
...@@ -8,6 +8,12 @@ ...@@ -8,6 +8,12 @@
<el-input v-model="queryParams.titleZh" placeholder="请输入名称" clearable @keyup.enter.native="handleQuery"/> <el-input v-model="queryParams.titleZh" placeholder="请输入名称" clearable @keyup.enter.native="handleQuery"/>
</el-form-item> </el-form-item>
<el-form-item label="地区" prop="countryId">
<el-select v-model="queryParams.countryId" placeholder="请选择地区" clearable>
<el-option v-for="item in countryList" :key="item.id" :label="item.titleZh" :value="item.id"/>
</el-select>
</el-form-item>
<!-- <el-form-item label="地区" prop="countryId"> <!-- <el-form-item label="地区" prop="countryId">
<el-input v-model="queryParams.countryId" placeholder="请输入国家" clearable @keyup.enter.native="handleQuery"/> <el-input v-model="queryParams.countryId" placeholder="请输入国家" clearable @keyup.enter.native="handleQuery"/>
</el-form-item> --> </el-form-item> -->
...@@ -30,10 +36,10 @@ ...@@ -30,10 +36,10 @@
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
v-hasPermi="['ecw:pickup-loc:create']">新增</el-button> v-hasPermi="['ecw:pickup-loc:create']">新增</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <!-- <el-col :span="1.5">
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading" <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"
v-hasPermi="['ecw:pickup-loc:export']">导出</el-button> v-hasPermi="['ecw:pickup-loc:export']">导出</el-button>
</el-col> </el-col> -->
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row> </el-row>
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
</el-form-item> </el-form-item>
<el-form-item label="关键字" prop="keywords"> <el-form-item label="关键字" prop="keywords">
<el-input v-model="queryParams.keywords" placeholder="请输入仓库编号/名称、网点名称" clearable @keyup.enter.native="handleQuery"/> <el-input v-model="queryParams.keywords" placeholder="请输入仓库编号/名称" clearable @keyup.enter.native="handleQuery"/>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
...@@ -204,7 +204,17 @@ ...@@ -204,7 +204,17 @@
</el-form-item> </el-form-item>
<el-form-item label="img" prop="img"> <el-form-item label="img" prop="img">
<el-input v-model="form.img" placeholder="请输入图片" /> <el-col :span="8">
<el-input v-model="form.img" placeholder="请上传图片" disabled/>
</el-col>
<el-upload action="#" :http-request="requestUpload" :show-file-list="false" :before-upload="beforeUpload">
<el-button size="small">
上传图片
<i class="el-icon-upload el-icon--right"></i>
</el-button>
</el-upload>
</el-form-item> </el-form-item>
<el-form-item label="备注" prop="remark"> <el-form-item label="备注" prop="remark">
...@@ -227,6 +237,7 @@ import { getNodePage } from "@/api/ecw/node"; ...@@ -227,6 +237,7 @@ import { getNodePage } from "@/api/ecw/node";
import { getListTree } from "@/api/ecw/region"; import { getListTree } from "@/api/ecw/region";
import { getDictDatas, DICT_TYPE } from '@/utils/dict'; import { getDictDatas, DICT_TYPE } from '@/utils/dict';
import {CommonStatusEnum} from '@/utils/constants' import {CommonStatusEnum} from '@/utils/constants'
import { uploadFile } from "@/api/infra/file";
export default { export default {
name: "Warehouse", name: "Warehouse",
...@@ -408,6 +419,39 @@ export default { ...@@ -408,6 +419,39 @@ export default {
} }
}, },
// 覆盖默认的上传行为
requestUpload() {
},
// 上传预处理
beforeUpload(file) {
if (file.type.indexOf("image/") == -1) {
this.$modal.msgError("文件格式错误,请上传图片类型,如:JPG,PNG后缀的文件。");
} else {
//上传
let formData = new FormData();
formData.append("file", file);
formData.append("path", this.uuid());
uploadFile(formData).then(response => {
this.$set(this.form, 'img', response.data);
// this.form.img = response.data;
})
}
},
uuid() {
var s = [];
var hexDigits = "0123456789abcdef";
for (var i = 0; i < 36; i++) {
s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
}
s[14] = "4"; // bits 12-15 of the time_hi_and_version field to 0010
s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1); // bits 6-7 of the clock_seq_hi_and_reserved to 01
s[8] = s[13] = s[18] = s[23] = "-";
var uuid = s.join("");
return uuid;
},
getContinentsList() { getContinentsList() {
this.queryParams.treeType = 0; this.queryParams.treeType = 0;
getListTree(this.queryParams).then(response => { getListTree(this.queryParams).then(response => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment