|
@@ -16,7 +16,7 @@
|
|
|
<i
|
|
|
class="el-icon-s-platform"
|
|
|
style="font-size: 24px; line-height: 50px"
|
|
|
- @click="toEngine"
|
|
|
+ @click="openEngineAccount"
|
|
|
></i>
|
|
|
</el-tooltip>
|
|
|
</div>
|
|
@@ -60,33 +60,47 @@
|
|
|
title="绑定工程机系统"
|
|
|
:visible.sync="dialogFormVisible"
|
|
|
:modal="false"
|
|
|
- width="30%"
|
|
|
+ width="60%"
|
|
|
>
|
|
|
- <el-form ref="engineForm" :model="engineForm" :rules="engineFormRules">
|
|
|
- <el-form-item label="账号" :label-width="formLabelWidth" prop="account">
|
|
|
- <el-input
|
|
|
- v-model="engineForm.account"
|
|
|
- placeholder="请输入账号"
|
|
|
- autocomplete="off"
|
|
|
- ></el-input>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item
|
|
|
- label="密码"
|
|
|
- :label-width="formLabelWidth"
|
|
|
- prop="password"
|
|
|
- >
|
|
|
- <el-input
|
|
|
- v-model="engineForm.password"
|
|
|
- placeholder="请输入密码"
|
|
|
- autocomplete="off"
|
|
|
- show-password
|
|
|
- ></el-input>
|
|
|
- </el-form-item>
|
|
|
- <input type="hidden" value="zfire" name="vcode" />
|
|
|
+ <el-form ref="engineForm" :model="engineForm">
|
|
|
+ <el-row v-for="(row, index) in engineForm.engineList" :key="row.id" :gutter="20">
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item
|
|
|
+ :label="'账号' + (index+1)"
|
|
|
+ :label-width="formLabelWidth"
|
|
|
+ :prop="'engineList.' + index + '.enginUserName'"
|
|
|
+ :rules="{required: true, message: '请输入工程机账号', trigger: 'blur'}"
|
|
|
+ >
|
|
|
+ <el-input v-model="row.enginUserName" placeholder="请输入账号" autocomplete="off"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item
|
|
|
+ :label="'密码' + (index+1)"
|
|
|
+ :label-width="formLabelWidth"
|
|
|
+ :prop="'engineList.' + index + '.enginPassword'"
|
|
|
+ :rules="{required: true, message: '请输入工程机密码', trigger: 'blur'}"
|
|
|
+ >
|
|
|
+ <el-input v-model="row.enginPassword" placeholder="请输入密码" autocomplete="off" show-password></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <template v-if="row.adminUserId">
|
|
|
+ <el-button @click="submitForm(index)">重验</el-button>
|
|
|
+ </template>
|
|
|
+ <template v-else>
|
|
|
+ <el-button @click="submitForm(index)">验证</el-button>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <el-button v-if="row.adminUserId" @click="toEngine(index)">打开</el-button>
|
|
|
+ <el-button @click="delAccountForm(index)">删除</el-button>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
</el-form>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
+ <el-button @click="addRowEngine">新增账号</el-button>
|
|
|
<el-button @click="dialogFormVisible = false">取 消</el-button>
|
|
|
- <el-button type="primary" @click="submitForm">确 定</el-button>
|
|
|
+<!-- <el-button type="primary" @click="submitForm">确 定</el-button>-->
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
<!-- <form v-show="false" :action="userInfo.enginSysUrl" method="POST">-->
|
|
@@ -106,7 +120,7 @@ import Hamburger from "@/components/Hamburger";
|
|
|
import Screenfull from "@/components/Screenfull";
|
|
|
import NavMenu from "@/components/NavMenu";
|
|
|
import { getNoticeListCount } from "@/api/notice";
|
|
|
-import { checkEngineAccount, bindEngineAccount } from "@/api/setting";
|
|
|
+import {checkEngineAccount, bindEngineAccount, delEngineAccount} from "@/api/setting";
|
|
|
import request from "@/utils/request";
|
|
|
|
|
|
export default {
|
|
@@ -117,19 +131,18 @@ export default {
|
|
|
noticeCount: 0,
|
|
|
userInfo: "",
|
|
|
engineForm: {
|
|
|
- account: "",
|
|
|
- password: "",
|
|
|
- },
|
|
|
- engineFormRules: {
|
|
|
- account: [
|
|
|
- { required: true, message: "请输入工程机账号", trigger: "blur" },
|
|
|
- ],
|
|
|
- password: [
|
|
|
- { required: true, message: "请输入工程机密码", trigger: "blur" },
|
|
|
- ],
|
|
|
+ engineList: []
|
|
|
},
|
|
|
+ // engineFormRules: {
|
|
|
+ // account: [
|
|
|
+ // { required: true, message: "请输入工程机账号", trigger: "blur" },
|
|
|
+ // ],
|
|
|
+ // password: [
|
|
|
+ // { required: true, message: "请输入工程机密码", trigger: "blur" },
|
|
|
+ // ],
|
|
|
+ // },
|
|
|
formLabelWidth: "100px",
|
|
|
- dialogFormVisible: false,
|
|
|
+ dialogFormVisible: false
|
|
|
};
|
|
|
},
|
|
|
mounted() {
|
|
@@ -202,42 +215,59 @@ export default {
|
|
|
goNotice() {
|
|
|
this.$router.push("/notice/index");
|
|
|
},
|
|
|
- toEngine() {
|
|
|
- const userInfoCopy = this.userInfo;
|
|
|
- if (userInfoCopy && userInfoCopy.bindEngin) {
|
|
|
- checkEngineAccount().then((res) => {
|
|
|
- if (res.code === 200) {
|
|
|
+ openEngineAccount() {
|
|
|
+ this.engineForm.engineList = this.userInfo.bindEnginList
|
|
|
+ this.dialogFormVisible = true;
|
|
|
+ },
|
|
|
+ toEngine(index) {
|
|
|
+ // const userInfoCopy = this.userInfo;
|
|
|
+ // if (userInfoCopy && userInfoCopy.bindEngin) {
|
|
|
+ // checkEngineAccount().then((res) => {
|
|
|
+ // if (res.code === 200) {
|
|
|
// this.$refs.engineSubmit.click()
|
|
|
const { href } = this.$router.resolve({
|
|
|
name: "open_engin",
|
|
|
+ query: {
|
|
|
+ index: index
|
|
|
+ }
|
|
|
});
|
|
|
window.open(href, "_blank");
|
|
|
- } else {
|
|
|
- this.$errorMsg("账号密码错误,请重新绑定");
|
|
|
- this.dialogFormVisible = true;
|
|
|
- }
|
|
|
- });
|
|
|
- } else {
|
|
|
- this.dialogFormVisible = true;
|
|
|
- }
|
|
|
+ // } else {
|
|
|
+ // this.$errorMsg("账号密码错误,请重新绑定");
|
|
|
+ // this.dialogFormVisible = true;
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ // } else {
|
|
|
+ // this.dialogFormVisible = true;
|
|
|
+ // }
|
|
|
},
|
|
|
- submitForm() {
|
|
|
+ addRowEngine() {
|
|
|
+ this.engineForm.engineList.push({
|
|
|
+ adminUserId: '',
|
|
|
+ enginPassword: '',
|
|
|
+ enginUserName: '',
|
|
|
+ status: '',
|
|
|
+ })
|
|
|
+ },
|
|
|
+ submitForm(index) {
|
|
|
this.$refs.engineForm.validate((valid) => {
|
|
|
if (valid) {
|
|
|
const params = {
|
|
|
- enginUserName: this.engineForm.account,
|
|
|
- enginPassword: this.engineForm.password,
|
|
|
+ enginUserName: this.engineForm.engineList[index].enginUserName,
|
|
|
+ enginPassword: this.engineForm.engineList[index].enginPassword,
|
|
|
+ isReset: this.engineForm.engineList[index].adminUserId !== ''
|
|
|
};
|
|
|
bindEngineAccount(params).then((res) => {
|
|
|
if (res.code === 200) {
|
|
|
- this.$successMsg("绑定成功,正在打开工程机系统");
|
|
|
- this.dialogFormVisible = false;
|
|
|
+ this.$successMsg("绑定成功,工程机系统");
|
|
|
+ // this.dialogFormVisible = false;
|
|
|
this.$store.dispatch("user/getInfo").then(() => {
|
|
|
this.userInfo = JSON.parse(localStorage.getItem("supply_user"));
|
|
|
- const { href } = this.$router.resolve({
|
|
|
- name: "open_engin",
|
|
|
- });
|
|
|
- window.open(href, "_blank");
|
|
|
+ this.engineForm.engineList = this.userInfo.bindEnginList
|
|
|
+ // const { href } = this.$router.resolve({
|
|
|
+ // name: "open_engin",
|
|
|
+ // });
|
|
|
+ // window.open(href, "_blank");
|
|
|
// this.userInfo.enginUserName = this.engineForm.account
|
|
|
// this.userInfo.enginPassword = this.engineForm.password
|
|
|
// this.$refs.engineSubmit.click()
|
|
@@ -249,6 +279,27 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
+ delAccountForm(index) {
|
|
|
+ if (this.engineForm.engineList[index].id) {
|
|
|
+ this.$confirm('此操作将删除账号, 是否继续?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning',
|
|
|
+ center: true
|
|
|
+ }).then(() => {
|
|
|
+ delEngineAccount({id: this.engineForm.engineList[index].id}).then(() => {
|
|
|
+ this.$store.dispatch("user/getInfo").then(() => {
|
|
|
+ this.userInfo = JSON.parse(localStorage.getItem("supply_user"));
|
|
|
+ this.engineForm.engineList = this.userInfo.bindEnginList
|
|
|
+ });
|
|
|
+ this.$successMsg("删除成功");
|
|
|
+ })
|
|
|
+ }).catch(() => {
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.engineForm.engineList.splice(index, 1)
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
};
|
|
|
</script>
|