mirror of
				https://github.com/veops/cmdb.git
				synced 2025-11-04 21:56:16 +08:00 
			
		
		
		
	@@ -139,9 +139,9 @@
 | 
				
			|||||||
        :normalizer="
 | 
					        :normalizer="
 | 
				
			||||||
          (node) => {
 | 
					          (node) => {
 | 
				
			||||||
            return {
 | 
					            return {
 | 
				
			||||||
              id: String(node[0]),
 | 
					              id: String(node[0] || ''),
 | 
				
			||||||
              label: node[1].label || node[0],
 | 
					              label: node[1] ? node[1].label || node[0] : node[0],
 | 
				
			||||||
              children: node.children,
 | 
					              children: node.children && node.children.length ? node.children : undefined,
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
        "
 | 
					        "
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -118,6 +118,8 @@ export default {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
.locale {
 | 
					.locale {
 | 
				
			||||||
  cursor: pointer;
 | 
					  cursor: pointer;
 | 
				
			||||||
 | 
					  padding: 0 8px;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  &:hover {
 | 
					  &:hover {
 | 
				
			||||||
    color: @primary-color;
 | 
					    color: @primary-color;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
@@ -135,6 +137,7 @@ export default {
 | 
				
			|||||||
    display: flex;
 | 
					    display: flex;
 | 
				
			||||||
    align-items: center;
 | 
					    align-items: center;
 | 
				
			||||||
    justify-content: center;
 | 
					    justify-content: center;
 | 
				
			||||||
 | 
					    margin: 0 8px;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    &-icon {
 | 
					    &-icon {
 | 
				
			||||||
      font-size: 12px;
 | 
					      font-size: 12px;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -102,7 +102,7 @@ const genCmdbRoutes = async () => {
 | 
				
			|||||||
        name: 'cmdb_ci_type',
 | 
					        name: 'cmdb_ci_type',
 | 
				
			||||||
        component: RouteView,
 | 
					        component: RouteView,
 | 
				
			||||||
        redirect: '/cmdb/ci_type',
 | 
					        redirect: '/cmdb/ci_type',
 | 
				
			||||||
        meta: { title: 'cmdb.menu.backendManage', icon: 'veops-setting2', permission: ['cmdb_admin', 'OneOPS_Application_Admin', 'admin'], },
 | 
					        meta: { title: 'cmdb.menu.backendManage', icon: 'veops-setting2', selectedIcon: 'veops-setting2', permission: ['cmdb_admin', 'OneOPS_Application_Admin', 'admin'], },
 | 
				
			||||||
        children: [
 | 
					        children: [
 | 
				
			||||||
          {
 | 
					          {
 | 
				
			||||||
            path: '/cmdb/customdashboard',
 | 
					            path: '/cmdb/customdashboard',
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -45,14 +45,7 @@
 | 
				
			|||||||
              attr.name,
 | 
					              attr.name,
 | 
				
			||||||
              {
 | 
					              {
 | 
				
			||||||
                rules: [{ required: attr.is_required, message: $t('placeholder2') + `${attr.alias || attr.name}` }],
 | 
					                rules: [{ required: attr.is_required, message: $t('placeholder2') + `${attr.alias || attr.name}` }],
 | 
				
			||||||
                initialValue:
 | 
					                initialValue: getChoiceDefault(attr),
 | 
				
			||||||
                  attr.default && attr.default.default
 | 
					 | 
				
			||||||
                    ? attr.is_list
 | 
					 | 
				
			||||||
                      ? Array.isArray(attr.default.default)
 | 
					 | 
				
			||||||
                        ? attr.default.default
 | 
					 | 
				
			||||||
                        : attr.default.default.split(',')
 | 
					 | 
				
			||||||
                      : attr.default.default
 | 
					 | 
				
			||||||
                    : attr.is_list ? [] : null,
 | 
					 | 
				
			||||||
              },
 | 
					              },
 | 
				
			||||||
            ]"
 | 
					            ]"
 | 
				
			||||||
            :placeholder="$t('placeholder2')"
 | 
					            :placeholder="$t('placeholder2')"
 | 
				
			||||||
@@ -216,6 +209,35 @@ export default {
 | 
				
			|||||||
    jsonEditorOk(jsonData) {
 | 
					    jsonEditorOk(jsonData) {
 | 
				
			||||||
      this.form.setFieldsValue({ [this.editAttr.name]: JSON.stringify(jsonData) })
 | 
					      this.form.setFieldsValue({ [this.editAttr.name]: JSON.stringify(jsonData) })
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    getChoiceDefault(attr) {
 | 
				
			||||||
 | 
					      if (!attr?.default?.default) {
 | 
				
			||||||
 | 
					        return attr.is_list ? [] : null
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      if (attr.is_list) {
 | 
				
			||||||
 | 
					        let defaultValue = []
 | 
				
			||||||
 | 
					        if (Array.isArray(attr.default.default)) {
 | 
				
			||||||
 | 
					          defaultValue = attr.default.default
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					          defaultValue = String(attr.default.default).split(',')
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        if (['0', '1', '11'].includes(attr.value_type)) {
 | 
				
			||||||
 | 
					          defaultValue = defaultValue?.map((item) => {
 | 
				
			||||||
 | 
					            const numberValue = Number(item)
 | 
				
			||||||
 | 
					            return Number.isNaN(numberValue) ? item : numberValue
 | 
				
			||||||
 | 
					          })
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        return defaultValue
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      let defaultValue = attr.default.default
 | 
				
			||||||
 | 
					      if (['0', '1', '11'].includes(attr.value_type)) {
 | 
				
			||||||
 | 
					        const numberValue = Number(defaultValue)
 | 
				
			||||||
 | 
					        defaultValue = Number.isNaN(numberValue) ? attr.default.default : numberValue
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					      return defaultValue
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
</script>
 | 
					</script>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -62,11 +62,8 @@ export default {
 | 
				
			|||||||
  mounted() {
 | 
					  mounted() {
 | 
				
			||||||
    this.$nextTick(() => {
 | 
					    this.$nextTick(() => {
 | 
				
			||||||
      switch (this.activeKey) {
 | 
					      switch (this.activeKey) {
 | 
				
			||||||
        case '6':
 | 
					 | 
				
			||||||
          this.$refs.triggerTable.getTableData()
 | 
					 | 
				
			||||||
          break
 | 
					 | 
				
			||||||
        case '5':
 | 
					        case '5':
 | 
				
			||||||
          this.$refs.reconciliationTable.getTableData()
 | 
					          this.$refs.triggerTable.getTableData()
 | 
				
			||||||
          break
 | 
					          break
 | 
				
			||||||
        default:
 | 
					        default:
 | 
				
			||||||
          break
 | 
					          break
 | 
				
			||||||
@@ -87,11 +84,8 @@ export default {
 | 
				
			|||||||
          case '1':
 | 
					          case '1':
 | 
				
			||||||
            this.$refs.attributesTable.getCITypeGroupData()
 | 
					            this.$refs.attributesTable.getCITypeGroupData()
 | 
				
			||||||
            break
 | 
					            break
 | 
				
			||||||
          case '6':
 | 
					 | 
				
			||||||
            this.$refs.triggerTable.getTableData()
 | 
					 | 
				
			||||||
            break
 | 
					 | 
				
			||||||
          case '5':
 | 
					          case '5':
 | 
				
			||||||
            this.$refs.reconciliationTable.getTableData()
 | 
					            this.$refs.triggerTable.getTableData()
 | 
				
			||||||
            break
 | 
					            break
 | 
				
			||||||
          default:
 | 
					          default:
 | 
				
			||||||
            break
 | 
					            break
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -87,9 +87,9 @@
 | 
				
			|||||||
          :normalizer="
 | 
					          :normalizer="
 | 
				
			||||||
            (node) => {
 | 
					            (node) => {
 | 
				
			||||||
              return {
 | 
					              return {
 | 
				
			||||||
                id: node[0],
 | 
					                id: String(node[0] || ''),
 | 
				
			||||||
                label: node[1].label || node[0],
 | 
					                label: node[1] ? node[1].label || node[0] : node[0],
 | 
				
			||||||
                children: node.children,
 | 
					                children: node.children && node.children.length ? node.children : undefined,
 | 
				
			||||||
              }
 | 
					              }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
          "
 | 
					          "
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -166,7 +166,6 @@
 | 
				
			|||||||
</template>
 | 
					</template>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<script>
 | 
					<script>
 | 
				
			||||||
import { mapState } from 'vuex'
 | 
					 | 
				
			||||||
import _ from 'lodash'
 | 
					import _ from 'lodash'
 | 
				
			||||||
import { v4 as uuidv4 } from 'uuid'
 | 
					import { v4 as uuidv4 } from 'uuid'
 | 
				
			||||||
import Treeselect from '@riophae/vue-treeselect'
 | 
					import Treeselect from '@riophae/vue-treeselect'
 | 
				
			||||||
@@ -191,20 +190,7 @@ export default {
 | 
				
			|||||||
      userFilterSelect: [],
 | 
					      userFilterSelect: [],
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  computed: {
 | 
					 | 
				
			||||||
    ...mapState(['user'])
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
  created() {
 | 
					 | 
				
			||||||
    this.initUserFilterSelect()
 | 
					 | 
				
			||||||
  },
 | 
					 | 
				
			||||||
  methods: {
 | 
					  methods: {
 | 
				
			||||||
    initUserFilterSelect() {
 | 
					 | 
				
			||||||
      const permissions = this.user?.detailPermissions?.backend?.find((item) => item.name === 'Employee_Fields')?.permissions
 | 
					 | 
				
			||||||
      const userFilterSelect = USER_FILTER_SELECT.filter((item) => {
 | 
					 | 
				
			||||||
        return permissions.includes(item.value)
 | 
					 | 
				
			||||||
      })
 | 
					 | 
				
			||||||
      this.userFilterSelect = userFilterSelect
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
    async setRuleList(ruleList) {
 | 
					    async setRuleList(ruleList) {
 | 
				
			||||||
      this.ruleList = ruleList?.length ? ruleList : []
 | 
					      this.ruleList = ruleList?.length ? ruleList : []
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user