5 changed files with 1085 additions and 1892 deletions
@ -1,310 +1,268 @@ |
|||||
<template> |
<template> |
||||
<div class="worker-edit"> |
<div class="worker-edit"> |
||||
<!-- Drawer抽屉 --> |
<!-- Drawer抽屉 --> |
||||
<Drawer |
<Drawer :title="title" v-model="visible" width="720" draggable :mask-closable="type == '0'"> |
||||
:title="title" |
<div :style="{ maxHeight: maxHeight }" class="drawer-content"> |
||||
v-model="visible" |
<div class="drawer-header"> |
||||
width="720" |
<div style="margin-right: 16px">基本信息</div> |
||||
draggable |
</div> |
||||
:mask-closable="type == '0'" |
<Form label-colon v-show="type != '2'"> |
||||
> |
<Row :gutter="32"> |
||||
<div :style="{ maxHeight: maxHeight }" class="drawer-content"> |
<Col span="12"> |
||||
<div class="drawer-header"> |
<FormItem label="配送员ID"> |
||||
<div style="margin-right: 16px">基本信息</div> |
{{ form.workerId }} |
||||
</div> |
<Tooltip trigger="hover" placement="right" content="账户已禁用"> |
||||
<Form label-colon v-show="type != '2'"> |
<Icon v-show="form.workerStatus == 3" type="md-lock" size="18" |
||||
<Row :gutter="32"> |
style="margin-left: 10px; cursor: pointer" /> |
||||
<Col span="12"> |
</Tooltip> |
||||
<FormItem label="快递员ID"> |
</FormItem> |
||||
{{ form.workerId }} |
</Col> |
||||
<Tooltip trigger="hover" placement="right" content="账户已禁用"> |
<Col span="12"> |
||||
<Icon |
<FormItem label="配送员状态"> |
||||
v-show="form.workerStatus == 3" |
{{ this.statusName }} |
||||
type="md-lock" |
<Icon v-show="form.workerStatus" type="md-key" :color="passColor" size="18" |
||||
size="18" |
style="margin-left: 10px; cursor: pointer" /> |
||||
style="margin-left: 10px; cursor: pointer" |
</FormItem> |
||||
/> |
</Col> |
||||
</Tooltip> |
</Row> |
||||
</FormItem> |
</Form> |
||||
</Col> |
<Form ref="form" :model="form" :rules="formValidate" label-position="top"> |
||||
<Col span="12"> |
<Row :gutter="32"> |
||||
<FormItem label="快递员状态"> |
<Col span="12"> |
||||
{{ this.statusName }} |
<FormItem label="登录账号" prop="username"> |
||||
<Icon |
<Input v-model="form.username" /> |
||||
v-show="form.workerStatus" |
</FormItem> |
||||
type="md-key" |
</Col> |
||||
:color="passColor" |
<Col span="12"> |
||||
size="18" |
<FormItem label="登录密码" prop="password"> |
||||
style="margin-left: 10px; cursor: pointer" |
<SetPassword v-model="form.password" @on-change="changePass" /> |
||||
/> |
</FormItem> |
||||
</FormItem> |
</Col> |
||||
</Col> |
</Row> |
||||
</Row> |
<Row :gutter="32"> |
||||
</Form> |
<Col span="12"> |
||||
<Form |
<FormItem label="配送员名称" prop="workerName"> |
||||
ref="form" |
<Input v-model="form.workerName" /> |
||||
:model="form" |
</FormItem> |
||||
:rules="formValidate" |
</Col> |
||||
label-position="top" |
<Col span="12"> |
||||
> |
<FormItem label="所属学校" prop="region"> |
||||
<Row :gutter="32"> |
<Input v-model="form.regionTitle" disabled /> |
||||
<Col span="12"> |
</FormItem> |
||||
<FormItem label="登录账号" prop="username"> |
</Col> |
||||
<Input v-model="form.username" /> |
</Row> |
||||
</FormItem> |
<Row :gutter="32"> |
||||
</Col> |
<Col span="12"> |
||||
<Col span="12"> |
<FormItem label="佣金余额" prop="depoBal"> |
||||
<FormItem label="登录密码" prop="password"> |
<Input v-model="form.depoBal" /> |
||||
<SetPassword v-model="form.password" @on-change="changePass" /> |
</FormItem> |
||||
</FormItem> |
</Col> |
||||
</Col> |
<Col span="12"> |
||||
</Row> |
<FormItem label="交易保障金" prop="rebateAmount"> |
||||
<Row :gutter="32"> |
<Input v-model="form.rebateAmount" :disabled="true" /> |
||||
<Col span="12"> |
</FormItem> |
||||
<FormItem label="快递员名称" prop="workerName"> |
</Col> |
||||
<Input v-model="form.workerName" /> |
</Row> |
||||
</FormItem> |
<Row :gutter="32"> |
||||
</Col> |
<Col span="12"> |
||||
<Col span="12"> |
<FormItem label="电话" prop="mobile"> |
||||
<FormItem label="归属商圈" prop="region"> |
<Input v-model="form.mobile" /> |
||||
<region-tree-choose |
</FormItem> |
||||
@on-change="handleSelectRegion" |
</Col> |
||||
ref="regionTree" |
<Col span="24"> |
||||
></region-tree-choose> |
<FormItem label="配送员简介"> |
||||
</FormItem> |
<Input type="textarea" v-model="form.workerDescribe" :rows="4" /> |
||||
</Col> |
</FormItem> |
||||
</Row> |
</Col> |
||||
<Row :gutter="32"> |
</Row> |
||||
<Col span="12"> |
<Row :gutter="32"> |
||||
<FormItem label="当次应缴" prop="depoNum"> |
<Col span="24"> |
||||
<Input v-model="form.depoNum" /> |
<FormItem label="配送员收费标准说明"> |
||||
</FormItem> |
<Input type="textarea" v-model="form.remark" :rows="4" /> |
||||
</Col> |
</FormItem> |
||||
<Col span="12"> |
</Col> |
||||
<FormItem label="押金余额" prop="depoBal"> |
</Row> |
||||
<Input v-model="form.depoBal" :disabled="true"/> |
</Form> |
||||
</FormItem> |
</div> |
||||
</Col> |
<div class="drawer-footer br" v-show="type != '0'"> |
||||
</Row> |
<Button type="primary" :loading="submitLoading" @click="submit">提交</Button> |
||||
<Row :gutter="32"> |
<Button @click="visible = false">取消</Button> |
||||
<Col span="12"> |
</div> |
||||
<FormItem label="电话" prop="mobile"> |
</Drawer> |
||||
<Input v-model="form.mobile" /> |
</div> |
||||
</FormItem> |
|
||||
</Col> |
|
||||
<Col span="24"> |
|
||||
<FormItem label="快递员简介"> |
|
||||
<Input type="textarea" v-model="form.workerDescribe" :rows="4" /> |
|
||||
</FormItem> |
|
||||
</Col> |
|
||||
</Row> |
|
||||
<Row :gutter="32"> |
|
||||
<Col span="12"> |
|
||||
<FormItem label="所属公司" prop="ownerCompany"> |
|
||||
<Select v-model="form.ownerCompany" multiple transfer> |
|
||||
<Option |
|
||||
v-for="item in companyList" |
|
||||
:value="item.id" |
|
||||
:key="item.id" |
|
||||
:label="item.companyName" |
|
||||
> |
|
||||
<span style="margin-right: 10px">{{ item.companyName }}</span> |
|
||||
</Option> |
|
||||
</Select> |
|
||||
</FormItem> |
|
||||
</Col> |
|
||||
</Row> |
|
||||
<Row :gutter="32"> |
|
||||
<Col span="24"> |
|
||||
<FormItem label="快递员收费标准说明"> |
|
||||
<Input type="textarea" v-model="form.remark" :rows="4" /> |
|
||||
</FormItem> |
|
||||
</Col> |
|
||||
</Row> |
|
||||
</Form> |
|
||||
</div> |
|
||||
<div class="drawer-footer br" v-show="type != '0'"> |
|
||||
<Button type="primary" :loading="submitLoading" @click="submit" |
|
||||
>提交</Button |
|
||||
> |
|
||||
<Button @click="visible = false">取消</Button> |
|
||||
</div> |
|
||||
</Drawer> |
|
||||
</div> |
|
||||
</template> |
</template> |
||||
|
|
||||
<script> |
<script> |
||||
import { getAllRoleList, addWorker, editWorker } from "@/api/index"; |
import { |
||||
import { getLogiticsCompanyList } from "@/api/app"; |
getAllRoleList, |
||||
import { |
addWorker, |
||||
validateUsername, |
editWorker |
||||
validateMobile, |
} from "@/api/index"; |
||||
validatePassword, |
import { |
||||
} from "@/libs/validate"; |
getLogiticsCompanyList |
||||
import departmentTreeChoose from "@/views/my-components/hiver/department-tree-choose"; |
} from "@/api/app"; |
||||
import uploadPicInput from "@/views/my-components/hiver/upload-pic-input"; |
import { |
||||
import SetPassword from "@/views/my-components/hiver/set-password"; |
validateUsername, |
||||
import dict from "@/views/my-components/hiver/dict"; |
validateMobile, |
||||
import regionTreeChoose from "@/views/my-components/hiver/region-tree-choose"; |
validatePassword, |
||||
export default { |
} from "@/libs/validate"; |
||||
name: "addEdit", |
import departmentTreeChoose from "@/views/my-components/hiver/department-tree-choose"; |
||||
components: { |
import uploadPicInput from "@/views/my-components/hiver/upload-pic-input"; |
||||
regionTreeChoose, |
import SetPassword from "@/views/my-components/hiver/set-password"; |
||||
departmentTreeChoose, |
import dict from "@/views/my-components/hiver/dict"; |
||||
uploadPicInput, |
import regionTreeChoose from "@/views/my-components/hiver/region-tree-choose"; |
||||
SetPassword, |
export default { |
||||
dict, |
name: "addEdit", |
||||
}, |
components: { |
||||
props: { |
regionTreeChoose, |
||||
value: { |
departmentTreeChoose, |
||||
type: Boolean, |
uploadPicInput, |
||||
default: false, |
SetPassword, |
||||
}, |
dict, |
||||
data: { |
}, |
||||
type: Object, |
props: { |
||||
}, |
value: { |
||||
type: { |
type: Boolean, |
||||
type: String, |
default: false, |
||||
default: "0", |
}, |
||||
}, |
data: { |
||||
}, |
type: Object, |
||||
data() { |
}, |
||||
return { |
type: { |
||||
roleList: [], |
type: String, |
||||
visible: this.value, |
default: "0", |
||||
title: "", |
}, |
||||
passColor: "", |
}, |
||||
statusName: "", |
data() { |
||||
submitLoading: false, |
return { |
||||
maxHeight: 510, |
roleList: [], |
||||
form: { |
visible: this.value, |
||||
signPerson: "2", |
title: "", |
||||
}, |
passColor: "", |
||||
formValidate: {}, |
statusName: "", |
||||
companyList: [], |
submitLoading: false, |
||||
companyForm: { |
maxHeight: 510, |
||||
signCompany: "1", |
form: { |
||||
}, |
signPerson: "2", |
||||
}; |
}, |
||||
}, |
formValidate: {}, |
||||
methods: { |
companyList: [], |
||||
init() { |
companyForm: { |
||||
this.getRoleList(); |
signCompany: "1", |
||||
this.getCompanyList(); |
}, |
||||
}, |
}; |
||||
getRoleList() { |
}, |
||||
getAllRoleList().then((res) => { |
methods: { |
||||
if (res.success) { |
init() { |
||||
this.roleList = res.result; |
this.getRoleList(); |
||||
} |
this.getCompanyList(); |
||||
}); |
}, |
||||
}, |
getRoleList() { |
||||
getCompanyList() { |
getAllRoleList().then((res) => { |
||||
getLogiticsCompanyList(this.companyForm).then((res) => { |
if (res.success) { |
||||
if (res.success) { |
this.roleList = res.result; |
||||
this.companyList = res.result; |
} |
||||
} |
}); |
||||
}); |
}, |
||||
}, |
getCompanyList() { |
||||
handleSelectRegion(v) { |
getLogiticsCompanyList(this.companyForm).then((res) => { |
||||
this.form.region = v; |
if (res.success) { |
||||
}, |
this.companyList = res.result; |
||||
changePass(v, grade, strength) { |
} |
||||
this.form.passStrength = strength; |
}); |
||||
}, |
}, |
||||
submit() { |
handleSelectRegion(v) { |
||||
this.$refs.form.validate((valid) => { |
this.form.region = v; |
||||
if (valid) { |
}, |
||||
if (this.type == "1") { |
changePass(v, grade, strength) { |
||||
// 编辑 |
this.form.passStrength = strength; |
||||
this.submitLoading = true; |
}, |
||||
editWorker(this.form).then((res) => { |
submit() { |
||||
this.submitLoading = false; |
this.$refs.form.validate((valid) => { |
||||
if (res.success) { |
if (valid) { |
||||
this.$Message.success("操作成功"); |
if (this.type == "1") { |
||||
this.$emit("on-submit", true); |
// 编辑 |
||||
this.visible = false; |
this.submitLoading = true; |
||||
} |
editWorker(this.form).then((res) => { |
||||
}); |
this.submitLoading = false; |
||||
} else { |
if (res.success) { |
||||
// 添加 |
this.$Message.success("操作成功"); |
||||
this.submitLoading = true; |
this.$emit("on-submit", true); |
||||
addWorker(this.form).then((res) => { |
this.visible = false; |
||||
this.submitLoading = false; |
} |
||||
if (res.success) { |
}); |
||||
this.$Message.success("操作成功"); |
} else { |
||||
this.$emit("on-submit", true); |
// 添加 |
||||
this.visible = false; |
this.submitLoading = true; |
||||
} |
addWorker(this.form).then((res) => { |
||||
}); |
this.submitLoading = false; |
||||
} |
if (res.success) { |
||||
} |
this.$Message.success("操作成功"); |
||||
}); |
this.$emit("on-submit", true); |
||||
}, |
this.visible = false; |
||||
setCurrentValue(value) { |
} |
||||
if (value === this.visible) { |
}); |
||||
return; |
} |
||||
} |
} |
||||
if (this.type == "1") { |
}); |
||||
this.title = "修改信息"; |
}, |
||||
this.maxHeight = |
setCurrentValue(value) { |
||||
Number(document.documentElement.clientHeight - 121) + "px"; |
if (value === this.visible) { |
||||
} else if (this.type == "2") { |
return; |
||||
this.title = "新建信息"; |
} |
||||
this.maxHeight = |
if (this.type == "1") { |
||||
Number(document.documentElement.clientHeight - 121) + "px"; |
this.title = "修改信息"; |
||||
} else { |
this.maxHeight = |
||||
this.title = "信息详情"; |
Number(document.documentElement.clientHeight - 121) + "px"; |
||||
this.maxHeight = "100%"; |
} else if (this.type == "2") { |
||||
} |
this.title = "新建信息"; |
||||
// 清空数据 |
this.maxHeight = |
||||
this.$refs.form.resetFields(); |
Number(document.documentElement.clientHeight - 121) + "px"; |
||||
if (this.type == "0" || this.type == "1") { |
} else { |
||||
// 密码强度 |
this.title = "信息详情"; |
||||
// 回显数据 |
this.maxHeight = "100%"; |
||||
let data = this.data; |
} |
||||
if (data.workerStatus == "1") { |
// 清空数据 |
||||
this.passColor = "#52c41a"; |
this.$refs.form.resetFields(); |
||||
this.statusName = "可抢单"; |
if (this.type == "0" || this.type == "1") { |
||||
} else if (data.workerStatus == "2") { |
// 密码强度 |
||||
this.passColor = "#faad14"; |
// 回显数据 |
||||
this.statusName = "不可接单"; |
let data = this.data; |
||||
} else if (data.workerStatus == "3") { |
if (data.workerStatus == "1") { |
||||
this.passColor = "#ed3f14"; |
this.passColor = "#52c41a"; |
||||
this.statusName = "已禁用"; |
this.statusName = "可抢单"; |
||||
} |
} else if (data.workerStatus == "2") { |
||||
// 角色 |
this.passColor = "#faad14"; |
||||
let selectCompanyIds = []; |
this.statusName = "不可接单"; |
||||
selectCompanyIds = data.ownerCompany.split(","); |
} else if (data.workerStatus == "3") { |
||||
data.ownerCompany = selectCompanyIds; |
this.passColor = "#ed3f14"; |
||||
// 商圈 |
this.statusName = "已禁用"; |
||||
this.$refs.regionTree.setData(data.region, data.regionTitle); |
} |
||||
// 回显 |
// 回显 |
||||
this.form = data; |
this.form = data; |
||||
} else { |
} else { |
||||
this.form = { |
this.form = { |
||||
type: 0, |
type: 0, |
||||
signPerson: "2", |
signPerson: "2", |
||||
}; |
}; |
||||
} |
} |
||||
this.visible = value; |
this.visible = value; |
||||
}, |
}, |
||||
}, |
}, |
||||
watch: { |
watch: { |
||||
value(val) { |
value(val) { |
||||
this.setCurrentValue(val); |
this.setCurrentValue(val); |
||||
}, |
}, |
||||
visible(value) { |
visible(value) { |
||||
this.$emit("input", value); |
this.$emit("input", value); |
||||
}, |
}, |
||||
}, |
}, |
||||
mounted() { |
mounted() { |
||||
this.init(); |
this.init(); |
||||
}, |
}, |
||||
}; |
}; |
||||
</script> |
</script> |
||||
|
|
||||
<style lang="less"> |
<style lang="less"> |
||||
@import "@/styles/drawer-common.less"; |
@import "@/styles/drawer-common.less"; |
||||
</style> |
</style> |
||||
|
|
||||
File diff suppressed because it is too large
Loading…
Reference in new issue