From ad34a291db00bc4df1620b82221b7dcb22328f57 Mon Sep 17 00:00:00 2001
From: wangting <675591594@qq.com>
Date: 星期三, 24 四月 2024 16:09:46 +0800
Subject: [PATCH] 新增action

---
 Source/ProjectWeb/src/actions/base/AddAction.js                      |   27 +++++++-
 /dev/null                                                            |   16 -----
 Source/ProjectWeb/src/components/actions/AddEditDialog.vue           |   93 +++++++++++++++++++++++++++++++
 Source/ProjectWeb/src/components/dynamic-components/dynamic-form.vue |    1 
 Source/ProjectWeb/src/components/PLT-basic-component/BasicForm.vue   |   25 +++++---
 5 files changed, 131 insertions(+), 31 deletions(-)

diff --git a/Source/ProjectWeb/src/actions/base/AddAction.js b/Source/ProjectWeb/src/actions/base/AddAction.js
index e4523d6..507921f 100644
--- a/Source/ProjectWeb/src/actions/base/AddAction.js
+++ b/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);
+
 }
 /**
  * 鍓嶇疆浜嬩欢
diff --git a/Source/ProjectWeb/src/components/PLT-basic-component/BasicForm.vue b/Source/ProjectWeb/src/components/PLT-basic-component/BasicForm.vue
index 4412d13..caf71da 100644
--- a/Source/ProjectWeb/src/components/PLT-basic-component/BasicForm.vue
+++ b/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
                 };
               });
             }
diff --git a/Source/ProjectWeb/src/components/actions/AddEditDialog.vue b/Source/ProjectWeb/src/components/actions/AddEditDialog.vue
new file mode 100644
index 0000000..cebbd0c
--- /dev/null
+++ b/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>
diff --git a/Source/ProjectWeb/src/components/actions/formDialog.vue b/Source/ProjectWeb/src/components/actions/formDialog.vue
deleted file mode 100644
index 7837de5..0000000
--- a/Source/ProjectWeb/src/components/actions/formDialog.vue
+++ /dev/null
@@ -1,16 +0,0 @@
-<template>
-  <dialog>
-
-  </dialog>
-</template>
-
-<script>
-
-export default {
-  name: "formDialog"
-}
-</script>
-
-<style scoped>
-
-</style>
diff --git a/Source/ProjectWeb/src/components/dynamic-components/dynamic-form.vue b/Source/ProjectWeb/src/components/dynamic-components/dynamic-form.vue
index def378e..3e51d12 100644
--- a/Source/ProjectWeb/src/components/dynamic-components/dynamic-form.vue
+++ b/Source/ProjectWeb/src/components/dynamic-components/dynamic-form.vue
@@ -9,7 +9,6 @@
 </template>
 
 <script>
-
 import {dataForm} from "@/api/base/ui";
 
 export default {

--
Gitblit v1.9.3