wangting
2024-04-24 ad34a291db00bc4df1620b82221b7dcb22328f57
新增action
已修改3个文件
已删除1个文件
已添加1个文件
162 ■■■■ 文件已修改
Source/ProjectWeb/src/actions/base/AddAction.js 27 ●●●● 补丁 | 查看 | 原始文档 | 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 1 ●●●● 补丁 | 查看 | 原始文档 | 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/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,7 +9,6 @@
</template>
<script>
import {dataForm} from "@/api/base/ui";
export default {