Browse Source

修改 bug

master
王泽彦 5 months ago
parent
commit
8b7ef4c0db
  1. 2
      niucloud/app/model/resource_sharing/ResourceSharing.php
  2. 1
      niucloud/app/service/admin/campus_person_role/CampusPersonRoleService.php
  3. 4
      niucloud/app/service/api/apiService/CustomerResourcesService.php
  4. 30
      niucloud/app/service/api/apiService/ResourceSharingService.php
  5. 49
      start.sh
  6. 20
      uniapp/pages-coach/coach/my/salary.vue
  7. 92
      uniapp/pages-common/profile/personal_info.vue
  8. 11
      uniapp/pages-market/clue/index.vue
  9. BIN
      uniapp/static/images/no_data.png

2
niucloud/app/model/resource_sharing/ResourceSharing.php

@ -42,8 +42,6 @@ class ResourceSharing extends BaseModel
/**
* 搜索器:资源共享共享记录编号
* @param $value

1
niucloud/app/service/admin/campus_person_role/CampusPersonRoleService.php

@ -64,6 +64,7 @@ class CampusPersonRoleService extends BaseAdminService
->alias("a")
->join(['school_personnel' => 'b'],'a.person_id = b.id','left')
->where($where)
->where('b.deleted_at', 0) // 只显示未删除的人员
->with(['campus','personnel','sysRole','departments'])
->field($field)->order($order);

4
niucloud/app/service/api/apiService/CustomerResourcesService.php

@ -144,11 +144,11 @@ class CustomerResourcesService extends BaseApiService
'resource_id' => $resource_id,
'assignee_type' => 'user',
'assignee_id' => $assignee_id,
'is_primary' => 1,
'is_primary' => 0,
'assigned_by' => 0,
'assigned_at' => date("Y-m-d H:i:s"),
'campus_id' => $customer_resources_data['campus'],
'assigned_source' => 'api'
'assigned_source' => 'add'
]);
} catch (\Exception $e) {
// 如果插入失败,记录日志但不影响主流程

30
niucloud/app/service/api/apiService/ResourceSharingService.php

@ -643,18 +643,17 @@ class ResourceSharingService extends BaseApiService
$consultant_names = $personnel->whereIn('id', $consultant_ids)->column('name', 'id');
}
// 查询销售老师信息(从资源分配表获取assigned_by=0的记录)
// 查询销售老师信息(从资源分配表获取assigned_source为auto_allocation或api的最新记录)
$sales_teachers = [];
if (!empty($resource_ids)) {
$assignment_model = new \app\model\resource_assignment\ResourceAssignment();
// 查询每个资源assigned_by=0的最新一条记录
// 查询每个资源assigned_source为auto_allocation或api的最新一条记录
$sales_assignments = [];
foreach ($resource_ids as $resource_id) {
$latest_assignment = $assignment_model
->where('resource_id', $resource_id)
->where('assignee_type', 'user')
->where('assigned_by', 0)
->whereIn('assigned_source', ['auto_allocation', 'api'])
->order('assigned_at', 'desc')
->field('assignee_id')
->find();
@ -678,17 +677,18 @@ class ResourceSharingService extends BaseApiService
}
}
// 查询市场老师信息(从资源分配表获取assigned_source为auto_allocation或api的最新记录)
// 查询市场老师信息(从资源分配表获取assigned_by=0且assignee_type='user'的记录)
$market_teachers = [];
if (!empty($resource_ids)) {
$assignment_model = new \app\model\resource_assignment\ResourceAssignment();
// 查询每个资源assigned_source为auto_allocation或api的最新一条记录
// 查询每个资源assigned_by=0且assignee_type='user'的最新一条记录
$market_assignments = [];
foreach ($resource_ids as $resource_id) {
$latest_assignment = $assignment_model
->where('resource_id', $resource_id)
->whereIn('assigned_source', ['auto_allocation', 'api'])
->where('assignee_type', 'user')
->where('assigned_by', 0)
->order('assigned_at', 'desc')
->field('assignee_id')
->find();
@ -1266,18 +1266,17 @@ class ResourceSharingService extends BaseApiService
$consultant_names = $personnel->whereIn('id', $consultant_ids)->column('name', 'id');
}
// 查询销售老师信息(从资源分配表获取assigned_by=0的记录)
// 查询销售老师信息(从资源分配表获取assigned_source为auto_allocation或api的最新记录)
$sales_teachers = [];
if (!empty($resource_ids)) {
$assignment_model = new \app\model\resource_assignment\ResourceAssignment();
// 查询每个资源assigned_by=0的最新一条记录
// 查询每个资源assigned_source为auto_allocation或api的最新一条记录
$sales_assignments = [];
foreach ($resource_ids as $resource_id) {
$latest_assignment = $assignment_model
->where('resource_id', $resource_id)
->where('assignee_type', 'user')
->where('assigned_by', 0)
->whereIn('assigned_source', ['auto_allocation', 'api'])
->order('assigned_at', 'desc')
->field('assignee_id')
->find();
@ -1301,17 +1300,18 @@ class ResourceSharingService extends BaseApiService
}
}
// 查询市场老师信息(从资源分配表获取assigned_source为auto_allocation或api的最新记录)
// 查询市场老师信息(从资源分配表获取assigned_by=0且assignee_type='user'的记录)
$market_teachers = [];
if (!empty($resource_ids)) {
$assignment_model = new \app\model\resource_assignment\ResourceAssignment();
// 查询每个资源assigned_source为auto_allocation或api的最新一条记录
// 查询每个资源assigned_by=0且assignee_type='user'的最新一条记录
$market_assignments = [];
foreach ($resource_ids as $resource_id) {
$latest_assignment = $assignment_model
->where('resource_id', $resource_id)
->whereIn('assigned_source', ['auto_allocation', 'api'])
->where('assignee_type', 'user')
->where('assigned_by', 0)
->order('assigned_at', 'desc')
->field('assignee_id')
->find();
@ -1524,7 +1524,7 @@ class ResourceSharingService extends BaseApiService
'resource_id' => $resource_id,
'assignee_type' => $assignee_type,
'assignee_id' => $assignee_id,
'is_primary' => $is_primary ? 1 : 0,
'is_primary' => 1,
'assigned_by' => $assigned_by,
'assigned_at' => date('Y-m-d H:i:s'),
'campus_id' => $campus_id,

49
start.sh

@ -173,6 +173,26 @@ EOF
# 启动服务
start_services() {
print_message "启动 ${PROJECT_NAME} 服务..."
# 检查是否存在冲突的容器并清理
print_message "检查并清理可能冲突的容器..."
# 检查并停止冲突的容器
for container in niucloud_mysql niucloud_redis niucloud_php niucloud_nginx niucloud_composer niucloud_node; do
if docker ps -a --format "table {{.Names}}" | grep -q "^${container}$"; then
print_warning "发现已存在的容器: $container,正在清理..."
docker stop $container 2>/dev/null || true
docker rm $container 2>/dev/null || true
fi
done
# 清理可能存在的网络
if docker network ls --format "table {{.Name}}" | grep -q "^zhjwxt_niucloud_network$"; then
print_warning "发现已存在的网络,正在清理..."
docker network rm zhjwxt_niucloud_network 2>/dev/null || true
fi
# 启动服务
docker-compose up -d
}
@ -182,6 +202,31 @@ stop_services() {
docker-compose down
}
# 强制清理所有容器和网络
force_cleanup() {
print_message "强制清理所有相关容器和网络..."
# 停止并删除所有相关容器
for container in niucloud_mysql niucloud_redis niucloud_php niucloud_nginx niucloud_composer niucloud_node; do
if docker ps -a --format "table {{.Names}}" | grep -q "^${container}$"; then
print_warning "正在删除容器: $container"
docker stop $container 2>/dev/null || true
docker rm $container 2>/dev/null || true
fi
done
# 删除网络
if docker network ls --format "table {{.Name}}" | grep -q "^zhjwxt_niucloud_network$"; then
print_warning "正在删除网络: zhjwxt_niucloud_network"
docker network rm zhjwxt_niucloud_network 2>/dev/null || true
fi
# 删除未使用的网络
docker network prune -f 2>/dev/null || true
print_message "清理完成!"
}
# 重启服务
restart_services() {
print_message "重启 ${PROJECT_NAME} 服务..."
@ -241,6 +286,7 @@ show_help() {
echo " status 查看服务状态"
echo " logs 查看所有服务日志"
echo " logs <服务名> 查看指定服务日志"
echo " cleanup 强制清理所有容器和网络"
echo " init 初始化项目"
echo " help 显示此帮助信息"
}
@ -265,6 +311,9 @@ main() {
logs)
view_logs "$2"
;;
cleanup)
force_cleanup
;;
init)
init_project
;;

20
uniapp/pages-coach/coach/my/salary.vue

@ -58,7 +58,7 @@
<!-- 暂无数据 -->
<view class="no_data" v-else-if="!loading">
<image class="no_data_icon" src="/static/images/no_data.png" mode="aspectFit"></image>
<image class="no_data_icon" src="@/static/images/no_data.png" mode="aspectFit"></image>
<text class="no_data_text">暂无工资数据</text>
</view>
@ -404,18 +404,24 @@ export default {
/* 暂无数据 */
.no_data {
text-align: center;
padding: 100rpx 0;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 120rpx 0;
color: #888;
.no_data_icon {
width: 150rpx;
height: 150rpx;
margin-bottom: 30rpx;
width: 180rpx;
height: 180rpx;
margin-bottom: 40rpx;
opacity: 0.8;
}
.no_data_text {
font-size: 28rpx;
font-size: 30rpx;
color: #999;
margin-top: 10rpx;
}
}

