From 2cbad4e40c2938a90172aa24551e82a4817b9640 Mon Sep 17 00:00:00 2001
From: yuxc <yuxc@vci-tech.com>
Date: 星期四, 25 四月 2024 15:21:31 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 Source/ProjectWeb/src/actions/base/AddAction.js                      |   27 ++++-
 /dev/null                                                            |   16 ---
 Source/ProjectWeb/src/api/system/dict.js                             |   12 ++
 Source/ProjectWeb/src/components/actions/AddEditDialog.vue           |   93 ++++++++++++++++++
 Source/ProjectWeb/src/components/dynamic-components/dynamic-form.vue |   70 +++++++++++++
 Source/ProjectWeb/src/components/PLT-basic-component/BasicForm.vue   |   25 +++-
 6 files changed, 211 insertions(+), 32 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/api/system/dict.js b/Source/ProjectWeb/src/api/system/dict.js
index 572f1da..411c211 100644
--- a/Source/ProjectWeb/src/api/system/dict.js
+++ b/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',
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 7c570d8..3e51d12 100644
--- a/Source/ProjectWeb/src/components/dynamic-components/dynamic-form.vue
+++ b/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(){
 
     }

--
Gitblit v1.9.3