wangting
2024-05-09 4e778d7f61e2508455e3a69815f7a17c455d81da
调整列表中按钮展示位置及默认按钮
已修改6个文件
已重命名4个文件
已添加1个文件
219 ■■■■ 文件已修改
Source/ProjectWeb/src/components/PLT-basic-component/basicForm.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/ProjectWeb/src/components/actions/AddEditDialog.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/ProjectWeb/src/components/actions/base/AddAction.js 补丁 | 查看 | 原始文档 | blame | 历史
Source/ProjectWeb/src/components/actions/base/BaseAction.js 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/ProjectWeb/src/components/actions/base/DeleteAction.js 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/ProjectWeb/src/components/actions/base/EditAction.js 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/ProjectWeb/src/components/actions/base/TabViewAction.js 98 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/ProjectWeb/src/components/dynamic-components/dynamic-button.vue 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/ProjectWeb/src/components/dynamic-components/dynamic-form.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/ProjectWeb/src/components/dynamic-components/dynamic-table.vue 36 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/ProjectWeb/src/components/dynamic-components/dynamic-tree.vue 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/ProjectWeb/src/components/PLT-basic-component/basicForm.vue
@@ -212,6 +212,10 @@
          required: item.required,
          message: `请输入${item.text}!`,
          trigger: "blur"
        },{
          required: item.required,
          message: `请输入${item.text}!`,
          trigger: "submit"
        }]):[]
      };
      if(!this.isEdit){
Source/ProjectWeb/src/components/actions/AddEditDialog.vue
@@ -43,7 +43,7 @@
<script>
import uiView from "@/views/base/UIContentViewerInDialog"
import {parseEventByUrl} from "@/actions/base/BaseAction"
import {parseEventByUrl} from "@/components/actions/base/BaseAction"
import {getFormDefineById,dataForm} from "@/api/base/ui";
import {addSave,editSave} from "@/api/base/actions"
import {validatenull} from "@/util/validate"
Source/ProjectWeb/src/components/actions/base/AddAction.js
Source/ProjectWeb/src/components/actions/base/BaseAction.js
ÎļþÃû´Ó Source/ProjectWeb/src/actions/base/BaseAction.js ÐÞ¸Ä
@@ -65,17 +65,22 @@
    //通用action
    const handlers = {
      //查看
      view: () => {},
      view: () => {import("@/components/actions/base/TabViewAction").then(module => {
        module.doAction(options,callback);
      })},
      //创建
      add: () => {import("@/actions/base/AddAction").then(module => {
      add: () => {import("@/components/actions/base/AddAction").then(module => {
        module.doAction(options,callback);
      })},
      //修改
      edit: () =>  {import("@/actions/base/EditAction").then(module => {
      edit: () =>  {import("@/components/actions/base/EditAction").then(module => {
        module.doAction(options,callback);
      })},
      //删除
      delete: () =>  {import("@/actions/base/DeleteAction").then(module => {
      delete: () =>  {import("@/components/actions/base/DeleteAction").then(module => {
        module.doAction(options,callback);
      })},  //删除
      del: () =>  {import("@/components/actions/base/DeleteAction").then(module => {
        module.doAction(options,callback);
      })},
    };
Source/ProjectWeb/src/components/actions/base/DeleteAction.js
ÎļþÃû´Ó Source/ProjectWeb/src/actions/base/DeleteAction.js ÐÞ¸Ä
@@ -81,7 +81,7 @@
 * @param callback å›žè°ƒ
 */
export const doBefore = (options,callback)=> {
  Vue.prototype.$message.success('执行删除前置事件');
  console.log('执行删除前置事件');
  if(callback){
    callback(options);
  }
@@ -92,7 +92,7 @@
 * @param callback å›žè°ƒ
 */
export const doAfter = (options,callback,actionType)=> {
  Vue.prototype.$message.success('执行删除后置事件');
  console.log('执行删除后置事件');
  if(callback){
    callback(actionType);
  }
Source/ProjectWeb/src/components/actions/base/EditAction.js
ÎļþÃû´Ó Source/ProjectWeb/src/actions/base/EditAction.js ÐÞ¸Ä
@@ -85,7 +85,7 @@
 * @param callback å›žè°ƒ
 */
export const doBefore = (options,callback)=> {
  Vue.prototype.$message.success('执行修改前置事件');
  console.log('执行修改前置事件');
  if(callback){
    callback(options);
  }
@@ -96,7 +96,7 @@
 * @param callback å›žè°ƒ
 */
export const doAfter = (options,callback,actionType)=> {
  Vue.prototype.$message.success('执行修改后置事件');
  console.log('执行修改后置事件');
  if(callback){
    callback(actionType);
  }
Source/ProjectWeb/src/components/actions/base/TabViewAction.js
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,98 @@
/**
 * æŒ‰é’®å¤„理 é¡µé¢å±•示为tab选项卡
 */
import {paramLow,callPreEvent,callPostEvent,replaceFreeMarker} from './BaseAction';
import {validatenull} from "@/util/validate";
import Vue from "vue";
import AddEditDialog from "@/components/actions/AddEditDialog";
import Layout from "@/router/page";
import router from '@/router/router';
export const doAction = (options,callback) => {
  const paramVOS = Object.assign({
    getdataurl: '/api/uiDataController/dataFormQuery',
    getdatamethod: 'post',
    url: '/api/uiDataController/editSave',
    method: 'put',
    uploadfileurl: 'vciFileUploadController/uploadFile'
  }, options.paramVOS)
  options.paramVOS = paramVOS;
  options.sourceData = options.sourceData || {};
  options.dataStore = options.dataStore || [];
  if (!options.dataStore || options.dataStore.length < 1) {
    Vue.prototype.$message.error("请选择需要浏览的数据");
    return false;
  }
  if (!paramVOS.multi && options.dataStore.length > 1) {
    Vue.prototype.$message.error("仅能选择一条数据来操作");
    return false;
  }
  callPreEvent(options, doBefore, function (options) {
    doView(options, function (type,formData) {
      callPostEvent(options, doAfter,type, callback);
    });
  });
};
/**
 * æ‰§è¡Œ
 * @param options æŒ‰é’®çš„配置信息
 * @param callback å›žè°ƒ
 */
export const doView = (options,callback)=> {
  const paramVOS = options.paramVOS;
  let component = '@/views/base/UIContentViewerInDialog';
  if (!validatenull(paramVOS.customurl)) {
    //自定义js
    component = `@/views/custom-ui/` + paramVOS.customurl;
  }else{
    if (!paramVOS['type'] || !paramVOS['context']) {
      Vue.prototype.$message.error("按钮配置不正确");
      return false;
    }
  }
  let name="查看数据"
  if(paramVOS.showname){
    name=replaceFreeMarker(paramVOS.showname,options.dataStore,options.sourceData)
  }
  router.addRoutes({
    path: '/view-form'+options.dataStore[0].oid,
    name: name,
    component: Layout,
    meta: {
      keepAlive: true,
      isTab: true
    },
    children: [
      {
        path: '', // ç©ºè·¯å¾„表示访问 '/dynamic-form' æ—¶åŠ è½½ Layout ç»„ä»¶
        component: () => import(component),
        props: true
      }
    ]
    })
}
/**
 * å‰ç½®äº‹ä»¶
 * @param options æŒ‰é’®çš„配置信息
 * @param callback å›žè°ƒ
 */
export const doBefore = (options,callback)=> {
  console.log('执行查看前置事件');
  if(callback){
    callback(options);
  }
}
/**
 * åŽç½®äº‹ä»¶
 * @param options æŒ‰é’®çš„配置信息
 * @param callback å›žè°ƒ
 */
export const doAfter = (options,callback,actionType)=> {
  console.log('执行查看后置事件');
  if(callback){
    callback(actionType);
  }
}
Source/ProjectWeb/src/components/dynamic-components/dynamic-button.vue
@@ -5,21 +5,22 @@
      <!--top展示表格上方区域 menu展示表格操作栏区域 æ— å°±æ˜¯é»˜è®¤ -->
      <el-button v-for="item in basicButtonList.top"
                 v-if="LocationType === 'top'"
                 :key="item.oid" :icon="item.paramVOS.webUiButtonIcon"
                 :type="item.paramVOS.webUiButtonType || 'primary'" plain
                 :key="item.oid" :icon="item.paramVOS.icon"
                 :type="item.paramVOS.btnType || 'primary'" plain
                 size="small"
                 @click="buttonClick(item)">
        {{ item.name }}
      </el-button>
      <el-button type="text" @click="handleDefaultAddChildren(scope.row)" v-if="(LocationType === 'menu' && this.default === 'default')">新增子级</el-button>
      <el-button type="text" @click="handleDefaultAddChildren(scope.row)" v-if="(LocationType === 'menu' && type === 'TreeTable')">新增子级</el-button>
      <el-button type="text" icon="el-icon-view" size="small" plain @click="$emit('rowView',scope.row,scope.index)" v-if="LocationType === 'menu'">查看</el-button>
      <el-button v-for="item in basicButtonList.menu"
                 v-if="LocationType === 'menu'"
                 :key="item.oid"
                 :icon="item.paramVOS.webUiButtonIcon ? item.paramVOS.webUiButtonIcon : (item.paramVOS.webUiButtonMethods === 'edit' ? 'el-icon-edit' : (item.paramVOS.webUiButtonMethods === 'delete' ? 'el-icon-delete' : ''))"
                 :type="item.paramVOS.webUiButtonType || 'text'" plain
                 :icon="item.paramVOS.icon ? item.paramVOS.icon : (item.id === 'edit' ? 'el-icon-edit' : (item.id === 'delete'  ||item.id === 'del' ? 'el-icon-delete' : ''))"
                 :type="item.paramVOS.btnType || 'text'" plain
                 size="small"
                 @click="buttonClick(item)">
                 @click="buttonClick(item,scope.row)">
        {{ item.name }}
      </el-button>
@@ -31,8 +32,8 @@
    <div v-else-if="type === 'form'">
      <el-button v-for="item in basicButtonList"
                 :key="item.oid"
                 :icon="item.paramVOS.webUiButtonIcon"
                 :type="(item.paramVOS.webUiButtonType !== 'text' ? item.paramVOS.webUiButtonType : 'primary') || 'primary'"
                 :icon="item.paramVOS.icon"
                 :type="item.paramVOS.btnType || 'primary'"
                 plain
                 size="small"
                 @click="buttonClick(item)">
@@ -42,12 +43,18 @@
    <div v-else-if="type === 'tree'" class="tree-buttons">
      <el-button v-for="item in basicButtonList"
                 :key="item.oid"
                 :icon="item.paramVOS.webUiButtonIcon"
                 :type="(item.paramVOS.webUiButtonType !== 'text' ? item.paramVOS.webUiButtonType : 'primary') || 'primary'"
                 :icon="item.paramVOS.icon"
                 :type="item.paramVOS.btnType || 'primary'"
                 plain
                 size="small"
                 @click="buttonClick(item)">
        {{ item.name }}
      </el-button>
      <el-button type="primary"
                 plain
                 size="small"
                 @click="$emit('refresh')">
        åˆ·æ–°
      </el-button>
    </div>
  </div>
@@ -56,7 +63,7 @@
<script>
import func from "@/util/func";
import {validatenull} from "@/util/validate";
import {doAction} from '@/actions/base/BaseAction';
import {doAction} from '@/components/actions/base/BaseAction';
import Vue from "vue";
export default {
@@ -77,9 +84,6 @@
    },
    butttonList: {
      type: Array
    },
    default:{
      type:String,
    },
    sourceData: {
      //按钮所属区域的上一区域选中数据
@@ -111,10 +115,20 @@
        return basicColumn;
      } else if (this.type === 'table' || this.type === 'TreeTable') {
        const top = basicColumn.filter(item => {
          return item.paramVOS && (item.paramVOS.webUiButtonLocation === 'top' || func.isEmpty(item.paramVOS.webUiButtonLocation));
          if (item.paramVOS && item.paramVOS.webUiButtonLocation && item.paramVOS.webUiButtonLocation !== 'menu') {
            return true;
          } else if (item.id != "edit" && item.id != "del" && item.id != "delete" &&  item.id != "refresh") {
            return true;
          }
          return false
        });
        const menu = basicColumn.filter(item => {
          return item.paramVOS && item.paramVOS.webUiButtonLocation === 'menu';
          if (item.paramVOS && item.paramVOS.webUiButtonLocation && item.paramVOS.webUiButtonLocation === 'menu') {
            return true
          } else if (item.id == "edit" || item.id == "del" || item.id == "delete"){
            return true;
          }
            return false;
        });
        return {
          top: top,
@@ -130,7 +144,7 @@
      this.formName = '新增子级'
      this.$refs.dynamicForm.form = row;
    },
    buttonClick(buttonitem) {
    buttonClick(buttonitem,rowData) {
      const paramVOS = buttonitem.paramVOS;
      const DefineVO = this.componentVO.treeDefineVO || this.componentVO.tableDefineVO || this.componentVO.treeTableDefineVO || this.componentVO.formDefineVO;
      if (!paramVOS['title']) {
@@ -150,7 +164,7 @@
      //paramVOS.customBtn //弹窗默认有保存按钮,customBtn为true时内容展示自定义按钮
      doAction(buttonitem, {
        paramVOS: paramVOS,
        dataStore: this.dataStore || [],
        dataStore: rowData || this.dataStore || [],
        sourceData: this.sourceData || {}
      }, function (actionType,data) {
        that.$emit("afterMethod",actionType,data);
Source/ProjectWeb/src/components/dynamic-components/dynamic-form.vue
@@ -167,7 +167,7 @@
      }
      if (Object.keys(this.sourceData).length>0 && this.isShow && this.actionType!="add") {
        this.loading = true;
        dataForm(this.params).then(res => {
        dataForm(this.params, this.paramVOS.getdataurl, this.paramVOS.getdatamethod).then(res => {
          this.form = res.data.obj;
          this.loading = false;
        }).catch(error => {
Source/ProjectWeb/src/components/dynamic-components/dynamic-table.vue
@@ -13,7 +13,7 @@
               @size-change="sizeChange"
               @row-click="rowClickChange"
               @search-change='searchChange'
               @filter-change="filterChange"
               @filter="filterChange"
               @selection-change="selectChange">
      <!--top区域按钮-->
      <template slot="menuLeft" slot-scope="scope">
@@ -29,6 +29,7 @@
        <dynamic-button :componentVO="componentVO" :butttonList="componentVO.buttons" :scope="scope" :dataStore="selectList" :sourceData="sourceData"
                        LocationType="menu"
                        @afterMethod="handleRefresh"
                        @rowView="rowView"
                        type="table"></dynamic-button>
      </template>
      <template  slot="menuRight" slot-scope="scope">
@@ -144,6 +145,7 @@
        filterBtn:false,
        selection: true,
        tip: false,
        menuWidth:260,
        height: '100%',
        calcHeight: 15,
        indexFixed: false,
@@ -313,7 +315,7 @@
    onLoad(page, params = {}) {
      if (Object.keys(this.sourceData).length>0 && this.isShow) {
        this.loading = true;
        getList(page.currentPage, page.pageSize, Object.assign(params,this.params,this.query)).then(res => {
        getList(page.currentPage, page.pageSize, Object.assign({},this.params,this.query,params)).then(res => {
          let data = [];
          if (res.data && res.data.data) {
            data = res.data.data;
@@ -334,6 +336,9 @@
        });
      }
    },
    rowView(row,index){
      this.$refs.dataTable.rowView(row,index)
    },
    rowClickChange(row){
      this.$refs.dataTable.toggleRowSelection(row);
    },
@@ -353,14 +358,33 @@
      this.page.pageSize = pageSize;
    },
    searchChange(params,done){
      this.query = params;
      this.query = {};
      for (let i in params) {
        this.query['conditionMap["' + i + '"]'] = "*" + params[i] + "*";
      }
      this.page.currentPage = 1;
      this.onLoad(this.page);
      done();
    },
    filterChange(result){
      debugger;
      let parms={}
      for (let i in result) {
        if(!validatenull(result[i][2])) {
          const fieldVal = result[i][2]
          if (result[i][1] == "=") {
            parms['conditionMap["' + result[i][0] + '"]'] = fieldVal;
          } else if (result[i][1] == "≠") {
            parms['conditionMap["' + result[i][0] + '"]'] = '!=' + fieldVal;
          } else if (result[i][1] == "like") {
            parms['conditionMap["' + result[i][0] + '"]'] = "*" + fieldVal + "*";
          } else if (result[i][1] == "∈") {
            parms['conditionMap["' + result[i][0] + '"]'] = "*" + fieldVal + "*";
          } else {
            parms['conditionMap["' + result[i][0] + '"]'] = result[i][1] + fieldVal;
          }
        }
      }
      this.onLoad(this.page,parms);
    },
    searchReset() {
      this.query = {};
@@ -375,7 +399,7 @@
      }
    },
    handleRefresh(type) {
      this.onLoad(this.page, this.query);
      this.onLoad(this.page);
    },
    rowExcel() {
      //导出
Source/ProjectWeb/src/components/dynamic-components/dynamic-tree.vue
@@ -4,6 +4,7 @@
                    :key="areasName+'buttons-'+componentVO.oid"
                    :butttonList="componentVO.buttons" :dataStore="checkDatas"
                    @afterMethod="handleRefresh"
                    @refresh="initData"
                    :sourceData="sourceData" type="tree" style="margin-bottom: 5px;"></dynamic-button>
    <el-input
      placeholder="输入关键字进行过滤"
@@ -155,10 +156,6 @@
    }
  },
  created() {
    this.getParams();
    if (!this.lazy) {
      this.initData();
    }
  },
  mounted() {
    if(this.componentVO.buttons && this.componentVO.buttons.length>0){
@@ -223,6 +220,7 @@
      this.params = Object.assign({}, treeParams, sourceDataMapList);
    },
    initData() {
      this.data=[];
      if (Object.keys(this.sourceData).length > 0 && this.isShow) {
        getTree(null, null, Object.assign({
          queryRoot: true