92
uniapp/pages-common/profile/personal_info.vue

@ -9,8 +9,8 @@
</view>
<view class="nav-title">个人资料</view>
<view class="nav-right">
<text class="save-btn" @click="saveProfile" v-if="isEditing">保存</text>
<text class="edit-btn" @click="toggleEdit" v-else>编辑</text>
<text class="action-btn" @click="saveProfile" v-if="isEditing">保存</text>
<text class="action-btn" @click="toggleEdit" v-else>编辑</text>
</view>
</view>
</view>
@ -279,17 +279,6 @@
<text v-else class="value">{{ formData.info.name || '未填写' }}</text>
</view>
<!-- 门店 -->
<view class="form-item">
<text class="label">门店</text>
<input
v-if="isEditing"
v-model="formData.info.store"
placeholder="请输入门店"
class="input-field"
/>
<text v-else class="value">{{ formData.info.store || '未填写' }}</text>
</view>
<!-- 民族 -->
<view class="form-item">
@ -470,6 +459,8 @@ export default {
return {
isEditing: false,
loading: false,
//
originalData: {},
formData: {
head_img: '',
name: '',
@ -493,7 +484,6 @@ export default {
// personnel_info
info: {
name: '',
store: '',
ethnicity: '',
age: '',
tenure: '',
@ -533,14 +523,69 @@ export default {
await this.loadUserProfile()
},
methods: {
//
hasUnsavedChanges() {
if (!this.isEditing) return false
//
const currentData = JSON.stringify(this.formData)
const originalData = JSON.stringify(this.originalData)
return currentData !== originalData
},
//
goBack() {
uni.navigateBack()
//
if (this.isEditing && this.hasUnsavedChanges()) {
uni.showModal({
title: '确认离开',
content: '离开这个页面后未保存的内容会丢失',
confirmText: '离开',
cancelText: '取消',
success: (res) => {
if (res.confirm) {
// 退
this.isEditing = false
//
this.formData = JSON.parse(JSON.stringify(this.originalData))
uni.navigateBack()
}
//
}
})
} else {
//
uni.navigateBack()
}
},
//
toggleEdit() {
this.isEditing = !this.isEditing
if (this.isEditing) {
// 退
if (this.hasUnsavedChanges()) {
uni.showModal({
title: '确认退出编辑',
content: '退出编辑后未保存的内容会丢失',
confirmText: '退出',
cancelText: '取消',
success: (res) => {
if (res.confirm) {
// 退
this.formData = JSON.parse(JSON.stringify(this.originalData))
this.isEditing = false
}
//
}
})
} else {
// 退
this.isEditing = false
}
} else {
//
this.isEditing = true
}
},
//
@ -607,6 +652,8 @@ export default {
...(data.info || {})
}
}
//
this.originalData = JSON.parse(JSON.stringify(this.formData))
} else {
uni.showToast({
title: res.msg || '获取用户信息失败',
@ -663,7 +710,6 @@ export default {
id_card_back: this.formData.id_card_back,
info: {
name: this.formData.info.name,
store: this.formData.info.store,
ethnicity: this.formData.info.ethnicity,
age: this.formData.info.age,
politics: this.formData.info.politics,
@ -693,6 +739,8 @@ export default {
icon: 'success'
})
this.isEditing = false
//
this.originalData = JSON.parse(JSON.stringify(this.formData))
} else {
uni.showToast({
title: res.msg || '保存失败',
@ -968,16 +1016,22 @@ export default {
}
.nav-right {
width: 60px;
width: 80px; /* 增加宽度避免换行 */
display: flex;
align-items: center;
justify-content: flex-end;
/* 微信小程序胶囊按钮适配 */
/* #ifdef MP-WEIXIN */
margin-right: 100px; /* 为胶囊按钮预留足够空间 */
/* #endif */
}
.edit-btn, .save-btn {
.action-btn {
color: #29d3b4;
font-size: 14px;
padding: 5px 10px;
white-space: nowrap; /* 防止文字换行 */
display: inline-block;
}
.content-wrapper {

11
uniapp/pages-market/clue/index.vue

@ -85,11 +85,11 @@
<view class="info-column">
<view class="card-con">
<text class="info-label">市场老师</text>
<text class="info-value">{{ v.customerResource.sales_teacher || '-' }}</text>
<text class="info-value">{{ v.customerResource.market_teacher || '-' }}</text>
</view>
<view class="card-con">
<text class="info-label">销售老师</text>
<text class="info-value">{{ v.customerResource.market_teacher || '-' }}</text>
<text class="info-value">{{ v.customerResource.sales_teacher || '-' }}</text>
</view>
<view class="card-con">
<text class="info-label">是否有效</text>
@ -188,7 +188,7 @@
<view class="status-section">
<view class="assign-status">
<span class="assigned-to" :class="v.shared_by_name === '未分配' ? 'unassigned' : 'assigned'">
{{v.shared_by_name}}
{{v.shared_by_name === '未分配' ? '未分配' : '已分配'}}
</span>
</view>
</view>
@ -221,12 +221,12 @@
<view class="info-column">
<view class="card-con">
<text class="info-label">市场老师</text>
<text class="info-value">{{ v.customerResource.sales_teacher || '-' }}</text>
<text class="info-value">{{ v.customerResource.market_teacher || '-' }}</text>
</view>
<view class="card-con">
<text class="info-label">分配状态</text>
<text class="info-value assigned-to" :class="v.shared_by_name === '未分配' ? 'unassigned' : 'assigned'">
{{v.shared_by_name}}
{{v.shared_by_name === '未分配' ? '未分配' : v.shared_by_name + '分配了资源'}}
</text>
</view>
</view>
@ -1935,7 +1935,6 @@
border-radius: 20rpx;
width: 90%;
max-width: 700rpx;
max-height: 80vh;
overflow: hidden;
box-shadow: 0 8rpx 32rpx rgba(0, 0, 0, 0.4);
}

BIN
uniapp/static/images/no_data.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

Loading…
Cancel
Save