Browse Source

添加获取区域和查询部门树的API接口

master
parent
commit
1aeb88b29c
  1. 55
      App.vue
  2. 10
      api/system/dict.js
  3. 9
      api/task/index.js
  4. 11
      pages/enterprise.vue
  5. 65
      pages/index.vue
  6. 6
      pages/owner.vue
  7. 32
      pages/task.vue
  8. 6
      sub/enterprise/detail.vue
  9. 6
      sub/invite/addEnterprise.vue
  10. 34
      sub/invite/enterpriseTags.vue
  11. 4
      sub/invite/prove.vue
  12. 6
      sub/owner/edit.vue
  13. 34
      sub/owner/notic.vue
  14. 6
      sub/task/detail.vue
  15. 10
      uni_modules/s-components/s-header/index.vue
  16. 1
      wxcomponents/vant/dropdown-menu/index.wxml
  17. 2
      wxcomponents/vant/dropdown-menu/index.wxss

55
App.vue

@ -6,28 +6,41 @@ export default {
return {}
},
async onLaunch(options) {
// const updateManager = uni.getUpdateManager()
// updateManager.onCheckForUpdate(function (res) {
// //
// console.log(res.hasUpdate)
// })
// updateManager.onUpdateReady(function (res) {
// uni.showModal({
// title: '',
// content: '',
// showCancel: false,
// confirmText: '',
// confirmColor: '#1890FF',
// success(res) {
// if (res.confirm) {
// // applyUpdate
// updateManager.applyUpdate()
// }
// }
// })
// })
await this.initApp()
},
onShow() {
const updateManager = uni.getUpdateManager()
updateManager.onCheckForUpdate(function (res) {
//
// console.log(res.hasUpdate)
})
updateManager.onUpdateReady(function (res) {
uni.showModal({
title: '更新提示',
content: '新版本已经准备好,是否重启应用?',
showCancel: false,
success(res) {
if (res.confirm) {
// applyUpdate
updateManager.applyUpdate()
}
}
})
})
updateManager.onUpdateFailed(function (res) {
//
console.log('download error')
uni.showModal({
title: '提示',
content:
'新版小程序下载失败\n请自行退出程序,手动卸载本程序,再运行',
confirmText: '知道了'
})
})
},
methods: {
//
initApp() {
@ -55,4 +68,4 @@ export default {
<style lang="scss">
@import '@/uni_modules/windi-css-uniapp/index.scss';
@import '@/static/scss/index.scss';
</style>
</style>

10
api/system/dict.js

@ -34,4 +34,14 @@ export function getTagData(params) {
codeList: params
}
})
}
/**
* 获取区域
*/
export function getArea() {
return request({
url: `/system/home/getUserArea`,
method: 'GET',
})
}

9
api/task/index.js

@ -31,5 +31,14 @@ export const TaskApi = {
method: 'POST',
data
})
},
/**
* 查询部门树
*/
getDept: () => {
return request({
url: `/system/task-info/appSelectCreateDept`,
method: 'GET',
})
}
}

11
pages/enterprise.vue

