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

fix:补充角色选择器按照role_note_进行排序逻辑

liujiayin 2 лет назад
Родитель
Сommit
215f289995
1 измененных файлов с 181 добавлено и 181 удалено
  1. 181 181
      src/business/platform/org/role/panel.vue

+ 181 - 181
src/business/platform/org/role/panel.vue

@@ -1,21 +1,21 @@
 <template>
-  <ibps-crud
-    ref="crud"
-    :height="tableHeight"
-    :data="listData"
-    :toolbars="listConfig.toolbars"
-    :search-form="listConfig.searchForm"
-    :pk-key="pkKey"
-    :columns="listConfig.columns"
-    :row-handle="listConfig.rowHandle"
-    :pagination="pagination"
-    :loading="loading"
-    :selection-type="multiple?'checkbox':'radio'"
-    @selection-change="handleSelectionChange"
-    @action-event="handleAction"
-    @sort-change="handleSortChange"
-    @pagination-change="handlePaginationChange"
-  />
+    <ibps-crud
+        ref="crud"
+        :height="tableHeight"
+        :data="listData"
+        :toolbars="listConfig.toolbars"
+        :search-form="listConfig.searchForm"
+        :pk-key="pkKey"
+        :columns="listConfig.columns"
+        :row-handle="listConfig.rowHandle"
+        :pagination="pagination"
+        :loading="loading"
+        :selection-type="multiple?'checkbox':'radio'"
+        @selection-change="handleSelectionChange"
+        @action-event="handleAction"
+        @sort-change="handleSortChange"
+        @pagination-change="handlePaginationChange"
+    />
 </template>
 <script>
 import { getScriptValue } from '@/api/platform/form/formDef'// 脚本
