Просмотр исходного кода

标题下方按钮自适应问题,部门选择器

linweizeng 2 лет назад
Родитель
Сommit
d6639c2c4d

+ 72 - 72
src/business/platform/form/formrender/dynamic-form/mixins/relevanceTable.vue

@@ -1,85 +1,85 @@
 <template>
-  <div>
-    <ul style="padding: 0px;margin: 0px;">
-      <li v-for="el in list" class ="tableClazz" @click="openDataTemplate(el)" >
-        <el-tag>
-          {{el.name}}
-        </el-tag>
-      </li>
-    </ul>
-  </div>
+    <div class="relev">
+        <div v-for="(el,index) in list" :key="index" class="sin" @click="openDataTemplate(el)">
+            <el-tag>
+                {{ el.name }}
+            </el-tag>
+        </div>
+    </div>
 </template>
 
 <script>
-  import $dialog from '@/utils/dialog'
-  export default {
-    props:{
-      list:{ //传入的开启对话框数组
-          type: Array,
+import $dialog from '@/utils/dialog'
+export default {
+    props: {
+        list: { // 传入的开启对话框数组
+            type: Array
         },
-      form:{ //当前表单示例
-          type: Object,
-          default:{}
-        },
-    },
-    data() {
-      return {
-      }
+        form: { // 当前表单示例
+            type: Object,
+            default: {}
+        }
     },
-  methods: {
-    openDataTemplate(el) {
-      this.openDataTemplateDialog(this.form, {
-        title: el.name,
-        templateId: el.templateId,
-        dynamicParams:el.filter,
-      })
+    data () {
+        return {
+        }
     },
-   openDataTemplateDialog(form, { title, templateId, dynamicParams }) {
-      // 弹窗打开
-      $dialog({
-         components:{
-           templateList: () => import ('@/views/platform/data/dataTemplate/template-list.vue')
-           },
-        data() {
-          return {
-            // 自定义高度
-            height: document.body.clientHeight - 120,
-            // 要打开的数据模版id
-            templateId: templateId,
-            // 用于过滤的动态参数
-            dynamicParams: dynamicParams
-          }
+    methods: {
+        openDataTemplate (el) {
+            this.openDataTemplateDialog(this.form, {
+                title: el.name,
+                templateId: el.templateId,
+                dynamicParams: el.filter
+            })
         },
-        template: '<template-list :template-id="templateId" :height="height" :dynamic-params="dynamicParams" />'
-      }, {
-        dialog: {
-          appendToBody: true,
-          width: '70%',
-          center: true,
-          title: title
+        openDataTemplateDialog (form, { title, templateId, dynamicParams }) {
+            // 弹窗打开
+            $dialog({
+                components: {
+                    templateList: () => import ('@/views/platform/data/dataTemplate/template-list.vue')
+                },
+                data () {
+                    return {
+                        // 自定义高度
+                        height: document.body.clientHeight - 120,
+                        // 要打开的数据模版id
+                        templateId: templateId,
+                        // 用于过滤的动态参数
+                        dynamicParams: dynamicParams
+                    }
+                },
+                template: '<template-list :template-id="templateId" :height="height" :dynamic-params="dynamicParams" />'
+            }, {
+                dialog: {
+                    appendToBody: true,
+                    width: '70%',
+                    center: true,
+                    title: title
+                }
+            }, (tpl) => {
+                // 关掉自定义浮窗
+                form.customComponent = null
+                // 打开弹窗
+                form.dialogTemplate = tpl
+            }).catch((_this) => {
+                // 标识为不显示
+                _this.visible = false
+                // 关掉弹窗
+                form.dialogTemplate = null
+            })
         }
-      }, (tpl) => {
-        // 关掉自定义浮窗
-        form.customComponent = null
-        // 打开弹窗
-        form.dialogTemplate = tpl
-      }).catch((_this) => {
-        // 标识为不显示
-        _this.visible = false
-        // 关掉弹窗
-        form.dialogTemplate = null
-      })
-    }
-  },
     }
+}
 </script>
 
-<style>
-  .tableClazz{
-    cursor: pointer;
-    padding: 5px 5px;
-    font-size: 12px;
-     float: right;
-     margin-top: -1.25rem;
-  }
+<style lang="less" scoped>
+.relev{
+    width: 100%;
+    display: flex;
+    flex-flow: wrap;
+    justify-content: flex-end;
+    .sin{
+        margin: 5px;
+    }
+}
 </style>

+ 26 - 6
src/business/platform/org/position/panel.vue

@@ -235,7 +235,6 @@ export default {
                         this.treeData = arrTwo
                     } else {
                         let arrList = []
-                        const fristList = false
                         const frist = this.$store.getters.level.first || ''
                         if ((type === '1' || type === '2') && this.filtrate && frist) {
                             const showBoo = arr.some((item) => item.id === frist)
@@ -249,7 +248,7 @@ export default {
                         }
 
                         if (type === '2') {
-                            this.getPosiData(arrList, true)
+                            this.getPosiData(arrList, true, true)
                         }
 
                         if (this.$utils.isEmpty(node.data)) {
@@ -288,7 +287,7 @@ export default {
                     }
 
                     if (type === '2') {
-                        this.getPosiData(arrList, node.data.disabled)
+                        this.getPosiData(arrList, node.data.disabled, node.data.disabledShow)
                     }
 
                     resolve(this.toTree(arrList))
@@ -298,7 +297,7 @@ export default {
                 })
             }
         },
-        getPosiData (arrList, disabled) {
+        getPosiData (arrList, disabled, disabledShow = false) {
             const positions = this.$store.getters.userInfo.employee.positions
             if (positions) {
                 const positionsList = positions.split(',')
@@ -306,23 +305,44 @@ export default {
                     const index = arrList.findIndex(it => it.id === item)
                     if (index >= 0) {
                         arrList[index].disabled = true
+                        arrList[index].disabledShow = true
                     }
                 })
             }
+            let dotCount = 0
+            if (arrList && Array.isArray(arrList) && arrList.length > 0 && arrList[0].path) {
+                // dotCount = (arrList[0].path.match(/\./g) || []).length
+                dotCount = arrList[0].depth
+            }
+
+            console.log(arrList)
+
             // 如果上级可以选择 也就是 disabled false,下级一定是false
-            if (!disabled) {
+            // if(dotCount)
+
+            if (!disabledShow) {
                 arrList.forEach(item => {
                     item.disabled = false
+                    item.disabledShow = false
                 })
             } else {
                 arrList.forEach(item => {
-                    if (item.disabled) {
+                    if (item.disabledShow) {
                         item.disabled = false
+                        item.disabledShow = false
                     } else {
                         item.disabled = true
+                        item.disabledShow = true
                     }
                 })
             }
+
+            if (dotCount <= 3) {
+                console.log(5)
+                arrList.forEach(item => {
+                    item.disabled = true
+                })
+            }
         },
         toTree (data) {
             return TreeUtils.transformToTreeFormat(data, {