田源
2024-06-18 d0b2563e29ab723b68c70855375a37c76471eb26
登录页布局修改-启动流程action样式配置
已修改8个文件
已添加6个文件
855 ■■■■ 文件已修改
Source/plt-web/plt-web-ui/public/img/Group.png 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-ui/public/img/image.png.png 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-ui/public/img/login-background.png 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-ui/public/img/login-bg.png 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-ui/src/api/user.js 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-ui/src/components/actions/base/StartWorkflowAction.js 72 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-ui/src/components/actions/base/startWorkFlow.vue 144 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-ui/src/components/actions/handlers.js 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-ui/src/components/dynamic-components/dynamic-button.vue 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-ui/src/page/login/index.vue 51 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-ui/src/page/login/userlogin.vue 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-ui/src/store/modules/user.js 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-ui/src/styles/login.scss 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-ui/src/views/custom-ui/testFileTable.vue 532 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-ui/public/img/Group.png
Source/plt-web/plt-web-ui/public/img/image.png.png
Source/plt-web/plt-web-ui/public/img/login-background.png
Source/plt-web/plt-web-ui/public/img/login-bg.png
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",
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;
}
/**
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>
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]()
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>
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>
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();
            });
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 {
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%;
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      // å•选 é€‰æ‹©å½“前行传当前行id
   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: [],
      //默认为null全部是true
      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 {
                //原始大小是B
                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,
              },
              {
                // å¦‚果没有正则则匹配任何字符
                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>