forked from wangjiadong/comp
Merge branch 'main' of http://182.92.169.222:3000/zhc077/hnjd_comp
commit
fe81d16f11
29 changed files with 1805 additions and 149 deletions
@ -0,0 +1,135 @@ |
||||
package org.jeecg.modules.demo.expert.entity; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.*; |
||||
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
import com.fasterxml.jackson.annotation.JsonProperty; |
||||
import io.swagger.annotations.ApiModel; |
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
import lombok.EqualsAndHashCode; |
||||
import lombok.experimental.Accessors; |
||||
import org.jeecg.common.aspect.annotation.Dict; |
||||
import org.jeecgframework.poi.excel.annotation.Excel; |
||||
import org.springframework.format.annotation.DateTimeFormat; |
||||
|
||||
import java.io.Serializable; |
||||
import java.util.Date; |
||||
|
||||
/** |
||||
* @Description: 专家表导出、导入表 |
||||
* @Author: jeecg-boot |
||||
* @Date: 2023-10-11 |
||||
* @Version: V1.0 |
||||
*/ |
||||
@Data |
||||
@Accessors(chain = true) |
||||
@EqualsAndHashCode(callSuper = false) |
||||
@ApiModel(value="expert对象", description="专家表") |
||||
public class UserExpertExcel implements Serializable { |
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
|
||||
/** |
||||
* 登录账号 |
||||
*/ |
||||
@Excel(name = "登录账号(必填且唯一)", width = 15) |
||||
private String username; |
||||
|
||||
|
||||
/** |
||||
* 工号,唯一键 |
||||
*/ |
||||
@Excel(name = "工号(唯一)", width = 15) |
||||
private String workNo; |
||||
|
||||
/** |
||||
* 真实姓名 |
||||
*/ |
||||
@Excel(name = "真实姓名(必填)", width = 15) |
||||
private String realname; |
||||
|
||||
|
||||
/** |
||||
* 生日 |
||||
*/ |
||||
@Excel(name = "生日(yyyy-MM-dd)", width = 15, format = "yyyy-MM-dd") |
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd") |
||||
@DateTimeFormat(pattern = "yyyy-MM-dd") |
||||
private Date birthday; |
||||
|
||||
/** |
||||
* 性别(1:男 2:女) |
||||
*/ |
||||
@Excel(name = "性别(1:男 2:女)", width = 15,dicCode="sex") |
||||
@Dict(dicCode = "sex") |
||||
private Integer sex; |
||||
|
||||
/** |
||||
* 电子邮件 |
||||
*/ |
||||
@Excel(name = "电子邮件(唯一)", width = 15) |
||||
private String email; |
||||
|
||||
/** |
||||
* 电话 |
||||
*/ |
||||
@Excel(name = "电话(唯一)", width = 15) |
||||
private String phone; |
||||
|
||||
/** |
||||
* 负责部门 |
||||
*/ |
||||
@Excel(name="院系",width = 15,dictTable ="sys_depart",dicText = "depart_name",dicCode = "id") |
||||
@Dict(dictTable ="sys_depart",dicText = "depart_name",dicCode = "id") |
||||
private String departIds; |
||||
|
||||
|
||||
/**专家名称*/ |
||||
@Excel(name = "专家名称", width = 15) |
||||
@ApiModelProperty(value = "专家名称") |
||||
private String name; |
||||
|
||||
|
||||
/**专家学历*/ |
||||
@Excel(name = "专家学历", width = 15) |
||||
@ApiModelProperty(value = "专家学历") |
||||
private String expTitle; |
||||
|
||||
/**学位*/ |
||||
@Excel(name = "学位", width = 15) |
||||
@ApiModelProperty(value = "学位") |
||||
private String expXw; |
||||
|
||||
/**职称*/ |
||||
@Excel(name = "职称", width = 15) |
||||
@ApiModelProperty(value = "职称") |
||||
private String expZc; |
||||
|
||||
/**研究方向*/ |
||||
@Excel(name = "研究方向", width = 15) |
||||
@ApiModelProperty(value = "研究方向") |
||||
private String expYjfx; |
||||
|
||||
/**从事工作*/ |
||||
@Excel(name = "从事工作", width = 15) |
||||
@ApiModelProperty(value = "从事工作") |
||||
private String expCsgz; |
||||
|
||||
/**专家毕业院校*/ |
||||
@Excel(name = "专家毕业院校", width = 15) |
||||
@ApiModelProperty(value = "专家毕业院校") |
||||
private String expSc; |
||||
|
||||
/**简介*/ |
||||
@Excel(name = "简介", width = 15) |
||||
@ApiModelProperty(value = "简介") |
||||
private String expResume; |
||||
|
||||
|
||||
/** |
||||
* 状态(1:正常 2:冻结 ) |
||||
*/ |
||||
@Excel(name = "状态(1:正常 2:冻结 )", width = 15,dicCode="user_status") |
||||
@Dict(dicCode = "user_status") |
||||
private Integer status; |
||||
} |
@ -0,0 +1,260 @@ |
||||
<template> |
||||
<div class="clearfix"> |
||||
<a-upload |
||||
:listType="listType" |
||||
accept="image/*" |
||||
:multiple="multiple" |
||||
:action="uploadUrlzs" |
||||
:headers="headers" |
||||
:data="{ biz: bizPath }" |
||||
v-model:fileList="uploadFileList" |
||||
:beforeUpload="beforeUpload" |
||||
:disabled="disabled" |
||||
@change="handleChange" |
||||
@preview="handlePreview" |
||||
> |
||||
<div v-if="uploadVisible"> |
||||
<div v-if="listType == 'picture-card'"> |
||||
<LoadingOutlined v-if="loading" /> |
||||
<UploadOutlined v-else /> |
||||
<div class="ant-upload-text">{{ text }}</div> |
||||
</div> |
||||
<a-button v-if="listType == 'picture'" :disabled="disabled"> |
||||
<UploadOutlined></UploadOutlined> |
||||
{{ text }} |
||||
</a-button> |
||||
</div> |
||||
</a-upload> |
||||
<a-modal :visible="previewVisible" :footer="null" @cancel="handleCancel()"> |
||||
<img alt="example" style="width: 100%" :src="previewImage" /> |
||||
</a-modal> |
||||
</div> |
||||
</template> |
||||
<script lang="ts"> |
||||
import { defineComponent, PropType, ref, reactive, watchEffect, computed, unref, watch, onMounted } from 'vue'; |
||||
import { LoadingOutlined, UploadOutlined } from '@ant-design/icons-vue'; |
||||
import { useRuleFormItem } from '/@/hooks/component/useFormItem'; |
||||
import { propTypes } from '/@/utils/propTypes'; |
||||
import { useAttrs } from '/@/hooks/core/useAttrs'; |
||||
import { useMessage } from '/@/hooks/web/useMessage'; |
||||
import { getFileAccessHttpUrlzs, getRandom } from '/@/utils/common/compUtils'; |
||||
import { uploadUrlzs } from '/@/api/common/api'; |
||||
import { getToken } from '/@/utils/auth'; |
||||
|
||||
const { createMessage, createErrorModal } = useMessage(); |
||||
export default defineComponent({ |
||||
name: 'JImageUpload', |
||||
components: { LoadingOutlined, UploadOutlined }, |
||||
inheritAttrs: false, |
||||
props: { |
||||
//绑定值 |
||||
value: propTypes.oneOfType([propTypes.string, propTypes.array]), |
||||
//按钮文本 |
||||
listType: { |
||||
type: String, |
||||
required: false, |
||||
default: 'picture-card', |
||||
}, |
||||
//按钮文本 |
||||
text: { |
||||
type: String, |
||||
required: false, |
||||
default: '上传', |
||||
}, |
||||
//这个属性用于控制文件上传的业务路径 |
||||
bizPath: { |
||||
type: String, |
||||
required: false, |
||||
default: 'temp', |
||||
}, |
||||
//是否禁用 |
||||
disabled: { |
||||
type: Boolean, |
||||
required: false, |
||||
default: false, |
||||
}, |
||||
//上传数量 |
||||
fileMax: { |
||||
type: Number, |
||||
required: false, |
||||
default: 1, |
||||
}, |
||||
}, |
||||
emits: ['options-change', 'change', 'update:value'], |
||||
setup(props, { emit, refs }) { |
||||
const emitData = ref<any[]>([]); |
||||
const attrs = useAttrs(); |
||||
const [state] = useRuleFormItem(props, 'value', 'change', emitData); |
||||
//获取文件名 |
||||
const getFileName = (path) => { |
||||
if (path.lastIndexOf('\\') >= 0) { |
||||
let reg = new RegExp('\\\\', 'g'); |
||||
path = path.replace(reg, '/'); |
||||
} |
||||
return path.substring(path.lastIndexOf('/') + 1); |
||||
}; |
||||
//token |
||||
const headers = ref<object>({ |
||||
'X-Access-Token': getToken(), |
||||
}); |
||||
//上传状态 |
||||
const loading = ref<boolean>(false); |
||||
//是否是初始化加载 |
||||
const initTag = ref<boolean>(true); |
||||
//文件列表 |
||||
let uploadFileList = ref<any[]>([]); |
||||
//预览图 |
||||
const previewImage = ref<string | undefined>(''); |
||||
//预览框状态 |
||||
const previewVisible = ref<boolean>(false); |
||||
|
||||
//计算是否开启多图上传 |
||||
const multiple = computed(() => { |
||||
return props['fileMax'] > 1; |
||||
}); |
||||
|
||||
//计算是否可以继续上传 |
||||
const uploadVisible = computed(() => { |
||||
return uploadFileList.value.length < props['fileMax']; |
||||
}); |
||||
|
||||
/** |
||||
* 监听value变化 |
||||
*/ |
||||
watch( |
||||
() => props.value, |
||||
(val, prevCount) => { |
||||
//update-begin---author:liusq ---date:20230601 for:【issues/556】JImageUpload组件value赋初始值没显示图片------------ |
||||
if (val && val instanceof Array) { |
||||
val = val.join(','); |
||||
} |
||||
if (initTag.value == true) { |
||||
initFileList(val); |
||||
} |
||||
}, |
||||
{ immediate: true } |
||||
//update-end---author:liusq ---date:20230601 for:【issues/556】JImageUpload组件value赋初始值没显示图片------------ |
||||
); |
||||
|
||||
/** |
||||
* 初始化文件列表 |
||||
*/ |
||||
function initFileList(paths) { |
||||
if (!paths || paths.length == 0) { |
||||
uploadFileList.value = []; |
||||
return; |
||||
} |
||||
let files = []; |
||||
let arr = paths.split(','); |
||||
arr.forEach((value) => { |
||||
let url = getFileAccessHttpUrlzs(value); |
||||
files.push({ |
||||
uid: getRandom(10), |
||||
name: getFileName(value), |
||||
status: 'done', |
||||
url: url, |
||||
response: { |
||||
status: 'history', |
||||
message: value, |
||||
}, |
||||
}); |
||||
}); |
||||
uploadFileList.value = files; |
||||
} |
||||
|
||||
/** |
||||
* 上传前校验 |
||||
*/ |
||||
function beforeUpload(file) { |
||||
let fileType = file.type; |
||||
if (fileType.indexOf('image') < 0) { |
||||
createMessage.info('请上传图片'); |
||||
return false; |
||||
} |
||||
} |
||||
/** |
||||
* 文件上传结果回调 |
||||
*/ |
||||
function handleChange({ file, fileList, event }) { |
||||
initTag.value = false; |
||||
uploadFileList.value = fileList; |
||||
if (file.status === 'error') { |
||||
createMessage.error(`${file.name} 上传失败.`); |
||||
} |
||||
let fileUrls = []; |
||||
//上传完成 |
||||
if (file.status != 'uploading') { |
||||
fileList.forEach((file) => { |
||||
if (file.status === 'done') { |
||||
//update-begin---author:wangshuai ---date:20221121 for:[issues/248]原生表单内使用图片组件,关闭弹窗图片组件值不会被清空------------ |
||||
initTag.value = true; |
||||
//update-end---author:wangshuai ---date:20221121 for:[issues/248]原生表单内使用图片组件,关闭弹窗图片组件值不会被清空------------ |
||||
fileUrls.push(file.response.message); |
||||
} |
||||
}); |
||||
if (file.status === 'removed') { |
||||
handleDelete(file); |
||||
} |
||||
} |
||||
// emitData.value = fileUrls.join(','); |
||||
state.value = fileUrls.join(','); |
||||
emit('update:value', fileUrls.join(',')); |
||||
} |
||||
|
||||
/** |
||||
* 删除图片 |
||||
*/ |
||||
function handleDelete(file) { |
||||
//如有需要新增 删除逻辑 |
||||
console.log(file); |
||||
} |
||||
|
||||
/** |
||||
* 预览图片 |
||||
*/ |
||||
function handlePreview(file) { |
||||
previewImage.value = file.url || file.thumbUrl; |
||||
previewVisible.value = true; |
||||
} |
||||
|
||||
function getAvatarView() { |
||||
if (uploadFileList.length > 0) { |
||||
let url = uploadFileList[0].url; |
||||
return getFileAccessHttpUrlzs(url, null); |
||||
} |
||||
} |
||||
|
||||
function handleCancel() { |
||||
previewVisible.value = false; |
||||
} |
||||
|
||||
return { |
||||
state, |
||||
attrs, |
||||
previewImage, |
||||
previewVisible, |
||||
uploadFileList, |
||||
multiple, |
||||
headers, |
||||
loading, |
||||
uploadUrlzs, |
||||
beforeUpload, |
||||
uploadVisible, |
||||
handlePreview, |
||||
handleCancel, |
||||
handleChange, |
||||
}; |
||||
}, |
||||
}); |
||||
</script> |
||||
<style scoped> |
||||
.ant-upload-select-picture-card i { |
||||
font-size: 32px; |
||||
color: #999; |
||||
} |
||||
|
||||
.ant-upload-select-picture-card .ant-upload-text { |
||||
margin-top: 8px; |
||||
color: #666; |
||||
} |
||||
</style> |
@ -0,0 +1,284 @@ |
||||
<template> |
||||
<div> |
||||
<!--查询区域--> |
||||
<div class="jeecg-basic-table-form-container"> |
||||
<a-form ref="formRef" @keyup.enter.native="searchQuery" :model="queryParam" :label-col="labelCol" :wrapper-col="wrapperCol"> |
||||
<a-row :gutter="24"> |
||||
<a-col :lg="8"> |
||||
<a-form-item label="年度" name="annualid"> |
||||
<j-dict-select-tag placeholder="请选择年度" v-model:value="queryParam.annualid" dictCode="annual,annual_name,id"/> |
||||
</a-form-item> |
||||
</a-col> |
||||
<a-col :lg="8"> |
||||
<a-form-item label="报名编号" name="enrollCode"> |
||||
<a-input placeholder="请输入报名编号" v-model:value="queryParam.enrollCode"></a-input> |
||||
</a-form-item> |
||||
</a-col> |
||||
<a-col :xl="6" :lg="7" :md="8" :sm="24"> |
||||
<span style="float: left; overflow: hidden" class="table-page-search-submitButtons"> |
||||
<a-col :lg="6"> |
||||
<a-button type="primary" preIcon="ant-design:search-outlined" @click="searchQuery">查询</a-button> |
||||
<a-button type="primary" preIcon="ant-design:reload-outlined" @click="searchReset" style="margin-left: 8px">重置</a-button> |
||||
<a @click="toggleSearchStatus = !toggleSearchStatus" style="margin-left: 8px"> |
||||
{{ toggleSearchStatus ? '收起' : '展开' }} |
||||
<Icon :icon="toggleSearchStatus ? 'ant-design:up-outlined' : 'ant-design:down-outlined'" /> |
||||
</a> |
||||
</a-col> |
||||
</span> |
||||
</a-col> |
||||
</a-row> |
||||
</a-form> |
||||
</div> |
||||
<!--引用表格--> |
||||
<BasicTable @register="registerTable" :rowSelection="rowSelection"> |
||||
<!--插槽:table标题--> |
||||
<template #tableTitle> |
||||
<a-dropdown v-if="selectedRowKeys.length > 0"> |
||||
<template #overlay> |
||||
<a-menu> |
||||
<a-menu-item key="1" @click="batchHandleDelete"> |
||||
<Icon icon="ant-design:delete-outlined"></Icon> |
||||
删除 |
||||
</a-menu-item> |
||||
</a-menu> |
||||
</template> |
||||
<a-button>批量操作 |
||||
<Icon icon="mdi:chevron-down"></Icon> |
||||
</a-button> |
||||
</a-dropdown> |
||||
</template> |
||||
<!--操作栏--> |
||||
<template #action="{ record }"> |
||||
<TableAction :actions="getTableAction(record)"/> |
||||
</template> |
||||
<!--字段回显插槽--> |
||||
<template #htmlSlot="{text}"> |
||||
<div v-html="text"></div> |
||||
</template> |
||||
<!--省市区字段回显插槽--> |
||||
<template #pcaSlot="{text}"> |
||||
{{ getAreaTextByCode(text) }} |
||||
</template> |
||||
<template #fileSlot="{text}"> |
||||
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span> |
||||
<a-button v-else :ghost="true" type="primary" preIcon="ant-design:download-outlined" size="small" @click="downloadFile(text)">下载</a-button> |
||||
</template> |
||||
</BasicTable> |
||||
<!-- 表单区域 --> |
||||
<AwardPersionModal ref="registerModal" @success="handleSuccess"></AwardPersionModal> |
||||
<AwardPersionModal1 ref="registerModal1" @success="handleSuccess"></AwardPersionModal1> |
||||
<AwardPersionModal2 ref="registerModal2" @success="handleSuccess"></AwardPersionModal2> |
||||
</div> |
||||
</template> |
||||
|
||||
<script lang="ts" name="awardpersion-awardPersion" setup> |
||||
import { ref, reactive } from 'vue'; |
||||
import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
||||
import { useListPage } from '/@/hooks/system/useListPage'; |
||||
import { columns } from './AwardPersion.data'; |
||||
import { |
||||
list, |
||||
deleteOne, |
||||
batchDelete, |
||||
getImportUrl, |
||||
getExportUrl, |
||||
getExportUrlMb, |
||||
// personalAbilityEvaluation |
||||
} from './AwardPersion.api'; |
||||
import { downloadFile } from '/@/utils/common/renderUtils'; |
||||
import AwardPersionModal from './components/AwardPersionModal.vue' |
||||
import AwardPersionModal1 from './components/AwardPersionModal1.vue' |
||||
import AwardPersionModal2 from './components/AwardPersionModal2.vue' |
||||
import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue'; |
||||
import JSearchSelect from '/@/components/Form/src/jeecg/components/JSearchSelect.vue'; |
||||
import {collectScore} from "/@/views/annualCompPoint/committee/AnnualCompPoint.api"; |
||||
|
||||
const formRef = ref(); |
||||
const queryParam = reactive<any>({}); |
||||
const toggleSearchStatus = ref<boolean>(false); |
||||
const registerModal = ref(); |
||||
const registerModal1 = ref(); |
||||
const registerModal2 = ref(); |
||||
//注册table数据 |
||||
const { prefixCls, tableContext, onExportXls, onImportXls,onExportXlsMb } = useListPage({ |
||||
tableProps: { |
||||
title: '获奖管理', |
||||
api: list, |
||||
columns, |
||||
canResize:false, |
||||
useSearchForm: false, |
||||
actionColumn: { |
||||
width: 230, |
||||
fixed: 'right', |
||||
}, |
||||
beforeFetch: (params) => { |
||||
return Object.assign(params, queryParam); |
||||
}, |
||||
}, |
||||
exportConfig: { |
||||
name: "获奖管理", |
||||
url: getExportUrl, |
||||
params: queryParam, |
||||
}, |
||||
exportConfigMb: { |
||||
name: "获奖管理", |
||||
url: getExportUrlMb, |
||||
params: null, |
||||
}, |
||||
importConfig: { |
||||
url: getImportUrl, |
||||
success: handleSuccess |
||||
}, |
||||
}); |
||||
const [registerTable, { reload, collapseAll, updateTableDataRecord, findTableDataRecord, getDataSource }, { rowSelection, selectedRowKeys }] = tableContext; |
||||
const labelCol = reactive({ |
||||
xs: { span: 24 }, |
||||
sm: { span: 7 }, |
||||
}); |
||||
const wrapperCol = reactive({ |
||||
xs: { span: 24 }, |
||||
sm: { span: 16 }, |
||||
}); |
||||
|
||||
/** |
||||
* 新增事件 |
||||
*/ |
||||
function handleAdd() { |
||||
registerModal.value.disableSubmit = false; |
||||
registerModal.value.add(); |
||||
} |
||||
|
||||
/** |
||||
* 重新获取事件 |
||||
*/ |
||||
function cxhq() { |
||||
registerModal1.value.disableSubmit = false; |
||||
registerModal1.value.add(); |
||||
} |
||||
|
||||
/** |
||||
* 编辑事件 |
||||
*/ |
||||
function handleEdit(record: Recordable) { |
||||
registerModal.value.disableSubmit = false; |
||||
registerModal.value.edit(record); |
||||
} |
||||
|
||||
/** |
||||
* 详情 |
||||
*/ |
||||
function handleDetail(record: Recordable) { |
||||
registerModal.value.disableSubmit = true; |
||||
registerModal.value.edit(record); |
||||
} |
||||
|
||||
/** |
||||
* 删除事件 |
||||
*/ |
||||
async function handleDelete(record) { |
||||
await deleteOne({ id: record.id }, handleSuccess); |
||||
} |
||||
|
||||
/** |
||||
* 上传证书事件 |
||||
*/ |
||||
async function sczs(record) { |
||||
registerModal2.value.disableSubmit = false; |
||||
registerModal2.value.add(record); |
||||
} |
||||
|
||||
/** |
||||
* 批量删除事件 |
||||
*/ |
||||
async function batchHandleDelete() { |
||||
await batchDelete({ ids: selectedRowKeys.value }, handleSuccess); |
||||
} |
||||
|
||||
/** |
||||
* 成功回调 |
||||
*/ |
||||
function handleSuccess() { |
||||
(selectedRowKeys.value = []) && reload(); |
||||
} |
||||
|
||||
// /** |
||||
// * 个人能力量化 |
||||
// */ |
||||
// function handlePersonalAbilityEvaluation(record: Recordable) { |
||||
// personalAbilityEvaluation({annualCompP: record.annualCompP, enrollCode: record.enrollCode}, handleSuccess); |
||||
// } |
||||
|
||||
/** |
||||
* 操作栏 |
||||
*/ |
||||
function getTableAction(record) { |
||||
const actions = []; |
||||
actions.unshift({ |
||||
label: '上传证书', |
||||
onClick: sczs.bind(null, record), |
||||
}); |
||||
actions.unshift({ |
||||
label: '详情', |
||||
onClick: handleDetail.bind(null, record), |
||||
}); |
||||
return actions; |
||||
} |
||||
|
||||
/** |
||||
* 下拉操作栏 |
||||
*/ |
||||
function getDropDownAction(record) { |
||||
return [ |
||||
{ |
||||
label: '详情', |
||||
onClick: handleDetail.bind(null, record), |
||||
}, { |
||||
label: '删除', |
||||
popConfirm: { |
||||
title: '是否确认删除', |
||||
confirm: handleDelete.bind(null, record), |
||||
} |
||||
}, |
||||
] |
||||
} |
||||
|
||||
/** |
||||
* 查询 |
||||
*/ |
||||
function searchQuery() { |
||||
reload(); |
||||
} |
||||
|
||||
/** |
||||
* 重置 |
||||
*/ |
||||
function searchReset() { |
||||
formRef.value.resetFields(); |
||||
selectedRowKeys.value = []; |
||||
//刷新数据 |
||||
reload(); |
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
</script> |
||||
|
||||
<style lang="less" scoped> |
||||
.jeecg-basic-table-form-container { |
||||
.table-page-search-submitButtons { |
||||
display: block; |
||||
margin-bottom: 24px; |
||||
white-space: nowrap; |
||||
} |
||||
.query-group-cust{ |
||||
width: calc(50% - 15px); |
||||
min-width: 100px !important; |
||||
} |
||||
.query-group-split-cust{ |
||||
width: 30px; |
||||
display: inline-block; |
||||
text-align: center |
||||
} |
||||
} |
||||
</style> |
@ -0,0 +1,148 @@ |
||||
<template> |
||||
<a-spin :spinning="confirmLoading"> |
||||
<a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol"> |
||||
<a-row> |
||||
<a-col :span="12"> |
||||
<a-form-item label="上传证书" v-bind="validateInfos.sczs" :label-col="{ span: 10, offset: 1 }"> |
||||
<j-image-upload v-model:value="formData.sczs" :disabled="disabled" /> |
||||
</a-form-item> |
||||
</a-col> |
||||
<!-- <a-col :span="24"> |
||||
<a-form-item label="状态" v-bind="validateInfos.status"> |
||||
<j-dict-select-tag v-model:value="formData.status" dictCode="sh_status" placeholder="请选择状态" :disabled="disabled"/> |
||||
</a-form-item> |
||||
</a-col>--> |
||||
<!-- <a-col :span="24"> |
||||
<a-form-item label="奖项" v-bind="validateInfos.awardid"> |
||||
<a-input v-model:value="formData.awardid" placeholder="请输入奖项" :disabled="disabled"></a-input> |
||||
</a-form-item> |
||||
</a-col>--> |
||||
</a-row> |
||||
</a-form> |
||||
</a-spin> |
||||
</template> |
||||
|
||||
<script lang="ts" setup> |
||||
import { ref, reactive, defineExpose, nextTick, defineProps, computed, onMounted,watch } from 'vue'; |
||||
import { defHttp } from '/@/utils/http/axios'; |
||||
import { useMessage } from '/@/hooks/web/useMessage'; |
||||
import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue'; |
||||
import JSearchSelect from '/@/components/Form/src/jeecg/components/JSearchSelect.vue'; |
||||
import { getValueType } from '/@/utils'; |
||||
import { sczs,queryCompId } from '../AwardPersion.api'; |
||||
import { Form } from 'ant-design-vue'; |
||||
import { duplicateValidate } from '/@/utils/helper/validator' |
||||
import JImageUpload from '/@/components/Form/src/jeecg/components/JImageUploadzs.vue'; |
||||
|
||||
let strst = ref(); |
||||
let ndbsxm = ref(); |
||||
let options= ref(); |
||||
const props = defineProps({ |
||||
formDisabled: { type: Boolean, default: false }, |
||||
formData: { type: Object, default: ()=>{} }, |
||||
formBpm: { type: Boolean, default: true } |
||||
}); |
||||
const formRef = ref(); |
||||
const useForm = Form.useForm; |
||||
const emit = defineEmits(['register', 'ok']); |
||||
const formData = reactive<Record<string, any>>({ |
||||
id: '', |
||||
sczs: '', |
||||
}); |
||||
const { createMessage } = useMessage(); |
||||
const labelCol = ref<any>({ xs: { span: 24 }, sm: { span: 5 } }); |
||||
const wrapperCol = ref<any>({ xs: { span: 24 }, sm: { span: 16 } }); |
||||
const confirmLoading = ref<boolean>(false); |
||||
//表单验证 |
||||
const validatorRules = { |
||||
sczs: [{ required: true, message: '请上传证书!' }], |
||||
}; |
||||
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: true }); |
||||
|
||||
// 表单禁用 |
||||
const disabled = computed(()=>{ |
||||
if(props.formBpm === true){ |
||||
if(props.formData.disabled === false){ |
||||
return false; |
||||
}else{ |
||||
return true; |
||||
} |
||||
} |
||||
return props.formDisabled; |
||||
}); |
||||
|
||||
/** |
||||
* 新增 |
||||
*/ |
||||
function add(record) { |
||||
edit(record); |
||||
} |
||||
|
||||
/** |
||||
* 编辑 |
||||
*/ |
||||
function edit(record) { |
||||
nextTick(() => { |
||||
resetFields(); |
||||
//赋值 |
||||
Object.assign(formData, record); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 提交数据 |
||||
*/ |
||||
async function submitForm() { |
||||
// 触发表单验证 |
||||
await validate(); |
||||
confirmLoading.value = true; |
||||
const isUpdate = ref<boolean>(false); |
||||
//时间格式化 |
||||
let model = formData; |
||||
/* let awardsort = model.awardname; |
||||
let awardname = model.awardsort; |
||||
model.awardname = awardname; |
||||
model.awardsort = awardsort;*/ |
||||
if (model.id) { |
||||
isUpdate.value = true; |
||||
} |
||||
//循环数据 |
||||
for (let data in model) { |
||||
//如果该数据是数组并且是字符串类型 |
||||
if (model[data] instanceof Array) { |
||||
let valueType = getValueType(formRef.value.getProps, data); |
||||
//如果是字符串类型的需要变成以逗号分割的字符串 |
||||
if (valueType === 'string') { |
||||
model[data] = model[data].join(','); |
||||
} |
||||
} |
||||
} |
||||
await sczs(model, isUpdate.value) |
||||
.then((res) => { |
||||
if (res.success) { |
||||
createMessage.success(res.message); |
||||
emit('ok'); |
||||
} else { |
||||
createMessage.warning(res.message); |
||||
} |
||||
}) |
||||
.finally(() => { |
||||
confirmLoading.value = false; |
||||
}); |
||||
} |
||||
|
||||
|
||||
defineExpose({ |
||||
add, |
||||
edit, |
||||
submitForm, |
||||
}); |
||||
</script> |
||||
|
||||
<style lang="less" scoped> |
||||
.antd-modal-form { |
||||
min-height: 500px !important; |
||||
overflow-y: auto; |
||||
padding: 24px 24px 24px 24px; |
||||
} |
||||
</style> |
@ -0,0 +1,75 @@ |
||||
<template> |
||||
<a-modal :title="title" :width="width" :visible="visible" @ok="handleOk" :okButtonProps="{ class: { 'jee-hidden': disableSubmit } }" @cancel="handleCancel" cancelText="关闭"> |
||||
<AwardPersionForm2 ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit" :formBpm="false"></AwardPersionForm2> |
||||
</a-modal> |
||||
</template> |
||||
|
||||
<script lang="ts" setup> |
||||
import { ref, nextTick, defineExpose } from 'vue'; |
||||
import AwardPersionForm2 from './AwardPersionForm2.vue' |
||||
|
||||
const title = ref<string>(''); |
||||
const width = ref<number>(400); |
||||
const visible = ref<boolean>(false); |
||||
const disableSubmit = ref<boolean>(false); |
||||
const registerForm = ref(); |
||||
const emit = defineEmits(['register', 'success']); |
||||
|
||||
/** |
||||
* 新增 |
||||
*/ |
||||
function add(record) { |
||||
title.value = '上传证书'; |
||||
visible.value = true; |
||||
nextTick(() => { |
||||
registerForm.value.add(record); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 编辑 |
||||
* @param record |
||||
*/ |
||||
function edit(record) { |
||||
title.value = disableSubmit.value ? '详情' : '编辑'; |
||||
visible.value = true; |
||||
nextTick(() => { |
||||
registerForm.value.edit(record); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 确定按钮点击事件 |
||||
*/ |
||||
function handleOk() { |
||||
registerForm.value.submitForm(); |
||||
} |
||||
|
||||
/** |
||||
* form保存回调事件 |
||||
*/ |
||||
function submitCallback() { |
||||
handleCancel(); |
||||
emit('success'); |
||||
} |
||||
|
||||
/** |
||||
* 取消按钮回调事件 |
||||
*/ |
||||
function handleCancel() { |
||||
visible.value = false; |
||||
} |
||||
|
||||
defineExpose({ |
||||
add, |
||||
edit, |
||||
disableSubmit, |
||||
}); |
||||
</script> |
||||
|
||||
<style> |
||||
/**隐藏样式-modal确定按钮 */ |
||||
.jee-hidden { |
||||
display: none !important; |
||||
} |
||||
</style> |
Loading…
Reference in new issue