516 lines
10 KiB
Vue
516 lines
10 KiB
Vue
<template>
|
|
<view class="content">
|
|
|
|
<view class="content-middle">
|
|
<view class="content-middle-title">
|
|
请输入部门信息
|
|
</view>
|
|
<form report-submit='true'>
|
|
<view class='merchantsSettled'>
|
|
<view class='list' style="padding-bottom: 30rpx;">
|
|
<view class="item" style="border-bottom: 1px solid #eee;">
|
|
<view class="uni-list">
|
|
<view class="uni-list-cell">
|
|
<view class="uni-list-cell-db acea-row row-middle">
|
|
<text class="item-name">部门名称:</text>
|
|
<input placeholder="请输入部门" type="text" readonly v-model="merchantData.title">
|
|
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="item">
|
|
<view class="acea-row row-middle">
|
|
<text class="item-name">上级部门:</text>
|
|
<input placeholder="上级部门" type="text" readonly v-model="buname" @click="showck">
|
|
|
|
</view>
|
|
</view>
|
|
<view class="item">
|
|
<view class="acea-row row-middle">
|
|
<text class="item-name">分管领导:</text>
|
|
|
|
<input placeholder="分管领导" type="text" readonly v-model="buname2" @click="showck1('1')">
|
|
|
|
</view>
|
|
</view>
|
|
<view class="item">
|
|
<view class="acea-row row-middle">
|
|
<text class="item-name">部门负责人:</text>
|
|
|
|
<input placeholder="部门负责人" type="text" readonly v-model="buname3" @click="showck1('2')">
|
|
|
|
</view>
|
|
</view>
|
|
<view class="item">
|
|
<view class="acea-row row-middle">
|
|
<text class="item-name">排序:</text>
|
|
<input placeholder="请输入排序" type="text" readonly v-model="merchantData.sort">
|
|
|
|
</view>
|
|
</view>
|
|
|
|
<view class="item">
|
|
<view class="acea-row row-middle">
|
|
<text class="item-name">联系电话:</text>
|
|
<input placeholder="部门联系电话,可空" type="text" readonly v-model="merchantData.phone">
|
|
|
|
</view>
|
|
</view>
|
|
|
|
|
|
|
|
</view>
|
|
</view>
|
|
</form>
|
|
|
|
<u-picker :show="flag1" :columns="columns3" ref="uPicker4" @cancel="flag1 = false" closeOnClickOverlay
|
|
@close="flag1 = false" @confirm="confirm" keyName="title" :defaultIndex=[0,0]>
|
|
</u-picker>
|
|
|
|
<u-picker :show="flag2" :columns="columns4" ref="uPicker5" @cancel="flag2 = false" closeOnClickOverlay
|
|
@close="flag2 = false" @confirm="confirm1" keyName="name" :defaultIndex=[0]>
|
|
</u-picker>
|
|
<view class="content-bottom">
|
|
<view class="content-bottom-two" @click="submit">
|
|
立即提交
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import {
|
|
userdepartment,
|
|
adddepartment,
|
|
getemployee
|
|
} from '@/api/oa.js'
|
|
import {
|
|
Toast
|
|
} from '@/libs/uniApi.js'
|
|
export default {
|
|
|
|
data() {
|
|
return {
|
|
validate: false,
|
|
columns3: [],
|
|
columns4: [],
|
|
flag1: false,
|
|
flag2: false,
|
|
buname: "",
|
|
buname2: "",
|
|
buname3: "",
|
|
merchantData: {
|
|
sort: '',
|
|
phone: '',
|
|
title: '',
|
|
pid: ''
|
|
|
|
},
|
|
dou: 1,
|
|
type: ''
|
|
};
|
|
},
|
|
onLoad(option) {
|
|
|
|
|
|
this.type = option.type
|
|
if (this.type == 1) {
|
|
uni.setNavigationBarTitle({
|
|
title: '编辑部门'
|
|
})
|
|
let arr1 = JSON.parse(decodeURIComponent(option.data));
|
|
|
|
|
|
this.merchantData.id = arr1.id
|
|
this.merchantData.leader_id = arr1.leader_id
|
|
this.merchantData.manager_id= arr1.manager_id
|
|
this.merchantData.phone = arr1.phone
|
|
this.merchantData.pid = arr1.pid
|
|
this.merchantData.title = arr1.title
|
|
this.merchantData.sort = arr1.sort
|
|
|
|
|
|
|
|
}
|
|
|
|
this.getDocumentList()
|
|
this.getDocumentList1()
|
|
|
|
|
|
},
|
|
methods: {
|
|
//获取员工
|
|
|
|
async getDocumentList1() {
|
|
this.columns4 = []
|
|
const res = await getemployee()
|
|
// this.columns4 = res.data
|
|
this.columns4.push(res.data)
|
|
if (this.type == 1) {
|
|
res.data.map((item, index) => {
|
|
if (item.id == this.merchantData.leader_id) {
|
|
this.buname2 = item.name
|
|
}
|
|
if (item.id == this.merchantData.manager_id) {
|
|
this.buname3 = item.name
|
|
}
|
|
})
|
|
}
|
|
},
|
|
|
|
showck1(val) {
|
|
this.dou = val
|
|
this.flag2 = true
|
|
},
|
|
//获取部门
|
|
async getDocumentList() {
|
|
this.columns3 = []
|
|
const res = await userdepartment({
|
|
tree: 1
|
|
})
|
|
const deArr = res.data
|
|
this.columns3.push(deArr)
|
|
if (this.type == 1) {
|
|
res.data.map((item, index) => {
|
|
if (item.id == this.merchantData.id) {
|
|
this.buname = item.title
|
|
}
|
|
})
|
|
}
|
|
},
|
|
validateForm: function() {
|
|
let that = this,
|
|
value = that.merchantData;
|
|
//console.log(this.merchantData)
|
|
if (!value.sort) return Toast(
|
|
'请输入排序'
|
|
);
|
|
if (!value.title) return Toast('请输入部门名称');
|
|
if (value.pid.length == 0) return Toast('请选择顶级部门');
|
|
// if (!value.phone) return Toast('请输入手机号');
|
|
// if (!/^1(3|4|5|7|8|9|6)\d{9}$/i.test(value.phone)) return Toast(
|
|
// '请输入正确的手机号码'
|
|
// );
|
|
|
|
|
|
that.validate = true;
|
|
return true;
|
|
},
|
|
showck() {
|
|
this.flag1 = true
|
|
},
|
|
confirm(e) {
|
|
//console.log(e)
|
|
this.merchantData.pid = e.value[0].id
|
|
this.buname = e.value[0].title
|
|
|
|
this.flag1 = false
|
|
},
|
|
confirm1(e) {
|
|
//console.log(e)
|
|
if (this.dou == 1) {
|
|
this.merchantData.leader_id = e.value[0].id
|
|
this.buname2 = e.value[0].name
|
|
} else {
|
|
this.merchantData.manager_id = e.value[0].id
|
|
this.buname3 = e.value[0].name
|
|
}
|
|
// this.merchantData.pid = e.value[0].id
|
|
// this.buname = e.value[0].title
|
|
|
|
this.flag2 = false
|
|
},
|
|
async submit() {
|
|
let that = this
|
|
//console.log(that.validate)
|
|
if (this.validateForm() && this.validate) {
|
|
const res = await adddepartment(this.merchantData)
|
|
Toast(res.msg);
|
|
if (res.code == 0) {
|
|
uni.redirectTo({
|
|
url: '/pages/structure/index'
|
|
})
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
};
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
page {
|
|
padding-bottom: 88rpx;
|
|
}
|
|
|
|
.content-top {
|
|
width: 100%;
|
|
background: #3274F9;
|
|
position: fixed;
|
|
z-index: 100;
|
|
|
|
}
|
|
|
|
.content-middle {
|
|
padding: 28rpx 28rpx;
|
|
|
|
.content-middle-title {
|
|
font-size: 35rpx;
|
|
font-family: PingFang SC-Bold, PingFang SC;
|
|
font-weight: bold;
|
|
color: #333333;
|
|
margin-bottom: 35rpx;
|
|
|
|
}
|
|
|
|
.merchantsSettled .list {
|
|
background-color: #fff;
|
|
border-radius: 12px;
|
|
|
|
}
|
|
|
|
.application-record {
|
|
position: absolute;
|
|
display: flex;
|
|
align-items: center;
|
|
top: 240rpx;
|
|
right: 0;
|
|
color: #fff;
|
|
font-size: 22rpx;
|
|
background-color: rgba(0, 0, 0, 0.3);
|
|
padding: 8rpx 18rpx;
|
|
border-radius: 20px 0px 0px 20px;
|
|
}
|
|
|
|
.merchantsSettled .list .item {
|
|
padding: 50rpx 0 20rpx;
|
|
|
|
position: relative;
|
|
margin: 0 20px;
|
|
|
|
&.no-border {
|
|
border-bottom: none;
|
|
padding-left: 0;
|
|
padding-right: 0;
|
|
}
|
|
|
|
.item-title {
|
|
color: #666666;
|
|
font-size: 28rpx;
|
|
display: block;
|
|
}
|
|
|
|
.item-desc {
|
|
color: #B2B2B2;
|
|
font-size: 22rpx;
|
|
display: block;
|
|
margin-top: 9rpx;
|
|
line-height: 36rpx;
|
|
}
|
|
}
|
|
|
|
.item-name {
|
|
width: 160rpx;
|
|
margin-right: 10rpx;
|
|
}
|
|
|
|
.acea-row,
|
|
.upload {
|
|
display: -webkit-box;
|
|
display: -moz-box;
|
|
display: -webkit-flex;
|
|
display: -ms-flexbox;
|
|
display: flex;
|
|
-webkit-box-lines: multiple;
|
|
-moz-box-lines: multiple;
|
|
-o-box-lines: multiple;
|
|
-webkit-flex-wrap: wrap;
|
|
-ms-flex-wrap: wrap;
|
|
flex-wrap: wrap;
|
|
}
|
|
|
|
.upload {
|
|
margin-top: 20rpx;
|
|
}
|
|
|
|
.acea-row.row-middle {
|
|
-webkit-box-align: center;
|
|
-moz-box-align: center;
|
|
-o-box-align: center;
|
|
-ms-flex-align: center;
|
|
-webkit-align-items: center;
|
|
align-items: center;
|
|
padding-left: 2px;
|
|
}
|
|
|
|
.acea-row.row-column {
|
|
-webkit-box-orient: vertical;
|
|
-moz-box-orient: vertical;
|
|
-o-box-orient: vertical;
|
|
-webkit-flex-direction: column;
|
|
-ms-flex-direction: column;
|
|
flex-direction: column;
|
|
}
|
|
|
|
.acea-row.row-center-wrapper {
|
|
-webkit-box-align: center;
|
|
-moz-box-align: center;
|
|
-o-box-align: center;
|
|
-ms-flex-align: center;
|
|
-webkit-align-items: center;
|
|
align-items: center;
|
|
-webkit-box-pack: center;
|
|
-moz-box-pack: center;
|
|
-o-box-pack: center;
|
|
-ms-flex-pack: center;
|
|
-webkit-justify-content: center;
|
|
justify-content: center;
|
|
}
|
|
|
|
|
|
.uni-list-cell-db {
|
|
position: relative;
|
|
}
|
|
|
|
|
|
|
|
|
|
.merchantsSettled .list .item input {
|
|
width: 400rpx;
|
|
font-size: 30rpx;
|
|
}
|
|
|
|
.merchantsSettled .list .item .placeholder {
|
|
color: #b2b2b2;
|
|
}
|
|
|
|
.merchantsSettled .default {
|
|
padding: 0 30rpx;
|
|
height: 90rpx;
|
|
background-color: #fff;
|
|
margin-top: 23rpx;
|
|
}
|
|
|
|
.merchantsSettled .default checkbox {
|
|
margin-right: 15rpx;
|
|
}
|
|
|
|
.merchantsSettled .acea-row uni-image {
|
|
width: 20px;
|
|
height: 20px;
|
|
display: block;
|
|
}
|
|
|
|
.merchantsSettled .list .item .codeIput {
|
|
width: 125px;
|
|
}
|
|
|
|
.uni-input-input {
|
|
display: block;
|
|
height: 100%;
|
|
background: none;
|
|
color: inherit;
|
|
opacity: 1;
|
|
-webkit-text-fill-color: currentcolor;
|
|
font: inherit;
|
|
line-height: inherit;
|
|
letter-spacing: inherit;
|
|
text-align: inherit;
|
|
text-indent: inherit;
|
|
text-transform: inherit;
|
|
text-shadow: inherit;
|
|
}
|
|
|
|
.merchantsSettled .list .item .code {
|
|
position: absolute;
|
|
width: 93px;
|
|
line-height: 27px;
|
|
border: 1px solid var(--view-theme);
|
|
border-radius: 15px;
|
|
color: var(--view-theme);
|
|
text-align: center;
|
|
bottom: 8px;
|
|
right: 0;
|
|
font-size: 12px;
|
|
}
|
|
|
|
.merchantsSettled .list .item .code.on {
|
|
background-color: #bbb;
|
|
color: #fff;
|
|
border-color: #bbb;
|
|
}
|
|
|
|
.merchantsSettled .submitBtn {
|
|
width: 588rpx;
|
|
margin: 0 auto;
|
|
height: 86rpx;
|
|
border-radius: 25px;
|
|
text-align: center;
|
|
line-height: 86rpx;
|
|
font-size: 15px;
|
|
color: #fff;
|
|
background: #E3E3E3;
|
|
margin-top: 25px;
|
|
pointer-events: none;
|
|
}
|
|
|
|
.merchantsSettled .submitBtn.on {
|
|
background: var(--view-theme);
|
|
pointer-events: all;
|
|
}
|
|
|
|
uni-checkbox-group,
|
|
.settleAgree {
|
|
display: inline-block;
|
|
font-size: 24rpx;
|
|
}
|
|
|
|
uni-checkbox-group {
|
|
color: #b2b2b2;
|
|
}
|
|
|
|
.settleAgree {
|
|
color: var(--view-theme);
|
|
position: relative;
|
|
top: 2px;
|
|
left: 8px;
|
|
}
|
|
|
|
.merchantsSettled uni-checkbox .uni-checkbox-wrapper {
|
|
width: 30rpx;
|
|
height: 30rpx;
|
|
border: 2rpx solid #C3C3C3;
|
|
border-radius: 15px;
|
|
}
|
|
}
|
|
|
|
.content-bottom {
|
|
width: 485rpx;
|
|
height: 88rpx;
|
|
position: absolute;
|
|
bottom: 30rpx;
|
|
left: 50%;
|
|
margin-left: -242.5rpx;
|
|
position: fixed;
|
|
|
|
|
|
|
|
.content-bottom-two {
|
|
width: 485rpx;
|
|
height: 88rpx;
|
|
line-height: 88rpx;
|
|
text-align: center;
|
|
font-size: 32rpx;
|
|
border-radius: 60rpx 60rpx;
|
|
font-family: PingFang SC-Regular, PingFang SC;
|
|
font-weight: 400;
|
|
color: #FFFFFF;
|
|
background: #3274F9;
|
|
|
|
}
|
|
}
|
|
</style> |