27 changed files with 1677 additions and 1737 deletions
@ -0,0 +1,81 @@ |
|||
// generated by unplugin-vue-components
|
|||
// We suggest you to commit this file into source control
|
|||
// Read more: https://github.com/vuejs/core/pull/3399
|
|||
import '@vue/runtime-core' |
|||
|
|||
export {} |
|||
|
|||
declare module '@vue/runtime-core' { |
|||
export interface GlobalComponents { |
|||
Attachment: typeof import('./src/components/upload-attachment/attachment.vue')['default'] |
|||
DiyLink: typeof import('./src/components/diy-link/index.vue')['default'] |
|||
Editor: typeof import('./src/components/editor/index.vue')['default'] |
|||
ElAside: typeof import('element-plus/es')['ElAside'] |
|||
ElAvatar: typeof import('element-plus/es')['ElAvatar'] |
|||
ElBreadcrumb: typeof import('element-plus/es')['ElBreadcrumb'] |
|||
ElBreadcrumbItem: typeof import('element-plus/es')['ElBreadcrumbItem'] |
|||
ElButton: typeof import('element-plus/es')['ElButton'] |
|||
ElCard: typeof import('element-plus/es')['ElCard'] |
|||
ElCheckbox: typeof import('element-plus/es')['ElCheckbox'] |
|||
ElCol: typeof import('element-plus/es')['ElCol'] |
|||
ElColorPicker: typeof import('element-plus/es')['ElColorPicker'] |
|||
ElConfigProvider: typeof import('element-plus/es')['ElConfigProvider'] |
|||
ElContainer: typeof import('element-plus/es')['ElContainer'] |
|||
ElDialog: typeof import('element-plus/es')['ElDialog'] |
|||
ElDrawer: typeof import('element-plus/es')['ElDrawer'] |
|||
ElDropdown: typeof import('element-plus/es')['ElDropdown'] |
|||
ElDropdownItem: typeof import('element-plus/es')['ElDropdownItem'] |
|||
ElDropdownMenu: typeof import('element-plus/es')['ElDropdownMenu'] |
|||
ElForm: typeof import('element-plus/es')['ElForm'] |
|||
ElFormItem: typeof import('element-plus/es')['ElFormItem'] |
|||
ElHeader: typeof import('element-plus/es')['ElHeader'] |
|||
ElIcon: typeof import('element-plus/es')['ElIcon'] |
|||
ElImage: typeof import('element-plus/es')['ElImage'] |
|||
ElImageViewer: typeof import('element-plus/es')['ElImageViewer'] |
|||
ElInput: typeof import('element-plus/es')['ElInput'] |
|||
ElInputNumber: typeof import('element-plus/es')['ElInputNumber'] |
|||
ElMain: typeof import('element-plus/es')['ElMain'] |
|||
ElMenu: typeof import('element-plus/es')['ElMenu'] |
|||
ElMenuItem: typeof import('element-plus/es')['ElMenuItem'] |
|||
ElOption: typeof import('element-plus/es')['ElOption'] |
|||
ElPagination: typeof import('element-plus/es')['ElPagination'] |
|||
ElPopover: typeof import('element-plus/es')['ElPopover'] |
|||
ElRadio: typeof import('element-plus/es')['ElRadio'] |
|||
ElRadioGroup: typeof import('element-plus/es')['ElRadioGroup'] |
|||
ElRow: typeof import('element-plus/es')['ElRow'] |
|||
ElScrollbar: typeof import('element-plus/es')['ElScrollbar'] |
|||
ElSelect: typeof import('element-plus/es')['ElSelect'] |
|||
ElSubMenu: typeof import('element-plus/es')['ElSubMenu'] |
|||
ElSwitch: typeof import('element-plus/es')['ElSwitch'] |
|||
ElTable: typeof import('element-plus/es')['ElTable'] |
|||
ElTableColumn: typeof import('element-plus/es')['ElTableColumn'] |
|||
ElTabPane: typeof import('element-plus/es')['ElTabPane'] |
|||
ElTabs: typeof import('element-plus/es')['ElTabs'] |
|||
ElTag: typeof import('element-plus/es')['ElTag'] |
|||
ElTooltip: typeof import('element-plus/es')['ElTooltip'] |
|||
ElTreeSelect: typeof import('element-plus/es')['ElTreeSelect'] |
|||
ElUpload: typeof import('element-plus/es')['ElUpload'] |
|||
ExportSure: typeof import('./src/components/export-sure/index.vue')['default'] |
|||
HeatMap: typeof import('./src/components/heat-map/index.vue')['default'] |
|||
Icon: typeof import('./src/components/icon/index.vue')['default'] |
|||
PopoverInput: typeof import('./src/components/popover-input/index.vue')['default'] |
|||
RangeInput: typeof import('./src/components/range-input/index.vue')['default'] |
|||
RouterLink: typeof import('vue-router')['RouterLink'] |
|||
RouterView: typeof import('vue-router')['RouterView'] |
|||
SelectArea: typeof import('./src/components/select-area/index.vue')['default'] |
|||
SelectIcon: typeof import('./src/components/select-icon/index.vue')['default'] |
|||
TencentMapPicker: typeof import('./src/components/TencentMapPicker.vue')['default'] |
|||
UploadAttachment: typeof import('./src/components/upload-attachment/index.vue')['default'] |
|||
UploadFile: typeof import('./src/components/upload-file/index.vue')['default'] |
|||
UploadImage: typeof import('./src/components/upload-image/index.vue')['default'] |
|||
UploadVideo: typeof import('./src/components/upload-video/index.vue')['default'] |
|||
Verify: typeof import('./src/components/verifition/Verify.vue')['default'] |
|||
VerifyPoints: typeof import('./src/components/verifition/Verify/VerifyPoints.vue')['default'] |
|||
VerifySlide: typeof import('./src/components/verifition/Verify/VerifySlide.vue')['default'] |
|||
VideoPlayer: typeof import('./src/components/video-player/index.vue')['default'] |
|||
WebLink: typeof import('./src/components/web-link/web-link.vue')['default'] |
|||
} |
|||
export interface ComponentCustomProperties { |
|||
vLoading: typeof import('element-plus/es')['ElLoadingDirective'] |
|||
} |
|||
} |
|||
@ -1,31 +1,21 @@ |
|||
{ |
|||
"id": "沟通记录编号", |
|||
"idPlaceholder": "请输入沟通记录编号", |
|||
"staffId": "员工ID", |
|||
"staffIdPlaceholder": "请输入员工ID", |
|||
"resourceId": "资源ID", |
|||
"resourceIdPlaceholder": "请输入资源ID", |
|||
"resourceType": "资源类型(如设备、文件、系统等)", |
|||
"resourceTypePlaceholder": "请输入资源类型(如设备、文件、系统等)", |
|||
"communicationType": "沟通类型: phone-电话, email-邮件, meeting-会议, other-其他", |
|||
"communicationTypePlaceholder": "请输入沟通类型: phone-电话, email-邮件, meeting-会议, other-其他", |
|||
"communicationResult": "沟通结果: success-成功, failure-失败, pending-待定", |
|||
"communicationResultPlaceholder": "请输入沟通结果: success-成功, failure-失败, pending-待定", |
|||
"communicationTime": "沟通时间", |
|||
"communicationTimePlaceholder": "请输入沟通时间", |
|||
"remarks": "备注", |
|||
"remarksPlaceholder": "请输入备注", |
|||
"tag": "标签: high-高, medium-中, low-低", |
|||
"tagPlaceholder": "请输入标签: high-高, medium-中, low-低", |
|||
"businessId": "关联的业务ID", |
|||
"businessIdPlaceholder": "请输入关联的业务ID", |
|||
"createdAt": "创建时间", |
|||
"createdAtPlaceholder": "请输入创建时间", |
|||
"updatedAt": "修改时间", |
|||
"updatedAtPlaceholder": "请输入修改时间", |
|||
"addCommunicationRecords": "添加沟通记录", |
|||
"updateCommunicationRecords": "编辑沟通记录", |
|||
"communicationRecordsDeleteTips": "确定要删除该数据吗?", |
|||
"startDate": "请选择开始时间", |
|||
"endDate": "请选择结束时间" |
|||
} |
|||
"resourceId":"资源", |
|||
"resourceIdPlaceholder":"全部", |
|||
"resourceType":"资源类型", |
|||
"resourceTypePlaceholder":"请输入资源类型", |
|||
"communicationType":"沟通类型", |
|||
"communicationTypePlaceholder":"请输入沟通类型", |
|||
"communicationResult":"沟通结果", |
|||
"communicationResultPlaceholder":"请输入沟通结果", |
|||
"communicationTime":"沟通时间", |
|||
"communicationTimePlaceholder":"请输入沟通时间", |
|||
"remarks":"备注", |
|||
"remarksPlaceholder":"请输入备注", |
|||
"tag":"标签", |
|||
"tagPlaceholder":"请输入标签", |
|||
"addCommunicationRecords":"添加沟通记录", |
|||
"updateCommunicationRecords":"编辑沟通记录", |
|||
"communicationRecordsDeleteTips":"确定要删除该数据吗?", |
|||
"startDate":"请选择开始时间", |
|||
"endDate":"请选择结束时间" |
|||
} |
|||
@ -1,21 +1,19 @@ |
|||
{ |
|||
"id": "记录编号", |
|||
"idPlaceholder": "请输入记录编号", |
|||
"studentId": "学员ID", |
|||
"studentIdPlaceholder": "请输入学员ID", |
|||
"courseId": "课程ID", |
|||
"courseIdPlaceholder": "请输入课程ID", |
|||
"totalHours": "总正式课时数", |
|||
"totalHoursPlaceholder": "请输入总正式课时数", |
|||
"giftHours": "赠送课时数", |
|||
"giftHoursPlaceholder": "请输入赠送课时数", |
|||
"startDate": "课程开始日期", |
|||
"startDatePlaceholder": "请输入课程开始日期", |
|||
"endDate": "课程结束日期", |
|||
"endDatePlaceholder": "请输入课程结束日期", |
|||
"addStudentCourses": "添加学员课程", |
|||
"updateStudentCourses": "编辑学员课程", |
|||
"studentCoursesDeleteTips": "确定要删除该数据吗?", |
|||
"startDate": "请选择开始时间", |
|||
"endDate": "请选择结束时间" |
|||
} |
|||
"studentId":"学员", |
|||
"studentIdPlaceholder":"全部", |
|||
"courseId":"课程", |
|||
"courseIdPlaceholder":"全部", |
|||
"totalHours":"总正式课时数", |
|||
"totalHoursPlaceholder":"请输入总正式课时数", |
|||
"giftHours":"赠送课时数", |
|||
"giftHoursPlaceholder":"请输入赠送课时数", |
|||
"startDate":"课程开始日期", |
|||
"startDatePlaceholder":"请输入课程开始日期", |
|||
"endDate":"课程结束日期", |
|||
"endDatePlaceholder":"请输入课程结束日期", |
|||
"addStudentCourses":"添加学员课程", |
|||
"updateStudentCourses":"编辑学员课程", |
|||
"studentCoursesDeleteTips":"确定要删除该数据吗?", |
|||
"startDate":"请选择开始时间", |
|||
"endDate":"请选择结束时间" |
|||
} |
|||
@ -1,351 +1,231 @@ |
|||
<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('addCommunicationRecords') }} |
|||
</el-button> |
|||
</div> |
|||
|
|||
<el-card |
|||
class="box-card !border-none my-[10px] table-search-wrap" |
|||
shadow="never" |
|||
> |
|||
<el-form |
|||
:inline="true" |
|||
:model="communicationRecordsTable.searchParam" |
|||
ref="searchFormRef" |
|||
> |
|||
<el-form-item :label="t('staffId')" prop="staff_id"> |
|||
<el-input |
|||
v-model="communicationRecordsTable.searchParam.staff_id" |
|||
:placeholder="t('staffIdPlaceholder')" |
|||
/> |
|||
</el-form-item> |
|||
<el-form-item :label="t('resourceId')" prop="resource_id"> |
|||
<el-input |
|||
v-model="communicationRecordsTable.searchParam.resource_id" |
|||
:placeholder="t('resourceIdPlaceholder')" |
|||
/> |
|||
</el-form-item> |
|||
<el-form-item :label="t('resourceType')" prop="resource_type"> |
|||
<el-input |
|||
v-model="communicationRecordsTable.searchParam.resource_type" |
|||
:placeholder="t('resourceTypePlaceholder')" |
|||
/> |
|||
</el-form-item> |
|||
<el-form-item |
|||
:label="t('communicationType')" |
|||
prop="communication_type" |
|||
> |
|||
<el-input |
|||
v-model="communicationRecordsTable.searchParam.communication_type" |
|||
:placeholder="t('communicationTypePlaceholder')" |
|||
/> |
|||
</el-form-item> |
|||
<el-form-item |
|||
:label="t('communicationResult')" |
|||
prop="communication_result" |
|||
> |
|||
<el-input |
|||
v-model=" |
|||
communicationRecordsTable.searchParam.communication_result |
|||
" |
|||
:placeholder="t('communicationResultPlaceholder')" |
|||
/> |
|||
</el-form-item> |
|||
<el-form-item |
|||
:label="t('communicationTime')" |
|||
prop="communication_time" |
|||
> |
|||
<el-input |
|||
v-model="communicationRecordsTable.searchParam.communication_time" |
|||
:placeholder="t('communicationTimePlaceholder')" |
|||
/> |
|||
</el-form-item> |
|||
<el-form-item :label="t('remarks')" prop="remarks"> |
|||
<el-input |
|||
v-model="communicationRecordsTable.searchParam.remarks" |
|||
:placeholder="t('remarksPlaceholder')" |
|||
/> |
|||
</el-form-item> |
|||
<el-form-item :label="t('tag')" prop="tag"> |
|||
<el-input |
|||
v-model="communicationRecordsTable.searchParam.tag" |
|||
:placeholder="t('tagPlaceholder')" |
|||
/> |
|||
</el-form-item> |
|||
<el-form-item :label="t('businessId')" prop="business_id"> |
|||
<el-input |
|||
v-model="communicationRecordsTable.searchParam.business_id" |
|||
:placeholder="t('businessIdPlaceholder')" |
|||
/> |
|||
</el-form-item> |
|||
<el-form-item :label="t('createdAt')" prop="created_at"> |
|||
<el-input |
|||
v-model="communicationRecordsTable.searchParam.created_at" |
|||
:placeholder="t('createdAtPlaceholder')" |
|||
/> |
|||
</el-form-item> |
|||
<el-form-item :label="t('updatedAt')" prop="updated_at"> |
|||
<el-input |
|||
v-model="communicationRecordsTable.searchParam.updated_at" |
|||
:placeholder="t('updatedAtPlaceholder')" |
|||
/> |
|||
</el-form-item> |
|||
|
|||
<el-form-item> |
|||
<el-button type="primary" @click="loadCommunicationRecordsList()">{{ |
|||
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="communicationRecordsTable.data" |
|||
size="large" |
|||
v-loading="communicationRecordsTable.loading" |
|||
> |
|||
<template #empty> |
|||
<span>{{ |
|||
!communicationRecordsTable.loading ? t('emptyData') : '' |
|||
}}</span> |
|||
</template> |
|||
<el-table-column |
|||
prop="staff_id" |
|||
:label="t('staffId')" |
|||
min-width="120" |
|||
:show-overflow-tooltip="true" |
|||
/> |
|||
|
|||
<el-table-column |
|||
prop="resource_id" |
|||
:label="t('resourceId')" |
|||
min-width="120" |
|||
:show-overflow-tooltip="true" |
|||
/> |
|||
|
|||
<el-table-column |
|||
prop="resource_type" |
|||
:label="t('resourceType')" |
|||
min-width="120" |
|||
:show-overflow-tooltip="true" |
|||
/> |
|||
|
|||
<el-table-column |
|||
prop="communication_type" |
|||
:label="t('communicationType')" |
|||
min-width="120" |
|||
:show-overflow-tooltip="true" |
|||
/> |
|||
|
|||
<el-table-column |
|||
prop="communication_result" |
|||
:label="t('communicationResult')" |
|||
min-width="120" |
|||
:show-overflow-tooltip="true" |
|||
/> |
|||
|
|||
<el-table-column |
|||
prop="communication_time" |
|||
:label="t('communicationTime')" |
|||
min-width="120" |
|||
:show-overflow-tooltip="true" |
|||
/> |
|||
|
|||
<el-table-column |
|||
prop="remarks" |
|||
:label="t('remarks')" |
|||
min-width="120" |
|||
:show-overflow-tooltip="true" |
|||
/> |
|||
|
|||
<el-table-column |
|||
prop="tag" |
|||
:label="t('tag')" |
|||
min-width="120" |
|||
:show-overflow-tooltip="true" |
|||
/> |
|||
|
|||
<el-table-column |
|||
prop="business_id" |
|||
:label="t('businessId')" |
|||
min-width="120" |
|||
:show-overflow-tooltip="true" |
|||
/> |
|||
|
|||
<el-table-column |
|||
prop="created_at" |
|||
:label="t('createdAt')" |
|||
min-width="120" |
|||
:show-overflow-tooltip="true" |
|||
/> |
|||
|
|||
<el-table-column |
|||
prop="updated_at" |
|||
:label="t('updatedAt')" |
|||
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="communicationRecordsTable.page" |
|||
v-model:page-size="communicationRecordsTable.limit" |
|||
layout="total, sizes, prev, pager, next, jumper" |
|||
:total="communicationRecordsTable.total" |
|||
@size-change="loadCommunicationRecordsList()" |
|||
@current-change="loadCommunicationRecordsList" |
|||
/> |
|||
</div> |
|||
</div> |
|||
|
|||
<edit |
|||
ref="editCommunicationRecordsDialog" |
|||
@complete="loadCommunicationRecordsList" |
|||
/> |
|||
</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 { |
|||
getCommunicationRecordsList, |
|||
deleteCommunicationRecords, |
|||
} from '@/app/api/communication_records' |
|||
import { img } from '@/utils/common' |
|||
import { ElMessageBox, FormInstance } from 'element-plus' |
|||
import Edit from '@/app/views/communication_records/components/communication-records-edit.vue' |
|||
import { useRoute } from 'vue-router' |
|||
const route = useRoute() |
|||
const pageName = route.meta.title |
|||
|
|||
let communicationRecordsTable = reactive({ |
|||
page: 1, |
|||
limit: 10, |
|||
total: 0, |
|||
loading: true, |
|||
data: [], |
|||
searchParam: { |
|||
staff_id: '', |
|||
resource_id: '', |
|||
resource_type: '', |
|||
communication_type: '', |
|||
communication_result: '', |
|||
communication_time: '', |
|||
remarks: '', |
|||
tag: '', |
|||
business_id: '', |
|||
created_at: '', |
|||
updated_at: '', |
|||
}, |
|||
}) |
|||
|
|||
const searchFormRef = ref<FormInstance>() |
|||
|
|||
// 选中数据 |
|||
const selectData = ref<any[]>([]) |
|||
|
|||
// 字典数据 |
|||
|
|||
/** |
|||
* 获取沟通记录列表 |
|||
*/ |
|||
const loadCommunicationRecordsList = (page: number = 1) => { |
|||
communicationRecordsTable.loading = true |
|||
communicationRecordsTable.page = page |
|||
|
|||
getCommunicationRecordsList({ |
|||
page: communicationRecordsTable.page, |
|||
limit: communicationRecordsTable.limit, |
|||
...communicationRecordsTable.searchParam, |
|||
}) |
|||
.then((res) => { |
|||
communicationRecordsTable.loading = false |
|||
communicationRecordsTable.data = res.data.data |
|||
communicationRecordsTable.total = res.data.total |
|||
}) |
|||
.catch(() => { |
|||
communicationRecordsTable.loading = false |
|||
}) |
|||
} |
|||
loadCommunicationRecordsList() |
|||
|
|||
const editCommunicationRecordsDialog: Record<string, any> | null = ref(null) |
|||
|
|||
/** |
|||
* 添加沟通记录 |
|||
*/ |
|||
const addEvent = () => { |
|||
editCommunicationRecordsDialog.value.setFormData() |
|||
editCommunicationRecordsDialog.value.showDialog = true |
|||
} |
|||
|
|||
/** |
|||
* 编辑沟通记录 |
|||
* @param data |
|||
*/ |
|||
const editEvent = (data: any) => { |
|||
editCommunicationRecordsDialog.value.setFormData(data) |
|||
editCommunicationRecordsDialog.value.showDialog = true |
|||
} |
|||
|
|||
/** |
|||
* 删除沟通记录 |
|||
*/ |
|||
const deleteEvent = (id: number) => { |
|||
ElMessageBox.confirm(t('communicationRecordsDeleteTips'), t('warning'), { |
|||
confirmButtonText: t('confirm'), |
|||
cancelButtonText: t('cancel'), |
|||
type: 'warning', |
|||
}).then(() => { |
|||
deleteCommunicationRecords(id) |
|||
.then(() => { |
|||
loadCommunicationRecordsList() |
|||
}) |
|||
.catch(() => {}) |
|||
}) |
|||
} |
|||
|
|||
const resetForm = (formEl: FormInstance | undefined) => { |
|||
if (!formEl) return |
|||
formEl.resetFields() |
|||
loadCommunicationRecordsList() |
|||
} |
|||
</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> |
|||
<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('addCommunicationRecords') }} |
|||
</el-button> |
|||
</div> |
|||
|
|||
<el-card class="box-card !border-none my-[10px] table-search-wrap" shadow="never"> |
|||
<el-form :inline="true" :model="communicationRecordsTable.searchParam" ref="searchFormRef"> |
|||
|
|||
<el-form-item :label="t('resourceId')" prop="resource_id"> |
|||
<el-select class="w-[280px]" v-model="communicationRecordsTable.searchParam.resource_id" clearable :placeholder="t('resourceIdPlaceholder')"> |
|||
<el-option |
|||
v-for="(item, index) in resourceIdList" |
|||
:key="index" |
|||
:label="item['name']" |
|||
:value="item['id']" |
|||
/> |
|||
</el-select> |
|||
</el-form-item> |
|||
|
|||
|
|||
<el-form-item :label="t('communicationType')" prop="communication_type"> |
|||
<el-select class="w-[280px]" v-model="communicationRecordsTable.searchParam.communication_type" clearable :placeholder="t('communicationTypePlaceholder')"> |
|||
<el-option label="全部" value=""></el-option> |
|||
<el-option |
|||
v-for="(item, index) in communication_typeList" |
|||
:key="index" |
|||
:label="item.name" |
|||
:value="item.value" |
|||
/> |
|||
</el-select> |
|||
</el-form-item> |
|||
|
|||
<el-form-item> |
|||
<el-button type="primary" @click="loadCommunicationRecordsList()">{{ 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="communicationRecordsTable.data" size="large" v-loading="communicationRecordsTable.loading"> |
|||
<template #empty> |
|||
<span>{{ !communicationRecordsTable.loading ? t('emptyData') : '' }}</span> |
|||
</template> |
|||
<el-table-column prop="resource_id_name" :label="t('resourceId')" min-width="120" :show-overflow-tooltip="true"/> |
|||
|
|||
<el-table-column prop="resource_type" :label="t('resourceType')" min-width="120" :show-overflow-tooltip="true"/> |
|||
|
|||
<el-table-column :label="t('communicationType')" min-width="180" align="center" :show-overflow-tooltip="true"> |
|||
<template #default="{ row }"> |
|||
<div v-for="(item, index) in communication_typeList"> |
|||
<div v-if="item.value == row.communication_type">{{ item.name }}</div> |
|||
</div> |
|||
</template> |
|||
</el-table-column> |
|||
|
|||
<el-table-column :label="t('communicationResult')" min-width="180" align="center" :show-overflow-tooltip="true"> |
|||
<template #default="{ row }"> |
|||
<div v-for="(item, index) in communication_resultList"> |
|||
<div v-if="item.value == row.communication_result">{{ item.name }}</div> |
|||
</div> |
|||
</template> |
|||
</el-table-column> |
|||
|
|||
<el-table-column prop="communication_time" :label="t('communicationTime')" min-width="120" :show-overflow-tooltip="true"/> |
|||
|
|||
<el-table-column prop="remarks" :label="t('remarks')" min-width="120" :show-overflow-tooltip="true"/> |
|||
|
|||
<el-table-column :label="t('tag')" min-width="180" align="center" :show-overflow-tooltip="true"> |
|||
<template #default="{ row }"> |
|||
<div v-for="(item, index) in tagList"> |
|||
<div v-if="item.value == row.tag">{{ item.name }}</div> |
|||
</div> |
|||
</template> |
|||
</el-table-column> |
|||
|
|||
<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="communicationRecordsTable.page" v-model:page-size="communicationRecordsTable.limit" |
|||
layout="total, sizes, prev, pager, next, jumper" :total="communicationRecordsTable.total" |
|||
@size-change="loadCommunicationRecordsList()" @current-change="loadCommunicationRecordsList" /> |
|||
</div> |
|||
</div> |
|||
|
|||
<edit ref="editCommunicationRecordsDialog" @complete="loadCommunicationRecordsList" /> |
|||
</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 { getCommunicationRecordsList, deleteCommunicationRecords, getWithCustomerResourcesList } from '@/app/api/communication_records' |
|||
import { img } from '@/utils/common' |
|||
import { ElMessageBox,FormInstance } from 'element-plus' |
|||
import Edit from '@/app/views/communication_records/components/communication-records-edit.vue' |
|||
import { useRoute } from 'vue-router' |
|||
const route = useRoute() |
|||
const pageName = route.meta.title; |
|||
|
|||
let communicationRecordsTable = reactive({ |
|||
page: 1, |
|||
limit: 10, |
|||
total: 0, |
|||
loading: true, |
|||
data: [], |
|||
searchParam:{ |
|||
"resource_id":"", |
|||
"communication_type":"" |
|||
} |
|||
}) |
|||
|
|||
const searchFormRef = ref<FormInstance>() |
|||
|
|||
// 选中数据 |
|||
const selectData = ref<any[]>([]) |
|||
|
|||
// 字典数据 |
|||
const communication_typeList = ref([] as any[]) |
|||
const communication_typeDictList = async () => { |
|||
communication_typeList.value = await (await useDictionary('communication_type')).data.dictionary |
|||
} |
|||
communication_typeDictList(); |
|||
const communication_resultList = ref([] as any[]) |
|||
const communication_resultDictList = async () => { |
|||
communication_resultList.value = await (await useDictionary('communication_result')).data.dictionary |
|||
} |
|||
communication_resultDictList(); |
|||
const tagList = ref([] as any[]) |
|||
const tagDictList = async () => { |
|||
tagList.value = await (await useDictionary('tag')).data.dictionary |
|||
} |
|||
tagDictList(); |
|||
|
|||
/** |
|||
* 获取沟通记录列表 |
|||
*/ |
|||
const loadCommunicationRecordsList = (page: number = 1) => { |
|||
communicationRecordsTable.loading = true |
|||
communicationRecordsTable.page = page |
|||
|
|||
getCommunicationRecordsList({ |
|||
page: communicationRecordsTable.page, |
|||
limit: communicationRecordsTable.limit, |
|||
...communicationRecordsTable.searchParam |
|||
}).then(res => { |
|||
communicationRecordsTable.loading = false |
|||
communicationRecordsTable.data = res.data.data |
|||
communicationRecordsTable.total = res.data.total |
|||
}).catch(() => { |
|||
communicationRecordsTable.loading = false |
|||
}) |
|||
} |
|||
loadCommunicationRecordsList() |
|||
|
|||
const editCommunicationRecordsDialog: Record<string, any> | null = ref(null) |
|||
|
|||
/** |
|||
* 添加沟通记录 |
|||
*/ |
|||
const addEvent = () => { |
|||
editCommunicationRecordsDialog.value.setFormData() |
|||
editCommunicationRecordsDialog.value.showDialog = true |
|||
} |
|||
|
|||
/** |
|||
* 编辑沟通记录 |
|||
* @param data |
|||
*/ |
|||
const editEvent = (data: any) => { |
|||
editCommunicationRecordsDialog.value.setFormData(data) |
|||
editCommunicationRecordsDialog.value.showDialog = true |
|||
} |
|||
|
|||
/** |
|||
* 删除沟通记录 |
|||
*/ |
|||
const deleteEvent = (id: number) => { |
|||
ElMessageBox.confirm(t('communicationRecordsDeleteTips'), t('warning'), |
|||
{ |
|||
confirmButtonText: t('confirm'), |
|||
cancelButtonText: t('cancel'), |
|||
type: 'warning', |
|||
} |
|||
).then(() => { |
|||
deleteCommunicationRecords(id).then(() => { |
|||
loadCommunicationRecordsList() |
|||
}).catch(() => { |
|||
}) |
|||
}) |
|||
} |
|||
|
|||
|
|||
const resourceIdList = ref([]) |
|||
const setResourceIdList = async () => { |
|||
resourceIdList.value = await (await getWithCustomerResourcesList({})).data |
|||
} |
|||
setResourceIdList() |
|||
|
|||
const resetForm = (formEl: FormInstance | undefined) => { |
|||
if (!formEl) return |
|||
formEl.resetFields() |
|||
loadCommunicationRecordsList() |
|||
} |
|||
</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> |
|||
|
|||
@ -1,322 +1,262 @@ |
|||
<template> |
|||
<el-dialog |
|||
v-model="showDialog" |
|||
:title=" |
|||
formData.id |
|||
? t('updateCommunicationRecords') |
|||
: t('addCommunicationRecords') |
|||
" |
|||
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('staffId')" prop="staff_id"> |
|||
<el-input |
|||
v-model="formData.staff_id" |
|||
clearable |
|||
:placeholder="t('staffIdPlaceholder')" |
|||
class="input-width" |
|||
/> |
|||
</el-form-item> |
|||
|
|||
<el-form-item :label="t('resourceId')" prop="resource_id"> |
|||
<el-input |
|||
v-model="formData.resource_id" |
|||
clearable |
|||
:placeholder="t('resourceIdPlaceholder')" |
|||
class="input-width" |
|||
/> |
|||
</el-form-item> |
|||
|
|||
<el-form-item :label="t('resourceType')" prop="resource_type"> |
|||
<el-input |
|||
v-model="formData.resource_type" |
|||
clearable |
|||
:placeholder="t('resourceTypePlaceholder')" |
|||
class="input-width" |
|||
/> |
|||
</el-form-item> |
|||
|
|||
<el-form-item :label="t('communicationType')" prop="communication_type"> |
|||
<el-input |
|||
v-model="formData.communication_type" |
|||
clearable |
|||
:placeholder="t('communicationTypePlaceholder')" |
|||
class="input-width" |
|||
/> |
|||
</el-form-item> |
|||
|
|||
<el-form-item |
|||
:label="t('communicationResult')" |
|||
prop="communication_result" |
|||
> |
|||
<el-input |
|||
v-model="formData.communication_result" |
|||
clearable |
|||
:placeholder="t('communicationResultPlaceholder')" |
|||
class="input-width" |
|||
/> |
|||
</el-form-item> |
|||
|
|||
<el-form-item :label="t('communicationTime')" prop="communication_time"> |
|||
<el-input |
|||
v-model="formData.communication_time" |
|||
clearable |
|||
:placeholder="t('communicationTimePlaceholder')" |
|||
class="input-width" |
|||
/> |
|||
</el-form-item> |
|||
|
|||
<el-form-item :label="t('remarks')"> |
|||
<el-input |
|||
v-model="formData.remarks" |
|||
clearable |
|||
:placeholder="t('remarksPlaceholder')" |
|||
class="input-width" |
|||
/> |
|||
</el-form-item> |
|||
|
|||
<el-form-item :label="t('tag')"> |
|||
<el-input |
|||
v-model="formData.tag" |
|||
clearable |
|||
:placeholder="t('tagPlaceholder')" |
|||
class="input-width" |
|||
/> |
|||
</el-form-item> |
|||
|
|||
<el-form-item :label="t('businessId')"> |
|||
<el-input |
|||
v-model="formData.business_id" |
|||
clearable |
|||
:placeholder="t('businessIdPlaceholder')" |
|||
class="input-width" |
|||
/> |
|||
</el-form-item> |
|||
|
|||
<el-form-item :label="t('createdAt')"> |
|||
<el-input |
|||
v-model="formData.created_at" |
|||
clearable |
|||
:placeholder="t('createdAtPlaceholder')" |
|||
class="input-width" |
|||
/> |
|||
</el-form-item> |
|||
|
|||
<el-form-item :label="t('updatedAt')"> |
|||
<el-input |
|||
v-model="formData.updated_at" |
|||
clearable |
|||
:placeholder="t('updatedAtPlaceholder')" |
|||
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 { |
|||
addCommunicationRecords, |
|||
editCommunicationRecords, |
|||
getCommunicationRecordsInfo, |
|||
} from '@/app/api/communication_records' |
|||
|
|||
let showDialog = ref(false) |
|||
const loading = ref(false) |
|||
|
|||
/** |
|||
* 表单数据 |
|||
*/ |
|||
const initialFormData = { |
|||
id: '', |
|||
staff_id: '', |
|||
resource_id: '', |
|||
resource_type: '', |
|||
communication_type: '', |
|||
communication_result: '', |
|||
communication_time: '', |
|||
remarks: '', |
|||
tag: '', |
|||
business_id: '', |
|||
created_at: '', |
|||
updated_at: '', |
|||
} |
|||
const formData: Record<string, any> = reactive({ ...initialFormData }) |
|||
|
|||
const formRef = ref<FormInstance>() |
|||
|
|||
// 表单验证规则 |
|||
const formRules = computed(() => { |
|||
return { |
|||
staff_id: [ |
|||
{ required: true, message: t('staffIdPlaceholder'), trigger: 'blur' }, |
|||
], |
|||
resource_id: [ |
|||
{ required: true, message: t('resourceIdPlaceholder'), trigger: 'blur' }, |
|||
], |
|||
resource_type: [ |
|||
{ |
|||
required: true, |
|||
message: t('resourceTypePlaceholder'), |
|||
trigger: 'blur', |
|||
}, |
|||
], |
|||
communication_type: [ |
|||
{ |
|||
required: true, |
|||
message: t('communicationTypePlaceholder'), |
|||
trigger: 'blur', |
|||
}, |
|||
], |
|||
communication_result: [ |
|||
{ |
|||
required: true, |
|||
message: t('communicationResultPlaceholder'), |
|||
trigger: 'blur', |
|||
}, |
|||
], |
|||
communication_time: [ |
|||
{ |
|||
required: true, |
|||
message: t('communicationTimePlaceholder'), |
|||
trigger: 'blur', |
|||
}, |
|||
], |
|||
remarks: [ |
|||
{ required: true, message: t('remarksPlaceholder'), trigger: 'blur' }, |
|||
], |
|||
tag: [{ required: true, message: t('tagPlaceholder'), trigger: 'blur' }], |
|||
business_id: [ |
|||
{ required: true, message: t('businessIdPlaceholder'), trigger: 'blur' }, |
|||
], |
|||
created_at: [ |
|||
{ required: true, message: t('createdAtPlaceholder'), trigger: 'blur' }, |
|||
], |
|||
updated_at: [ |
|||
{ required: true, message: t('updatedAtPlaceholder'), trigger: 'blur' }, |
|||
], |
|||
} |
|||
}) |
|||
|
|||
const emit = defineEmits(['complete']) |
|||
|
|||
/** |
|||
* 确认 |
|||
* @param formEl |
|||
*/ |
|||
const confirm = async (formEl: FormInstance | undefined) => { |
|||
if (loading.value || !formEl) return |
|||
let save = formData.id ? editCommunicationRecords : addCommunicationRecords |
|||
|
|||
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 setFormData = async (row: any = null) => { |
|||
Object.assign(formData, initialFormData) |
|||
loading.value = true |
|||
if (row) { |
|||
const data = await (await getCommunicationRecordsInfo(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> |
|||
<template> |
|||
<el-dialog v-model="showDialog" :title="formData.id ? t('updateCommunicationRecords') : t('addCommunicationRecords')" 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('resourceId')" prop="resource_id"> |
|||
<el-select class="input-width" v-model="formData.resource_id" clearable :placeholder="t('resourceIdPlaceholder')"> |
|||
<el-option label="请选择" value=""></el-option> |
|||
<el-option |
|||
v-for="(item, index) in resourceIdList" |
|||
:key="index" |
|||
:label="item['name']" |
|||
:value="item['id']" |
|||
/> |
|||
</el-select> |
|||
</el-form-item> |
|||
|
|||
<el-form-item :label="t('resourceType')" prop="resource_type"> |
|||
<el-input v-model="formData.resource_type" clearable :placeholder="t('resourceTypePlaceholder')" class="input-width" /> |
|||
</el-form-item> |
|||
|
|||
<el-form-item :label="t('communicationType')" prop="communication_type"> |
|||
<el-select class="input-width" v-model="formData.communication_type" clearable :placeholder="t('communicationTypePlaceholder')"> |
|||
<el-option label="请选择" value=""></el-option> |
|||
<el-option |
|||
v-for="(item, index) in communication_typeList" |
|||
:key="index" |
|||
:label="item.name" |
|||
:value="item.value" |
|||
/> |
|||
</el-select> |
|||
</el-form-item> |
|||
|
|||
<el-form-item :label="t('communicationResult')" prop="communication_result"> |
|||
<el-select class="input-width" v-model="formData.communication_result" clearable :placeholder="t('communicationResultPlaceholder')"> |
|||
<el-option label="请选择" value=""></el-option> |
|||
<el-option |
|||
v-for="(item, index) in communication_resultList" |
|||
:key="index" |
|||
:label="item.name" |
|||
:value="item.value" |
|||
/> |
|||
</el-select> |
|||
</el-form-item> |
|||
|
|||
<el-form-item :label="t('communicationTime')" prop="communication_time" class="input-width"> |
|||
<el-date-picker |
|||
class="flex-1 !flex" |
|||
v-model="formData.communication_time" |
|||
clearable |
|||
type="datetime" |
|||
value-format="YYYY-MM-DD HH:mm:ss" |
|||
:placeholder="t('communicationTimePlaceholder')"> |
|||
</el-date-picker> |
|||
</el-form-item> |
|||
<el-form-item :label="t('remarks')" > |
|||
<el-input v-model="formData.remarks" type="textarea" rows="4" clearable :placeholder="t('remarksPlaceholder')" class="input-width"/> |
|||
</el-form-item> |
|||
<el-form-item :label="t('tag')" > |
|||
<el-select class="input-width" v-model="formData.tag" clearable :placeholder="t('tagPlaceholder')"> |
|||
<el-option label="请选择" value=""></el-option> |
|||
<el-option |
|||
v-for="(item, index) in tagList" |
|||
:key="index" |
|||
:label="item.name" |
|||
:value="item.value" |
|||
/> |
|||
</el-select> |
|||
</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 { addCommunicationRecords, editCommunicationRecords, getCommunicationRecordsInfo, getWithCustomerResourcesList } from '@/app/api/communication_records' |
|||
|
|||
let showDialog = ref(false) |
|||
const loading = ref(false) |
|||
|
|||
/** |
|||
* 表单数据 |
|||
*/ |
|||
const initialFormData = { |
|||
id: '', |
|||
resource_id: '', |
|||
resource_type: '', |
|||
communication_type: '', |
|||
communication_result: '', |
|||
communication_time: '', |
|||
remarks: '', |
|||
tag: '', |
|||
} |
|||
const formData: Record<string, any> = reactive({ ...initialFormData }) |
|||
|
|||
const formRef = ref<FormInstance>() |
|||
|
|||
// 表单验证规则 |
|||
const formRules = computed(() => { |
|||
return { |
|||
resource_id: [ |
|||
{ required: true, message: t('resourceIdPlaceholder'), trigger: 'blur' }, |
|||
|
|||
] |
|||
, |
|||
resource_type: [ |
|||
{ required: true, message: t('resourceTypePlaceholder'), trigger: 'blur' }, |
|||
|
|||
] |
|||
, |
|||
communication_type: [ |
|||
{ required: true, message: t('communicationTypePlaceholder'), trigger: 'blur' }, |
|||
|
|||
] |
|||
, |
|||
communication_result: [ |
|||
{ required: true, message: t('communicationResultPlaceholder'), trigger: 'blur' }, |
|||
|
|||
] |
|||
, |
|||
communication_time: [ |
|||
{ required: true, message: t('communicationTimePlaceholder'), trigger: 'blur' }, |
|||
|
|||
] |
|||
, |
|||
remarks: [ |
|||
{ required: true, message: t('remarksPlaceholder'), trigger: 'blur' }, |
|||
|
|||
] |
|||
, |
|||
tag: [ |
|||
{ required: true, message: t('tagPlaceholder'), trigger: 'blur' }, |
|||
|
|||
] |
|||
, |
|||
} |
|||
}) |
|||
|
|||
const emit = defineEmits(['complete']) |
|||
|
|||
/** |
|||
* 确认 |
|||
* @param formEl |
|||
*/ |
|||
const confirm = async (formEl: FormInstance | undefined) => { |
|||
if (loading.value || !formEl) return |
|||
let save = formData.id ? editCommunicationRecords : addCommunicationRecords |
|||
|
|||
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 |
|||
}) |
|||
} |
|||
}) |
|||
} |
|||
|
|||
// 获取字典数据 |
|||
let communication_typeList = ref([]) |
|||
const communication_typeDictList = async () => { |
|||
communication_typeList.value = await (await useDictionary('communication_type')).data.dictionary |
|||
} |
|||
communication_typeDictList(); |
|||
watch(() => communication_typeList.value, () => { formData.communication_type = communication_typeList.value[0].value }) |
|||
let communication_resultList = ref([]) |
|||
const communication_resultDictList = async () => { |
|||
communication_resultList.value = await (await useDictionary('communication_result')).data.dictionary |
|||
} |
|||
communication_resultDictList(); |
|||
watch(() => communication_resultList.value, () => { formData.communication_result = communication_resultList.value[0].value }) |
|||
let tagList = ref([]) |
|||
const tagDictList = async () => { |
|||
tagList.value = await (await useDictionary('tag')).data.dictionary |
|||
} |
|||
tagDictList(); |
|||
watch(() => tagList.value, () => { formData.tag = tagList.value[0].value }) |
|||
|
|||
|
|||
const resourceIdList = ref([] as any[]) |
|||
const setResourceIdList = async () => { |
|||
resourceIdList.value = await (await getWithCustomerResourcesList({})).data |
|||
} |
|||
setResourceIdList() |
|||
const setFormData = async (row: any = null) => { |
|||
Object.assign(formData, initialFormData) |
|||
loading.value = true |
|||
if(row){ |
|||
const data = await (await getCommunicationRecordsInfo(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> |
|||
|
|||
@ -1,236 +1,231 @@ |
|||
<template> |
|||
<el-dialog |
|||
v-model="showDialog" |
|||
:title="formData.id ? t('updateStudentCourses') : t('addStudentCourses')" |
|||
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('studentId')" prop="student_id"> |
|||
<el-input |
|||
v-model="formData.student_id" |
|||
clearable |
|||
:placeholder="t('studentIdPlaceholder')" |
|||
class="input-width" |
|||
/> |
|||
</el-form-item> |
|||
|
|||
<el-form-item :label="t('courseId')" prop="course_id"> |
|||
<el-input |
|||
v-model="formData.course_id" |
|||
clearable |
|||
:placeholder="t('courseIdPlaceholder')" |
|||
class="input-width" |
|||
/> |
|||
</el-form-item> |
|||
|
|||
<el-form-item :label="t('totalHours')" prop="total_hours"> |
|||
<el-input |
|||
v-model="formData.total_hours" |
|||
clearable |
|||
:placeholder="t('totalHoursPlaceholder')" |
|||
class="input-width" |
|||
/> |
|||
</el-form-item> |
|||
|
|||
<el-form-item :label="t('giftHours')"> |
|||
<el-input |
|||
v-model="formData.gift_hours" |
|||
clearable |
|||
:placeholder="t('giftHoursPlaceholder')" |
|||
class="input-width" |
|||
/> |
|||
</el-form-item> |
|||
|
|||
<el-form-item :label="t('startDate')" prop="start_date"> |
|||
<el-input |
|||
v-model="formData.start_date" |
|||
clearable |
|||
:placeholder="t('startDatePlaceholder')" |
|||
class="input-width" |
|||
/> |
|||
</el-form-item> |
|||
|
|||
<el-form-item :label="t('endDate')" prop="end_date"> |
|||
<el-input |
|||
v-model="formData.end_date" |
|||
clearable |
|||
:placeholder="t('endDatePlaceholder')" |
|||
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 { |
|||
addStudentCourses, |
|||
editStudentCourses, |
|||
getStudentCoursesInfo, |
|||
} from '@/app/api/student_courses' |
|||
|
|||
let showDialog = ref(false) |
|||
const loading = ref(false) |
|||
|
|||
/** |
|||
* 表单数据 |
|||
*/ |
|||
const initialFormData = { |
|||
id: '', |
|||
student_id: '', |
|||
course_id: '', |
|||
total_hours: '', |
|||
gift_hours: '', |
|||
start_date: '', |
|||
end_date: '', |
|||
} |
|||
const formData: Record<string, any> = reactive({ ...initialFormData }) |
|||
|
|||
const formRef = ref<FormInstance>() |
|||
|
|||
// 表单验证规则 |
|||
const formRules = computed(() => { |
|||
return { |
|||
student_id: [ |
|||
{ required: true, message: t('studentIdPlaceholder'), trigger: 'blur' }, |
|||
], |
|||
course_id: [ |
|||
{ required: true, message: t('courseIdPlaceholder'), trigger: 'blur' }, |
|||
], |
|||
total_hours: [ |
|||
{ required: true, message: t('totalHoursPlaceholder'), trigger: 'blur' }, |
|||
], |
|||
gift_hours: [ |
|||
{ required: true, message: t('giftHoursPlaceholder'), trigger: 'blur' }, |
|||
], |
|||
start_date: [ |
|||
{ required: true, message: t('startDatePlaceholder'), trigger: 'blur' }, |
|||
], |
|||
end_date: [ |
|||
{ required: true, message: t('endDatePlaceholder'), trigger: 'blur' }, |
|||
], |
|||
} |
|||
}) |
|||
|
|||
const emit = defineEmits(['complete']) |
|||
|
|||
/** |
|||
* 确认 |
|||
* @param formEl |
|||
*/ |
|||
const confirm = async (formEl: FormInstance | undefined) => { |
|||
if (loading.value || !formEl) return |
|||
let save = formData.id ? editStudentCourses : addStudentCourses |
|||
|
|||
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 setFormData = async (row: any = null) => { |
|||
Object.assign(formData, initialFormData) |
|||
loading.value = true |
|||
if (row) { |
|||
const data = await (await getStudentCoursesInfo(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> |
|||
<template> |
|||
<el-dialog v-model="showDialog" :title="formData.id ? t('updateStudentCourses') : t('addStudentCourses')" 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('studentId')" prop="student_id"> |
|||
<el-select class="input-width" v-model="formData.student_id" clearable :placeholder="t('studentIdPlaceholder')"> |
|||
<el-option label="请选择" value=""></el-option> |
|||
<el-option |
|||
v-for="(item, index) in studentIdList" |
|||
:key="index" |
|||
:label="item['name']" |
|||
:value="item['id']" |
|||
/> |
|||
</el-select> |
|||
</el-form-item> |
|||
|
|||
<el-form-item :label="t('courseId')" prop="course_id"> |
|||
<el-select class="input-width" v-model="formData.course_id" clearable :placeholder="t('courseIdPlaceholder')"> |
|||
<el-option label="请选择" value=""></el-option> |
|||
<el-option |
|||
v-for="(item, index) in courseIdList" |
|||
:key="index" |
|||
:label="item['course_name']" |
|||
:value="item['id']" |
|||
/> |
|||
</el-select> |
|||
</el-form-item> |
|||
|
|||
<el-form-item :label="t('totalHours')" prop="total_hours"> |
|||
<el-input v-model="formData.total_hours" clearable :placeholder="t('totalHoursPlaceholder')" class="input-width" /> |
|||
</el-form-item> |
|||
|
|||
<el-form-item :label="t('giftHours')" > |
|||
<el-input v-model="formData.gift_hours" clearable :placeholder="t('giftHoursPlaceholder')" class="input-width" /> |
|||
</el-form-item> |
|||
|
|||
<el-form-item :label="t('startDate')" prop="start_date" class="input-width"> |
|||
<el-date-picker |
|||
class="flex-1 !flex" |
|||
v-model="formData.start_date" |
|||
clearable |
|||
type="datetime" |
|||
value-format="YYYY-MM-DD HH:mm:ss" |
|||
:placeholder="t('startDatePlaceholder')"> |
|||
</el-date-picker> |
|||
</el-form-item> |
|||
<el-form-item :label="t('endDate')" prop="end_date" class="input-width"> |
|||
<el-date-picker |
|||
class="flex-1 !flex" |
|||
v-model="formData.end_date" |
|||
clearable |
|||
type="datetime" |
|||
value-format="YYYY-MM-DD HH:mm:ss" |
|||
:placeholder="t('endDatePlaceholder')"> |
|||
</el-date-picker> |
|||
</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 { addStudentCourses, editStudentCourses, getStudentCoursesInfo, getWithStudentList, getWithCourseList } from '@/app/api/student_courses' |
|||
|
|||
let showDialog = ref(false) |
|||
const loading = ref(false) |
|||
|
|||
/** |
|||
* 表单数据 |
|||
*/ |
|||
const initialFormData = { |
|||
id: '', |
|||
student_id: '', |
|||
course_id: '', |
|||
total_hours: '', |
|||
gift_hours: '', |
|||
start_date: '', |
|||
end_date: '', |
|||
} |
|||
const formData: Record<string, any> = reactive({ ...initialFormData }) |
|||
|
|||
const formRef = ref<FormInstance>() |
|||
|
|||
// 表单验证规则 |
|||
const formRules = computed(() => { |
|||
return { |
|||
student_id: [ |
|||
{ required: true, message: t('studentIdPlaceholder'), trigger: 'blur' }, |
|||
|
|||
] |
|||
, |
|||
course_id: [ |
|||
{ required: true, message: t('courseIdPlaceholder'), trigger: 'blur' }, |
|||
|
|||
] |
|||
, |
|||
total_hours: [ |
|||
{ required: true, message: t('totalHoursPlaceholder'), trigger: 'blur' }, |
|||
|
|||
] |
|||
, |
|||
gift_hours: [ |
|||
{ required: true, message: t('giftHoursPlaceholder'), trigger: 'blur' }, |
|||
|
|||
] |
|||
, |
|||
start_date: [ |
|||
{ required: true, message: t('startDatePlaceholder'), trigger: 'blur' }, |
|||
|
|||
] |
|||
, |
|||
end_date: [ |
|||
{ required: true, message: t('endDatePlaceholder'), trigger: 'blur' }, |
|||
|
|||
] |
|||
, |
|||
} |
|||
}) |
|||
|
|||
const emit = defineEmits(['complete']) |
|||
|
|||
/** |
|||
* 确认 |
|||
* @param formEl |
|||
*/ |
|||
const confirm = async (formEl: FormInstance | undefined) => { |
|||
if (loading.value || !formEl) return |
|||
let save = formData.id ? editStudentCourses : addStudentCourses |
|||
|
|||
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 studentIdList = ref([] as any[]) |
|||
const setStudentIdList = async () => { |
|||
studentIdList.value = await (await getWithStudentList({})).data |
|||
} |
|||
setStudentIdList() |
|||
const courseIdList = ref([] as any[]) |
|||
const setCourseIdList = async () => { |
|||
courseIdList.value = await (await getWithCourseList({})).data |
|||
} |
|||
setCourseIdList() |
|||
const setFormData = async (row: any = null) => { |
|||
Object.assign(formData, initialFormData) |
|||
loading.value = true |
|||
if(row){ |
|||
const data = await (await getStudentCoursesInfo(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> |
|||
|
|||
@ -1,267 +1,201 @@ |
|||
<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('addStudentCourses') }} |
|||
</el-button> |
|||
</div> |
|||
|
|||
<el-card |
|||
class="box-card !border-none my-[10px] table-search-wrap" |
|||
shadow="never" |
|||
> |
|||
<el-form |
|||
:inline="true" |
|||
:model="studentCoursesTable.searchParam" |
|||
ref="searchFormRef" |
|||
> |
|||
<el-form-item :label="t('studentId')" prop="student_id"> |
|||
<el-input |
|||
v-model="studentCoursesTable.searchParam.student_id" |
|||
:placeholder="t('studentIdPlaceholder')" |
|||
/> |
|||
</el-form-item> |
|||
<el-form-item :label="t('courseId')" prop="course_id"> |
|||
<el-input |
|||
v-model="studentCoursesTable.searchParam.course_id" |
|||
:placeholder="t('courseIdPlaceholder')" |
|||
/> |
|||
</el-form-item> |
|||
<el-form-item :label="t('totalHours')" prop="total_hours"> |
|||
<el-input |
|||
v-model="studentCoursesTable.searchParam.total_hours" |
|||
:placeholder="t('totalHoursPlaceholder')" |
|||
/> |
|||
</el-form-item> |
|||
<el-form-item :label="t('giftHours')" prop="gift_hours"> |
|||
<el-input |
|||
v-model="studentCoursesTable.searchParam.gift_hours" |
|||
:placeholder="t('giftHoursPlaceholder')" |
|||
/> |
|||
</el-form-item> |
|||
<el-form-item :label="t('startDate')" prop="start_date"> |
|||
<el-input |
|||
v-model="studentCoursesTable.searchParam.start_date" |
|||
:placeholder="t('startDatePlaceholder')" |
|||
/> |
|||
</el-form-item> |
|||
<el-form-item :label="t('endDate')" prop="end_date"> |
|||
<el-input |
|||
v-model="studentCoursesTable.searchParam.end_date" |
|||
:placeholder="t('endDatePlaceholder')" |
|||
/> |
|||
</el-form-item> |
|||
|
|||
<el-form-item> |
|||
<el-button type="primary" @click="loadStudentCoursesList()">{{ |
|||
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="studentCoursesTable.data" |
|||
size="large" |
|||
v-loading="studentCoursesTable.loading" |
|||
> |
|||
<template #empty> |
|||
<span>{{ |
|||
!studentCoursesTable.loading ? t('emptyData') : '' |
|||
}}</span> |
|||
</template> |
|||
<el-table-column |
|||
prop="student_id" |
|||
:label="t('studentId')" |
|||
min-width="120" |
|||
:show-overflow-tooltip="true" |
|||
/> |
|||
|
|||
<el-table-column |
|||
prop="course_id" |
|||
:label="t('courseId')" |
|||
min-width="120" |
|||
:show-overflow-tooltip="true" |
|||
/> |
|||
|
|||
<el-table-column |
|||
prop="total_hours" |
|||
:label="t('totalHours')" |
|||
min-width="120" |
|||
:show-overflow-tooltip="true" |
|||
/> |
|||
|
|||
<el-table-column |
|||
prop="gift_hours" |
|||
:label="t('giftHours')" |
|||
min-width="120" |
|||
:show-overflow-tooltip="true" |
|||
/> |
|||
|
|||
<el-table-column |
|||
prop="start_date" |
|||
:label="t('startDate')" |
|||
min-width="120" |
|||
:show-overflow-tooltip="true" |
|||
/> |
|||
|
|||
<el-table-column |
|||
prop="end_date" |
|||
:label="t('endDate')" |
|||
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="studentCoursesTable.page" |
|||
v-model:page-size="studentCoursesTable.limit" |
|||
layout="total, sizes, prev, pager, next, jumper" |
|||
:total="studentCoursesTable.total" |
|||
@size-change="loadStudentCoursesList()" |
|||
@current-change="loadStudentCoursesList" |
|||
/> |
|||
</div> |
|||
</div> |
|||
|
|||
<edit ref="editStudentCoursesDialog" @complete="loadStudentCoursesList" /> |
|||
</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 { |
|||
getStudentCoursesList, |
|||
deleteStudentCourses, |
|||
} from '@/app/api/student_courses' |
|||
import { img } from '@/utils/common' |
|||
import { ElMessageBox, FormInstance } from 'element-plus' |
|||
import Edit from '@/app/views/student_courses/components/student-courses-edit.vue' |
|||
import { useRoute } from 'vue-router' |
|||
const route = useRoute() |
|||
const pageName = route.meta.title |
|||
|
|||
let studentCoursesTable = reactive({ |
|||
page: 1, |
|||
limit: 10, |
|||
total: 0, |
|||
loading: true, |
|||
data: [], |
|||
searchParam: { |
|||
student_id: '', |
|||
course_id: '', |
|||
total_hours: '', |
|||
gift_hours: '', |
|||
start_date: '', |
|||
end_date: '', |
|||
}, |
|||
}) |
|||
|
|||
const searchFormRef = ref<FormInstance>() |
|||
|
|||
// 选中数据 |
|||
const selectData = ref<any[]>([]) |
|||
|
|||
// 字典数据 |
|||
|
|||
/** |
|||
* 获取学员课程列表 |
|||
*/ |
|||
const loadStudentCoursesList = (page: number = 1) => { |
|||
studentCoursesTable.loading = true |
|||
studentCoursesTable.page = page |
|||
|
|||
getStudentCoursesList({ |
|||
page: studentCoursesTable.page, |
|||
limit: studentCoursesTable.limit, |
|||
...studentCoursesTable.searchParam, |
|||
}) |
|||
.then((res) => { |
|||
studentCoursesTable.loading = false |
|||
studentCoursesTable.data = res.data.data |
|||
studentCoursesTable.total = res.data.total |
|||
}) |
|||
.catch(() => { |
|||
studentCoursesTable.loading = false |
|||
}) |
|||
} |
|||
loadStudentCoursesList() |
|||
|
|||
const editStudentCoursesDialog: Record<string, any> | null = ref(null) |
|||
|
|||
/** |
|||
* 添加学员课程 |
|||
*/ |
|||
const addEvent = () => { |
|||
editStudentCoursesDialog.value.setFormData() |
|||
editStudentCoursesDialog.value.showDialog = true |
|||
} |
|||
|
|||
/** |
|||
* 编辑学员课程 |
|||
* @param data |
|||
*/ |
|||
const editEvent = (data: any) => { |
|||
editStudentCoursesDialog.value.setFormData(data) |
|||
editStudentCoursesDialog.value.showDialog = true |
|||
} |
|||
|
|||
/** |
|||
* 删除学员课程 |
|||
*/ |
|||
const deleteEvent = (id: number) => { |
|||
ElMessageBox.confirm(t('studentCoursesDeleteTips'), t('warning'), { |
|||
confirmButtonText: t('confirm'), |
|||
cancelButtonText: t('cancel'), |
|||
type: 'warning', |
|||
}).then(() => { |
|||
deleteStudentCourses(id) |
|||
.then(() => { |
|||
loadStudentCoursesList() |
|||
}) |
|||
.catch(() => {}) |
|||
}) |
|||
} |
|||
|
|||
const resetForm = (formEl: FormInstance | undefined) => { |
|||
if (!formEl) return |
|||
formEl.resetFields() |
|||
loadStudentCoursesList() |
|||
} |
|||
</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> |
|||
<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('addStudentCourses') }} |
|||
</el-button> |
|||
</div> |
|||
|
|||
<el-card class="box-card !border-none my-[10px] table-search-wrap" shadow="never"> |
|||
<el-form :inline="true" :model="studentCoursesTable.searchParam" ref="searchFormRef"> |
|||
|
|||
<el-form-item :label="t('studentId')" prop="student_id"> |
|||
<el-select class="w-[280px]" v-model="studentCoursesTable.searchParam.student_id" clearable :placeholder="t('studentIdPlaceholder')"> |
|||
<el-option |
|||
v-for="(item, index) in studentIdList" |
|||
:key="index" |
|||
:label="item['name']" |
|||
:value="item['id']" |
|||
/> |
|||
</el-select> |
|||
</el-form-item> |
|||
|
|||
|
|||
<el-form-item :label="t('courseId')" prop="course_id"> |
|||
<el-select class="w-[280px]" v-model="studentCoursesTable.searchParam.course_id" clearable :placeholder="t('courseIdPlaceholder')"> |
|||
<el-option |
|||
v-for="(item, index) in courseIdList" |
|||
:key="index" |
|||
:label="item['course_name']" |
|||
:value="item['id']" |
|||
/> |
|||
</el-select> |
|||
</el-form-item> |
|||
|
|||
<el-form-item> |
|||
<el-button type="primary" @click="loadStudentCoursesList()">{{ 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="studentCoursesTable.data" size="large" v-loading="studentCoursesTable.loading"> |
|||
<template #empty> |
|||
<span>{{ !studentCoursesTable.loading ? t('emptyData') : '' }}</span> |
|||
</template> |
|||
<el-table-column prop="student_id_name" :label="t('studentId')" min-width="120" :show-overflow-tooltip="true"/> |
|||
|
|||
<el-table-column prop="course_id_name" :label="t('courseId')" min-width="120" :show-overflow-tooltip="true"/> |
|||
|
|||
<el-table-column prop="total_hours" :label="t('totalHours')" min-width="120" :show-overflow-tooltip="true"/> |
|||
|
|||
<el-table-column prop="gift_hours" :label="t('giftHours')" min-width="120" :show-overflow-tooltip="true"/> |
|||
|
|||
<el-table-column prop="start_date" :label="t('startDate')" min-width="120" :show-overflow-tooltip="true"/> |
|||
|
|||
<el-table-column prop="end_date" :label="t('endDate')" 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="studentCoursesTable.page" v-model:page-size="studentCoursesTable.limit" |
|||
layout="total, sizes, prev, pager, next, jumper" :total="studentCoursesTable.total" |
|||
@size-change="loadStudentCoursesList()" @current-change="loadStudentCoursesList" /> |
|||
</div> |
|||
</div> |
|||
|
|||
<edit ref="editStudentCoursesDialog" @complete="loadStudentCoursesList" /> |
|||
</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 { getStudentCoursesList, deleteStudentCourses, getWithStudentList, getWithCourseList } from '@/app/api/student_courses' |
|||
import { img } from '@/utils/common' |
|||
import { ElMessageBox,FormInstance } from 'element-plus' |
|||
import Edit from '@/app/views/student_courses/components/student-courses-edit.vue' |
|||
import { useRoute } from 'vue-router' |
|||
const route = useRoute() |
|||
const pageName = route.meta.title; |
|||
|
|||
let studentCoursesTable = reactive({ |
|||
page: 1, |
|||
limit: 10, |
|||
total: 0, |
|||
loading: true, |
|||
data: [], |
|||
searchParam:{ |
|||
"student_id":"", |
|||
"course_id":"" |
|||
} |
|||
}) |
|||
|
|||
const searchFormRef = ref<FormInstance>() |
|||
|
|||
// 选中数据 |
|||
const selectData = ref<any[]>([]) |
|||
|
|||
// 字典数据 |
|||
|
|||
|
|||
/** |
|||
* 获取学员课程列表 |
|||
*/ |
|||
const loadStudentCoursesList = (page: number = 1) => { |
|||
studentCoursesTable.loading = true |
|||
studentCoursesTable.page = page |
|||
|
|||
getStudentCoursesList({ |
|||
page: studentCoursesTable.page, |
|||
limit: studentCoursesTable.limit, |
|||
...studentCoursesTable.searchParam |
|||
}).then(res => { |
|||
studentCoursesTable.loading = false |
|||
studentCoursesTable.data = res.data.data |
|||
studentCoursesTable.total = res.data.total |
|||
}).catch(() => { |
|||
studentCoursesTable.loading = false |
|||
}) |
|||
} |
|||
loadStudentCoursesList() |
|||
|
|||
const editStudentCoursesDialog: Record<string, any> | null = ref(null) |
|||
|
|||
/** |
|||
* 添加学员课程 |
|||
*/ |
|||
const addEvent = () => { |
|||
editStudentCoursesDialog.value.setFormData() |
|||
editStudentCoursesDialog.value.showDialog = true |
|||
} |
|||
|
|||
/** |
|||
* 编辑学员课程 |
|||
* @param data |
|||
*/ |
|||
const editEvent = (data: any) => { |
|||
editStudentCoursesDialog.value.setFormData(data) |
|||
editStudentCoursesDialog.value.showDialog = true |
|||
} |
|||
|
|||
/** |
|||
* 删除学员课程 |
|||
*/ |
|||
const deleteEvent = (id: number) => { |
|||
ElMessageBox.confirm(t('studentCoursesDeleteTips'), t('warning'), |
|||
{ |
|||
confirmButtonText: t('confirm'), |
|||
cancelButtonText: t('cancel'), |
|||
type: 'warning', |
|||
} |
|||
).then(() => { |
|||
deleteStudentCourses(id).then(() => { |
|||
loadStudentCoursesList() |
|||
}).catch(() => { |
|||
}) |
|||
}) |
|||
} |
|||
|
|||
|
|||
const studentIdList = ref([]) |
|||
const setStudentIdList = async () => { |
|||
studentIdList.value = await (await getWithStudentList({})).data |
|||
} |
|||
setStudentIdList() |
|||
const courseIdList = ref([]) |
|||
const setCourseIdList = async () => { |
|||
courseIdList.value = await (await getWithCourseList({})).data |
|||
} |
|||
setCourseIdList() |
|||
|
|||
const resetForm = (formEl: FormInstance | undefined) => { |
|||
if (!formEl) return |
|||
formEl.resetFields() |
|||
loadStudentCoursesList() |
|||
} |
|||
</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,212 @@ |
|||
<template> |
|||
<div class="main-container"> |
|||
<el-card class="box-card !border-none" shadow="never" v-loading="loading"> |
|||
|
|||
<div class="flex justify-between items-center"> |
|||
<span class="text-lg">{{ pageName }}</span> |
|||
<el-button type="primary" @click="addStage"> |
|||
新增阶段 |
|||
</el-button> |
|||
</div> |
|||
</el-card> |
|||
|
|||
|
|||
|
|||
<el-card class="box-card !border-none" shadow="never" > |
|||
|
|||
<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"> |
|||
|
|||
<template #title> |
|||
<div class="collapse-title"> |
|||
<span class="title-name">{{ stage.name }}</span> |
|||
<span class="arrow">{{ stage.price }} 元</span> |
|||
<!-- <span class="arrow">></span> --> |
|||
</div> |
|||
</template> |
|||
|
|||
<el-form label-width="100px" style="margin-bottom: 10px"> |
|||
<el-form-item label="阶段名称"> |
|||
<el-input v-model="stage.name" placeholder="请输入阶段名称" /> |
|||
</el-form-item> |
|||
</el-form> |
|||
|
|||
<el-form label-width="100px" style="margin-bottom: 10px"> |
|||
<el-form-item label="阶段底薪"> |
|||
<el-input v-model="stage.price" placeholder="请输入阶段底薪" /> |
|||
</el-form-item> |
|||
</el-form> |
|||
|
|||
|
|||
|
|||
<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="请输入续费上限" /> |
|||
</template> |
|||
</el-table-column> |
|||
|
|||
<el-table-column prop="renewal_standard_max" label="续费下限"> |
|||
<template #default="{ row }"> |
|||
<el-input v-model="row.renewal_standard_max" placeholder="请输入续费下限" /> |
|||
</template> |
|||
</el-table-column> |
|||
|
|||
<el-table-column prop="renewal_commission" label="续费提成"> |
|||
<template #default="{ row }"> |
|||
<el-input v-model="row.renewal_commission" placeholder="%" /> |
|||
</template> |
|||
</el-table-column> |
|||
|
|||
<el-table-column prop="new_count_min" label="新单成交数上限"> |
|||
<template #default="{ row }"> |
|||
<el-input v-model="row.new_count_min" /> |
|||
</template> |
|||
</el-table-column> |
|||
|
|||
<el-table-column prop="new_count_max" label="新单成交数下限"> |
|||
<template #default="{ row }"> |
|||
<el-input v-model="row.new_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" /> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column prop="new_move_7" label="新招(7+1)x3"> |
|||
<template #default="{ row }"> |
|||
<el-input v-model="row.new_move_7" /> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column label="操作" width="100"> |
|||
<template #default="{ $index }"> |
|||
<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-collapse-item> |
|||
</el-collapse> |
|||
|
|||
<div style="text-align: right; margin-top: 20px;"> |
|||
<el-button type="primary" @click="onSave">提交保存</el-button> |
|||
</div> |
|||
</el-card> |
|||
</div> |
|||
</template> |
|||
|
|||
<script lang="ts" setup> |
|||
import { xsyjConfig, getXsyjConfig } from '@/app/api/sys' |
|||
import { reactive, ref } from 'vue' |
|||
import {ElMessage} from 'element-plus' |
|||
import { useRoute } from 'vue-router' |
|||
const route = useRoute() |
|||
const pageName = route.meta.title |
|||
|
|||
const loading = ref(true) |
|||
const stages = ref([]) |
|||
const activeNames = ref(null) |
|||
|
|||
function addStage() { |
|||
const newStage = { |
|||
name: '默认阶段', |
|||
price:0, |
|||
rules: [{ |
|||
renewal_standard_min: '', |
|||
renewal_standard_max: '', |
|||
renewal_commission: '', |
|||
new_count_min: '', |
|||
new_count_max: '', |
|||
new_move_5: '', |
|||
new_move_7: '' |
|||
}] |
|||
} |
|||
stages.value.push(newStage) |
|||
activeNames.value = newStage.name |
|||
} |
|||
|
|||
function removeStage(index) { |
|||
stages.value.splice(index, 1) |
|||
} |
|||
|
|||
function addRule(stage) { |
|||
stage.rules.push({ |
|||
renewal_standard_min: '', |
|||
renewal_standard_max: '', |
|||
renewal_commission: '', |
|||
new_count_min: '', |
|||
new_count_max: '', |
|||
new_move_5: '', |
|||
new_move_7: '' |
|||
}) |
|||
} |
|||
|
|||
function removeRule(stage, ruleIndex) { |
|||
if (stage.rules.length === 1) { |
|||
ElMessage.warning('至少保留一条规则') |
|||
return |
|||
} |
|||
stage.rules.splice(ruleIndex, 1) |
|||
} |
|||
|
|||
const setFormData = async () => { |
|||
const data = await (await getXsyjConfig()).data |
|||
stages.value = data |
|||
loading.value = false |
|||
} |
|||
|
|||
setFormData(); |
|||
|
|||
const onSave = async () => { |
|||
xsyjConfig(stages.value) |
|||
.then(() => { |
|||
loading.value = true |
|||
setFormData() |
|||
}) |
|||
.catch(() => { |
|||
loading.value = false |
|||
}) |
|||
} |
|||
</script> |
|||
|
|||
<style lang="scss" scoped> |
|||
.collapse-title { |
|||
display: flex; |
|||
align-items: center; |
|||
justify-content: space-between; |
|||
width: 100%; |
|||
font-size: 14px; |
|||
font-weight: 500; |
|||
padding-right: 10px; |
|||
color: #333; |
|||
padding: 10px; |
|||
} |
|||
|
|||
.title-name { |
|||
width: 230px; |
|||
} |
|||
|
|||
.title-salary { |
|||
width: 110px; |
|||
text-align: center; |
|||
color: #7438D5; |
|||
} |
|||
|
|||
.arrow { |
|||
margin-left: auto; |
|||
color: #999; |
|||
font-size: 14px; |
|||
} |
|||
|
|||
</style> |
|||
@ -0,0 +1,55 @@ |
|||
<?php |
|||
// +---------------------------------------------------------------------- |
|||
// | Niucloud-admin 企业快速开发的多应用管理平台 |
|||
// +---------------------------------------------------------------------- |
|||
// | 官方网址:https://www.niucloud.com |
|||
// +---------------------------------------------------------------------- |
|||
// | niucloud团队 版权所有 开源版本可自由商用 |
|||
// +---------------------------------------------------------------------- |
|||
// | Author: Niucloud Team |
|||
// +---------------------------------------------------------------------- |
|||
|
|||
namespace app\model\student; |
|||
|
|||
use core\base\BaseModel; |
|||
use think\model\concern\SoftDelete; |
|||
use think\model\relation\HasMany; |
|||
use think\model\relation\HasOne; |
|||
|
|||
|
|||
class Student extends BaseModel |
|||
{ |
|||
use SoftDelete; |
|||
|
|||
|
|||
/** |
|||
* 数据表主键 |
|||
* @var string |
|||
*/ |
|||
protected $pk = 'id'; |
|||
|
|||
/** |
|||
* 模型名称 |
|||
* @var string |
|||
*/ |
|||
protected $name = 'student'; |
|||
|
|||
|
|||
|
|||
/** |
|||
* 定义软删除标记字段 |
|||
* @var string |
|||
*/ |
|||
protected $deleteTime = 'deleted_at'; |
|||
|
|||
/** |
|||
* 定义软删除字段的默认值 |
|||
* @var int |
|||
*/ |
|||
protected $defaultSoftDelete = 0; |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
} |
|||
Loading…
Reference in new issue