6 changed files with 485 additions and 3 deletions
@ -0,0 +1,52 @@ |
|||
import request from '@/utils/request' |
|||
|
|||
// USER_CODE_BEGIN -- aaaaaaaaaaa
|
|||
/** |
|||
* 获取测试列表 |
|||
* @param params |
|||
* @returns |
|||
*/ |
|||
export function getAaaaaaaaaaaList(params: Record<string, any>) { |
|||
return request.get(`aaaaaaaaaaa/aaaaaaaaaaa`, {params}) |
|||
} |
|||
|
|||
/** |
|||
* 获取测试详情 |
|||
* @param id 测试id |
|||
* @returns |
|||
*/ |
|||
export function getAaaaaaaaaaaInfo(id: number) { |
|||
return request.get(`aaaaaaaaaaa/aaaaaaaaaaa/${id}`); |
|||
} |
|||
|
|||
/** |
|||
* 添加测试 |
|||
* @param params |
|||
* @returns |
|||
*/ |
|||
export function addAaaaaaaaaaa(params: Record<string, any>) { |
|||
return request.post('aaaaaaaaaaa/aaaaaaaaaaa', params, { showErrorMessage: true, showSuccessMessage: true }) |
|||
} |
|||
|
|||
/** |
|||
* 编辑测试 |
|||
* @param id |
|||
* @param params |
|||
* @returns |
|||
*/ |
|||
export function editAaaaaaaaaaa(params: Record<string, any>) { |
|||
return request.put(`aaaaaaaaaaa/aaaaaaaaaaa/${params.id}`, params, { showErrorMessage: true, showSuccessMessage: true }) |
|||
} |
|||
|
|||
/** |
|||
* 删除测试 |
|||
* @param id |
|||
* @returns |
|||
*/ |
|||
export function deleteAaaaaaaaaaa(id: number) { |
|||
return request.delete(`aaaaaaaaaaa/aaaaaaaaaaa/${id}`, { showErrorMessage: true, showSuccessMessage: true }) |
|||
} |
|||
|
|||
|
|||
|
|||
// USER_CODE_END -- aaaaaaaaaaa
|
|||
@ -0,0 +1,165 @@ |
|||
<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('addAaaaaaaaaaa') }} |
|||
</el-button> |
|||
</div> |
|||
|
|||
<el-card class="box-card !border-none my-[10px] table-search-wrap" shadow="never"> |
|||
<el-form :inline="true" :model="aaaaaaaaaaaTable.searchParam" ref="searchFormRef"> |
|||
|
|||
<el-form-item> |
|||
<el-button type="primary" @click="loadAaaaaaaaaaaList()">{{ 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="aaaaaaaaaaaTable.data" size="large" v-loading="aaaaaaaaaaaTable.loading"> |
|||
<template #empty> |
|||
<span>{{ !aaaaaaaaaaaTable.loading ? t('emptyData') : '' }}</span> |
|||
</template> |
|||
<el-table-column :label="t('url1')" width="100" align="left"> |
|||
<template #default="{ row }"> |
|||
<el-avatar v-if="row.url1" :src="img(row.url1)" /> |
|||
<el-avatar v-else icon="UserFilled" /> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column prop="url2" :label="t('url2')" min-width="120" :show-overflow-tooltip="true"/> |
|||
|
|||
<el-table-column prop="url3" :label="t('url3')" 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="aaaaaaaaaaaTable.page" v-model:page-size="aaaaaaaaaaaTable.limit" |
|||
layout="total, sizes, prev, pager, next, jumper" :total="aaaaaaaaaaaTable.total" |
|||
@size-change="loadAaaaaaaaaaaList()" @current-change="loadAaaaaaaaaaaList" /> |
|||
</div> |
|||
</div> |
|||
|
|||
<edit ref="editAaaaaaaaaaaDialog" @complete="loadAaaaaaaaaaaList" /> |
|||
</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 { getAaaaaaaaaaaList, deleteAaaaaaaaaaa } from '@/app/api/aaaaaaaaaaa' |
|||
import { img } from '@/utils/common' |
|||
import { ElMessageBox,FormInstance } from 'element-plus' |
|||
import Edit from '@/app/views/aaaaaaaaaaa/components/aaaaaaaaaaa-edit.vue' |
|||
import { useRoute } from 'vue-router' |
|||
const route = useRoute() |
|||
const pageName = route.meta.title; |
|||
|
|||
let aaaaaaaaaaaTable = reactive({ |
|||
page: 1, |
|||
limit: 10, |
|||
total: 0, |
|||
loading: true, |
|||
data: [], |
|||
searchParam:{ |
|||
|
|||
} |
|||
}) |
|||
|
|||
const searchFormRef = ref<FormInstance>() |
|||
|
|||
// 选中数据 |
|||
const selectData = ref<any[]>([]) |
|||
|
|||
// 字典数据 |
|||
|
|||
|
|||
/** |
|||
* 获取测试列表 |
|||
*/ |
|||
const loadAaaaaaaaaaaList = (page: number = 1) => { |
|||
aaaaaaaaaaaTable.loading = true |
|||
aaaaaaaaaaaTable.page = page |
|||
|
|||
getAaaaaaaaaaaList({ |
|||
page: aaaaaaaaaaaTable.page, |
|||
limit: aaaaaaaaaaaTable.limit, |
|||
...aaaaaaaaaaaTable.searchParam |
|||
}).then(res => { |
|||
aaaaaaaaaaaTable.loading = false |
|||
aaaaaaaaaaaTable.data = res.data.data |
|||
aaaaaaaaaaaTable.total = res.data.total |
|||
}).catch(() => { |
|||
aaaaaaaaaaaTable.loading = false |
|||
}) |
|||
} |
|||
loadAaaaaaaaaaaList() |
|||
|
|||
const editAaaaaaaaaaaDialog: Record<string, any> | null = ref(null) |
|||
|
|||
/** |
|||
* 添加测试 |
|||
*/ |
|||
const addEvent = () => { |
|||
editAaaaaaaaaaaDialog.value.setFormData() |
|||
editAaaaaaaaaaaDialog.value.showDialog = true |
|||
} |
|||
|
|||
/** |
|||
* 编辑测试 |
|||
* @param data |
|||
*/ |
|||
const editEvent = (data: any) => { |
|||
editAaaaaaaaaaaDialog.value.setFormData(data) |
|||
editAaaaaaaaaaaDialog.value.showDialog = true |
|||
} |
|||
|
|||
/** |
|||
* 删除测试 |
|||
*/ |
|||
const deleteEvent = (id: number) => { |
|||
ElMessageBox.confirm(t('aaaaaaaaaaaDeleteTips'), t('warning'), |
|||
{ |
|||
confirmButtonText: t('confirm'), |
|||
cancelButtonText: t('cancel'), |
|||
type: 'warning', |
|||
} |
|||
).then(() => { |
|||
deleteAaaaaaaaaaa(id).then(() => { |
|||
loadAaaaaaaaaaaList() |
|||
}).catch(() => { |
|||
}) |
|||
}) |
|||
} |
|||
|
|||
|
|||
|
|||
const resetForm = (formEl: FormInstance | undefined) => { |
|||
if (!formEl) return |
|||
formEl.resetFields() |
|||
loadAaaaaaaaaaaList() |
|||
} |
|||
</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,163 @@ |
|||
<template> |
|||
<el-dialog v-model="showDialog" :title="formData.id ? t('updateAaaaaaaaaaa') : t('addAaaaaaaaaaa')" 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('url1')"> |
|||
<upload-image v-model="formData.url1" /> |
|||
</el-form-item> |
|||
|
|||
<el-form-item :label="t('url2')"> |
|||
<upload-file v-model="formData.url2" /> |
|||
</el-form-item> |
|||
|
|||
<el-form-item :label="t('url3')"> |
|||
<upload-video v-model="formData.url3" /> |
|||
</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 { addAaaaaaaaaaa, editAaaaaaaaaaa, getAaaaaaaaaaaInfo } from '@/app/api/aaaaaaaaaaa' |
|||
|
|||
let showDialog = ref(false) |
|||
const loading = ref(false) |
|||
|
|||
/** |
|||
* 表单数据 |
|||
*/ |
|||
const initialFormData = { |
|||
id: '', |
|||
url1: '', |
|||
url2: '', |
|||
url3: '', |
|||
} |
|||
const formData: Record<string, any> = reactive({ ...initialFormData }) |
|||
|
|||
const formRef = ref<FormInstance>() |
|||
|
|||
// 表单验证规则 |
|||
const formRules = computed(() => { |
|||
return { |
|||
url1: [ |
|||
{ required: true, message: t('url1Placeholder'), trigger: 'blur' }, |
|||
|
|||
] |
|||
, |
|||
url2: [ |
|||
{ required: true, message: t('url2Placeholder'), trigger: 'blur' }, |
|||
|
|||
] |
|||
, |
|||
url3: [ |
|||
{ required: true, message: t('url3Placeholder'), trigger: 'blur' }, |
|||
|
|||
] |
|||
|
|||
} |
|||
}) |
|||
|
|||
const emit = defineEmits(['complete']) |
|||
|
|||
/** |
|||
* 确认 |
|||
* @param formEl |
|||
*/ |
|||
const confirm = async (formEl: FormInstance | undefined) => { |
|||
if (loading.value || !formEl) return |
|||
let save = formData.id ? editAaaaaaaaaaa : addAaaaaaaaaaa |
|||
|
|||
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 getAaaaaaaaaaaInfo(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,81 @@ |
|||
<?php |
|||
// +---------------------------------------------------------------------- |
|||
// | Niucloud-admin 企业快速开发的多应用管理平台 |
|||
// +---------------------------------------------------------------------- |
|||
// | 官方网址:https://www.niucloud.com |
|||
// +---------------------------------------------------------------------- |
|||
// | niucloud团队 版权所有 开源版本可自由商用 |
|||
// +---------------------------------------------------------------------- |
|||
// | Author: Niucloud Team |
|||
// +---------------------------------------------------------------------- |
|||
|
|||
namespace app\service\api\apiService; |
|||
|
|||
use app\model\campus_person_role\CampusPersonRole; |
|||
use app\model\departments\Departments; |
|||
use app\model\lesson_course_teaching\LessonCourseTeaching; |
|||
use app\model\member\Member; |
|||
use app\model\personnel\Personnel; |
|||
use app\model\sys\SysRole; |
|||
use app\service\core\member\CoreMemberService; |
|||
use core\base\BaseApiService; |
|||
use core\exception\ApiException; |
|||
use core\util\Barcode; |
|||
use think\Model; |
|||
use think\facade\Db; |
|||
|
|||
/** |
|||
* 员工服务层 |
|||
* Class MemberService |
|||
* @package app\service\api\member |
|||
*/ |
|||
class TeachingResearchService extends BaseApiService |
|||
{ |
|||
public function __construct() |
|||
{ |
|||
parent::__construct(); |
|||
$this->model = new Personnel(); |
|||
} |
|||
|
|||
//获取教研管理文章列表 |
|||
public function list($id,$table_type){ |
|||
$field = 'id,title,image,type,content,status,create_time,update_time,delete_time,table_type,user_permission,url'; |
|||
$order = 'id desc'; |
|||
$LessonCourseTeaching = new LessonCourseTeaching(); |
|||
$where = []; |
|||
if ($table_type) { |
|||
$where[] = ['table_type','=',$table_type]; |
|||
} |
|||
if ($id !== null && $id !== '') { |
|||
$where[] = [Db::raw("FIND_IN_SET($id, user_permission)"), '>', 0]; |
|||
} |
|||
$search_model = $LessonCourseTeaching->where($where)->field($field)->order($order); |
|||
$list = $this->pageQuery($search_model); |
|||
return $list; |
|||
} |
|||
|
|||
//获取教研管理文章详情 |
|||
public function info($id){ |
|||
$field = 'id,title,image,type,content,status,create_time,update_time,delete_time,table_type,user_permission,url'; |
|||
$LessonCourseTeaching = new LessonCourseTeaching(); |
|||
$info = $LessonCourseTeaching->field($field)->where([['id', "=", $id]])->findOrEmpty()->toArray(); |
|||
if (is_array($info) && isset($info['type']) && $info['type'] == 2 && !empty($info['url']) && is_string($info['url'])) { |
|||
$protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? "https://" : "http://"; |
|||
$domain = $_SERVER['HTTP_HOST'] ?? $_SERVER['SERVER_NAME'] ?? 'localhost'; |
|||
$info['url'] = $protocol . $domain . '/' . $info['url']; |
|||
} |
|||
|
|||
return $info; |
|||
} |
|||
|
|||
//获取能看的教研管理类型 |
|||
public function lookType($id){ |
|||
$LessonCourseTeaching = new LessonCourseTeaching(); |
|||
$where = []; |
|||
if ($id !== null && $id !== '') { |
|||
$where[] = [Db::raw("FIND_IN_SET($id, user_permission)"), '>', 0]; |
|||
} |
|||
$list = $LessonCourseTeaching->where($where)->distinct(true)->column('table_type'); |
|||
return $list; |
|||
} |
|||
} |
|||
Loading…
Reference in new issue