Lion 4 years ago
commit abd9c07efb

@ -7,8 +7,8 @@
<div slot="content"></div>
<slot>
<div>
<Input style="width: 200px; margin-right: 10px" v-model="searchFields.KeyWord" placeholder="关键字搜索" />
<DatePicker @on-change="handleChangeSYear" type="year" placeholder="请选择年份" format="yyyy"
value-format="yyyy" v-model="searchFields.year" style="width: 200px"></DatePicker>
<Button type="primary" @click="search" style="margin-left: 10px">查询</Button>
<Button type="primary" @click="edit()" style="margin-left: 10px">新增</Button>
</div>
@ -53,20 +53,21 @@
<el-row>
<el-col :span="8">
<el-form-item label="年份" prop="year">
<el-date-picker v-model="form.year" type="year" placeholder="选择年份">
<el-date-picker @change="handleChangeYear" format="yyyy" v-model="form.year" type="year"
placeholder="选择年份">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="批准人" prop="ratify_admin">
<el-autocomplete class="inline-input" v-model="form.ratify_admin" :fetch-suggestions="querySearch"
placeholder="请输入内容" :trigger-on-focus="false" @select="handleSelectRatify"></el-autocomplete>
placeholder="请输入内容" :trigger-on-focus="true" @select="handleSelectRatify"></el-autocomplete>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="审核人" prop="audit_admin">
<el-autocomplete class="inline-input" v-model="form.audit_admin" :fetch-suggestions="querySearch"
placeholder="请输入内容" :trigger-on-focus="false" @select="handleSelectAudit"></el-autocomplete>
placeholder="请输入内容" :trigger-on-focus="true" @select="handleSelectAudit"></el-autocomplete>
</el-form-item>
</el-col>
<el-col :span="24">
@ -81,7 +82,7 @@
</div>
<el-table :data="this.form.train_plan_people_list" height="400" class="v-table"
style="width: 100%;margin-bottom: 20px;">
<el-table-column type="index" align="center">
<el-table-column type="index" fixed="left" align="center">
</el-table-column>
<el-table-column prop="item_name" label="项目" width="200">
<template slot-scope="scope">
@ -101,22 +102,23 @@
</el-input>
</template>
</el-table-column>
<el-table-column prop="host_unit" label="主办单位" width="160">
<el-table-column prop="host_unit" label="主办单位" width="200">
<template slot-scope="scope">
<el-input v-model="scope.row.host_unit" />
</el-input>
</template>
</el-table-column>
<el-table-column prop="assist_unit" label="协办单位" width="160">
<el-table-column prop="assist_unit" label="协办单位" width="200">
<template slot-scope="scope">
<el-input v-model="scope.row.assist_unit" />
</el-input>
</template>
</el-table-column>
<el-table-column prop="finish_time" label="完成时间" width="140">
<el-table-column prop="finish_time" label="完成时间" width="240">
<template slot-scope="scope">
<el-input v-model="scope.row.finish_time" />
</el-input>
<el-date-picker type="datetime" format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss"
v-model="scope.row.finish_time"></el-date-picker>
</template>
</el-table-column>
<el-table-column prop="fund" label="资金" width="140">
@ -125,7 +127,7 @@
</el-input>
</template>
</el-table-column>
<el-table-column label="操作" width="100" align="center">
<el-table-column label="操作" fixed="right" width="100" align="center">
<template slot-scope="scope">
<Button type="error" @click="delRow(scope.row,scope.$index)" size="small" style="margin-left: 10px;"
ghost>删除</Button>
@ -205,22 +207,22 @@
year: [{
required: true,
message: '请选择年份',
trigger: 'blur'
trigger: 'change'
}],
audit_admin: [{
required: true,
message: '请选择审核人',
trigger: 'blur'
trigger: 'change'
}],
ratify_admin: [{
required: true,
message: '请选择批准人',
trigger: 'blur'
trigger: 'change'
}]
},
tableHeight: 900,
searchFields: {
KeyWord: ""
year: ""
},
columns: [{
field: "year",
@ -252,6 +254,15 @@
},
methods: {
handleChangeSYear() {
if (this.searchFields.year)
this.searchFields.year = this.$moment(this.searchFields.year).format("yyyy");
else
this.searchFields.year = ""
},
handleChangeYear() {
this.form.year = this.$moment(this.form.year).format("yyyy");
},
addRow() {
var len = this.form.train_plan_people_list.length;
this.form.train_plan_people_list.push({
@ -308,7 +319,8 @@
load() {
listtrain({
page: this.paginations.page,
page_size: this.paginations.page_size
page_size: this.paginations.page_size,
year: this.searchFields.year
}).then(res => {
this.tableData = res.data;
this.paginations.total = res.total
@ -346,8 +358,13 @@
get(obj.id).then(res => {
let result = Object.assign(that.form, res);
that.form = result;
that.form.type = parseInt(result.type);
that.form.train_plan_people_list = res.people;
that.form.audit_admin = res.audit_admin.name;
that.form.audit_admin_id = res.audit_admin.id;
that.form.ratify_admin = res.ratify_admin.name;
that.form.ratify_admin_id = res.ratify_admin.id;
that.form.year = res.year + "-01-01";
}).catch(error => {
//reject(error)
})
@ -365,6 +382,9 @@
var that = this;
this.$refs[formName].validate((valid) => {
if (valid) {
if (that.form.year.indexOf("-") > -1) {
that.form.year = that.form.year.split("-")[0]
}
if (that.form.id) {
save(that.form).then(response => {
//console.log(response)

@ -1,8 +1,517 @@
<template>
<div class="container">
<!-- 查询配置 -->
<div style="padding: 0px 20px">
<div ref="lxHeader">
<LxHeader icon="md-apps" text="教育培训记录" style="margin-bottom: 10px; border: 0px; margin-top: 15px">
<div slot="content"></div>
<slot>
<div>
<Input style="width: 200px; margin-right: 10px" v-model="searchFields.KeyWord" placeholder="关键字搜索" />
<Button type="primary" @click="search" style="margin-left: 10px">查询</Button>
<Button type="primary" @click="edit()" style="margin-left: 10px">新增</Button>
</div>
</slot>
</LxHeader>
</div>
<div ref="lxTable">
<el-table :data="tableData" :height="tableHeight" style="width: 100%">
<el-table-column type="index" width="50" align="center"> </el-table-column>
<el-table-column :prop="column.field" :align="column.align" v-for="(column,index) in columns"
:label="column.title" :width="column.width">
<template slot-scope="scope">
<div v-if="column.type=='opt'">
<Button ghost size="small" @click="edit(scope.row)" type="primary"
style="margin-left: 10px;">编辑</Button>
<Button ghost size="small" @click="del(scope.row)" type="error" style="margin-left: 10px;">删除</Button>
</div>
<div v-else>{{scope.row[column.field]}}</div>
</template>
</el-table-column>
</el-table>
<div class="pagination">
<el-pagination @current-change="handleCurrentChange" :current-page="paginations.page"
:page-size="paginations.page_size" background layout="prev, pager, next" :total="paginations.total">
</el-pagination>
</div>
</div>
</div>
<el-dialog title="教育培训记录编辑" :visible.sync="dialogFormVisible" fullscreen width="90%">
<div class="dialogConcent" :style="{height:clientHeight+'px'}">
<el-scrollbar style="flex: 1">
<el-form :model="form" :rules="rules" ref="form" label-position="right" :label-width="formLabelWidth">
<el-row>
<el-col :span="24">
<div class="form-sub-title">基本信息</div>
</el-col>
<el-col :span="24">
<el-form-item label="培训名称" prop="name">
<el-input v-model="form.name" placeholder="请填写培训名称" autocomplete="off"></el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="培训时间" prop="time">
<el-date-picker type="datetime" value-format="yyyy-MM-dd HH:mm:ss" format="yyyy-MM-dd HH:mm:ss"
v-model="form.time" placeholder="请填写培训时间" autocomplete="off">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="培训课时" prop="period">
<el-input v-model="form.period" placeholder="请填写培训课时" type="number" autocomplete="off"></el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="培训单位" prop="unit">
<el-select v-model="form.unit" placeholder="培训单位" style="width: 100%">
<el-option v-for="item in deptOptions" :key="item.id" :label="item.name" :value="item.name">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="16">
<el-form-item label="培训地点" prop="address">
<el-input v-model="form.address" placeholder="请填写培训地点" autocomplete="off"></el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="授课人" prop="teacher">
<el-input v-model="form.teacher" placeholder="请填写授课人" autocomplete="off"></el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="培训内容" prop="content">
<el-input v-model="form.content" placeholder="请填写培训内容" type="textarea" autocomplete="off"></el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="参与人员" prop="people_list">
<el-transfer filterable :titles="['待选择', '已选择']" :props="{key: 'id',label: 'name'}"
:filter-method="filterMethod" :format="{ noChecked: '${total}',hasChecked: '${checked}/${total}' }"
filter-placeholder="请选择参与人员" v-model="form.people_list" :data="userdata">
</el-transfer>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="附件" prop="file_list">
<el-upload class="upload-demo" :on-success="handlesuccess" :data="uploadOther"
action="/api/admin/upload-file" :on-remove="handleRemove" :before-remove="beforeRemove"
:on-exceed="handleExceed" :file-list="fileList">
<el-button size="small" type="primary">点击上传</el-button>
</el-upload>
</el-form-item>
</el-col>
<el-col :span="24">
<div class="form-sub-title">培训评估</div>
</el-col>
<el-col :span="24">
<el-form-item label="培训评估方式" prop="evaluate">
<el-radio-group v-model="form.evaluate">
<el-radio :label="item.id" v-for="(item,index) in evaluateOptions ">{{item.name}}</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="培训效果评估" prop="result_evaluate">
<el-input v-model="form.result_evaluate" placeholder="请填写培训效果评估" autocomplete="off"></el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="评估人" prop="evaluate_person">
<el-input v-model="form.evaluate_person" placeholder="请填写评估人" autocomplete="off"></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-scrollbar>
</div>
<div slot="footer" class="dialog-footer">
<el-button @click="resetForm('form')"> </el-button>
<el-button type="primary" v-preventReClick @click="submitForm('form')"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {
getToken
} from '@/utils/auth';
import LxHeader from "@/components/LxHeader/index.vue";
import {
listtrainlog,
store,
save,
get,
del
} from "../../api/training/record.js";
import {
listCommondepartment,
listCommonuser
} from "../../api/common.js"
export default {
components: {
LxHeader
},
data() {
return {
evaluateOptions: [{
id: 1,
name: "考试"
}, {
id: 2,
name: "课堂评价"
}, {
id: 3,
name: "事后检查"
}, {
id: 4,
name: "实际操作"
}],
paginations: {
page: 1,
page_size: 15,
total: 0
},
userdata: [],
filterMethod(query, item) {
return item.name.indexOf(query) > -1;
},
tableHeight: 0,
dialogFormVisible: false,
formLabelWidth: "120px",
clientHeight: 0,
form: {
name: "",
time: "",
period: "",
address: "",
unit: "",
teacher: "",
content: "",
evaluate: "",
result_evaluate: "",
evaluate_person: "",
people_list: [],
files_list: [],
id: ""
},
fileList: [],
tableData: [],
rules: {
name: [{
required: true,
message: '请填写培训名称',
trigger: 'blur'
}],
time: [{
required: true,
message: '请选择培训时间',
trigger: 'change'
}],
period: [{
required: true,
message: '请输入课时',
trigger: 'blur'
}],
address: [{
required: true,
message: '请输入培训地点',
trigger: 'blur'
}],
unit: [{
required: true,
message: '请选择单位科室',
trigger: 'change'
}],
teacher: [{
required: true,
message: '请输入授课人',
trigger: 'blur'
}]
},
tableHeight: 900,
searchFields: {
KeyWord: ""
},
columns: [{
field: "name",
title: "培训名称",
type: "string"
},
{
field: "time",
title: "培训时间",
type: "string",
width: 180
},
{
field: "unit",
title: "科室",
type: "string",
width: 180
},
{
field: "period",
title: "课时",
type: "int",
width: 80,
align: "center"
},
{
field: "created_at",
title: "创建信息",
type: "string",
width: 180,
align: "center"
},
{
field: "操作",
title: "操作",
width: 220,
type: "opt",
}
],
uploadOther: {
token: ""
},
deptOptions: []
}
},
created() {
this.uploadOther.token = getToken();
this.loadDeptOptions();
this.loadUser();
this.initLoad();
this.load();
},
methods: {
loadDeptOptions() {
listCommondepartment().
then((res) => {
this.deptOptions = res.data;
}).catch(error => {
console.log(error)
reject(error)
})
},
loadUser() {
listCommonuser({
page_size: 999
}).
then((res) => {
this.userdata = res.data;
}).catch(error => {
console.log(error)
})
},
handleCheckAllChange(val) {
console.log(val)
let options = [];
for (var m of this.deptOptions) {
options.push(m.id);
}
this.form.department_list = val ? options : [];
this.isIndeterminate = false;
},
handleCheckedDeptChange(value) {
let checkedCount = value.length;
this.checkAll = checkedCount === this.deptOptions.length;
this.isIndeterminate = checkedCount > 0 && checkedCount < this.deptOptions.length;
},
initLoad() {
var that = this;
var clientHeight = document.documentElement.clientHeight
var lxHeader_height = 96.5; //
var paginationHeight = 37; //
var topHeight = 50; //
let tableHeight = clientHeight - lxHeader_height - topHeight - paginationHeight - 20;
that.tableHeight = tableHeight;
},
handleCurrentChange(page) {
this.paginations.page = page;
this.load();
},
search() {
this.paginations.page = 1;
this.load();
},
load() {
listtrainlog({
page: this.paginations.page,
page_size: this.paginations.page_size,
}).then(response => {
this.tableData = response.data;
this.paginations.total = response.total;
}).catch(error => {
console.log(error)
reject(error)
})
},
del(obj) {
var that = this;
if (obj) {
this.$Modal.confirm({
title: '确认要删除数据?',
onOk: () => {
del(obj.id).then(response => {
this.$Message.success('操作成功');
that.load();
}).catch(error => {
console.log(error)
reject(error)
})
},
onCancel: () => {
//this.$Message.info('Clicked cancel');
}
});
}
},
show(obj) {
this.clientHeight = document.documentElement.clientHeight - 84 - 110;
this.dialogViewVisible = true;
this.info(obj);
},
info(obj) {
var that = this;
get(obj.id).then(res => {
let result = Object.assign(that.form, res);
that.form = result;
for (var m of res.people) {
if (m.admin)
that.form.people_list.push(m.admin.id)
}
}).catch(error => {
//reject(error)
})
},
edit(obj) {
this.form = this.$options.data().form;
this.clientHeight = document.documentElement.clientHeight - 84 - 110;
if (obj) {
var that = this;
that.info(obj);
} else {}
this.dialogFormVisible = true;
},
submitForm(formName) {
var that = this;
this.$refs[formName].validate((valid) => {
if (valid) {
var arr = [];
for (var m of this.form.people_list) {
arr.push({
admin_id: m
})
}
this.form.people_list = arr;
if (that.form.id) {
that.form.id = that.form.id;
save(that.form).then(response => {
//console.log(response)
this.$Message.success('操作成功');
that.load();
that.dialogFormVisible = false;
}).catch(error => {
//reject(error)
})
} else {
store(that.form).then(response => {
//console.log(response)
this.$Message.success('操作成功');
that.load();
that.dialogFormVisible = false;
}).catch(error => {
//reject(error)
})
}
that.fileList = [];
} else {
this.$Message.error('数据校验失败');
console.log('error submit!!');
return false;
}
});
},
handleRemove(file, fileList) {
let listUrl = [];
for (var m of fileList) {
if (m.response)
listUrl.push({
"upload_id": m.response.id
});
else
listUrl.push({
"upload_id": m.id
});
}
this.form.file_list = listUrl;
},
handleExceed(files, fileList) {},
beforeRemove(file, fileList) {
return this.$confirm(`确定移除 ${ file.name }`);
},
handlesuccess(response, file, fileList) {
let listUrl = [];
for (var m of fileList) {
if (m.response)
listUrl.push({
"upload_id": m.response.id
});
else
listUrl.push({
"upload_id": m.id
});
}
this.form.file_list = listUrl;
},
resetForm(formName) {
var that = this;
that.fileList = [];
this.$refs[formName].resetFields();
that.dialogFormVisible = false;
},
}
}
</script>
<style>
.dialogConcent {
overflow-y: auto;
}
.form-sub-title {
padding: 20px 0px;
}
</style>

Loading…
Cancel
Save