@@ -25,186 +25,186 @@ import ActionUtils from '@/utils/action'
 import SelectionMixin from '@/components/ibps-selector/mixins/selection'
 
 export default {
-  mixins: [SelectionMixin],
-  props: {
-    value: [Object, Array],
-    partyTypeId: { // 类型节点ID
-      type: [String, Number],
-      default: ''
-    },
-    currentOrgId: { // 用户组ID
-      type: [String, Number],
-      default: ''
+    mixins: [SelectionMixin],
+    props: {
+        value: [Object, Array],
+        partyTypeId: { // 类型节点ID
+            type: [String, Number],
+            default: ''
+        },
+        currentOrgId: { // 用户组ID
+            type: [String, Number],
+            default: ''
+        },
+        script: String,
+        isUseScope: { // 是否启用范围
+            type: Boolean,
+            default: false
+        },
+        isAuth: {
+            type: Boolean,
+            default: false
+        },
+        multiple: Boolean,
+        height: {
+            type: String,
+            default: '400px'
+        },
+        orgId: [String, Number]
     },
-    script: String,
-    isUseScope: { // 是否启用范围
-      type: Boolean,
-      default: false
+    data () {
+        return {
+            radio: '',
+            pkKey: 'id', // 主键  如果主键不是pk需要传主键
+            loading: false,
+            pagination: {},
+            sorts: { 'role_note_': 'asc' },
+            listData: [],
+            listConfig: {
+                toolbars: [
+                    {
+                        key: 'search'
+                    }
+                ],
+                searchForm: {
+                    labelWidth: 90,
+                    forms: [
+                        { prop: 'Q^NAME_^SL', label: '角色名', itemWidth: '200' },
+                        {
+                            prop: 'Q^SYSTEM_ID_^SL',
+                            label: '子系统',
+                            fieldType: 'select',
+                            valueKey: 'id',
+                            labelKey: 'name',
+                            resultField: 'data',
+                            selectFetch: findAllSubsystem,
+                            itemWidth: '200'
+                        }
+                    ]
+                },
+                // 表格字段配置
+                columns: [
+                    { prop: 'name', label: '角色名' },
+                    { prop: 'roleAlias', label: '角色别名' }
+                    //   { prop: 'subSystemName', label: '子系统名称111' }
+                ]
+            }
+        }
     },
-    isAuth: {
-      type: Boolean,
-      default: false
+    computed: {
+        tableHeight () {
+            const h = this.height.substr(0, this.height.length - 2)
+            return parseInt(h) - 10
+        }
     },
-    multiple: Boolean,
-    height: {
-      type: String,
-      default: '400px'
+    created () {
+        this.loadData()
     },
-    orgId: [String, Number]
-  },
-  data() {
-    return {
-      radio: '',
-      pkKey: 'id', // 主键  如果主键不是pk需要传主键
-      loading: false,
-      pagination: {},
-      sorts: {},
-      listData: [],
-      listConfig: {
-        toolbars: [
-          {
-            key: 'search'
-          }
-        ],
-        searchForm: {
-          labelWidth: 90,
-          forms: [
-            { prop: 'Q^NAME_^SL', label: '角色名', itemWidth: '200' },
-            {
-              prop: 'Q^SYSTEM_ID_^SL',
-              label: '子系统',
-              fieldType: 'select',
-              valueKey: 'id',
-              labelKey: 'name',
-              resultField: 'data',
-              selectFetch: findAllSubsystem,
-              itemWidth: '200'
+    methods: {
+    // 加载数据
+        loadData () {
+            this.loading = true
+            if (this.isAuth) {
+                queryWithGrade(this.getSearcFormData()).then(response => {
+                    this.loading = false
+                    ActionUtils.handleListData(this, response.data)
+                    this.setSelectRow()
+                }).catch(() => {
+                    this.loading = false
+                })
+            } else if (this.isUseScope) {
+                if (this.partyTypeId === 'script') {
+                    getScriptValue({
+                        script: this.script,
+                        vars: ''
+                    }).then(response => {
+                        const data = JSON.parse(response.data)
+                        ActionUtils.handleListData(this, data.data)
+                        this.setSelectRow()
+                        this.loading = false
+                    }).catch(() => {
+                        this.loading = false
+                    })
+                } else {
+                    queryRoleScope(this.getSearcFormData()).then(response => {
+                        ActionUtils.handleListData(this, response.data)
+                        this.setSelectRow()
+                        this.loading = false
+                    }).catch(() => {
+                        this.loading = false
+                    })
+                }
+            } else {
+                queryPageList(this.getSearcFormData()).then(response => {
+                    this.loading = false
+                    ActionUtils.handleListData(this, response.data)
+                    this.setSelectRow()
+                }).catch(() => {
+                    this.loading = false
+                })
             }
-          ]
         },
-        // 表格字段配置
-        columns: [
-          { prop: 'name', label: '角色名' },
-          { prop: 'roleAlias', label: '角色别名' },
-        //   { prop: 'subSystemName', label: '子系统名称111' }
-        ]
-      }
-    }
-  },
-  computed: {
-    tableHeight() {
-      const h = this.height.substr(0, this.height.length - 2)
-      return parseInt(h) - 10
-    }
-  },
-  created() {
-    this.loadData()
-  },
-  methods: {
-    // 加载数据
-    loadData() {
-      this.loading = true
-      if (this.isAuth) {
-        queryWithGrade(this.getSearcFormData()).then(response => {
-          this.loading = false
-          ActionUtils.handleListData(this, response.data)
-          this.setSelectRow()
-        }).catch(() => {
-          this.loading = false
-        })
-      } else if (this.isUseScope) {
-        if (this.partyTypeId === 'script') {
-          getScriptValue({
-            script: this.script,
-            vars: ''
-          }).then(response => {
-            const data = JSON.parse(response.data)
-            ActionUtils.handleListData(this, data.data)
-            this.setSelectRow()
-            this.loading = false
-          }).catch(() => {
-            this.loading = false
-          })
-        } else {
-          queryRoleScope(this.getSearcFormData()).then(response => {
-            ActionUtils.handleListData(this, response.data)
-            this.setSelectRow()
-            this.loading = false
-          }).catch(() => {
-            this.loading = false
-          })
-        }
-      } else {
-        queryPageList(this.getSearcFormData()).then(response => {
-          this.loading = false
-          ActionUtils.handleListData(this, response.data)
-          this.setSelectRow()
-        }).catch(() => {
-          this.loading = false
-        })
-      }
-    },
-    /**
+        /**
      * 获取格式化参数
      */
-    getSearcFormData() {
-      const params = this.$refs['crud'] ? this.$refs['crud'].getSearcFormData() : {}
-      if (this.isAuth) {
-        const obj = {
-          partyType: 'org',
-          partyId: this.orgId
-        }
-        Object.assign(params, obj)
-      }
-      if (this.isUseScope) {
-        const obj = {}
-        obj.type = this.partyTypeId
-        if (obj.type === '3') {
-          obj.partyId = this.currentOrgId
-        }
-        obj.type === 'script' ? obj.script = this.script : null
-        Object.assign(params, obj)
-      }
-      return ActionUtils.formatParams(
-        params,
-        this.pagination,
-        this.sorts)
-    },
-    /**
+        getSearcFormData () {
+            const params = this.$refs['crud'] ? this.$refs['crud'].getSearcFormData() : {}
+            if (this.isAuth) {
+                const obj = {
+                    partyType: 'org',
+                    partyId: this.orgId
+                }
+                Object.assign(params, obj)
+            }
+            if (this.isUseScope) {
+                const obj = {}
+                obj.type = this.partyTypeId
+                if (obj.type === '3') {
+                    obj.partyId = this.currentOrgId
+                }
+                obj.type === 'script' ? obj.script = this.script : null
+                Object.assign(params, obj)
+            }
+            return ActionUtils.formatParams(
+                params,
+                this.pagination,
+                this.sorts)
+        },
+        /**
      * 处理分页事件
      */
-    handlePaginationChange(page) {
-      this.changePageCoreRecordData()
-      ActionUtils.setPagination(this.pagination, page)
-      this.loadData()
-    },
-    /**
+        handlePaginationChange (page) {
+            this.changePageCoreRecordData()
+            ActionUtils.setPagination(this.pagination, page)
+            this.loadData()
+        },
+        /**
      * 处理排序
      */
-    handleSortChange(sort) {
-      ActionUtils.setSorts(this.sorts, sort)
-      this.loadData()
-    },
-    /**
+        handleSortChange (sort) {
+            ActionUtils.setSorts(this.sorts, sort)
+            this.loadData()
+        },
+        /**
      * 查询
      */
-    search() {
-      this.loadData()
-    },
-    /**
+        search () {
+            this.loadData()
+        },
+        /**
      * 处理按钮事件
      */
-    handleAction(command, position, selection, data) {
-      switch (command) {
-        case 'search':// 查询
-          ActionUtils.setFirstPagination(this.pagination)
-          this.search()
-          break
-        default:
-          break
-      }
-    }
+        handleAction (command, position, selection, data) {
+            switch (command) {
+                case 'search':// 查询
+                    ActionUtils.setFirstPagination(this.pagination)
+                    this.search()
+                    break
+                default:
+                    break
+            }
+        }
 
-  }
+    }
 }
 </script>