123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543 |
- <template>
- <div class="car_add">
- <div>
- <div class="communal-title">
- <div>{{ title }}</div>
- </div>
- </div>
- <hr style='background-color:#5555; height:1px; border:none;margin: 10px 0;' />
- <div>
- <el-form :model="OpInvitationOfficialActivityData" ref="OpInvitationOfficialActivityData"
- :rules="OpInvitationOfficialActivityDataRules" label-width="100px" class="demo-ruleForm">
- <div style="display:flex ;">
- <div style="width: 25%;">
- <el-form-item label="国家:" prop="country" label-width="160px">
- <el-input clearable placeholder="国家" v-model="OpInvitationOfficialActivityData.country">
- </el-input>
- </el-form-item>
- </div>
- <div style="width: 25%;">
- <el-form-item label="城市:" prop="city" label-width="160px">
- <el-input clearable placeholder="城市" v-model="OpInvitationOfficialActivityData.city">
- </el-input>
- </el-form-item>
- </div>
- <div style="width: 25%;">
- <el-form-item label="邀请方名称:" prop="unitName" label-width="160px">
- <el-input clearable placeholder="邀请方名称" v-model="OpInvitationOfficialActivityData.unitName">
- </el-input>
- </el-form-item>
- </div>
- <div style="width: 25%;">
- <el-form-item label="邀请方官网:" prop="unitWeb" label-width="160px">
- <el-input clearable placeholder="邀请方官网" v-model="OpInvitationOfficialActivityData.unitWeb">
- </el-input>
- </el-form-item>
- </div>
- </div>
- <div style="display:flex ;">
- <div style="width: 25%;">
- <el-form-item label="涉及领域:" prop="field" label-width="160px">
- <el-input clearable placeholder="涉及领域" v-model="OpInvitationOfficialActivityData.field">
- </el-input>
- </el-form-item>
- </div>
- <div style="width: 25%;">
- <el-form-item label="邀请方地址:" prop="address" label-width="160px">
- <el-input clearable placeholder="邀请方地址" v-model="OpInvitationOfficialActivityData.address">
- </el-input>
- </el-form-item>
- </div>
- <div style="width: 25%;">
- <el-form-item label="邀请方信息:" prop="unitInfo" label-width="160px">
- <el-input clearable placeholder="邀请方信息" v-model="OpInvitationOfficialActivityData.unitInfo">
- </el-input>
- </el-form-item>
- </div>
- <div style="width: 25%;">
- <el-form-item label="联系人:" prop="contact" label-width="160px">
- <el-input clearable placeholder="联系人" v-model="OpInvitationOfficialActivityData.contact">
- </el-input>
- </el-form-item>
- </div>
- </div>
- <div style="display:flex ;">
- <div style="width: 25%;">
- <el-form-item label="联系人职务:" prop="job" label-width="160px">
- <el-input clearable placeholder="联系人职务" v-model="OpInvitationOfficialActivityData.job">
- </el-input>
- </el-form-item>
- </div>
- <div style="width: 25%;">
- <el-form-item label="联系电话:" prop="tel" label-width="160px">
- <el-input clearable placeholder="联系电话" v-model="OpInvitationOfficialActivityData.tel">
- </el-input>
- </el-form-item>
- </div>
- <div style="width: 25%;">
- <el-form-item label="电子邮箱:" prop="email" label-width="160px">
- <el-input clearable placeholder="电子邮箱" v-model="OpInvitationOfficialActivityData.email">
- </el-input>
- </el-form-item>
- </div>
- <div style="width: 25%;">
- <el-form-item label="微信:" prop="weChat" label-width="160px">
- <el-input clearable placeholder="微信" v-model="OpInvitationOfficialActivityData.weChat">
- </el-input>
- </el-form-item>
- </div>
- </div>
- <div style="display:flex ;">
- <div style="width: 25%;">
- <el-form-item label="FaceBook:" prop="faceBook" label-width="160px">
- <el-input clearable placeholder="faceBook" v-model="OpInvitationOfficialActivityData.faceBook">
- </el-input>
- </el-form-item>
- </div>
- <div style="width: 25%;">
- <el-form-item label="Ins:" prop="ins" label-width="160px">
- <el-input clearable placeholder="ins" v-model="OpInvitationOfficialActivityData.ins">
- </el-input>
- </el-form-item>
- </div>
- <div style="width: 25%;">
- <el-form-item label="传真号码:" prop="fax" label-width="160px">
- <el-input clearable placeholder="传真号码" v-model="OpInvitationOfficialActivityData.fax">
- </el-input>
- </el-form-item>
- </div>
- <div style="width: 25%;">
- <el-form-item label="团组名称:" label-width="160px">
- <el-select style="width: 100%;" v-model="OpInvitationOfficialActivityData.delegation" clearable filterable multiple
- placeholder="团组名称">
- <el-option v-for="item in DelegationList" :key="item.id" :label="item.groupName"
- :value="item.id">
- </el-option>
- </el-select>
- </el-form-item>
- </div>
- </div>
- <div style="display:flex ;">
- <div style="width: 50%;">
- <el-form-item label="邀请函文件(原版):" prop="fileUrl" label-width="160px">
- <div>
- {{ OpInvitationOfficialActivityData.filePath }} <el-link
- @click="DownloadOdl">下载原版文件</el-link>
- </div>
- </el-form-item>
- <el-form-item label="邀请函文件(修改版):" prop="fileUrl" label-width="160px">
- <el-upload :file-list="uploadFiles" ref="upload" :on-success="upLoadSuccess"
- :on-error="upLoadError" :before-remove="beforeRemove" :on-change="onChange" :limit="1"
- :on-exceed="exceed" :action="uploadURL" :headers="headers" :auto-upload="false">
- <el-button slot="trigger" size="small" type="primary">选取文件</el-button>
- <!-- <el-button style="margin-left: 10px;" size="small" type="success"
- @click="submitUpload">上传到服务器</el-button> -->
- </el-upload>
- </el-form-item>
- </div>
- <div style="width: 50%;">
- <el-form-item label="其他信息:" prop="remark" label-width="160px">
- <el-input type="textarea" :rows="5" placeholder="其他信息"
- v-model="OpInvitationOfficialActivityData.remark"></el-input>
- </el-form-item>
- </div>
- </div>
- <el-form-item>
- <div style="text-align: right;">
- <el-button type="primary" @click="addBtn">保存</el-button>
- <router-link to='/home/InvitationOfficialActivityData'>
- <el-button>取消</el-button>
- </router-link>
- </div>
- </el-form-item>
- </el-form>
- </div>
- </div>
- </template>
- <script>
- export default {
- data() {
- return {
- title: "新增商邀资料",
- token: '',
- userId: 0,
- OpInvitationByIdData: {},
- OpInvitationOfficialActivityData: {
- status: 0,
- id: 0,
- country: '',
- city: '',
- unitName: '',
- unitWeb: '',
- field: '',
- address: '',
- unitInfo: '',
- contact: '',
- job: '',
- tel: '',
- email: '',
- weChat: '',
- faceBook: '',
- ins: '',
- delegation: [],
- filePath: '',
- sndFilePath: '',
- fax: '',
- createUserId: 0,
- remark: ''
- },
- OpInvitationOfficialActivityDataRules: {
- country: [
- { required: true, message: '请输入国家', trigger: 'blur' },
- { required: true, message: '请输入国家', trigger: 'change' }
- ],
- city: [
- { required: true, message: '请输入城市', trigger: 'blur' },
- { required: true, message: '请输入城市', trigger: 'change' }
- ],
- unitName: [
- { required: true, message: '请输入邀请方名称', trigger: 'blur' },
- { required: true, message: '请输入邀请方名称', trigger: 'change' }
- ],
- field: [
- { required: true, message: '请输入涉及领域', trigger: 'blur' },
- { required: true, message: '请输入涉及领域', trigger: 'change' }
- ],
- address: [
- { required: true, message: '请输入邀请方地址', trigger: 'blur' },
- { required: true, message: '请输入邀请方地址', trigger: 'change' }
- ],
- contact: [
- { required: true, message: '请输入联系人', trigger: 'blur' },
- { required: true, message: '请输入联系人', trigger: 'change' }
- ],
- tel: [
- { required: true, message: '请输入联系方式', trigger: 'blur' },
- { required: true, message: '请输入联系方式', trigger: 'change' }
- ],
- delegation: [
- { type: "array", required: true, message: '请选择关联团组', trigger: ['blur', 'change'] },
- ],
- },
- DelegationList: [],
- uploadFiles: [],//上传的文件列表
- uploadURL: "http://132.232.92.186:8888/api/Groups/UploadProject",
- headers: {
- Authorization: JSON.parse(localStorage.getItem('userinif')).token,
- TypeName: "B"
- },
- OldFile: '',
- NewFile: '',
- }
- },
- methods: {
- //团组数据
- GetGroupNameList() {
- var url = "/api/Business/GetGroupNameList"
- var that = this
- this.$axios({
- method: 'post',
- url: url,
- headers: {
- Authorization: 'Bearer ' + this.token
- },
- data: {
- PortType: 1
- }
- }).then(function (res) {
- console.log(res)
- if (res.data.code == 200) {
- that.DelegationList = res.data.data;
- }
- }).catch(function (error) {
- that.loading = false
- that.$message.error("网络错误,请稍后重试");
- });
- },
- QueryInvitationOfficialActivityById() {
- var url = "/api/Resource/QueryInvitationOfficialActivityById"
- var that = this
- this.$axios({
- method: 'post',
- url: url,
- headers: {
- Authorization: 'Bearer ' + this.token
- },
- data: {
- Id: that.OpInvitationOfficialActivityData.id
- }
- }).then(function (res) {
- if (res.data.code == 200) {
- that.OpInvitationOfficialActivityData.id = res.data.data.id
- that.OpInvitationOfficialActivityData.country = res.data.data.country
- that.OpInvitationOfficialActivityData.city = res.data.data.city
- that.OpInvitationOfficialActivityData.unitName = res.data.data.unitName
- that.OpInvitationOfficialActivityData.unitWeb = res.data.data.unitWeb
- that.OpInvitationOfficialActivityData.field = res.data.data.field
- that.OpInvitationOfficialActivityData.address = res.data.data.address
- that.OpInvitationOfficialActivityData.unitInfo = res.data.data.unitInfo
- that.OpInvitationOfficialActivityData.contact = res.data.data.contact
- that.OpInvitationOfficialActivityData.job = res.data.data.job
- that.OpInvitationOfficialActivityData.tel = res.data.data.tel
- that.OpInvitationOfficialActivityData.email = res.data.data.email
- that.OpInvitationOfficialActivityData.weChat = res.data.data.weChat
- that.OpInvitationOfficialActivityData.faceBook = res.data.data.faceBook
- that.OpInvitationOfficialActivityData.ins = res.data.data.ins
- var delList = res.data.data.delegation.split(',')
- console.log(res.data.data.delegation)
- var delegaLOist = [];
- if (res.data.data.delegation) {
- delList.forEach(function (item, index) {
- delegaLOist.push(
- parseInt(item)
- )
- });
- }else{
- delegaLOist=''
- }
- that.OpInvitationOfficialActivityData.delegation = delegaLOist
- that.OpInvitationOfficialActivityData.filePath = res.data.data.filePath
- that.OpInvitationOfficialActivityData.sndFilePath = res.data.data.sndFilePath
- that.OpInvitationOfficialActivityData.fax = res.data.data.fax
- that.OpInvitationOfficialActivityData.createUserId = res.data.data.createUserId
- that.OpInvitationOfficialActivityData.remark = res.data.data.remark
- if (that.OpInvitationOfficialActivityData.filePath != null && that.OpInvitationOfficialActivityData.filePath != undefined && that.OpInvitationOfficialActivityData.filePath != "") {
- that.uploadFiles.push({
- name: that.OpInvitationOfficialActivityData.sndFilePath,
- url: 'http://132.232.92.186:24/Office/GrpFile/团组增减款项相关文件/',
- })
- }
- }
- })
- },
- //点击保存事件
- addBtn() {
- const that = this;
- that.OpInvitationOfficialActivityData.createUserId = that.userId
- that.$refs.OpInvitationOfficialActivityData.validate((valid) => {
- if (valid) {
- console.log(that.uploadFiles.length);
- console.log(that.uploadFiles);
- if (that.uploadFiles.length != 0 && that.uploadFiles[0].name!= that.OpInvitationOfficialActivityData.sndFilePath) {
- that.$refs.upload.submit();//上传文件到服务器
- }
- var delegationStr = '';
- if(that.OpInvitationOfficialActivityData.delegation){
- that.OpInvitationOfficialActivityData.delegation.forEach(function (item, index) {
- delegationStr += item + ','
- });
- that.OpInvitationOfficialActivityData.delegation = delegationStr.substring(0, delegationStr.length - 1)
- }
- var url = "/api/Resource/OpInvitationOfficialActivity"
- that.$axios({
- method: 'post',
- url: url,
- headers: {
- Authorization: 'Bearer ' + that.token
- },
- data: that.OpInvitationOfficialActivityData
- }).then(function (res) {
- if (res.data.code == 200) {
- console.log(that.OpInvitationOfficialActivityData.delegation);
- var delList = that.OpInvitationOfficialActivityData.delegation.split(',')
- var delegaLOist = [];
- console.log(delList);
- if(delList){
- delList.forEach(function (item, index) {
- delegaLOist.push(
- parseInt(item)
- )
- });
- that.OpInvitationOfficialActivityData.delegation = delegaLOist
- }
- that.$message({
- message: res.data.msg,
- type: 'success'
- });
- that.loading = true;
- setTimeout(() => {
- that.$router.push('/home/InvitationOfficialActivityData')
- }, 3000);
- } else {
- that.$message.error(res.data.msg);
- }
- })
- } else {
- var delList = this.OpInvitationOfficialActivityData.delegation.split(',')
- var delegaLOist = [];
- delList.forEach(function (item, index) {
- delegaLOist.push(
- parseInt(item)
- )
- });
- this.OpInvitationOfficialActivityData.delegation = delegaLOist
- this.$message.error('请完善信息在保存!');
- return false;
- }
- })
- },
- //上传
- // 文件超出限制
- exceed(files, fileList) {
- this.$message.warning(
- `当前限制选择 1个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length
- } 个文件,请取消要替换的文件`
- );
- },
- //文件上传成功时的钩子
- upLoadSuccess(response, file, fileList) {
- if (response.code == 200) {
- console.log("上传成功");
- this.$refs.OpInvitationOfficialActivityData.validate((valid) => {
- if (valid) {
- const that = this;
- that.OpInvitationOfficialActivityData.filePath = that.OldFile;
- that.OpInvitationOfficialActivityData.sndFilePath = response.data;
- that.OpInvitationOfficialActivityData.createUserId = that.userId
- var url = "/api/Resource/OpInvitationOfficialActivity"
- that.$axios({
- method: 'post',
- url: url,
- headers: {
- Authorization: 'Bearer ' + that.token
- },
- data: that.OpInvitationOfficialActivityData
- }).then(function (res) {
- if (res.data.code == 200) {
- that.$message({
- message: res.data.msg,
- type: 'success'
- });
- that.loading = true;
- setTimeout(() => {
- that.$router.push('/home/InvitationOfficialActivityData')
- }, 3000);
- } else {
- that.$message.error(res.data.msg);
- }
- })
- } else {
- var delList = this.OpInvitationOfficialActivityData.delegation.split(',')
- var delegaLOist = [];
- delList.forEach(function (item, index) {
- delegaLOist.push(
- parseInt(item)
- )
- });
- this.OpInvitationOfficialActivityData.delegation = delegaLOist
- this.$message.error('请完善信息在保存!');
- return false;
- }
- })
- } else {
- console.log("保存失败");
- }
- },
- //文件上传失败时的钩子
- upLoadError(response, file, fileList) {
- console.log("项目添加失败");
- },
- //删除文件之前的钩子,参数为上传的文件和文件列表,若返回 false 或者返回 Promise 且被 reject,则停止删除。
- beforeRemove(file, fileList) {
- this.uploadFiles = fileList;
- this.OldFile = this.OpInvitationOfficialActivityData.filePath
- this.NewFile = file.name
- },
- //文件状态改变时的钩子,添加文件、上传成功和上传失败时都会被调用
- onChange(file, fileList) {
- this.uploadFiles = fileList
- this.OldFile = this.OpInvitationOfficialActivityData.sndFilePath
- this.OpInvitationOfficialActivityData.filePath = this.OldFile
- this.NewFile = file.name
- },
- DownloadOdl() {
- if (this.OpInvitationOfficialActivityData.filePath != "") {
- window.location.href = "http://132.232.92.186:24/Office/GrpFile/商邀相关文件/" + this.OpInvitationOfficialActivityData.filePath
- } else {
- this.$message.error("暂未上传附件");
- }
- }
- },
- mounted() {
- this.token = JSON.parse(localStorage.getItem('userinif')).token;
- this.userId = JSON.parse(localStorage.getItem('userinif')).userInfo.userId
- this.GetGroupNameList();
- this.id = this.$route.query.id
- if (this.id != null && this.id != undefined && this.id != 0) {
- this.title = "修改邀请资料";
- this.OpInvitationOfficialActivityData.status = 2
- this.OpInvitationOfficialActivityData.id = this.id
- this.QueryInvitationOfficialActivityById();
- } else {
- this.OpInvitationOfficialActivityData.status = 1
- this.title = "新增邀请资料"
- }
- }
- }
- </script>
- <style>
- .communal-list {
- background-color: #fff;
- padding: 10px;
- box-shadow: 0 0 5px #0005;
- border-radius: 10px;
- }
- .car_add .communal-title {
- display: flex;
- font-size: 17px;
- font-weight: 600;
- color: #555;
- margin-bottom: 20px;
- justify-content: space-between;
- align-items: center;
- }
- .appraise-box {
- display: flex;
- flex-wrap: wrap;
- justify-content: space-between;
- margin: 50px 0;
- }
- .appraise-box>div {
- width: 30%;
- }
- .communal-box {
- display: flex;
- }
- .communal-box>button {
- margin-left: 10px;
- padding: 8px 20px;
- }
- .car_add {
- background-color: #fff;
- padding: 20px;
- box-shadow: 0 0 5px #0005;
- border-radius: 10px;
- }
- @media screen and (max-width: 1700px) {
- .appraise-box>div {
- width: 48%;
- }
- .appraise-box>div el-form-item__content {
- width: 260px !important;
- }
- }
- </style>
|