ludc
2025-01-16 391eec3114a17e68652434c6eae610799d80290e
Merge remote-tracking branch 'origin/master'
已修改21个文件
已删除1个文件
501 ■■■■ 文件已修改
Bin/PLTWEB/server/lib/desktop.ini 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Bin/PLTWEB/server/lib/plt-slice-1.0.RELEASE.jar 补丁 | 查看 | 原始文档 | blame | 历史
Bin/PLTWEB/server/lib/plt-starter-2024.1-SNAPSHOT.jar 补丁 | 查看 | 原始文档 | blame | 历史
Bin/PLTWEB/server/lib/plt-web-api-2024.1-SNAPSHOT.jar 补丁 | 查看 | 原始文档 | blame | 历史
Bin/PLTWEB/server/lib/plt-web-base-2024.1-SNAPSHOT.jar 补丁 | 查看 | 原始文档 | blame | 历史
Bin/PLTWEB/server/lib/plt-web-permission-2024.1-SNAPSHOT.jar 补丁 | 查看 | 原始文档 | blame | 历史
Bin/PLTWEB/server/plt-web.jar 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsPortalVIServiceImpl.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-ui/src/api/user.js 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-ui/src/components/flow-design/main.vue 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-ui/src/page/index/top/index.vue 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-ui/src/store/modules/user.js 27 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-ui/src/styles/ui.scss 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/attributePool/index.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-ui/src/views/modelingMenu/ui/Aciton/index.vue 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-ui/src/views/modelingMenu/ui/uiDefine/rightRegion/bottomTable/index.vue 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-ui/src/views/modelingMenu/ui/uiDefine/rightRegion/plShow.vue 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-ui/src/views/processTemplate/customDefine/index.vue 134 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-ui/src/views/processTemplate/customType/index.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-ui/src/views/system/department/index.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-ui/src/views/system/userInfo/index.vue 187 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/plt-web/plt-web-ui/src/views/system/userInfo/userAvatar.vue 52 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Bin/PLTWEB/server/lib/desktop.ini
ÎļþÒÑɾ³ý
Bin/PLTWEB/server/lib/plt-slice-1.0.RELEASE.jar
Binary files differ
Bin/PLTWEB/server/lib/plt-starter-2024.1-SNAPSHOT.jar
Binary files differ
Bin/PLTWEB/server/lib/plt-web-api-2024.1-SNAPSHOT.jar
Binary files differ
Bin/PLTWEB/server/lib/plt-web-base-2024.1-SNAPSHOT.jar
Binary files differ
Bin/PLTWEB/server/lib/plt-web-permission-2024.1-SNAPSHOT.jar
Binary files differ
Bin/PLTWEB/server/plt-web.jar
Binary files differ
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsPortalVIServiceImpl.java
@@ -34,6 +34,7 @@
import com.vci.web.service.OsQuereyTemplateServiceI;
import com.vci.web.util.PlatformClientUtil;
import com.vci.web.util.UITools;
import com.vci.web.util.WebUtil;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
@@ -828,7 +829,7 @@
    @Override
    public PortalVI portalVIDTOO2VI(PortalVIDTO portalVIDTO) {
        PortalVI portalVI = new PortalVI();
        portalVI.id = portalVIDTO.getId();
        portalVI.id = StringUtils.isNotBlank(portalVIDTO.getId()) ? portalVIDTO.getId() : WebUtil.getPk();
        portalVI.typeFlag = portalVIDTO.getTypeFlag();
        portalVI.typeName = portalVIDTO.getTypeName();
        portalVI.viName = portalVIDTO.getViName();
Source/plt-web/plt-web-ui/src/api/user.js
@@ -53,3 +53,20 @@
    params
  });
}
// èŽ·å–å¤´åƒ
export function getUserPhoto(params) {
  return request({
    url: "/api/userQueryController/getUserPhoto",
    method: "get",
    responseType:'blob',
    params
  });
}
// ä¸Šä¼ å¤´åƒ
export function updateUserPhoto(formData) {
  return request({
    url: "/api/userQueryController/updateUserPhoto",
    method: "post",
    data:formData
  });
}
Source/plt-web/plt-web-ui/src/components/flow-design/main.vue
@@ -8,13 +8,13 @@
               width="70%"
               custom-class="flow-design-dialog">
      <wf-design-base ref="bpmn"
                      style="height: 60vh;"
                      :style="'height: '+height+';'"
                      :options="option"></wf-design-base>
    </el-dialog>
    <div v-else>
      <wf-design-base v-if="visible"
                      ref="bpmn"
                      style="height: 60vh;"
                      :style="'height: '+height+';'"
                      :options="option"></wf-design-base>
    </div>
  </div>
