Bladeren bron

:recycle: jdbc长度设置为256 ,success 重构,头像上传配置

冷冷 5 jaren geleden
bovenliggende
commit
fd96cbd0b6

+ 1 - 0
package.json

@@ -11,6 +11,7 @@
   "dependencies": {
     "@xkeshi/vue-qrcode": "^1.0.0",
     "avue-plugin-formdesign": "^1.0.1",
+    "avue-plugin-ueditor": "^0.0.6",
     "axios": "^0.18.0",
     "babel-polyfill": "^6.26.0",
     "classlist-polyfill": "^1.2.0",

+ 11 - 5
src/const/crud/activiti/leave-bill.js

@@ -71,13 +71,19 @@ export const tableOption = {
       addDisplay: false
     },
     {
+      hide: true,
       label: '备注',
       prop: 'content',
-      type: 'textarea',
-      overHidden: true,
-      minRows: 2,
-      row: true,
-      span: 24
+      type: 'ueditor',
+      component: 'ueditor',
+      span: 24,
+      options: {
+        action: "/admin/sys-file/upload",
+        props: {
+          res: "data",
+          url: "url"
+        },
+      }
     }
   ]
 }

+ 30 - 9
src/const/crud/admin/sys-file.js

@@ -24,40 +24,61 @@ export const tableOption = {
   align: 'center',
   viewBtn:false,
   editBtn:false,
-  addBtn: false,
+  saveBtn: false,
+  addBtn: true,
   column: [
 	  {
       label: '编号',
       prop: 'id',
-      hide: true
+      hide: true,
+      addDisplay: false
+    },
+    {
+      hide: true,
+      label: '附件上传',
+      prop: 'imgUrl',
+      type: 'upload',
+      loadText: '附件上传中,请稍等',
+      span: 24,
+      propsHttp: {
+        res: 'data'
+      },
+      tip: '上传同步至文件服务器',
+      action: "/admin/sys-file/upload"
     },
     {
       label: '空间',
       prop: 'bucketName',
-      overHidden:true
+      overHidden:true,
+      addDisplay: false
     },
 	  {
       label: '文件名',
       prop: 'fileName',
       overHidden:true,
-      search: true
+      search: true,
+      addDisplay: false
     },
 	  {
       label: '原文件名',
       prop: 'original',
-      overHidden:true
+      overHidden:true,
+      addDisplay: false
     },
 	  {
       label: '文件类型',
-      prop: 'type'
+      prop: 'type',
+      addDisplay: false
     },
 	  {
       label: '文件大小',
-      prop: 'fileSize'
+      prop: 'fileSize',
+      addDisplay: false
     },
     {
       label: '上传人',
-      prop: 'createUser'
+      prop: 'createUser',
+      addDisplay: false
     },
     {
       width: 180,
@@ -68,7 +89,7 @@ export const tableOption = {
       valueFormat: 'yyyy-MM-dd HH:mm:ss',
       editDisabled: true,
       addDisplay: false,
-      span: 24
+      span: 24,
     }
   ]
 }

+ 1 - 1
src/const/crud/gen/gen.js

@@ -142,7 +142,7 @@ export const tableDsOption = {
       overHidden: true,
       rules: [
         { required: true, message: '请输入jdbcUrl', trigger: 'blur' },
-        { max: 128, message: '长度在 128 个字符内', trigger: 'blur' }
+        { max: 256, message: '长度在 256 个字符内', trigger: 'blur' }
       ]
     },
     {

+ 1 - 1
src/page/index/top/index.vue

@@ -176,7 +176,7 @@ export default {
         type: 'warning'
       }).then(() => {
         this.$store.dispatch('LogOut').then(() => {
-          this.$router.push({ path: '/login' })
+            this.$router.push({ path: '/login' })
         })
       })
     }

+ 4 - 4
src/util/util.js