@ -29,7 +29,7 @@
}
"
/>
<van-dropdown-item
<!-- <van-dropdown-item
:value="queryParams.st"
:options="getDropdownOption('st')"
@change="
@ -46,7 +46,7 @@
querySelect(v, 'wr')
}
"
/>
/> -->
</van-dropdown-menu>
</view>
@ -126,6 +126,7 @@
marginBottom="12"
v-if="load !== 'nomore' && list.length > 0"
/>
<view style="height: 96rpx; width: 100%" v-else></view>
<cs-emty v-if="list.length == 0"></cs-emty>
</scroll-view>
</view>
@ -233,10 +234,8 @@ export default {
getDropdownOption(key) {
if (!this.dictMap[key]) return []
const keyMap = {
enterprises_area: '按区域',
hy: '按行业',
st: '按生态',
wr: '按污染'
enterprises_area: '执法区域',
hy: '行业类别'
}
if (['enterprises_area'].includes(key)) {
return [

65
pages/index.vue

@ -4,12 +4,12 @@
<view class="drop-box">
<van-dropdown-menu active-color="#17C653">
<van-dropdown-item
:value="queryParams.deptId"
:options="dropOption.dept"
title="按部门"
:value="queryParams.region"
:options="dropOption.area"
title="按乡镇"
@change="
v => {
querySelect(v, 'deptId')
querySelect(v, 'region')
}
"
></van-dropdown-item>
@ -196,7 +196,11 @@
</template>
<script>
import { getDictBatchByType, getDeptTree } from '@/api/system/dict.js'
import {
getDictBatchByType,
getDeptTree,
getArea
} from '@/api/system/dict.js'
import { HomeApi } from '@/api/common/home.js'
export default {
data() {
@ -204,7 +208,7 @@ export default {
dictMap: {},
queryParams: {
selectWeek: '',
deptId: '',
region: '',
type: 1
},
detail: {},
@ -233,19 +237,13 @@ export default {
animation: false
})
await this.getDict()
if (!this.$roles.checkRole(['director'])) {
this.queryParams.deptId = this.$store.getters.deptId
}
// await this.init()
await this.init()
},
onReady() {
this.$nextTick(() => {
this.getPageHeight()
})
},
onShow() {
this.init()
},
methods: {
getPageHeight() {
const query = uni.createSelectorQuery().in(this)
@ -264,35 +262,13 @@ export default {
const dict = await getDictBatchByType({
type: ['select_week'].join(',')
})
const dept = await getDeptTree()
if (!this.$roles.checkRole(['director'])) {
this.dropOption.dept = [
...dept.data
.filter(i => {
return i.id == this.$store.getters.deptId
})
.map(i => {
return {
value: i.id,
text: i.name
}
})
]
} else {
this.dropOption.dept = [
...dept.data.map(i => {
return {
value: i.id,
text: i.name
}
}),
{
value: '',
text: '全部'
}
]
}
const area = await getArea()
this.dropOption.area = area.data.map(i => {
return {
value: i.value,
text: i.label
}
})
this.dropOption.select_week = [
{
value: '',
@ -305,11 +281,9 @@ export default {
}
})
]
this.queryParams.region = this.dropOption.area[0].value
},
async init() {
// if (!this.$roles.checkRole(['director'])) {
// this.queryParams.deptId = this.$store.getters.deptId
// }
const res = await HomeApi.getPieData(this.queryParams)
this.detail = res.data
let curIndex = 0
@ -412,7 +386,6 @@ export default {
refresherrefresh() {
this.init()
},
numFilter(value) {
//
let tempVal = parseFloat(value).toFixed(3)

6
pages/owner.vue

@ -212,7 +212,11 @@ export default {
openSubMessage() {
uni.requestSubscribeMessage({
//ID
tmplIds: ['E8RK91cPLMios6ZHoKx6FJOV4H2kodx6yPWYp7jpLJY'],
tmplIds: [
'2Mfm2TRKwEP4jF_wRaQQ6EfuhHO5c1CQhKiWAl-cm9g',
'DcXH1Zo78EoG25771zxR0JcsUj8TTbG-Go3yT8YAszM',
'E8RK91cPLMios6ZHoKx6FJOV4H2kodx6yPWYp7jpLJY'
],
complete(res) {
uni.navigateTo({
url: '/sub/owner/notic'

32
pages/task.vue

@ -4,11 +4,11 @@
<view class="drop-box">
<van-dropdown-menu active-color="#17C653">
<van-dropdown-item
:value="queryParams.status"
:options="getDropdownOption('task_state')"
:value="queryParams.createDeptId"
:options="getDropdownOption('dept')"
@change="
v => {
querySelect(v, 'status')
querySelect(v, 'createDeptId')
}
"
/>
@ -135,6 +135,7 @@
marginBottom="12"
v-if="load !== 'nomore'"
/>
<view style="height: 96rpx; width: 100%" v-else></view>
<cs-emty marginTop="24" v-if="list.length == 0"></cs-emty>
</scroll-view>
</view>
@ -156,7 +157,7 @@ export default {
pageNo: 1,
zf_lx: '',
priority: '',
status: '',
createDeptId: '',
select_week: '',
tagList: ''
},
@ -201,12 +202,13 @@ export default {
})
)
this.load = 'loadmore'
if (this.list.length == res.data.total) {
if (this.list.length >= res.data.total) {
this.load = 'nomore'
}
uni.hideToast()
},
async getDict() {
const dept = await TaskApi.getDept()
const tags = await getTagData(['zf_lx'].join(','))
const dict = await getDictBatchByType({
type: ['select_week', 'task_state', 'task_priority'].join(',')
@ -217,7 +219,8 @@ export default {
})
this.dictMap = {
...tagMap,
...dict.data
...dict.data,
dept: dept.data
}
},
getDropdownOption(key) {
@ -225,7 +228,7 @@ export default {
const keyMap = {
task_priority: '按等级',
zf_lx: '按类型',
task_state: '按发布',
dept: '按发布',
select_week: '按周期'
}
if (['zf_lx'].includes(key)) {
@ -238,7 +241,8 @@ export default {
}
})
]
} else {
}
if (['dept'].includes(key)) {
return [
{ value: '', text: keyMap[key] },
...this.dictMap[key].map(d => {
@ -249,6 +253,16 @@ export default {
})
]
}
return [
{ value: '', text: keyMap[key] },
...this.dictMap[key].map(d => {
return {
value: d.value,
text: d.label
}
})
]
},
querySelect(v, key) {
this.queryParams[key] = v.detail
@ -292,7 +306,7 @@ export default {
pageNo: 1,
zf_lx: '',
priority: '',
status: '',
createDeptId: '',
select_week: '',
tagList: ''
}

6
sub/enterprise/detail.vue

@ -105,7 +105,11 @@
<view class="wd-flex" style="gap: 18rpx; align-items: center">
<text class="label">资质时限</text>
<view style="color: #071437">
{{ $util.formatDate(prove.expiryDate, 'YYYY年M月D日') }}
{{
prove.qualificationName == 99
? '永久'
: $util.formatDate(prove.expiryDate, 'YYYY/M/D')
}}
</view>
</view>
</view>

6
sub/invite/addEnterprise.vue

@ -214,7 +214,11 @@
<view class="wd-flex" style="gap: 8px; align-items: center">
<text class="label">资质到期</text>
<view class="wd-font-800">
{{ $util.formatDate(p.expiryDate, 'YYYY/M/D') }}
{{
p.qualificationName == 99
? '永久'
: $util.formatDate(p.expiryDate, 'YYYY/M/D')
}}
</view>
</view>
</view>

34
sub/invite/enterpriseTags.vue

@ -33,8 +33,8 @@
</view>
</view>
<!-- 省厅类型 -->
<view class="block">
<!-- 生态类型 -->
<!-- <view class="block">
<view>
<text style="color: #f8285a; margin-right: 4px">*</text>
所属生态
@ -48,10 +48,10 @@
</view>
<u-icon name="arrow-right"></u-icon>
</view>
</view>
</view> -->
<!-- 污染类型 -->
<view class="block">
<!-- <view class="block">
<view>
<text style="color: #f8285a; margin-right: 4px">*</text>
污染类型
@ -65,7 +65,7 @@
</view>
<u-icon name="arrow-right"></u-icon>
</view>
</view>
</view> -->
<u-picker
:show="picker.show"
@ -74,6 +74,7 @@
closeOnClickOverlay
keyName="name"
ref="uPicker"
:defaultIndex="picker.defaultIndex"
@close="closePicker"
@confirm="confirmPicker"
></u-picker>
@ -103,6 +104,7 @@ export default {
show: false,
//
key: null,
defaultIndex: [0],
data: []
}
}
@ -174,20 +176,21 @@ export default {
this.picker.data = [this.dictMap[type] || []]
this.picker.key = type
this.picker.show = true
if (this.form[type]) {
const index = this.dictMap[type].findIndex(
i => i.value == this.form[type].id
)
this.picker.defaultIndex = index > -1 ? [index] : [0]
}
},
submit() {
//
if (
!this.form.qy ||
!this.form.hy ||
!this.form.st ||
!this.form.wr
) {
if (!this.form.qy || !this.form.hy) {
const emptyFields = []
if (!this.form.qy) emptyFields.push('所在区域')
if (!this.form.hy) emptyFields.push('行业类型')
if (!this.form.st) emptyFields.push('所属生态')
if (!this.form.wr) emptyFields.push('污染类型')
// if (!this.form.st) emptyFields.push('')
// if (!this.form.wr) emptyFields.push('')
uni.showToast({
title: `请选择${emptyFields.join('、')}`,
@ -199,10 +202,9 @@ export default {
//
const submitData = {
qy: this.form.qy,
hy: this.form.hy,
st: this.form.st,
wr: this.form.wr
hy: this.form.hy
}
console.log(submitData)
uni.$emit('enterpriseTag', submitData)
uni.navigateBack()
}

4
sub/invite/prove.vue

@ -59,7 +59,7 @@
</view>
</view> -->
<view class="block">
<view class="block" v-if="prove.qualificationName != 99">
<view style="">
<text style="color: #f8285a; margin-right: 4px">*</text>
到期时间
@ -314,6 +314,8 @@ export default {
if (!Object.hasOwn(msgMap, i)) {
return false
}
if (i == 'expiryDate' && this.prove.qualificationName == 99)
return false
if (!this.prove[i] && i) return i
if (typeof this.prove[i] == 'object' && this.prove[i].length == 0)
return i

6
sub/owner/edit.vue

@ -86,11 +86,11 @@
</view>
</view>
<!-- 所属部门 -->
<!-- <view
<view
class="section wd-flex wd-flex-row wd-justify-between wd-items-center"
@click="showPicker('dept', 'deptId')"
>
<text class="wd-font-800">部门</text>
<text style="color: #99a1b7">部门</text>
<view class="wd-flex wd-flex-row wd-items-center" style="gap: 8px">
<text v-if="form.deptId">
{{ $dict.echoDicValue(dictMap.dept, form.deptId) }}
@ -98,7 +98,7 @@
<text class="placeholder" v-else>请选择部门</text>
<u-icon name="arrow-right" color="#99A1B7" size="16"></u-icon>
</view>
</view> -->
</view>
<view class="button-box">
<button class="button audit" v-if="form.audit == 1">
{{ $dict.echoDicValue(dictMap.user_audit_type, form.audit) }}

34
sub/owner/notic.vue

@ -86,36 +86,6 @@ export default {
pageNo: 1
},
list: [],
mock: [
{
id: 1,
title: '全区餐饮环保检查全区餐饮环保检查全区餐饮环保检查...',
time: '2025年3月18日 - 2025年3月18日',
icon: '/static/images/notice-icon.png',
type: 0
},
{
id: 2,
title: '餐饮店卫生检查通知',
time: '2025年3月15日 - 2025年3月20日',
icon: '/static/images/notice-icon.png',
type: 0
},
{
id: 3,
title: '消防安全整改通知',
time: '2025年3月10日 - 2025年3月25日',
icon: '/static/images/notice-icon.png',
type: 1
},
{
id: 4,
title: '营业执照即将到期提醒',
time: '2025年4月1日到期',
icon: '/static/images/notice-icon.png',
type: 1
}
],
dictMap: {},
isRefreshing: false,
hasMore: true //
@ -124,10 +94,10 @@ export default {
onLoad() {
this.getDict()
this.getTabber()
// this.getTabber()
},
onShow() {
this.getList()
this.getTabber()
},
methods: {
async getDict() {

6
sub/task/detail.vue

@ -96,10 +96,9 @@
"
/>
</van-dropdown-menu>
<view style="flex: 0 0 200rpx">
(当前
<view style="flex: 0 0 120rpx">
<text style="color: #17c653">{{ list.length }}</text>
条记录)
条记录
</view>
</view>
</u-sticky>
@ -415,6 +414,7 @@ export default {
if (this.list.length == data.total) {
this.load = 'nomore'
}
uni.stopPullDownRefresh()
uni.hideToast()
},
getUserOption({ detail }) {

10
uni_modules/s-components/s-header/index.vue

@ -1,5 +1,5 @@
<template>
<view class="container">
<view class="container" :style="{ height: height }">
<!-- <view class="fit-content"></view> -->
<view class="operation" v-if="isCustom">
<slot></slot>
@ -23,7 +23,8 @@ export default {
name: 's-header',
data() {
return {
operatStyle: {}
operatStyle: {},
height: '0px'
}
},
props: {
@ -37,9 +38,10 @@ export default {
default: false
}
},
mounted() {
created() {
this.getSetRect()
},
mounted() {},
methods: {
getSetRect() {
const menuButtonInfo = uni.getMenuButtonBoundingClientRect()
@ -47,6 +49,7 @@ export default {
Object.keys(menuButtonInfo).forEach(i => {
this.operatStyle[i] = `${menuButtonInfo[i] * 2}rpx`
})
this.height = `${(menuButtonInfo.bottom + 7) * 2}rpx`
delete this.operatStyle.left
delete this.operatStyle.right
delete this.operatStyle.bottom
@ -63,7 +66,6 @@ export default {
.container {
background-color: #fff;
z-index: 1;
height: 176rpx;
position: relative;
.operation {
position: absolute;

1
wxcomponents/vant/dropdown-menu/index.wxml

@ -11,7 +11,6 @@
>
<view
class="{{ item.titleClass }} {{ utils.bem('dropdown-menu__title', { active: item.showPopup, down: item.showPopup === (direction === 'down') }) }} title-class"
style="{{ item.showPopup ? 'color:' + activeColor : '' }}"
>
<view class="van-ellipsis">
<text class='preffix'>{{item.title}}</text>

2
wxcomponents/vant/dropdown-menu/index.wxss

@ -51,7 +51,7 @@
} */
.van-dropdown-menu__title--active {
color: var(--dropdown-menu-title-active-text-color, #ee0a24)
/* color: var(--dropdown-menu-title-active-text-color, #ee0a24) */
}
.van-ellipsis {

Loading…
Cancel
Save