Compare commits

...

2 Commits

Author SHA1 Message Date
wangyilin 0a6f824a8f Merge remote-tracking branch 'origin/main' 2024-09-14 09:54:47 +08:00
wangyilin 1a60125c4f 编辑 2024-09-14 09:54:41 +08:00
7 changed files with 141 additions and 37 deletions

View File

@ -1,5 +1,6 @@
import Taro from "@tarojs/taro"; import Taro from "@tarojs/taro";
import {ApiOptions} from "../../types/request"; import {ApiOptions} from "../../types/request";
import {type} from "os";
const requestInterceptor = (chain: Taro.Chain) => { const requestInterceptor = (chain: Taro.Chain) => {
const requestParams = chain.requestParams const requestParams = chain.requestParams
@ -28,6 +29,8 @@ class CustomRequest {
title: '请求中...', title: '请求中...',
}).then() }).then()
} }
console.log(params,method)
Taro.request<JsonResult<T>, object>({ Taro.request<JsonResult<T>, object>({
url: this.BASE_API + url, url: this.BASE_API + url,
data: params, data: params,

View File

@ -50,7 +50,7 @@
</view> </view>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import {ref} from "vue"; import {onMounted, ref, watch} from "vue";
import {SEX} from "@/enums"; import {SEX} from "@/enums";
import {FormRules} from "@nutui/nutui-taro/dist/types/__VUE/form/types"; import {FormRules} from "@nutui/nutui-taro/dist/types/__VUE/form/types";
import api from "@/request"; import api from "@/request";
@ -69,7 +69,7 @@ const formData = ref<formDate>({
remark:'', remark:'',
homeAddress: '' homeAddress: ''
}) })
const serviceProjectId = ref('') const serviceProjectId = ref('') //id
const pickerValue = ref(new Date()) const pickerValue = ref(new Date())
const formRef = ref(null) const formRef = ref(null)
@ -94,7 +94,13 @@ const rules: FormRules = {
}; };
useLoad((options)=>{ useLoad((options)=>{
formData.value = JSON.parse(options.item)
serviceProjectId.value = JSON.parse(options.item).snowFlakeId serviceProjectId.value = JSON.parse(options.item).snowFlakeId
console.log(serviceProjectId.value)
})
watch(()=>formData.value,(res)=>{
console.log(res)
}) })
const openDate = ()=>{ const openDate = ()=>{
showPicker.value = true showPicker.value = true

View File

@ -8,6 +8,10 @@
<view class="myProjectIndex">地址 <view class="myProjectIndex">地址
<text>{{ item?.provinceName }}{{ item.cityName }}{{ item.districtsName }}{{ item.streetName }}</text> <text>{{ item?.provinceName }}{{ item.cityName }}{{ item.districtsName }}{{ item.streetName }}</text>
</view> </view>
<view style="display: flex;justify-content: space-between">
<text>联系人{{ item?.contactPersonInfo.name }}</text>
<text>电话{{ item?.contactPersonInfo.telephone }}</text>
</view>
<view class="project"> <view class="project">
<view @click="projectClick(items,item?.name)" v-for="(items,index) in item.serviceProjectList" :key="index"> <view @click="projectClick(items,item?.name)" v-for="(items,index) in item.serviceProjectList" :key="index">
{{ items.name }} {{ items.name }}
@ -30,9 +34,7 @@ const getMyServiceProject = async () => {
} }
const projectClick = (items: ServiceProjectList, name: string) => { const projectClick = (items: ServiceProjectList, name: string) => {
console.log(name, JSON.stringify(items))
Taro.navigateTo({ Taro.navigateTo({
url: `/subPages/pages/projectDetails/projectDetails?name=${name}&item=${JSON.stringify(items)}`, url: `/subPages/pages/projectDetails/projectDetails?name=${name}&item=${JSON.stringify(items)}`,
}) })
} }

View File

@ -5,8 +5,7 @@
display: flex; display: flex;
flex-direction: column; flex-direction: column;
.projectDetailsItem{ .projectDetailsItem{
height: 18%; margin: 10px 20px 10px 20px;
margin: 20px;
border-radius: 10px; border-radius: 10px;
background: #ffffff; background: #ffffff;
padding: 15px; padding: 15px;
@ -14,6 +13,10 @@
line-height: 65px; line-height: 65px;
color: #333333; color: #333333;
.projectDetailsIndex{ .projectDetailsIndex{
display: flex;
flex-wrap: wrap;
line-height: 44rpx;
margin-bottom: 20px;
.content{ .content{
color: #9b9b9f; color: #9b9b9f;
} }
@ -35,7 +38,16 @@
align-items: center; align-items: center;
flex-wrap: wrap; flex-wrap: wrap;
font-size: 24px; font-size: 24px;
margin-bottom: 15px margin-bottom: 15px;
.projectDetailsTableIndex{
display: flex;
justify-content: flex-end;
text-align: center;
view{
width: 70px;
margin-right: 20px;
}
}
} }
} }
} }
@ -48,6 +60,12 @@
right: 0; right: 0;
width: 100%; width: 100%;
} }
.nutPopup{
width: 300px;
height: 100px;
display: flex;
flex-wrap: wrap;
}
} }

