Commit d236a1c6 by 胡悦

Merge branch 'v1.5.0' into 'develop'

V1.5.0版本已上线,先需要吧代码合并到develop

See merge request !3
2 parents b7d2ba44 789a3b92
......@@ -45,8 +45,11 @@ export const GET_VEHICLE_SELECTEDTYPETREE = (params) => {
};
// 工单管理-工单列表-图片打包下载
export const GET_WORKORDER_BATCHEXPORTPICS =
"/trialdrive/workorder/batchExportPics";
//export const GET_WORKORDER_BATCHEXPORTPICS = "/trialdrive/workorder/batchExportPics";
export const GET_WORKORDER_BATCHEXPORTPICS = params => {
return request(params, "/trialdrive/workorder/batchExportPics");
}
// 工单管理-工单列表-导入工单-模板下载
export const GET_WORKORDER_TEMPLATEFILE =
......
......@@ -44,4 +44,39 @@ function dictInfo (params) {
function resetPassword(params) {
return request(params, '/usercenter/user/resetPassword')
}
// 获取车辆树列表
export const GET_VEHICLE_TREE = params => {
return request(params,'/trialdrive/vehicle/tree')
}
// 获取车辆树列表-查询用户下面的车辆
export const GET_USER_VEHICLE_LIST = params => {
return request(params,'/trialdrive/vehicle/uvlist')
}
// 获取车辆树列表-查询组织下面的车辆
export const GET_ORGANIZATION_VEHICLE_LIST = params => {
return request(params,'/trialdrive/vehicle/ovlist')
}
// 用户管理-指定数据-保存数据
export const SAVE_USER_ASSIGN_INFO = params => {
return request(params,'/trialdrive/vehicle/permit/assign','post')
}
// 用户管理-指定数据-获取用户指定数据
export const GET_USER_ASSIGN_INFO = params => {
return request(params,'/trialdrive/vehicle/permit/assigndetails')
}
// 用户管理-指定数据-文件导入接口
export const IMPORT_VEHICLE_TEMPLATE = '/trialdrive/vehicle/permit/import'
// 用户管理-指定数据-文件导入-模板下载
export const DOWNLOAD_ASSIGNPERMIT_TEMPLATE_FILE = params => {
return request(params,'/publiccenter/dict/data/type/excelTemplate/assignPermit')
}
export { getUserList, getSuperUser, addUser, editUser, detailUser, deleteUser, roleList, dictInfo, resetPassword}
......@@ -23,4 +23,9 @@ export default {
updateOrganizationTree(state, list) {
state.organizationTree = list;
},
// 更新用户组织树数据
updateUserOrganizationTree(state, list) {
state.userVehicleTree = list;
},
};
......@@ -16,6 +16,7 @@ const state = {
vehicleCustomTree:[], // 新增工单-新增车辆-车型数据
deviceAssembly:[], // 新增工单-新增车辆-设备组合
organizationTree:[], // 组织树
userVehicleTree:[], // 用户管理-指定数据-组织树
}
try {
......
import Vue from 'vue'
const EventBus = new Vue()
import { Message, MessageBox, Loading } from 'element-ui'
import moment from 'moment'
let loadingInstance = ''
......@@ -241,9 +241,25 @@ export const Util = {
}
throw new Error("Unable to clone obj! Its type isn't supported.")
},
// 传递消息
broadcast: function (msg, data) {
EventBus.$emit(msg, data)
},
// 接收消息
received: function (msg, callBack) {
EventBus.$off(msg)
EventBus.$on(msg, function (row) {
callBack(row)
})
},
}
export const showModal = Util.msg
export const showToast = Util.Info
export const showLoading = Util.loading
export const hideLoading = Util.closeLoading
export const deepClone = Util.deepClone
export const broadcast = Util.broadcast
export const received = Util.received
<template>
<div class="">
<el-tabs v-model="activeTabs">
<el-tab-pane label="选择数据" name="1">
<select-info ref="selectInfoCom" v-if="activeTabs == 1" :id="id" :key="id"></select-info>
</el-tab-pane>
<el-tab-pane label="导入数据" name="2">
<import-vehicle ref="importVehicleCom" v-if="activeTabs == 2" :id="id" :key="id"></import-vehicle>
</el-tab-pane>
</el-tabs>
</div>
</template>
<script>
import SelectInfo from "./select.vue";
import ImportVehicle from "./import.vue";
export default {
name: "AssignInfo",
components: {
SelectInfo,
ImportVehicle,
},
props: {
id: {
type: [String, Number],
default: "",
},
},
data() {
return {
activeTabs: "1",
userId: "",
randomKey:''
};
},
watch:{
id:{
handler:function(){
console.log('key:',Math.random())
this.randomKey = Math.random()
}
}
},
mounted() {
this.userId = this.id;
},
methods: {
// 保存数据
saveInfo() {
if (this.activeTabs == 1) {
this.$refs.selectInfoCom.saveInfo();
return false;
}
this.$refs.importVehicleCom.saveInfo();
},
},
};
</script>
<style lang="scss" scoped>
</style>
\ No newline at end of file
<template>
<div class="imort_page">
<div class="choose_box">
<div class="upload_wrap">
<el-input placeholder="请选择需要导入的车辆表格" v-model="uploadFile.name" readonly>
<el-button slot="append">选择文件</el-button>
</el-input>
<!-- 隐藏上传文件按钮 开始 -->
<el-upload ref="uploadBox" class="upload_box" :auto-upload="false" :headers="uploadHead" :accept="acceptFile" :data="uploadParams" :action="uploadPath" multiple :show-file-list="false" :on-change="onChange" :on-success="onSuccess" :before-upload="beforeUpload" :on-error="onError" :file-list="fileList">
<el-button type="primary">点击上传</el-button>
</el-upload>
<!-- 隐藏上传文件按钮 end -->
</div>
<el-link type="primary" class="el_link" @click="downTemplate">下载模版</el-link>
</div>
<!-- <div class="btn_group">
<el-button type="default" size="small">取消</el-button>
<el-button type="primary" size="small">确定</el-button>
</div> -->
<!-- 导入结果 开始 -->
<div class="upload_result" v-if="uploadResult && (uploadResult.total || uploadResult.total == 0)">
<h2 class="title">导入结果</h2>
<div class="result_box">
<div class="cell">
<div class="name">
<span>成功记录</span>
</div>
<span class="txt">{{uploadResult.succNum||0}}</span>
</div>
<div class="cell">
<div class="name">
<span>失败记录</span>
<span class="btn" v-if="uploadResult.failFile" @click="downloadFail()">导出记录</span>
</div>
<span class="txt">{{uploadResult.failNum||0}}</span>
</div>
</div>
</div>
<!-- 导入结果 end -->
</div>
</template>
<script>
import {
IMPORT_VEHICLE_TEMPLATE,
DOWNLOAD_ASSIGNPERMIT_TEMPLATE_FILE,
} from "@/services/user";
import { showToast, broadcast } from "@/utils/util";
export default {
name: "ImportVehicle",
props: {
id: {
type: [String, Number],
default: "",
},
},
data() {
return {
fileInfo: "",
uploadPath: "",
uploadHead: {},
uploadFile: {},
uploadParams: {},
uploadResult: {},
acceptFile: ".xlsx,.xls",
fileList: [],
};
},
mounted() {
let id = this.id;
let token = localStorage.getItem("token");
this.uploadPath =
this.$root.parentVuex.getters.baseURL + IMPORT_VEHICLE_TEMPLATE;
this.uploadHead = { Authorization: token };
this.uploadParams = { receiverId: id };
},
methods: {
// 监听文件选择
onChange(file, fileList) {
console.log(file);
console.log(fileList);
if (!file.response) {
this.uploadFile = file;
this.fileList = [file];
}
},
// 下载失败文件
downloadFail() {
let o = this.uploadResult;
window.open(o.failFile);
},
// 文件上传前
beforeUpload() {
this.uploadResult = {};
},
// 文件上传失败
onError(err, file, fileList) {
console.log(err);
},
// 监听文件上传成功
onSuccess(response, file, fileList) {
console.log(response);
let _this = this;
broadcast("cancel-loading");
_this.$refs.uploadBox.clearFiles();
if (response.code != 200) {
showToast({
message: response.message,
});
_this.uploadFile = {};
_this.fileList = [];
return false;
}
this.uploadResult = response.data;
broadcast("import-success");
},
// 上传文档
saveInfo() {
let o = this.uploadFile;
console.log(this.fileList);
console.log(o);
if (!o || !o.name) {
showToast({
message: "请选择文件",
});
console.log("7777777777777");
broadcast("cancel-loading");
return false;
}
let list = o.name.split('.')
let acceptFile = this.acceptFile;
let _type = list[list.length-1];
let idx = acceptFile.includes(_type)
if(!idx){
showToast({
message: `导入文件只支持${acceptFile}`,
});
broadcast("cancel-loading");
return false;
}
this.$refs.uploadBox.submit();
},
// 下载模板
downTemplate() {
DOWNLOAD_ASSIGNPERMIT_TEMPLATE_FILE().then((res) => {
let { data } = res;
window.open(data.dictValue);
});
},
},
};
</script>
<style lang="scss" scoped>
.choose_box {
display: flex;
align-items: center;
padding: 10px 72px;
.el_link {
flex-shrink: 0;
text-align: left;
margin: 0 10px;
}
.upload_wrap {
flex: 1;
position: relative;
.upload_box {
position: absolute;
right: 0;
bottom: 0;
top: 0;
opacity: 0;
}
}
}
.btn_group {
padding: 20px 0 10px 0;
text-align: center;
}
.upload_result {
border-top: 1px solid #eee;
margin-top: 30px;
.title {
font-family: PingFangSC-Medium;
font-size: 20px;
color: #333333;
font-weight: 500;
}
.result_box {
display: flex;
align-items: center;
justify-content: center;
padding-bottom: 30px;
.cell {
width: 248px;
height: 108px;
background: #fbfbfb;
border: 1px solid rgba(215, 215, 215, 1);
border-radius: 4px;
margin: 0 20px;
display: flex;
flex-direction: column;
justify-content: center;
padding: 20px;
box-sizing: border-box;
.name {
font-family: PingFangSC-Medium;
font-size: 14px;
color: #666666;
font-weight: 500;
display: flex;
align-items: center;
.btn {
width: 76px;
height: 30px;
border: 1px solid rgba(33, 150, 243, 1);
border-radius: 4px;
text-align: center;
line-height: 28px;
font-family: PingFangSC-Regular;
font-size: 14px;
color: #409eff;
font-weight: 400;
cursor: pointer;
margin-left: 10px;
}
.btn:hover {
opacity: 0.8;
}
}
.txt {
font-family: PingFangSC-Medium;
font-size: 30px;
color: #333333;
font-weight: 500;
line-height: 1.5;
}
}
}
}
</style>
\ No newline at end of file
......@@ -97,7 +97,7 @@
</el-table-column>
</el-table>
<div class="pagination_list">
<el-pagination background layout="sizes, total,prev, pager, next, jumper" :total="pageTotal" :page-size.sync="currentPage" :page-sizes="pageSizes" @current-change="getList" @size-change="changePageSize" />
<el-pagination background layout="sizes, total,prev, pager, next, jumper" :total="pageTotal" :current-page.sync="currentPage" :page-sizes="pageSizes" @current-change="getList" @size-change="changePageSize" />
</div>
</div>
<!-- 表格区域 end -->
......@@ -375,18 +375,32 @@ export default {
oParams.orderIds = arr.toString();
_this.iloading = true;
_this.$Common.exportExcel({
url: `${store.state.baseURL}${GET_WORKORDER_BATCHEXPORTPICS}`,
method: "GET",
data: oParams,
fileName: `图片${moment().format("YYYY-MM-DD")}.zip`,
success: () => {
GET_WORKORDER_BATCHEXPORTPICS(oParams)
.then((res) => {
_this.iloading = false;
},
fail: () => {
if (res.code != 200) {
showToast({
message: res.message,
});
return false;
}
window.open(res.data);
})
.catch((error) => {
_this.iloading = false;
},
});
});
// _this.$Common.exportExcel({
// url: `${store.state.baseURL}${GET_WORKORDER_BATCHEXPORTPICS}`,
// method: "GET",
// data: oParams,
// fileName: `图片${moment().format("YYYY-MM-DD")}.zip`,
// success: () => {
// _this.iloading = false;
// },
// fail: () => {
// _this.iloading = false;
// },
// });
},
// 导出excel
......
const path = require('path')
const { name, port } = require("./package");
function resolve (dir) {
function resolve(dir) {
return path.join(__dirname, dir)
}
......@@ -13,6 +13,7 @@ module.exports = {
outputDir: "dist",
assetsDir: "static",
filenameHashing: true,
productionSourceMap: false,
devServer: {
overlay: {
warning: false,
......@@ -42,14 +43,14 @@ module.exports = {
.loader('file-loader')
.options({
name: 'fonts/[name].[hash:8].[ext]',
publicPath: getPublicPath
//publicPath: getPublicPath
})
.end()
},
configureWebpack: {
output: {
// 微应用的包名,这里与主应用中注册的微应用名称一致
library: `${name}-[name]`,
library: `${name}-[name]`,
// 将你的 library 暴露为所有的模块定义下都可运行的方式
libraryTarget: 'umd',
// 按需加载相关
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!