Files
zhgh_hrbnu/src/main/resources/views/platform/healthCheckup/projectMange.html
T
2024-12-09 16:02:46 +08:00

649 lines
30 KiB
HTML

<!--#
layout("/layouts/platform.html"){
#-->
<div class="platform" id="app" v-cloak>
<guava padding="0 5%" ref="guava">
<template>
<el-card shadow="never">
<div class="search">
<div class="search-item">
<div class="search-item-label">年&emsp;&emsp;度:</div>
<div class="search-item-option">
<el-date-picker
placeholder="请选择"
style="width: 100%"
type="year"
v-model="pageForm.year"
value-format="yyyy">
</el-date-picker>
</div>
</div>
<div class="search-item">
<div class="search-item-label">项目名称:</div>
<div class="search-item-option">
<el-input @keyup.enter.native="doSearch" clearable placeholder="请输入内容"
style="width:100%" v-model="pageForm.name"></el-input>
</div>
</div>
<div class="search-query">
<el-button @click="doSearch" icon="el-icon-search" type="primary">搜索
</el-button>
</div>
</div>
</el-card>
<el-card class="mt10" shadow="never">
<table-tool :app="this" label="体检项目">
<template #func>
<el-button @click="openAdd" icon="el-icon-plus"
size="small"
type="primary">新建体检项目
</el-button>
</template>
</table-tool>
<el-table :data="tableData" :size="tableSize" @sort-change="pageOrder"
class="vi-table" ref="table"
row-key="id" style="width: 100%" v-loading="tableLoading">
<el-table-column :index="indexMethod" align="center" header-align="center"
label="序号" type="index"
width="80px"></el-table-column>
<el-table-column
:label="column.label"
:prop="column.prop"
:sortable="column.sortable"
:width="column.width"
align="center"
header-align="center"
min-width="100px" show-overflow-tooltip v-for="column in tableColumns">
<template scope="{row}" v-if="column.prop=='choiceTime'">
{{row.choiceTimeStart}}-{{row.choiceTimeEnd}}
</template>
</el-table-column>
<el-table-column align="center" header-align="center" label="操作"
prop="userOnline" width="100px">
<template scope="{row}">
<el-dropdown @command="dropdownCommand">
<el-button plain size="mini">
<i class="ti-settings"></i>
<span class="ti-angle-down"></span>
</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item :command="{type:'view',data:row}">
查看
</el-dropdown-item>
<el-dropdown-item
:command="{type:'created',data:row}"
v-if="row.isWithinChoiceTime && !row.isHasUserList">
生成名单
</el-dropdown-item>
<el-dropdown-item
:command="{type:'renew',data:row}"
v-if="row.isWithinChoiceTime && row.isHasUserList">
更新名单
</el-dropdown-item>
<el-dropdown-item :command="{type:'reset',data:row}"
v-if="row.isWithinChoiceTime">
重置名单
</el-dropdown-item>
<el-dropdown-item :command="{type:'edit',data:row}">
编辑
</el-dropdown-item>
<el-dropdown-item :command="{type:'delete',data:row}">
删除
</el-dropdown-item>
<el-dropdown-item :command="{type:'send',data:row}">
通知
</el-dropdown-item>
<el-dropdown-item :command="{type:'code',data:row}">
二维码
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template>
</el-table-column>
</el-table>
<!--#include("/layouts/pagination.html"){}#-->
</el-card>
</template>
<template #edit>
<el-form :model="formData" :rules="formRules" label-width="120px" ref="form"
v-loading="formLoading">
<vi-title title="体检项目信息"></vi-title>
<el-form-item label="项目名称" prop="name">
<el-input maxlength="100" placeholder="项目名称" v-model="formData.name"></el-input>
</el-form-item>
<el-row>
<el-col span="12">
<el-form-item label="选择时间" prop="choiceTime">
<el-date-picker
end-placeholder="结束时间"
range-separator="-"
start-placeholder="开始时间"
style="width: 80%"
type="datetimerange"
v-model="formData.choiceTime"
value-format="yyyy-MM-dd HH:mm:ss">
</el-date-picker>
</el-form-item>
</el-col>
<el-col span="12">
<el-form-item label="可报名人员范围" prop="activityGroupId">
<div style="display: flex; justify-content: space-between">
<div style="width: 99%">
<el-select clearable filterable
placeholder="参加人员范围"
prop="activityGroupId"
style="width: 99%;"
v-model="formData.activityGroupId">
<el-option :label="item.groupName"
:value="item.groupId"
v-for="item in activityGroupList"></el-option>
</el-select>
</div>
<div>
<el-button
@click="$refs.drawerUserScope.userScopeDialog = true"
type="primary">设置
</el-button>
</div>
</div>
</el-form-item>
</el-col>
<el-col span="24">
<el-form-item label="体检对象类型" prop="healthCheckupType">
<el-radio-group v-model="formData.healthCheckupType">
<el-radio-button label="jzg">教职工</el-radio-button>
<el-radio-button label="js">家属</el-radio-button>
</el-radio-group>
</el-form-item>
</el-col>
<el-col span="24">
<el-form-item label="体检套餐" prop="healthCheckupProjectSubjects">
<el-card class="item" shadow="hover">
<div class="s-options-list" style="margin-top: 10px;">
<el-table :data="formData.healthCheckupProjectSubjects" border>
<el-table-column
align="center"
header-align="center"
label="套餐名称">
<template slot-scope="{row}">
<el-input autosize class="text-input"
data-type="option"
v-model="row.optionName"
></el-input>
</template>
</el-table-column>
<el-table-column
align="center"
header-align="center"
label="排序">
<template slot-scope="{row}">
<el-input autosize class="text-input"
data-type="option"
v-model="row.optionSort"
></el-input>
</template>
</el-table-column>
<el-table-column
align="center"
header-align="center"
label="图片" width="130px">
<template slot-scope="{row,$index}">
<image-Upload :file-size="10" :file-type="['png','jpg']"
:height="100" :limit="1"
:width="100"
ref="imageUpload"
v-model="row.imgUrl"></image-Upload>
</template>
</el-table-column>
<el-table-column align="center"
header-align="center"
label="说明">
<template slot-scope="{row,$index}">
<el-link @click="openDescRichText(row.description,$index)"
type="primary">
编辑说明
</el-link>
</template>
</el-table-column>
<el-table-column
align="center"
header-align="center"
label="操作"
width="100px">
<template slot-scope="{row,$index}">
<div class="option-delete">
<el-button @click="openCnd(row,$index,true)"
circle
icon="el-icon-s-tools" size="mini"
type="primary"></el-button>
<el-button @click="deleteRow(row,$index)"
circle
icon="el-icon-delete" size="mini"
type="danger"></el-button>
</div>
</template>
</el-table-column>
</el-table>
<div class="s-operation">
<el-button @click="formData.healthCheckupProjectSubjects.push({optionNameId:'',optionName:'套餐'+(formData.healthCheckupProjectSubjects.length+1),optionSort:formData.healthCheckupProjectSubjects.length+1,imgUrl:null})" size="small"
type="primary">
添加项目
</el-button>
</div>
</div>
</el-card>
</el-form-item>
<el-form-item label="项目封面" prop="cover">
<image-Upload :file-size="10" :file-type="['png','jpg']"
:height="200" :limit="1"
:width="200"
ref="imageUpload"
v-model="formData.cover"></image-Upload>
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-button @click="doAdd" style="float: right" type="primary">
提交
</el-button>
</template>
<template #view>
<el-descriptions :column="4" border class="table_fixed">
<el-descriptions-item :span="4" label="项目名称">
{{viewData.name}}
</el-descriptions-item>
<el-descriptions-item :span="4" label="选择时间">
{{viewData.choiceTimeStart}}-{{viewData.choiceTimeEnd}}
</el-descriptions-item>
<el-descriptions-item :span="4" label="可报名人员范围">
{{viewData.activityGroupName}}
</el-descriptions-item>
<el-descriptions-item :span="4" label="体检对象类型">
{{viewData.healthCheckupType==='jzg'?'教职工':'家属'}}
</el-descriptions-item>
<template v-for="i in viewData.healthCheckupProjectSubjects">
<el-descriptions-item label="套餐名称">
{{i.optionName}}
</el-descriptions-item>
<el-descriptions-item label="套餐说明">
<span v-html="i.description"></span>
</el-descriptions-item>
<el-descriptions-item label="套餐图片">
<el-image
:src="CREATE_PREVIEW_URL(i.imgUrl)"
@click="preview(i.imgUrl,i.imgUrl)"
fit="cover"
style="width: 100px; height: 100px;"
v-if="i.imgUrl"></el-image>
<div v-else>暂无</div>
</el-descriptions-item>
<el-descriptions-item label="报名条件">
<el-button @click="openCnd(i,null,false)"
circle
icon="el-icon-s-tools" size="mini"
type="primary"></el-button>
</el-descriptions-item>
</template>
</el-descriptions>
</template>
</guava>
<drawer-user-scope
:group_id.sync="formData.activityGroupId"
@group_change="getActivityGroup"
ref="drawerUserScope"
></drawer-user-scope>
<send-msg :url="url" ref="sendMsg"></send-msg>
<open-qr-code :url="url" ref="openQRCode"></open-qr-code>
<el-dialog
:append-to-body="true"
:close-on-click-modal="false"
:visible.sync="richTextDialog"
title="编辑说明"
width="60%">
<text-editor v-model="descRichTextContent"></text-editor>
<span class="dialog-footer" slot="footer">
<el-button @click="richTextDialog = false">取 消</el-button>
<el-button @click="getRichText" type="primary">确 定</el-button>
</span>
</el-dialog>
<condition :fields="fields" :show_submit="showSubmit" @confirm="cndConfirm"
ref="cnd"
v-model="conditions"></condition>
</div>
<script>
const vue = new Vue({
el: '#app',
mixins: [initTableMixins],
data() {
return {
showSubmit: true,
conditions: {
method: "",
conditions: [{}],
},
viewData: {},
subjectIndex: null,
richTextDialog: false,
url: "",
activityGroupList: [],
pageForm: {
year: moment().format('YYYY')
},
formData: {
healthCheckupProjectSubjects: []
},
tableColumns: [
{prop: 'year', label: '年度'},
{prop: 'name', label: '项目名称'},
{prop: 'choiceTime', label: '选择时间'},
],
formRules: {
name: [{required: true, message: '必填', trigger: ['blur', 'change']}],
choiceTime: [{required: true, message: '必填', trigger: ['blur', 'change']}],
activityGroupId: [{required: true, message: '必填', trigger: ['blur', 'change']}],
// cover: [{required: true, message: '必填', trigger: ['blur', 'change']}],
healthCheckupType: [{
required: true,
message: '必填',
trigger: ['blur', 'change']
}],
healthCheckupProjectSubjects: [{
required: true,
message: '必填',
trigger: ['blur', 'change']
}],
},
fields: [
{
label: '性别',
value: 'sex',
type: "select",
options: [{label: '男', value: '男'}, {label: '女', value: '女'}]
},
{label: '出生日期', value: 'birthday', type: "date"},
],
deleteRowIds: [],
descRichTextContent: ""
}
},
components: {
'send-msg': httpVueLoader('/components/plugins/SendMsgByGroupId.vue'),
'drawer-user-scope': httpVueLoader('/components/plugins/DrawerUserScope.vue'),
'open-qr-code': httpVueLoader('/components/plugins/OpenQRCode.vue'),
'condition': httpVueLoader('/components/plugins/ConditionStructure.vue?v=1.0.0'),
},
methods: {
dropdownCommand(command) {
const {type, data} = command
if (type === 'view') {
this.openView(data)
} else if (type === 'created') {
this.createUserList(data)
} else if (type === 'renew') {
this.renewUserList(data)
} else if (type === 'reset') {
this.resetUserList(data)
} else if (type === 'edit') {
this.openEdit(data)
} else if (type === 'delete') {
this.doDelete(data.id)
} else if (type === 'send') {
this.sendMsg(data)
} else if (type === 'code') {
this.openCode(data.id)
}
},
async createUserList(row) {
const msg = '您确定要生成【' + row.name + '】体检名单吗?(该名单生成是按照创建时选择的可报名人员范围来生成)'
const confirm = await this.$confirm(msg, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
if ('confirm' !== confirm) return
const loading = this.$loading({
lock: true,
text: '数据更新中,请稍后...',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
const resp = await $.post(loc() + '/createUserList', row)
loading.close()
if (resp.code === 0) {
this.$message.success('操作成功')
this.pageData()
} else {
this.$message.warning(resp.msg)
}
},
async renewUserList(row) {
const msg = '您确定要更新【' + row.name + '】的体检名单吗?(如可报名人员范围发生变化会删除已选择的人员信息)'
const confirm = await this.$confirm(msg, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
if ('confirm' !== confirm) return
const loading = this.$loading({
lock: true,
text: '数据更新中,请稍后...',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
const resp = await $.post(loc() + '/renewUserList', row)
loading.close()
if (resp.code === 0) {
this.$message.success('操作成功')
this.pageData()
} else {
this.$message.warning(resp.msg)
}
},
async resetUserList(row) {
const msg = '您确定要重置【' + row.name + '】的体检名单吗?(该操作会将所有已选择的人员清空后,在进行生成)'
const confirm = await this.$confirm(msg, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
if ('confirm' !== confirm) return
const loading = this.$loading({
lock: true,
text: '数据更新中,请稍后...',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
const resp = await $.post(loc() + '/resetUserList', row)
loading.close()
if (resp.code === 0) {
this.$message.success('操作成功')
this.pageData()
} else {
this.$message.warning(resp.msg)
}
},
openCode(id) {
this.$refs.openQRCode.openCode("/childrenActivities?id=" + id)
},
sendMsg(row) {
this.url = `<a href="` + (APP_DOMAIN + "/mobile/healthCheckup/checkUp?projectId=" + row.id) + `">点击参与</a>`
this.$refs.sendMsg.openDialog(row.activityGroupId)
},
deleteRow(row, index) {
this.formData.healthCheckupProjectSubjects.splice(index, 1)
if (row.id) this.deleteRowIds.push(row.id)
},
async doDelete(id) {
const confirm = await this.$confirm('确定要删除该项目吗?', '提示', {type: 'warning'})
if (confirm) {
const resp = await $.post(loc() + "/doDelete", {id})
if (resp.code === 0) {
this.pageData()
this.notifySuccess(resp.msg)
} else {
this.notifyWarning(resp.msg)
}
}
},
async openEdit(row) {
this.formData = await this.findOne(row.id)
this.$refs.guava.edit()
},
async openView(row) {
this.viewData = await this.findOne(row.id)
this.$refs.guava.view()
},
async findOne(id) {
const resp = await $.post(loc() + "/findOne", {id: id})
if (resp.code === 0) {
resp.data.choiceTime = [resp.data.choiceTimeStart, resp.data.choiceTimeEnd]
return resp.data
} else {
this.notifyError("查询失败")
}
},
async doAdd() {
const formValid = await this.$refs["form"].validate()
if (formValid) {
const loading = this.$loading({
lock: true,
text: '数据保存中请稍后',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
const formData = clone(this.formData)
formData.choiceTimeStart = formData.choiceTime[0]
formData.choiceTimeEnd = formData.choiceTime[1]
formData.healthCheckupProjectSubjects = JSON.stringify(this.formData.healthCheckupProjectSubjects)
formData.activityGroupName = this.activityGroupList.find(v => v.groupId === this.formData.activityGroupId).groupName
formData.deleteRowIds = JSON.stringify(this.deleteRowIds)
const resp = await $.post(loc() + "/doAdd", formData)
loading.close()
if (resp.code === 0) {
this.pageData()
this.$refs.guava.index()
this.deleteRowIds = []
} else {
this.notifyWarning(resp.msg)
}
}
},
openAdd() {
this.formData = {
name: null,
activityGroupId: null,
choiceTime: null,
healthCheckupProjectSubjects: [
{
optionName: '套餐1',
optionNameId: '',
optionSort: '1',
imgUrl: ''
}
]
}
if (this.$refs.form) this.$refs.form.resetFields();
this.$refs.guava.edit()
},
openDescRichText(richText, sIdx) {
this.richTextDialog = true
this.subjectIndex = sIdx
},
getRichText() {
this.formData.healthCheckupProjectSubjects[this.subjectIndex].description = this.descRichTextContent
this.richTextDialog = false
},
async openCnd(row, index, showSubmit) {
this.showSubmit = showSubmit
if (row.matchCnd) {
this.conditions = row.matchCnd
} else {
this.conditions = {
method: "",
conditions: [{}],
}
}
this.subjectIndex = index
this.$refs.cnd.open()
},
async cndConfirm(val) {
if (val) {
const matchCnd = clone(val)
if (matchCnd.conditions && matchCnd.conditions.length > 0) {
this.formData.healthCheckupProjectSubjects[this.subjectIndex].matchCnd = matchCnd
}
}
},
async getActivityGroup() {
const {data} = await $.get('/platform/activity/basic/scope/getActivityUserScopeGroup')
this.activityGroupList = data
},
},
async created() {
const personType = await getDictOptions("UserType")
const userState = await getDictOptions("userState")
this.fields = this.fields.concat([{
label: '人员类型',
value: 'personType',
type: "select",
options: personType.map(v => {
return {label: v.name, value: v.code}
})
}, {
label: '在职状态',
value: 'userState',
type: "select",
options: userState.map(v => {
return {label: v.name, value: v.code}
})
}])
this.getActivityGroup()
this.pageData()
}
})
</script>
<!--#
}
#-->