|
@@ -32,7 +32,7 @@
|
|
|
<el-button
|
|
<el-button
|
|
|
v-if="!expiredTimeEditable"
|
|
v-if="!expiredTimeEditable"
|
|
|
@click="editExpiredTime"
|
|
@click="editExpiredTime"
|
|
|
- size="mini"
|
|
|
|
|
|
|
+ size="small"
|
|
|
type="primary"
|
|
type="primary"
|
|
|
>
|
|
>
|
|
|
修改
|
|
修改
|
|
@@ -40,7 +40,7 @@
|
|
|
<el-button
|
|
<el-button
|
|
|
v-if="expiredTimeEditable"
|
|
v-if="expiredTimeEditable"
|
|
|
@click="submitExpiredTime"
|
|
@click="submitExpiredTime"
|
|
|
- size="mini"
|
|
|
|
|
|
|
+ size="small"
|
|
|
type="primary"
|
|
type="primary"
|
|
|
>
|
|
>
|
|
|
提交
|
|
提交
|
|
@@ -48,7 +48,7 @@
|
|
|
<el-button
|
|
<el-button
|
|
|
v-if="expiredTimeEditable"
|
|
v-if="expiredTimeEditable"
|
|
|
@click="cancelExpiredTime"
|
|
@click="cancelExpiredTime"
|
|
|
- size="mini"
|
|
|
|
|
|
|
+ size="small"
|
|
|
>
|
|
>
|
|
|
取消
|
|
取消
|
|
|
</el-button>
|
|
</el-button>
|
|
@@ -67,11 +67,11 @@
|
|
|
></el-input>
|
|
></el-input>
|
|
|
<div class="seach-btn" @click="getCargoOwnerAccountList(1)">查询</div>
|
|
<div class="seach-btn" @click="getCargoOwnerAccountList(1)">查询</div>
|
|
|
</div>
|
|
</div>
|
|
|
- <div class="cargo-owner-add" @click="dialogFormVisible = true">
|
|
|
|
|
|
|
+ <el-button type="primary" @click="dialogFormVisible = true">
|
|
|
添加账号
|
|
添加账号
|
|
|
- </div>
|
|
|
|
|
|
|
+ </el-button>
|
|
|
<el-dialog
|
|
<el-dialog
|
|
|
- title="添加账号"
|
|
|
|
|
|
|
+ :title="ruleForm.id ? '编辑账号' : '添加账号'"
|
|
|
v-model="dialogFormVisible"
|
|
v-model="dialogFormVisible"
|
|
|
@closed="resetForm"
|
|
@closed="resetForm"
|
|
|
>
|
|
>
|
|
@@ -79,7 +79,7 @@
|
|
|
<el-form
|
|
<el-form
|
|
|
:model="ruleForm"
|
|
:model="ruleForm"
|
|
|
:rules="rules"
|
|
:rules="rules"
|
|
|
- ref="form"
|
|
|
|
|
|
|
+ ref="ruleFormRef"
|
|
|
label-width="110px"
|
|
label-width="110px"
|
|
|
label-position="left"
|
|
label-position="left"
|
|
|
>
|
|
>
|
|
@@ -96,9 +96,16 @@
|
|
|
<el-input
|
|
<el-input
|
|
|
style="width: 280px"
|
|
style="width: 280px"
|
|
|
v-model="ruleForm.phone"
|
|
v-model="ruleForm.phone"
|
|
|
|
|
+ :disabled="!!ruleForm.id"
|
|
|
|
|
+ ></el-input>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item prop="email" label="邮箱">
|
|
|
|
|
+ <el-input
|
|
|
|
|
+ style="width: 280px"
|
|
|
|
|
+ v-model="ruleForm.email"
|
|
|
></el-input>
|
|
></el-input>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
- <el-form-item prop="password" label="密码">
|
|
|
|
|
|
|
+ <el-form-item v-if="!ruleForm.id" prop="password" label="密码">
|
|
|
<el-input
|
|
<el-input
|
|
|
style="width: 280px"
|
|
style="width: 280px"
|
|
|
v-model="ruleForm.password"
|
|
v-model="ruleForm.password"
|
|
@@ -122,10 +129,21 @@
|
|
|
</template>
|
|
</template>
|
|
|
<template v-slot:footer>
|
|
<template v-slot:footer>
|
|
|
<div class="dialog-footer">
|
|
<div class="dialog-footer">
|
|
|
- <el-button @click="resetForm">取 消</el-button>
|
|
|
|
|
- <el-button type="primary" @click="addCargoOwnerAccount(ruleForm)">
|
|
|
|
|
|
|
+ <el-button @click="resetForm">取消</el-button>
|
|
|
|
|
+ <el-button
|
|
|
|
|
+ v-if="!ruleForm.id"
|
|
|
|
|
+ type="primary"
|
|
|
|
|
+ @click="addCargoOwnerAccount('add')"
|
|
|
|
|
+ >
|
|
|
确认添加
|
|
确认添加
|
|
|
</el-button>
|
|
</el-button>
|
|
|
|
|
+ <el-button
|
|
|
|
|
+ v-else
|
|
|
|
|
+ type="primary"
|
|
|
|
|
+ @click="editCargoOwnerAccount('update')"
|
|
|
|
|
+ >
|
|
|
|
|
+ 确认修改
|
|
|
|
|
+ </el-button>
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
</el-dialog>
|
|
</el-dialog>
|
|
@@ -151,8 +169,8 @@
|
|
|
align="center"
|
|
align="center"
|
|
|
></el-table-column>
|
|
></el-table-column>
|
|
|
<el-table-column
|
|
<el-table-column
|
|
|
- prop="password"
|
|
|
|
|
- label="密码"
|
|
|
|
|
|
|
+ prop="email"
|
|
|
|
|
+ label="邮箱"
|
|
|
min-width="160"
|
|
min-width="160"
|
|
|
align="center"
|
|
align="center"
|
|
|
></el-table-column>
|
|
></el-table-column>
|
|
@@ -176,6 +194,13 @@
|
|
|
{{ scope.row.roleName || "暂无职位" }}
|
|
{{ scope.row.roleName || "暂无职位" }}
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
|
|
+ <el-table-column label="操作" min-width="160" align="center">
|
|
|
|
|
+ <template v-slot="scope">
|
|
|
|
|
+ <el-button type="primary" size="small" @click="showEdit(scope.row)">
|
|
|
|
|
+ 编辑
|
|
|
|
|
+ </el-button>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
</el-table>
|
|
</el-table>
|
|
|
<div style="width: 100%; text-align: right; margin-top: 43px">
|
|
<div style="width: 100%; text-align: right; margin-top: 43px">
|
|
|
<el-pagination
|
|
<el-pagination
|
|
@@ -203,9 +228,9 @@
|
|
|
查询
|
|
查询
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
- <div class="cargo-owner-add" @click="dialogFormVisible2 = true">
|
|
|
|
|
|
|
+ <el-button type="primary" @click="dialogFormVisible2 = true">
|
|
|
关联代理公司
|
|
关联代理公司
|
|
|
- </div>
|
|
|
|
|
|
|
+ </el-button>
|
|
|
<el-dialog
|
|
<el-dialog
|
|
|
title="关联代理公司"
|
|
title="关联代理公司"
|
|
|
v-model="dialogFormVisible2"
|
|
v-model="dialogFormVisible2"
|
|
@@ -310,7 +335,7 @@ let term = ref("");
|
|
|
let currentPage = ref(1);
|
|
let currentPage = ref(1);
|
|
|
let total = ref(0);
|
|
let total = ref(0);
|
|
|
let dialogFormVisible = ref(false);
|
|
let dialogFormVisible = ref(false);
|
|
|
-let form = ref(null);
|
|
|
|
|
|
|
+let ruleFormRef = ref(null);
|
|
|
|
|
|
|
|
async function getCargoOwnerAccountList(page) {
|
|
async function getCargoOwnerAccountList(page) {
|
|
|
currentPage.value = page || currentPage.value;
|
|
currentPage.value = page || currentPage.value;
|
|
@@ -332,6 +357,7 @@ async function getCargoOwnerAccountList(page) {
|
|
|
const ruleForm = ref({
|
|
const ruleForm = ref({
|
|
|
userName: "",
|
|
userName: "",
|
|
|
phone: "",
|
|
phone: "",
|
|
|
|
|
+ email: "",
|
|
|
password: "",
|
|
password: "",
|
|
|
cargo: "",
|
|
cargo: "",
|
|
|
});
|
|
});
|
|
@@ -341,6 +367,7 @@ const rules = ref({
|
|
|
{ required: true, message: "请填写手机号", trigger: "blur" },
|
|
{ required: true, message: "请填写手机号", trigger: "blur" },
|
|
|
{ min: 11, max: 11, message: "请正确填写手机号", trigger: "blur" },
|
|
{ min: 11, max: 11, message: "请正确填写手机号", trigger: "blur" },
|
|
|
],
|
|
],
|
|
|
|
|
+ email: [{ required: true, message: "请填写邮箱", trigger: "blur" }],
|
|
|
password: [{ required: false, message: "请填写密码", trigger: "blur" }],
|
|
password: [{ required: false, message: "请填写密码", trigger: "blur" }],
|
|
|
cargo: [{ required: true, message: "请选择货种", trigger: "blur" }],
|
|
cargo: [{ required: true, message: "请选择货种", trigger: "blur" }],
|
|
|
});
|
|
});
|
|
@@ -357,7 +384,7 @@ async function getCargoList() {
|
|
|
function resetForm() {
|
|
function resetForm() {
|
|
|
dialogFormVisible.value = false;
|
|
dialogFormVisible.value = false;
|
|
|
|
|
|
|
|
- form.value.resetFields();
|
|
|
|
|
|
|
+ ruleForm.value = {};
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function pageChange(e) {
|
|
function pageChange(e) {
|
|
@@ -366,18 +393,23 @@ function pageChange(e) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
async function addCargoOwnerAccount() {
|
|
async function addCargoOwnerAccount() {
|
|
|
- form.value.validate(async (valid) => {
|
|
|
|
|
|
|
+ ruleFormRef.value.validate(async (valid) => {
|
|
|
if (valid) {
|
|
if (valid) {
|
|
|
- let { userName, phone, password, cargo } = ruleForm.value;
|
|
|
|
|
-
|
|
|
|
|
|
|
+ let { userName, phone, email, password, cargo } = ruleForm.value;
|
|
|
|
|
+ const loading = ElLoading.service({
|
|
|
|
|
+ lock: true,
|
|
|
|
|
+ text: "正在提交...",
|
|
|
|
|
+ background: "rgba(0, 0, 0, 0.7)",
|
|
|
|
|
+ });
|
|
|
let res = await api.addCargoOwnerAccount({
|
|
let res = await api.addCargoOwnerAccount({
|
|
|
cargoOwnerId: route.query.id,
|
|
cargoOwnerId: route.query.id,
|
|
|
userName,
|
|
userName,
|
|
|
phone,
|
|
phone,
|
|
|
|
|
+ email,
|
|
|
password,
|
|
password,
|
|
|
cargo,
|
|
cargo,
|
|
|
});
|
|
});
|
|
|
- console.log(res);
|
|
|
|
|
|
|
+ loading.close();
|
|
|
if (res.data.status == 0) {
|
|
if (res.data.status == 0) {
|
|
|
ElNotification.success({
|
|
ElNotification.success({
|
|
|
title: "添加成功",
|
|
title: "添加成功",
|
|
@@ -399,6 +431,43 @@ async function addCargoOwnerAccount() {
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
+async function editCargoOwnerAccount() {
|
|
|
|
|
+ ruleFormRef.value.validate(async (valid) => {
|
|
|
|
|
+ if (valid) {
|
|
|
|
|
+ let { id: cargoOwnerLoginAccountId, userName, email } = ruleForm.value;
|
|
|
|
|
+ const loading = ElLoading.service({
|
|
|
|
|
+ lock: true,
|
|
|
|
|
+ text: "正在提交...",
|
|
|
|
|
+ background: "rgba(0, 0, 0, 0.7)",
|
|
|
|
|
+ });
|
|
|
|
|
+ let res = await api.editCargoOwnerAccount({
|
|
|
|
|
+ cargoOwnerId: route.query.id,
|
|
|
|
|
+ cargoOwnerLoginAccountId,
|
|
|
|
|
+ userName,
|
|
|
|
|
+ email,
|
|
|
|
|
+ });
|
|
|
|
|
+ loading.close();
|
|
|
|
|
+ if (res.data.status == 0) {
|
|
|
|
|
+ ElNotification.success({
|
|
|
|
|
+ title: "修改成功",
|
|
|
|
|
+ duration: 2000,
|
|
|
|
|
+ message: `${userName}:${res.data.msg}`,
|
|
|
|
|
+ type: "success",
|
|
|
|
|
+ });
|
|
|
|
|
+ resetForm();
|
|
|
|
|
+ getCargoOwnerAccountList();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ ElNotification.error({
|
|
|
|
|
+ title: "失败",
|
|
|
|
|
+ duration: 3000,
|
|
|
|
|
+ message: res.data.msg,
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
let tableData2 = ref([]);
|
|
let tableData2 = ref([]);
|
|
|
let term2 = ref("");
|
|
let term2 = ref("");
|
|
@@ -501,6 +570,14 @@ function cancelExpiredTime() {
|
|
|
expiredTimeEditable.value = false;
|
|
expiredTimeEditable.value = false;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+function showEdit(row) {
|
|
|
|
|
+ console.log(row);
|
|
|
|
|
+ dialogFormVisible.value = true;
|
|
|
|
|
+ ruleForm.value = {
|
|
|
|
|
+ ...row,
|
|
|
|
|
+ };
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
|
getCargoOwnerCompanyDetail();
|
|
getCargoOwnerCompanyDetail();
|
|
|
getCargoOwnerAccountList();
|
|
getCargoOwnerAccountList();
|