于宏哲PHP 9 months ago
parent
commit
0baf8c3e13
  1. 4
      admin/src/app/views/campus_person_role/campus_person_role.vue
  2. 4
      admin/src/app/views/campus_person_role/components/campus-person-role-edit.vue
  3. 151
      admin/src/app/views/course/components/course-edit.vue
  4. 4
      admin/src/app/views/departments/departments.vue
  5. 115
      admin/src/app/views/xsyj/xsyj.vue
  6. 3
      niucloud/app/adminapi/controller/course/Course.php
  7. 1
      niucloud/app/adminapi/controller/sys/System.php
  8. 8
      niucloud/app/api/controller/apiController/Personnel.php
  9. 99
      niucloud/app/api/controller/apiController/Statistics.php
  10. 22
      niucloud/app/common.php
  11. 12
      niucloud/app/service/admin/campus_person_role/CampusPersonRoleService.php
  12. 1
      niucloud/app/service/admin/course/CourseService.php
  13. 35
      niucloud/app/service/admin/sys/SystemService.php
  14. 30
      niucloud/app/service/api/apiService/PersonnelService.php
  15. 5
      niucloud/app/service/api/apiService/ResourceSharingService.php

4
admin/src/app/views/campus_person_role/campus_person_role.vue

@ -218,10 +218,10 @@ let campusPersonRoleTable = reactive({
if(pageName == '市场人员列表'){
campusPersonRoleTable.searchParam.dept_id = 1;
}else if(pageName == '销售人员列表'){
campusPersonRoleTable.searchParam.dept_id = 2;
campusPersonRoleTable.searchParam.dept_id = 3;
// campusPersonRoleTable.searchParam.role_id = 2;
}else if(pageName == '教练管理'){
campusPersonRoleTable.searchParam.role_id = 5;
campusPersonRoleTable.searchParam.dept_id = 2;
}
const searchFormRef = ref<FormInstance>()

4
admin/src/app/views/campus_person_role/components/campus-person-role-edit.vue

@ -160,10 +160,10 @@ const initialFormData = {
if(pageName == '市场人员列表'){
initialFormData.dept_id = 1;
}else if(pageName == '销售人员列表'){
initialFormData.dept_id = 2;
initialFormData.dept_id = 3;
// campusPersonRoleTable.searchParam.role_id = 2;
}else if(pageName == '教练管理'){
initialFormData.dept_id = 3;
initialFormData.dept_id = 2;
}else{
initialFormData.dept_id = 0;
}

151
admin/src/app/views/course/components/course-edit.vue

@ -1,127 +1,98 @@
<template>
<el-dialog
v-model="showDialog"
:title="formData.id ? t('updateCourse') : t('addCourse')"
width="50%"
class="diy-dialog-wrap"
:destroy-on-close="true"
>
<el-form
:model="formData"
label-width="120px"
ref="formRef"
:rules="formRules"
class="page-form"
v-loading="loading"
>
<el-dialog v-model="showDialog" :title="formData.id ? t('updateCourse') : t('addCourse')" width="50%"
class="diy-dialog-wrap" :destroy-on-close="true">
<el-form :model="formData" label-width="120px" ref="formRef" :rules="formRules" class="page-form"
v-loading="loading">
<el-form-item :label="t('courseName')" prop="course_name">
<el-input
v-model="formData.course_name"
clearable
:placeholder="t('courseNamePlaceholder')"
class="input-width"
/>
<el-input v-model="formData.course_name" clearable :placeholder="t('courseNamePlaceholder')"
class="input-width" />
</el-form-item>
<el-form-item :label="t('courseType')" prop="course_type">
<el-select
class="input-width"
v-model="formData.course_type"
:placeholder="t('courseTypePlaceholder')"
>
<el-option
v-for="(item, index) in courseTypeList"
:key="index"
:label="item.name"
:value="item.name"
/>
<el-select class="input-width" v-model="formData.course_type" :placeholder="t('courseTypePlaceholder')">
<el-option v-for="(item, index) in courseTypeList" :key="index" :label="item.name"
:value="item.name" />
</el-select>
</el-form-item>
<el-form-item :label="t('duration')" prop="duration">
<el-input
v-model="formData.duration"
clearable
:placeholder="t('durationPlaceholder')"
class="input-width"
/>
<el-input v-model="formData.duration" clearable :placeholder="t('durationPlaceholder')"
class="input-width">
<template #suffix>
<span></span>
</template>
</el-input>
</el-form-item>
<el-form-item :label="t('sessionCount')" prop="session_count">
<el-input
v-model="formData.session_count"
clearable
:placeholder="t('sessionCountPlaceholder')"
class="input-width"
/>
<el-input v-model="formData.session_count" clearable :placeholder="t('sessionCountPlaceholder')"
class="input-width" >
<template #suffix>
<span></span>
</template>
</el-input>
</el-form-item>
<el-form-item :label="t('giftSessionCount')" prop="gift_session_count">
<el-input
v-model="formData.gift_session_count"
clearable
:placeholder="t('giftSessionCountPlaceholder')"
class="input-width"
/>
<el-input v-model="formData.gift_session_count" clearable
:placeholder="t('giftSessionCountPlaceholder')" class="input-width" >
<template #suffix>
<span></span>
</template>
</el-input>
</el-form-item>
<el-form-item
:label="t('singleSessionCount')"
prop="single_session_count"
>
<el-input
v-model="formData.single_session_count"
clearable
:placeholder="t('singleSessionCountPlaceholder')"
class="input-width"
/>
<el-form-item :label="t('singleSessionCount')" prop="single_session_count">
<el-input v-model="formData.single_session_count" clearable
:placeholder="t('singleSessionCountPlaceholder')" class="input-width" >
<template #suffix>
<span></span>
</template>
</el-input>
</el-form-item>
<el-form-item :label="t('price')" prop="price">
<el-input
v-model="formData.price"
clearable
:placeholder="t('pricePlaceholder')"
class="input-width"
/>
<el-input v-model="formData.price" clearable :placeholder="t('pricePlaceholder')" class="input-width" >
<template #suffix>
<span></span>
</template>
</el-input>
</el-form-item>
<el-form-item :label="t('internalReminder')" prop="internal_reminder">
<el-input
v-model="formData.internal_reminder"
clearable
:placeholder="t('internalReminderPlaceholder')"
class="input-width"
/>
<el-input v-model="formData.internal_reminder" clearable :placeholder="t('internalReminderPlaceholder')"
class="input-width" >
<template #suffix>
<span></span>
</template>
</el-input>
</el-form-item>
<el-form-item :label="t('customerReminder')" prop="customer_reminder">
<el-input
v-model="formData.customer_reminder"
clearable
:placeholder="t('customerReminderPlaceholder')"
class="input-width"
/>
<el-input v-model="formData.customer_reminder" clearable :placeholder="t('customerReminderPlaceholder')"
class="input-width" >
<template #suffix>
<span></span>
</template>
</el-input>
</el-form-item>
<el-form-item :label="t('remarks')">
<el-input
v-model="formData.remarks"
clearable
:placeholder="t('remarksPlaceholder')"
class="input-width"
/>
<el-input v-model="formData.remarks" clearable :placeholder="t('remarksPlaceholder')"
class="input-width" />
</el-form-item>
</el-form>
<template #footer>
<span class="dialog-footer">
<el-button @click="showDialog = false">{{ t('cancel') }}</el-button>
<el-button
type="primary"
:loading="loading"
@click="confirm(formRef)"
>{{ t('confirm') }}</el-button
>
<el-button type="primary" :loading="loading" @click="confirm(formRef)">{{ t('confirm') }}</el-button>
</span>
</template>
</el-dialog>

4
admin/src/app/views/departments/departments.vue

@ -91,7 +91,7 @@
:show-overflow-tooltip="true"
/>
<el-table-column
<!-- <el-table-column
:label="t('operation')"
fixed="right"
min-width="120"
@ -104,7 +104,7 @@
t('delete')
}}</el-button>
</template>
</el-table-column>
</el-table-column> -->
</el-table>
<div class="mt-[16px] flex justify-end">
<el-pagination

115
admin/src/app/views/xsyj/xsyj.vue

@ -8,19 +8,13 @@
</el-card>
<el-card class="box-card !border-none" shadow="never">
<div
class="flex items-center justify-between p-[10px] table-item-border bg"
>
<div class="flex items-center justify-between p-[10px] table-item-border bg">
<span class="text-base w-[230px]">阶段名称</span>
<span class="text-base w-[110px] text-center">底薪</span>
</div>
<el-collapse v-model="activeNames" accordion>
<el-collapse-item
v-for="(stage, index) in stages"
:key="stage.id"
:name="stage.id"
>
<el-collapse-item v-for="(stage, index) in stages" :key="stage.id" :name="stage.id">
<template #title>
<div class="collapse-title">
<span class="title-name">{{ stage.name }}</span>
@ -41,26 +35,18 @@
</el-form-item>
</el-form>
<el-button type="success" size="small" @click="addRule(stage)"
>新增规则</el-button
>
<el-button type="success" size="small" @click="addRule(stage)">新增规则</el-button>
<el-table :data="stage.rules" border style="margin-top: 10px">
<el-table-column prop="renewal_standard_min" label="续费上限">
<template #default="{ row }">
<el-input
v-model="row.renewal_standard_min"
placeholder="请输入续费上限"
/>
<el-input v-model="row.renewal_standard_min" placeholder="请输入续费上限" />
</template>
</el-table-column>
<el-table-column prop="renewal_standard_max" label="续费下限">
<template #default="{ row }">
<el-input
v-model="row.renewal_standard_max"
placeholder="请输入续费下限"
/>
<el-input v-model="row.renewal_standard_max" placeholder="请输入续费下限" />
</template>
</el-table-column>
@ -82,6 +68,19 @@
</template>
</el-table-column>
<el-table-column prop="xf_count_min" label="续费成交数上限">
<template #default="{ row }">
<el-input v-model="row.xf_count_min" />
</template>
</el-table-column>
<el-table-column prop="xf_count_max" label="续费成交数下限">
<template #default="{ row }">
<el-input v-model="row.xf_count_max" />
</template>
</el-table-column>
<el-table-column prop="new_move_5" label="新招(5+1)x3">
<template #default="{ row }">
<el-input v-model="row.new_move_5" />
@ -94,26 +93,55 @@
</el-table-column>
<el-table-column label="操作" width="100">
<template #default="{ $index }">
<el-button
type="danger"
size="small"
@click="removeRule(stage, $index)"
>删除</el-button
>
<el-button type="danger" size="small" @click="removeRule(stage, $index)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-button
type="danger"
size="small"
style="margin-top: 10px"
@click="removeStage(index)"
>删除该阶段</el-button
>
<el-button type="danger" size="small" style="margin-top: 10px"
@click="removeStage(index)">删除该阶段</el-button>
</el-collapse-item>
</el-collapse>
<el-form label-position="left" label-width="100px" class="config-form" style="margin-top: 70px;">
<h3>其他绩效配置</h3>
<el-row :gutter="20">
<el-col :span="6">
<el-form-item label="一访成交">
<el-input v-model="form.qt_firstVisit" placeholder="%" suffix-icon="el-icon-percent" />
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="二访成交">
<el-input v-model="form.qt_secondVisit" placeholder="%" suffix-icon="el-icon-percent" />
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="追单">
<el-input v-model="form.qt_followUp" placeholder="%" suffix-icon="el-icon-percent" />
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="内部员工">
<el-input v-model="form.qt_internalStaff" placeholder="元" suffix-icon="el-icon-money" />
</el-form-item>
</el-col>
</el-row>
<view v-for="(item, index) in course_type">
<el-form-item :label="item.name" >
<el-input v-model="item.num" placeholder="元" style="width: 200px;"/>
</el-form-item>
</view>
</el-form>
<div style="text-align: right; margin-top: 20px">
<el-button type="primary" @click="onSave">提交保存</el-button>
</div>
@ -133,6 +161,19 @@ const loading = ref(true)
const stages = ref([])
const activeNames = ref(null)
const form = ref({
qt_firstVisit: '',
qt_secondVisit: '',
qt_followUp: '',
qt_internalStaff: '',
});
const course_type = ref({});
function addStage() {
const newStage = {
name: '默认阶段',
@ -144,6 +185,8 @@ function addStage() {
renewal_commission: '',
new_count_min: '',
new_count_max: '',
xf_count_min: '',
xf_count_max: '',
new_move_5: '',
new_move_7: '',
},
@ -164,6 +207,8 @@ function addRule(stage) {
renewal_commission: '',
new_count_min: '',
new_count_max: '',
xf_count_min: '',
xf_count_max: '',
new_move_5: '',
new_move_7: '',
})
@ -179,14 +224,16 @@ function removeRule(stage, ruleIndex) {
const setFormData = async () => {
const data = await (await getXsyjConfig()).data
stages.value = data
stages.value = data.data
form.value = data.form
course_type.value = data.course_type
loading.value = false
}
setFormData()
const onSave = async () => {
xsyjConfig(stages.value)
xsyjConfig({ 'stages': stages.value, 'form': form.value,'course_type':course_type.value})
.then(() => {
loading.value = true
setFormData()

3
niucloud/app/adminapi/controller/course/Course.php

@ -94,8 +94,9 @@ class Course extends BaseAdminController
["customer_reminder", 0],
["remarks", ""],
["contract_id",""],
["gift_session_count ",""],
["gift_session_count",0],
]);
$this->validate($data, 'app\validate\course\Course.edit');
(new CourseService())->edit($id, $data);
return success('EDIT_SUCCESS');

1
niucloud/app/adminapi/controller/sys/System.php

@ -127,6 +127,7 @@ class System extends BaseAdminController
public function xsyj_config(){
$data = $this->request->post();
return success(data: (new SystemService())->xsyj_config($data));
}

8
niucloud/app/api/controller/apiController/Personnel.php

@ -72,12 +72,14 @@ class Personnel extends BaseApiService
$where = [
'account_type' => $request->param('account_type', ''),//账号类型|teacher=老师,market=销售
'personnel_id' => $request->param('personnel_id', ''),//员工id
'campus' => $request->param('campus', ''),//校区id
];
$field = 'id,name';
$res = (new PersonnelService())->getAll($where,$field);
if(!$res){
return fail('账户信息有误');
}
// if(!$res){
// return fail('账户信息有误');
// }
return success($res);
}

99
niucloud/app/api/controller/apiController/Statistics.php

@ -13,6 +13,7 @@ namespace app\api\controller\apiController;
use app\model\market_performance\MarketPerformance;
use app\model\order_table\OrderTable;
use app\model\personnel\PersonnelSummary;
use app\Request;
use app\service\api\apiService\CommonService;
use core\base\BaseApiService;
@ -249,6 +250,8 @@ class Statistics extends BaseApiService
*/
public function marketData(Request $request)
{
$resourceSharing = new ResourceSharing();
$customerResources = new CustomerResources();
$personnel_id = $request->param('personnel_id','');//员工表id
$role_key_arr = $request->param('role_key_arr','');//array 角色key
$role_key_arr = explode(',',$role_key_arr);
@ -258,59 +261,75 @@ class Statistics extends BaseApiService
// $role_key_arr = ['sale'];//@todo 调试使用
$assigned = 0;
$unassigned = 0;
$lastWeekNewTotal = 0;
$resource_list = $resourceSharing->where(['shared_by' => $personnel_id])->select();
foreach($resource_list as $item){
$sharedAt = strtotime($item['shared_at']);
$date = date("Y-m-d",$sharedAt);
if(isDateInThisWeek($date)){
$assigned++;
}
}
$customer_list = $customerResources->where(['consultant' => $personnel_id])->select();
foreach($customer_list as $item){
if(!$resourceSharing->where(['resource_id' => $item['id']])->find()){
if(isDateInThisWeek($item['create_date'])){
$unassigned++;
}
}
if(isDateInLastWeek($item['create_date'])){
$lastWeekNewTotal++;
}
}
$staff_list = [];
$personnel_summary = new PersonnelSummary();
$staff_list = $personnel_summary
->alias('a')
->join(['school_campus_person_role' => 'b'],'a.campus_person_role_id = b.id','left')
->join(['school_personnel' => 'c'],'b.person_id = c.id','left')
->field("c.name,a.task_num as goal,a.complete_num as wx_yj")
->select();
if(in_array('market',$role_key_arr) || in_array('market_manager',$role_key_arr)){
//市场人员统计数据(地推拉人头的)
$data = [
'role_type'=>'market_type',//角色类型|market_type=市场,sale_type=销售
'num_1' => ($assigned = rand(20, 150)),//本周已分配
'num_2' => ($unassigned = rand(5, 50)),//本周未分配
'num_1' => $assigned,//本周已分配
'num_2' => $unassigned,//本周未分配
'total_1' => ($newTotal = $assigned + $unassigned),//本周拉新总数
'total_2' => ($lastWeekNewTotal = rand(10, 100)),//上周拉新总数
'num_1_rate' => min(100, round($assigned / $newTotal * 100, 2)),//已分配比例
'num_2_rate' => min(100, round($unassigned / $newTotal * 100, 2)),//未分配比例
'num_3_rate' => min(100, round($newTotal / max(1, $lastWeekNewTotal) * 100, 2)), // 本周拉新率(对比上周)
'num_4_rate' => min(100, round($assigned / max(1, $lastWeekNewTotal) * 100, 2)), // 本周分配率(对比上周)
'staff_list' => [
['name' => '张三', 'goal' => rand(50, 200), 'wx_yj' => rand(30, 180)],
['name' => '李四', 'goal' => rand(50, 200), 'wx_yj' => rand(30, 180)],
['name' => '王五', 'goal' => rand(50, 200), 'wx_yj' => rand(30, 180)],
['name' => '赵六', 'goal' => rand(50, 200), 'wx_yj' => rand(30, 180)],
['name' => '钱七', 'goal' => rand(50, 200), 'wx_yj' => rand(30, 180)],
['name' => '孙八', 'goal' => rand(50, 200), 'wx_yj' => rand(30, 180)],
['name' => '周九', 'goal' => rand(50, 200), 'wx_yj' => rand(30, 180)],
['name' => '吴十', 'goal' => rand(50, 200), 'wx_yj' => rand(30, 180)],
['name' => '郑十一', 'goal' => rand(50, 200), 'wx_yj' => rand(30, 180)],
['name' => '王十二', 'goal' => rand(50, 200), 'wx_yj' => rand(30, 180)],
],
'total_2' => $lastWeekNewTotal,//上周拉新总数
'num_1_rate' => $newTotal ? min(100, round($assigned / $newTotal * 100, 2)) : 0,//已分配比例
'num_2_rate' => $newTotal ? min(100, round($unassigned / $newTotal * 100, 2)) : 0,//未分配比例
'num_3_rate' => $lastWeekNewTotal ? min(100, round($newTotal / max(1, $lastWeekNewTotal) * 100, 2)) : 0, // 本周拉新率(对比上周)
'num_4_rate' => $lastWeekNewTotal ? min(100, round($assigned / max(1, $lastWeekNewTotal) * 100, 2)) : 0, // 本周分配率(对比上周)
'staff_list' => $staff_list,
];
}elseif(in_array('sale',$role_key_arr) || in_array('sale_manager',$role_key_arr)){
//销售人员统计数据(买课的)
$data = [
'role_type'=>'sale',//角色类型|market_type=市场,sale_type=销售
'num_1' => ($assigned = rand(20, 150)),//本周已分配
'num_2' => ($unassigned = rand(5, 50)),//本周未分配
'num_1' => $assigned,//本周已分配
'num_2' => $unassigned,//本周未分配
'total_1' => ($newTotal = $assigned + $unassigned),//本周拉新总数
'total_2' => ($lastWeekNewTotal = rand(10, 100)),//上周拉新总数
'num_1_rate' => min(100, round($assigned / $newTotal * 100, 2)),//已分配比例
'num_2_rate' => min(100, round($unassigned / $newTotal * 100, 2)),//未分配比例
'num_3_rate' => min(100, round($newTotal / max(1, $lastWeekNewTotal) * 100, 2)), // 本周拉新率(对比上周)
'num_4_rate' => min(100, round($assigned / max(1, $lastWeekNewTotal) * 100, 2)), // 本周分配率(对比上周)
'staff_list' => [
['name' => '张三', 'goal' => rand(50, 200), 'wx_yj' => rand(30, 180)],
['name' => '李四', 'goal' => rand(50, 200), 'wx_yj' => rand(30, 180)],
['name' => '王五', 'goal' => rand(50, 200), 'wx_yj' => rand(30, 180)],
['name' => '赵六', 'goal' => rand(50, 200), 'wx_yj' => rand(30, 180)],
['name' => '钱七', 'goal' => rand(50, 200), 'wx_yj' => rand(30, 180)],
['name' => '孙八', 'goal' => rand(50, 200), 'wx_yj' => rand(30, 180)],
['name' => '周九', 'goal' => rand(50, 200), 'wx_yj' => rand(30, 180)],
['name' => '吴十', 'goal' => rand(50, 200), 'wx_yj' => rand(30, 180)],
['name' => '郑十一', 'goal' => rand(50, 200), 'wx_yj' => rand(30, 180)],
['name' => '王十二', 'goal' => rand(50, 200), 'wx_yj' => rand(30, 180)],
],
'total_2' => $lastWeekNewTotal,//上周拉新总数
'num_1_rate' => $newTotal ? min(100, round($assigned / $newTotal * 100, 2)) : 0,//已分配比例
'num_2_rate' => $newTotal ? min(100, round($unassigned / $newTotal * 100, 2)) : 0,//未分配比例
'num_3_rate' => $lastWeekNewTotal ? min(100, round($newTotal / max(1, $lastWeekNewTotal) * 100, 2)) : 0, // 本周拉新率(对比上周)
'num_4_rate' => $lastWeekNewTotal ? min(100, round($assigned / max(1, $lastWeekNewTotal) * 100, 2)) : 0, // 本周分配率(对比上周)
'staff_list' => $staff_list,
];
}else{
return fail('角色权限不正确');

22
niucloud/app/common.php

@ -1271,3 +1271,25 @@ function get_role_type($role_id)
/**
* 获取顶级部门
*/
function isDateInThisWeek($date) {
$timestamp = strtotime($date);
// 获取本周开始和结束时间戳(周一到周日)
$monday = strtotime('monday this week');
$sunday = strtotime('sunday this week 23:59:59');
return $timestamp >= $monday && $timestamp <= $sunday;
}
function isDateInLastWeek($date) {
$timestamp = strtotime($date);
// 获取上周的周一(开始)和周日(结束)
$startOfLastWeek = strtotime('monday last week');
$endOfLastWeek = strtotime('sunday last week 23:59:59');
return $timestamp >= $startOfLastWeek && $timestamp <= $endOfLastWeek;
}

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

@ -48,9 +48,9 @@ class CampusPersonRoleService extends BaseAdminService
$where[] = ['a.campus_id','=',$data['campus_id']];
}
// if($data['role_id']){
// $where[] = ['a.role_id','=',$data['role_id']];
// }
if($data['role_id']){
$where[] = ['a.role_id','=',$data['role_id']];
}
if($data['dept_id']){
$where[] = ['a.dept_id','=',$data['dept_id']];
@ -96,9 +96,12 @@ class CampusPersonRoleService extends BaseAdminService
*/
public function add(array $data)
{
if($this->model->where(['person_id' => $data['person_id']])->find()){
return fail("重复操作");
}
$role = new SysRole();
$data['dept_id'] = $role->where(['role_id' => $data['role_id']])->value("dept_id");
$res = $this->model->create($data);
return success("操作成功");
@ -122,6 +125,9 @@ class CampusPersonRoleService extends BaseAdminService
$personnel_summary->where(['id' => $tasks['id']])->update(['task_num' => $tasks['task_num']]);
}
$role = new SysRole();
$data['dept_id'] = $role->where(['role_id' => $data['role_id']])->value("dept_id");
$this->model->where([['id', '=', $id]])->update($data);
return success("操作成功");
}

1
niucloud/app/service/admin/course/CourseService.php

@ -84,7 +84,6 @@ class CourseService extends BaseAdminService
*/
public function edit(int $id, array $data)
{
$this->model->where([['id', '=', $id]])->update($data);
return true;
}

35
niucloud/app/service/admin/sys/SystemService.php

@ -207,7 +207,15 @@ class SystemService extends BaseAdminService
$config = new SysConfig();
$config->where(['config_key' => 'XSYJ'])->update([
'value' => json_encode($data)
'value' => json_encode($data['stages'])
]);
$config->where(['config_key' => 'XSPJ'])->update([
'value' => json_encode($data['form'])
]);
$config->where(['config_key' => 'course_type'])->update([
'value' => json_encode($data['course_type'])
]);
return true;
@ -215,11 +223,34 @@ class SystemService extends BaseAdminService
public function get_xsyj_config(){
$dict = new \app\model\dict\Dict();
$config = new SysConfig();
$data = $config->where(['config_key' => 'XSYJ'])->value("value");
return $data;
$form = $config->where(['config_key' => 'XSPJ'])->value("value");
$course_type = $config->where(['config_key' => 'course_type'])->value("value");
// $course_type = json_decode($course_type, true);
$dict_course_type = $dict->where(['key' => 'course_type'])->value("dictionary");
$dict_course_type = json_decode($dict_course_type, true);
foreach ($dict_course_type as $k => $v) {
foreach ($course_type as $k1 => $v1) {
if($v['value'] == $v1['value']){
$dict_course_type[$k]['num'] = $v1['num'] ?? 0;
}
}
if(!isset($dict_course_type[$k]['num'])){
$dict_course_type[$k]['num'] = 0;
}
}
return ['data' => $data,'form' => $form,'course_type' => $dict_course_type];
}

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

@ -192,8 +192,20 @@ class PersonnelService extends BaseApiService
$campus_id = CampusPersonRole::where('person_id', $where['personnel_id'])
->distinct(true)
->column('campus_id');
if ($campus_id) {
if ($campus_id[0]) {
$person_id_arr = CampusPersonRole::whereIn('campus_id', $campus_id)
->where(['dept_id' => 3])
->distinct(true)
->column('person_id');
if ($person_id_arr) {
//根据校区id获取校区下的全部员工
$model = $model->whereIn('id', $person_id_arr);
}
}else{
echo 123;die;
$person_id_arr = CampusPersonRole::whereIn('campus_id', $campus_id)
->where(['dept_id' => 3])
->distinct(true)
->column('person_id');
if ($person_id_arr) {
@ -207,6 +219,22 @@ class PersonnelService extends BaseApiService
$model = $model->where('account_type', $where['account_type']);
}
if (!empty($where['campus'])) {
// $model = $model->where('campus', $where['campus']);
$person_id_arr = CampusPersonRole::whereIn('campus_id', $where['campus'])
->distinct(true)
->where(['dept_id' => 3])
->column('person_id');
if ($person_id_arr) {
//根据校区id获取校区下的全部员工
$model = $model->whereIn('id', $person_id_arr);
}
}
$res = $model->field($field)
->select()
->toArray();//员工信息

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

@ -11,6 +11,7 @@
namespace app\service\api\apiService;
use app\model\campus\Campus;
use app\model\campus_person_role\CampusPersonRole;
use app\model\customer_resources\CustomerResources;
use app\model\order_table\OrderTable;
@ -101,9 +102,11 @@ class ResourceSharingService extends BaseApiService
'page' => $page,
])->toArray();
$campus = new Campus();
foreach ($res['data'] as &$item){
$item['customerResource']['source_channel'] = get_dict_value('source',$item['customerResource']['source_channel']);
$item['customerResource']['campus_name'] = $campus->where(['id' =>$item['customerResource']['campus']])->value("campus_name");
}
return $res;

Loading…
Cancel
Save