From d0b2563e29ab723b68c70855375a37c76471eb26 Mon Sep 17 00:00:00 2001
From: 田源 <lastanimals@163.com>
Date: 星期二, 18 六月 2024 16:34:18 +0800
Subject: [PATCH] 登录页布局修改-启动流程action样式配置

---
 Source/plt-web/plt-web-ui/src/components/actions/handlers.js                   |    4 
 Source/plt-web/plt-web-ui/public/img/login-background.png                      |    0 
 Source/plt-web/plt-web-ui/src/page/login/userlogin.vue                         |    3 
 Source/plt-web/plt-web-ui/src/store/modules/user.js                            |   12 
 Source/plt-web/plt-web-ui/src/components/actions/base/startWorkFlow.vue        |  144 +++++++++
 Source/plt-web/plt-web-ui/src/components/actions/base/StartWorkflowAction.js   |   72 +++-
 Source/plt-web/plt-web-ui/public/img/Group.png                                 |    0 
 Source/plt-web/plt-web-ui/public/img/image.png.png                             |    0 
 Source/plt-web/plt-web-ui/src/styles/login.scss                                |   20 -
 Source/plt-web/plt-web-ui/src/components/dynamic-components/dynamic-button.vue |   13 
 Source/plt-web/plt-web-ui/src/views/custom-ui/testFileTable.vue                |  532 +++++++++++++++++++++++++++++++++++
 Source/plt-web/plt-web-ui/public/img/login-bg.png                              |    0 
 Source/plt-web/plt-web-ui/src/page/login/index.vue                             |   51 +--
 Source/plt-web/plt-web-ui/src/api/user.js                                      |    4 
 14 files changed, 765 insertions(+), 90 deletions(-)

diff --git a/Source/plt-web/plt-web-ui/public/img/Group.png b/Source/plt-web/plt-web-ui/public/img/Group.png
new file mode 100644
index 0000000..9ffeefa
--- /dev/null
+++ b/Source/plt-web/plt-web-ui/public/img/Group.png
Binary files differ
diff --git a/Source/plt-web/plt-web-ui/public/img/image.png.png b/Source/plt-web/plt-web-ui/public/img/image.png.png
new file mode 100644
index 0000000..86cfdeb
--- /dev/null
+++ b/Source/plt-web/plt-web-ui/public/img/image.png.png
Binary files differ
diff --git a/Source/plt-web/plt-web-ui/public/img/login-background.png b/Source/plt-web/plt-web-ui/public/img/login-background.png
new file mode 100644
index 0000000..9d61111
--- /dev/null
+++ b/Source/plt-web/plt-web-ui/public/img/login-background.png
Binary files differ
diff --git a/Source/plt-web/plt-web-ui/public/img/login-bg.png b/Source/plt-web/plt-web-ui/public/img/login-bg.png
new file mode 100644
index 0000000..b5e04b8
--- /dev/null
+++ b/Source/plt-web/plt-web-ui/public/img/login-bg.png
Binary files differ
diff --git a/Source/plt-web/plt-web-ui/src/api/user.js b/Source/plt-web/plt-web-ui/src/api/user.js
index b3d90d9..9bb5ea7 100644
--- a/Source/plt-web/plt-web-ui/src/api/user.js
+++ b/Source/plt-web/plt-web-ui/src/api/user.js
@@ -1,7 +1,7 @@
 import request from '@/router/axios';
 import website from "@/config/website";
 
