赵鹏 1 month ago
parent
commit
8e4e8ae65f
  1. 2
      pages/enterprise.vue
  2. 2
      sub/enterprise/detail.vue
  3. 43
      sub/invite/addEnterprise.vue
  4. 185
      sub/invite/index.vue
  5. 4
      sub/invite/prove.vue
  6. 5
      utils/dict.js

2
pages/enterprise.vue

@ -322,7 +322,7 @@ export default {
display: flex;
gap: 4px;
color: $uni-text-color-grey;
display: flex;
flex-flow: row wrap;
.tag {
font-size: 12px;
display: flex;

2
sub/enterprise/detail.vue

@ -270,8 +270,8 @@ export default {
.tagList {
display: flex;
gap: 4px;
flex-flow: row wrap;
color: $uni-text-color-grey;
display: flex;
.tag {
font-size: 12px;
display: flex;

43
sub/invite/addEnterprise.vue

@ -111,8 +111,7 @@
type="text"
placeholder="请输入企业负责人"
:inputBorder="false"
style="text-align: center"
:value="form.contactName"
v-model="form.contactName"
:clearable="false"
:autoHeight="true"
></uni-easyinput>
@ -216,29 +215,33 @@ import { getDictBatchByType } from '@/api/system/dict.js'
import {
createEnterPrise,
vertifyName,
c
getEnterPrise
} from '@/api/enterprise/index.js'
export default {
data() {
return {
form: {
enterprisesName: undefined,
address: undefined,
gpsLocation: undefined,
enterprisesName: '',
address: '',
gpsLocation: '',
introduction: '',
photo: [],
tags: {},
environmentalContactPhone: undefined,
contactName: undefined,
environmentalContactPhone: '',
contactName: '',
id: ''
},
dictMap: {},
prove: [],
inviteId: undefined
inviteId: ''
}
},
onLoad(res) {
this.inviteId = res.inviteId
if (res.id) {
this.form.id = res.id
this.init()
}
this.getDict()
},
onShow() {
@ -254,6 +257,7 @@ export default {
},
methods: {
proofName(v) {
if (v.detail.value == '') return
uni.showLoading({
title: '加载中'
})
@ -287,6 +291,11 @@ export default {
this.form.environmentalContactPhone = v.detail.value
}
},
init() {
getEnterPrise(this.form.id).then(res => {
console.log(res)
})
},
/**
* 获取字典
*/
@ -323,6 +332,9 @@ export default {
* @param {Object} e
*/
async addEnterprisePhoto(e) {
uni.showLoading({
title: '上传中...'
})
e.file.forEach(p => {
this.form.photo.push({
...p,
@ -345,6 +357,7 @@ export default {
})
).then(res => {
this.form.photo = res
uni.hideLoading()
})
},
/**
@ -368,13 +381,11 @@ export default {
const valide = await this.verifyForm()
if (!valide) return
const data = { ...this.form }
console.log(data)
data.region = data.tags.qy.id
// data.type = data.tags.qy.id
data.tagIds = [data.tags.hy.id, data.tags.st.id, data.tags.wr.id]
data.fileIds = data.photo.map(i => i.id)
// data.userId = this.inviteId
data.userId = 162
data.userId = this.inviteId
data.qualis = this.prove.map(i => {
return {
...i,
@ -384,10 +395,11 @@ export default {
})
if (this.form.id) {
} else {
console.log(data)
createEnterPrise(data).then(res => {
uni.showToast({
icon: 'none',
title: res.msg
title: '操作成功'
})
uni.navigateBack()
})
@ -407,10 +419,7 @@ export default {
}
const msg = []
Object.keys(this.form).forEach(i => {
if (!Object.hasOwn(msgMap, i)) {
return
}
if (!this.form[i]) {
if (!this.form[i] && i != 'id') {
msg.push(msgMap[i])
}
if (typeof this.form[i] == 'Object' && this.form[i].length == 0) {

185
sub/invite/index.vue

@ -1,6 +1,6 @@
<template>
<view class="view">
<view class="emty">
<view class="emty" v-if="list.length == 0">
<image
src="/static/images/emty.png"
style="width: 79px; height: 79px"
@ -9,6 +9,79 @@
<text>暂无数据</text>
</view>
<view
class="enterprise"
v-for="enterprise in list"
:key="enterprise.id"
>
<view class="info">
<view>
{{ enterprise.enterprisesName }}
</view>
<view class="wd-flex" style="gap: 8px">
<u-avatar
:src="enterprise.files[0].url"
shape="cricle"
style="width: 53px; height: 53px"
></u-avatar>
<view class="">
<view class="">
<view class="wd-flex wd-pb-8px">
<u-icon name="map" size="14" color="#17C653"></u-icon>
<text class="address wd-text-12" style="margin-left: 4px">
{{ enterprise.address }}
</text>
</view>
<view class="tagList">
<view class="tag">
{{
$dict.echoDicValue(
dictMap.enterprises_area,
enterprise.region
)
}}
</view>
<view
class="tag"
v-for="(tag, index) in enterprise.tagList"
:key="index"
>
{{ tag }}
</view>
</view>
</view>
</view>
</view>
<view class="wd-flex" style="align-items: center">
<text class="address" style="margin-right: 8px; color: #4b5675">
环保负责人
</text>
<text style="margin-right: 16px">
{{ enterprise.contactName }}
</text>
<text class="address" style="margin-right: 8px; color: #4b5675">
联系方式
</text>
<text style="">
{{ enterprise.environmentalContactPhone }}
</text>
</view>
</view>
<view class="opera">
<view class="box-btn red">变更管理人</view>
<view class="box-btn green" @tap="editEnterprise(enterprise.id)">
编辑该企业
</view>
</view>
<view
class="audit"
v-if="!enterprise.isAudit"
style="color: #f6b100; background-color: #fff8dd"
>
待审核
</view>
</view>
<cs-bottom-wrapper>
<view class="operation">
<button class="btn green" @tap="addEnterprise">新增企业</button>
@ -18,23 +91,58 @@
</template>
<script>
import { vertifyName } from '@/api/enterprise/index.js'
import { getTagData, getDictBatchByType } from '@/api/system/dict.js'
export default {
data() {
return {
inviteId: ''
inviteId: '',
list: [],
dictMap: {}
}
},
onLoad(res) {
console.log(res)
if (res.inviteId) {
this.inviteId = res.inviteId
}
this.getDict()
this.getList()
},
methods: {
getList() {
uni.showLoading({
title: '加载中...'
})
vertifyName({ enterpriseUserId: this.$store.getters.userId }).then(
res => {
this.list = res.data.list
uni.hideLoading()
}
)
},
async getDict() {
const tags = await getTagData(['qy', ' hy', 'st', 'wr'].join(','))
const dict = await getDictBatchByType({
type: ['user_audit_type', 'enterprises_area'].join(',')
})
let tagMap = {}
tags.data.forEach(t => {
tagMap[t.tagCode] = t.children
})
this.dictMap = {
...tagMap,
...dict.data
}
},
addEnterprise() {
uni.navigateTo({
url: `/sub/invite/addEnterprise?inviteId=${this.inviteId}`
})
},
editEnterprise(id) {
uni.navigateTo({
url: `/sub/invite/addEnterprise?inviteId=${this.inviteId}&id=${id}`
})
}
}
}
@ -81,4 +189,75 @@ export default {
color: #fff;
}
}
.enterprise {
padding: 12px;
border-radius: var(--Number-12px, 12px);
border: 1px solid var(--LightMode-Grey-Grey-200, #f1f1f4);
background: #fff;
display: flex;
padding: var(--Number-16px, 16px);
flex-direction: column;
align-items: flex-start;
gap: var(--Number-16px, 16px);
align-self: stretch;
position: relative;
overflow: hidden;
.audit {
position: absolute;
right: -19px;
top: 6px;
transform: rotateZ(45deg);
transform-origin: 50% 50%;
padding: 4px 20px;
font-size: 12px;
text-align: center;
}
.info {
display: flex;
flex-direction: column;
align-items: flex-start;
gap: var(--Number-12px, 12px);
align-self: stretch;
.tagList {
margin-top: 8px;
display: flex;
gap: 4px;
color: $uni-text-color-grey;
display: flex;
.tag {
font-size: 12px;
display: flex;
padding: 2px 6px;
justify-content: center;
align-items: center;
border-radius: 2px;
background: #f9f9f9;
}
}
}
.opera {
display: flex;
flex-flow: row nowrap;
gap: 16px;
width: 100%;
.box-btn {
flex: 1;
border-radius: var(--Number-8px, 8px);
display: flex;
padding: var(--Number-12px, 12px);
justify-content: center;
align-items: center;
gap: var(--Number-12px, 12px);
flex: 1 0 0;
}
.red {
background: var(--LightMode-Orange-Orange-Light, #fff5ef);
color: var(--LightMode-Orange-Orange, #ff6f1e);
}
.green {
background: var(--LightMode-Success-Success-Light, #eafff1);
color: var(--LightMode-Success-Success, #17c653);
}
}
}
</style>

4
sub/invite/prove.vue

@ -18,7 +18,7 @@
}}
</view>
<view class="input-textarea" style="color: #808080" v-else>
输入资质名称
选择资质名称
</view>
<u-icon name="arrow-right"></u-icon>
</view>
@ -199,7 +199,7 @@ export default {
* @param {Object} e
*/
delPhoto(e) {
this.prove.photo = {}
this.prove.photo = []
},
/**
* 选择器确认回调

5
utils/dict.js

@ -5,7 +5,10 @@
*/
export function echoDicValue(dict, value) {
if (!dict || !value) return ''
return dict.find(d => d.value == value).label || ''
if (dict.find(d => d.value == value)) {
return dict.find(d => d.value == value).label
}
return ''
}
/**

Loading…
Cancel
Save