79 changed files with 3282 additions and 1339 deletions
@ -1,5 +1,5 @@ |
|||
// Generated by 'unplugin-auto-import'
|
|||
export {} |
|||
declare global { |
|||
|
|||
const ElNotification: typeof import('element-plus/es')['ElNotification'] |
|||
} |
|||
|
|||
@ -0,0 +1,56 @@ |
|||
import request from '@/utils/request' |
|||
|
|||
// USER_CODE_BEGIN -- market_performance
|
|||
/** |
|||
* 获取市场绩效列表 |
|||
* @param params |
|||
* @returns |
|||
*/ |
|||
export function getMarketPerformanceList(params: Record<string, any>) { |
|||
return request.get(`market_performance/market_performance`, {params}) |
|||
} |
|||
|
|||
/** |
|||
* 获取市场绩效详情 |
|||
* @param id 市场绩效id |
|||
* @returns |
|||
*/ |
|||
export function getMarketPerformanceInfo(id: number) { |
|||
return request.get(`market_performance/market_performance/${id}`); |
|||
} |
|||
|
|||
/** |
|||
* 添加市场绩效 |
|||
* @param params |
|||
* @returns |
|||
*/ |
|||
export function addMarketPerformance(params: Record<string, any>) { |
|||
return request.post('market_performance/market_performance', params, { showErrorMessage: true, showSuccessMessage: true }) |
|||
} |
|||
|
|||
/** |
|||
* 编辑市场绩效 |
|||
* @param id |
|||
* @param params |
|||
* @returns |
|||
*/ |
|||
export function editMarketPerformance(params: Record<string, any>) { |
|||
return request.put(`market_performance/market_performance/${params.id}`, params, { showErrorMessage: true, showSuccessMessage: true }) |
|||
} |
|||
|
|||
/** |
|||
* 删除市场绩效 |
|||
* @param id |
|||
* @returns |
|||
*/ |
|||
export function deleteMarketPerformance(id: number) { |
|||
return request.delete(`market_performance/market_performance/${id}`, { showErrorMessage: true, showSuccessMessage: true }) |
|||
} |
|||
|
|||
export function getWithPersonnelList(params: Record<string,any>){ |
|||
return request.get('market_performance/personnel_all', {params}) |
|||
}export function getWithCampusList(params: Record<string,any>){ |
|||
return request.get('market_performance/campus_all', {params}) |
|||
} |
|||
|
|||
// USER_CODE_END -- market_performance
|
|||
@ -0,0 +1,13 @@ |
|||
{ |
|||
"personnelId":"人员", |
|||
"personnelIdPlaceholder":"请输入人员", |
|||
"campusId":"校区", |
|||
"campusIdPlaceholder":"全部", |
|||
"performanceAmount":"绩效金额", |
|||
"performanceAmountPlaceholder":"请输入绩效金额", |
|||
"addMarketPerformance":"添加市场绩效", |
|||
"updateMarketPerformance":"编辑市场绩效", |
|||
"marketPerformanceDeleteTips":"确定要删除该数据吗?", |
|||
"startDate":"请选择开始时间", |
|||
"endDate":"请选择结束时间" |
|||
} |
|||
@ -0,0 +1,189 @@ |
|||
<template> |
|||
<el-dialog v-model="showDialog" :title="formData.id ? t('updateMarketPerformance') : t('addMarketPerformance')" 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('personnelId')" > |
|||
<el-select class="input-width" v-model="formData.personnel_id" clearable :placeholder="t('personnelIdPlaceholder')"> |
|||
<el-option label="请选择" value=""></el-option> |
|||
<el-option |
|||
v-for="(item, index) in personnelIdList" |
|||
:key="index" |
|||
:label="item['name']" |
|||
:value="item['id']" |
|||
/> |
|||
</el-select> |
|||
</el-form-item> |
|||
|
|||
<el-form-item :label="t('campusId')" > |
|||
<el-select class="input-width" v-model="formData.campus_id" clearable :placeholder="t('campusIdPlaceholder')"> |
|||
<el-option label="请选择" value=""></el-option> |
|||
<el-option |
|||
v-for="(item, index) in campusIdList" |
|||
:key="index" |
|||
:label="item['campus_name']" |
|||
:value="item['id']" |
|||
/> |
|||
</el-select> |
|||
</el-form-item> |
|||
|
|||
<el-form-item :label="t('performanceAmount')" > |
|||
<el-input v-model="formData.performance_amount" clearable :placeholder="t('performanceAmountPlaceholder')" 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> |
|||
</span> |
|||
</template> |
|||
</el-dialog> |
|||
</template> |
|||
|
|||
<script lang="ts" setup> |
|||
import { ref, reactive, computed, watch } from 'vue' |
|||
import { useDictionary } from '@/app/api/dict' |
|||
import { t } from '@/lang' |
|||
import type { FormInstance } from 'element-plus' |
|||
import { addMarketPerformance, editMarketPerformance, getMarketPerformanceInfo, getWithPersonnelList, getWithCampusList } from '@/app/api/market_performance' |
|||
|
|||
let showDialog = ref(false) |
|||
const loading = ref(false) |
|||
|
|||
/** |
|||
* 表单数据 |
|||
*/ |
|||
const initialFormData = { |
|||
id: '', |
|||
personnel_id: '', |
|||
campus_id: '', |
|||
performance_amount: '', |
|||
} |
|||
const formData: Record<string, any> = reactive({ ...initialFormData }) |
|||
|
|||
const formRef = ref<FormInstance>() |
|||
|
|||
// 表单验证规则 |
|||
const formRules = computed(() => { |
|||
return { |
|||
personnel_id: [ |
|||
{ required: true, message: t('personnelIdPlaceholder'), trigger: 'blur' }, |
|||
|
|||
] |
|||
, |
|||
campus_id: [ |
|||
{ required: true, message: t('campusIdPlaceholder'), trigger: 'blur' }, |
|||
|
|||
] |
|||
, |
|||
performance_amount: [ |
|||
{ required: true, message: t('performanceAmountPlaceholder'), trigger: 'blur' }, |
|||
|
|||
] |
|||
, |
|||
} |
|||
}) |
|||
|
|||
const emit = defineEmits(['complete']) |
|||
|
|||
/** |
|||
* 确认 |
|||
* @param formEl |
|||
*/ |
|||
const confirm = async (formEl: FormInstance | undefined) => { |
|||
if (loading.value || !formEl) return |
|||
let save = formData.id ? editMarketPerformance : addMarketPerformance |
|||
|
|||
await formEl.validate(async (valid) => { |
|||
if (valid) { |
|||
loading.value = true |
|||
|
|||
let data = formData |
|||
|
|||
save(data).then(res => { |
|||
loading.value = false |
|||
showDialog.value = false |
|||
emit('complete') |
|||
}).catch(err => { |
|||
loading.value = false |
|||
}) |
|||
} |
|||
}) |
|||
} |
|||
|
|||
// 获取字典数据 |
|||
|
|||
|
|||
|
|||
const personnelIdList = ref([] as any[]) |
|||
const setPersonnelIdList = async () => { |
|||
personnelIdList.value = await (await getWithPersonnelList({})).data |
|||
} |
|||
setPersonnelIdList() |
|||
const campusIdList = ref([] as any[]) |
|||
const setCampusIdList = async () => { |
|||
campusIdList.value = await (await getWithCampusList({})).data |
|||
} |
|||
setCampusIdList() |
|||
const setFormData = async (row: any = null) => { |
|||
Object.assign(formData, initialFormData) |
|||
loading.value = true |
|||
if(row){ |
|||
const data = await (await getMarketPerformanceInfo(row.id)).data |
|||
if (data) Object.keys(formData).forEach((key: string) => { |
|||
if (data[key] != undefined) formData[key] = data[key] |
|||
}) |
|||
} |
|||
loading.value = false |
|||
} |
|||
|
|||
// 验证手机号格式 |
|||
const mobileVerify = (rule: any, value: any, callback: any) => { |
|||
if (value && !/^1[3-9]\d{9}$/.test(value)) { |
|||
callback(new Error(t('generateMobile'))) |
|||
} else { |
|||
callback() |
|||
} |
|||
} |
|||
|
|||
// 验证身份证号 |
|||
const idCardVerify = (rule: any, value: any, callback: any) => { |
|||
if (value && !/^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/.test(value)) { |
|||
callback(new Error(t('generateIdCard'))) |
|||
} else { |
|||
callback() |
|||
} |
|||
} |
|||
|
|||
// 验证邮箱号 |
|||
const emailVerify = (rule: any, value: any, callback: any) => { |
|||
if (value && !/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/.test(value)) { |
|||
callback(new Error(t('generateEmail'))) |
|||
} else { |
|||
callback() |
|||
} |
|||
} |
|||
|
|||
// 验证请输入整数 |
|||
const numberVerify = (rule: any, value: any, callback: any) => { |
|||
if (!Number.isInteger(value)) { |
|||
callback(new Error(t('generateNumber'))) |
|||
} else { |
|||
callback() |
|||
} |
|||
} |
|||
|
|||
defineExpose({ |
|||
showDialog, |
|||
setFormData |
|||
}) |
|||
</script> |
|||
|
|||
<style lang="scss" scoped></style> |
|||
<style lang="scss"> |
|||
.diy-dialog-wrap .el-form-item__label{ |
|||
height: auto !important; |
|||
} |
|||
</style> |
|||
@ -0,0 +1,186 @@ |
|||
<template> |
|||
<div class="main-container"> |
|||
<el-card class="box-card !border-none" shadow="never"> |
|||
|
|||
<div class="flex justify-between items-center"> |
|||
<span class="text-lg">{{pageName}}</span> |
|||
<!-- <el-button type="primary" @click="addEvent"> |
|||
{{ t('addMarketPerformance') }} |
|||
</el-button> --> |
|||
</div> |
|||
|
|||
<el-card class="box-card !border-none my-[10px] table-search-wrap" shadow="never"> |
|||
<el-form :inline="true" :model="marketPerformanceTable.searchParam" ref="searchFormRef"> |
|||
|
|||
<el-form-item :label="t('campusId')" prop="campus_id"> |
|||
<el-select class="w-[280px]" v-model="marketPerformanceTable.searchParam.campus_id" clearable :placeholder="t('campusIdPlaceholder')"> |
|||
<el-option |
|||
v-for="(item, index) in campusIdList" |
|||
:key="index" |
|||
:label="item['campus_name']" |
|||
:value="item['id']" |
|||
/> |
|||
</el-select> |
|||
</el-form-item> |
|||
|
|||
<el-form-item :label="t('performanceAmount')" prop="performance_amount"> |
|||
<el-input v-model="marketPerformanceTable.searchParam.performance_amount" :placeholder="t('performanceAmountPlaceholder')" /> |
|||
</el-form-item> |
|||
<el-form-item> |
|||
<el-button type="primary" @click="loadMarketPerformanceList()">{{ t('search') }}</el-button> |
|||
<el-button @click="resetForm(searchFormRef)">{{ t('reset') }}</el-button> |
|||
</el-form-item> |
|||
</el-form> |
|||
</el-card> |
|||
|
|||
<div class="mt-[10px]"> |
|||
<el-table :data="marketPerformanceTable.data" size="large" v-loading="marketPerformanceTable.loading"> |
|||
<template #empty> |
|||
<span>{{ !marketPerformanceTable.loading ? t('emptyData') : '' }}</span> |
|||
</template> |
|||
<el-table-column prop="personnel_id_name" :label="t('personnelId')" min-width="120" :show-overflow-tooltip="true"/> |
|||
|
|||
<el-table-column prop="campus_id_name" :label="t('campusId')" min-width="120" :show-overflow-tooltip="true"/> |
|||
|
|||
<el-table-column prop="performance_amount" :label="t('performanceAmount')" min-width="120" :show-overflow-tooltip="true"/> |
|||
<!-- |
|||
<el-table-column :label="t('operation')" fixed="right" min-width="120"> |
|||
<template #default="{ row }"> |
|||
<el-button type="primary" link @click="editEvent(row)">{{ t('edit') }}</el-button> |
|||
<el-button type="primary" link @click="deleteEvent(row.id)">{{ t('delete') }}</el-button> |
|||
</template> |
|||
</el-table-column> --> |
|||
|
|||
</el-table> |
|||
<div class="mt-[16px] flex justify-end"> |
|||
<el-pagination v-model:current-page="marketPerformanceTable.page" v-model:page-size="marketPerformanceTable.limit" |
|||
layout="total, sizes, prev, pager, next, jumper" :total="marketPerformanceTable.total" |
|||
@size-change="loadMarketPerformanceList()" @current-change="loadMarketPerformanceList" /> |
|||
</div> |
|||
</div> |
|||
|
|||
<edit ref="editMarketPerformanceDialog" @complete="loadMarketPerformanceList" /> |
|||
</el-card> |
|||
</div> |
|||
</template> |
|||
|
|||
<script lang="ts" setup> |
|||
import { reactive, ref, watch } from 'vue' |
|||
import { t } from '@/lang' |
|||
import { useDictionary } from '@/app/api/dict' |
|||
import { getMarketPerformanceList, deleteMarketPerformance, getWithPersonnelList, getWithCampusList } from '@/app/api/market_performance' |
|||
import { img } from '@/utils/common' |
|||
import { ElMessageBox,FormInstance } from 'element-plus' |
|||
import Edit from '@/app/views/market_performance/components/market-performance-edit.vue' |
|||
import { useRoute } from 'vue-router' |
|||
const route = useRoute() |
|||
const pageName = route.meta.title; |
|||
|
|||
let marketPerformanceTable = reactive({ |
|||
page: 1, |
|||
limit: 10, |
|||
total: 0, |
|||
loading: true, |
|||
data: [], |
|||
searchParam:{ |
|||
"campus_id":"", |
|||
"performance_amount":"" |
|||
} |
|||
}) |
|||
|
|||
const searchFormRef = ref<FormInstance>() |
|||
|
|||
// 选中数据 |
|||
const selectData = ref<any[]>([]) |
|||
|
|||
// 字典数据 |
|||
|
|||
|
|||
/** |
|||
* 获取市场绩效列表 |
|||
*/ |
|||
const loadMarketPerformanceList = (page: number = 1) => { |
|||
marketPerformanceTable.loading = true |
|||
marketPerformanceTable.page = page |
|||
|
|||
getMarketPerformanceList({ |
|||
page: marketPerformanceTable.page, |
|||
limit: marketPerformanceTable.limit, |
|||
...marketPerformanceTable.searchParam |
|||
}).then(res => { |
|||
marketPerformanceTable.loading = false |
|||
marketPerformanceTable.data = res.data.data |
|||
marketPerformanceTable.total = res.data.total |
|||
}).catch(() => { |
|||
marketPerformanceTable.loading = false |
|||
}) |
|||
} |
|||
loadMarketPerformanceList() |
|||
|
|||
const editMarketPerformanceDialog: Record<string, any> | null = ref(null) |
|||
|
|||
/** |
|||
* 添加市场绩效 |
|||
*/ |
|||
const addEvent = () => { |
|||
editMarketPerformanceDialog.value.setFormData() |
|||
editMarketPerformanceDialog.value.showDialog = true |
|||
} |
|||
|
|||
/** |
|||
* 编辑市场绩效 |
|||
* @param data |
|||
*/ |
|||
const editEvent = (data: any) => { |
|||
editMarketPerformanceDialog.value.setFormData(data) |
|||
editMarketPerformanceDialog.value.showDialog = true |
|||
} |
|||
|
|||
/** |
|||
* 删除市场绩效 |
|||
*/ |
|||
const deleteEvent = (id: number) => { |
|||
ElMessageBox.confirm(t('marketPerformanceDeleteTips'), t('warning'), |
|||
{ |
|||
confirmButtonText: t('confirm'), |
|||
cancelButtonText: t('cancel'), |
|||
type: 'warning', |
|||
} |
|||
).then(() => { |
|||
deleteMarketPerformance(id).then(() => { |
|||
loadMarketPerformanceList() |
|||
}).catch(() => { |
|||
}) |
|||
}) |
|||
} |
|||
|
|||
|
|||
const personnelIdList = ref([]) |
|||
const setPersonnelIdList = async () => { |
|||
personnelIdList.value = await (await getWithPersonnelList({})).data |
|||
} |
|||
setPersonnelIdList() |
|||
const campusIdList = ref([]) |
|||
const setCampusIdList = async () => { |
|||
campusIdList.value = await (await getWithCampusList({})).data |
|||
} |
|||
setCampusIdList() |
|||
|
|||
const resetForm = (formEl: FormInstance | undefined) => { |
|||
if (!formEl) return |
|||
formEl.resetFields() |
|||
loadMarketPerformanceList() |
|||
} |
|||
</script> |
|||
|
|||
<style lang="scss" scoped> |
|||
/* 多行超出隐藏 */ |
|||
.multi-hidden { |
|||
word-break: break-all; |
|||
text-overflow: ellipsis; |
|||
overflow: hidden; |
|||
display: -webkit-box; |
|||
-webkit-line-clamp: 2; |
|||
-webkit-box-orient: vertical; |
|||
} |
|||
</style> |
|||
@ -0,0 +1,107 @@ |
|||
<template> |
|||
<div class="main-container"> |
|||
<el-card class="box-card !border-none" shadow="never"> |
|||
<el-form |
|||
class="page-form" |
|||
:model="formData" |
|||
label-width="150px" |
|||
ref="ruleFormRef" |
|||
:rules="formRules" |
|||
v-loading="loading" |
|||
> |
|||
<el-form-item |
|||
v-for="day in weekDays" |
|||
:key="day.key" |
|||
:label="day.label" |
|||
:prop="`priceRules.${day.key}`" |
|||
> |
|||
<span style="margin: 0 8px;">每个</span> |
|||
<el-input |
|||
v-model.number="formData.priceRules[day.key].basePrice" |
|||
placeholder="请输入" |
|||
class="input-width" |
|||
clearable |
|||
/> |
|||
<span style="margin: 0 8px;">元 超过</span> |
|||
<el-input |
|||
v-model.number="formData.priceRules[day.key].limitCount" |
|||
placeholder="请输入" |
|||
class="input-width" |
|||
clearable |
|||
/> |
|||
<span style="margin: 0 8px;">个</span> |
|||
<el-input |
|||
v-model.number="formData.priceRules[day.key].extraPrice" |
|||
placeholder="请输入" |
|||
class="input-width" |
|||
clearable |
|||
/> |
|||
<span style="margin-left: 4px;">元</span> |
|||
</el-form-item> |
|||
|
|||
|
|||
</el-form> |
|||
</el-card> |
|||
|
|||
<div class="fixed-footer-wrap"> |
|||
<div class="fixed-footer"> |
|||
<el-button type="primary" @click="onSave()">提交</el-button> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
|
|||
<script lang="ts" setup> |
|||
import { reactive, ref } from 'vue' |
|||
import { t } from '@/lang' |
|||
import { FormInstance, FormRules } from 'element-plus' |
|||
import { yjpzConfig,getYjpzConfig} from '@/app/api/sys' |
|||
|
|||
|
|||
const loading = ref(true) |
|||
const formData = reactive({ |
|||
priceRules: { |
|||
mon: { basePrice: 0, limitCount: 0, extraPrice: 0 }, |
|||
tue: { basePrice: 0, limitCount: 0, extraPrice: 0 }, |
|||
wed: { basePrice: 0, limitCount: 0, extraPrice: 0 }, |
|||
thu: { basePrice: 0, limitCount: 0, extraPrice: 0 }, |
|||
fri: { basePrice: 0, limitCount: 0, extraPrice: 0 }, |
|||
sat: { basePrice: 0, limitCount: 0, extraPrice: 0 }, |
|||
sun: { basePrice: 0, limitCount: 0, extraPrice: 0 }, |
|||
} |
|||
}) |
|||
|
|||
const weekDays = [ |
|||
{ key: 'mon', label: '周一' }, |
|||
{ key: 'tue', label: '周二' }, |
|||
{ key: 'wed', label: '周三' }, |
|||
{ key: 'thu', label: '周四' }, |
|||
{ key: 'fri', label: '周五' }, |
|||
{ key: 'sat', label: '周六' }, |
|||
{ key: 'sun', label: '周日' }, |
|||
] |
|||
|
|||
const formRules = reactive<FormRules>({}) |
|||
|
|||
|
|||
const setFormData = async () => { |
|||
const data = await (await getYjpzConfig()).data |
|||
formData['priceRules'] = data; |
|||
loading.value = false |
|||
} |
|||
setFormData(); |
|||
const onSave = async () => { |
|||
|
|||
yjpzConfig(formData) |
|||
.then(() => { |
|||
loading.value = true |
|||
setFormData(); |
|||
}) |
|||
.catch(() => { |
|||
loading.value = false |
|||
}) |
|||
} |
|||
|
|||
</script> |
|||
|
|||
<style lang="scss" scoped></style> |
|||
@ -0,0 +1,248 @@ |
|||
<template> |
|||
<el-dialog |
|||
v-model="dialogVisible" |
|||
:title="t('mapPickerTitle')" |
|||
width="800px" |
|||
:before-close="handleClose" |
|||
> |
|||
|
|||
<div class="map-container" id="container"></div> |
|||
<div class="address-search"> |
|||
<el-select |
|||
v-model="province" |
|||
:placeholder="t('provincePlaceholder')" |
|||
@change="handleProvinceChange" |
|||
> |
|||
<el-option |
|||
v-for="item in provinceList" |
|||
:key="item.id" |
|||
:label="item.name" |
|||
:value="item.id" |
|||
/> |
|||
</el-select> |
|||
<el-select |
|||
v-model="city" |
|||
:placeholder="t('cityPlaceholder')" |
|||
@change="handleCityChange" |
|||
:disabled="!province" |
|||
> |
|||
<el-option |
|||
v-for="item in cityList" |
|||
:key="item.id" |
|||
:label="item.name" |
|||
:value="item.id" |
|||
/> |
|||
</el-select> |
|||
<el-select |
|||
v-model="district" |
|||
:placeholder="t('districtPlaceholder')" |
|||
@change="handleDistrictChange" |
|||
:disabled="!province || !city" |
|||
> |
|||
<el-option |
|||
v-for="item in districtList" |
|||
:key="item.id" |
|||
:label="item.name" |
|||
:value="item.id" |
|||
/> |
|||
</el-select> |
|||
<el-input |
|||
v-model="detailAddress" |
|||
:placeholder="t('detailAddressPlaceholder')" |
|||
/> |
|||
<el-button type="primary" @click="handleAddressSearch">{{ t('search') }}</el-button> |
|||
</div> |
|||
<template #footer> |
|||
<span class="dialog-footer"> |
|||
<el-button @click="dialogVisible = false">{{ t('cancel') }}</el-button> |
|||
<el-button type="primary" @click="handleConfirm"> |
|||
{{ t('confirm') }} |
|||
</el-button> |
|||
</span> |
|||
</template> |
|||
</el-dialog> |
|||
</template> |
|||
|
|||
<script lang="ts" setup> |
|||
import { ref, onMounted, watch } from 'vue' |
|||
import { getAreaListByPid, getAreaByCode } from '@/app/api/sys' |
|||
import { createMarker, latLngToAddress, addressToLatLng } from '@/utils/qqmap' |
|||
import { t } from '@/lang' |
|||
|
|||
const props = defineProps({ |
|||
modelValue: { |
|||
type: Object, |
|||
default: () => ({ |
|||
lat: null, |
|||
lng: null, |
|||
address: '', |
|||
}), |
|||
}, |
|||
}) |
|||
|
|||
const emit = defineEmits(['update:modelValue', 'confirm']) |
|||
|
|||
const dialogVisible = ref(false) |
|||
|
|||
const handleClose = (done: () => void) => { |
|||
done() |
|||
} |
|||
|
|||
const handleConfirm = () => { |
|||
emit('confirm', { |
|||
lat: props.modelValue.lat, |
|||
lng: props.modelValue.lng, |
|||
address: detailAddress.value |
|||
}) |
|||
dialogVisible.value = false |
|||
} |
|||
|
|||
// 地图相关 |
|||
let map: any |
|||
let marker: any |
|||
const mapKey = ref('') |
|||
|
|||
// 区域选择 |
|||
const province = ref('') |
|||
const city = ref('') |
|||
const district = ref('') |
|||
const detailAddress = ref('') |
|||
const provinceList = ref<any[]>([]) |
|||
const cityList = ref<any[]>([]) |
|||
const districtList = ref<any[]>([]) |
|||
|
|||
// 初始化地图 |
|||
onMounted(() => { |
|||
const mapScript = document.createElement('script') |
|||
mapKey.value = 'IZQBZ-3UHEU-WTCVD-2464U-I5N4V-ZFFU3' |
|||
mapScript.type = 'text/javascript' |
|||
mapScript.src = |
|||
'https://map.qq.com/api/gljs?libraries=tools,service&v=1.exp&key=IZQBZ-3UHEU-WTCVD-2464U-I5N4V-ZFFU3' |
|||
document.body.appendChild(mapScript) |
|||
mapScript.onload = () => { |
|||
setTimeout(() => { |
|||
initMap() |
|||
}, 500) |
|||
} |
|||
|
|||
// 初始化省份列表 |
|||
getAreaListByPid(0).then((res) => { |
|||
provinceList.value = res.data |
|||
}) |
|||
}) |
|||
|
|||
const initMap = () => { |
|||
const TMap = (window as any).TMap |
|||
const center = new TMap.LatLng(39.90403, 116.407526) |
|||
map = new TMap.Map('container', { |
|||
center, |
|||
zoom: 12, |
|||
}) |
|||
|
|||
marker = createMarker(map) |
|||
|
|||
map.on('click', (evt: any) => { |
|||
map.setCenter(evt.latLng) |
|||
marker.updateGeometries({ |
|||
id: 'center', |
|||
position: evt.latLng, |
|||
}) |
|||
emit('update:modelValue', { |
|||
lat: evt.latLng.lat, |
|||
lng: evt.latLng.lng, |
|||
address: detailAddress.value, |
|||
}) |
|||
}) |
|||
} |
|||
|
|||
// 区域选择处理 |
|||
const handleProvinceChange = (val: string) => { |
|||
getAreaListByPid(val).then((res) => { |
|||
cityList.value = res.data |
|||
city.value = '' |
|||
district.value = '' |
|||
}) |
|||
} |
|||
|
|||
const handleCityChange = (val: string) => { |
|||
getAreaListByPid(val).then((res) => { |
|||
districtList.value = res.data |
|||
district.value = '' |
|||
}) |
|||
} |
|||
|
|||
const handleDistrictChange = (val: string) => { |
|||
// TODO: 处理区县选择 |
|||
} |
|||
|
|||
// 地址搜索 |
|||
const handleAddressSearch = () => { |
|||
const address = [ |
|||
province.value |
|||
? provinceList.value.find((p) => p.id === province.value)?.name |
|||
: '', |
|||
city.value ? cityList.value.find((c) => c.id === city.value)?.name : '', |
|||
district.value |
|||
? districtList.value.find((d) => d.id === district.value)?.name |
|||
: '', |
|||
detailAddress.value, |
|||
].join('') |
|||
|
|||
addressToLatLng({ mapKey: mapKey.value, address }).then( |
|||
({ message, result }) => { |
|||
if (message == 'Success' || message == 'query ok') { |
|||
const latLng = new (window as any).TMap.LatLng( |
|||
result.location.lat, |
|||
result.location.lng |
|||
) |
|||
map.setCenter(latLng) |
|||
marker.updateGeometries({ |
|||
id: 'center', |
|||
position: latLng, |
|||
}) |
|||
emit('update:modelValue', { |
|||
lat: result.location.lat, |
|||
lng: result.location.lng, |
|||
address: detailAddress.value, |
|||
}) |
|||
} |
|||
} |
|||
) |
|||
} |
|||
|
|||
// 回显处理 |
|||
watch( |
|||
() => props.modelValue, |
|||
(newVal) => { |
|||
if (newVal.lat && newVal.lng) { |
|||
const latLng = new (window as any).TMap.LatLng(newVal.lat, newVal.lng) |
|||
map?.setCenter(latLng) |
|||
marker?.updateGeometries({ |
|||
id: 'center', |
|||
position: latLng, |
|||
}) |
|||
} |
|||
}, |
|||
{ immediate: true } |
|||
) |
|||
</script> |
|||
|
|||
<style scoped> |
|||
.map-picker { |
|||
display: flex; |
|||
flex-direction: column; |
|||
gap: 16px; |
|||
} |
|||
|
|||
.map-container { |
|||
width: 100%; |
|||
height: 400px; |
|||
border: 1px solid #dcdfe6; |
|||
border-radius: 4px; |
|||
} |
|||
|
|||
.address-search { |
|||
display: flex; |
|||
gap: 8px; |
|||
} |
|||
</style> |
|||
@ -0,0 +1,97 @@ |
|||
<?php |
|||
// +---------------------------------------------------------------------- |
|||
// | Niucloud-admin 企业快速开发的多应用管理平台 |
|||
// +---------------------------------------------------------------------- |
|||
// | 官方网址:https://www.niucloud.com |
|||
// +---------------------------------------------------------------------- |
|||
// | niucloud团队 版权所有 开源版本可自由商用 |
|||
// +---------------------------------------------------------------------- |
|||
// | Author: Niucloud Team |
|||
// +---------------------------------------------------------------------- |
|||
|
|||
namespace app\adminapi\controller\campus; |
|||
|
|||
use core\base\BaseAdminController; |
|||
use app\service\admin\campus\CampusService; |
|||
|
|||
|
|||
/** |
|||
* 校区控制器 |
|||
* Class Campus |
|||
* @package app\adminapi\controller\campus |
|||
*/ |
|||
class Campus extends BaseAdminController |
|||
{ |
|||
/** |
|||
* 获取校区列表 |
|||
* @return \think\Response |
|||
*/ |
|||
public function lists(){ |
|||
$data = $this->request->params([ |
|||
["campus_name",""], |
|||
["campus_address",""], |
|||
["campus_status",""] |
|||
]); |
|||
return success((new CampusService())->getPage($data)); |
|||
} |
|||
|
|||
/** |
|||
* 校区详情 |
|||
* @param int $id |
|||
* @return \think\Response |
|||
*/ |
|||
public function info(int $id){ |
|||
return success((new CampusService())->getInfo($id)); |
|||
} |
|||
|
|||
/** |
|||
* 添加校区 |
|||
* @return \think\Response |
|||
*/ |
|||
public function add(){ |
|||
$data = $this->request->params([ |
|||
["campus_name",""], |
|||
["campus_address",""], |
|||
["campus_preview_image",""], |
|||
["campus_coordinates",""], |
|||
["campus_introduction",""], |
|||
["campus_status",0], |
|||
|
|||
]); |
|||
$this->validate($data, 'app\validate\campus\Campus.add'); |
|||
$id = (new CampusService())->add($data); |
|||
return success('ADD_SUCCESS', ['id' => $id]); |
|||
} |
|||
|
|||
/** |
|||
* 校区编辑 |
|||
* @param $id 校区id |
|||
* @return \think\Response |
|||
*/ |
|||
public function edit(int $id){ |
|||
$data = $this->request->params([ |
|||
["campus_name",""], |
|||
["campus_address",""], |
|||
["campus_preview_image",""], |
|||
["campus_coordinates",""], |
|||
["campus_introduction",""], |
|||
["campus_status",0], |
|||
|
|||
]); |
|||
$this->validate($data, 'app\validate\campus\Campus.edit'); |
|||
(new CampusService())->edit($id, $data); |
|||
return success('EDIT_SUCCESS'); |
|||
} |
|||
|
|||
/** |
|||
* 校区删除 |
|||
* @param $id 校区id |
|||
* @return \think\Response |
|||
*/ |
|||
public function del(int $id){ |
|||
(new CampusService())->del($id); |
|||
return success('DELETE_SUCCESS'); |
|||
} |
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,99 @@ |
|||
<?php |
|||
// +---------------------------------------------------------------------- |
|||
// | Niucloud-admin 企业快速开发的多应用管理平台 |
|||
// +---------------------------------------------------------------------- |
|||
// | 官方网址:https://www.niucloud.com |
|||
// +---------------------------------------------------------------------- |
|||
// | niucloud团队 版权所有 开源版本可自由商用 |
|||
// +---------------------------------------------------------------------- |
|||
// | Author: Niucloud Team |
|||
// +---------------------------------------------------------------------- |
|||
|
|||
namespace app\adminapi\controller\market_performance; |
|||
|
|||
use core\base\BaseAdminController; |
|||
use app\service\admin\market_performance\MarketPerformanceService; |
|||
|
|||
|
|||
/** |
|||
* 市场绩效控制器 |
|||
* Class MarketPerformance |
|||
* @package app\adminapi\controller\market_performance |
|||
*/ |
|||
class MarketPerformance extends BaseAdminController |
|||
{ |
|||
/** |
|||
* 获取市场绩效列表 |
|||
* @return \think\Response |
|||
*/ |
|||
public function lists(){ |
|||
$data = $this->request->params([ |
|||
["campus_id",""], |
|||
["performance_amount",""] |
|||
]); |
|||
|
|||
return success((new MarketPerformanceService())->getPage($data)); |
|||
} |
|||
|
|||
/** |
|||
* 市场绩效详情 |
|||
* @param int $id |
|||
* @return \think\Response |
|||
*/ |
|||
public function info(int $id){ |
|||
return success((new MarketPerformanceService())->getInfo($id)); |
|||
} |
|||
|
|||
/** |
|||
* 添加市场绩效 |
|||
* @return \think\Response |
|||
*/ |
|||
public function add(){ |
|||
$data = $this->request->params([ |
|||
["personnel_id",0], |
|||
["campus_id",0], |
|||
["performance_amount",0.00], |
|||
|
|||
]); |
|||
$this->validate($data, 'app\validate\market_performance\MarketPerformance.add'); |
|||
$id = (new MarketPerformanceService())->add($data); |
|||
return success('ADD_SUCCESS', ['id' => $id]); |
|||
} |
|||
|
|||
/** |
|||
* 市场绩效编辑 |
|||
* @param $id 市场绩效id |
|||
* @return \think\Response |
|||
*/ |
|||
public function edit(int $id){ |
|||
$data = $this->request->params([ |
|||
["personnel_id",0], |
|||
["campus_id",0], |
|||
["performance_amount",0.00], |
|||
|
|||
]); |
|||
$this->validate($data, 'app\validate\market_performance\MarketPerformance.edit'); |
|||
(new MarketPerformanceService())->edit($id, $data); |
|||
return success('EDIT_SUCCESS'); |
|||
} |
|||
|
|||
/** |
|||
* 市场绩效删除 |
|||
* @param $id 市场绩效id |
|||
* @return \think\Response |
|||
*/ |
|||
public function del(int $id){ |
|||
(new MarketPerformanceService())->del($id); |
|||
return success('DELETE_SUCCESS'); |
|||
} |
|||
|
|||
|
|||
public function getPersonnelAll(){ |
|||
return success(( new MarketPerformanceService())->getPersonnelAll()); |
|||
} |
|||
|
|||
public function getCampusAll(){ |
|||
return success(( new MarketPerformanceService())->getCampusAll()); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,116 @@ |
|||
<?php |
|||
// +---------------------------------------------------------------------- |
|||
// | Niucloud-admin 企业快速开发的多应用管理平台 |
|||
// +---------------------------------------------------------------------- |
|||
// | 官方网址:https://www.niucloud.com |
|||
// +---------------------------------------------------------------------- |
|||
// | niucloud团队 版权所有 开源版本可自由商用 |
|||
// +---------------------------------------------------------------------- |
|||
// | Author: Niucloud Team |
|||
// +---------------------------------------------------------------------- |
|||
|
|||
namespace app\adminapi\controller\personnel; |
|||
|
|||
use core\base\BaseAdminController; |
|||
use app\service\admin\personnel\PersonnelService; |
|||
|
|||
|
|||
/** |
|||
* 人力资源-人员控制器 |
|||
* Class Personnel |
|||
* @package app\adminapi\controller\personnel |
|||
*/ |
|||
class Personnel extends BaseAdminController |
|||
{ |
|||
/** |
|||
* 获取人力资源-人员列表 |
|||
* @return \think\Response |
|||
*/ |
|||
public function lists(){ |
|||
$data = $this->request->params([ |
|||
["name",""], |
|||
["gender",""], |
|||
["phone",""], |
|||
["address",""], |
|||
["education",""], |
|||
["employee_number",""], |
|||
["status",""], |
|||
["create_time",""] |
|||
]); |
|||
return success((new PersonnelService())->getPage($data)); |
|||
} |
|||
|
|||
/** |
|||
* 人力资源-人员详情 |
|||
* @param int $id |
|||
* @return \think\Response |
|||
*/ |
|||
public function info(int $id){ |
|||
return success((new PersonnelService())->getInfo($id)); |
|||
} |
|||
|
|||
/** |
|||
* 添加人力资源-人员 |
|||
* @return \think\Response |
|||
*/ |
|||
public function add(){ |
|||
$data = $this->request->params([ |
|||
["name",""], |
|||
["gender",0], |
|||
["phone",""], |
|||
["head_img",""], |
|||
["address",""], |
|||
["native_place",""], |
|||
["education",""], |
|||
["profile",""], |
|||
["emergency_contact_phone",""], |
|||
["id_card_front",""], |
|||
["id_card_back",""], |
|||
["status",0], |
|||
["is_sys_user",0], |
|||
|
|||
]); |
|||
$this->validate($data, 'app\validate\personnel\Personnel.add'); |
|||
$id = (new PersonnelService())->add($data); |
|||
return success('ADD_SUCCESS', ['id' => $id]); |
|||
} |
|||
|
|||
/** |
|||
* 人力资源-人员编辑 |
|||
* @param $id 人力资源-人员id |
|||
* @return \think\Response |
|||
*/ |
|||
public function edit(int $id){ |
|||
$data = $this->request->params([ |
|||
["name",""], |
|||
["gender",0], |
|||
["phone",""], |
|||
["head_img",""], |
|||
["address",""], |
|||
["native_place",""], |
|||
["education",""], |
|||
["profile",""], |
|||
["emergency_contact_phone",""], |
|||
["id_card_front",""], |
|||
["id_card_back",""], |
|||
["status",0], |
|||
["is_sys_user",0], |
|||
|
|||
]); |
|||
$this->validate($data, 'app\validate\personnel\Personnel.edit'); |
|||
(new PersonnelService())->edit($id, $data); |
|||
return success('EDIT_SUCCESS'); |
|||
} |
|||
|
|||
/** |
|||
* 人力资源-人员删除 |
|||
* @param $id 人力资源-人员id |
|||
* @return \think\Response |
|||
*/ |
|||
public function del(int $id){ |
|||
(new PersonnelService())->del($id); |
|||
return success('DELETE_SUCCESS'); |
|||
} |
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,37 @@ |
|||
<?php |
|||
// +---------------------------------------------------------------------- |
|||
// | Niucloud-admin 企业快速开发的多应用管理平台 |
|||
// +---------------------------------------------------------------------- |
|||
// | 官方网址:https://www.niucloud.com |
|||
// +---------------------------------------------------------------------- |
|||
// | niucloud团队 版权所有 开源版本可自由商用 |
|||
// +---------------------------------------------------------------------- |
|||
// | Author: Niucloud Team |
|||
// +---------------------------------------------------------------------- |
|||
|
|||
use think\facade\Route; |
|||
|
|||
use app\adminapi\middleware\AdminCheckRole; |
|||
use app\adminapi\middleware\AdminCheckToken; |
|||
use app\adminapi\middleware\AdminLog; |
|||
// USER_CODE_BEGIN -- campus |
|||
|
|||
Route::group('campus', function () { |
|||
|
|||
//校区列表 |
|||
Route::get('campus', 'campus.Campus/lists'); |
|||
//校区详情 |
|||
Route::get('campus/:id', 'campus.Campus/info'); |
|||
//添加校区 |
|||
Route::post('campus', 'campus.Campus/add'); |
|||
//编辑校区 |
|||
Route::put('campus/:id', 'campus.Campus/edit'); |
|||
//删除校区 |
|||
Route::delete('campus/:id', 'campus.Campus/del'); |
|||
|
|||
})->middleware([ |
|||
AdminCheckToken::class, |
|||
AdminCheckRole::class, |
|||
AdminLog::class |
|||
]); |
|||
// USER_CODE_END -- campus |
|||
@ -0,0 +1,41 @@ |
|||
<?php |
|||
// +---------------------------------------------------------------------- |
|||
// | Niucloud-admin 企业快速开发的多应用管理平台 |
|||
// +---------------------------------------------------------------------- |
|||
// | 官方网址:https://www.niucloud.com |
|||
// +---------------------------------------------------------------------- |
|||
// | niucloud团队 版权所有 开源版本可自由商用 |
|||
// +---------------------------------------------------------------------- |
|||
// | Author: Niucloud Team |
|||
// +---------------------------------------------------------------------- |
|||
|
|||
use think\facade\Route; |
|||
|
|||
use app\adminapi\middleware\AdminCheckRole; |
|||
use app\adminapi\middleware\AdminCheckToken; |
|||
use app\adminapi\middleware\AdminLog; |
|||
// USER_CODE_BEGIN -- market_performance |
|||
|
|||
Route::group('market_performance', function () { |
|||
|
|||
//市场绩效列表 |
|||
Route::get('market_performance', 'market_performance.MarketPerformance/lists'); |
|||
//市场绩效详情 |
|||
Route::get('market_performance/:id', 'market_performance.MarketPerformance/info'); |
|||
//添加市场绩效 |
|||
Route::post('market_performance', 'market_performance.MarketPerformance/add'); |
|||
//编辑市场绩效 |
|||
Route::put('market_performance/:id', 'market_performance.MarketPerformance/edit'); |
|||
//删除市场绩效 |
|||
Route::delete('market_performance/:id', 'market_performance.MarketPerformance/del'); |
|||
|
|||
Route::get('personnel_all','market_performance.MarketPerformance/getPersonnelAll'); |
|||
|
|||
Route::get('campus_all','market_performance.MarketPerformance/getCampusAll'); |
|||
|
|||
})->middleware([ |
|||
AdminCheckToken::class, |
|||
AdminCheckRole::class, |
|||
AdminLog::class |
|||
]); |
|||
// USER_CODE_END -- market_performance |
|||
@ -0,0 +1,37 @@ |
|||
<?php |
|||
// +---------------------------------------------------------------------- |
|||
// | Niucloud-admin 企业快速开发的多应用管理平台 |
|||
// +---------------------------------------------------------------------- |
|||
// | 官方网址:https://www.niucloud.com |
|||
// +---------------------------------------------------------------------- |
|||
// | niucloud团队 版权所有 开源版本可自由商用 |
|||
// +---------------------------------------------------------------------- |
|||
// | Author: Niucloud Team |
|||
// +---------------------------------------------------------------------- |
|||
|
|||
use think\facade\Route; |
|||
|
|||
use app\adminapi\middleware\AdminCheckRole; |
|||
use app\adminapi\middleware\AdminCheckToken; |
|||
use app\adminapi\middleware\AdminLog; |
|||
// USER_CODE_BEGIN -- personnel |
|||
|
|||
Route::group('personnel', function () { |
|||
|
|||
//人力资源-人员列表 |
|||
Route::get('personnel', 'personnel.Personnel/lists'); |
|||
//人力资源-人员详情 |
|||
Route::get('personnel/:id', 'personnel.Personnel/info'); |
|||
//添加人力资源-人员 |
|||
Route::post('personnel', 'personnel.Personnel/add'); |
|||
//编辑人力资源-人员 |
|||
Route::put('personnel/:id', 'personnel.Personnel/edit'); |
|||
//删除人力资源-人员 |
|||
Route::delete('personnel/:id', 'personnel.Personnel/del'); |
|||
|
|||
})->middleware([ |
|||
AdminCheckToken::class, |
|||
AdminCheckRole::class, |
|||
AdminLog::class |
|||
]); |
|||
// USER_CODE_END -- personnel |
|||
@ -0,0 +1,94 @@ |
|||
<?php |
|||
// +---------------------------------------------------------------------- |
|||
// | Niucloud-admin 企业快速开发的多应用管理平台 |
|||
// +---------------------------------------------------------------------- |
|||
// | 官方网址:https://www.niucloud.com |
|||
// +---------------------------------------------------------------------- |
|||
// | niucloud团队 版权所有 开源版本可自由商用 |
|||
// +---------------------------------------------------------------------- |
|||
// | Author: Niucloud Team |
|||
// +---------------------------------------------------------------------- |
|||
|
|||
namespace app\model\campus; |
|||
|
|||
use core\base\BaseModel; |
|||
use think\model\concern\SoftDelete; |
|||
use think\model\relation\HasMany; |
|||
use think\model\relation\HasOne; |
|||
|
|||
/** |
|||
* 校区模型 |
|||
* Class Campus |
|||
* @package app\model\campus |
|||
*/ |
|||
class Campus extends BaseModel |
|||
{ |
|||
|
|||
use SoftDelete; |
|||
|
|||
/** |
|||
* 数据表主键 |
|||
* @var string |
|||
*/ |
|||
protected $pk = 'id'; |
|||
|
|||
/** |
|||
* 模型名称 |
|||
* @var string |
|||
*/ |
|||
protected $name = 'campus'; |
|||
|
|||
/** |
|||
* 定义软删除标记字段. |
|||
* @var string |
|||
*/ |
|||
protected $deleteTime = 'delete_time'; |
|||
|
|||
/** |
|||
* 定义软删除字段的默认值. |
|||
* @var int |
|||
*/ |
|||
protected $defaultSoftDelete = 0; |
|||
|
|||
/** |
|||
* 搜索器:校区校区名称 |
|||
* @param $value |
|||
* @param $data |
|||
*/ |
|||
public function searchCampusNameAttr($query, $value, $data) |
|||
{ |
|||
if ($value) { |
|||
$query->where("campus_name", "like", "%".$value."%"); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 搜索器:校区校区地址 |
|||
* @param $value |
|||
* @param $data |
|||
*/ |
|||
public function searchCampusAddressAttr($query, $value, $data) |
|||
{ |
|||
if ($value) { |
|||
$query->where("campus_address", $value); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 搜索器:校区校区状态 |
|||
* @param $value |
|||
* @param $data |
|||
*/ |
|||
public function searchCampusStatusAttr($query, $value, $data) |
|||
{ |
|||
if ($value) { |
|||
$query->where("campus_status", $value); |
|||
} |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,86 @@ |
|||
<?php |
|||
// +---------------------------------------------------------------------- |
|||
// | Niucloud-admin 企业快速开发的多应用管理平台 |
|||
// +---------------------------------------------------------------------- |
|||
// | 官方网址:https://www.niucloud.com |
|||
// +---------------------------------------------------------------------- |
|||
// | niucloud团队 版权所有 开源版本可自由商用 |
|||
// +---------------------------------------------------------------------- |
|||
// | Author: Niucloud Team |
|||
// +---------------------------------------------------------------------- |
|||
|
|||
namespace app\model\market_performance; |
|||
|
|||
use core\base\BaseModel; |
|||
use think\model\concern\SoftDelete; |
|||
use think\model\relation\HasMany; |
|||
use think\model\relation\HasOne; |
|||
|
|||
use app\model\personnel\Personnel; |
|||
|
|||
use app\model\campus\Campus; |
|||
|
|||
/** |
|||
* 市场绩效模型 |
|||
* Class MarketPerformance |
|||
* @package app\model\market_performance |
|||
*/ |
|||
class MarketPerformance extends BaseModel |
|||
{ |
|||
|
|||
|
|||
|
|||
/** |
|||
* 数据表主键 |
|||
* @var string |
|||
*/ |
|||
protected $pk = 'id'; |
|||
|
|||
/** |
|||
* 模型名称 |
|||
* @var string |
|||
*/ |
|||
protected $name = 'market_performance'; |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
/** |
|||
* 搜索器:市场绩效校区 |
|||
* @param $value |
|||
* @param $data |
|||
*/ |
|||
public function searchCampusIdAttr($query, $value, $data) |
|||
{ |
|||
if ($value) { |
|||
$query->where("campus_id", $value); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 搜索器:市场绩效绩效金额 |
|||
* @param $value |
|||
* @param $data |
|||
*/ |
|||
public function searchPerformanceAmountAttr($query, $value, $data) |
|||
{ |
|||
if ($value) { |
|||
$query->where("performance_amount", $value); |
|||
} |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
public function personnel(){ |
|||
return $this->hasOne(Personnel::class, 'id', 'personnel_id')->joinType('left')->withField('name,id')->bind(['personnel_id_name'=>'name']); |
|||
} |
|||
|
|||
public function campus(){ |
|||
return $this->hasOne(Campus::class, 'id', 'campus_id')->joinType('left')->withField('campus_name,id')->bind(['campus_id_name'=>'campus_name']); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,159 @@ |
|||
<?php |
|||
// +---------------------------------------------------------------------- |
|||
// | Niucloud-admin 企业快速开发的多应用管理平台 |
|||
// +---------------------------------------------------------------------- |
|||
// | 官方网址:https://www.niucloud.com |
|||
// +---------------------------------------------------------------------- |
|||
// | niucloud团队 版权所有 开源版本可自由商用 |
|||
// +---------------------------------------------------------------------- |
|||
// | Author: Niucloud Team |
|||
// +---------------------------------------------------------------------- |
|||
|
|||
namespace app\model\personnel; |
|||
|
|||
use core\base\BaseModel; |
|||
use think\model\concern\SoftDelete; |
|||
use think\model\relation\HasMany; |
|||
use think\model\relation\HasOne; |
|||
|
|||
/** |
|||
* 人力资源-人员模型 |
|||
* Class Personnel |
|||
* @package app\model\personnel |
|||
*/ |
|||
class Personnel extends BaseModel |
|||
{ |
|||
|
|||
use SoftDelete; |
|||
|
|||
/** |
|||
* 数据表主键 |
|||
* @var string |
|||
*/ |
|||
protected $pk = 'id'; |
|||
|
|||
/** |
|||
* 模型名称 |
|||
* @var string |
|||
*/ |
|||
protected $name = 'personnel'; |
|||
|
|||
/** |
|||
* 定义软删除标记字段. |
|||
* @var string |
|||
*/ |
|||
protected $deleteTime = 'delete_time'; |
|||
|
|||
/** |
|||
* 定义软删除字段的默认值. |
|||
* @var int |
|||
*/ |
|||
protected $defaultSoftDelete = 0; |
|||
|
|||
/** |
|||
* 搜索器:人力资源-人员姓名 |
|||
* @param $value |
|||
* @param $data |
|||
*/ |
|||
public function searchNameAttr($query, $value, $data) |
|||
{ |
|||
if ($value) { |
|||
$query->where("name", "like", "%".$value."%"); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 搜索器:人力资源-人员性别 |
|||
* @param $value |
|||
* @param $data |
|||
*/ |
|||
public function searchGenderAttr($query, $value, $data) |
|||
{ |
|||
if ($value) { |
|||
$query->where("gender", $value); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 搜索器:人力资源-人员电话 |
|||
* @param $value |
|||
* @param $data |
|||
*/ |
|||
public function searchPhoneAttr($query, $value, $data) |
|||
{ |
|||
if ($value) { |
|||
$query->where("phone", $value); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 搜索器:人力资源-人员家庭住址 |
|||
* @param $value |
|||
* @param $data |
|||
*/ |
|||
public function searchAddressAttr($query, $value, $data) |
|||
{ |
|||
if ($value) { |
|||
$query->where("address", $value); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 搜索器:人力资源-人员学历 |
|||
* @param $value |
|||
* @param $data |
|||
*/ |
|||
public function searchEducationAttr($query, $value, $data) |
|||
{ |
|||
if ($value) { |
|||
$query->where("education", $value); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 搜索器:人力资源-人员员工编号 |
|||
* @param $value |
|||
* @param $data |
|||
*/ |
|||
public function searchEmployeeNumberAttr($query, $value, $data) |
|||
{ |
|||
if ($value) { |
|||
$query->where("employee_number", $value); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 搜索器:人力资源-人员员工状态 |
|||
* @param $value |
|||
* @param $data |
|||
*/ |
|||
public function searchStatusAttr($query, $value, $data) |
|||
{ |
|||
if ($value) { |
|||
$query->where("status", $value); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 搜索器:人力资源-人员创建时间 |
|||
* @param $value |
|||
* @param $data |
|||
*/ |
|||
public function searchCreateTimeAttr($query, $value, $data) |
|||
{ |
|||
if ($value) { |
|||
$query->where("create_time", $value); |
|||
} |
|||
} |
|||
|
|||
|
|||
|
|||
public function sys_user() |
|||
{ |
|||
return $this->hasOne(\app\model\sys\SysUser::class, 'uid', 'sys_user_id'); |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,100 @@ |
|||
<?php |
|||
// +---------------------------------------------------------------------- |
|||
// | Niucloud-admin 企业快速开发的多应用管理平台 |
|||
// +---------------------------------------------------------------------- |
|||
// | 官方网址:https://www.niucloud.com |
|||
// +---------------------------------------------------------------------- |
|||
// | niucloud团队 版权所有 开源版本可自由商用 |
|||
// +---------------------------------------------------------------------- |
|||
// | Author: Niucloud Team |
|||
// +---------------------------------------------------------------------- |
|||
|
|||
namespace app\service\admin\campus; |
|||
|
|||
use app\model\campus\Campus; |
|||
|
|||
use core\base\BaseAdminService; |
|||
|
|||
|
|||
/** |
|||
* 校区服务层 |
|||
* Class CampusService |
|||
* @package app\service\admin\campus |
|||
*/ |
|||
class CampusService extends BaseAdminService |
|||
{ |
|||
public function __construct() |
|||
{ |
|||
parent::__construct(); |
|||
$this->model = new Campus(); |
|||
} |
|||
|
|||
/** |
|||
* 获取校区列表 |
|||
* @param array $where |
|||
* @return array |
|||
*/ |
|||
public function getPage(array $where = []) |
|||
{ |
|||
$field = 'id,campus_name,campus_address,campus_preview_image,campus_coordinates,campus_introduction,campus_status,create_time,update_time,delete_time'; |
|||
$order = ''; |
|||
|
|||
$search_model = $this->model->withSearch(["campus_name","campus_address","campus_status"], $where)->field($field)->order($order); |
|||
$list = $this->pageQuery($search_model); |
|||
return $list; |
|||
} |
|||
|
|||
/** |
|||
* 获取校区信息 |
|||
* @param int $id |
|||
* @return array |
|||
*/ |
|||
public function getInfo(int $id) |
|||
{ |
|||
$field = 'id,campus_name,campus_address,campus_preview_image,campus_coordinates,campus_introduction,campus_status,create_time,update_time,delete_time'; |
|||
|
|||
$info = $this->model->field($field)->where([['id', "=", $id]])->findOrEmpty()->toArray(); |
|||
$info['campus_status'] = strval($info['campus_status']); |
|||
return $info; |
|||
} |
|||
|
|||
/** |
|||
* 添加校区 |
|||
* @param array $data |
|||
* @return mixed |
|||
*/ |
|||
public function add(array $data) |
|||
{ |
|||
$res = $this->model->create($data); |
|||
return $res->id; |
|||
|
|||
} |
|||
|
|||
/** |
|||
* 校区编辑 |
|||
* @param int $id |
|||
* @param array $data |
|||
* @return bool |
|||
*/ |
|||
public function edit(int $id, array $data) |
|||
{ |
|||
|
|||
$this->model->where([['id', '=', $id]])->update($data); |
|||
return true; |
|||
} |
|||
|
|||
/** |
|||
* 删除校区 |
|||
* @param int $id |
|||
* @return bool |
|||
*/ |
|||
public function del(int $id) |
|||
{ |
|||
$model = $this->model->where([['id', '=', $id]])->find(); |
|||
$res = $model->delete(); |
|||
return $res; |
|||
} |
|||
|
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,111 @@ |
|||
<?php |
|||
// +---------------------------------------------------------------------- |
|||
// | Niucloud-admin 企业快速开发的多应用管理平台 |
|||
// +---------------------------------------------------------------------- |
|||
// | 官方网址:https://www.niucloud.com |
|||
// +---------------------------------------------------------------------- |
|||
// | niucloud团队 版权所有 开源版本可自由商用 |
|||
// +---------------------------------------------------------------------- |
|||
// | Author: Niucloud Team |
|||
// +---------------------------------------------------------------------- |
|||
|
|||
namespace app\service\admin\market_performance; |
|||
|
|||
use app\model\market_performance\MarketPerformance; |
|||
use app\model\personnel\Personnel; |
|||
use app\model\campus\Campus; |
|||
|
|||
use core\base\BaseAdminService; |
|||
|
|||
|
|||
/** |
|||
* 市场绩效服务层 |
|||
* Class MarketPerformanceService |
|||
* @package app\service\admin\market_performance |
|||
*/ |
|||
class MarketPerformanceService extends BaseAdminService |
|||
{ |
|||
public function __construct() |
|||
{ |
|||
parent::__construct(); |
|||
$this->model = new MarketPerformance(); |
|||
} |
|||
|
|||
/** |
|||
* 获取市场绩效列表 |
|||
* @param array $where |
|||
* @return array |
|||
*/ |
|||
public function getPage(array $where = []) |
|||
{ |
|||
$field = 'id,personnel_id,campus_id,performance_amount,resource_count,performance_date,performance_config,performance_algorithm,status,created_at,updated_at'; |
|||
$order = 'id desc'; |
|||
|
|||
$search_model = $this->model->where(get_campus_where($this->uid))->withSearch(["campus_id","performance_amount"], $where)->with(['personnel','campus'])->field($field)->order($order); |
|||
$list = $this->pageQuery($search_model); |
|||
return $list; |
|||
} |
|||
|
|||
/** |
|||
* 获取市场绩效信息 |
|||
* @param int $id |
|||
* @return array |
|||
*/ |
|||
public function getInfo(int $id) |
|||
{ |
|||
$field = 'id,personnel_id,campus_id,performance_amount,resource_count,performance_date,performance_config,performance_algorithm,status,created_at,updated_at'; |
|||
|
|||
$info = $this->model->field($field)->where([['id', "=", $id]])->with(['personnel','campus'])->findOrEmpty()->toArray(); |
|||
return $info; |
|||
} |
|||
|
|||
/** |
|||
* 添加市场绩效 |
|||
* @param array $data |
|||
* @return mixed |
|||
*/ |
|||
public function add(array $data) |
|||
{ |
|||
$res = $this->model->create($data); |
|||
return $res->id; |
|||
|
|||
} |
|||
|
|||
/** |
|||
* 市场绩效编辑 |
|||
* @param int $id |
|||
* @param array $data |
|||
* @return bool |
|||
*/ |
|||
public function edit(int $id, array $data) |
|||
{ |
|||
|
|||
$this->model->where([['id', '=', $id]])->update($data); |
|||
return true; |
|||
} |
|||
|
|||
/** |
|||
* 删除市场绩效 |
|||
* @param int $id |
|||
* @return bool |
|||
*/ |
|||
public function del(int $id) |
|||
{ |
|||
$model = $this->model->where([['id', '=', $id]])->find(); |
|||
$res = $model->delete(); |
|||
return $res; |
|||
} |
|||
|
|||
|
|||
public function getPersonnelAll(){ |
|||
$personnelModel = new Personnel(); |
|||
return $personnelModel->select()->toArray(); |
|||
} |
|||
|
|||
public function getCampusAll(){ |
|||
$campusModel = new Campus(); |
|||
return $campusModel->select()->toArray(); |
|||
} |
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,151 @@ |
|||
<?php |
|||
// +---------------------------------------------------------------------- |
|||
// | Niucloud-admin 企业快速开发的多应用管理平台 |
|||
// +---------------------------------------------------------------------- |
|||
// | 官方网址:https://www.niucloud.com |
|||
// +---------------------------------------------------------------------- |
|||
// | niucloud团队 版权所有 开源版本可自由商用 |
|||
// +---------------------------------------------------------------------- |
|||
// | Author: Niucloud Team |
|||
// +---------------------------------------------------------------------- |
|||
|
|||
namespace app\service\admin\personnel; |
|||
|
|||
use app\dict\sys\UserDict; |
|||
use app\model\personnel\Personnel; |
|||
|
|||
use app\model\sys\SysUser; |
|||
use app\service\admin\user\UserService; |
|||
use core\base\BaseAdminService; |
|||
use think\facade\Db; |
|||
|
|||
|
|||
/** |
|||
* 人力资源-人员服务层 |
|||
* Class PersonnelService |
|||
* @package app\service\admin\personnel |
|||
*/ |
|||
class PersonnelService extends BaseAdminService |
|||
{ |
|||
public function __construct() |
|||
{ |
|||
parent::__construct(); |
|||
$this->model = new Personnel(); |
|||
} |
|||
|
|||
/** |
|||
* 获取人力资源-人员列表 |
|||
* @param array $where |
|||
* @return array |
|||
*/ |
|||
public function getPage(array $where = []) |
|||
{ |
|||
$field = 'id,name,head_img,gender,birthday,phone,address,native_place,education,profile,emergency_contact_phone,id_card_front,id_card_back,employee_number,status,is_sys_user,sys_user_id,create_time,update_time,delete_time'; |
|||
$order = 'create_time desc'; |
|||
|
|||
$search_model = $this->model->withSearch(["name", "gender", "phone", "address", "education", "employee_number", "status", "create_time"], $where)->field($field)->order($order); |
|||
$list = $this->pageQuery($search_model); |
|||
return $list; |
|||
} |
|||
|
|||
/** |
|||
* 获取人力资源-人员信息 |
|||
* @param int $id |
|||
* @return array |
|||
*/ |
|||
public function getInfo(int $id) |
|||
{ |
|||
$field = 'id,name,gender,head_img,birthday,phone,address,native_place,education,profile,emergency_contact_phone,id_card_front,id_card_back,employee_number,status,is_sys_user,sys_user_id,create_time,update_time,delete_time'; |
|||
|
|||
$info = $this->model->field($field)->where([['id', "=", $id]])->findOrEmpty()->toArray(); |
|||
$info['gender'] = strval($info['gender']); |
|||
$info['status'] = strval($info['status']); |
|||
$info['is_sys_user'] = strval($info['is_sys_user']); |
|||
return $info; |
|||
} |
|||
|
|||
/** |
|||
* 添加人力资源-人员 |
|||
* @param array $data |
|||
* @return mixed |
|||
*/ |
|||
public function add(array $data) |
|||
{ |
|||
$status = $this->model->where('phone', $data['phone'])->value('id'); |
|||
if ($status) { |
|||
throw new \Exception('手机号已存在'); |
|||
} |
|||
try { |
|||
Db::startTrans(); |
|||
if ($data['is_sys_user'] === '1') { |
|||
$uid = (new UserService())->addUser([ |
|||
'username' => $data['phone'], |
|||
'password' => $data['phone'], |
|||
'real_name' => $data['name'], |
|||
'head_img' => $data['head_img'], |
|||
'status' => UserDict::ON, |
|||
'role_ids' => [] |
|||
]); |
|||
$data['sys_user_id'] = $uid; |
|||
} |
|||
$res = $this->model->create($data); |
|||
Db::commit(); |
|||
return $res->id; |
|||
} catch (\Exception $e) { |
|||
Db::rollback(); |
|||
throw new \Exception($e->getMessage()); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 人力资源-人员编辑 |
|||
* @param int $id |
|||
* @param array $data |
|||
* @return bool |
|||
*/ |
|||
public function edit(int $id, array $data) |
|||
{ |
|||
|
|||
$status = $this->model->where('phone', $data['phone'])->value('id'); |
|||
if ($status && $status != $id) { |
|||
throw new \Exception('手机号已存在'); |
|||
} |
|||
try { |
|||
Db::startTrans(); |
|||
if ($data['is_sys_user'] === '1') { |
|||
$uid = (new SysUser())->where(['username' => $data['phone']])->value('uid'); |
|||
if (!$uid) { |
|||
$uid = (new UserService())->addUser([ |
|||
'username' => $data['phone'], |
|||
'password' => $data['phone'], |
|||
'real_name' => $data['name'], |
|||
'head_img' => $data['head_img'], |
|||
'status' => UserDict::ON, |
|||
'role_ids' => [] |
|||
]); |
|||
$data['sys_user_id'] = $uid; |
|||
} |
|||
} |
|||
$this->model->where([['id', '=', $id]])->update($data); |
|||
Db::commit(); |
|||
} catch (\Exception $e) { |
|||
Db::rollback(); |
|||
throw new \Exception($e->getMessage()); |
|||
} |
|||
return true; |
|||
} |
|||
|
|||
/** |
|||
* 删除人力资源-人员 |
|||
* @param int $id |
|||
* @return bool |
|||
*/ |
|||
public function del(int $id) |
|||
{ |
|||
$model = $this->model->where([['id', '=', $id]])->find(); |
|||
$res = $model->delete(); |
|||
return $res; |
|||
} |
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,35 @@ |
|||
<?php |
|||
// +---------------------------------------------------------------------- |
|||
// | Niucloud-admin 企业快速开发的多应用管理平台 |
|||
// +---------------------------------------------------------------------- |
|||
// | 官方网址:https://www.niucloud.com |
|||
// +---------------------------------------------------------------------- |
|||
// | niucloud团队 版权所有 开源版本可自由商用 |
|||
// +---------------------------------------------------------------------- |
|||
// | Author: Niucloud Team |
|||
// +---------------------------------------------------------------------- |
|||
|
|||
namespace app\validate\campus; |
|||
use core\base\BaseValidate; |
|||
/** |
|||
* 校区验证器 |
|||
* Class Campus |
|||
* @package addon\app\validate\campus |
|||
*/ |
|||
class Campus extends BaseValidate |
|||
{ |
|||
|
|||
protected $rule = [ |
|||
'campus_name' => 'require', |
|||
]; |
|||
|
|||
protected $message = [ |
|||
'campus_name.require' => ['common_validate.require', ['campus_name']], |
|||
]; |
|||
|
|||
protected $scene = [ |
|||
"add" => ['campus_name', 'campus_address', 'campus_preview_image', 'campus_coordinates', 'campus_introduction', 'campus_status'], |
|||
"edit" => ['campus_name', 'campus_address', 'campus_preview_image', 'campus_coordinates', 'campus_introduction', 'campus_status'] |
|||
]; |
|||
|
|||
} |
|||
@ -0,0 +1,35 @@ |
|||
<?php |
|||
// +---------------------------------------------------------------------- |
|||
// | Niucloud-admin 企业快速开发的多应用管理平台 |
|||
// +---------------------------------------------------------------------- |
|||
// | 官方网址:https://www.niucloud.com |
|||
// +---------------------------------------------------------------------- |
|||
// | niucloud团队 版权所有 开源版本可自由商用 |
|||
// +---------------------------------------------------------------------- |
|||
// | Author: Niucloud Team |
|||
// +---------------------------------------------------------------------- |
|||
|
|||
namespace app\validate\market_performance; |
|||
use core\base\BaseValidate; |
|||
/** |
|||
* 市场绩效验证器 |
|||
* Class MarketPerformance |
|||
* @package addon\app\validate\market_performance |
|||
*/ |
|||
class MarketPerformance extends BaseValidate |
|||
{ |
|||
|
|||
protected $rule = [ |
|||
|
|||
]; |
|||
|
|||
protected $message = [ |
|||
|
|||
]; |
|||
|
|||
protected $scene = [ |
|||
"add" => ['personnel_id', 'campus_id', 'performance_amount'], |
|||
"edit" => ['personnel_id', 'campus_id', 'performance_amount'] |
|||
]; |
|||
|
|||
} |
|||
@ -0,0 +1,44 @@ |
|||
<?php |
|||
// +---------------------------------------------------------------------- |
|||
// | Niucloud-admin 企业快速开发的多应用管理平台 |
|||
// +---------------------------------------------------------------------- |
|||
// | 官方网址:https://www.niucloud.com |
|||
// +---------------------------------------------------------------------- |
|||
// | niucloud团队 版权所有 开源版本可自由商用 |
|||
// +---------------------------------------------------------------------- |
|||
// | Author: Niucloud Team |
|||
// +---------------------------------------------------------------------- |
|||
|
|||
namespace app\validate\personnel; |
|||
use core\base\BaseValidate; |
|||
/** |
|||
* 人力资源-人员验证器 |
|||
* Class Personnel |
|||
* @package addon\app\validate\personnel |
|||
*/ |
|||
class Personnel extends BaseValidate |
|||
{ |
|||
|
|||
protected $rule = [ |
|||
'name' => 'require', |
|||
'phone' => 'require|mobile', |
|||
'emergency_contact_phone' => 'mobile', |
|||
'status' => 'require', |
|||
'is_sys_user' => 'require', |
|||
]; |
|||
|
|||
protected $message = [ |
|||
'name.require' => ['common_validate.require', ['name']], |
|||
'phone.require' => ['common_validate.require', ['phone']], |
|||
'phone.mobile' => ['common_validate.mobile', ['phone']], |
|||
'emergency_contact_phone.mobile' => ['common_validate.mobile', ['emergency_contact_phone']], |
|||
'status.require' => ['common_validate.require', ['status']], |
|||
'is_sys_user.require' => ['common_validate.require', ['is_sys_user']], |
|||
]; |
|||
|
|||
protected $scene = [ |
|||
"add" => ['name', 'gender', 'phone', 'address', 'native_place', 'education', 'profile', 'emergency_contact_phone', 'id_card_front', 'id_card_back', 'status', 'is_sys_user'], |
|||
"edit" => ['name', 'gender', 'phone', 'address', 'native_place', 'education', 'profile', 'emergency_contact_phone', 'id_card_front', 'id_card_back', 'status', 'is_sys_user'] |
|||
]; |
|||
|
|||
} |
|||
Loading…
Reference in new issue