@@ -312,9 +312,9 @@ export const openWindow = (url, title, w, h) => {
  *  <img> <a> src 处理
  * @returns {PromiseLike<T | never> | Promise<T | never>}
  */
-export function handleImg(fileName, id) {
-  return validatenull(fileName) ? null : request({
-    url: '/admin/sys-file/' + fileName,
+export function handleImg(url, id) {
+  return validatenull(url) ? null : request({
+    url:  url,
     method: 'get',
     responseType: 'blob'
   }).then((response) => { // 处理返回的文件流
@@ -329,7 +329,7 @@ export function handleImg(fileName, id) {
 
 export function handleDown(filename, bucket) {
   return request({
-    url: '/admin/sys-file/' + bucket + '-' + filename,
+    url: '/admin/sys-file/' + bucket + '/' + filename,
     method: 'get',
     responseType: 'blob'
   }).then((response) => { // 处理返回的文件流

+ 4 - 0
src/views/activiti/leave.vue

@@ -65,9 +65,13 @@
 <script>
 import { addObj, delObj, fetchList, putObj, submit } from '@/api/activiti/leave-bill'
 import { tableOption } from '@/const/crud/activiti/leave-bill'
+import AvueUeditor from 'avue-plugin-ueditor';
 import { mapGetters } from 'vuex'
 
 export default {
+  comments: {
+      AvueUeditor
+  },
   name: 'LeaveBill',
   data() {
     return {

+ 1 - 2
src/views/admin/client/index.vue

@@ -94,7 +94,6 @@
                 })
             },
             handleUpdate: function (row, index, done) {
-                row.authorizedGrantTypes = row.authorizedGrantTypes.join(',')
                 if (row.accessTokenValidity === 0) {
                     row.accessTokenValidity = 60 * 60 * 12
                 }
@@ -105,7 +104,7 @@
                     this.$message.success('修改成功');
                     this.refreshChange()
                     done()
-                })`-`
+                })
             },
             handleSave: function (row, done) {
                 row.authorizedGrantTypes = row.authorizedGrantTypes.join(',')

+ 9 - 14
src/views/admin/file/index.vue

@@ -24,6 +24,7 @@
         :permission="permissionList"
         :table-loading="tableLoading"
         :option="tableOption"
+        :upload-after="uploadAfter"
         @on-load="getList"
         @search-change="searchChange"
         @refresh-change="refreshChange"
@@ -74,7 +75,7 @@ export default {
     ...mapGetters(['permissions']),
     permissionList() {
       return {
-        addBtn: this.vaildData(this.permissions.sys_file_add, false),
+        addBtn: this.vaildData(this.permissions.sys_file_add, true),
         delBtn: this.vaildData(this.permissions.sys_file_del, true),
         editBtn: this.vaildData(this.permissions.sys_file_edit, false)
       }
@@ -104,31 +105,25 @@ export default {
       }).then(function() {
         return delObj(row.id)
       }).then(data => {
-        _this.tableData.splice(index, 1)
-        _this.$message({
-          showClose: true,
-          message: '删除成功',
-          type: 'success'
-        })
+        _this.$message.success('删除成功')
         this.getList(this.page)
       })
     },
-    /**
-       * 搜索回调
-       */
     searchChange(form) {
       this.getList(this.page, form)
     },
-    /**
-       * 刷新回调
-       */
     refreshChange() {
       this.searchForm = form
       this.getList(this.page)
     },
     download: function(row, index) {
       handleDown(row.fileName, row.bucketName)
-    }
+    },
+    uploadAfter(res, done, loading) {
+        this.$message.success('上传成功')
+        done()
+        this.getList(this.page)
+    },
   }
 }
 </script>

+ 6 - 33
src/views/admin/social/index.vue

@@ -100,52 +100,25 @@ export default {
       }).catch(function() {
       })
     },
-    /**
-       * @title 数据更新
-       * @param row 为当前的数据
-       * @param index 为当前更新数据的行数
-       * @param done 为表单关闭函数
-       *
-       **/
     handleUpdate: function(row, index, done) {
       putObj(row).then(() => {
         this.tableData.splice(index, 1, Object.assign({}, row))
-        this.$message({
-          showClose: true,
-          message: '修改成功',
-          type: 'success'
-        })
+        this.$message.success('修改成功')
         this.refreshChange()
         done()
       })
     },
-    /**
-       * @title 数据添加
-       * @param row 为当前的数据
-       * @param done 为表单关闭函数
-       *
-       **/
     handleSave: function(row, done) {
-      addObj(row).then(() => {
-        this.tableData.push(Object.assign({}, row))
-        this.$message({
-          showClose: true,
-          message: '添加成功',
-          type: 'success'
+        addObj(row).then(() => {
+            this.tableData.push(Object.assign({}, row))
+            this.$message.success('添加成功')
+            this.refreshChange()
+            done()
         })
-        this.refreshChange()
-        done()
-      })
     },
-    /**
-       * 刷新回调
-       */
     refreshChange() {
       this.getList(this.page)
     },
-    /**
-       * 搜索回调
-       */
     searchChange(form) {
       this.searchForm = form
       this.getList(this.page, form)

+ 1 - 1
src/views/admin/user/info.vue

@@ -244,7 +244,7 @@ export default {
     },
     handleAvatarSuccess(res, file) {
       this.avatarUrl = URL.createObjectURL(file.raw)
-      this.ruleForm2.avatar = res.data.bucketName + '-' + res.data.fileName
+      this.ruleForm2.avatar = res.data.url
     }
   }
 }

+ 5 - 28
src/views/mp/wxaccount/index.vue

@@ -113,12 +113,7 @@ export default {
       }).then(function() {
         return delObj(row.id)
       }).then(() => {
-        _this.tableData.splice(index, 1)
-        _this.$message({
-          showClose: true,
-          message: '删除成功',
-          type: 'success'
-        })
+          _this.$message.success('删除成功')
         this.getList(this.page)
       }).catch(function() {
       })
@@ -132,12 +127,7 @@ export default {
        **/
     handleUpdate: function(row, index, done) {
       putObj(row).then(() => {
-        this.tableData.splice(index, 1, Object.assign({}, row))
-        this.$message({
-          showClose: true,
-          message: '修改成功',
-          type: 'success'
-        })
+        this.$message.success('删除成功')
         done()
         this.getList(this.page)
       })
@@ -151,12 +141,7 @@ export default {
     handleSave: function(row, done) {
       row.qrUrl = undefined
       addObj(row).then(() => {
-        this.tableData.push(Object.assign({}, row))
-        this.$message({
-          showClose: true,
-          message: '添加成功',
-          type: 'success'
-        })
+        this.$message.success('保存成功')
         done()
         this.getList(this.page)
       })
@@ -167,11 +152,7 @@ export default {
     },
     generateQr: function(row) {
       generateQr(row.appid).then(() => {
-        this.$message({
-          showClose: true,
-          message: '获取成功',
-          type: 'success'
-        })
+        this.$message.success('获取成功')
         this.getList(this.page)
       })
     },
@@ -185,11 +166,7 @@ export default {
       })
       // 复制成功执行的回调
       clipboard.on('success', () => {
-        this.$message({
-          showClose: true,
-          message: '复制成功',
-          type: 'success'
-        })
+        this.$message.success('复制成功')
       })
     }
   }