336 lines
13 KiB
HTML
336 lines
13 KiB
HTML
<!--#
|
|
layout("/layouts/platform.html"){
|
|
#-->
|
|
<style>
|
|
.flexible-gifts {
|
|
display: flex;
|
|
flex-direction: column
|
|
}
|
|
|
|
.flexible-gifts-item {
|
|
display: flex;
|
|
}
|
|
|
|
.flexible-gifts-item:not(:first-of-type) {
|
|
margin-top: 15px;
|
|
}
|
|
|
|
.flexible-gifts-item-input {
|
|
width: calc(100% - 144px);
|
|
}
|
|
|
|
.flexible-gifts-item-radio {
|
|
width: 100px;
|
|
text-align: center;
|
|
}
|
|
|
|
.flexible-gifts-item-delete {
|
|
width: 44px;
|
|
}
|
|
</style>
|
|
|
|
<div id="app" class="platform" v-cloak>
|
|
<guava ref="guava" padding="0 20%">
|
|
<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=='physicalsTimeStart'" scope="{row}">
|
|
<i class="el-icon-time"></i> {{row.physicalsTimeStart}} 至 {{row.physicalsTimeEnd}}
|
|
</template>
|
|
</el-table-column>
|
|
|
|
<el-table-column prop="userOnline" align="center" header-align="center" label="操作" width="150px">
|
|
<template scope="{row}">
|
|
|
|
<el-dropdown @command="dropdownCommand">
|
|
<el-button plain size="mini" :loading="submitLoading">
|
|
<i class="ti-settings"></i>
|
|
<span class="ti-angle-down"></span>
|
|
</el-button>
|
|
<el-dropdown-menu slot="dropdown">
|
|
|
|
<el-dropdown-item :disabled="!row.created"
|
|
:command="{type:'export',data:row}">
|
|
导出体检名单
|
|
</el-dropdown-item>
|
|
|
|
<el-dropdown-item
|
|
:disabled="moment().valueOf()>=moment(row.physicalsTimeStart).valueOf()"
|
|
:command="{type:'createList',data:row}">
|
|
{{row.created?'重新生成体检名单':'生成体检名单'}}
|
|
</el-dropdown-item>
|
|
|
|
<el-dropdown-item
|
|
:disabled="moment().valueOf()>=moment(row.physicalsTimeEnd).valueOf()"
|
|
:command="{type:'edit',data:row}">
|
|
编辑
|
|
</el-dropdown-item>
|
|
|
|
<el-dropdown-item :command="{type:'delete',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" 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-form-item prop="physicalsTime" label="体检时间">
|
|
<el-date-picker
|
|
style="width: 100%"
|
|
v-model="formData.physicalsTime"
|
|
type="datetimerange"
|
|
value-format="yyyy-MM-dd HH:mm:ss"
|
|
range-separator="-"
|
|
start-placeholder="开始时间"
|
|
end-placeholder="结束时间" @change="provideTimeChange">
|
|
</el-date-picker>
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item prop="physicalsAddress" label="体检地点">
|
|
<el-input v-model="formData.physicalsAddress" placeholder="体检地点"
|
|
suffix-icon="el-icon-location-information" maxlength="200"></el-input>
|
|
</el-form-item>
|
|
|
|
<el-form-item prop="conditionStructure" label="体检范围">
|
|
<el-button @click="$refs.cnd.open()" size="small" icon="el-icon-s-operation">打开</el-button>
|
|
</el-form-item>
|
|
|
|
</el-form>
|
|
|
|
<el-button @click="save" :loading="submitLoading" type="primary" style="float: right">提交</el-button>
|
|
|
|
</template>
|
|
|
|
<template #view>
|
|
|
|
</template>
|
|
</guava>
|
|
|
|
<condition ref="cnd" v-model="formData.conditionStructure" :fields="fields"></condition>
|
|
</div>
|
|
<script>
|
|
const vue = new Vue({
|
|
el: '#app',
|
|
mixins: [initTableMixins],
|
|
data() {
|
|
return {
|
|
fields: [
|
|
{
|
|
label: '性别',
|
|
value: 'sex',
|
|
type: "select",
|
|
options: [{label: '男', value: '男'}, {label: '女', value: '女'}]
|
|
},
|
|
{label: '出生日期', value: 'birthday', type: "date"},
|
|
],
|
|
pageForm: {
|
|
year: moment().format('YYYY')
|
|
},
|
|
tableColumns: [
|
|
{prop: 'year', label: '年度'},
|
|
{prop: 'name', label: '项目名称'},
|
|
{prop: 'physicalsAddress', label: '体检地址'},
|
|
{prop: 'physicalsTimeStart', label: '体检时间'},
|
|
],
|
|
formRules: {
|
|
name: [{required: true, message: '必填', trigger: ['blur', 'change']}],
|
|
physicalsTime: [{required: true, message: '必选', trigger: ['blur', 'change']}],
|
|
physicalsAddress: [{required: true, message: '必选', trigger: ['blur', 'change']}],
|
|
},
|
|
}
|
|
},
|
|
components: {
|
|
'guava': httpVueLoader('/components/plugins/Guava.vue?v=1.0.0'),
|
|
'condition': httpVueLoader('/components/plugins/ConditionStructure.vue?v=1.0.0'),
|
|
},
|
|
methods: {
|
|
exportPhysicalsList,
|
|
save() {
|
|
this.$refs["form"].validate(async (valid) => {
|
|
if (valid) {
|
|
this.submitLoading = true
|
|
|
|
const formData = clone(this.formData)
|
|
|
|
if (formData.conditionStructure)
|
|
formData.conditionStructure = JSON.stringify(formData.conditionStructure)
|
|
|
|
const resp = await $.post(loc() + "/save", formData)
|
|
|
|
requestLaterMsgFun(this, resp, () => {
|
|
this.$refs.guava.index()
|
|
this.pageData()
|
|
}, () => {
|
|
}, () => {
|
|
this.submitLoading = false
|
|
})
|
|
}
|
|
})
|
|
},
|
|
provideTimeChange() {
|
|
if (this.formData.physicalsTime && this.formData.physicalsTime.length) {
|
|
this.formData.physicalsTimeStart = this.formData.physicalsTime[0]
|
|
this.formData.physicalsTimeEnd = this.formData.physicalsTime[1]
|
|
} else {
|
|
this.formData.physicalsTimeStart = ''
|
|
this.formData.physicalsTimeEnd = ''
|
|
}
|
|
},
|
|
openAdd() {
|
|
this.formData = {}
|
|
this.$refs.guava.edit()
|
|
if (this.$refs.form)
|
|
this.$refs.form.resetFields();
|
|
},
|
|
|
|
async createList(id) {
|
|
this.$confirm('是否生成体检名单?', '提示', {
|
|
confirmButtonText: '确定',
|
|
cancelButtonText: '取消',
|
|
type: 'warning'
|
|
}).then(async () => {
|
|
this.submitLoading = true
|
|
const resp = await $.post(loc() + "/createList", {id});
|
|
requestLaterMsgFun(this, resp, async () => {
|
|
this.pageData()
|
|
}, null, () => {
|
|
this.submitLoading = false
|
|
})
|
|
}).catch(() => {
|
|
});
|
|
},
|
|
|
|
doDelete(id) {
|
|
this.$confirm('确定要删除吗?', '提示', {
|
|
confirmButtonText: '确定',
|
|
cancelButtonText: '取消',
|
|
type: 'warning'
|
|
}).then(async () => {
|
|
const resp = await $.post(loc() + "/delete", {id});
|
|
requestLaterMsgFun(this, resp, async () => {
|
|
this.pageData()
|
|
})
|
|
}).catch(() => {
|
|
});
|
|
},
|
|
dropdownCommand(command) {
|
|
const {type, data} = command
|
|
if (type === 'edit') {
|
|
this.openEdit(data)
|
|
} else if (type === 'delete') {
|
|
this.doDelete(data.id)
|
|
} else if (type === 'createList') {
|
|
this.createList(data.id)
|
|
} else if (type === 'export') {
|
|
this.exportPhysicalsList(data.id)
|
|
}
|
|
},
|
|
|
|
async openEdit(row) {
|
|
this.submitLoading = true
|
|
|
|
const resp = await $.get(loc() + "/findOne", {id: row.id})
|
|
|
|
requestLaterFun(resp, (data) => {
|
|
data.physicalsTime = [data.physicalsTimeStart, data.physicalsTimeEnd]
|
|
this.formData = data
|
|
this.$refs.guava.edit()
|
|
}, null, () => {
|
|
this.submitLoading = false
|
|
})
|
|
|
|
}
|
|
},
|
|
async created() {
|
|
this.pageData();
|
|
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}
|
|
})
|
|
}])
|
|
|
|
|
|
}
|
|
})
|
|
</script>
|
|
<!--#
|
|
}
|
|
#--> |