534 lines
24 KiB
HTML
534 lines
24 KiB
HTML
<!--#
|
|
layout("/layouts/platform.html"){
|
|
#-->
|
|
|
|
|
|
<div id="app" class="platform" v-cloak>
|
|
<guava ref="guava" padding="0 5%">
|
|
<template>
|
|
<el-card shadow="never">
|
|
|
|
<div class="search">
|
|
|
|
<div class="search-item">
|
|
<div class="search-item-label">年  度:</div>
|
|
<div class="search-item-option">
|
|
<el-date-picker
|
|
v-model="pageForm.year"
|
|
type="year"
|
|
style="width: 100%"
|
|
value-format="yyyy"
|
|
placeholder="请选择">
|
|
</el-date-picker>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="search-item">
|
|
<div class="search-item-label">项目名称:</div>
|
|
<div class="search-item-option">
|
|
<el-input placeholder="请输入内容" clearable v-model="pageForm.name"
|
|
@keyup.enter.native="doSearch" style="width:100%"></el-input>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="search-query">
|
|
<el-button type="primary" icon="el-icon-search" @click="doSearch">搜索
|
|
</el-button>
|
|
</div>
|
|
</div>
|
|
</el-card>
|
|
|
|
|
|
<el-card shadow="never" class="mt10">
|
|
<table-tool label="体检项目" :app="this">
|
|
<template #func>
|
|
<el-button type="primary" size="small"
|
|
icon="el-icon-plus"
|
|
@click="openAdd">新建体检项目
|
|
</el-button>
|
|
</template>
|
|
</table-tool>
|
|
|
|
|
|
<el-table :data="tableData" style="width: 100%" row-key="id"
|
|
@sort-change="pageOrder" :size="tableSize"
|
|
v-loading="tableLoading" ref="table" class="vi-table">
|
|
|
|
|
|
<el-table-column align="center" header-align="center" type="index"
|
|
:index="indexMethod" label="序号"
|
|
width="80px"></el-table-column>
|
|
|
|
<el-table-column
|
|
align="center"
|
|
header-align="center"
|
|
v-for="column in tableColumns"
|
|
show-overflow-tooltip
|
|
:sortable="column.sortable"
|
|
:label="column.label"
|
|
:prop="column.prop" :width="column.width" min-width="100px">
|
|
|
|
<template v-if="column.prop=='choiceTime'" scope="{row}">
|
|
{{row.choiceTimeStart}}-{{row.choiceTimeEnd}}
|
|
</template>
|
|
|
|
</el-table-column>
|
|
|
|
<el-table-column prop="userOnline" align="center" header-align="center"
|
|
label="操作" width="500px">
|
|
<template scope="{row}">
|
|
<el-button size="mini" :loading="row.loading" @click="openView(row)">
|
|
查看
|
|
</el-button>
|
|
<el-button size="mini" :loading="row.loading" type="primary"
|
|
@click="openEdit(row)">
|
|
编辑
|
|
</el-button>
|
|
<el-button size="mini" :loading="row.loading" type="danger"
|
|
@click="doDelete(row.id)">
|
|
删除
|
|
</el-button>
|
|
<el-button plain size="mini" @click="sendMsg(row)" type="primary">
|
|
通知
|
|
</el-button>
|
|
<el-button plain size="mini" @click="openCode(row.id)" type="primary">
|
|
二维码
|
|
</el-button>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
<!--#include("/layouts/pagination.html"){}#-->
|
|
</el-card>
|
|
|
|
</template>
|
|
|
|
<template #edit>
|
|
<el-form :model="formData" ref="form" :rules="formRules" label-width="120px"
|
|
v-loading="formLoading">
|
|
<vi-title title="体检项目信息"></vi-title>
|
|
|
|
<el-form-item prop="name" label="项目名称">
|
|
<el-input v-model="formData.name" placeholder="项目名称" maxlength="100"></el-input>
|
|
</el-form-item>
|
|
<el-row>
|
|
<el-col span="12">
|
|
<el-form-item prop="choiceTime" label="选择时间">
|
|
<el-date-picker
|
|
style="width: 80%"
|
|
v-model="formData.choiceTime"
|
|
type="datetimerange"
|
|
value-format="yyyy-MM-dd HH:mm:ss"
|
|
range-separator="-"
|
|
start-placeholder="开始时间"
|
|
end-placeholder="结束时间">
|
|
</el-date-picker>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col span="12">
|
|
<el-form-item prop="activityGroupId" label="可报名人员范围">
|
|
<div style="display: flex; justify-content: space-between">
|
|
<div style="width: 99%">
|
|
<el-select prop="activityGroupId" placeholder="参加人员范围"
|
|
v-model="formData.activityGroupId"
|
|
style="width: 99%;"
|
|
clearable
|
|
filterable>
|
|
<el-option v-for="item in activityGroupList"
|
|
:label="item.groupName"
|
|
:value="item.groupId"></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="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 v-model="row.optionName" autosize
|
|
class="text-input"
|
|
data-type="option"
|
|
></el-input>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column
|
|
align="center"
|
|
header-align="center"
|
|
label="排序">
|
|
<template slot-scope="{row}">
|
|
<el-input v-model="row.optionSort" autosize
|
|
class="text-input"
|
|
data-type="option"
|
|
></el-input>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column
|
|
align="center"
|
|
header-align="center"
|
|
label="图片" width="130px">
|
|
<template slot-scope="{row,$index}">
|
|
<image-Upload ref="imageUpload" :height="100"
|
|
:width="100" :limit="1"
|
|
:file-type="['png','jpg']"
|
|
:file-size="10"
|
|
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 type="primary"
|
|
@click="openDescRichText(row.description,$index)">
|
|
编辑说明
|
|
</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 circle
|
|
icon="el-icon-s-tools"
|
|
size="mini" type="primary"
|
|
@click="openCnd(row,$index,true)"></el-button>
|
|
<el-button circle
|
|
icon="el-icon-delete"
|
|
size="mini" type="danger"
|
|
@click="deleteRow(row,$index)"></el-button>
|
|
|
|
</div>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
|
|
<div class="s-operation">
|
|
<el-button size="small" type="primary"
|
|
@click="formData.healthCheckupProjectSubjects.push({optionNameId:'',optionName:'套餐'+(formData.healthCheckupProjectSubjects.length+1),optionSort:formData.healthCheckupProjectSubjects.length+1,imgUrl:null})">
|
|
添加项目
|
|
</el-button>
|
|
</div>
|
|
</div>
|
|
</el-card>
|
|
|
|
</el-form-item>
|
|
<el-form-item label="项目封面" prop="cover">
|
|
<image-Upload ref="imageUpload" :height="200"
|
|
:width="200" :limit="1"
|
|
:file-type="['png','jpg']"
|
|
:file-size="10"
|
|
v-model="formData.cover"></image-Upload>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
</el-form>
|
|
<el-button @click="doAdd" type="primary" style="float: right">
|
|
提交
|
|
</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>
|
|
<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"
|
|
v-if="i.imgUrl"
|
|
style="width: 100px; height: 100px;"></el-image>
|
|
<div v-else>暂无</div>
|
|
</el-descriptions-item>
|
|
<el-descriptions-item label="报名条件">
|
|
<el-button circle
|
|
icon="el-icon-s-tools"
|
|
size="mini" type="primary"
|
|
@click="openCnd(i,null,false)"></el-button>
|
|
</el-descriptions-item>
|
|
</template>
|
|
|
|
</el-descriptions>
|
|
</template>
|
|
|
|
</guava>
|
|
<drawer-user-scope
|
|
@group_change="getActivityGroup"
|
|
ref="drawerUserScope"
|
|
:group_id.sync="formData.activityGroupId"
|
|
></drawer-user-scope>
|
|
|
|
<send-msg ref="sendMsg" :url="url"></send-msg>
|
|
|
|
<open-qr-code ref="openQRCode" :url="url"></open-qr-code>
|
|
|
|
<el-dialog
|
|
:close-on-click-modal="false"
|
|
:visible.sync="richTextDialog"
|
|
title="编辑说明"
|
|
:append-to-body="true"
|
|
width="60%">
|
|
<div id="descRichText">
|
|
</div>
|
|
<span slot="footer" class="dialog-footer">
|
|
<el-button @click="richTextDialog = false">取 消</el-button>
|
|
<el-button type="primary" @click="getRichText">确 定</el-button>
|
|
</span>
|
|
</el-dialog>
|
|
|
|
<condition ref="cnd" v-model="conditions" :fields="fields"
|
|
:show_submit="showSubmit"
|
|
@confirm="cndConfirm"></condition>
|
|
</div>
|
|
|
|
<script>
|
|
var 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']}],
|
|
healthCheckupProjectSubjects: [{
|
|
required: true,
|
|
message: '必填',
|
|
trigger: ['blur', 'change']
|
|
}],
|
|
},
|
|
fields: [
|
|
{
|
|
label: '性别',
|
|
value: 'sex',
|
|
type: "select",
|
|
options: [{label: '男', value: '男'}, {label: '女', value: '女'}]
|
|
},
|
|
{label: '出生日期', value: 'birthday', type: "date"},
|
|
],
|
|
deleteRowIds: []
|
|
}
|
|
},
|
|
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: {
|
|
openCode(id) {
|
|
this.$refs.openQRCode.openCode("/childrenActivities?id=" + id)
|
|
},
|
|
sendMsg(row) {
|
|
this.url = `<a href="` + (APP_DOMAIN + "/childrenActivities?id=" + 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
|
|
this.$nextTick(() => {
|
|
$("#descRichText").html("")
|
|
descRichTextEditor = new wangEditor("#descRichText")
|
|
descRichTextEditor.config.onchange = (html) => {
|
|
richText = (html ? html : "")
|
|
}
|
|
descRichTextEditor.config.uploadImgShowBase64 = true
|
|
descRichTextEditor.create()
|
|
if (richText) {
|
|
descRichTextEditor.txt.html(richText)
|
|
}
|
|
})
|
|
},
|
|
getRichText() {
|
|
this.formData.healthCheckupProjectSubjects[this.subjectIndex].description = descRichTextEditor.txt.html()
|
|
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>
|
|
|
|
|
|
<!--#
|
|
}
|
|
#--> |