This commit is contained in:
parent
7472cb566a
commit
1a60125c4f
|
@ -1,5 +1,6 @@
|
|||
import Taro from "@tarojs/taro";
|
||||
import {ApiOptions} from "../../types/request";
|
||||
import {type} from "os";
|
||||
|
||||
const requestInterceptor = (chain: Taro.Chain) => {
|
||||
const requestParams = chain.requestParams
|
||||
|
@ -28,6 +29,8 @@ class CustomRequest {
|
|||
title: '请求中...',
|
||||
}).then()
|
||||
}
|
||||
|
||||
console.log(params,method)
|
||||
Taro.request<JsonResult<T>, object>({
|
||||
url: this.BASE_API + url,
|
||||
data: params,
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
</view>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import {ref} from "vue";
|
||||
import {onMounted, ref, watch} from "vue";
|
||||
import {SEX} from "@/enums";
|
||||
import {FormRules} from "@nutui/nutui-taro/dist/types/__VUE/form/types";
|
||||
import api from "@/request";
|
||||
|
@ -69,7 +69,7 @@ const formData = ref<formDate>({
|
|||
remark:'',
|
||||
homeAddress: ''
|
||||
})
|
||||
const serviceProjectId = ref('')
|
||||
const serviceProjectId = ref('') //新增带过来的id
|
||||
const pickerValue = ref(new Date())
|
||||
const formRef = ref(null)
|
||||
|
||||
|
@ -94,7 +94,13 @@ const rules: FormRules = {
|
|||
};
|
||||
|
||||
useLoad((options)=>{
|
||||
formData.value = JSON.parse(options.item)
|
||||
serviceProjectId.value = JSON.parse(options.item).snowFlakeId
|
||||
console.log(serviceProjectId.value)
|
||||
})
|
||||
|
||||
watch(()=>formData.value,(res)=>{
|
||||
console.log(res)
|
||||
})
|
||||
const openDate = ()=>{
|
||||
showPicker.value = true
|
||||
|
|
|
@ -8,6 +8,10 @@
|
|||
<view class="myProjectIndex">地址:
|
||||
<text>{{ item?.provinceName }}{{ item.cityName }}{{ item.districtsName }}{{ item.streetName }}</text>
|
||||
</view>
|
||||
<view style="display: flex;justify-content: space-between">
|
||||
<text>联系人:{{ item?.contactPersonInfo.name }}</text>
|
||||
<text>电话:{{ item?.contactPersonInfo.telephone }}</text>
|
||||
</view>
|
||||
<view class="project">
|
||||
<view @click="projectClick(items,item?.name)" v-for="(items,index) in item.serviceProjectList" :key="index">
|
||||
{{ items.name }}
|
||||
|
@ -30,9 +34,7 @@ const getMyServiceProject = async () => {
|
|||
}
|
||||
|
||||
const projectClick = (items: ServiceProjectList, name: string) => {
|
||||
console.log(name, JSON.stringify(items))
|
||||
Taro.navigateTo({
|
||||
|
||||
url: `/subPages/pages/projectDetails/projectDetails?name=${name}&item=${JSON.stringify(items)}`,
|
||||
})
|
||||
}
|
||||
|
|
|
@ -5,8 +5,7 @@
|
|||
display: flex;
|
||||
flex-direction: column;
|
||||
.projectDetailsItem{
|
||||
height: 18%;
|
||||
margin: 20px;
|
||||
margin: 10px 20px 10px 20px;
|
||||
border-radius: 10px;
|
||||
background: #ffffff;
|
||||
padding: 15px;
|
||||
|
@ -14,6 +13,10 @@
|
|||
line-height: 65px;
|
||||
color: #333333;
|
||||
.projectDetailsIndex{
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
line-height: 44rpx;
|
||||
margin-bottom: 20px;
|
||||
.content{
|
||||
color: #9b9b9f;
|
||||
}
|
||||
|
@ -35,7 +38,16 @@
|
|||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
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;
|
||||
width: 100%;
|
||||
}
|
||||
.nutPopup{
|
||||
width: 300px;
|
||||
height: 100px;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,11 +1,24 @@
|
|||
<template>
|
||||
<view class="projectDetails">
|
||||
<view class="projectDetailsItem">
|
||||
<view style="display: flex;justify-content: space-between">
|
||||
<text style="font-size: 18px">{{ nameValue ? nameValue : '' }}{{ '-----' + detailsList?.name }}项目</text>
|
||||
<!--<text>进行中</text>-->
|
||||
<view class="projectDetailsItem" style="line-height: 50rpx">
|
||||
<view>
|
||||
<view style="display: flex;justify-content: space-between">
|
||||
<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 class="projectDetailsItem">
|
||||
<view class="projectDetailsIndex">
|
||||
<nut-row>
|
||||
<nut-col :span="24">
|
||||
<view class="content">保安证件号:{{ detailsList?.idNumber }}</view>
|
||||
</nut-col>
|
||||
</nut-row>
|
||||
<nut-row>
|
||||
<nut-col :span="12">
|
||||
<view class="content">工作人员数量:{{ detailsList?.staffTotal }}</view>
|
||||
|
@ -23,10 +36,7 @@
|
|||
</nut-col>
|
||||
</nut-row>
|
||||
<nut-row>
|
||||
<nut-col :span="16">
|
||||
<view class="content">证件号:{{ detailsList?.idNumber }}</view>
|
||||
</nut-col>
|
||||
<nut-col :span="8">
|
||||
<nut-col :span="4">
|
||||
<view class="content">户数:{{ detailsList?.houseTotal }}</view>
|
||||
</nut-col>
|
||||
</nut-row>
|
||||
|
@ -34,8 +44,8 @@
|
|||
</view>
|
||||
<!--表格-->
|
||||
<view class="projectDetailsTableDrop">
|
||||
<view style="padding: 0 12px">项目人员</view>
|
||||
<scroll-view :scroll-y="true" style="height: 80%;" @scrolltoupper="upper" @scrolltolower="lower"
|
||||
<view style="padding: 0 12px">项目人员({{total}})</view>
|
||||
<scroll-view :scroll-y="true" style="height: 80%;" @scrolltolower="lower"
|
||||
:scroll-into-view="toView" :scroll-top="scrollTop" :refresherEnabled="true"
|
||||
@refresherrefresh="onRefresherRefresh" :refresher-triggered="isRefresher"
|
||||
>
|
||||
|
@ -46,7 +56,7 @@
|
|||
<view style="display: flex;justify-content: space-between">
|
||||
<text>姓名:{{ item?.name?item?.name:'创建者' }}</text>
|
||||
<text>性别:{{ item.sex?.label?item.sex?.label:' 隐藏' }}</text>
|
||||
<text>职位:{{ item.workPost?item.workPost:'创建者' }}</text>
|
||||
<text>职位:{{ item.workPost?item.workPost:'无' }}</text>
|
||||
</view>
|
||||
<view style="display: flex;justify-content: space-between">
|
||||
<text>保安证件:{{ item.securityNumber?item.securityNumber:'125241256451' }}</text>
|
||||
|
@ -57,8 +67,10 @@
|
|||
<text>身份证:{{ item.idCard }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view>
|
||||
<nut-button style="width: 25%" size="small" type="info">删除</nut-button>
|
||||
<view class="projectDetailsTableIndex" >
|
||||
<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>
|
||||
|
@ -70,25 +82,53 @@
|
|||
<nut-button style="width: 45%" type="info" @click="formAdd">项目人员录入</nut-button>
|
||||
<nut-button style="width: 45%" type="info">二维码录入</nut-button>
|
||||
</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>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import Taro, {useLoad} from "@tarojs/taro";
|
||||
import Taro, {useLoad,useDidShow} from "@tarojs/taro";
|
||||
import './projectDetails.scss'
|
||||
import {ref} from "vue";
|
||||
import api from "@/request/index";
|
||||
import * as dayjs from 'dayjs'
|
||||
import {type} from "os";
|
||||
const detailsList = 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) => {
|
||||
console.log(JSON.parse(options.item),'111111111111',options.name)
|
||||
nameValue.value = options.name
|
||||
detailsList.value = await JSON.parse(options.item)
|
||||
await projectDetailsTable()
|
||||
})
|
||||
useDidShow(async () => {
|
||||
initServiceProjectSecurityUserList()
|
||||
})
|
||||
const projectDetailsTable = async () => {
|
||||
// if (total.value === projectData.value.length) return
|
||||
Taro.showLoading({
|
||||
await Taro.showLoading({
|
||||
title: '加载中',
|
||||
})
|
||||
const queryParams = {
|
||||
|
@ -114,29 +154,56 @@ const current = ref(1)
|
|||
const isRefresher = ref(false)
|
||||
const scrollTop = ref(0)
|
||||
const toView = ref('demo2')
|
||||
const upper = (e) => {
|
||||
console.log('到顶了:', e)
|
||||
}
|
||||
// 滚动到底部/右边时触发
|
||||
const lower = (e) => {
|
||||
if (total.value === projectData.value.length) return
|
||||
if (total.value > projectData.value.length) {
|
||||
console.log('触底了:', e)
|
||||
current.value = current.value + 1
|
||||
projectDetailsTable()
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
// 自定义下拉刷新被触发
|
||||
const onRefresherRefresh = (e) => {
|
||||
const initServiceProjectSecurityUserList = () => {
|
||||
projectData.value = []
|
||||
total.value = null
|
||||
current.value = 1 //重置
|
||||
isRefresher.value = true
|
||||
console.log('自定义下拉刷新被触发:', e)
|
||||
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>
|
||||
<style scoped lang="scss">
|
||||
|
||||
|
|
|
@ -33,5 +33,12 @@ interface ServiceProjectList {
|
|||
snowFlakeId?: string;
|
||||
staffTotal?: number;
|
||||
type?:string;
|
||||
projectManagerMiniProgramUserInfo?:ProgramUserInfo
|
||||
}
|
||||
interface ProgramUserInfo{
|
||||
idCard: null
|
||||
name: string
|
||||
telephone: string
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
interface Records<T>{
|
||||
interface Records{
|
||||
createTime?: string;
|
||||
dateOfBirth?: string;
|
||||
homeAddress?: string;
|
||||
|
@ -10,16 +10,17 @@ interface Records<T>{
|
|||
securityUnitId?: string;
|
||||
securityUnitName?: string;
|
||||
serviceProjectId?: string;
|
||||
snowFlakeId:string;
|
||||
workPost?:string;
|
||||
sex?:Sex
|
||||
}
|
||||
interface ProjectData<T> {
|
||||
current?:string;
|
||||
pages?:string;
|
||||
records?: Records<T>;
|
||||
records?: Records[];
|
||||
size?: string;
|
||||
total?: string;
|
||||
data: Records<T>;
|
||||
data: Records[];
|
||||
}
|
||||
|
||||
interface Sex {
|
||||
|
|
Loading…
Reference in New Issue