@@ -36,6 +36,10 @@
    },
    processInstanceId: String,
    processDefinitionId: String,
    height: {
      type: String,
      default: '60vh'
    },
  },
  data() {
    return {
Source/plt-web/plt-web-ui/src/page/index/top/index.vue
@@ -77,7 +77,7 @@
      </el-tooltip>
      <el-tooltip content="个人信息">
        <div>
          <img :src="userInfo.avatar"
          <img :src="avatar"
               class="top-bar__img"
               @click="gotoInfo">
        </div>
@@ -184,6 +184,9 @@
    listenfullscreen(this.setScreen);
  },
  computed: {
    avatar(){
      return this.userInfo.avatar
    },
    ...mapState({
      showDebug: state => state.common.showDebug,
      showTheme: state => state.common.showTheme,
Source/plt-web/plt-web-ui/src/store/modules/user.js
@@ -4,7 +4,7 @@
import {isURL, validatenull} from '@/util/validate'
import {deepClone, queryStringToObject} from '@/util/util'
import website from '@/config/website'
import {loginByUsername, loginBySocial, loginBySso, getUserInfo, logout, refreshToken, getButtons} from '@/api/user'
import {loginByUsername, loginBySocial, loginBySso, getUserInfo, logout, refreshToken, getButtons,getUserPhoto} from '@/api/user'
import {getTopMenu, getRoutes} from '@/api/system/menu'
import md5 from 'js-md5'
import func from "@/util/func";
@@ -286,12 +286,27 @@
      state.tenantId = tenantId;
      setStore({name: 'tenantId', content: state.tenantId})
    },
    // SET_USER_INFO: (state, userInfo) => {
    //   getUserPhoto().then(res => {
    //     userInfo.avatar = URL.createObjectURL(res.data);
    //     console.log('userInfo',userInfo)
    //   })
    //   state.userInfo = userInfo;
    //   setStore({name: 'userInfo', content: state.userInfo})
    // },
    SET_USER_INFO: (state, userInfo) => {
      if (validatenull(userInfo.avatar)) {
        userInfo.avatar = "/img/bg/img-logo.png";
      }
      state.userInfo = userInfo;
      setStore({name: 'userInfo', content: state.userInfo})
      getUserPhoto().then(res => {
        // å°† Blob è½¬æ¢ä¸º Base64
        const reader = new FileReader();
        reader.onloadend = (result) => {
          userInfo.avatar = reader.result; // å­˜å‚¨ Base64 å­—符串
          // æ›´æ–°çŠ¶æ€å¹¶å­˜å‚¨åˆ° localStorage
          state.userInfo = userInfo;
          setStore({ name: 'userInfo', content: state.userInfo });
        };
        reader.readAsDataURL(res.data); // è°ƒç”¨reader方法
      });
    },
    SET_ROLES: (state, roles) => {
      state.roles = roles;
Source/plt-web/plt-web-ui/src/styles/ui.scss
@@ -371,17 +371,18 @@
}
.avue-dialog .el-dialog{
  top:50%;
  max-height: calc(100% - 80px);
  max-height: calc(100% - 50px);
  max-width: calc(100% - 50px);
  -webkit-transform: translate(-50%, 0);
  transform: translate(-50%, -50%);
  margin-top: 0 !important;
}
.avue-dialog .el-dialog__body{
  padding: 15px 15px 0px 15px; // ä¸Šå³ä¸‹å·¦ å–消表格下边距(会出现滚动条)
  margin-bottom: 10px !important;
  margin-bottom: 5px !important;
}
.avue-dialog .el-dialog__body .avue-form{
  margin: 0px auto 40px; // å•独给对话框里的avue表单加上下边距
  margin: 0px auto 45px; // å•独给对话框里的avue表单加上下边距
}
.dialog-footer{
  background-color: #ffffff;
@@ -408,15 +409,18 @@
.avue-crud table td{
  line-height: 22px;
}
.avue-crud__header{
  min-height: 35px;
}
/**左侧操作栏**/
.avue-crud__left{
  display: flex;
  align-items: center;
  align-items: start;
}
/**右侧侧操作栏**/
.avue-crud__right{
  display: flex;
  align-items: center;
  align-items: start;
}
/**表内操作栏**/
.avue-crud .avue-crud__menu{
Source/plt-web/plt-web-ui/src/views/modelingMenu/modeling/attributePool/index.vue
@@ -675,7 +675,7 @@
        editBtn: this.vaildData(this.permission[this.$route.query.id].EDIT, false),
        exportBtn: this.vaildData(this.permission[this.$route.query.id].EXPORT, false),
        importBtn: this.vaildData(this.permission[this.$route.query.id].IMPORT, false),
        downloadImportTemplateBtn: this.vaildData(this.permission[this.$route.query.id].DOWNLOADFILE, false),
        downloadImportTemplateBtn: this.vaildData(this.permission[this.$route.query.id].DOWNLOAD, false),
        viewTheScopeBtn: this.vaildData(this.permission[this.$route.query.id].VIRTUALVIEW, false),
      };
    },
Source/plt-web/plt-web-ui/src/views/modelingMenu/ui/Aciton/index.vue
@@ -253,13 +253,13 @@
        editBtn: this.vaildData(this.permission[this.$route.query.id].EDIT, false),
        exportBtn: this.vaildData(this.permission[this.$route.query.id].EXPORT, false),
        importBtn: this.vaildData(this.permission[this.$route.query.id].IMPORT, false),
        actionTopAddBtn: this.vaildData(this.permission[this.$route.query.id].USE, false),
        actionTopDelBtn: this.vaildData(this.permission[this.$route.query.id].RESET, false),
        actionTopEditBtn: this.vaildData(this.permission[this.$route.query.id].RECYCLE, false),
        actionTopExportBtn: this.vaildData(this.permission[this.$route.query.id].DOWNLOADFILE, false),
        actionBottomAddBtn: this.vaildData(this.permission[this.$route.query.id].FREEZE, false),
        actionBottomDelBtn: this.vaildData(this.permission[this.$route.query.id].BATCHAPPLY, false),
        actionBottomEditBtn: this.vaildData(this.permission[this.$route.query.id].CODEAPPLY, false),
        actionTopAddBtn: this.vaildData(this.permission[this.$route.query.id].ADD2, false),
        actionTopDelBtn: this.vaildData(this.permission[this.$route.query.id].DELETE2, false),
        actionTopEditBtn: this.vaildData(this.permission[this.$route.query.id].EDIT2, false),
        actionTopExportBtn: this.vaildData(this.permission[this.$route.query.id].DOWNLOAD, false),
        actionBottomAddBtn: this.vaildData(this.permission[this.$route.query.id].ADD3, false),
        actionBottomDelBtn: this.vaildData(this.permission[this.$route.query.id].DELETE3, false),
        actionBottomEditBtn: this.vaildData(this.permission[this.$route.query.id].EDIT3, false),
      };
    },
    treeCrudOption(){
Source/plt-web/plt-web-ui/src/views/modelingMenu/ui/uiDefine/rightRegion/bottomTable/index.vue
@@ -165,7 +165,8 @@
                  <span slot-scope="{ node, data }" class="el-tree-node__label">
                    <span style="display: flex">
                      <i v-if="data.oId=='parentNode'" class="iconShow el-icon-s-home"></i>
                      <icon-show v-else :name="data.iconPath"></icon-show>
                      <icon-show v-if="data.oId!='parentNode' && data.iconPath && data.iconPath!='undefined'"
                                 :name="data.iconPath"></icon-show>
                        {{ (node || {}).label }}
                    </span>
                  </span>
@@ -226,7 +227,9 @@
                      </el-radio>
                    </el-form-item>
                  </el-col>
                  <el-col :span="24" v-show="basicForm.show=='0' && (basicForm.displayMode=='image'||basicForm.displayMode=='textandimage')">
                  <el-col
                    v-show="basicForm.show=='0' && (basicForm.displayMode=='image'||basicForm.displayMode=='textandimage')"
                    :span="24">
                    <el-form-item :class="basicForm.displayMode==='image'?'is-required':''" label="图标:" prop="iconPath">
                      <input-icon v-model="basicForm.iconPath" :disabled="disabledBtn"></input-icon>
                    </el-form-item>
@@ -476,9 +479,10 @@
            ]
          },
          {
            label: '编号',
            label: '序号',
            prop: 'seq',
            width: 100,
            type: 'number',
            labelWidth: 110,
            hide: false,
            rules: [
@@ -889,9 +893,9 @@
    ...mapGetters(["permission"]),
    permissionChildrenList() {
      return {
        UiPageLayoutAddBtn: this.vaildData(this.permission[this.$route.query.id].CLSRIGHT, false),
        UiPageLayoutEditBtn: this.vaildData(this.permission[this.$route.query.id].DATARIGHT, false),
        UiPageLayoutDelBtn: this.vaildData(this.permission[this.$route.query.id].ATTRRIGHT, false),
        UiPageLayoutAddBtn: this.vaildData(this.permission[this.$route.query.id].ADD3, false),
        UiPageLayoutEditBtn: this.vaildData(this.permission[this.$route.query.id].EDIT3, false),
        UiPageLayoutDelBtn: this.vaildData(this.permission[this.$route.query.id].DELETE3, false),
        UiPageLayoutCloneBtn: this.vaildData(this.permission[this.$route.query.id].CLONE, false),
        UiPageLayoutDesignBtn: this.vaildData(this.permission[this.$route.query.id].UPLOAD, false),
      }
@@ -1324,7 +1328,6 @@
        } else {
          return false;
        }
        done();
      });
    },
