pull/1/head
xiaozhiyong 2 years ago
parent e4b34f6d63
commit 81c21b48f6
  1. 8
      src/api/login.js
  2. 49
      src/views/login/index.vue

@ -3,16 +3,10 @@ import request from "utils/axios.js";
const login = (params) => { const login = (params) => {
return request.postJson("/oil-identity/oilRefinery/loginOMSByPwd", params); return request.postJson("/oil-identity/oilRefinery/loginOMSByPwd", params);
}; };
//关联企业
const getRefineryByCustomerId = (phone) => {
return request.get(
`/oil-user/oilCustomerRefineryRelation/getRefineryByCustomerId/${phone}`
);
};
//路由 //路由
const getCustomerRouters = () => { const getCustomerRouters = () => {
return request.get( return request.get(
"/oil-identity/oilRefinery/getCustomerRouters/REFINERY_OMS_WEB" "/oil-identity/oilRefinery/getCustomerRouters/REFINERY_OMS_WEB"
); );
}; };
export default { login, getRefineryByCustomerId, getCustomerRouters }; export default { login, getCustomerRouters };

@ -62,38 +62,6 @@
<span> password: any</span> <span> password: any</span>
</div> </div>
</el-form> </el-form>
<el-dialog
:visible.sync="companySelectDialog"
:close-on-click-modal="false"
:close-on-press-escape="false"
width="500px"
title="请选择登录企业"
>
<el-table :data="companyList">
<el-table-column property="companyName" label="公司名称" width="200" />
<el-table-column property="parentMark" label="公司性质">
<template slot-scope="{ row }">
<el-tag v-if="row.parentMark === 0" effect="dark" size="normal"
>主体公司</el-tag
>
<el-tag v-else effect="dark" type="info" size="normal"
>分公司</el-tag
>
</template>
</el-table-column>
<el-table-column property="name" label="操作">
<template slot-scope="scope">
<el-button
type="text"
size="small"
@click="loginAgain(scope.row.companyId)"
>登录</el-button
>
</template>
</el-table-column>
</el-table>
</el-dialog>
</div> </div>
</template> </template>
@ -113,8 +81,6 @@ export default {
loading: false, loading: false,
passwordType: "", passwordType: "",
companyList: [], companyList: [],
companySelectDialog: false,
loginForm: { loginForm: {
username: "", username: "",
password: "", password: "",
@ -140,6 +106,8 @@ export default {
}); });
}, },
handleLogin() { handleLogin() {
this.$refs["loginForm"].validate((valid) => {
if (valid) {
this.loading = true; this.loading = true;
let { username, password, networkId } = this.loginForm; let { username, password, networkId } = this.loginForm;
serve serve
@ -149,21 +117,16 @@ export default {
networkId, networkId,
}) })
.then((res) => { .then((res) => {
if (res && res.code === 42014) { if (res.data.accessToken) {
serve
.getRefineryByCustomerId(this.loginForm.username)
.then((res) => {
this.companyList = res.data;
this.companySelectDialog = true;
return;
});
}
localStorage.setItem("token", res.data.accessToken); localStorage.setItem("token", res.data.accessToken);
this.$router.replace("/"); this.$router.replace("/");
}
}) })
.catch(() => { .catch(() => {
this.loading = false; this.loading = false;
}); });
}
});
}, },
}, },
}; };

Loading…
Cancel
Save