Commit 6ef9d21b by 张杰

v1.5.0版本需求

1 parent 0eb3ab25
...@@ -73,6 +73,10 @@ export const GET_USER_ASSIGN_INFO = params => { ...@@ -73,6 +73,10 @@ export const GET_USER_ASSIGN_INFO = params => {
// 用户管理-指定数据-文件导入接口 // 用户管理-指定数据-文件导入接口
export const IMPORT_VEHICLE_TEMPLATE = '/trialdrive/vehicle/permit/import' 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} export { getUserList, getSuperUser, addUser, editUser, detailUser, deleteUser, roleList, dictInfo, resetPassword}
import Vue from 'vue' import Vue from 'vue'
const EventBus = new Vue()
import { Message, MessageBox, Loading } from 'element-ui' import { Message, MessageBox, Loading } from 'element-ui'
import moment from 'moment' import moment from 'moment'
let loadingInstance = '' let loadingInstance = ''
...@@ -241,9 +241,25 @@ export const Util = { ...@@ -241,9 +241,25 @@ export const Util = {
} }
throw new Error("Unable to clone obj! Its type isn't supported.") 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 showModal = Util.msg
export const showToast = Util.Info export const showToast = Util.Info
export const showLoading = Util.loading export const showLoading = Util.loading
export const hideLoading = Util.closeLoading export const hideLoading = Util.closeLoading
export const deepClone = Util.deepClone export const deepClone = Util.deepClone
export const broadcast = Util.broadcast
export const received = Util.received
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
</el-upload> </el-upload>
<!-- 隐藏上传文件按钮 end --> <!-- 隐藏上传文件按钮 end -->
</div> </div>
<el-link type="primary" class="el_link">下载模版</el-link> <el-link type="primary" class="el_link" @click="downTemplate">下载模版</el-link>
</div> </div>
<!-- <div class="btn_group"> <!-- <div class="btn_group">
...@@ -44,7 +44,11 @@ ...@@ -44,7 +44,11 @@
</div> </div>
</template> </template>
<script> <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 { export default {
name: "ImportVehicle", name: "ImportVehicle",
props: { props: {
...@@ -91,15 +95,33 @@ export default { ...@@ -91,15 +95,33 @@ export default {
}, },
// 监听文件上传成功 // 监听文件上传成功
onSuccess(response, file, fileList){ onSuccess(response, file, fileList) {
console.log(response) console.log(response);
this.uploadResult = response.data; broadcast("cancel-loading");
this.uploadResult = response.data;
}, },
// 上传文档 // 上传文档
saveInfo() { saveInfo() {
let o = this.uploadFile;
if (!o || !o.name) {
showToast({
message: "请选择文件",
});
console.log('7777777777777')
broadcast("cancel-loading");
return false;
}
this.$refs.uploadBox.submit(); this.$refs.uploadBox.submit();
}, },
// 下载模板
downTemplate() {
DOWNLOAD_ASSIGNPERMIT_TEMPLATE_FILE().then((res) => {
let { data } = res;
window.open(data.dictValue);
});
},
}, },
}; };
</script> </script>
......
...@@ -87,6 +87,7 @@ import { getSimpleList, getTreeOrg } from "services/orginizaManage"; ...@@ -87,6 +87,7 @@ import { getSimpleList, getTreeOrg } from "services/orginizaManage";
import GlsxDialog from "@/components/dialog"; import GlsxDialog from "@/components/dialog";
import AssignInfo from "./assign.vue"; import AssignInfo from "./assign.vue";
import AuthLink from "@/components/auth-button/link"; import AuthLink from "@/components/auth-button/link";
import {received} from '@/utils/util'
export default { export default {
components: { components: {
GlsxDialog, GlsxDialog,
...@@ -325,7 +326,12 @@ export default { ...@@ -325,7 +326,12 @@ export default {
}, },
}, },
mounted() { 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(); this.init();
}, },
methods: { methods: {
...@@ -692,7 +698,7 @@ export default { ...@@ -692,7 +698,7 @@ export default {
// 保存数据 // 保存数据
saveInfo() { saveInfo() {
//this.loading = true; this.loading = true;
this.$refs.assignInfo.saveInfo(); this.$refs.assignInfo.saveInfo();
}, },
}, },
......
...@@ -81,7 +81,7 @@ import { ...@@ -81,7 +81,7 @@ import {
SAVE_USER_ASSIGN_INFO, SAVE_USER_ASSIGN_INFO,
GET_USER_ASSIGN_INFO, GET_USER_ASSIGN_INFO,
} from "@/services/user"; } from "@/services/user";
import { deepClone, showToast } from "@/utils/util"; import { deepClone, showToast,broadcast } from "@/utils/util";
export default { export default {
name: "SelectInfo", name: "SelectInfo",
props: { props: {
...@@ -340,13 +340,13 @@ export default { ...@@ -340,13 +340,13 @@ export default {
// 保存数据 // 保存数据
saveInfo() { saveInfo() {
console.log(this.id);
let list = this.checkList; let list = this.checkList;
let arr = []; let arr = [];
if (!list || list.length <= 0) { if (!list || list.length <= 0) {
showToast({ showToast({
message: "请选择数据", message: "请选择数据",
}); });
this.$emit('cancel-loading')
return false; return false;
} }
...@@ -358,13 +358,16 @@ export default { ...@@ -358,13 +358,16 @@ export default {
oParams.receiverId = this.id; oParams.receiverId = this.id;
oParams.vehicleIds = arr; oParams.vehicleIds = arr;
SAVE_USER_ASSIGN_INFO(oParams).then((res) => { SAVE_USER_ASSIGN_INFO(oParams).then((res) => {
broadcast('cancel-loading')
if (res.code == 200) { if (res.code == 200) {
showToast({ showToast({
message: "保存成功", message: "保存成功",
type: "success", 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!