Source/plt-web/plt-web-ui/src/views/modelingMenu/ui/uiDefine/rightRegion/plShow.vue
@@ -185,7 +185,8 @@
          prop: 'plExtAttr'
        }, {
          label: '描述',
          prop: 'plDesc'
          prop: 'plDesc',
          overHidden: true
        }]
      },
      data: [],
@@ -226,9 +227,9 @@
    ...mapGetters(["permission"]),
    permissionChildrenList() {
      return {
        UiTabAddBtn: this.vaildData(this.permission[this.$route.query.id].BATCHAPPLY, false),
        UiTabEditBtn: this.vaildData(this.permission[this.$route.query.id].BATCHUPDATE, false),
        UiTabDelBtn: this.vaildData(this.permission[this.$route.query.id].DOWNLOADFILE, false),
        UiTabAddBtn: this.vaildData(this.permission[this.$route.query.id].ADD2, false),
        UiTabEditBtn: this.vaildData(this.permission[this.$route.query.id].EDIT2, false),
        UiTabDelBtn: this.vaildData(this.permission[this.$route.query.id].DELETE2, false),
        UiTabCloneBtn: this.vaildData(this.permission[this.$route.query.id].CLONE, false),
      }
    }
Source/plt-web/plt-web-ui/src/views/processTemplate/customDefine/index.vue
@@ -1,7 +1,7 @@
<template>
  <!--流程模板定义-->
  <basic-container style="height: calc(100vh - 123px)">
    <div style="margin-bottom: 5px;">
    <div style="margin-bottom: 10px;">
      æµç¨‹åˆ†ç±»ï¼š
      <el-select v-model="tempType" :clearable="true" placeholder="请选择" size="small"
                 style="width: 300px;margin-right: 20px;"
