@sunny-base/effects 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,202 @@
1
+ <template>
2
+ <div class="i18nConfig commonQueryDiv">
3
+ <kunkka-ux-grid
4
+ ref="kunkka-ux-grid"
5
+ v-bind="i18nConfig.tableAttrs"
6
+ @toggleToolbarClick="toggleToolbarClick"
7
+ @selection-change="toggleSelectRow"
8
+ />
9
+ <!-- 新增弹窗 -->
10
+ <KunkkaModal
11
+ ref="addDialogModal"
12
+ :visible.sync="i18nConfig.addDialog.visible"
13
+ :can-fullscreen="true"
14
+ :show-close="false"
15
+ :title="i18nConfig.addDialog.title"
16
+ @ok="handleAddDialogOk"
17
+ >
18
+ <add-dialog
19
+ v-if="i18nConfig.addDialog.visible"
20
+ :toolbar="i18nConfig.addDialog.toolbar"
21
+ :columns="i18nConfig.addDialog.columns"
22
+ :table-data="i18nConfig.addDialog.tableData"
23
+ />
24
+ </KunkkaModal>
25
+
26
+ <!-- 修改弹窗 -->
27
+ <edit-dialog />
28
+
29
+ <!-- 模块自定义翻译弹窗 -->
30
+
31
+ <!-- 模块自定义翻译弹窗 -->
32
+ <KunkkaModal
33
+ ref="moduleI18nDialogModal"
34
+ :visible.sync="i18nConfig.moduleI18nDialog.visible"
35
+ width="960ox"
36
+ :can-fullscreen="true"
37
+ :show-close="false"
38
+ :title="i18nConfig.moduleI18nDialog.title"
39
+ @ok="handleModuleI18nDialogOk"
40
+ >
41
+ <module-i18n-Dialog
42
+ v-if="i18nConfig.moduleI18nDialog.visible"
43
+ ref="moduleI18nDialog"
44
+ />
45
+ </KunkkaModal>
46
+ <!-- 导出弹窗 -->
47
+ <KunkkaModal
48
+ ref="exportDialogModal"
49
+ :visible.sync="i18nConfig.exportDialog.visible"
50
+ :can-fullscreen="true"
51
+ :show-close="false"
52
+ :title="i18nConfig.exportDialog.title"
53
+ @ok="handleExportDialogOk"
54
+ >
55
+ <i18nExport
56
+ v-if="i18nConfig.exportDialog.visible"
57
+ ref="exportDialog"
58
+ :form-data="i18nConfig.exportDialog.formData"
59
+ @changeLoading="changeLoading"
60
+ />
61
+ </KunkkaModal>
62
+
63
+ <!-- 导入弹窗 -->
64
+ <KunkkaModal
65
+ ref="importDialogModal"
66
+ :visible.sync="i18nConfig.importDialog.visible"
67
+ :can-fullscreen="true"
68
+ :show-close="false"
69
+ :title="i18nConfig.importDialog.title"
70
+ @ok="handleImportDialogOk"
71
+ >
72
+ <i18nImport
73
+ v-if="i18nConfig.importDialog.visible"
74
+ ref="importDialog"
75
+ :form-data="i18nConfig.importDialog.formData"
76
+ @changeLoading="changeLoading"
77
+ />
78
+ </KunkkaModal>
79
+ </div>
80
+ </template>
81
+ <script>
82
+ /* eslint-disable no-async-promise-executor */
83
+ import { mapGetters } from 'vuex'
84
+ import list from '@/mixins/list'
85
+ import AddDialog from './components/AddDialog.vue'
86
+ import EditDialog from './components/EditDialog.vue'
87
+ import ModuleI18nDialog from './components/ModuleI18nDialog'
88
+ import i18nExport from './components/i18nExport'
89
+ import i18nImport from './components/i18nImport'
90
+
91
+ export default {
92
+ name: 'I18nConfig',
93
+ components: {
94
+ AddDialog,
95
+ EditDialog,
96
+ ModuleI18nDialog,
97
+ i18nExport,
98
+ i18nImport
99
+ },
100
+ mixins: [list],
101
+ data() {
102
+ return {
103
+ name: 'i18nConfig'
104
+ }
105
+ },
106
+ computed: {
107
+ ...mapGetters(['i18nConfig'])
108
+ },
109
+ mounted: function() {},
110
+ methods: {
111
+ // 表格按钮回调
112
+ toggleToolbarClick: function(data) {
113
+ const { handle, label } = data.item
114
+ switch (handle) {
115
+ case 'i18nConfig/addStatic':
116
+ this.currentUserResourcesGroupBycArea({ modnumb: '00a4d11a-3f80-4ba3-975f-f2983e678318' }).then((res) => {
117
+ this.$store.dispatch('i18nConfig/addShow', {
118
+ title: `国际化配置-${label}`,
119
+ width: '960px',
120
+ lg: 8,
121
+ visible: true,
122
+ nType: 5,
123
+ conditions: res.resFieldList.createForm
124
+ })
125
+ })
126
+ break
127
+ case 'i18nConfig/addBack':
128
+ this.currentUserResourcesGroupBycArea({ modnumb: '00a4d11a-3f80-4ba3-975f-f2983e678318' }).then((res) => {
129
+ this.$store.dispatch('i18nConfig/addShow', {
130
+ title: `国际化配置-${label}`,
131
+ width: '960px',
132
+ lg: 8,
133
+ visible: true,
134
+ nType: 6,
135
+ conditions: res.resFieldList.createForm
136
+ })
137
+ })
138
+ break
139
+ case 'i18nConfig/update':
140
+ this.currentUserResourcesGroupBycArea({ modnumb: 'aa696e9c-fe19-4f8d-8228-beb6e7d52a06' }).then((res) => {
141
+ this.$store.dispatch('i18nConfig/updateShow', {
142
+ width: '960px',
143
+ lg: 8,
144
+ visible: true,
145
+ conditions: res.resFieldList.updateForm
146
+ })
147
+ })
148
+ break
149
+ case 'i18nConfig/moduleI18n':
150
+ this.i18nConfig.moduleI18nDialog.visible = true
151
+ this.i18nConfig.moduleI18nDialog.title = `国际化配置-${label}`
152
+ this.$nextTick(() => {
153
+ this.$refs.moduleI18nDialog.openInit()
154
+ })
155
+ break
156
+ case 'i18nConfig/export':
157
+ this.i18nConfig.exportDialog.visible = true
158
+ this.i18nConfig.exportDialog.title = `国际化配置-${label}`
159
+ this.$nextTick(() => {
160
+ this.$refs.exportDialog.openInit()
161
+ })
162
+ break
163
+ case 'i18nConfig/import':
164
+ this.i18nConfig.importDialog.visible = true
165
+ this.i18nConfig.importDialog.title = `国际化配置-${label}`
166
+ this.$nextTick(() => {
167
+ this.$refs.importDialog.openInit()
168
+ })
169
+ break
170
+ default:
171
+ break
172
+ }
173
+ },
174
+ // 选择行事件
175
+ toggleSelectRow: function(row) {
176
+ const self = this
177
+ self[self.name].selectRow = row
178
+ },
179
+ // 弹窗确定回调
180
+ handleAddDialogOk() {
181
+ this.$refs.addDialogModal.changeOkLoading(true)
182
+ this.$store.dispatch('i18nConfig/addSaveAction').then(() => {
183
+ this.i18nConfig.addDialog.visible = false
184
+ }).finally(() => {
185
+ this.$refs.addDialogModal.changeOkLoading(false)
186
+ })
187
+ },
188
+ handleModuleI18nDialogOk() {
189
+ this.$refs.moduleI18nDialog.saveAction()
190
+ },
191
+ handleExportDialogOk() {
192
+ this.$refs.exportDialog.submitForm()
193
+ },
194
+ handleImportDialogOk() {
195
+ this.$refs.importDialog.upLoads()
196
+ },
197
+ changeLoading(name, bol) {
198
+ this.$refs[name].changeOkLoading(bol)
199
+ }
200
+ }
201
+ }
202
+ </script>
package/index.js CHANGED
@@ -1,4 +1,13 @@
1
- export * from './user/api/user.js';
2
1
  import UserQuery from './user/UserQuery.vue';