-export const loginByUsername = (tenantId, deptId, roleId, username, password, type, key) => request({
+export const loginByUsername = (tenantId, deptId, roleId, userId, password, type, key) => request({
   url: '/api/framework/loginController/login',
   method: 'post',
   headers: {
@@ -13,7 +13,7 @@
   },
   params: {
     tenantId,
-    username,
+    userId,
     password,
     grant_type: (website.captchaMode ? "captcha" : "password"),
     scope: "all",
diff --git a/Source/plt-web/plt-web-ui/src/components/actions/base/StartWorkflowAction.js b/Source/plt-web/plt-web-ui/src/components/actions/base/StartWorkflowAction.js
index 5d67215..ab77ad8 100644
--- a/Source/plt-web/plt-web-ui/src/components/actions/base/StartWorkflowAction.js
+++ b/Source/plt-web/plt-web-ui/src/components/actions/base/StartWorkflowAction.js
@@ -4,34 +4,36 @@
 import {paramLow,callPreEvent, callPostEvent} from '../BaseAction';
 import {validatenull} from "@/util/validate";
 import Vue from "vue";
+import workActionDialog from "@/components/actions/base/startWorkFlow"
+
 
 export const doAction = (options,callback) => {
   options.sourceData = options.sourceData || {};
   options.dataStore = options.dataStore || [];
-  if (!options.dataStore || options.dataStore.length < 1) {
-    Vue.prototype.$message.error("璇烽�夋嫨闇�瑕佸彂璧锋祦绋嬬殑鏁版嵁");
-    return false;
-  }
-  if (!options.paramVOS.multi && options.dataStore.length > 1) {
-    Vue.prototype.$message.error("浠呰兘閫夋嫨涓�鏉℃暟鎹彂璧锋祦绋�");
-    return false;
-  }
-
-  //楠岃瘉涓嶅厑璁稿惎鍔ㄧ殑鏉′欢
-  if(!validatenull(options.paramVOS.checknotprocess)) {
-    let notprocess = options.paramVOS.checknotprocess.split('&');
-    let checknotprocess=false;
-    notprocess.forEach((item,i)=>{
-      if (options.dataStore[0][item.split('=')[0]] == item.split('=')[1]) {
-        checknotprocess=true;
-        return false;
-      }
-    })
-    if (checknotprocess) {
-      Vue.prototype.$message.error(replaceFreeMarker(options.paramVOS.checknotprocessmsg,options.dataStore,{}) || "褰撳墠鏁版嵁涓嶅厑璁稿彂璧锋祦绋�");
-      return false;
-    }
-  }
+  // if (!options.dataStore || options.dataStore.length < 1) {
+  //   Vue.prototype.$message.error("璇烽�夋嫨闇�瑕佸彂璧锋祦绋嬬殑鏁版嵁");
+  //   return false;
+  // }
+  // if (!options.paramVOS.multi && options.dataStore.length > 1) {
+  //   Vue.prototype.$message.error("浠呰兘閫夋嫨涓�鏉℃暟鎹彂璧锋祦绋�");
+  //   return false;
+  // }
+  //
+  // //楠岃瘉涓嶅厑璁稿惎鍔ㄧ殑鏉′欢
+  // if(!validatenull(options.paramVOS.checknotprocess)) {
+  //   let notprocess = options.paramVOS.checknotprocess.split('&');
+  //   let checknotprocess=false;
+  //   notprocess.forEach((item,i)=>{
+  //     if (options.dataStore[0][item.split('=')[0]] == item.split('=')[1]) {
+  //       checknotprocess=true;
+  //       return false;
+  //     }
+  //   })
+  //   if (checknotprocess) {
+  //     Vue.prototype.$message.error(replaceFreeMarker(options.paramVOS.checknotprocessmsg,options.dataStore,{}) || "褰撳墠鏁版嵁涓嶅厑璁稿彂璧锋祦绋�");
+  //     return false;
+  //   }
+  // }
 
   callPreEvent(options, doBefore, function (options) {
     showStartWindow(options, function () {
@@ -47,7 +49,29 @@
  */
 export const showStartWindow = (options,callback)=> {
   const paramVOS = options.paramVOS;
+  // if (!paramVOS['form'] && !paramVOS['context']) {
+  //   Vue.prototype.$message.error("鎸夐挳閰嶇疆涓嶆纭�");
+  //   return false;
+  // }
 
+  const dialogConstructor = Vue.extend(workActionDialog);
+  let instance = new dialogConstructor();
+  instance.sourceData = options.sourceData;
+  instance.dataStore = options.dataStore;
+  instance.paramVOS = paramVOS
+
+  instance.dialogClose = function () {
+    vm.visible = false;
+    document.body.removeChild(vm.$el);
+    instance.$destroy();
+    instance = null;
+  };
+  if (callback) {
+    instance.saveCallback = callback;
+  }
+  let vm = instance.$mount();
+  document.body.appendChild(vm.$el);
+  instance.visible = true;
 
 }
 /**
diff --git a/Source/plt-web/plt-web-ui/src/components/actions/base/startWorkFlow.vue b/Source/plt-web/plt-web-ui/src/components/actions/base/startWorkFlow.vue
new file mode 100644
index 0000000..5c8cdb1
--- /dev/null
+++ b/Source/plt-web/plt-web-ui/src/components/actions/base/startWorkFlow.vue
@@ -0,0 +1,144 @@
+<template>
+  <el-dialog v-dialogDrag
+             append-to-body="true"
+             :close-on-click-modal="false"
+             :destroy-on-close="true"
+             :visible.sync="visible"
+             :width="width"
+             class="avue-dialog"
+             title="鍚姩娴佺▼"
+             top="0"
+             style="margin-top: -10% !important;"
+             @close="dialogClose">
+
+    <el-form :model="saveParam" :rules="rules" class="demo-form-inline" label-position="left" label-width="auto">
+      <el-form-item label="娴佺▼妯℃澘">
+        <el-input v-model="saveParam.modelName" disabled placeholder="娴佺▼妯℃澘"></el-input>
+      </el-form-item>
+      <el-form-item label="娴佺▼鍚嶇О" prop="processName">
+        <el-input v-model="saveParam.processName" placeholder="娴佺▼鍚嶇О">
+        </el-input>
+      </el-form-item>
+      <el-form-item label="娴佺▼鎻忚堪">
+        <el-input v-model="saveParam.processDesc" :rows="4" placeholder="娴佺▼鎻忚堪" type="textarea">
+        </el-input>
+      </el-form-item>
+    </el-form>
+
+    <el-divider></el-divider>
+    <div class="btns-icon">
+      <el-button circle icon="el-icon-star-off" @click="handleCollect"></el-button>
+    </div>
+    <el-form :model="collectParam" class="demo-form-inline" label-position="left" label-width="auto">
+      <el-form-item v-for="(item, index) in initFrom" :key="index" :label="item.taskName">
+        <el-select v-model="collectParam.flowTaskUsers[index]['userId']" :placeholder="item.taskName" filterable
+                   style="width: 100%;" @change="handleSelect($event, index)">
+          <el-option v-for="(key, keyi) in typeName" :key="keyi" :label="key.userNames"
+                     :value="key.userId"></el-option>
+        </el-select>
+      </el-form-item>
+    </el-form>
+    <div slot="footer" class="dialog-footer">
+      <el-button @click="handleCancel">鍙� 娑�</el-button>
+      <el-button type="primary" @click="handleConfirm">纭� 瀹�</el-button>
+    </div>
+
+  </el-dialog>
+</template>
+
+<script>
+import {validatenull} from "@/util/validate";
+
+export default {
+  name: "startWorkFlow",
+  props: {
+    paramVOS: {
+      type: Object,
+      default: {}
+    },
+    sourceData: {
+      //鎵�灞炲尯鍩熺殑涓婁竴鍖哄煙閫変腑鏁版嵁
+      type: Object,
+      default: {}
+    },
+    dataStore: {
+      //寮圭獥鏃舵寜閽墍灞炲尯鍩熼�変腑鏁版嵁
+      type: Array,
+      default: []
+    },
+  },
+  data() {
+    return {
+      visible: false,
+      saveParam: {},
+      users: [],
+      collectParam: {},
+      initFrom: [],
+      typeName: [],
+    }
+  },
+  watch: {
+    users: {
+      handler(val) {
+        this.collectParam.flowTaskUsers = val
+      },
+      deep: true,
+      immediate: true
+    },
+    parameter: {
+      handler(newval, oldval) {
+        this.saveParam = Object.assign({processName: '', processDesc: ''}, newval);
+      },
+      deep: true,
+      immediate: true
+    }
+  },
+  computed: {
+    fullscreen() {
+      if (this.paramVOS.width || this.paramVOS.height) {
+        return false;
+      } else if (this.paramVOS.form) {
+        return false;
+      }
+      return true;
+    },
+    width() {
+      if (!validatenull(this.paramVOS.width)) {
+        if (this.paramVOS.width.includes("px") || this.paramVOS.width.includes("%")) {
+          return this.paramVOS.width;
+        } else {
+          return this.paramVOS.width + "px";
+        }
+      } else {
+        return "40%";
+      }
+    },
+  },
+  methods: {
+    // 鍏抽棴寮圭獥
+    dialogClose() {
+      this.visible = false;
+    },
+
+    handleSelect() {
+
+    },
+
+    handleCollect() {
+
+    },
+
+    handleCancel() {
+      this.dialogClose();
+    },
+
+    handleConfirm() {
+
+    }
+  }
+}
+</script>
+
+<style scoped lang="scss">
+
+</style>
diff --git a/Source/plt-web/plt-web-ui/src/components/actions/handlers.js b/Source/plt-web/plt-web-ui/src/components/actions/handlers.js
index 9838f82..ec54208 100644
--- a/Source/plt-web/plt-web-ui/src/components/actions/handlers.js
+++ b/Source/plt-web/plt-web-ui/src/components/actions/handlers.js
@@ -27,6 +27,10 @@
     rev: () =>  {import("@/components/actions/base/RevisionAction").then(module => {
       module.doAction(options,callback);
     })},
+    //鍚姩娴佺▼
+    launchworkflow: () => {import("@/components/actions/base/StartWorkflowAction").then(module => {
+      module.doAction(options,callback);
+    })},
   };
   if (handlers[type]) {
     handlers[type]()
diff --git a/Source/plt-web/plt-web-ui/src/components/dynamic-components/dynamic-button.vue b/Source/plt-web/plt-web-ui/src/components/dynamic-components/dynamic-button.vue
index d9834d3..4007355 100644
--- a/Source/plt-web/plt-web-ui/src/components/dynamic-components/dynamic-button.vue
+++ b/Source/plt-web/plt-web-ui/src/components/dynamic-components/dynamic-button.vue
@@ -4,8 +4,9 @@
     <div v-if="type === 'table' || type === 'TreeTable'">
       <!--top灞曠ず琛ㄦ牸涓婃柟鍖哄煙 menu灞曠ず琛ㄦ牸鎿嶄綔鏍忓尯鍩� 鏃犲氨鏄粯璁� -->
       <el-tooltip v-if="LocationType === 'top'" v-for="item in basicButtonList.top" :content="item.description || item.name" placement="top">
-        <el-button :key="item.oid" :icon="item.paramVOS.icon"
-                   :type="item.paramVOS.btnType || 'primary'" plain
+        <el-button :key="item.oid"
+                   :icon="item.paramVOS && item.paramVOS.icon ? item.paramVOS.icon :''"
+                   :type="item.paramVOS && item.paramVOS.btnType ?  item.paramVOS.btnType : 'primary'" plain
                    size="small"
                    @click="buttonClick(item)">{{ item.name }}</el-button>
       </el-tooltip>
@@ -28,8 +29,8 @@
     <div v-else-if="type === 'form'">
       <el-tooltip v-for="item in basicButtonList" :content="item.description || item.name" placement="top">
         <el-button :key="item.oid"
-                   :icon="item.paramVOS.icon"
-                   :type="item.paramVOS.btnType || 'primary'"
+                   :icon="item.paramVOS && item.paramVOS.icon ? item.paramVOS.icon :''"
+                   :type="item.paramVOS && item.paramVOS.btnType ?  item.paramVOS.btnType : 'primary'" plain
                    plain
                    size="small"
                    @click="buttonClick(item)">{{ item.name }}</el-button>
@@ -38,8 +39,8 @@
     <div v-else-if="type === 'tree'" class="tree-buttons">
       <el-tooltip v-for="item in basicButtonList" :content="item.description || item.name" placement="top">
         <el-button :key="item.oid"
-                   :icon="item.paramVOS.icon"
-                   :type="item.paramVOS.btnType || 'primary'"
+                   :icon="item.paramVOS && item.paramVOS.icon ? item.paramVOS.icon :''"
+                   :type="item.paramVOS && item.paramVOS.btnType ?  item.paramVOS.btnType : 'primary'" plain
                    plain
                    size="small"
                    @click="buttonClick(item)">{{ item.name }}</el-button>
diff --git a/Source/plt-web/plt-web-ui/src/page/login/index.vue b/Source/plt-web/plt-web-ui/src/page/login/index.vue
index 610911e..2307ee0 100644
--- a/Source/plt-web/plt-web-ui/src/page/login/index.vue
+++ b/Source/plt-web/plt-web-ui/src/page/login/index.vue
@@ -4,34 +4,6 @@
        @keyup.enter.native="handleLogin">
     <top-color v-show="false"></top-color>
     <div class="login-weaper animated bounceInDown">
-      <div class="login-left">
-        <div class="login-time">
-          {{time}}
-        </div>
-        <p class="title">{{ $t('login.info') }}</p>
-        <div style="font-size: 15px">
-          <span>----------------------------------------------</span>
-          <br>
-          <span>绠$悊绉熸埛缂栧彿锛�000000</span>
-          <br>
-          <span>瓒呯骇绠$悊鍛樿处鍙�: admin / admin</span>
-          <br>
-          <span>浜轰簨璐﹀彿: hr / hr</span>
-          <br>
-          <span>缁忕悊璐﹀彿: manager / manager</span>
-          <br>
-          <span>鑰佹澘璐﹀彿: boss / boss</span>
-          <br>
-          <span>----------------------------------------------</span>
-          <br>
-          <span>鏅�氱鎴风紪鍙凤細璇﹁绉熸埛绠$悊妯″潡</span>
-          <br>
-          <span>绉熸埛绠$悊鍛樿处鍙�: admin / admin</span>
-          <br>
-          <span>----------------------------------------------</span>
-        </div>
-      <!--<img class="img" src="/img/logo.png" alt="">-->
-      </div>
       <div class="login-border">
         <div class="login-main">
           <h4 class="login-title">
@@ -40,15 +12,15 @@
           </h4>
           <userLogin v-if="activeName==='user'"></userLogin>
           <thirdLogin v-else-if="activeName==='third'"></thirdLogin>
-          <div class="login-menu">
-            <a href="#" @click.stop="activeName='user'">{{ $t('login.userLogin') }}</a>
-            <!--<a href="#" @click.stop="activeName='code'">{{ $t('login.phoneLogin') }}</a>-->
-            <a href="#" @click.stop="activeName='third'">{{ $t('login.thirdLogin') }}</a>
-            <a :href="website.ssoUrl + website.redirectUri">{{ $t('login.ssoLogin') }}</a>
-          </div>
         </div>
 
       </div>
+    </div>
+    <div class="login-bg-image">
+      <el-image
+        style="width: 20vw; height: 44vh"
+        :src="require('../../../public/img/Group.png')"
+        fit="fill"></el-image>
     </div>
   </div>
 </template>
@@ -147,6 +119,15 @@
   };
 </script>
 
-<style lang="scss">
+<style lang="scss" scoped>
+.login-container {
+  background: #fff url('../../../public/img/login-background.png')no-repeat center;
+  background-size: 100% 100%; /* 鎴栬�� background-size: 100% 100%; */
+}
+.login-bg-image{
+  position: fixed;
+  left: 10%;
+  top: 35%;
 
+}
 </style>
diff --git a/Source/plt-web/plt-web-ui/src/page/login/userlogin.vue b/Source/plt-web/plt-web-ui/src/page/login/userlogin.vue
index 6ef68e3..0e775ec 100644
--- a/Source/plt-web/plt-web-ui/src/page/login/userlogin.vue
+++ b/Source/plt-web/plt-web-ui/src/page/login/userlogin.vue
@@ -189,7 +189,8 @@
               }
               this.$router.push({path: this.tagWel.value});
               loading.close();
-            }).catch(() => {
+            }).catch((err) => {
+              console.log('err',err)
               loading.close();
 
             });
diff --git a/Source/plt-web/plt-web-ui/src/store/modules/user.js b/Source/plt-web/plt-web-ui/src/store/modules/user.js
index 3b04ff9..2506220 100644
--- a/Source/plt-web/plt-web-ui/src/store/modules/user.js
+++ b/Source/plt-web/plt-web-ui/src/store/modules/user.js
@@ -62,13 +62,13 @@
     //鏍规嵁鐢ㄦ埛鍚嶇櫥褰�
     LoginByUsername({commit}, userInfo) {
       return new Promise((resolve, reject) => {
-        loginByUsername(userInfo.tenantId, userInfo.deptId, userInfo.roleId, userInfo.username, md5(userInfo.password), userInfo.type, userInfo.key,).then(res => {
+        loginByUsername(userInfo.tenantId, userInfo.deptId, userInfo.roleId, userInfo.username, userInfo.password, userInfo.type, userInfo.key,).then(res => {
           const data = res.data;
-          if (data.success) {
-            commit('SET_TOKEN', data.obj.sessionInfo.token);
-            commit('SET_REFRESH_TOKEN', data.obj.sessionInfo.token);
-            commit('SET_TENANT_ID', data.tenant_id);
-            commit('SET_USER_INFO', data.obj.sessionInfo);
+          if (data.code === 200) {
+            commit('SET_TOKEN', data.obj.tokenVO.accessToken);
+            commit('SET_REFRESH_TOKEN', data.obj.tokenVO.accessToken);
+            // commit('SET_TENANT_ID', data.tenant_id);
+            // commit('SET_USER_INFO', data.obj.sessionInfo); 鐢ㄦ埛淇℃伅
             commit('DEL_ALL_TAG');
             commit('CLEAR_LOCK');
           } else {
diff --git a/Source/plt-web/plt-web-ui/src/styles/login.scss b/Source/plt-web/plt-web-ui/src/styles/login.scss
index e6a7b13..3760c17 100644
--- a/Source/plt-web/plt-web-ui/src/styles/login.scss
+++ b/Source/plt-web/plt-web-ui/src/styles/login.scss
@@ -5,15 +5,15 @@
   width: 100%;
   height: 100%;
   margin: 0 auto;
-  background-image: url("/img/bg/bg.jpg");
   background-size: 100% 100%;
 }
 
 .login-weaper {
   margin: 0 auto;
-  width: 1000px;
-  box-shadow: -4px 5px 10px rgba(0, 0, 0, 0.4);
-
+  width: 500px;
+  border-radius: 20px;
+  background-color: rgba(256, 256, 256, 0.6);
+  box-shadow: -4px 5px 10px rgba(0, 0, 0, 0.3);
   .el-input-group__append {
     border: none;
   }
@@ -62,18 +62,6 @@
   font-size: 30px;
   letter-spacing: 2px;
 }
-
-.login-border {
-  border-left: none;
-  border-top-right-radius: 5px;
-  border-bottom-right-radius: 5px;
-  color: #fff;
-  background-color: #fff;
-  width: 50%;
-  float: left;
-  box-sizing: border-box;
-}
-
 .login-main {
   margin: 0 auto;
   width: 65%;
diff --git a/Source/plt-web/plt-web-ui/src/views/custom-ui/testFileTable.vue b/Source/plt-web/plt-web-ui/src/views/custom-ui/testFileTable.vue
new file mode 100644
index 0000000..25ef3a8
--- /dev/null
+++ b/Source/plt-web/plt-web-ui/src/views/custom-ui/testFileTable.vue
@@ -0,0 +1,532 @@
+<template>
+  <basic-container>
+    <avue-crud ref="crud"
+               v-model="form"
+               :before-open="beforeOpen"
+               :data="data"
+               :option="option"
+               :page.sync="page"
+               :table-loading="loading"
+               @row-del="rowDel"
+               @search-change="searchChange"
+               @search-reset="searchReset"
+               @selection-change="selectionChange"
+               @row-click="selectedRowClick"
+               @current-change="currentChange"
+               @size-change="sizeChange"
+               @refresh-change="refreshChange"
+               @on-load="onLoad">
+      <template slot="menuLeft">
+        <el-button v-if="hasUpload" icon="el-icon-upload2"
+                   plain
+                   size="small"
+                   type="primary"
+                   @click="handleUpload">涓� 浼�
+        </el-button>
+        <el-button v-if="hasEdit" icon="el-icon-edit"
+                   plain
+                   size="small"
+                   type="primary"
+                   @click="handleEdit">淇� 鏀�
+        </el-button>
+        <el-button v-if="hasDownload" icon="el-icon-download"
+                   plain
+                   size="small"
+                   type="primary"
+                   @click="handleDownload">涓� 杞�
+        </el-button>
+        <el-button v-if="hasDel" icon="el-icon-delete"
+                   plain
+                   size="small"
+                   type="danger"
+                   @click="handleDelete">鍒� 闄�
+        </el-button>
+      </template>
+      <template slot="menu" slot-scope="scope">
+        <el-button v-if="hasDownload" icon="el-icon-download"
+                   size="small"
+                   type="text"
+                   @click="handleDownload(scope.row)">涓嬭浇
+        </el-button>
+      </template>
+    </avue-crud>
+    <el-dialog :visible.sync="attachBox"
+               append-to-body
+               title="闄勪欢绠$悊"
+               width="555px">
+      <avue-form ref="form" v-model="attachForm" :option="attachOption" :upload-after="uploadAfter"
+                 :upload-before="uploadBefore" :upload-error="uploadError">
+      </avue-form>
+    </el-dialog>
+  </basic-container>
+</template>
+<script>
+// import {getList, getFile, upload, update, remove, download} from "@/api/resource/file";
+import {validatenull} from "@/util/validate";
+import func from "@/util/func";
+
+export default {
+  name: "testFileTable",
+  // props: ["options", "ownbizOid"],
+  props:{
+    options:{
+      type:Object,
+      default:{}
+    },
+    ownbizOid:{
+      type:String,
+      default: ""
+    },
+    sourceData:{
+      type:Array,
+      default:[]
+    }
+  },
+  /**
+   * 棣栨鍔犺浇鐖剁骇琛ㄦ牸濡傛灉涓虹┖ 浼犵殑榛樿鏉′欢
+   currentButtonKey: VIEW
+   ownbizOid: share
+   ownBtmName: share
+   fileDocClassify: ADMIN_SHARE
+   fileDocClassifyName: 绠$悊鍛樺叡浜枃浠�
+   page: 1
+   limit: 10
+   **/
+  /**
+   *棣栨鍔犺浇鐖剁骇琛ㄦ牸濡傛灉瀛樺湪鏁版嵁 鍜� 琛ㄦ牸琛屽叏閫� 浼犵殑榛樿鏉′欢
+   currentButtonKey: VIEW
+   ownbizOid: 0      // 鍗曢�� 閫夋嫨褰撳墠琛屼紶褰撳墠琛宨d
+   ownBtmName: 0     // 鍗曢�� 閫夋嫨褰撳墠琛屼紶褰撳墠鍒嗙被鍚嶇О
+   fileDocClassify: !=processAuditSuggest
+   fileDocClassifyName: 绠$悊鍛樺叡浜枃浠�
+   page: 1
+   limit: 10
+   */
+  data() {
+    return {
+      form: {},
+      query: {},
+      params: {},
+      loading: false,
+      // hasPage: this.options.hasPage || false,
+      page: {
+        pageSize: 10,
+        currentPage: 1,
+        total: 0
+      },
+      attachBox: false,
+      selectionList: [],
+      //榛樿涓簄ull鍏ㄩ儴鏄痶rue
+      hasUpload: validatenull(this.options.hasUpload) ? true : this.options.hasUpload,
+      hasEdit: validatenull(this.options.hasEdit) ? true : this.options.hasEdit,
+      hasDel: validatenull(this.options.hasDel) ? true : this.options.hasDel,
+      hasDownload: validatenull(this.options.hasDownload) ? true : this.options.hasDownload,
+      option: {
+        height: (this.options.tableHeight ? this.options.tableHeight : '300'),
+        calcHeight: 30,
+        tip: false,
+        searchShow: false,
+        searchMenuSpan: 6,
+        border: true,
+        index: true,
+        viewBtn: true,
+        refreshBtn: false,
+        selection: true,
+        dialogClickModal: false,
+        addBtn:false,
+        column: [
+          {
+            label: "鏂囦欢鍚嶇О",
+            prop: "name",
+            search: true,
+          },
+          {
+            label: "鏂囦欢澶у皬",
+            prop: "fileSize",
+            formatter: function (d) {
+              if (!d.fileSize || d.fileSize == null || d.fileSize * 1 == 0 || isNaN(d.fileSize * 1)) {
+                return "鏈煡澶у皬";
+              } else {
+                //鍘熷澶у皬鏄疊
+                var filesize = d.fileSize * 1;
+                if (filesize > 1024 * 1024 * 1024 * 1024) {
+                  return parseInt(filesize / (1024 * 1024 * 1024 * 1024)) + "TB";
+                } else if (filesize > 1024 * 1024 * 1024) {
+                  return parseInt(filesize / (1024 * 1024 * 1024)) + "GB";
+                } else if (filesize > 1024 * 1024) {
+                  return parseInt(filesize / (1024 * 1024)) + "MB";
+                } else if (filesize > 1024) {
+                  return parseInt(filesize / 1024) + "KB";
+                } else {
+                  return filesize + "B";
+                }
+              }
+            }
+          },
+          {
+            label: "鍒涘缓鑰�",
+            prop: "creator"
+          },
+          {
+            label: "鍒涘缓鏃堕棿",
+            prop: "createTime"
+          },
+        ]
+      },
+      columnType: {
+        text: "input",
+        combox: "select",
+        truefalse: "switch",
+        number: "number",
+        textarea: "textarea",
+        datetime: "datetime",
+        date: "date",
+        refer: "refer",
+      },
+      data: [],
+      attachForm: {},
+      attachOption: {
+        submitBtn: false,
+        emptyBtn: false,
+        column: [{
+          prop: 'fileDocClassify',
+          label: '鏂囦欢绫诲瀷',
+          props: {
+            label: 'value',
+            value: 'key'
+          },
+          change: () => {
+            (!!this.options.fileDocClassifyCombox) && this.changeFun('fileDocClassify');
+          },
+          blur: () => {
+            (!this.options.fileDocClassifyCombox) && this.changeFun('fileDocClassify');
+          },
+          value: this.options.fileDocClassify || "ADMIN_SHARE",
+          type: (!this.options.fileDocClassifyCombox) ? 'input' : 'select',
+          dicData: (this.options.fileDocClassifyCombox || []),//[{key: 'text', value: '鏂囨湰妗�'}]
+          display: (!!this.options.fileDocClassifyCombox)
+        }, {
+          label: '闄勪欢涓婁紶',
+          prop: 'attachFile',
+          type: 'upload',
+          dragFile: true,
+          showFileList: false,
+          accept: this.options.uploadAccept || 'file',
+          loadText: '鏂囦欢涓婁紶涓紝璇风◢绛�',
+          span: 24,
+          propsHttp: {
+            res: 'data'
+          },
+          data: {
+            ownbizOid: this.options.ownbizOid || "share",
+            ownBtmName: this.options.ownbizBtm || "share",
+            fileDocClassify: this.options.fileDocClassify || "ADMIN_SHARE",
+            fileDocClassifyName: this.options.fileDocClassifyName || "绠$悊鍛樺叡浜枃浠�"
+          },
+          action: "/api/ubcs-resource/fileController/uploadFile"
+        }
+        ]
+      }
+    };
+  },
+  computed: {
+    oids() {
+      let oids = [];
+      this.selectionList.forEach(ele => {
+        oids.push(ele.oid);
+      });
+      return oids.join(",");
+    }
+  },
+  created() {
+    this.setFormItem();
+    this.setParams()
+  },
+  mounted() {
+    console.log('sourceData',this.sourceData)
+  },
+  watch: {
+    ownbizOid(val) {
+      this.setParams()
+      this.refreshChange()
+    },
+  },
+  methods: {
+    setFormItem() {
+      /*this.options.formItems=[{
+        field: 'fileDocClassify11',
+        title: '鏂囦欢绫诲瀷',
+        type:  'combox',
+        data: [{key: 'text', value: '鏂囨湰妗�'},{key: 'number', value: '鏁板瓧妗�'}]
+      }]*/
+      if (this.options && this.options.formItems) {
+        this.options.formItems.forEach(item => {
+          // 璁剧疆琛ㄥ崟鏍¢獙鐨勮鍒欙紝鏂囨湰
+          let message = "璇烽�夋嫨";
+          let trigger = "change";
+          if (item.type === "text") {
+            message = "璇疯緭鍏�";
+            trigger = "blur";
+          }
+          this.attachOption.column.push({
+            ...item,
+            label: item.title,
+            prop: item.field,
+            display: !item.hidden,
+            value: item.defaultValue,
+            disabled: item.readOnly,
+            type: this.columnType[item.type],
+            dicData: this.getDataList(item.type, item.data),
+            change: () => {
+              if (item.type !== "text" && item.type !== "number" && item.type !== "textarea") {
+                this.changeFun(item.field);
+              }
+            },
+            blur: () => {
+              if (item.type == "text" || item.type == "number" || item.type == "textarea") {
+                this.changeFun(item.field);
+              }
+            },
+            rules: [
+              {
+                required: item.required,
+                message: `璇�${message}${item.title}`,
+                trigger,
+              },
+              {
+                // 濡傛灉娌℃湁姝e垯鍒欏尮閰嶄换浣曞瓧绗�
+                pattern: item.verify ? item.verify : /[\s\S.]*/g,
+                message: item.tooltips,
+                trigger,
+              },
+            ],
+            props: {
+              label: 'value',
+              value: 'key'
+            }
+          })
+        })
+      }
+    },
+    changeFun(prop) {
+      this.attachOption.column[1].data[prop] = this.attachForm[prop]
+    },
+    getDataList(type, dicData) {
+      if (type === "truefalse") {
+        return [
+          {
+            key: false,
+            value: "鍚�",
+          },
+          {
+            key: true,
+            value: "鏄�",
+          },
+        ];
+      } else if (type === "combox") {
+        return dicData;
+      }
+      return [];
+    },
+    setParams() {
+      var queryMap = {
+        currentButtonKey: 'VIEW',
+        ownbizOid: this.options.ownbizOid || "share",
+        ownBtmName: this.options.ownbizBtm || "share",
+        fileDocClassify: this.options.fileDocClassify || "ADMIN_SHARE",
+        fileDocClassifyName: this.options.fileDocClassifyName || "绠$悊鍛樺叡浜枃浠�"
+      };
+      if (this.options.where) {
+        Object.assign(queryMap, this.options.where);
+      }
+      this.params = queryMap;
+
+      if (!this.options.pageObject) {
+        this.options.pageObject = {
+          limit: 10,
+          page: 1
+        };
+      }
+      this.page.pageSize = this.options.pageObject.limit;
+      this.page.currentPage = this.options.pageObject.page;
+
+      this.attachOption.column[1].data.ownbizOid = this.options.ownbizOid || "share";
+      this.attachOption.column[1].data.ownBtmName = this.options.ownbizBtm || "share";
+      this.attachOption.column[1].data.fileDocClassify = this.options.fileDocClassify || "ADMIN_SHARE";
+      this.attachOption.column[1].data.fileDocClassifyName = this.options.fileDocClassifyName || "绠$悊鍛樺叡浜枃浠�"
+
+    },
+    handleUpload() {
+      this.attachOption.column[1].data.fileOid = '';
+      delete this.attachOption.column[1].data.oid;
+      delete this.attachOption.column[1].data.updateFileFlag;
+      this.attachBox = true;
+    },
+    handleEdit() {
+      if (this.selectionList.length == 0) {
+        this.$message.warning('璇烽�夋嫨闇�瑕佷慨鏀圭殑鏂囦欢')
+        return false;
+      } else if (this.selectionList.length > 1) {
+        this.$message.warning('璇烽�夋嫨涓�鏉℃暟鎹�')
+        return false;
+      }
+      this.attachOption.column[1].data.fileOid = this.oids;
+      this.attachOption.column[1].data.oid = this.oids;
+      this.attachOption.column[1].data.updateFileFlag = true
+      this.attachBox = true;
+    },
+    uploadBefore(file, done, loading, column) {
+      done();
+    },
+    uploadAfter(res, done, loading, column) {
+      this.attachBox = false;
+      this.$message.success('鏂囦欢涓婁紶鎴愬姛')
+      this.refreshChange();
+      done();
+    },
+    uploadError(error, column) {
+      this.$message.error(error || '涓婁紶鏂囦欢鍑虹幇浜嗗紓甯�')
+    },
+    handleDownload(row) {
+      //window.open(`${row.link}`);
+      let data = new FormData();
+      if (row && row.oid) {
+        data.append('fileOids', row.oid)
+        this.downloadFile(data);
+      } else {
+        if (this.selectionList.length === 0) {
+          this.$message.warning("璇烽�夋嫨鑷冲皯涓�鏉℃暟鎹�");
+          return;
+        }
+        data.append('fileOids', this.oids)
+        this.downloadFile(data);
+      }
+    },
+    downloadFile(data) {
+      download(data).then(res => {
+        // console.log(res);
+        if (res) {
+          func.downloadFileByBlobHandler(res);
+        }
+      });
+    },
+    rowDel(row) {
+      this.$confirm("纭畾灏嗛�夋嫨鏂囦欢鍒犻櫎?", {
+        confirmButtonText: "纭畾",
+        cancelButtonText: "鍙栨秷",
+        type: "warning"
+      })
+        .then(() => {
+          return remove([row.oid]);
+        })
+        .then(() => {
+          this.onLoad(this.page);
+          this.$message({
+            type: "success",
+            message: "鎿嶄綔鎴愬姛!"
+          });
+        });
+    },
+    handleDelete() {
+      if (this.selectionList.length === 0) {
+        this.$message.warning("璇烽�夋嫨鑷冲皯涓�鏉℃暟鎹�");
+        return;
+      }
+      this.$confirm("纭畾灏嗛�夋嫨鏁版嵁鍒犻櫎?", {
+        confirmButtonText: "纭畾",
+        cancelButtonText: "鍙栨秷",
+        type: "warning"
+      })
+        .then(() => {
+          return remove(this.oids.split(','));
+        })
+        .then(() => {
+          this.onLoad(this.page);
+          this.$message({
+            type: "success",
+            message: "鎿嶄綔鎴愬姛!"
+          });
+          this.$refs.crud.toggleSelection();
+        });
+    },
+    beforeOpen(done, type) {
+      if (["edit", "view"].includes(type)) {
+        getDetail(this.form.id).then(res => {
+          this.form = res.data.data;
+        });
+      }
+      done();
+    },
+    searchReset() {
+      this.query = {};
+      this.onLoad(this.page);
+    },
+    searchChange(params, done) {
+      this.query = params;
+      this.page.currentPage = 1;
+      this.onLoad(this.page);
+      done();
+    },
+    selectionChange(list) {
+      this.selectionList = list;
+      this.$refs.crud.setCurrentRow(this.selectionList[list.length - 1]);
+    },
+    selectedRowClick(row) {
+      this.selectionList = row;
+      this.$refs.crud.toggleSelection();
+      this.$refs.crud.setCurrentRow(row);
+      this.$refs.crud.toggleRowSelection(row); //閫変腑褰撳墠琛�
+    },
+    selectionClear() {
+      this.selectionList = [];
+      this.$refs.crud.toggleSelection();
+    },
+    currentChange(currentPage) {
+      this.page.currentPage = currentPage;
+    },
+    sizeChange(pageSize) {
+      this.page.pageSize = pageSize;
+    },
+    refreshChange() {
+      this.onLoad(this.page);
+    },
+    onLoad(page, params = {}) {
+      // this.loading = true;
+      // var query = {}
+      // if (this.query) {
+      //   for (var key in this.query) {
+      //     query['conditionMap["' + key + '"]'] = this.query[key];
+      //   }
+      // }
+      // getList(page.currentPage, page.pageSize, Object.assign(params, this.params, query, this.query)).then(res => {
+      //   const data = res.data.data;
+      //   this.page.total = data.total;
+      //   if (this.options.fileDocClassifyCombox) {
+      //     this.data = data.records.map(item => {
+      //       if (validatenull(item.fileDocClassifyName) && !validatenull(item.fileDocClassify)) {
+      //         item.fileDocClassifyName = this.options.fileDocClassifyCombox[item.fileDocClassify] || '';
+      //       }
+      //       return {
+      //         ...item
+      //       }
+      //     })
+      //   } else {
+      //     this.data = data.records;
+      //   }
+      //
+      //   this.loading = false;
+      //   this.selectionClear();
+      // }).catch(error => {
+      //   this.$message.error(error);
+      //   this.loading = false;
+      // });
+    }
+  }
+}
+</script>
+
+<style scoped lang="scss">
+/deep/.el-dialog{
+  height: 20% !important;
+}
+</style>

--
Gitblit v1.9.3