Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
basic-uniapp-v3
概览
概览
详情
活动
周期分析
版本库
存储库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
1
合并请求
1
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Basic
basic-uniapp-v3
Commits
382aadea
提交
382aadea
authored
11月 11, 2025
作者:
ifzm
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'dev' of
https://gitlab.yiring.com/digital-agri/agri-app
上级
2b898779
3dcec200
全部展开
显示空白字符变更
内嵌
并排
正在显示
17 个修改的文件
包含
274 行增加
和
372 行删除
+274
-372
chanxiao.ts
src/api/model/chanxiao.ts
+1
-1
dict.ts
src/api/model/dict.ts
+17
-0
nongjifuwu.ts
src/api/model/nongjifuwu.ts
+0
-13
chanxiao.vue
src/pages/chanxiao/chanxiao.vue
+3
-2
purchaseXuQiu.vue
src/pages/chanxiao/purchaseXuQiu.vue
+8
-8
supplyXuQiu.vue
src/pages/chanxiao/supplyXuQiu.vue
+18
-13
fuwu.vue
src/pages/fuwu/fuwu.vue
+3
-45
register-dialog.vue
src/pages/linghuoyonggong/components/register-dialog.vue
+4
-8
form.vue
src/pages/linghuoyonggong/form.vue
+49
-58
linghuoyonggong.vue
src/pages/linghuoyonggong/linghuoyonggong.vue
+0
-0
nongchang.vue
src/pages/nongchang/nongchang.vue
+21
-27
apply-dialog.vue
src/pages/nongjifuwu/components/apply-dialog.vue
+34
-7
farm-form.vue
src/pages/nongjifuwu/farm-form.vue
+12
-103
machine-form.vue
src/pages/nongjifuwu/machine-form.vue
+24
-51
nongjifuwu.vue
src/pages/nongjifuwu/nongjifuwu.vue
+5
-36
shouye.vue
src/pages/shouye/shouye.vue
+2
-0
area.ts
src/utils/dict/area.ts
+73
-0
没有找到文件。
src/api/model/chanxiao.ts
浏览文件 @
382aadea
...
...
@@ -4,7 +4,7 @@ import { otherHttp } from '/@/utils/http/axios'
enum
Api
{
purchaseList
=
'/purchaseSell/bizPurchase/list'
,
// 采购需求列表
supplyList
=
'/purchaseSell/bizSupply/list'
,
// 供应需求列表
purchaseSellDetails
=
'/purchaseSell/bizPurchase/queryBy
l
d'
,
// 产销详情
purchaseSellDetails
=
'/purchaseSell/bizPurchase/queryBy
I
d'
,
// 产销详情
purchaseSell
=
'/purchaseSell/bizPurchase/add'
,
// 发布采购需求
supplyAdd
=
'/purchaseSell/bizSupply/add'
,
// 发布供应需求
bizPurchaseSupplyRecord
=
'/purchaseSell/bizPurchaseSupplyRecord/add'
,
// 报价
...
...
src/api/model/dict.ts
0 → 100644
浏览文件 @
382aadea
// 上传请求
import
{
otherHttp
}
from
'/@/utils/http/axios'
enum
Api
{
cascaderHn
=
'/region/cascader/hn'
,
// 获取湖南省内 市/区县/乡镇级联数据
}
/**
* 查询湖南省 市/区县/乡镇
* @returns 市/区县/乡镇
*/
export
function
cascaderHn
()
{
return
otherHttp
.
get
({
url
:
Api
.
cascaderHn
,
})
}
\ No newline at end of file
src/api/model/nongjifuwu.ts
浏览文件 @
382aadea
...
...
@@ -8,7 +8,6 @@ enum Api {
farmMachineAddFarm
=
'/farmMachine/machineWork/app/addFarm'
,
// 发布农活服务
farmMachineEdit
=
'/farmMachine/machineWork/edit'
,
// 编辑农机服务
farmMachineRegister
=
'/farmMachine/machineWork/app/register'
,
// 参与服务
cascaderHn
=
'/region/cascader/hn'
,
}
/**
...
...
@@ -81,13 +80,3 @@ export function farmMachineRegister(params = {}) {
params
,
})
}
\ No newline at end of file
/**
* 查询湖南省 市/区县/乡镇
* @returns 市/区县/乡镇
*/
export
function
cascaderHn
()
{
return
otherHttp
.
get
({
url
:
Api
.
cascaderHn
,
})
}
\ No newline at end of file
src/pages/chanxiao/chanxiao.vue
浏览文件 @
382aadea
...
...
@@ -4,6 +4,7 @@
import
PriceDialog
from
'./components/price-dialog.vue'
import
Navigate
from
'@/utils/page/navigate'
import
*
as
ChanxiaoAPI
from
'@/api/model/chanxiao'
import
{
getText
}
from
'@/utils/dict/area'
// 下拉刷新
onPullDownRefresh
(()
=>
{
...
...
@@ -92,7 +93,7 @@
pageData
.
purchaseDemands
=
[...
pageData
.
purchaseDemands
,
...
records
]
pageData
.
purchaseDemands
=
pageData
.
purchaseDemands
.
map
((
item
)
=>
({
...
item
,
location
:
`
${
item
.
province
}${
item
.
city
}
`
,
location
:
getText
(
`
${
item
.
province
}
,
${
item
.
city
}
,
${
item
.
country
}
`
,
' / '
)
,
}))
pageData
.
total
=
total
})
...
...
@@ -109,7 +110,7 @@
pageData
.
supplyInfos
=
[...
pageData
.
supplyInfos
,
...
records
]
pageData
.
supplyInfos
=
pageData
.
supplyInfos
.
map
((
item
)
=>
({
...
item
,
location
:
`
${
item
.
province
}${
item
.
city
}
`
,
location
:
getText
(
`
${
item
.
province
}
,
${
item
.
city
}
,
${
item
.
country
}
`
,
' / '
)
,
}))
pageData
.
total
=
total
})
...
...
src/pages/chanxiao/purchaseXuQiu.vue
浏览文件 @
382aadea
...
...
@@ -5,7 +5,7 @@
import
{
useGlobSetting
}
from
'/@/hooks/setting'
import
*
as
ChanxiaoAPI
from
'@/api/model/chanxiao'
import
*
as
UserInfoAPI
from
'@/api/model/userInfo'
import
{
area
Tree
,
getCodeByText
,
getTextByCode
}
from
'@/utils/areaDat
a'
import
{
area
Options
,
getText
}
from
'@/utils/dict/are
a'
import
{
useDictStore
}
from
'@/store/modules/dict'
const
dictStore
=
useDictStore
()
...
...
@@ -116,7 +116,7 @@
text
:
item
.
text
,
}
})
pageData
.
options
.
address
=
area
Tree
pageData
.
options
.
address
=
area
Options
}
function
getCurrentAddressInfo
()
{
...
...
@@ -138,7 +138,7 @@ return
function
getDetails
(
id
)
{
ChanxiaoAPI
.
purchaseSellDetails
({
id
}).
then
((
res
)
=>
{
pageData
.
form
=
res
pageData
.
form
.
address
=
`
${
getTextByCode
(
res
.
province
)}
/
${
getTextByCode
(
res
.
city
)}
/
${
getTextByCode
(
res
.
country
)
}
`
pageData
.
form
.
address
=
`
${
res
.
province
}
,
${
res
.
city
}
,
${
res
.
country
}
`
pageData
.
form
.
classifyText
=
pageData
.
options
.
classify
.
find
((
item
)
=>
item
.
value
==
res
.
classify
)?.
text
pageData
.
form
.
imageObj
=
pageData
.
form
.
image
&&
parseUrlInfo
(
pageData
.
form
.
image
)
})
...
...
@@ -170,7 +170,7 @@ return
pageData
.
show
.
classify
=
false
}
function
handleChangeAddress
(
e
)
{
pageData
.
form
.
address
=
e
.
text
.
join
(
'/
'
)
pageData
.
form
.
address
=
e
.
value
.
join
(
',
'
)
pageData
.
show
.
address
=
false
}
...
...
@@ -239,9 +239,9 @@ return
function
changeAddressValue
(
formData
)
{
const
addressValue
=
formData
.
address
.
split
(
'/'
)
if
(
addressValue
.
length
===
3
)
{
formData
.
province
=
getCodeByText
(
addressValue
[
0
])
formData
.
city
=
getCodeByText
(
addressValue
[
1
])
formData
.
country
=
getCodeByText
(
addressValue
[
2
])
formData
.
province
=
addressValue
[
0
]
formData
.
city
=
addressValue
[
1
]
formData
.
country
=
addressValue
[
2
]
}
}
</
script
>
...
...
@@ -314,7 +314,7 @@ return
<text
class=
"label"
>
省/市/区县
</text>
<view
class=
"time-input"
@
click=
"show.address = true"
>
<text
class=
"select-text"
:class=
"
{ placeholder: !form.address }">
{{
form
.
address
||
'请选择省/市/区县'
}}
{{
getText
(
form
.
address
,
' / '
)
||
'请选择省/市/区县'
}}
</text>
</view>
</view>
...
...
src/pages/chanxiao/supplyXuQiu.vue
浏览文件 @
382aadea
...
...
@@ -5,7 +5,7 @@
import
{
useGlobSetting
}
from
'/@/hooks/setting'
import
*
as
ChanxiaoAPI
from
'@/api/model/chanxiao'
import
*
as
UserInfoAPI
from
'@/api/model/userInfo'
import
{
area
Tree
,
getCodeByText
,
getTextByCode
}
from
'@/utils/areaDat
a'
import
{
area
Options
,
getText
}
from
'@/utils/dict/are
a'
import
{
useDictStore
}
from
'@/store/modules/dict'
const
dictStore
=
useDictStore
()
...
...
@@ -124,8 +124,7 @@
const
{
show
,
options
,
form
}
=
toRefs
(
pageData
)
function
initDict
()
{
pageData
.
options
.
address
=
areaTree
console
.
log
(
dictStore
.
getDictList
.
purchase_status
)
pageData
.
options
.
address
=
areaOptions
pageData
.
options
.
status
=
dictStore
.
getDictList
.
purchase_status
.
map
((
item
)
=>
{
return
{
...
...
@@ -159,7 +158,7 @@
function
getDetails
(
id
)
{
ChanxiaoAPI
.
purchaseSellDetails
({
id
}).
then
((
res
)
=>
{
pageData
.
form
=
res
pageData
.
form
.
address
=
`
${
getTextByCode
(
res
.
province
)}
/
${
getTextByCode
(
res
.
city
)}
/
${
getTextByCode
(
res
.
country
)
}
`
pageData
.
form
.
address
=
`
${
res
.
province
}
/
${
res
.
city
}
/
${
res
.
country
}
`
pageData
.
form
.
statusText
=
pageData
.
options
.
status
.
find
((
item
)
=>
item
.
value
==
res
.
status
).
text
pageData
.
form
.
classifyText
=
pageData
.
options
.
classify
.
find
((
item
)
=>
item
.
value
==
res
.
classify
).
text
pageData
.
form
.
imageObj
=
pageData
.
form
.
image
&&
parseUrlInfo
(
pageData
.
form
.
image
)
...
...
@@ -196,7 +195,7 @@
pageData
.
show
.
classify
=
false
}
function
handleChangeAddress
(
e
)
{
pageData
.
form
.
address
=
e
.
text
.
join
(
'/
'
)
pageData
.
form
.
address
=
e
.
value
.
join
(
',
'
)
pageData
.
show
.
address
=
false
}
function
handleChangeStatus
(
e
)
{
...
...
@@ -268,11 +267,11 @@
* @param formData 表单数据
*/
function
changeAddressValue
(
formData
)
{
const
addressValue
=
formData
.
address
.
split
(
'
/
'
)
const
addressValue
=
formData
.
address
.
split
(
'
,
'
)
if
(
addressValue
.
length
===
3
)
{
formData
.
province
=
getCodeByText
(
addressValue
[
0
])
formData
.
city
=
getCodeByText
(
addressValue
[
1
])
formData
.
country
=
getCodeByText
(
addressValue
[
2
])
formData
.
province
=
addressValue
[
0
]
formData
.
city
=
addressValue
[
1
]
formData
.
country
=
addressValue
[
2
]
}
}
...
...
@@ -315,7 +314,7 @@
<text
class=
"label"
style=
"font-size: 28rpx"
>
请选择区域
</text>
<view
class=
"select-input"
@
click=
"show.address = true"
>
<text
class=
"time-text"
:class=
"
{ placeholder: !form.address }">
{{
form
.
address
||
'请选择区域
'
}}
{{
getText
(
form
.
address
,
' / '
)
||
'请选择省/市/区县
'
}}
</text>
</view>
</view>
...
...
@@ -327,12 +326,16 @@
<text
class=
"label"
style=
"font-size: 28rpx"
>
供应时间
</text>
<view
class=
"time-range"
>
<view
class=
"time-input"
@
click=
"show.time1 = true"
>
<text
class=
"time-text"
:class=
"
{ placeholder: !form.supplyStartDate }">
{{
form
.
supplyStartDate
||
'开始时间'
}}
<text
class=
"time-text"
:class=
"
{ placeholder: !form.supplyStartDate }" style="font-size: 26rpx">
{{
form
.
supplyStartDate
||
'开始时间'
}}
</text>
</view>
<text
class=
"time-separator"
>
-
</text>
<view
class=
"time-input"
@
click=
"show.time2 = true"
>
<text
class=
"time-text"
:class=
"
{ placeholder: !form.supplyEndDate }">
{{
form
.
supplyEndDate
||
'结束时间'
}}
<text
class=
"time-text"
:class=
"
{ placeholder: !form.supplyEndDate }" style="font-size: 26rpx">
{{
form
.
supplyEndDate
||
'结束时间'
}}
</text>
...
...
@@ -380,6 +383,7 @@
background-color
:
#e6f5e8
;
width
:
750
rpx
;
overflow-x
:
hidden
;
.mt20
{
margin-top
:
30
rpx
;
background
:
#fff
;
...
...
@@ -392,7 +396,7 @@
margin
:
30
rpx
auto
;
}
.
supply
-form
{
.
purchase
-form
{
background
:
transparent
;
}
...
...
@@ -422,6 +426,8 @@
//
添加点击区域样式
.select-input
{
position
:
relative
;
}
}
.form-row
{
display
:
flex
;
...
...
@@ -587,6 +593,7 @@
}
}
}
::v-deep
.uni-input-placeholder
{
font-size
:
28
rpx
!important
;
color
:
#999999
!important
;
...
...
@@ -609,6 +616,4 @@
margin-bottom
:
0
;
padding
:
0
;
}
}
}
</
style
>
src/pages/fuwu/fuwu.vue
浏览文件 @
382aadea
...
...
@@ -75,7 +75,7 @@
title
:
'季节性用工'
,
description
:
'三农区域灵活用工服务'
,
actionText
:
'去发布'
,
url
:
'/pages/
nongjifuwu/farm-form
'
,
url
:
'/pages/
linghuoyonggong/linghuoyonggong?type=1
'
,
},
{
id
:
2
,
...
...
@@ -208,42 +208,10 @@
// 技能培训日历
trainingCalendar
:
{
days
:
[
{
id
:
1
,
month
:
'09月'
,
day
:
'10'
},
{
id
:
2
,
month
:
'09月'
,
day
:
'11'
},
{
id
:
3
,
month
:
'09月'
,
day
:
'12'
,
active
:
true
},
{
id
:
4
,
month
:
'09月'
,
day
:
'13'
},
{
id
:
5
,
month
:
'09月'
,
day
:
'14'
},
{
id
:
6
,
month
:
'09月'
,
day
:
'15'
},
{
id
:
7
,
month
:
'09月'
,
day
:
'16'
},
],
trainings
:
[
{
id
:
1
,
time
:
'09:30'
,
title
:
'有机农业种植技术'
,
description
:
'农技专家指导授课'
,
actionText
:
'报名'
,
badge
:
'机'
,
badgeType
:
'orange'
,
},
{
id
:
2
,
time
:
'14:00'
,
title
:
'有机农业种植技术'
,
description
:
'拖拉机专用技能'
,
actionText
:
'查看'
,
badge
:
'政'
,
badgeType
:
'blue'
,
},
{
id
:
3
,
time
:
'09:30'
,
title
:
'有机农业种植技术'
,
description
:
'农技专家指导授课'
,
actionText
:
'报名'
,
badge
:
'证'
,
badgeType
:
'green'
,
},
],
},
})
...
...
@@ -389,15 +357,6 @@
<view
class=
"codefun-flex-col section"
>
<view
class=
"codefun-flex-col group_2"
>
<view
class=
"codefun-flex-col"
>
<!--
<view
class=
"codefun-flex-row codefun-justify-center codefun-items-center codefun-relative group_3"
>
<text
class=
"font text"
>
{{
pageData
.
header
.
title
}}
</text>
<image
class=
"image_6 pos_2"
src=
"/static/images/codefun/2d7ca3ba49afaa9f885afb0ba601a403.png"
/>
</view>
-->
<view
class=
"codefun-flex-col"
>
<view
class=
"codefun-flex-row codefun-items-center section_2"
>
<text
class=
"codefun-shrink-0 font_2"
>
岗位
</text>
...
...
@@ -659,7 +618,6 @@
</view>
</view>
<view
class=
"codefun-flex-col codefun-mt-24"
>
<text
class=
"codefun-self-start font_5 text_40"
>
技能培训
</text>
<view
class=
"codefun-flex-col codefun-self-stretch codefun-mt-18"
>
<view
class=
"codefun-flex-col codefun-justify-start section_17"
>
<view
class=
"codefun-flex-row equal-division_4"
>
...
...
src/pages/linghuoyonggong/components/register-dialog.vue
浏览文件 @
382aadea
...
...
@@ -28,6 +28,7 @@
],
})
function
open
(
params
)
{
reset
()
pageData
.
form
.
employmentId
=
params
.
id
pageData
.
form
.
userId
=
getUserInfo
.
id
pageData
.
show
=
true
...
...
@@ -72,15 +73,10 @@
</view>
<view
class=
"text-left"
>
<fui-form
ref=
"formRef"
>
<fui-input
marginTop=
"30"
size=
"28"
placeholder=
"请填写预留姓名"
v-model=
"pageData.form.reservedname"
/>
<fui-input
marginTop=
"30"
size=
"28"
placeholder=
"请填写预留手机"
v-model=
"pageData.form.reservedmobile"
/>
<fui-input
marginTop=
"30"
size=
"28"
placeholder=
"请填写预留姓名"
v-model=
"pageData.form.reservedname"
required
maxlength=
"16"
placeholderStyle=
"margin-left: 10rpx"
/>
<fui-input
marginTop=
"30"
size=
"28"
placeholder=
"请填写预留手机"
v-model=
"pageData.form.reservedmobile"
required
type=
"number"
maxlength=
"11"
placeholderStyle=
"margin-left: 10rpx"
/>
<view
style=
"margin-top: 30rpx"
>
<fui-button
text=
"
确定
"
bold
radius=
"96rpx"
@
click=
"submit"
/>
<fui-button
text=
"
提交
"
bold
radius=
"96rpx"
@
click=
"submit"
/>
</view>
</fui-form>
</view>
...
...
src/pages/linghuoyonggong/form.vue
浏览文件 @
382aadea
...
...
@@ -7,6 +7,7 @@
import
*
as
UserInfoAPI
from
'@/api/model/userInfo'
import
{
areaTree
,
getCodeByText
,
getTextByCode
}
from
'@/utils/areaData'
import
{
useDictStore
}
from
'@/store/modules/dict'
import
{
areaOptions
}
from
'@/utils/dict/area'
const
dictStore
=
useDictStore
()
const
userStore
=
useUserStore
()
...
...
@@ -63,56 +64,46 @@
},
rules
:
[
{
name
:
'
nam
e'
,
name
:
'
typ
e'
,
rule
:
[
'required'
],
msg
:
[
'请输入名称'
],
},
{
name
:
'workers'
,
msg
:
[
'请选择用工类型'
],
},{
name
:
'name'
,
rule
:
[
'required'
],
msg
:
[
'请输入工作内容'
],
},
{
msg
:
[
'请输入标题'
],
},
{
name
:
'workers'
,
rule
:
[
'required'
],
msg
:
[
'请输入工人数量'
],
},
{
},
{
name
:
'price'
,
rule
:
[
'required'
],
msg
:
[
'请输入价钱'
],
},
{
name
:
'type'
,
msg
:
[
'请输入用工单价'
],
},
{
name
:
'starttime'
,
rule
:
[
'required'
],
msg
:
[
'请选择类型'
],
},
{
msg
:
[
'请选择开始时间'
],
},
{
name
:
'estimatedendtime'
,
rule
:
[
'required'
],
msg
:
[
'请选择预计结束时间'
],
},
{
name
:
'content'
,
rule
:
[
'required'
],
msg
:
[
'请输入工作内容'
],
},
{
name
:
'area'
,
rule
:
[
'required'
],
msg
:
[
'请选择地区'
],
},
{
},
{
name
:
'address'
,
rule
:
[
'required'
],
msg
:
[
'请选择详细地址'
],
},
{
msg
:
[
'请输入详细地址'
],
},
{
name
:
'urgentdegree'
,
rule
:
[
'required'
],
msg
:
[
'请选择紧急程度'
],
},
{
name
:
'starttime'
,
rule
:
[
'required'
],
msg
:
[
'请选择开始时间'
],
},
{
name
:
'estimatedendtime'
,
rule
:
[
'required'
],
msg
:
[
'请选择预计结束时间'
],
},
{
},
{
name
:
'picture'
,
rule
:
[
'required'
],
msg
:
[
'请上传图片'
],
...
...
@@ -123,9 +114,7 @@
const
{
show
,
options
,
form
}
=
toRefs
(
pageData
)
function
initDict
()
{
pageData
.
options
.
area
=
areaTree
console
.
log
(
dictStore
.
getDictList
.
purchase_status
)
pageData
.
options
.
area
=
areaOptions
pageData
.
options
.
urgentdegree
=
dictStore
.
getDictList
.
employment_urgent
.
map
((
item
)
=>
{
return
{
value
:
item
.
value
,
...
...
@@ -142,7 +131,7 @@
function
getCurrentAddressInfo
()
{
if
(
!
uni
.
getStorageSync
(
'location'
))
return
return
const
{
lon
,
lat
}
=
uni
.
getStorageSync
(
'location'
)
UserInfoAPI
.
location
({
...
...
@@ -288,18 +277,16 @@ return
<view
class=
"formBox"
>
<fui-form
ref=
"formRef"
label-weight=
"auto"
top=
"60"
:disabled=
"form.id ? true : false"
>
<view
class=
"mt20"
>
<fui-input
required
label=
"
名称"
placeholder=
"请输入名称"
v-model=
"form.name"
labelSize=
"28"
label-width=
"180
"
/>
<fui-input
required
label=
"
工作内容"
placeholder=
"请输入工作内容"
v-model=
"form.content"
labelSize=
"28"
label-width=
"180"
/>
<fui-input
required
label=
"
用工类型"
placeholder=
"请选择用工类型"
v-model=
"form.typeText"
labelSize=
"28"
size=
"28"
label-width=
"180"
@
click=
"show.type = true
"
/>
<fui-input
required
label=
"
标题"
placeholder=
"请输入标题"
v-model=
"form.name"
labelSize=
"28"
label-width=
"180"
maxlength=
"16"
size=
"28"
/>
</view>
<view
class=
"mt20"
>
<fui-input
required
type=
"number"
:min=
"0"
label=
"工人数量"
placeholder=
"请输入工人数量"
v-model=
"form.workers"
labelSize=
"28"
label-width=
"180"
/>
<fui-input
required
type=
"number"
label=
"价钱"
:min=
"0"
placeholder=
"请输入价钱"
v-model=
"form.price"
labelSize=
"28"
label-width=
"180"
/>
<fui-input
required
label=
"类型"
placeholder=
"请选择类型"
v-model=
"form.typeText"
labelSize=
"28"
label-width=
"180"
@
click=
"show.type = true"
/>
</view>
<view
class=
"mt20"
>
<fui-input
required
label=
"地区"
placeholder=
"请选择地区"
v-model=
"form.areaText"
labelSize=
"28"
label-width=
"180"
@
click=
"show.area = true"
/>
<fui-input
required
label=
"详细地址"
placeholder=
"请输入详细地址"
v-model=
"form.address"
labelSize=
"28"
label-width=
"180"
/>
<fui-input
required
label=
"紧急程度"
placeholder=
"请选择紧急程度"
v-model=
"form.urgentdegreeText"
labelSize=
"28"
label-width=
"180"
@
click=
"show.urgentdegree = true"
/>
<fui-input
required
type=
"number"
:min=
"0"
label=
"工人数量"
placeholder=
"请输入工人数量"
v-model=
"form.workers"
labelSize=
"28"
label-width=
"180"
maxlength=
"4"
size=
"28"
>
<view
slot=
"suffix"
class=
"unit-slot"
>
人
</view>
</fui-input>
<fui-input
required
type=
"number"
label=
"用工单价"
:min=
"0"
placeholder=
"请输入用工单价"
v-model=
"form.price"
labelSize=
"28"
label-width=
"180"
maxlength=
"6"
size=
"28"
>
<view
slot=
"suffix"
class=
"unit-slot"
>
元/人
</view>
</fui-input>
<!-- 时间范围 -->
<view
class=
"form-section"
style=
"padding: 0 30rpx"
>
<view
class=
"form-item flex align-center"
>
...
...
@@ -310,7 +297,7 @@ return
{{
form
.
starttime
||
'开始时间'
}}
</text>
</view>
<text
class=
"time-separator"
>
-
</text>
<text
class=
"time-separator"
>
至
</text>
<view
class=
"time-input"
@
click=
"show.time2 = true"
>
<text
class=
"time-text"
:class=
"
{ placeholder: !form.estimatedendtime }">
{{
form
.
estimatedendtime
||
'结束时间'
}}
...
...
@@ -319,17 +306,16 @@ return
</view>
</view>
</view>
<fui-input
required
label=
"工作内容"
placeholder=
"请输入工作内容"
v-model=
"form.content"
labelSize=
"28"
label-width=
"180"
maxlength=
"32"
size=
"28"
/>
</view>
<view
class=
"mt20"
>
<fui-input
required
label=
"地区"
placeholder=
"请选择地区"
v-model=
"form.areaText"
labelSize=
"28"
label-width=
"180"
@
click=
"show.area = true"
size=
"28"
/>
<fui-input
required
label=
"详细地址"
placeholder=
"请输入详细地址"
v-model=
"form.address"
labelSize=
"28"
label-width=
"180"
size=
"28"
/>
<fui-input
required
label=
"紧急程度"
placeholder=
"请选择紧急程度"
v-model=
"form.urgentdegreeText"
labelSize=
"28"
label-width=
"180"
size=
"28"
@
click=
"show.urgentdegree = true"
/>
</view>
<view
class=
"bg-white mt20"
style=
"padding: 0.875rem 1rem"
>
<view
class=
"mb-1 flex justify-start"
><span
style=
"color: red;"
>
*
</span>
图片
</view>
<uni-file-picker
:value=
"form.pictureObj"
ref=
"uploadRef"
limit=
"1"
:auto-upload=
"false"
@
select=
"handleUpload"
@
delete=
"handleDelete"
/>
<view
class=
"mb-1 flex justify-start"
style=
"font-size: 28rpx;"
><span
style=
"color: red;"
>
*
</span>
图片
</view>
<uni-file-picker
:value=
"form.pictureObj"
ref=
"uploadRef"
limit=
"1"
:auto-upload=
"false"
@
select=
"handleUpload"
@
delete=
"handleDelete"
/>
</view>
<view
class=
"fui-btn__box"
v-if=
"!form.id"
style=
"margin-top: 30rpx"
>
<fui-button
text=
"发布用工"
bold
radius=
"96rpx"
@
click=
"submit"
/>
...
...
@@ -517,4 +503,9 @@ return
margin-bottom
:
0
;
padding
:
0
;
}
.unit-slot
{
padding
:
0
16
rpx
;
color
:
#333
;
font-size
:
28
rpx
;
}
</
style
>
src/pages/linghuoyonggong/linghuoyonggong.vue
浏览文件 @
382aadea
差异被折叠。
点击展开。
src/pages/nongchang/nongchang.vue
浏览文件 @
382aadea
...
...
@@ -19,6 +19,8 @@
getCommonToolsList
()
// 农技课堂
getAgricultureClassList
()
// 智能设备
getDeviceList
()
})
// 下拉刷新
...
...
@@ -176,28 +178,11 @@
],
// 智能设备
smartDevices
:
[
{
id
:
1
,
name
:
'土壤监测仪'
,
image
:
'/static/images/codefun/8bd62352939b47e71f09a93a6ab344b2.png'
,
status
:
'在线'
,
statusColor
:
'#13e000'
,
},
{
id
:
2
,
name
:
'监测仪A'
,
image
:
'/static/images/codefun/81937c2666c800cf5966c29c2891b7c4.png'
,
status
:
'掉线'
,
statusColor
:
'#75777c'
,
},
{
id
:
3
,
name
:
'监测仪B'
,
image
:
'/static/images/codefun/8bd62352939b47e71f09a93a6ab344b2.png'
,
status
:
'在线'
,
statusColor
:
'#13e000'
,
},
smartDevices
:
[],
smartDeviceIcon
:
[
'/static/images/codefun/8bd62352939b47e71f09a93a6ab344b2.png'
,
'/static/images/codefun/81937c2666c800cf5966c29c2891b7c4.png'
,
],
// 信用中心
...
...
@@ -272,6 +257,12 @@
})
}
function
getDeviceList
()
{
NongChangAPI
.
getDeviceList
({}).
then
((
res
)
=>
{
pageData
.
smartDevices
=
res
.
records
})
}
// 菜单点击事件
function
onMenuItemClick
(
item
:
any
)
{
console
.
log
(
'点击菜单项:'
,
item
)
...
...
@@ -738,9 +729,12 @@
:key=
"device.id"
class=
"section_16 codefun-flex-row codefun-justify-center codefun-items-center codefun-shrink-0 codefun-relative"
>
<image
class=
"image_13"
:src=
"device.image"
/>
<image
class=
"image_13"
:src=
"device.isOnline === 1 ? pageData.smartDeviceIcon[0] : pageData.smartDeviceIcon[1]"
/>
<view
class=
"codefun-ml-8 codefun-flex-col"
>
<text
class=
"font_1
4"
:class=
"`text_${58 + index}`"
>
{{ device.n
ame }}
</text>
<text
class=
"font_1
0"
>
{{ device.deviceN
ame }}
</text>
<view
class=
"codefun-mt-10 codefun-flex-row codefun-items-center"
>
<view
class=
"section_17"
v-if=
"index !== 1"
/>
<view
class=
"section_18"
v-if=
"index === 1"
/>
...
...
@@ -749,7 +743,7 @@
:class=
"index !== 1 ? 'text_59' : 'text_60'"
:style=
"{ color: device.statusColor }"
>
{{ device.
status
}}
{{ device.
isOnline_dictText
}}
</text>
</view>
</view>
...
...
@@ -1773,8 +1767,8 @@
.image_13
{
border-radius
:
24
rpx
;
width
:
92
rpx
;
height
:
92
rpx
;
width
:
75
rpx
;
height
:
75
rpx
;
}
.font_14
{
...
...
src/pages/nongjifuwu/components/apply-dialog.vue
浏览文件 @
382aadea
...
...
@@ -2,11 +2,19 @@
import
{
reactive
}
from
'vue'
import
*
as
NongjifuwuAPI
from
'@/api/model/nongjifuwu'
import
{
useUserStore
}
from
'@/store/modules/user'
import
{
areaOptions
,
getText
}
from
'@/utils/dict/area'
const
{
getUserInfo
}
=
useUserStore
()
const
pageData
=
reactive
({
show
:
false
,
areaShow
:
{
time
:
false
,
classify
:
false
,
address
:
false
,
},
options
:
null
,
scopeText
:
null
,
content
:
''
,
form
:
{
machineId
:
''
,
...
...
@@ -65,6 +73,7 @@
}
function
open
(
params
)
{
reset
()
pageData
.
form
.
machineId
=
params
.
id
pageData
.
form
.
serviceType
=
params
.
serviceType
pageData
.
form
.
userId
=
getUserInfo
.
id
...
...
@@ -72,6 +81,7 @@
}
function
close
()
{
pageData
.
show
=
false
pageData
.
areaShow
.
address
=
false
}
function
reset
()
{
pageData
.
form
=
{
...
...
@@ -86,6 +96,7 @@
phone
:
''
,
demand
:
''
,
}
pageData
.
scopeText
=
null
}
const
formRef
=
ref
()
function
submit
()
{
...
...
@@ -102,6 +113,14 @@
}
})
}
function
handleChangeAddress
(
e
)
{
pageData
.
form
.
scope
=
e
.
value
.
join
(
','
)
pageData
.
scopeText
=
getText
(
pageData
.
form
.
scope
,
' / '
)
pageData
.
areaShow
.
address
=
false
}
onShow
(()
=>
{
pageData
.
options
=
areaOptions
})
defineExpose
({
open
,
close
,
...
...
@@ -111,23 +130,31 @@
<
template
>
<fui-dialog
title=
""
:buttons=
"[]"
:show=
"pageData.show"
maskClosable
>
<view
class=
"title flex justify-center"
>
<view
class=
"flex-1"
>
我有需要
</view>
<view
class=
"flex-1"
>
预约表单
</view>
<fui-icon
class=
"close flex-basis"
name=
"close"
size=
"46"
color=
"#999999"
@
click=
"close"
/>
</view>
<view
class=
"text-left"
>
<fui-form
ref=
"formRef"
>
<fui-input
marginTop=
"30"
size=
"24"
placeholder=
"请填写手机号码"
v-model=
"pageData.form.phone"
required
/>
<fui-input
marginTop=
"30"
size=
"24"
placeholder=
"请选择作业区域"
v-model=
"pageData.form.scope"
required
/>
<fui-input
marginTop=
"30"
size=
"24"
placeholder=
"请填写详细地址"
v-model=
"pageData.form.address"
required
/>
<fui-input
marginTop=
"30"
size=
"24"
placeholder=
"请选择作业时间"
v-model=
"pageData.form.time"
@
click=
"dict.show.time = true"
required
/>
<fui-textarea
v-model=
"pageData.form.demand"
:marginTop=
"30"
size=
"24"
placeholder=
"简要说明作业需求"
required
/>
<fui-input
marginTop=
"30"
size=
"24"
type=
"number"
maxlength=
"11"
placeholder=
"请填写手机号码"
v-model=
"pageData.form.phone"
required
placeholderStyle=
"margin-left: 10rpx;"
/>
<fui-input
marginTop=
"30"
size=
"24"
disabled
@
click=
"pageData.areaShow.address = true"
placeholder=
"请选择作业区域"
v-model=
"pageData.scopeText"
required
placeholderStyle=
"margin-left: 10rpx;"
/>
<fui-input
marginTop=
"30"
size=
"24"
placeholder=
"请填写详细地址"
v-model=
"pageData.form.address"
required
placeholderStyle=
"margin-left: 10rpx;"
/>
<fui-input
marginTop=
"30"
size=
"24"
placeholder=
"请选择作业时间"
v-model=
"pageData.form.time"
@
click=
"dict.show.time = true"
required
placeholderStyle=
"margin-left: 10rpx;"
/>
<fui-textarea
v-model=
"pageData.form.demand"
:marginTop=
"30"
size=
"24"
placeholder=
"简要说明作业需求"
flexStart
required
placeholderStyle=
"margin-left: 10rpx;"
/>
<view
style=
"margin-top: 30rpx"
>
<fui-button
type=
"warning"
text=
"
确定
"
bold
radius=
"96rpx"
@
click=
"submit"
/>
<fui-button
type=
"warning"
text=
"
提交
"
bold
radius=
"96rpx"
@
click=
"submit"
/>
</view>
</fui-form>
</view>
</fui-dialog>
<fui-date-picker
:show=
"dict.show.time"
type=
"3"
range
@
change=
"handleTimeChange"
@
cancel=
"handleTimeCancel"
/>
<fui-picker
:show=
"pageData.areaShow.address"
:options=
"pageData.options"
:linkage=
"true"
:layer=
"3"
@
change=
"handleChangeAddress"
@
cancel=
"pageData.areaShow.address = false"
/>
</
template
>
<
style
lang=
"scss"
scoped
>
...
...
src/pages/nongjifuwu/farm-form.vue
浏览文件 @
382aadea
...
...
@@ -4,6 +4,7 @@
import
{
useUserStore
}
from
'@/store/modules/user'
import
{
useGlobSetting
}
from
'/@/hooks/setting'
import
*
as
nongjifuwu
from
'@/api/model/nongjifuwu'
import
{
areaOptions
,
getText
}
from
'@/utils/dict/area'
const
userStore
=
useUserStore
()
const
globSetting
=
useGlobSetting
()
...
...
@@ -92,41 +93,7 @@
const
{
show
,
options
,
form
}
=
toRefs
(
pageData
)
function
initDict
()
{
nongjifuwu
.
cascaderHn
().
then
((
res
)
=>
{
pageData
.
options
.
address
=
JSON
.
parse
(
JSON
.
stringify
(
res
[
0
].
children
).
replaceAll
(
'label'
,
'text'
))
})
}
function
getScope
(
scope
:
any
)
{
if
(
!
scope
||
!
pageData
.
options
.
address
)
{
return
''
}
const
values
=
scope
.
split
(
','
)
const
labels
=
[]
// 递归查找label
const
findLabel
=
(
nodes
,
value
)
=>
{
for
(
const
node
of
nodes
)
{
if
(
node
.
value
===
value
)
{
return
node
.
text
}
if
(
node
.
children
&&
node
.
children
.
length
>
0
)
{
const
found
=
findLabel
(
node
.
children
,
value
)
if
(
found
)
{
return
found
}
}
}
return
null
// 如果没找到,返回原始value
}
for
(
const
value
of
values
)
{
const
text
=
findLabel
(
pageData
.
options
.
address
,
value
.
trim
())
labels
.
push
(
text
)
}
return
labels
?
labels
.
join
(
' / '
)
:
''
pageData
.
options
.
address
=
areaOptions
}
function
getDetails
(
id
)
{
...
...
@@ -244,50 +211,20 @@
<view
class=
"formBox"
>
<fui-form
ref=
"formRef"
label-weight=
"auto"
top=
"60"
:disabled=
"form.id ? true : false"
>
<view
class=
"mt20"
>
<fui-input
required
label=
"服务名称"
placeholder=
"请输入服务名称"
v-model=
"form.name"
labelSize=
"28"
label-width=
"180"
/>
<fui-input
required
label=
"服务名称"
placeholder=
"请输入服务名称"
v-model=
"form.name"
labelSize=
"28"
label-width=
"180"
maxlength=
"16"
/>
<view
class=
"form-item required flex align-center"
style=
"padding: 20rpx 10rpx"
>
<text
class=
"label"
>
服务范围
</text>
<view
class=
"time-input"
@
click=
"show.address = true"
>
<text
class=
"select-text"
:class=
"
{ placeholder: !pageData.form.scope }">
{{
get
Scope
(
pageData
.
form
.
scope
)
||
'请选择市/区县/乡镇'
}}
{{
get
Text
(
pageData
.
form
.
scope
,
' / '
)
||
'请选择市/区县/乡镇'
}}
</text>
</view>
</view>
<fui-input
required
label=
"详细地址"
placeholder=
"请输入详细地址"
v-model=
"form.address"
labelSize=
"28"
label-width=
"180"
/>
<fui-input
required
type=
"number"
label=
"联系方式"
placeholder=
"请填写联系方式"
v-model=
"form.phone"
labelSize=
"28"
label-width=
"180"
:maxlength=
"11"
/>
<fui-input
required
label=
"详细地址"
placeholder=
"请输入详细地址"
v-model=
"form.address"
labelSize=
"28"
label-width=
"180"
size=
"28"
/>
<fui-input
required
type=
"number"
label=
"联系方式"
placeholder=
"请填写联系方式"
v-model=
"form.phone"
labelSize=
"28"
label-width=
"180"
:maxlength=
"11"
/>
</view>
<view
class=
"mt20"
>
<fui-input
required
label=
"作业需求"
placeholder=
"请输入作业需求"
v-model=
"form.demand"
labelSize=
"28"
label-width=
"180"
/>
<fui-textarea
flexStart
required
label=
"作业需求"
placeholder=
"请输入作业需求"
v-model=
"form.demand"
labelSize=
"28"
label-width=
"180"
placeholder-style=
"font-size: 28rpx;"
/>
<!-- 作业时间 -->
<view
class=
"form-section"
style=
"padding: 0 10rpx"
>
<view
class=
"form-item flex align-center"
>
...
...
@@ -310,46 +247,18 @@
</view>
<view
class=
"bg-white mt20"
style=
"padding: 0.875rem 1rem"
>
<view
class=
"mb-1 flex justify-start"
>
图片
</view>
<uni-file-picker
:value=
"form.pictureObj"
ref=
"uploadRef"
limit=
"1"
:auto-upload=
"false"
@
select=
"handleUpload"
@
delete=
"handleDelete"
/>
<view
class=
"mb-1 flex justify-start"
style=
"font-size:28rpx;"
><span
class=
"text-red"
>
*
</span>
图片
</view>
<uni-file-picker
:value=
"form.pictureObj"
ref=
"uploadRef"
limit=
"1"
:auto-upload=
"false"
@
select=
"handleUpload"
@
delete=
"handleDelete"
/>
</view>
<view
class=
"fui-btn__box"
v-if=
"!form.id"
style=
"margin-top: 30rpx"
>
<fui-button
text=
"发布作业"
bold
radius=
"96rpx"
@
click=
"submit"
/>
</view>
</fui-form>
<fui-date-picker
:show=
"show.time1"
type=
"3"
@
change=
"handleChangeTime1"
@
cancel=
"show.time1 = false"
:minDate=
"getCurrentDate()"
/>
<fui-date-picker
:show=
"show.time2"
type=
"3"
@
change=
"handleChangeTime2"
@
cancel=
"show.time2 = false"
:minDate=
"getCurrentDate()"
/>
<fui-date-picker
:show=
"show.time1"
type=
"3"
@
change=
"handleChangeTime1"
@
cancel=
"show.time1 = false"
:minDate=
"getCurrentDate()"
/>
<fui-date-picker
:show=
"show.time2"
type=
"3"
@
change=
"handleChangeTime2"
@
cancel=
"show.time2 = false"
:minDate=
"getCurrentDate()"
/>
<fui-toast
ref=
"toastRef"
/>
<fui-loading
isFixed
v-if=
"pageData.loading"
backgroundColor=
"rgba(0, 0, 0, 0.4)"
/>
<fui-picker
:show=
"show.address"
:options=
"options.address"
:linkage=
"true"
:layer=
"3"
@
change=
"handleChangeAddress"
@
cancel=
"show.address = false"
/>
<fui-picker
:show=
"show.address"
:options=
"options.address"
:linkage=
"true"
:layer=
"3"
@
change=
"handleChangeAddress"
@
cancel=
"show.address = false"
/>
</view>
</view>
</
template
>
...
...
src/pages/nongjifuwu/machine-form.vue
浏览文件 @
382aadea
...
...
@@ -4,6 +4,7 @@
import
{
useUserStore
}
from
'@/store/modules/user'
import
{
useGlobSetting
}
from
'/@/hooks/setting'
import
*
as
nongjifuwu
from
'@/api/model/nongjifuwu'
import
{
areaOptions
,
getText
}
from
'@/utils/dict/area'
const
userStore
=
useUserStore
()
const
globSetting
=
useGlobSetting
()
...
...
@@ -52,7 +53,7 @@
{
name
:
'name'
,
rule
:
[
'required'
],
msg
:
[
'请填写
农机名称
'
],
msg
:
[
'请填写
作业标题
'
],
},
{
name
:
'name'
,
...
...
@@ -79,41 +80,7 @@
const
{
show
,
options
,
form
}
=
toRefs
(
pageData
)
function
initDict
()
{
nongjifuwu
.
cascaderHn
().
then
((
res
)
=>
{
pageData
.
options
.
address
=
JSON
.
parse
(
JSON
.
stringify
(
res
[
0
].
children
).
replaceAll
(
'label'
,
'text'
))
})
}
function
getScope
(
scope
:
any
)
{
if
(
!
scope
||
!
pageData
.
options
.
address
)
{
return
''
}
const
values
=
scope
.
split
(
','
)
const
labels
=
[]
// 递归查找label
const
findLabel
=
(
nodes
,
value
)
=>
{
for
(
const
node
of
nodes
)
{
if
(
node
.
value
===
value
)
{
return
node
.
text
}
if
(
node
.
children
&&
node
.
children
.
length
>
0
)
{
const
found
=
findLabel
(
node
.
children
,
value
)
if
(
found
)
{
return
found
}
}
}
return
null
// 如果没找到,返回原始value
}
for
(
const
value
of
values
)
{
const
text
=
findLabel
(
pageData
.
options
.
address
,
value
.
trim
())
labels
.
push
(
text
)
}
return
labels
?
labels
.
join
(
' / '
)
:
''
pageData
.
options
.
address
=
areaOptions
}
function
getDetails
(
id
)
{
...
...
@@ -217,11 +184,13 @@
<view
class=
"mt20"
>
<fui-input
required
label=
"
农机名称
"
placeholder=
"请输入
农机名称
"
label=
"
作业标题
"
placeholder=
"请输入
作业标题
"
v-model=
"form.name"
labelSize=
"28"
label-width=
"180"
maxlength=
"16"
size=
"28"
/>
<fui-input
required
...
...
@@ -230,38 +199,37 @@
v-model=
"form.phone"
labelSize=
"28"
label-width=
"180"
type=
"number"
maxlength=
"11"
size=
"28"
/>
<view
class=
"form-item required flex align-center"
style=
"padding: 20rpx 10rpx"
>
<text
class=
"label"
>
服务范围
</text>
<view
class=
"time-input"
@
click=
"show.address = true"
>
<text
class=
"select-text"
:class=
"
{ placeholder: !pageData.form.scope }">
{{
get
Scope
(
pageData
.
form
.
scope
)
||
'请选择市/区县/乡镇'
}}
{{
get
Text
(
pageData
.
form
.
scope
,
' / '
)
||
'请选择市/区县/乡镇'
}}
</text>
</view>
</view>
<!--
<fui-input
required
label=
"服务范围"
placeholder=
"请输入服务范围"
v-model=
"form.scope"
labelSize=
"28"
label-width=
"180"
></fui-input>
-->
<fui-input
required
type=
"number"
label=
"价格
(元/亩)
"
label=
"价格"
placeholder=
"请输入价格"
number
v-model=
"form.price"
labelSize=
"28"
label-width=
"180"
/>
maxlength=
"6"
>
<view
slot=
"suffix"
class=
"unit-slot"
>
元/亩
</view>
<!--
<slot
name=
"right"
style=
"font-size:28rpx;"
></slot>
-->
</fui-input>
</view>
<view
class=
"bg-white mt20"
style=
"padding: 0.875rem 1rem"
>
<view
class=
"mb-1 flex justify-start"
>
图片
</view>
<view
class=
"mb-1 flex justify-start"
style=
"font-size:28rpx;"
><span
class=
"text-red"
>
*
</span
>
图片
</view>
<uni-file-picker
:value=
"form.pictureObj"
:max-size=
"1024"
...
...
@@ -505,4 +473,9 @@
color
:
#999999
;
}
}
.unit-slot
{
padding
:
0
16
rpx
;
color
:
#333
;
font-size
:
28
rpx
;
}
</
style
>
src/pages/nongjifuwu/nongjifuwu.vue
浏览文件 @
382aadea
...
...
@@ -6,6 +6,7 @@
import
*
as
NongjifuwuAPI
from
'@/api/model/nongjifuwu'
import
Navigate
from
'@/utils/page/navigate'
import
{
s
}
from
'vite/dist/node/types.d-aGj9QkWt'
import
{
areaOptions
,
getText
}
from
'@/utils/dict/area'
onLoad
((
option
)
=>
{
pageData
.
search
.
serviceType
=
Number
(
option
.
type
)
||
1
...
...
@@ -68,9 +69,7 @@ import { s } from 'vite/dist/node/types.d-aGj9QkWt'
}
function
getCascader
()
{
NongjifuwuAPI
.
cascaderHn
().
then
((
res
)
=>
{
pageData
.
options
=
JSON
.
parse
(
JSON
.
stringify
(
res
[
0
].
children
).
replaceAll
(
'label'
,
'text'
))
})
pageData
.
options
=
areaOptions
}
// 分类标签点击事件
...
...
@@ -106,37 +105,7 @@ import { s } from 'vite/dist/node/types.d-aGj9QkWt'
applyDialogRef
.
value
.
open
(
item
)
}
function
getScope
(
scope
:
any
)
{
if
(
!
scope
||
!
pageData
.
options
||
pageData
.
options
.
length
===
0
)
{
return
''
}
const
values
=
scope
.
split
(
','
)
const
labels
=
[]
// 递归查找label
const
findLabel
=
(
nodes
,
value
)
=>
{
for
(
const
node
of
nodes
)
{
if
(
node
.
value
===
value
)
{
return
node
.
text
}
if
(
node
.
children
&&
node
.
children
.
length
>
0
)
{
const
found
=
findLabel
(
node
.
children
,
value
)
if
(
found
)
{
return
found
}
}
}
return
null
// 如果没找到,返回原始value
}
for
(
const
value
of
values
)
{
const
text
=
findLabel
(
pageData
.
options
,
value
.
trim
())
labels
.
push
(
text
)
}
return
labels
?
labels
.
join
(
' / '
)
:
''
}
function
handleChangeAddress
(
e
)
{
pageData
.
search
.
scope
=
e
.
value
.
join
(
','
)
...
...
@@ -165,7 +134,7 @@ import { s } from 'vite/dist/node/types.d-aGj9QkWt'
<view
class=
"codefun-flex-row codefun-justify-between section_2"
>
<text
class=
"font_2 text_2"
>
服务区域
</text>
<view
class=
"codefun-flex-row codefun-items-center"
@
click=
"pageData.show.address = true"
>
<text
class=
"font_2 text_3"
>
{{
get
Scope
(
pageData
.
search
.
scope
)
||
'选择区域'
}}
</text>
<text
class=
"font_2 text_3"
>
{{
get
Text
(
pageData
.
search
.
scope
,
' / '
)
||
'选择区域'
}}
</text>
<image
class=
"codefun-shrink-0 image_7 codefun-ml-4"
src=
"/static/images/codefun/774cfe989f8417dc655fb301635f5893.png"
...
...
@@ -206,7 +175,7 @@ import { s } from 'vite/dist/node/types.d-aGj9QkWt'
>
<text
class=
"font text_6"
>
{{
item
.
name
}}
</text>
<text
class=
"font_3 text_7 ellipsis"
style=
"width: 100%; margin: 26rpx 0"
>
服务范围:
{{
get
Scope
(
item
.
scope
)
}}
</text
>
服务范围:
{{
get
Text
(
item
.
scope
,
' / '
)
}}
</text
>
</view>
<view
class=
"flex justify-between"
style=
"width: 100%"
>
...
...
@@ -219,7 +188,7 @@ import { s } from 'vite/dist/node/types.d-aGj9QkWt'
class=
"codefun-flex-col codefun-justify-start codefun-items-center codefun-shrink-0 codefun-self-start text-wrapper_2"
@
click=
"handleApply(item)"
>
<text
class=
"font_5"
>
我有需要
</text>
<text
class=
"font_5"
>
去预约
</text>
</view>
</view>
</view>
...
...
src/pages/shouye/shouye.vue
浏览文件 @
382aadea
...
...
@@ -8,6 +8,7 @@
import
*
as
UserAPI
from
'@/api/model/userInfo'
import
{
useDictStore
}
from
'@/store/modules/dict'
import
Navigate
from
'@/utils/page/navigate'
import
*
as
AreaDict
from
'@/utils/dict/area'
const
dictStore
=
useDictStore
()
const
model
=
reactive
({
...
...
@@ -127,6 +128,7 @@
// 获取字典列表
dictStore
.
setDictList
()
AreaDict
.
refreshDictData
()
// 查询金刚区数据
getServiceItems
()
...
...
src/utils/dict/area.ts
0 → 100644
浏览文件 @
382aadea
import
{
cascaderHn
}
from
'/@/api/model/dict'
const
storageKey
=
'app_dict_data_area_cascaderHn'
;
export
const
getDictData
=
()
=>
{
// 先从本地加载数据
let
dictData
=
getLocalDict
();
if
(
!
dictData
)
{
// 如果本地没有数据,则从接口获取
cascaderHn
().
then
(
res
=>
uni
.
setStorageSync
(
storageKey
,
JSON
.
stringify
(
res
[
0
].
children
).
replaceAll
(
'label'
,
'text'
)));
}
return
dictData
;
}
/**
* 获取本地数据
*/
export
const
getLocalDict
=
()
=>
{
const
data
=
uni
.
getStorageSync
(
storageKey
);
if
(
data
)
{
return
data
?
JSON
.
parse
(
data
)
:
null
;
}
return
null
;
}
/**
* 刷新数据
*/
export
const
refreshDictData
=
()
=>
{
// 删除本地数据
uni
.
removeStorageSync
(
storageKey
);
// 重新获取数据
getDictData
();
}
export
const
areaOptions
=
getDictData
();
export
const
getText
=
(
scope
:
string
,
spliced
:
string
)
=>
{
if
(
!
scope
||
!
areaOptions
||
areaOptions
.
length
===
0
)
{
return
''
}
const
values
=
scope
.
split
(
','
)
const
labels
=
[]
// 递归查找label
const
findLabel
=
(
nodes
,
value
)
=>
{
for
(
const
node
of
nodes
)
{
if
(
node
.
value
===
value
)
{
return
node
.
text
}
if
(
node
.
children
&&
node
.
children
.
length
>
0
)
{
const
found
=
findLabel
(
node
.
children
,
value
)
if
(
found
)
{
return
found
}
}
}
return
null
// 如果没找到,返回原始value
}
for
(
const
value
of
values
)
{
const
text
=
findLabel
(
areaOptions
,
value
.
trim
())
labels
.
push
(
text
)
}
if
(
spliced
)
{
return
labels
?
labels
.
join
(
spliced
)
:
''
}
else
{
return
labels
?
labels
.
join
(
''
)
:
''
}
}
\ No newline at end of file
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论