Explorar o código

调整表单设置表初步完成

zhangh %!s(int64=2) %!d(string=hai) anos
pai
achega
75f65e4308

+ 10 - 1
src/api/manager/AdjustForm.js

@@ -10,8 +10,17 @@ export const dictionary = () => {
 // 设置文本类型
 export const saveInput = (data) => {
     return request({
-        url: '/api/blade-manager/textdictinfo/save',
+        url: '/api/blade-manager/textdictinfo/saveTextInfo',
         method: 'post',
         data
     })
+}
+
+// 获取字段信息
+export const getColByTabId = (params) => {
+    return request({
+        url: '/api/blade-manager/linkdatainfo/getColByTabId',
+        method: 'get',
+        params
+    })
 }

+ 22 - 1
src/views/manager/projectinfo/treeTemplate/dynamicExcel.vue

@@ -36,7 +36,11 @@
         id='parent'
       ></div>
       <div class="excelRight">
-        <setInputTPT v-if="setUptype===0" />
+        <setInputTPT
+          v-if="setUptype===0"
+          :pkeyId='pkeyId'
+          @cop='domss'
+        />
         <electronicSignature v-if="setUptype===1" />
         <setFormula v-if="setUptype===2" />
         <editDefault v-if="setUptype===3" />
@@ -51,6 +55,7 @@ import electronicSignature from './template/electronicSignature.vue'
 import setFormula from './template/setFormula.vue'
 import editDefault from './template/editDefault.vue'
 import Vue from 'vue'
+import dictVue from '../../../system/dict.vue'
 export default {
   props: ['pkeyId'],
   data () {
@@ -70,8 +75,24 @@ export default {
         template: localStorage.getItem('excelHtml')
       })
       var component = new MyComponent().$mount()
+      let na = document.getElementById('parent')
       document.getElementById('parent').appendChild(component.$el);
     },
+    async copss () {
+      var MyComponent = await Vue.extend({
+        template: localStorage.getItem('excelHtml')
+      })
+      var component = new MyComponent().$mount()
+      let na = document.getElementById('parent')
+      na.innerHTML = `<div
+        class='parent'
+        id='parent'
+      ></div>`
+      document.getElementById('parent').appendChild(component.$el);
+    },
+    domss () {
+      this.copss()
+    },
   },
   components: {
     setInputTPT,

+ 77 - 29
src/views/manager/projectinfo/treeTemplate/template/setInputTPT.vue

@@ -7,15 +7,15 @@
         placeholder="请选择"
       >
         <el-option
-          v-for="item in options"
-          :key="item.value"
-          :label="item.label"
-          :value="item.value"
+          v-for="item in elementName"
+          :key="item.tabId"
+          :label="item.colName"
+          :value="item.tabId"
         >
         </el-option>
       </el-select>
       <el-select
-        v-model="from.value"
+        v-model="from.type"
         clearable
         placeholder="请选择"
       >
@@ -32,6 +32,7 @@
     <div
       style="border: 1px dotted rgb(187, 187, 187);box-sizing: border-box;padding: 0px 15px;"
       class="martop20"
+      v-show="from.type=='select'|from.type=='radio'|from.type=='checkbox'"
     >
       <table
         class="table"
@@ -58,7 +59,7 @@
             <td align="center">{{key+1}}</td>
             <td>
               <el-input
-                v-model="setInputTable[key].inputDa"
+                v-model="setInputTable[key].dictValue"
                 size="mini"
                 placeholder="请输入内容"
               ></el-input>
@@ -85,48 +86,72 @@
       type="info"
       size="mini"
       @click="saveType()"
+      :disabled="disabled"
     >保存设置</el-button>
   </div>
 </template>
 <script>
-import { dictionary, saveInput } from "@/api/manager/AdjustForm";
+import { dictionary, saveInput, getColByTabId } from "@/api/manager/AdjustForm";
+import { getExcelHtml } from '@/api/exctab/excelmodel'
 export default {
+  props: ['pkeyId'],
   data () {
     return {
-      options: [{
-        value: '选项1',
-        label: '黄金糕'
-      }, {
-        value: '选项2',
-        label: '双皮奶'
-      }, {
-        value: '选项3',
-        label: '蚵仔煎'
-      }, {
-        value: '选项4',
-        label: '龙须面'
-      }, {
-        value: '选项5',
-        label: '北京烤鸭'
-      }],
+      elementName: [],
       kjtype: [],//框架类型
       from: {
+        type: '',
         value: '',
       },
       setInputTable: [],//数据体
+      disabled: false,
     }
   },
   methods: {
     addTable () {//添加table表
-      this.setInputTable.push({ inputDa: '' })
+      this.setInputTable.push({ dictValue: '' })
     },
     deleteTable (key) {//删除数据
       this.setInputTable.splice(key, 1)
     },
     saveType () {//保存设置按钮
-      // if(){
-      //   this.saveInput()
-      // }
+      this.disabled = true
+
+      if (this.from.type && this.from.value) {
+        let ks = false
+        if (this.from.type == 'select' | this.from.type == 'radio' | this.from.type == 'checkbox') {
+          if (this.setInputTable) {
+            this.setInputTable.forEach(val => {
+              if (!val.dictValue) {
+                ks = true
+              }
+            })
+          }
+          if (ks) {
+            this.$message({
+              type: "error",
+              message: "请填写完枚举值"
+            });
+            this.disabled = false
+          } else {
+            this.saveInput({
+              colId: this.from.value,
+              nodeId: this.pkeyId,
+              textId: this.from.type,
+              textInfo: this.setInputTable
+            })
+          }
+        } else {
+          this.saveInput({
+            colId: this.from.value,
+            nodeId: this.pkeyId,
+            textId: this.from.type,
+            textInfo: []
+          })
+        }
+      } else {
+        this.disabled = false
+      }
     },
     async dictionary () {//获取文本类型接口
       const { data: res } = await dictionary()
@@ -135,13 +160,36 @@ export default {
         this.kjtype = res.data
       }
     },
-    async saveInput (data) {//保存设置文本接口
-      const { data: res } = await saveInput(data)
+    async saveInput (da) {//保存设置文本接口
+      const { data: res } = await saveInput(da)
+      console.log(res);
+      if (res.code == 200) {
+        this.disabled = false
+        this.getExcelHtml()
+      }
+    },
+    async getColByTabId () {//获取字段信息
+      const { data: res } = await getColByTabId({ tabId: this.pkeyId })
       console.log(res);
+      if (res.code === 200) {
+        this.elementName = res.data
+      }
+    },
+    async getExcelHtml () {
+      const { data: res } = await getExcelHtml()
+      console.log(res);
+      if (res.code === 200) {
+        this.from.value = ''
+        this.from.type = ''
+        this.setInputTable = []
+        localStorage.setItem('excelHtml', res.data)
+        this.$emit('cop')
+      }
     },
   },
   created () {
     this.dictionary()  //获取文本类型接口
+    this.getColByTabId()
   },
 }
 </script>

+ 11 - 2
src/views/system/user.vue

@@ -102,9 +102,13 @@
           </template>
 
           <!-- 参与项目自定义表单 -->
-          <template slot="projectIdForm">
+          <template
+            slot="projectIdForm"
+            slot-scope="{type}"
+          >
             <el-select
               v-model="fromss.projectId"
+              :disabled="type=='view'"
               placeholder="请选择"
             >
               <el-option
@@ -118,8 +122,12 @@
           </template>
 
           <!-- 合同段自定义表单 -->
-          <template slot="contractIdForm">
+          <template
+            slot="contractIdForm"
+            slot-scope="{type}"
+          >
             <el-select
+              :disabled="type=='view'"
               v-model="fromss.contractId"
               placeholder="请选择"
             >
@@ -140,6 +148,7 @@
           >
             <div class="flexStar">
               <el-select
+                :disabled="type=='view'"
                 v-model="fromss.roleIds"
                 placeholder="请选择"
               >

+ 2 - 2
vue.config.js

@@ -27,8 +27,8 @@ module.exports = {
             '/api': {
                 //本地服务接口地址
                 // target: 'http://localhost',
-                // target: 'http://192.168.3.76',
-                target: 'http://192.168.4.44',
+                target: 'http://192.168.4.12',
+                // target: 'http://192.168.4.44',
                 //远程演示服务地址,可用于直接启动项目
                 //target: 'https://saber.bladex.vip/api',
                 ws: true,