|
|
@@ -1,311 +0,0 @@
|
|
|
-<template>
|
|
|
- <div class="edu-training-edit">
|
|
|
- <DialogCom :title="title" @close="onHide" :visible.sync="isShow" width="800px">
|
|
|
- <div class="page-body">
|
|
|
- <el-form ref="form" :model="formData" :rules="formDataRules" label-width="100px">
|
|
|
- <el-row>
|
|
|
- <el-col :span="12">
|
|
|
- <el-form-item prop="letterName" label="介绍信名称">
|
|
|
- <el-input v-model="formData.letterName" placeholder="请输入介绍信名称" :length="200"/>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
-
|
|
|
- <el-col :span="12">
|
|
|
- <el-form-item label="接待机构" prop="orgIds">
|
|
|
- <org-tree-select
|
|
|
- v-model="formData.orgIds"
|
|
|
- ref="orgTreeSelect"
|
|
|
- :enabledCheckOrgTypes="orgType"
|
|
|
- >
|
|
|
- </org-tree-select>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
-
|
|
|
- <el-col :span="12">
|
|
|
- <el-form-item prop="startTime" label="有效开始时间">
|
|
|
- <el-date-picker required v-model="formData.startTime" :picker-options="startDatepickerOptions"
|
|
|
- type="date" placeholder="选择日期" @change="startDateChanged">
|
|
|
- </el-date-picker>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="12">
|
|
|
- <el-form-item prop="endTime" label="有效结束时间">
|
|
|
- <el-date-picker required v-model="formData.endTime" :picker-options="endDatepickerOptions" @change="endDateChanged"
|
|
|
- type="date" placeholder="选择日期">
|
|
|
- </el-date-picker>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
-
|
|
|
-<!-- <el-form-item label="介绍信文件" prop="letterFile">
|
|
|
- <file-upload v-model="formData.letterFile"/>
|
|
|
- </el-form-item>-->
|
|
|
- <el-form-item label="介绍信文件" prop="letterFile">
|
|
|
- <K-file-upload ref="upload" :defaultValue="formFileListDefualtValue" v-model="formData.letterFile"/>
|
|
|
- </el-form-item>
|
|
|
-
|
|
|
- <el-form-item label="备注" prop="description">
|
|
|
- <el-input v-model="formData.description" type="textarea" placeholder="请输入内容" />
|
|
|
- </el-form-item>
|
|
|
- <el-row :gutter="10" class="mb8">
|
|
|
- <el-col :span="1.5">
|
|
|
- <el-button
|
|
|
- type="primary"
|
|
|
- plain
|
|
|
- icon="el-icon-plus"
|
|
|
- size="mini"
|
|
|
- @click="handleAddUser"
|
|
|
- >新增人员</el-button>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
-
|
|
|
- <el-table :data="formData.userInfos">
|
|
|
- <el-table-column label="人员姓名" align="center" prop="userName" />
|
|
|
- <el-table-column label="单位" align="center" prop="companyName" />
|
|
|
- <el-table-column label="证据号码" align="center" prop="idCard">
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="证件" align="center" prop="imgFile" >
|
|
|
- <template slot-scope="scope">
|
|
|
- <img width="50" height="50" :src="splitImgFilePath(scope.row.imgFile,0)">
|
|
|
- <img width="50" height="50" :src="splitImgFilePath(scope.row.imgFile,1)">
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-button
|
|
|
- size="mini"
|
|
|
- type="text"
|
|
|
- @click="editUser(scope.row,scope.$index)"
|
|
|
- >编辑</el-button>
|
|
|
- <el-button
|
|
|
- size="mini"
|
|
|
- type="text"
|
|
|
- @click="remove(scope.row)"
|
|
|
- >移除</el-button>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- </el-table>
|
|
|
- </el-form>
|
|
|
- </div>
|
|
|
-
|
|
|
- <div slot="footer" class="dialog-footer">
|
|
|
- <el-button @click="onHide">取 消</el-button>
|
|
|
- <el-button type="primary" @click="submitForm">确 定</el-button>
|
|
|
- </div>
|
|
|
- </DialogCom>
|
|
|
-
|
|
|
-
|
|
|
- <DialogCom title="添加出入人员" :visible.sync="open" width="800px" append-to-body @close="onHideUser">
|
|
|
- <el-form ref="formUser" :model="userInfo" :rules="userInfoRules" label-width="80px">
|
|
|
- <el-form-item label="人员姓名" prop="userName">
|
|
|
- <el-input v-model="userInfo.userName" placeholder="请输入姓名" />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="单位" prop="companyName">
|
|
|
- <el-input v-model="userInfo.companyName" placeholder="请输入单位" />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="证件号码" prop="idCard">
|
|
|
- <el-input v-model="userInfo.idCard" placeholder="请输入证件号码" />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item prop="imgFile" label="上传图片">
|
|
|
- <imgUpload ref="imgUpload" :limit="2" type="more" :value="userInfo.imgFile"
|
|
|
- @input="imageListChanged"></imgUpload>
|
|
|
- </el-form-item>
|
|
|
- </el-form>
|
|
|
- <div slot="footer" class="dialog-footer">
|
|
|
- <el-button @click="onHideUser">取 消</el-button>
|
|
|
- <el-button type="primary" @click="submitUser">确 定</el-button>
|
|
|
- </div>
|
|
|
- </DialogCom>
|
|
|
- </div>
|
|
|
-
|
|
|
-</template>
|
|
|
-<script>
|
|
|
-import {mapState, mapMutations} from "vuex";
|
|
|
-import { listLetter, getLetter, delLetter, addLetter, updateLetter } from "@/api/core/letter";
|
|
|
-import OrgTreeSelect from "@/components/orgTreeSelect";
|
|
|
-import KFileUpload from "@/components/K-FileUpload";
|
|
|
-import dayjs from "dayjs";
|
|
|
-import imgUpload from "@/components/ImageUpload";
|
|
|
-export default {
|
|
|
- components: {OrgTreeSelect,KFileUpload,imgUpload},
|
|
|
- data() {
|
|
|
- const params = this.$route.params;
|
|
|
- return {
|
|
|
- id: params ? params.id : null,
|
|
|
- isShow: false,
|
|
|
- formData: this.reset(),
|
|
|
- formDataRules: {
|
|
|
- letterName: [{required: true, message: "请输入介绍信名称"}],
|
|
|
- orgIds: [{required: true, message: "请选择接待机构"}],
|
|
|
- startTime: [{required: true, message: "请选择有效开始时间"}],
|
|
|
- endTime: [{required: true, message: "请选择有效结束时间"}],
|
|
|
- userInfos:[{required: true, message: "请添加出入人员"}],
|
|
|
- },
|
|
|
- userInfoRules: {
|
|
|
- userName: [{required: true, message: "请输入姓名"}],
|
|
|
- companyName: [{required: true, message: "请输入单位"}],
|
|
|
- idCard: [{required: true, message: "请输入证件号码"}],
|
|
|
- },
|
|
|
- startDatepickerOptions: {
|
|
|
- disabledDate:this.endDisabledDate,
|
|
|
- },
|
|
|
- endDatepickerOptions: {
|
|
|
- disabledDate: this.endDisabledDate,
|
|
|
- },
|
|
|
- formFileListDefualtValue: [],
|
|
|
- open: false,
|
|
|
- userInfo: this.resetUserInfo(),
|
|
|
- imageList:[],
|
|
|
- title:null,
|
|
|
- index:null,
|
|
|
- orgType:4
|
|
|
- };
|
|
|
- },
|
|
|
- dicts: ['letter_status'],
|
|
|
- props: {},
|
|
|
- watch: {},
|
|
|
- created() {
|
|
|
- },
|
|
|
- computed: {
|
|
|
- ...mapState(["loginUser", "org",]),
|
|
|
-
|
|
|
- },
|
|
|
- methods: {
|
|
|
- ...mapMutations([]),
|
|
|
- reset(other = {}) {
|
|
|
- return {
|
|
|
- letterName:null,
|
|
|
- orgIds:null,
|
|
|
- startTime: null,
|
|
|
- endTime: null,
|
|
|
- description: null,
|
|
|
- fileList: [],
|
|
|
- userInfos:null,
|
|
|
- letterFile:null,
|
|
|
- ...other,
|
|
|
- };
|
|
|
- },
|
|
|
- resetUserInfo(){
|
|
|
- return {
|
|
|
- userName: null,
|
|
|
- companyName:null,
|
|
|
- idCard:null,
|
|
|
- imgFile:null,
|
|
|
- }
|
|
|
- },
|
|
|
- splitImgFilePath(imgPaths,index){
|
|
|
- return imgPaths.split(',')[index];
|
|
|
- },
|
|
|
- async show(id, other = {}) {
|
|
|
- this.isShow = true;
|
|
|
- this.title = "新增介绍信";
|
|
|
- console.log("-----------------",id);
|
|
|
- if(id){
|
|
|
- getLetter(id).then(response => {
|
|
|
- this.formData = response.data;
|
|
|
- this.userInfos = response.data.userInfos;
|
|
|
- this.orgIds = response.data.orgIds;
|
|
|
- this.formFileListDefualtValue = response.data.letterFile;
|
|
|
- this.title = "修改介绍信";
|
|
|
- console.log("-----------------",this.formFileListDefualtValue);
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- },
|
|
|
- handleAddUser() {
|
|
|
- this.open = true;
|
|
|
- console.log(this.userInfo,'hhhh')
|
|
|
- },
|
|
|
- imageListChanged(list) {
|
|
|
- this.userInfo.imgFile = list;
|
|
|
- },
|
|
|
- endDisabledDate(time) {
|
|
|
- //小于开始日期禁止选择
|
|
|
- let startDate = new Date();
|
|
|
- startDate.setTime(startDate.getTime() - 3600 * 1000 * 24);
|
|
|
- if (this.formData.trainingStartDateTime) {
|
|
|
- startDate = new Date(dayjs(this.formData.trainingStartDateTime).format('YYYY-MM-DD'));
|
|
|
- startDate.setTime(startDate.getTime() - 3600 * 1000 * 24);
|
|
|
- }
|
|
|
- return time.getTime() < new Date(startDate).getTime()
|
|
|
-
|
|
|
- },
|
|
|
- startDateChanged(time) {
|
|
|
- if (dayjs(this.formData.startTime).isAfter(dayjs(this.formData.endTime))) {
|
|
|
- this.formData.endTime = this.formData.startTime;
|
|
|
- }
|
|
|
- },
|
|
|
- endDateChanged(time) {
|
|
|
- if (dayjs(this.formData.startTime).isAfter(dayjs(this.formData.endTime))) {
|
|
|
- this.formData.startTime = this.formData.endTime;
|
|
|
- }
|
|
|
- },
|
|
|
- onHide() {
|
|
|
- this.isShow = false;
|
|
|
- this.formData = this.reset();
|
|
|
- this.$refs["upload"].clearFiles();
|
|
|
- this.$emit('closed')
|
|
|
- },
|
|
|
- onHideUser() {
|
|
|
- this.open = false;
|
|
|
- this.imageList=[];
|
|
|
- this.userInfo = this.resetUserInfo();
|
|
|
- },
|
|
|
- submitUser(){
|
|
|
- this.$refs["formUser"].validate(valid => {
|
|
|
- if (valid) {
|
|
|
- this.open = false;
|
|
|
- console.log("================",this.userInfo);
|
|
|
- if(this.index==null){
|
|
|
- this.formData.userInfos.push(this.userInfo);
|
|
|
- }else{
|
|
|
- this.formData.userInfos[this.index]=this.userInfo;
|
|
|
- }
|
|
|
- this.userInfo = this.resetUserInfo();
|
|
|
- this.imageList=[];
|
|
|
- this.index=null;
|
|
|
- }})
|
|
|
- },
|
|
|
- submitForm(){
|
|
|
- this.$refs["form"].validate(valid => {
|
|
|
- if (valid) {
|
|
|
- if(this.formData.userInfos.length<=0){
|
|
|
- this.$message.error("请添加人员");
|
|
|
- return;
|
|
|
- }
|
|
|
- console.log("================",this.formData);
|
|
|
- if (this.formData.id != null) {
|
|
|
- updateLetter(this.formData).then(response => {
|
|
|
- this.$modal.msgSuccess("修改成功");
|
|
|
- });
|
|
|
- } else {
|
|
|
- addLetter(this.formData).then(response => {
|
|
|
- this.$modal.msgSuccess("新增成功");
|
|
|
- });
|
|
|
- }
|
|
|
- this.onHide();
|
|
|
- /* this.isShow = false;
|
|
|
- this.formData = this.reset();
|
|
|
- this.getList();
|
|
|
- this.$refs["upload"].clearFiles();*/
|
|
|
- }})
|
|
|
- },
|
|
|
- editUser(row,index){
|
|
|
- this.open = true;
|
|
|
- this.userInfo = row;
|
|
|
- this.index=index;
|
|
|
- },
|
|
|
- remove(row){
|
|
|
- console.log("================",row);
|
|
|
- this.formData.userInfos.splice(this.formData.userInfos.indexOf(row),1);
|
|
|
- }
|
|
|
-
|
|
|
- },
|
|
|
- mounted() {
|
|
|
- },
|
|
|
-};
|
|
|
-</script>
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|