@@ -77,31 +77,58 @@
                </span>
            </el-button>
          </template>
        </avue-crud>
        <!-- åˆ›å»ºç¼–辑自定义对话框    -->
        <el-dialog
          v-dialogDrag
          v-loading="dialogLoading"
          :title="dialogType === 'add' ? ' åˆ›å»º' : '编辑'"
          title="流程自定义"
          :visible.sync="dialogVisible"
          append-to-body="true"
          class="avue-dialog"
          width="1000px"
          @close="dialogClose"
          :close-on-press-escape="false"
          :fullscreen="true"
          :before-close="handleNutflowClose"
          custom-class="wf-dialog"
        >
          <wf-design-base v-if="nutflowOption.step === 1"
                          class="animated fadeIn"
                          style="height: calc(100vh - 178px);"
                          ref="wf-design"
                          :options="nutflowOption.step1"></wf-design-base>
          <wf-design-base v-if="nutflowOption.step === 2"
                          class="animated fadeIn"
                          style="height: calc(100vh - 178px);"
                          ref="wf-design-view"
                          :options="nutflowOption.step2"></wf-design-base>
            <span slot="footer" class="dialog-footer">
              <el-button size="small" type="primary" @click="saveHandler">ç¡® å®š</el-button>
              <el-button size="small" @click="dialogClose">取 æ¶ˆ</el-button>
              <el-button v-if="nutflowOption.step === 1"
                         size="small"
                         type="success"
                         @click="handleStep(1)">下 ä¸€ æ­¥</el-button>
              <el-button v-if="nutflowOption.step === 2"
                         size="small"
                         type="success"
                         @click="handleStep(-1)">上 ä¸€ æ­¥</el-button>
              <el-button v-if="nutflowOption.step === 2"
                         size="small"
                         type="primary"
                         @click="handleSubmitModel">ç¡® å®š</el-button>
              <el-button size="small"
                         @click="handleNutflowClose(() => {}, true)">取 æ¶ˆ</el-button>
            </span>
        </el-dialog>
        <!-- å¯¼å…¥   -->
        <upload-file ref="upload" :fileType="upFileType" :fileUrl="fileUrl" :tipList="tipList" title="导入流程模板"
                     @updata="getTableList"></upload-file>
      </el-aside>
      <el-main width="60%">
        <div style="height: 100%;background-color: #eeeeea">设计器</div>
        <div style="height: 100%;position: relative;">
          <flow-design style="padding-top: 5px" :is-display.sync="flowBox" :process-definition-id="processDefinitionId" height="calc(100vh - 195px)"></flow-design>
          <div style="position: absolute;top:0;left: 0;height: 100%;width: 100%"></div>
        </div>
      </el-main>
    </el-container>
  </basic-container>