3
- export { UserQuery };
2
+ import RoleQuery from './role/RoleQuery.vue';
3
+ import i18nQuery from './i18n/i18nQuery.vue';
4
+ import dataDictionaryQuery from './dataDictionary/dataDictionaryQuery.vue';
5
+ import ywsjzdQuery from './ywsjzd/ywsjzdQuery.vue';
4
6
 
7
+ export {
8
+ UserQuery,
9
+ RoleQuery,
10
+ i18nQuery,
11
+ dataDictionaryQuery,
12
+ ywsjzdQuery
13
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sunny-base/effects",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -0,0 +1,175 @@
1
+ <template>
2
+ <div class="roleManagement commonQueryDiv">
3
+ <kunkka-ux-grid
4
+ ref="kunkka-ux-grid"
5
+ v-bind="roleManagement.tableAttrs"
6
+ @toggleToolbarClick="toggleToolbarClick"
7
+ @selection-change="toggleSelectRow"
8
+ />
9
+ <!-- 新增修改弹窗 -->
10
+ <KunkkaModal
11
+ ref="roleModal"
12
+ :visible.sync="roleManagement.dialog.visible"
13
+ :fullscreen.sync="fullscreen"
14
+ :can-fullscreen="true"
15
+ :show-close="false"
16
+ :title="roleManagement.dialog.resource.title"
17
+ class="roleManagementDialog"
18
+ @ok="handleOk"
19
+ >
20
+ <roleManagementTree />
21
+ </KunkkaModal>
22
+
23
+ <!-- 用户授权弹窗 -->
24
+ <KunkkaModal
25
+ ref="roleAuthorizationModal"
26
+ :visible.sync="roleManagement.roleAuthorization.visible"
27
+ :can-fullscreen="true"
28
+ :show-close="false"
29
+ :title="roleManagement.roleAuthorization.title"
30
+ @ok="handleRoleAuthorizationOk"
31
+ >
32
+ <role-authorization
33
+ v-if="roleManagement.roleAuthorization.visible"
34
+ ref="roleAuthorization"
35
+ />
36
+ </KunkkaModal>
37
+ </div>
38
+ </template>
39
+ <script>
40
+ /* eslint-disable no-async-promise-executor */
41
+ import { mapGetters } from 'vuex'
42
+ import list from '@/mixins/list'
43
+ import roleManagementTree from './compontents/RoleManagementTree'
44
+ import RoleAuthorization from './compontents/RoleAuthorization'
45
+ export default {
46
+ name: 'RoleManagement',
47
+ components: {
48
+ RoleAuthorization,
49
+ roleManagementTree
50
+ },
51
+ mixins: [list],
52
+ data() {
53
+ return {
54
+ name: 'roleManagement',
55
+ dialogTyep: '',
56
+ fullscreen: true
57
+ }
58
+ },
59
+ computed: {
60
+ ...mapGetters(['roleManagement'])
61
+ },
62
+ mounted: function() {},
63
+ methods: {
64
+ // 表格按钮点击事件回调
65
+ toggleToolbarClick: function(data) {
66
+ const { handle, label } = data.item
67
+ this.dialogType = handle
68
+ switch (handle) {
69
+ case 'roleManagement/add':
70
+ // events混入待完善
71
+ this.currentUserResourcesGroupBycArea({ modnumb: 'c270e787-f573-40b4-8b2e-705cbf34e464' }).then((res) => {
72
+ this.$store.dispatch('roleManagement/addShow', {
73
+ title: `角色管理-${label}`,
74
+ form: res.resFieldList.createForm,
75
+ model: {},
76
+ events: {
77
+ 'cSystem': {
78
+ 'change': () => {
79
+ this.$store.dispatch('roleManagement/systemChange')
80
+ }
81
+ }
82
+ }
83
+ })
84
+ })
85
+ break
86
+ case 'roleManagement/update':
87
+ this.currentUserResourcesGroupBycArea({ modnumb: 'c270e787-f573-40b4-8b2e-705cbf34e464' }).then((res) => {
88
+ this.$store.dispatch('roleManagement/updateShow', {
89
+ title: `角色管理-${label}`,
90
+ form: res.resFieldList.createForm,
91
+ model: data.res.role,
92
+ events: {
93
+ 'cSystem': {
94
+ 'change': () => {
95
+ this.$store.dispatch('roleManagement/systemChange')
96
+ }
97
+ }
98
+ },
99
+ treeList: data.res.treeList,
100
+ resourceidList: data.res.resourceidList
101
+ })
102
+ })
103
+ break
104
+ case 'roleManagement/auth':
105
+ this.roleManagement.roleAuthorization.title = `用户管理-${label}`
106
+ this.roleManagement.roleAuthorization.visible = true
107
+ break
108
+ default:
109
+ break
110
+ }
111
+ },
112
+ // 选择行事件
113
+ toggleSelectRow: function(row) {
114
+ const self = this
115
+ self[self.name].selectRow = row
116
+ },
117
+ // 弹窗保存事件
118
+ handleOk: function() {
119
+ this.$refs.roleModal.changeOkLoading(true)
120
+ if (this.dialogType === 'roleManagement/add') {
121
+ this.$store.dispatch('roleManagement/addSave').then(() => {
122
+ this.roleManagement.dialog.visible = false
123
+ }).finally(() => {
124
+ this.$refs.roleModal.changeOkLoading(false)
125
+ })
126
+ } else if (this.dialogType === 'roleManagement/update') {
127
+ this.$store.dispatch('roleManagement/updateSave').then(() => {
128
+ this.roleManagement.dialog.visible = false
129
+ }).finally(() => {
130
+ this.$refs.roleModal.changeOkLoading(false)
131
+ })
132
+ }
133
+ },
134
+ handleRoleAuthorizationOk() {
135
+ this.$refs.roleAuthorizationModal.changeOkLoading(true)
136
+ const jsonStr = {
137
+ authRole: { id: this.roleManagement.selectRow[0].id },
138
+ authUserDelList: this.$refs.roleAuthorization.getDeleteData(),
139
+ authUserInsList: this.$refs.roleAuthorization.getAddData()
140
+ }
141
+ this.$store.dispatch('roleManagement/saveAuth', jsonStr).then(() => {
142
+ this.roleManagement.roleAuthorization.visible = false
143
+ }).finally(() => {
144
+ this.$refs.roleAuthorizationModal.changeOkLoading(false)
145
+ })
146
+ },
147
+ state_init() {
148
+ const nSensitive = this.roleManagement.tableAttrs.columns.find(el => { return el.field === 'nSensitive' })
149
+ nSensitive.slots = {
150
+ default: ({ row, column, rowIndex }, h) => {
151
+ var opts = column.params.optionlist.find(op => {
152
+ return row[column.property] == op.cKeynumb // eslint-disable-line
153
+ })
154
+ return (row[column.property] !== null)
155
+ ? [
156
+ <el-tag key={rowIndex} type={ row[column.property] === 1 ? 'danger' : 'info' } title={opts ? opts.cKeyname : row[column.property]}>{ opts ? opts.cKeyname : row[column.property] }</el-tag>
157
+ ]
158
+ : []
159
+ }
160
+ }
161
+ this.$refs['kunkka-ux-grid'].$refs['kunkka-ux-grid'].loadColumn(this.roleManagement.tableAttrs.columns)
162
+ }
163
+ }
164
+ }
165
+ </script>
166
+ <style lang="scss">
167
+ .roleManagementDialog {
168
+ .el-dialog__body {
169
+ padding: 5px 10px !important;
170
+ }
171
+ .el-scrollbar__view {
172
+ margin: 0 !important;
173
+ }
174
+ }
175
+ </style>
@@ -0,0 +1,184 @@
1
+ <template>
2
+ <div class="userAuthDialog">
3
+ <div>
4
+ <el-row :gutter="10" class="padding0px5px">
5
+ <kunkka-form
6
+ ref="sunnyopticalForm"
7
+ :sm="12"
8
+ :lg="12"
9
+ :gutter="25"
10
+ :name="name"
11
+ :form="roleAuthorization.conditions"
12
+ :model="roleAuthorization.model"
13
+ />
14
+ </el-row>
15
+ <el-card class="table-card">
16
+ <div>
17
+ <el-button icon="iconfont icon-add" class="icon-base-btn" size="mini" style="margin-bottom:5px" @click="add">新增</el-button>
18
+ </div>
19
+ <el-table
20
+ :data="roleAuthorization.value"
21
+ height="200px"
22
+ style="width: 100%"
23
+ stripe
24
+ :show-overflow-tooltip="true"
25
+ class="addTable autoHeightTable"
26
+ border
27
+ >
28
+ <el-table-column label="用户编号">
29
+ <template slot-scope="scope">
30
+ {{ scope.row.cUsernumb }}
31
+ </template>
32
+ </el-table-column>
33
+ <el-table-column label="用户姓名" width="200">
34
+ <template slot-scope="scope">
35
+ {{ scope.row.cUsername }}
36
+ </template>
37
+ </el-table-column>
38
+ <el-table-column label="用户类型" width="100">
39
+ <template slot-scope="scope">
40
+ {{ filterSelect(scope.row.cAdmin, selectOpts.userYhlxOpts) }}
41
+ </template>
42
+ </el-table-column>
43
+ <el-table-column label="删除" width="90" align="center">
44
+ <template slot-scope="scope">
45
+ <el-button icon="iconfont icon-del" class="icon-btn" type="danger" @click="del(scope)">删除</el-button>
46
+ </template>
47
+ </el-table-column>
48
+ </el-table>
49
+ </el-card>
50
+ </div>
51
+ <!-- 用户查询弹窗 -->
52
+ <kunkka-search-dialog
53
+ ref="kunkka-search-dialog"
54
+ @submitAction="submitAction"
55
+ />
56
+ </div>
57
+ </template>
58
+ <script>
59
+ import { mapGetters } from 'vuex'
60
+ import { queryList } from '@/api/userManagement'
61
+ import { filterSelect } from '@/mixins/configurationFile/utils'
62
+ import selectOpts from '@/utils/select-options'
63
+ export default {
64
+ name: 'RoleAuthorization',
65
+ components: {
66
+
67
+ },
68
+ mixins: [
69
+
70
+ ],
71
+ props: {},
72
+ data() {
73
+ return {
74
+ name: 'roleAuthorization',
75
+ selectOpts
76
+ }
77
+ },
78
+ computed: {
79
+ ...mapGetters(['roleAuthorization'])
80
+ },
81
+ created() {
82
+ this.roleAuthorization.conditions = [
83
+ { label: '角色编号', components: 'Input', prop: 'cRolenumb', disabled: true, show: true },
84
+ { label: '角色名称', components: 'Input', prop: 'cRolename', disabled: true, show: true }
85
+ ]
86
+ },
87
+ mounted: function() {},
88
+ methods: {
89
+ // 按钮点击事件回调
90
+ add() {
91
+ this.$refs['kunkka-search-dialog'].openInit({
92
+ selection: true, // 多选
93
+ cTitle: '系统用户查询', // 标题名称
94
+ api: this.apiFunction, // 接口
95
+ fetchPath: { listField: 'result.records', totalField: 'result.total' }, // api返回格式取值路径变更
96
+ conditions: [
97
+ {
98
+ components: 'Input',
99
+ label: '用户编号',
100
+ prop: 'cUsernumb',
101
+ placeholder: '请输入内容',
102
+ clearable: true,
103
+ required: false,
104
+ lg: 12
105
+ },
106
+ {
107
+ components: 'Input',
108
+ label: '用户姓名',
109
+ prop: 'cUsername',
110
+ placeholder: '请输入内容',
111
+ clearable: true,
112
+ required: false,
113
+ lg: 12
114
+ }
115
+ ], // 查询表单配置项
116
+ tableCols: [
117
+ { field: 'cUsernumb', title: '用户编号' },
118
+ { field: 'cUsername', title: '用户姓名' },
119
+ { field: 'cDeptname', title: '部门' },
120
+ { field: 'cJobname', title: '岗位' }
121
+ ], // 查询表格配置项
122
+ nRows: 200 // 分页返回数目
123
+ })
124
+ },
125
+ apiFunction(data) {
126
+ return new Promise((resolve, reject) => {
127
+ const jsonStr = {
128
+ pageNo: data.pageNo,
129
+ pageSize: data.pageSize,
130
+ authUser: {
131
+ cUsernumb: data.cUsernumb ? data.cUsernumb : '',
132
+ cUsername: data.cUsername ? data.cUsername : ''
133
+ }
134
+ }
135
+ queryList(jsonStr)
136
+ .then(response => {
137
+ resolve(response)
138
+ })
139
+ .catch(error => {
140
+ reject(error)
141
+ })
142
+ })
143
+ },
144
+ del(scope) {
145
+ this.roleAuthorization.value.splice(scope.$index, 1)
146
+ },
147
+ // 用户查询确认
148
+ submitAction(selections) {
149
+ selections.forEach((item) => {
150
+ // eslint-disable-next-line no-undef
151
+ if (_.findIndex(this.roleAuthorization.value, (ele) => { return ele.id === item.id }) > -1) {
152
+ this.$message.info(`${item.cUsernumb}已存在`)
153
+ } else {
154
+ this.roleAuthorization.value.push({
155
+ id: item.id,
156
+ cAdmin: item.cAdmin,
157
+ cUsername: item.cUsername,
158
+ cUsernumb: item.cUsernumb
159
+ })
160
+ }
161
+ })
162
+ },
163
+ // 获取角色删除数据
164
+ getDeleteData() {
165
+ return this.roleAuthorization.valueClone.filter((v) => this.roleAuthorization.value.every((value) => value.id !== v.id))
166
+ },
167
+ // 获取角色新增数据
168
+ getAddData() {
169
+ return this.roleAuthorization.value.filter((v) => this.roleAuthorization.valueClone.every((value) => value.id !== v.id))
170
+ },
171
+ filterSelect
172
+ }
173
+ }
174
+ </script>
175
+ <style lang="scss">
176
+ .userAuthDialog {
177
+ .el-dialog__body {
178
+ padding: 10px !important;
179
+ }
180
+ .el-dialog__footer {
181
+ padding: 0 10px 10px 10px !important;
182
+ }
183
+ }
184
+ </style>