Browse Source

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	src/views/system/jobinfo/index.vue
master
DX 2 weeks ago
parent
commit
43549e89d4
  1. 2
      src/api/system/jobinfo/index.ts
  2. 6
      src/components/Dialog/src/Dialog.vue
  3. 2
      src/components/Editor/src/Editor.vue
  4. 14
      src/utils/formatTime.ts
  5. 109
      src/views/system/jobinfo/JobInfoForm.vue

2
src/api/system/jobinfo/index.ts

@ -37,7 +37,7 @@ export const JobInfoApi = {
},
// 删除工作汇报
deleteJobInfo: async (id: number) => {
deleteJobInfo: async (id) => {
return await request.delete({ url: `/system/job-info/delete?id=` + id })
},

6
src/components/Dialog/src/Dialog.vue

@ -68,12 +68,12 @@ const dialogStyle = computed(() => {
:top="top"
>
<template #header="{ close }">
<div class="relative h-54px flex items-center justify-between pl-15px pr-15px">
<div class="relative flex items-center justify-between text-18px">
<slot name="title">
{{ title }}
</slot>
<div
class="absolute right-15px top-[50%] h-54px flex translate-y-[-50%] items-center justify-between"
class="absolute right-0px top-[50%] h-54px flex translate-y-[-50%] items-center justify-between"
>
<Icon
class="is-hover cursor-pointer"
@ -108,9 +108,9 @@ const dialogStyle = computed(() => {
margin: 0 !important;
&__header {
height: 54px;
padding: 0;
margin-right: 0 !important;
margin-bottom: 20px;
}
&__body {

2
src/components/Editor/src/Editor.vue

@ -256,11 +256,11 @@ defineExpose({
<style scoped>
.wgEdit >>> .w-e-scroll::-webkit-scrollbar {
width: 4px !important;
//height: 8px !important;
}
.wgEdit >>> .w-e-scroll::-webkit-scrollbar-thumb {
background-color: #dcdfe6 !important;
border-radius: 10px !important;
box-shadow: none !important;
}
</style>

14
src/utils/formatTime.ts

@ -70,7 +70,7 @@ export function formatDate(date: Date, format?: string): string {
return ''
}
// 日期存在,则进行格式化
return date ? dayjs(date).locale('zh-cn').format(format ?? 'YYYY-MM-DD HH:mm:ss') : ''
return date ? dayjs(date).locale('zh-cn').format(format ?? 'YYYY年M月D日 H时m分s秒') : ''
}
/**
@ -111,7 +111,7 @@ export function getWeek(dateTime: Date): number {
* @description param 3 60 * 60* 24 * 1000 * 3
* @returns
*/
export function formatPast(param: string | Date, format = 'YYYY-MM-DD HH:mm:ss'): string {
export function formatPast(param: string | Date, format = 'YYYY年M月D日 H时m分s秒'): string {
// 传入格式处理、存储转换值
let t: any, s: number
// 获取js 时间戳
@ -199,7 +199,7 @@ export function formatPast2(ms: number): string {
* @param cellValue
*/
export function dateFormatter(_row: any, _column: TableColumnCtx<any>, cellValue: any): string {
return cellValue ? formatDate(cellValue, 'YYYY年MMDD日 A') : ''
return cellValue ? formatDate(cellValue, 'YYYY年M月D日 AH时m分') : ''
}
/**
@ -210,7 +210,7 @@ export function dateFormatter(_row: any, _column: TableColumnCtx<any>, cellValue
* @param cellValue
*/
export function dateFormatter2(_row: any, _column: TableColumnCtx<any>, cellValue: any): string {
return cellValue ? formatDate(cellValue, 'YYYY年MMDD日') : ''
return cellValue ? formatDate(cellValue, 'YYYY年M月D日') : ''
}
/**
@ -221,7 +221,7 @@ export function dateFormatter2(_row: any, _column: TableColumnCtx<any>, cellValu
* @param cellValue
*/
export function dateFormatter3(_row: any, _column: TableColumnCtx<any>, cellValue: any): string {
return cellValue ? formatDate(cellValue, 'YYYY年MMDD日') : ''
return cellValue ? formatDate(cellValue, 'YYYY年M月D日') : ''
}
/**
@ -338,7 +338,7 @@ export function getDateRange(
endDate: dayjs.ConfigType
): [string, string] {
return [
dayjs(beginDate).startOf('d').format('YYYY-MM-DD HH:mm:ss'),
dayjs(endDate).endOf('d').format('YYYY-MM-DD HH:mm:ss')
dayjs(beginDate).startOf('d').format('YYYY年M月D日 H时m分s秒'),
dayjs(endDate).endOf('d').format('YYYY年M月D日 H时m分s秒')
]
}

109
src/views/system/jobinfo/JobInfoForm.vue

@ -1,36 +1,44 @@
<template>
<Dialog :title="dialogTitle" v-model="dialogVisible" :fullscreen=true>
<Dialog :title="dialogTitle" v-model="dialogVisible" top="5vh" width="64vw">
<el-form
ref="formRef"
:model="formData"
:rules="formRules"
label-width="100px"
v-loading="formLoading"
width="600px"
class="reportForm"
>
<el-form-item label="汇报标题" prop="title">
<el-input v-model="formData.title" placeholder="请输入汇报标题" />
</el-form-item>
<el-form-item label="汇报日期" prop="jobDate">
<el-date-picker
v-model="formData.jobDate"
type="date"
placeholder="选择汇报日期"
value-format="YYYY-MM-DD"
:dafult-time="new Date()"
/>
</el-form-item>
<el-form-item label="汇报人姓名" prop="jobName">
<el-input v-model="formData.jobName" placeholder="请输入汇报人姓名" />
</el-form-item>
<el-form-item label="汇报内容" prop="content">
<Editor v-model="formData.content" height="450px" />
</el-form-item>
<section class="flex flex-wrap gap-20px">
<el-form-item label="汇报标题" prop="title" class="!w100%">
<el-input v-model="formData.title" placeholder="请输入汇报标题" />
</el-form-item>
<el-form-item label="汇报日期" prop="jobDate">
<el-date-picker
v-model="formData.jobDate"
type="date"
placeholder="选择汇报日期"
value-format="YYYY-MM-DD"
:dafult-time="new Date()"
class="!w100%"
/>
</el-form-item>
<el-form-item label="汇报人" prop="jobName">
<el-input v-model="formData.jobName" placeholder="请输入汇报人姓名" />
</el-form-item>
<el-form-item label="汇报内容" prop="content" class="!w100%">
<Editor v-model="formData.content" height="400px" class="w100%"/>
</el-form-item>
</section>
</el-form>
<template #footer>
<el-button @click="submitForm" type="primary" :disabled="formLoading"> </el-button>
<el-popconfirm title="是否确定删除当前政策法规?" @confirm="deleteReport" width="230">
<template #reference>
<el-button type="danger" v-if="formType == 'update'" link class="underline">
我要删除
</el-button>
</template>
</el-popconfirm>
<el-button @click="dialogVisible = false"> </el-button>
<el-button @click="submitForm" type="primary" :disabled="formLoading"> </el-button>
</template>
</Dialog>
</template>
@ -45,23 +53,51 @@ const message = useMessage() // 消息弹窗
const dialogVisible = ref(false) //
const dialogTitle = ref('') //
const formLoading = ref(false) // 12
const formLoading = ref(false) // 12
const formType = ref('') // create - update -
const formData = ref({
id: undefined,
title: undefined,
content: undefined,
jobDate: undefined,
jobName: undefined,
jobName: undefined
})
const formRules = reactive({
title: [
{
required: true,
message: '请输入汇报标题',
trigger: 'blur'
}
],
jobDate: [
{
required: true,
message: '请选择汇报日期',
trigger: 'blur'
}
],
jobName: [
{
required: true,
message: '请输入汇报人姓名',
trigger: 'blur'
}
],
content: [
{
required: true,
message: '请输入汇报内容',
trigger: 'blur'
}
]
})
const formRef = ref() // Ref
/** 打开弹窗 */
const open = async (type: string, id?: number) => {
dialogVisible.value = true
dialogTitle.value = t('action.' + type)
dialogTitle.value = type == 'create' ? '新增工作汇报' : '修改工作汇报'
formType.value = type
resetForm()
//
@ -107,8 +143,25 @@ const resetForm = () => {
title: undefined,
content: undefined,
jobDate: undefined,
jobName: undefined,
jobName: undefined
}
formRef.value?.resetFields()
}
</script>
const deleteReport = () => {
JobInfoApi.deleteJobInfo(formData.value.id).then(() => {
message.success(t('common.delSuccess'))
dialogVisible.value = false
emit('success')
})
}
</script>
<style scoped lang="scss">
.reportForm {
::v-deep(.el-form-item) {
width: calc(50% - 10px);
margin-bottom: 0;
}
}
</style>

Loading…
Cancel
Save