@@ -131,7 +158,21 @@
      tipList:[],
      dialogLoading:false,
      dialogVisible:false,
      dialogType:'add'
      dialogType:'add',
      processDefinitionId: '',
      flowBox: false,
      nutflowOption: {
        process: {},
        step: 1,
        step1: {
          toolbar: ['open', 'create', 'fit', 'zoom-in', 'zoom-out', 'undo', 'redo', 'import', 'preview'],
        },
        step2: {
          mode: 'view',
          simulation: true,
          minimap: true,
        }
      }
    }
  },
  computed: {
@@ -219,29 +260,75 @@
      this.dialogVisible = true;
      this.dialogType = 'edit'
    },
    // ç¼–辑保存
    saveHandler() {
    //保存流程配置
    handleSubmitModel() {
      const registry = this.$refs['wf-design-view'].getElementRegistry().getAll()
      const {businessObject} = registry[0]
      const {id, name, documentation} = businessObject
      const description = (documentation && documentation.length > 0) ? documentation[0].text : null
      const params = {
        ...this.nutflowOption.process,
        modelKey: id,
        name,
        description,
        modelEditorXml: this.nutflowOption.process.xml
      }
      if(this.dialogType=='add'){
        saveProcessTemp(this.form).then(res => {
        saveProcessTemp(params).then(res => {
          if (res.data.code === 200) {
            this.$message.success(res.data.obj);
            this.getTableList();
            this.handleNutflowClose()
          }
        });
      }else{
        updateProcessTemp(this.form).then(res => {
        updateProcessTemp(params).then(res => {
          if (res.data.code === 200) {
            this.$message.success(res.data.obj);
            this.getTableList();
            this.handleNutflowClose()
          }
        })
      }
    },
    dialogClose(){
      this.form={};
      this.dialogLoading=false;
      this.dialogVisible=false;
    handleStep(step) {
      if (step === 1) { // ä¸‹ä¸€æ­¥
        this.$refs['wf-design'].getData('xml').then(data => {
          this.$set(this.nutflowOption.step1, 'xml', data)
          this.$set(this.nutflowOption.step2, 'xml', data)
          this.$set(this.nutflowOption.process, 'xml', data)
          this.$set(this.nutflowOption, 'step', 2)
        })
      } else {
        this.$set(this.nutflowOption, 'step', 1)
      }
    },
    handleNutflowClose(done, flag) {
      const initOption = {
        process: {},
        step: 1,
        step1: {
          toolbar: ['open', 'create', 'fit', 'zoom-in', 'zoom-out', 'undo', 'redo', 'import', 'preview'],
        },
        step2: {
          mode: 'view',
          simulation: true,
          minimap: true,
        }
      }
      if (done || flag) {
        this.$confirm('确定要关闭吗?关闭未保存的修改都会丢失。', '警告', {
          type: 'warning'
        }).then(() => {
          this.$set(this, 'nutflowOption', initOption)
          if (typeof done == 'function') done()
          this.dialogVisible = false
        }).catch(() => {
        })
      } else {
        this.$set(this, 'nutflowOption', initOption)
        this.dialogVisible = false
      }
    },
    // åˆ é™¤
    handleDel(row,index) {
@@ -286,6 +373,9 @@
          this.selectionList = [row];
        }
      );
      //显示流程图
      this.processDefinitionId = row.id;
      this.flowBox = true;
    },
    // å¯¼å‡º
@@ -331,6 +421,10 @@
}
</script>
<style scoped>
<style lang="scss" scoped>
::v-deep {
  .avue-dialog .el-dialog__body{
    margin-bottom: 0 !important;
  }
}
</style>
Source/plt-web/plt-web-ui/src/views/processTemplate/customType/index.vue
@@ -88,7 +88,7 @@
        addBtn:false,
        editBtn:false,
        delBtn:false,
        calcHeight: -60,
        calcHeight: -55,
        align:'left',
        headerAlign:'center',
        menuWidth:160,
Source/plt-web/plt-web-ui/src/views/system/department/index.vue
@@ -186,7 +186,7 @@
        editBtn: this.vaildData(this.permission[this.$route.query.id].EDIT, false),
        assignMembersBtn: this.vaildData(this.permission[this.$route.query.id].FREEZE, false),
        departmentAddChildrenBtn: this.vaildData(this.permission[this.$route.query.id].ADD, false),
        downloadImportTemplateBtn: this.vaildData(this.permission[this.$route.query.id].DOWNLOADFILE, false),
        downloadImportTemplateBtn: this.vaildData(this.permission[this.$route.query.id].DOWNLOAD, false),
        importDepartmentBtn: this.vaildData(this.permission[this.$route.query.id].MGR, false),
        statisticsBtn: this.vaildData(this.permission[this.$route.query.id].DISCARD, false),
      };
Source/plt-web/plt-web-ui/src/views/system/userInfo/index.vue
@@ -1,25 +1,55 @@
<template>
  <div>
    <basic-container>
      <avue-form
        ref="form"
        v-model="form"
        :option="option"
        @submit="handleSubmit"
        @tab-click="handleTabClick">
        <template slot="avatar" slot-scope="{disabled,size}">
          <div>
            <userAvatar :avatar="form.avatar"/>
          </div>
        </template>
      </avue-form>
      <el-tabs v-model="index" @tab-click="handleTabClick">
        <el-tab-pane label="个人信息" name="0">
          <el-form ref="userForm" :model="userForm" :rules="userRules" label-width="90px" size="small">
            <el-form-item label="头像:">
              <userAvatar :avatar="userForm.avatar"/>
            </el-form-item>
            <el-form-item label="用户名:">
              <el-input v-model="userForm.userId" :disabled="true"></el-input>
            </el-form-item>
            <el-form-item label="姓名:" prop="userName">
              <el-input v-model="userForm.userName"></el-input>
            </el-form-item>
            <el-form-item label="当前角色:">
              <el-input v-model="userForm.personName" :disabled="true"></el-input>
            </el-form-item>
            <el-form-item label="邮箱:">
              <el-input v-model="userForm.email"></el-input>
            </el-form-item>
            <el-form-item>
              <el-button type="primary" @click="userSubmit">提交</el-button>
              <el-button @click="handleWitch">清空</el-button>
            </el-form-item>
          </el-form>
        </el-tab-pane>
        <el-tab-pane label="修改密码" name="1">
          <el-form ref="passWordForm" :model="passWordForm" :rules="rules" label-width="145px" size="small">
            <el-form-item label="登陆密码:" prop="oldPassword">
              <el-input v-model="passWordForm.oldPassword"></el-input>
            </el-form-item>
            <el-form-item label="新登陆密码:" prop="password">
              <el-input v-model="passWordForm.password"></el-input>
            </el-form-item>
            <el-form-item label="新密码登陆确认:" prop="confirmPassword">
              <el-input v-model="passWordForm.confirmPassword"></el-input>
            </el-form-item>
            <el-form-item>
              <el-button type="primary" @click="passWordSubmit">提交</el-button>
              <el-button @click="handleWitch">清空</el-button>
            </el-form-item>
          </el-form>
        </el-tab-pane>
      </el-tabs>
    </basic-container>
  </div>
</template>
<script>
import option from "@/option/user/info";
import {getUserInfo, updateInfo, updatePassword} from "@/api/system/user";
import {updateUser} from "@/api/system/user/api";
import func from "../../../util/func";
import {changePassword} from "../../../api/user"
import userAvatar from "./userAvatar";
@@ -30,9 +60,26 @@
  components: {userAvatar,},
  data() {
    return {
      index: 0,
      index: '0',
      option: option,
      form: {}
      userForm: {},
      passWordForm: {},
      userRules: {
        userName: [
          {required: true, message: '请输入密码', trigger: 'blur'},
        ],
      },
      rules: {
        oldPassword: [
          {required: true, message: '请输入密码', trigger: 'blur'},
        ],
        password: [
          {required: true, message: '请输入密码', trigger: 'blur'},
        ],
        confirmPassword: [
          {required: true, message: '请输入密码', trigger: 'blur'},
        ],
      }
    };
  },
  computed: {
@@ -42,58 +89,74 @@
    this.handleWitch();
  },
  methods: {
    handleSubmit(form, done) {
      if (this.index === 0) {
        updateInfo(form).then(res => {
          if (res.data.success) {
            this.$message({
              type: "success",
              message: "修改信息成功!"
            });
          } else {
            this.$message({
              type: "error",
              message: res.data.msg
            });
          }
          done();
        }, error => {
          window.console.log(error);
          done();
        })
      } else {
        let userInfo = JSON.parse(localStorage.getItem('saber-userInfo'));
        let params = {
          userName: userInfo.content.userId,
          oldPassword: func.encryptData(form.oldPassword, 'daliantan0v0vcip'),
          password: func.encryptData(form.password, 'daliantan0v0vcip'),
          confirmPassword: func.encryptData(form.confirmPassword, 'daliantan0v0vcip'),
        }
        changePassword(params).then(res => {
          if (res.data.code === 200) {
            this.$message.success(res.data.msg);
            this.passwordVisible = false;
            this.$store.dispatch("LogOut").then(() => {
              resetRouter();
              this.$router.push({path: "/login"});
            });
          }
        }).catch(err => {
          console.log(err);
        })
      }
    },
    handleWitch() {
      if (this.index === 0) {
        this.form = {...this.userInfo};
        console.log(this.form);
      if (this.index === '0') {
        const {avatar, userId, userName, email, personName} = this.userInfo;
        this.userForm = {avatar, userId, userName, email, personName};
      } else {
        this.passWordForm = {};
        this.$refs.passWordForm.clearValidate();
      }
    },
    handleTabClick(tabs) {
      this.index = func.toInt(tabs.index);
      this.index = tabs.index
      this.handleWitch();
      this.$refs.form.resetFields();
    },
    userSubmit() {
      console.log('123')
      this.$refs.userForm.validate((valid) => {
        if (valid) {
          const params = {
            id: this.userInfo.userId,
            name: this.userForm.userName,
            email: this.userForm.email
          }
          updateUser(params).then(res => {
            if (res.data.success) {
              this.$message({
                type: "success",
                message: "修改信息成功!"
              });
            } else {
              this.$message({
                type: "error",
                message: res.data.msg
              });
            }
            done();
          })
        } else {
          return false;
        }
      });
    },
    passWordSubmit() {
      this.$refs.passWordForm.validate((valid) => {
        if (valid) {
          let userInfo = JSON.parse(localStorage.getItem('saber-userInfo'));
          let params = {
            userName: userInfo.content.userId,
            oldPassword: func.encryptData(this.passWordForm.oldPassword, 'daliantan0v0vcip'),
            password: func.encryptData(this.passWordForm.password, 'daliantan0v0vcip'),
            confirmPassword: func.encryptData(this.passWordForm.confirmPassword, 'daliantan0v0vcip'),
          }
          changePassword(params).then(res => {
            if (res.data.code === 200) {
              this.$message.success(res.data.msg);
              this.$store.dispatch("LogOut").then(() => {
                resetRouter();
                this.$router.push({path: "/login"});
              });
            }
          }).catch(err => {
            console.log(err);
          })
        } else {
          return false;
        }
      });
    }
  }
};
Source/plt-web/plt-web-ui/src/views/system/userInfo/userAvatar.vue
@@ -61,7 +61,9 @@
<script>
import store from "@/store";
import { VueCropper } from "vue-cropper";
import { uploadAvatar } from "@/api/system/user";
import {getUserPhoto, updateUserPhoto} from "@/api/user";
import {mapGetters} from "vuex";
import {setStore} from '@/util/store'
export default {
  components: { VueCropper },
@@ -74,18 +76,23 @@
      visible: false,
      // å¼¹å‡ºå±‚标题
      title: "修改头像",
      options: {
        img: this.avatar,  //裁剪图片的地址
      previews: {},
      resizeHandler: null
    };
  },
  computed: {
    ...mapGetters(["userInfo"]),
    options() {
      return {
        img: this.userInfo.avatar,  //裁剪图片的地址
        autoCrop: true,             // æ˜¯å¦é»˜è®¤ç”Ÿæˆæˆªå›¾æ¡†
        autoCropWidth: 200,         // é»˜è®¤ç”Ÿæˆæˆªå›¾æ¡†å®½åº¦
        autoCropHeight: 200,        // é»˜è®¤ç”Ÿæˆæˆªå›¾æ¡†é«˜åº¦
        fixedBox: true,             // å›ºå®šæˆªå›¾æ¡†å¤§å° ä¸å…è®¸æ”¹å˜
        outputType:"png",           // é»˜è®¤ç”Ÿæˆæˆªå›¾ä¸ºPNG格式
        filename: 'avatar'          // æ–‡ä»¶åç§°
      },
      previews: {},
      resizeHandler: null
    };
      }
    }
  },
  methods: {
    // ç¼–辑头像
@@ -125,7 +132,7 @@
    // ä¸Šä¼ é¢„处理
    beforeUpload(file) {
      if (file.type.indexOf("image/") == -1) {
        this.$modal.msgError("文件格式错误,请上传图片类型,如:JPG,PNG后缀的文件。");
        this.$message.error("文件格式错误,请上传图片类型,如:JPG,PNG后缀的文件。");
      } else {
        const reader = new FileReader();
        reader.readAsDataURL(file);
@@ -133,19 +140,21 @@
          this.options.img = reader.result;
          this.options.filename = file.name;
        };
        this.$refs.cropper.refresh();
      }
    },
    // ä¸Šä¼ å›¾ç‰‡
    uploadImg() {
      this.$refs.cropper.getCropBlob(data => {
        console.log(data);
        let formData = new FormData();
        formData.append("avatarfile", data, this.options.filename);
        uploadAvatar(formData).then(response => {
        formData.append("file", data, this.options.filename);
        formData.append("username",this.userInfo.userId);
        updateUserPhoto(formData).then(response => {
          this.open = false;
          this.options.img = process.env.VUE_APP_BASE_API + response.imgUrl;
          store.commit('SET_AVATAR', this.options.img);
          this.$modal.msgSuccess("修改成功");
          this.$message.success('修改成功!');
          this.getUserInfo();
          this.visible = false;
        });
      });
@@ -156,9 +165,22 @@
    },
    // å…³é—­çª—口
    closeDialog() {
      this.options.img = store.getters.avatar
      this.options.img = this.userInfo.avatar; // å…³é—­çª—口更新为缓存中的头像地址 å¦‚修改成功更新为最新的 å¦‚修改后未保存更新为缓存中的
      this.visible = false;
      window.removeEventListener("resize", this.resizeHandler)
    },
    // æ›´æ–°ç¼“存内容
    getUserInfo(){
      getUserPhoto().then(res => {
        // å°† Blob è½¬æ¢ä¸º Base64
        const reader = new FileReader();
        reader.onloadend = (result) => {
          this.userInfo.avatar = reader.result; // å­˜å‚¨ Base64 å­—符串
          setStore({ name: 'userInfo', content:  this.userInfo });
        };
        reader.readAsDataURL(res.data); // è°ƒç”¨reader方法
      });
    }
  }
};