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 {} return {}
}, },
async onLaunch(options) { 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() 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: { methods: {
// //
initApp() { initApp() {
@ -55,4 +68,4 @@ export default {
<style lang="scss"> <style lang="scss">
@import '@/uni_modules/windi-css-uniapp/index.scss'; @import '@/uni_modules/windi-css-uniapp/index.scss';
@import '@/static/scss/index.scss'; @import '@/static/scss/index.scss';
</style> </style>

10
api/system/dict.js

@ -34,4 +34,14 @@ export function getTagData(params) {
codeList: 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', method: 'POST',
data 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" :value="queryParams.st"
:options="getDropdownOption('st')" :options="getDropdownOption('st')"
@change=" @change="
@ -46,7 +46,7 @@
querySelect(v, 'wr') querySelect(v, 'wr')
} }
" "
/> /> -->
</van-dropdown-menu> </van-dropdown-menu>
</view> </view>
@ -126,6 +126,7 @@
marginBottom="12" marginBottom="12"
v-if="load !== 'nomore' && list.length > 0" 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> <cs-emty v-if="list.length == 0"></cs-emty>
</scroll-view> </scroll-view>
</view> </view>
@ -233,10 +234,8 @@ export default {
getDropdownOption(key) { getDropdownOption(key) {
if (!this.dictMap[key]) return [] if (!this.dictMap[key]) return []
const keyMap = { const keyMap = {
enterprises_area: '按区域', enterprises_area: '执法区域',
hy: '按行业', hy: '行业类别'
st: '按生态',
wr: '按污染'
} }
if (['enterprises_area'].includes(key)) { if (['enterprises_area'].includes(key)) {
return [ return [

65
pages/index.vue

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

6
pages/owner.vue

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

32
pages/task.vue

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

6
sub/enterprise/detail.vue

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

6
sub/invite/addEnterprise.vue

@ -214,7 +214,11 @@
<view class="wd-flex" style="gap: 8px; align-items: center"> <view class="wd-flex" style="gap: 8px; align-items: center">
<text class="label">资质到期</text> <text class="label">资质到期</text>
<view class="wd-font-800"> <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> </view>
</view> </view>

34
sub/invite/enterpriseTags.vue

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

4
sub/invite/prove.vue

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

6
sub/owner/edit.vue

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

34
sub/owner/notic.vue

@ -86,36 +86,6 @@ export default {
pageNo: 1 pageNo: 1
}, },
list: [], 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: {}, dictMap: {},
isRefreshing: false, isRefreshing: false,
hasMore: true // hasMore: true //
@ -124,10 +94,10 @@ export default {
onLoad() { onLoad() {
this.getDict() this.getDict()
this.getTabber() // this.getTabber()
}, },
onShow() { onShow() {
this.getList() this.getTabber()
}, },
methods: { methods: {
async getDict() { async getDict() {

6
sub/task/detail.vue

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

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

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

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

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

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

@ -51,7 +51,7 @@
} */ } */
.van-dropdown-menu__title--active { .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 { .van-ellipsis {

Loading…
Cancel
Save