yuxc
2024-04-25 2cbad4e40c2938a90172aa24551e82a4817b9640
Merge remote-tracking branch 'origin/master'
已修改4个文件
已删除1个文件
已添加1个文件
243 ■■■■ 文件已修改
Source/ProjectWeb/src/actions/base/AddAction.js 27 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/ProjectWeb/src/api/system/dict.js 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/ProjectWeb/src/components/PLT-basic-component/BasicForm.vue 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/ProjectWeb/src/components/actions/AddEditDialog.vue 93 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/ProjectWeb/src/components/actions/formDialog.vue 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/ProjectWeb/src/components/dynamic-components/dynamic-form.vue 70 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/ProjectWeb/src/actions/base/AddAction.js
@@ -4,7 +4,7 @@
import {paramLow,callPreEvent, callPostEvent} from './BaseAction';
import {validatenull} from "@/util/validate";
import Vue from "vue";
import AddEditDialog from "@/components/actions/AddEditDialog"
export const doAction = (options) => {
  options.paramVOS = paramLow(options.paramVOS)
@@ -31,15 +31,32 @@
 */
export const doAdd = (options,callback)=> {
  const paramVOS = options.paramVOS;
  if (!paramVOS['form'] && !paramVOS['context']) {
  if (!paramVOS['form'] && !paramVOS['context']&& !paramVOS['content']) {
    Vue.prototype.$message.error("按钮配置不正确");
    return false;
  }
  Vue.prototype.$message.success('执行'+paramVOS.title);
  if(callback){
    callback(options);
  const dialogConstructor = Vue.extend(AddEditDialog);
  let instance = new dialogConstructor();
  instance.props={
    sourceData:options.sourceData,
    dataStore:options.dataStore,
    paramVOS:paramVOS
  }
  const vm = instance.$mount();
  vm.visible=true;
  vm.dialogClose=function (){
    document.body.removeChild(vm.$el);
    instance.$destroy();
    instance = null;
  };
  vm.prototype.saveCallback=function (){
    if (callback) {
      callback(options);
    }
  }
  document.body.appendChild(vm.$el);
}
/**
 * å‰ç½®äº‹ä»¶
Source/ProjectWeb/src/api/system/dict.js
@@ -1,5 +1,17 @@
import request from '@/router/axios';
//获取下拉
export const getDicts = (id) => {
  return request({
    url: '/api/uiDataController/getEnum',
    method: 'get',
    params: {
      comboxKey:id,
      id:id
    }
  })
}
export const getList = (current, size, params) => {
  return request({
    url: '/api/blade-system/dict/list',
Source/ProjectWeb/src/components/PLT-basic-component/BasicForm.vue
@@ -22,6 +22,7 @@
import vciWebRefer from "@/components/refer/vciWebRefer.vue";
import { formatMilliseconds } from "@/util/formatTime";
import { validatenull } from "@/util/validate";
import { getDicts } from "@/api/system/dict";
export default {
  name: "basicForm",
@@ -74,6 +75,7 @@
        datetime: "datetime",
        date: "date",
        refer: "refer",
        multiFile:"upload"
      }
    };
  },
@@ -148,14 +150,15 @@
      this.option.group = group;
    },
    initItem(item){
      const type=this.columnType[this.type] || this.type
      const type=this.columnType[item.type] || item.type
      const col= {
        ...item,
        label: item.text,
        prop: item.field,
        showProp:item.showField,
        type: type,
        labelWidth: this.labelWidth || (item.text.length >= 6 ? 115 : 90),
        disabled: item.disabled || this.disabled,
        disabled: item.readOnly || this.disabled,
        span: item.span
          ? item.span
          : item.type === "textarea"
@@ -174,16 +177,20 @@
          trigger: "blur"
        }]
      }
      if (col.propType === "dict") {
      if (col.type === "select") {
        if(!validatenull(col.dictCode)) {
          /*this.getDicts(col.dictCode).then((res) => {
            if (res.success) {
              const dic = res.obj.data;
          /*getDicts(col.dictCode).then((res) => {
            if (res.data.success){
              if(res.data.data && res.data.obj == null){
                res.data.obj = res.data.data
              }
              const dic = res.data.obj;
              col.dicData = dic.map((d) => {
                return {
                  label: d.name,
                  key: d.code,
                  value: d.code,
                  label: d.value,
                  key: d.key,
                  value: d.key,
                  attributes:d.attributes
                };
              });
            }
Source/ProjectWeb/src/components/actions/AddEditDialog.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,93 @@
<template>
  <el-dialog v-dialogDrag
             :title="paramVOS.title"
             :visible.sync="visible"
             :width="width"
             :style="'height:'+height || 'auto'"
             :append-to-body="true"
             class="avue-dialog avue-dialog--top"
             @close="dialogClose">
    dialog
    <basic-form ref="formRef" v-if="paramVOS.form"></basic-form>
    <ui-view ref="uiViewRef" v-else-if="paramVOS.content || paramVOS.context"></ui-view>
    <div v-if="paramVOS.form" class="avue-dialog__footer">
      <el-button type="primary" @click="saveHandler">保 å­˜</el-button>
      <el-button @click="escHandler">取 æ¶ˆ</el-button>
      <el-button @click="resetValue">重 ç½®</el-button>
    </div>
  </el-dialog>
</template>
<script>
import uiView from "@/views/base/UIContentViewerInDialog"
import {dataForm} from "@/api/base/ui";
export default {
  name: "AddEditDialog",
  components:{uiView},
  props: {
    sourceData: {
      //所属区域的上一区域选中数据
      type: Object,
      default: {}
    },
    dataStore: {
      //弹窗时按钮所属区域选中数据
      type: Array,
      default: []
    },
    paramVOS: {
      type: Object,
      default: {}
    },
    width: {
      type: String,
      default:'70%'
    },
    height: {
      type: String,
      default:'500px'
    },
  },
  data(){
    return {
      visible:false
    }
  },
  computed:{
  },
  created() {
  },
  methods: {
    dialogClose() {
      this.visible = false;
    },
    onLoad: function () {
      if (Object.keys(this.sourceData).length > 0 && this.isShow) {
        this.loading = true;
        dataForm(this.params).then(res => {
          this.form = res.data.obj;
          this.loading = false;
        }).catch(error => {
          this.$message.error(error);
          this.loading = false;
        });
      }
    },
    saveHandler() {
      this.dialogClose();
    },
    escHandler() {
      this.dialogClose();
    },
    resetValue() {
      this.$refs.formRef.resetValue();
    }
  }
}
</script>
<style scoped>
</style>
Source/ProjectWeb/src/components/actions/formDialog.vue
ÎļþÒÑɾ³ý
Source/ProjectWeb/src/components/dynamic-components/dynamic-form.vue
@@ -9,6 +9,7 @@
</template>
<script>
import {dataForm} from "@/api/base/ui";
export default {
  name: "dynamic-form",
@@ -38,6 +39,10 @@
      type: Object,
      default: {}
    },
    //上一区域业务类型
    sourceBtmType:{
      type: String
    },
    dataStore: {
      //弹窗时按钮所属区域选中数据
      type: Array,
@@ -56,6 +61,9 @@
  data() {
    return {
      form: {},
      params:{},
      sourceDataMapParams:{},
      currentDefineVO:this.componentVO.formDefineVO,
    }
  },
  mounted() {
@@ -76,13 +84,71 @@
    sourceData: {
      handler(newval) {
        //源数据有变化时变更当前区域数据
        console.log(this.areasName);
        console.log(newval);
        this.sourceDataMapParams=this.sourceDataMap();
        this.getParams();
        this.handleRefresh();
      }
    }
  },
  created() {
    this.getParams();
  },
  methods: {
    sourceDataMap: function () {
      const sourceDataMap = {};
      if (Object.keys(this.sourceData).length>0) {
        if(this.sourceData.oid ) {
          if (this.sourceData.oid.indexOf('@vcitreesep@') > -1) {
            this.sourceData.oid = this.sourceData.oid.split('@vcitreesep@')[1];
          }
          sourceDataMap.sourceBtmName = this.sourceBtmType;;
          sourceDataMap.sourceOid = this.sourceData.oid;
        }
        for (let i in this.sourceData) {
          let item = this.sourceData[i]
          if (item && item.constructor === Object) return;
          if (i == 'type' || i == 'context' || i == 'content') return;
          sourceDataMap['sourceData["' + i + '"]'] = item
        }
      }
      if (Object.keys(this.paramVOS).length>0) {
        for (let i in this.paramVOS) {
          let item = this.paramVOS[i]
          if (item && item.constructor === Object) return;
          if (i == 'type' || i == 'context' || i == 'content') return;
          sourceDataMap['sourceData["' + i + '"]'] = item
        }
      }
      return sourceDataMap;
    },
    getParams: function () {
      const formParams = {
        btmname: this.currentDefineVO.btmType,
        btmType:this.currentDefineVO.btmType,
        formDefineId: this.currentDefineVO.id,
        oid:this.currentDefineVO.oid
      };
      if(this.dataStore[0] && this.dataStore[0].oid) {
        formParams.oid = this.dataStore[0].oid;
      }
      const sourceDataMapList = this.sourceDataMapParams;
      this.params = Object.assign({},formParams, sourceDataMapList);
      console.log(this.params)
    },
    onLoad:function () {
      if (Object.keys(this.sourceData).length>0 && this.isShow) {
        this.loading = true;
        dataForm(this.params).then(res => {
          this.form = res.data.obj;
          this.loading = false;
        }).catch(error => {
          this.$message.error(error);
          this.loading = false;
        });
      }
    },
    handleRefresh(){
    }