Commit 6ef9d21b by 张杰

v1.5.0版本需求

1 parent 0eb3ab25
......@@ -73,6 +73,10 @@ export const GET_USER_ASSIGN_INFO = params => {
// 用户管理-指定数据-文件导入接口
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}
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
......@@ -12,7 +12,7 @@
</el-upload>
<!-- 隐藏上传文件按钮 end -->
</div>
<el-link type="primary" class="el_link">下载模版</el-link>
<el-link type="primary" class="el_link" @click="downTemplate">下载模版</el-link>
</div>
<!-- <div class="btn_group">
......@@ -44,7 +44,11 @@
</div>
</template>
<script>
import { IMPORT_VEHICLE_TEMPLATE } from "@/services/user";
import {
IMPORT_VEHICLE_TEMPLATE,
DOWNLOAD_ASSIGNPERMIT_TEMPLATE_FILE,
} from "@/services/user";
import { showToast,broadcast } from "@/utils/util";
export default {
name: "ImportVehicle",
props: {
......@@ -91,15 +95,33 @@ export default {
},
// 监听文件上传成功
onSuccess(response, file, fileList){
console.log(response)
this.uploadResult = response.data;
onSuccess(response, file, fileList) {
console.log(response);
broadcast("cancel-loading");
this.uploadResult = response.data;
},
// 上传文档
saveInfo() {
let o = this.uploadFile;
if (!o || !o.name) {
showToast({
message: "请选择文件",
});
console.log('7777777777777')
broadcast("cancel-loading");
return false;
}
this.$refs.uploadBox.submit();
},
// 下载模板
downTemplate() {
DOWNLOAD_ASSIGNPERMIT_TEMPLATE_FILE().then((res) => {
let { data } = res;
window.open(data.dictValue);
});
},
},
};
</script>
......
......@@ -87,6 +87,7 @@ import { getSimpleList, getTreeOrg } from "services/orginizaManage";
import GlsxDialog from "@/components/dialog";
import AssignInfo from "./assign.vue";
import AuthLink from "@/components/auth-button/link";
import {received} from '@/utils/util'
export default {
components: {
GlsxDialog,
......@@ -325,7 +326,12 @@ export default {
},
},
mounted() {
this.$on("assign-success", this.closeDialog);
let _this = this;
received("assign-success", this.closeDialog);
received("cancel-loading", function () {
console.log('进入此处')
_this.loading = false;
});
this.init();
},
methods: {
......@@ -692,7 +698,7 @@ export default {
// 保存数据
saveInfo() {
//this.loading = true;
this.loading = true;
this.$refs.assignInfo.saveInfo();
},
},
......
......@@ -81,7 +81,7 @@ import {
SAVE_USER_ASSIGN_INFO,
GET_USER_ASSIGN_INFO,
} from "@/services/user";
import { deepClone, showToast } from "@/utils/util";
import { deepClone, showToast,broadcast } from "@/utils/util";
export default {
name: "SelectInfo",
props: {
......@@ -340,13 +340,13 @@ export default {
// 保存数据
saveInfo() {
console.log(this.id);
let list = this.checkList;
let arr = [];
if (!list || list.length <= 0) {
showToast({
message: "请选择数据",
});
this.$emit('cancel-loading')
return false;
}
......@@ -358,13 +358,16 @@ export default {
oParams.receiverId = this.id;
oParams.vehicleIds = arr;
SAVE_USER_ASSIGN_INFO(oParams).then((res) => {
broadcast('cancel-loading')
if (res.code == 200) {
showToast({
message: "保存成功",
type: "success",
});
this.$emit("assign-success");
broadcast("assign-success");
}
}).catch(error => {
broadcast('cancel-loading')
});
},
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!