123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264 |
- <template>
- <div class="reply" ref = "replyModal">
- <a-modal
- :getContainer ='()=>$refs.replyModal'
- :title="(defult == 'add')?'新增':'编辑'"
- width="75%"
- :closable="true"
- @cancel="close"
- @ok="handleSubmit"
- :visible="visible"
- destroyOnClose
- >
- <div class="table-page-search-wrapper">
- <a-form-model layout="inline" ref="form" :model="formState" :rules="validatorRules">
- <a-row :gutter="24">
- <a-col :md="8" :sm="8">
- <a-form-model-item label="证件名称" prop="name">
- <a-input placeholder="请输入" v-model="formState.name" />
- </a-form-model-item>
- </a-col>
- <a-col :md="8" :sm="8">
- <a-form-model-item label="证件所有人" prop="userId" >
- <j-search-select-tag v-model="formState.userId" placeholder="请选择用户名称"
- dict="sys_user,realname,username" @search="searchName" />
- </a-form-model-item>
- <!-- <a-form-model-item label="证件所有人" prop="userId" >
- <j-search-select-tag v-model="formState.userId" placeholder="请选择用户名称"
- dict="sys_user,realname,username" @search="searchName" style="width:71%" v-if="inputMethod =='select'"/>
- <a-input placeholder="请输入" v-model="formState.name" style="width:71%" v-if="inputMethod =='input'"/>
- <a-button type="primary" style="margin-left: 8%;" v-model="formState.name" @click="changeInputMethod">切换</a-button>
- </a-form-model-item> -->
-
- </a-col>
- <a-col :md="8" :sm="8">
- <a-form-model-item label="证件编号" prop="code">
- <a-input placeholder="请输入" v-model="formState.code"/>
- </a-form-model-item>
- </a-col>
- <a-col :md="8" :sm="8">
- <a-form-model-item label="起始日期" prop="beginDate" >
- <a-date-picker
- style="width: 100%"
- placeholder="请选择起始时间"
- v-model="formState.beginDate"
- />
- </a-form-model-item>
- </a-col>
- <a-col :md="8" :sm="8">
- <a-form-model-item label="到期时间" prop="endDate">
- <a-date-picker
- style="width: 100%"
- placeholder="请选择到期时间"
- v-model="formState.endDate"
- />
- </a-form-model-item>
- </a-col>
- <a-col :md="8" :sm="8">
- <a-form-model-item label="管理人" prop="manageId">
- <j-search-select-tag v-model="formState.manageId" placeholder="请选择用户名称"
- dict="sys_user,realname,username"/>
- <!-- <a-input placeholder="请输入" v-model="formState.manageId"/> -->
- </a-form-model-item>
-
- </a-col>
- <a-col :md="8" :sm="8">
- <a-form-model-item label="提前通知时间/月" prop="noticeMonth">
- <a-input placeholder="请输入" v-model="formState.noticeMonth"/>
- </a-form-model-item>
- </a-col>
- <!-- <a-col :md="8" :sm="8">
- <a-form-model-item label="是否邮件通知" prop="isMessage">
- <a-select v-model="formState.isMessage">
- <a-select-option value="1">是</a-select-option>
- <a-select-option value="0">否</a-select-option>
- </a-select>
- </a-form-model-item>
- </a-col> -->
- </a-row>
- <a-row :gutter="24">
- <a-col :md="24" :sm="8">
- <a-form-item label="附件上传" class="upload">
- <a-upload :action="url.fileUpload" @change="aaa" :default-file-list="fileList" list-type="picture" :beforeUpload="beforeFileUpload">
- <a-button>
- <a-icon type="upload"/>上传
- </a-button>
- <div v-if="defult == 'edit'">
- <a @click="downloadFile">{{formState.enclosure}}</a>
- </div>
- </a-upload>
- </a-form-item>
- <!-- <a-form-model-item label="附件上传">
- <j-upload v-model="formState.enclosure">上传</j-upload>
- </a-form-model-item> -->
- </a-col>
- </a-row>
- <a-row :gutter="24">
- <a-col :md="24" :sm="8">
- <a-form-model-item label="备注信息" class="nresume" style="height:100px !important">
- <a-input type="textarea" placeholder="请输入" v-model="formState.remarks"/>
- </a-form-model-item>
- </a-col>
- </a-row>
- </a-form-model>
- </div>
- </a-modal>
- </div>
- </template>
- <script>
- import {
- managementAdd,
- managementEdit
- } from '@api/oa/cd-certificate-management'
- import JUpload from '@/components/jeecg/JUpload'
- import JSearchSelectTag from '@/components/dict/JSearchSelectTag'
- import moment from 'moment'
- import { downFile } from '@/api/manage'
- export default {
- name: 'AddCertificateManagement',
- components: {
- moment,
- JUpload,
- JSearchSelectTag
- },
- data () {
- return {
- visible:false,
- defult:'add',
- formState:{
- endDate:'',
- beginDate:'',
- isMessage:'1'
- },
- inputMethod:'select',
- fileList:[],
- confirmLoading: false,
- validatorRules: {
- name:[{required: true, message: '证件名称不能为空!'}],
- userId:[{required: true, message: '证件所有人不能为空!'}],
- noticeMonth:[{required: true, message: '提前通知时间不能为空!'},{ pattern: new RegExp(/^([0-9]{1,2}|100)$/, "g"), message: '只能输入正整数!'}],
- code:[{required: true, message: '证件编号不能为空!'}],
- manageId:[{required: true, message: '管理人不能为空!'}],
- isMessage:[{required: true, message: '是否邮件通知不能为空!'}],
- beginDate:[{required: true, message: '起始日期不能为空!'}],
- endDate:[{required: true, message: '到期时间不能为空!'}],
- },
- url: {
- fileUpload: window._CONFIG['domianURL'] + "/sys/common/upload",
- dowfile:window._CONFIG['domianURL'] +"/sys/common/static/"
- }
- }
- },
- created () {
-
- },
- computed: {
-
- },
- methods: {
- //下载
- downloadFile(){
- window.location.href =this.url.dowfile + this.formState.enclosure;
- },
- beforeFileUpload(file, fileList){
- if(fileList.lenght >1 || this.fileList.length>=1){
- this.$message.error('只可上传一个文件');
- }
- },
- aaa(info) {
- if(info.file.status !=='error'){
- this.formState.enclosure = info.file.response.message
- this.fileList.push(info.file.response.message)
- }else{
- this.formState.enclosure = ''
- }
- },
- close(){
- this.visible = false
- this.formState={}
- this.defult='add',
- this.enDate=''
- this.beDate=''
- this.fileList =[]
- },
- changeInputMethod(){
- if(this.inputMethod == 'select'){
- this.inputMethod = 'input'
- }else{
- this.inputMethod = 'select'
- }
- },
- handleSubmit(){
- this.$refs.form.validate(valid => {
- if(valid){
- // this.formState.isMessage = '是'
- var newobj = this.formState
- newobj.beginDate = moment(this.formState.beginDate).format('YYYY-MM-DD');
- newobj.endDate = moment(this.formState.endDate).format('YYYY-MM-DD');
- if(this.defult == 'add'){
- managementAdd(newobj).then(res => {
- if (res.success) {
- this.$message.success('新增成功');
- this.close()
- this.$emit('close')
- }else{
- this.$message.error(res.message);
- }
- })
- }else {
- managementEdit(newobj).then(res => {
- if (res.success) {
- this.$message.success('编辑成功');
- this.close()
- this.$emit('close')
- }else{
- this.$message.error(res.message);
- this.$message.error(res.message);
- }
- })
- }
- }
- })
-
-
- }
- }
- }
- </script>
- <style scoped lang="less">
- // /deep/.ant-form{
- // display: flex;
- // width: 100%;
- // flex-wrap: wrap;
- // justify-content: start;
- // }
- // /deep/ .ant-form-item{
- // display: flex;
- // width: 32%;
- // justify-content: start;
- // }
- // /deep/ .ant-form-item-label{
- // width: 37%;
- // }
- // .nresume{
- // width: 100% !important;
- // }
- // /deep/ .nresume .ant-form-item-label{
- // width: 12% !important;
- // }
- // /deep/ .nresume .ant-form-item-control-wrapper{
- // width: 82% !important;
- // }
- /deep/ .nresume .ant-input{
- height: 100px !important;
- }
- /deep/ .upload .ant-form-item-control{
- display: contents !important;
- }
- </style>
|