| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332 |
- <!DOCTYPE html>
- <html>
- <head>
- <title>展商</title>
- <#include "../../include/head-file.ftl">
- </head>
- <body>
- <div id="form" v-cloak>
- <el-header class="ms-header ms-tr" height="50px">
- <el-button type="primary" class="iconfont icon-baocun" size="default" @click="save()" :loading="saveDisabled">保存</el-button>
- <el-button size="default" class="iconfont icon-fanhui" plain @click="back()">返回</el-button>
- </el-header>
- <el-main class="ms-container" v-loading="loading">
- <el-form ref="form" :model="form" :rules="rules" label-width="120px" label-position="right" size="default">
- <!--公司名称-->
- <el-form-item label="公司名称" prop="exhibitorName">
- <el-input
- v-model="form.exhibitorName"
- :disabled="false"
- :readonly="false"
- :style="{width: '100%'}"
- :clearable="true"
- placeholder="请输入公司名称">
- </el-input>
- </el-form-item>
- <!--展位号-->
- <el-form-item label="展位号" prop="exhibitorBooth">
- <el-input
- v-model="form.exhibitorBooth"
- :disabled="false"
- :readonly="false"
- :style="{width: '100%'}"
- :clearable="true"
- placeholder="请输入展位号">
- </el-input>
- </el-form-item>
- <!--联系人-->
- <el-form-item label="联系人" prop="exhibitorContact">
- <el-input
- v-model="form.exhibitorContact"
- :disabled="false"
- :readonly="false"
- :style="{width: '100%'}"
- :clearable="true"
- placeholder="请输入联系人">
- </el-input>
- </el-form-item>
- <!--联系电话-->
- <el-form-item label="联系电话" prop="exhibitorPhone">
- <el-input
- v-model="form.exhibitorPhone"
- :disabled="false"
- :readonly="false"
- :style="{width: '100%'}"
- :clearable="true"
- placeholder="请输入联系电话">
- </el-input>
- </el-form-item>
- <!--公司LOGO-->
-
- <el-form-item label="公司LOGO" prop="exhibitorLogo">
- <el-upload
- :file-list="form.exhibitorLogo"
- :action="ms.manager+'/file/upload.do'"
- :limit="1"
- multiple
- :disabled="false"
- :data="{uploadPath:'/tf/','isRename':true,'appId':true}"
- :on-remove="exhibitorLogoHandleRemove"
- :on-exceed="exhibitorLogoHandleExceed"
- :on-preview="exhibitorLogoHandlePreview"
- :before-upload="exhibitorLogoBeforeUpload"
- :on-success="exhibitorLogoSuccess"
- :on-error="exhibitorLogoError"
- accept="image/*"
- list-type="picture-card">
- <i class="el-icon-plus"></i>
- <template #tip>
- <div class="el-upload__tip">最多上传1张图片</div>
- </template>
- </el-upload>
- </el-form-item>
-
- <!--公司简介-->
- <el-form-item label="公司简介" prop="exhibitorIntroduction">
- <el-input
- type="textarea" :rows="5"
- :disabled="false"
- v-model="form.exhibitorIntroduction"
- :style="{width: '100%'}"
- placeholder="请输入公司简介">
- </el-input>
- </el-form-item>
-
- <!--用户ID-->
- <!--展会ID-->
- <!--邀请码-->
- </el-form>
- </el-main>
- </div>
- </body>
- </html>
- <script>
- var formVue = new _Vue({
- el: '#form',
- data:function() {
- return {
- loading:false,
- saveDisabled: false,
- //表单数据
- form: {
- // 公司名称
- exhibitorName:'',
- // 展位号
- exhibitorBooth:'',
- // 联系人
- exhibitorContact:'',
- // 联系电话
- exhibitorPhone:'',
- // 公司LOGO
- exhibitorLogo: [],
- // 公司简介
- exhibitorIntroduction:'',
- // 用户ID
- exhibitorUser:'',
- // 展会ID
- exhibitorActivities:'',
- // 邀请码
- exhibitorCode:'',
- },
- rules:{
- // 公司名称
- exhibitorName: [{"required":true,"message":"公司名称不能为空"},{"min":0,"max":255,"message":"公司名称长度必须为0-255"}],
- // 展位号
- exhibitorBooth: [{"required":true,"message":"展位号不能为空"},{"min":0,"max":255,"message":"展位号长度必须为0-255"}],
- // 联系人
- exhibitorContact: [{"min":0,"max":255,"message":"联系人长度必须为0-255"}],
- // 联系电话
- exhibitorPhone: [{"min":0,"max":255,"message":"联系电话长度必须为0-255"}],
- // 用户ID
- exhibitorUser: [{"min":0,"max":255,"message":"用户ID长度必须为0-255"}],
- // 展会ID
- exhibitorActivities: [{"min":0,"max":255,"message":"展会ID长度必须为0-255"}],
- // 邀请码
- exhibitorCode: [{"min":0,"max":255,"message":"邀请码长度必须为0-255"}],
- },
- }
- },
- watch:{
- },
- components:{
- },
- computed:{
- },
- methods: {
- back: function (){
- ms.util.openSystemUrl("/tf/exhibitor/index.do",true);
- },
- save:function() {
- var that = this;
- var url = ms.manager + "/tf/exhibitor/save.do"
- if (that.form.id > 0) {
- url = ms.manager + "/tf/exhibitor/update.do";
- }
- this.$refs.form.validate(function(valid) {
- if (valid) {
- that.saveDisabled = true;
- var form = JSON.parse(JSON.stringify(that.form));
- if (form.exhibitorLogo.length>0) {
- form.exhibitorLogo.forEach(function (value) {
- value.url = value.url.replace(new RegExp('^'+ms.contextpath), "");
- });
- form.exhibitorLogo = JSON.stringify(form.exhibitorLogo);
- } else {
- form.exhibitorLogo = '';
- }
- ms.http.post(url, form).then(function (res) {
- if (res.result) {
- that.$notify({
- title: "成功",
- message: "保存成功",
- type: 'success'
- });
- ms.util.openSystemUrl("/tf/exhibitor/index.do",that.form.id > 0);
- } else {
- that.$notify({
- title: "错误",
- message: res.msg,
- type: 'warning'
- });
- }
- that.saveDisabled = false;
- }).catch(function (err) {
- console.log(err);
- that.saveDisabled = false;
- });
- } else {
- return false;
- }
- })
- },
- //获取当前展商
- get:function(id) {
- var that = this;
- this.loading = true
- ms.http.get(ms.manager + "/tf/exhibitor/get.do", {"id":id}).then(function (res) {
- that.loading = false
- if(res.result&&res.data) {
- if (res.data.exhibitorLogo) {
- res.data.exhibitorLogo = JSON.parse(res.data.exhibitorLogo);
- res.data.exhibitorLogo.forEach(function (value) {
- if(!value.url.startsWith("http://") && !value.url.startsWith("https://")){
- value.url = ms.contextpath + value.url;
- }
- });
- } else {
- res.data.exhibitorLogo = [];
- }
-
- that.form = res.data;
- }
- });
- },
- // exhibitorLogo删除
- exhibitorLogoHandleRemove: function (file, files) {
- var index = -1;
- index = this.form.exhibitorLogo.findIndex(function (text) {
- return text.uid == file.uid;
- });
- if (index != -1) {
- this.form.exhibitorLogo.splice(index, 1);
- }
- },
- //exhibitorLogo上传超过限制
- exhibitorLogoHandleExceed: function (files, fileList) {
- this.$notify({
- title: '失败',
- message: '当前最多上传1个文件',
- type: 'warning'
- });
- },
- //exhibitorLogo预览
- exhibitorLogoHandlePreview: function (file){
- window.open(file.url);
- },
- //exhibitorLogo上传前
- exhibitorLogoBeforeUpload: function (file) {
- var type = file.type;
- if (type) {
- var isImage = type.startsWith('image/');
- if (!isImage) {
- this.$notify({
- title: '提示',
- message: '请上传图片类型文件',
- type: 'warning'
- });
- }
- return isImage;
- }
- return false;
- },
- //exhibitorLogo上传成功
- exhibitorLogoSuccess: function (response, file, fileList) {
- if (response.result) {
- if(!response.data.startsWith("http://") && !response.data.startsWith("https://")) {
- file.url = ms.contextpath + response.data;
- }else{
- file.url = response.data;
- }
- this.form.exhibitorLogo.push({
- url: response.data,
- name: file.name,
- uid: file.uid
- });
- } else {
- // 移除上传图片
- var index = fileList.indexOf(file);
- if (index > -1) {
- fileList.splice(index, 1);
- }
- this.$notify({
- title: '失败',
- message: response.msg,
- type: 'warning'
- });
- }
- },
- //exhibitorLogo上传失败
- exhibitorLogoError: function (response, file, fileList) {
- response = JSON.parse(response.message);
- this.$notify({
- title: '失败',
- message: response.msg,
- type: 'warning'
- });
- }, },
- created:function() {
- var that = this;
- this.form.id = ms.util.getParameter("id");
- if (this.form.id) {
- this.get(this.form.id);
- }
- }
- });
- </script>
- <style scoped>
- </style>
|