View File

@ -1,11 +1,24 @@
<template> <template>
<view class="projectDetails"> <view class="projectDetails">
<view class="projectDetailsItem"> <view class="projectDetailsItem" style="line-height: 50rpx">
<view style="display: flex;justify-content: space-between"> <view>
<text style="font-size: 18px">{{ nameValue ? nameValue : '' }}{{ '-----' + detailsList?.name }}项目</text> <view style="display: flex;justify-content: space-between">
<!--<text>进行中</text>--> <text style="font-size: 18px">{{ nameValue ? nameValue : '' }}{{ '-----' + detailsList?.name }}项目</text>
<text>进行中</text>
</view>
<view>
<view style="float: left;width: 50%;" class="content">经理名称:{{ detailsList?.projectManagerMiniProgramUserInfo.name }}</view>
<view class="content">手机号:{{ detailsList?.projectManagerMiniProgramUserInfo.telephone }}</view>
</view>
</view> </view>
</view>
<view class="projectDetailsItem">
<view class="projectDetailsIndex"> <view class="projectDetailsIndex">
<nut-row>
<nut-col :span="24">
<view class="content">保安证件号{{ detailsList?.idNumber }}</view>
</nut-col>
</nut-row>
<nut-row> <nut-row>
<nut-col :span="12"> <nut-col :span="12">
<view class="content">工作人员数量:{{ detailsList?.staffTotal }}</view> <view class="content">工作人员数量:{{ detailsList?.staffTotal }}</view>
@ -23,10 +36,7 @@
</nut-col> </nut-col>
</nut-row> </nut-row>
<nut-row> <nut-row>
<nut-col :span="16"> <nut-col :span="4">
<view class="content">证件号{{ detailsList?.idNumber }}</view>
</nut-col>
<nut-col :span="8">
<view class="content">户数:{{ detailsList?.houseTotal }}</view> <view class="content">户数:{{ detailsList?.houseTotal }}</view>
</nut-col> </nut-col>
</nut-row> </nut-row>
@ -34,8 +44,8 @@
</view> </view>
<!--表格--> <!--表格-->
<view class="projectDetailsTableDrop"> <view class="projectDetailsTableDrop">
<view style="padding: 0 12px">项目人员</view> <view style="padding: 0 12px">项目人员({{total}})</view>
<scroll-view :scroll-y="true" style="height: 80%;" @scrolltoupper="upper" @scrolltolower="lower" <scroll-view :scroll-y="true" style="height: 80%;" @scrolltolower="lower"
:scroll-into-view="toView" :scroll-top="scrollTop" :refresherEnabled="true" :scroll-into-view="toView" :scroll-top="scrollTop" :refresherEnabled="true"
@refresherrefresh="onRefresherRefresh" :refresher-triggered="isRefresher" @refresherrefresh="onRefresherRefresh" :refresher-triggered="isRefresher"
> >
@ -46,7 +56,7 @@
<view style="display: flex;justify-content: space-between"> <view style="display: flex;justify-content: space-between">
<text>姓名:{{ item?.name?item?.name:'创建者' }}</text> <text>姓名:{{ item?.name?item?.name:'创建者' }}</text>
<text>性别:{{ item.sex?.label?item.sex?.label:' 隐藏' }}</text> <text>性别:{{ item.sex?.label?item.sex?.label:' 隐藏' }}</text>
<text>职位:{{ item.workPost?item.workPost:'创建者' }}</text> <text>职位:{{ item.workPost?item.workPost:'' }}</text>
</view> </view>
<view style="display: flex;justify-content: space-between"> <view style="display: flex;justify-content: space-between">
<text>保安证件:{{ item.securityNumber?item.securityNumber:'125241256451' }}</text> <text>保安证件:{{ item.securityNumber?item.securityNumber:'125241256451' }}</text>
@ -57,8 +67,10 @@
<text>身份证:{{ item.idCard }}</text> <text>身份证:{{ item.idCard }}</text>
</view> </view>
</view> </view>
<view> <view class="projectDetailsTableIndex" >
<nut-button style="width: 25%" size="small" type="info">删除</nut-button> <view style="color: #3a6bbe" @click="detail(item)">详情</view>
<view style="color: #ffa60d" @click="projectEdit(item)">编辑</view>
<view style="color: red" @click="deleteUssrID(item.snowFlakeId)">删除</view>
</view> </view>
</view> </view>
</view> </view>
@ -70,25 +82,53 @@
<nut-button style="width: 45%" type="info" @click="formAdd">项目人员录入</nut-button> <nut-button style="width: 45%" type="info" @click="formAdd">项目人员录入</nut-button>
<nut-button style="width: 45%" type="info">二维码录入</nut-button> <nut-button style="width: 45%" type="info">二维码录入</nut-button>
</view> </view>
<view>
<nut-dialog
content="是否确认删除该用户?"
:onOk="dialogOk"
v-model:visible="confirmVisible"
/>
</view>
<view>
<nut-dialog no-cancel-btn content="详情" v-model:visible="detailVisible">
<slot>
<view style="margin-bottom: 5px">
<view>籍贯{{content.nativePlace}}</view>
<view>公司{{content.securityUnitName}}</view>
<view>家庭地址{{content.homeAddress}}</view>
<view>备注{{content.remark}}</view>
</view>
</slot>
</nut-dialog>
</view>
</view> </view>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import Taro, {useLoad} from "@tarojs/taro"; import Taro, {useLoad,useDidShow} from "@tarojs/taro";
import './projectDetails.scss' import './projectDetails.scss'
import {ref} from "vue"; import {ref} from "vue";
import api from "@/request/index"; import api from "@/request/index";
import * as dayjs from 'dayjs' import * as dayjs from 'dayjs'
import {type} from "os";
const detailsList = ref() const detailsList = ref()
const nameValue = ref('') const nameValue = ref('')
const projectData = ref<Records<string>[]>([]) const projectData = ref<Records[]>([])
const content = ref<Records>({} as any)
//
const confirmVisible = ref(false);
const detailVisible = ref(false)
useLoad(async (options: MyProjectList) => { useLoad(async (options: MyProjectList) => {
console.log(JSON.parse(options.item),'111111111111',options.name)
nameValue.value = options.name nameValue.value = options.name
detailsList.value = await JSON.parse(options.item) detailsList.value = await JSON.parse(options.item)
await projectDetailsTable() })
useDidShow(async () => {
initServiceProjectSecurityUserList()
}) })
const projectDetailsTable = async () => { const projectDetailsTable = async () => {
// if (total.value === projectData.value.length) return await Taro.showLoading({
Taro.showLoading({
title: '加载中', title: '加载中',
}) })
const queryParams = { const queryParams = {
@ -114,29 +154,56 @@ const current = ref(1)
const isRefresher = ref(false) const isRefresher = ref(false)
const scrollTop = ref(0) const scrollTop = ref(0)
const toView = ref('demo2') const toView = ref('demo2')
const upper = (e) => {
console.log('到顶了:', e)
}
// / // /
const lower = (e) => { const lower = (e) => {
if (total.value === projectData.value.length) return if (total.value === projectData.value.length) return
if (total.value > projectData.value.length) { if (total.value > projectData.value.length) {
console.log('触底了:', e)
current.value = current.value + 1 current.value = current.value + 1
projectDetailsTable() projectDetailsTable()
} }
} }
// const initServiceProjectSecurityUserList = () => {
const onRefresherRefresh = (e) => {
projectData.value = [] projectData.value = []
total.value = null total.value = null
current.value = 1 // current.value = 1 //
isRefresher.value = true isRefresher.value = true
console.log('自定义下拉刷新被触发:', e)
projectDetailsTable() projectDetailsTable()
} }
//
const onRefresherRefresh = (e) => {
initServiceProjectSecurityUserList()
}
const securityUserId = ref<string>('')
//
const deleteUssrID = (snowFlakeId:string)=>{
confirmVisible.value = true
securityUserId.value = snowFlakeId
}
//
const dialogOk = async ()=>{
await api.delete(`/projectManageIndex/deleteSecurityUserByServiceProjectId`,{securityUserId:securityUserId.value},{
header:{
"content-type":'application/x-www-form-urlencoded'
}
})
initServiceProjectSecurityUserList()
}
//
const detail = (item)=>{
detailVisible.value = true
content.value = item
}
const projectEdit = (item)=>{
console.log(111)
Taro.navigateTo({url: `/subPages/pages/form/form?item=${JSON.stringify(item)}`})
}
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">

View File

@ -33,5 +33,12 @@ interface ServiceProjectList {
snowFlakeId?: string; snowFlakeId?: string;
staffTotal?: number; staffTotal?: number;
type?:string; type?:string;
projectManagerMiniProgramUserInfo?:ProgramUserInfo
}
interface ProgramUserInfo{
idCard: null
name: string
telephone: string
} }

View File

@ -1,4 +1,4 @@
interface Records<T>{ interface Records{
createTime?: string; createTime?: string;
dateOfBirth?: string; dateOfBirth?: string;
homeAddress?: string; homeAddress?: string;
@ -10,16 +10,17 @@ interface Records<T>{
securityUnitId?: string; securityUnitId?: string;
securityUnitName?: string; securityUnitName?: string;
serviceProjectId?: string; serviceProjectId?: string;
snowFlakeId:string;
workPost?:string; workPost?:string;
sex?:Sex sex?:Sex
} }
interface ProjectData<T> { interface ProjectData<T> {
current?:string; current?:string;
pages?:string; pages?:string;
records?: Records<T>; records?: Records[];
size?: string; size?: string;
total?: string; total?: string;
data: Records<T>; data: Records[];
} }
interface Sex { interface Sex {