@sunny-base/effects 0.0.1 → 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,95 @@
1
+ <template>
2
+ <KunkkaModal
3
+ ref="registerModal"
4
+ width="600px"
5
+ :visible.sync="visible"
6
+ :can-fullscreen="true"
7
+ :show-close="false"
8
+ :title="title"
9
+ @ok="handleOk"
10
+ >
11
+ <kunkka-form
12
+ label-position="left"
13
+ label-width="110px"
14
+ :show-message="false"
15
+ :lg="24"
16
+ v-bind="dataDictionary.formModalAttrs"
17
+ >
18
+ <template #cMeta="{ item }">
19
+ <el-table :data="dataDictionary.formModalAttrs.model[item.prop]" border size="mini">
20
+ <el-table-column label="key">
21
+ <template slot-scope="scope">
22
+ <el-select v-model="scope.row.key" size="mini" style="width: 100%;">
23
+ <el-option v-for="op in keyOpts" :key="op.cXuhao" :label="op.cName" :value="op.cXuhao" />
24
+ </el-select>
25
+ </template>
26
+ </el-table-column>
27
+ <el-table-column label="value">
28
+ <template slot-scope="scope">
29
+ <el-input v-model="scope.row.value" size="mini" style="width: 100%;" />
30
+ </template>
31
+ </el-table-column>
32
+ <el-table-column label="操作" width="40" align="center">
33
+ <template #header>
34
+ <i
35
+ class="el-icon-circle-plus-outline"
36
+ style="font-size: 16px; cursor: pointer;"
37
+ @click="dataDictionary.formModalAttrs.model[item.prop].push({})"
38
+ />
39
+ </template>
40
+ <template slot-scope="scope">
41
+ <i
42
+ class="el-icon-remove-outline"
43
+ style="font-size: 16px; cursor: pointer;"
44
+ @click="dataDictionary.formModalAttrs.model[item.prop].splice(scope.$index, 1)"
45
+ />
46
+ </template>
47
+ </el-table-column>
48
+ </el-table>
49
+ </template>
50
+ </kunkka-form>
51
+ </KunkkaModal>
52
+ </template>
53
+ <script>
54
+ /* eslint-disable no-async-promise-executor */
55
+ import { mapGetters } from 'vuex'
56
+ import { queryByXuhao } from '@/api/core'
57
+
58
+ export default {
59
+ data() {
60
+ return {
61
+ name: 'dataDictionary',
62
+ title: '数据字典-新增',
63
+ visible: false
64
+ }
65
+ },
66
+ computed: {
67
+ ...mapGetters(['dataDictionary'])
68
+ },
69
+ mounted: function() {},
70
+ methods: {
71
+ //
72
+ onDataReceive(data) {
73
+ this.dataDictionary.formModalAttrs.form = data.resFieldList.form
74
+ this.dataDictionary.formModalAttrs.model = {
75
+ nParent: data.nParent || 0,
76
+ cMeta: []
77
+ }
78
+ queryByXuhao({ cXuhao: 'DICTATTR' }).then(res => {
79
+ this.keyOpts = res.result
80
+ })
81
+ this.visible = true
82
+ },
83
+ // 弹窗确定回调
84
+ handleOk() {
85
+ this.$refs.registerModal.changeOkLoading(true)
86
+ this.$store.dispatch('dataDictionary/addSave').then(() => {
87
+ this.visible = false
88
+ this.$emit('handleSubmit')
89
+ }).finally(() => {
90
+ this.$refs.registerModal.changeOkLoading(false)
91
+ })
92
+ }
93
+ }
94
+ }
95
+ </script>
@@ -0,0 +1,133 @@
1
+ <template>
2
+ <div class="dataDictionary commonQueryDiv">
3
+ <kunkka-ux-grid
4
+ ref="kunkka-ux-grid"
5
+ v-bind="dataDictionary.tableAttrs"
6
+ row-id="id"
7
+ :checkbox-config="{
8
+ checkStrictly:true
9
+ }"
10
+ :tree-config="{lazy: true, children: 'children', hasChild: 'hasChildren', loadMethod: loadChildrenMethod }"
11
+ @toggleToolbarClick="toggleToolbarClick"
12
+ @selection-change="toggleSelectRow"
13
+ />
14
+ <DataDictionaryAdd ref="registerDataDictionaryAdd" @handleSubmit="handleSubmit" />
15
+ <DataDictionaryUpdate ref="registerDataDictionaryUpdate" @handleSubmit="handleSubmit" />
16
+ <!-- 导入弹窗 -->
17
+ <importDialog />
18
+ </div>
19
+ </template>
20
+ <script>
21
+ /* eslint-disable no-async-promise-executor */
22
+ import { mapGetters } from 'vuex'
23
+ import DataDictionaryAdd from './dataDictionaryAdd.vue'
24
+ import DataDictionaryUpdate from './dataDictionaryUpdate.vue'
25
+ import list from '@/mixins/list'
26
+
27
+ export default {
28
+ name: 'DataDictionary',
29
+ components: {
30
+ DataDictionaryAdd,
31
+ DataDictionaryUpdate
32
+ },
33
+ mixins: [list],
34
+ data() {
35
+ return {
36
+ name: 'dataDictionary',
37
+ title: '用户管理-弹窗',
38
+ visible: false
39
+ }
40
+ },
41
+ computed: {
42
+ ...mapGetters(['dataDictionary'])
43
+ },
44
+ mounted: function() {},
45
+ methods: {
46
+ // 表格按钮回调
47
+ toggleToolbarClick: function(data) {
48
+ const { handle } = data.item
49
+ switch (handle) {
50
+ case 'dataDictionary/add':
51
+ this.currentUserResourcesGroupBycArea({ modnumb: 'd925795d-58c0-4adf-b287-cc04233ada6d' }).then(result => {
52
+ const { resFieldList, resButtonList } = result
53
+ this.$refs.registerDataDictionaryAdd.onDataReceive({
54
+ visible: true,
55
+ nParent: this[this.name].selectRow[0]?.id,
56
+ resFieldList,
57
+ resButtonList
58
+ })
59
+ })
60
+ break
61
+ case 'dataDictionary/update':
62
+ this.$refs.registerDataDictionaryUpdate.onDataReceive({
63
+ visible: true,
64
+ row: this[this.name].selectRow[0]
65
+ })
66
+ break
67
+ case 'dataDictionary/enable':
68
+ this.handleSubmit()
69
+ break
70
+ case 'dataDictionary/disabled':
71
+ this.handleSubmit()
72
+ break
73
+ case 'dataDictionary/del':
74
+ this.handleSubmit()
75
+ break
76
+ default:
77
+ break
78
+ }
79
+ },
80
+ // 选择行事件
81
+ toggleSelectRow: function(row) {
82
+ const self = this
83
+ self[self.name].selectRow = row
84
+ },
85
+ // 弹窗确定回调
86
+ handleOk() {
87
+ this.$refs.registerModal.changeOkLoading(true)
88
+
89
+ if (this.dataDictionary.formModalAttrs.model.type !== 'update') {
90
+ this.$store.dispatch('dataDictionary/addSave').then(() => {
91
+ this.visible = false
92
+ this.$refs['kunkka-ux-grid'].fetch()
93
+ }).finally(() => {
94
+ this.$refs.registerModal.changeOkLoading(false)
95
+ })
96
+ } else {
97
+ this.$store.dispatch('dataDictionary/updateSave').then(() => {
98
+ this.visible = false
99
+ }).finally(() => {
100
+ this.$refs.registerModal.changeOkLoading(false)
101
+ })
102
+ }
103
+ },
104
+ handleSubmit() {
105
+ this.$refs['kunkka-ux-grid'].fetch()
106
+ this[this.name].selectRow = []
107
+ },
108
+ // 懒加载
109
+ loadChildrenMethod({ row }) {
110
+ return new Promise((resolve, reject) => {
111
+ // this.loadNodeMap.set(row.id, { row, resolve })
112
+ const jsonStr = {
113
+ pageNo: 1,
114
+ pageSize: 999,
115
+ authDict: {
116
+ nParent: row.id
117
+ }
118
+ }
119
+ this.$store.dispatch('dataDictionary/queryListAction', { jsonStr }).then((res) => {
120
+ if (res.records.length > 0) {
121
+ res.records.forEach(element => {
122
+ element.hasChildren = true
123
+ })
124
+ } else {
125
+ row.hasChildren = false
126
+ }
127
+ resolve(res.records)
128
+ })
129
+ })
130
+ }
131
+ }
132
+ }
133
+ </script>
@@ -0,0 +1,159 @@
1
+ <template>
2
+ <div>
3
+ <KunkkaModal
4
+ ref="registerModal"
5
+ width="960px"
6
+ :visible.sync="visible"
7
+ :can-fullscreen="true"
8
+ :show-close="false"
9
+ :title="title"
10
+ top="10px"
11
+ @ok="handleOk"
12
+ >
13
+ <kunkka-form
14
+ label-position="left"
15
+ label-width="110px"
16
+ :lg="24"
17
+ :show-message="false"
18
+ v-bind="tableAttr.formConfig"
19
+ @inputSearchClick="inputSearchClick"
20
+ >
21
+ <template #cMeta="{ item }">
22
+ <el-table :data="tableAttr.formConfig.model[item.prop]" border size="mini">
23
+ <el-table-column label="key">
24
+ <template slot-scope="scope">
25
+ <el-select v-model="scope.row.key" size="mini" style="width: 100%;">
26
+ <el-option v-for="op in keyOpts" :key="op.cXuhao" :label="op.cName" :value="op.cXuhao" />
27
+ </el-select>
28
+ </template>
29
+ </el-table-column>
30
+ <el-table-column label="value">
31
+ <template slot-scope="scope">
32
+ <el-input v-model="scope.row.value" size="mini" style="width: 100%;" />
33
+ </template>
34
+ </el-table-column>
35
+ <el-table-column label="操作" width="40" align="center">
36
+ <template #header>
37
+ <i
38
+ class="el-icon-circle-plus-outline"
39
+ style="font-size: 16px; cursor: pointer;"
40
+ @click="tableAttr.formConfig.model[item.prop].push({})"
41
+ />
42
+ </template>
43
+ <template slot-scope="scope">
44
+ <i
45
+ class="el-icon-remove-outline"
46
+ style="font-size: 16px; cursor: pointer;"
47
+ @click="tableAttr.formConfig.model[item.prop].splice(scope.$index, 1)"
48
+ />
49
+ </template>
50
+ </el-table-column>
51
+ </el-table>
52
+ </template>
53
+ </kunkka-form>
54
+
55
+ <kunkka-ux-grid
56
+ ref="kunkka-ux-grid"
57
+ v-bind="tableAttr"
58
+ :height="250"
59
+ />
60
+
61
+ </KunkkaModal>
62
+ <!-- 资源国际化配置 -->
63
+ <i18nDataDialog />
64
+ </div>
65
+ </template>
66
+ <script>
67
+ /* eslint-disable no-async-promise-executor */
68
+ import { mapGetters } from 'vuex'
69
+ import { queryByXuhao } from '@/api/core'
70
+ import i18nDataDialog from '@/components/i18nDataDialog'
71
+ import formTable from '@/mixins/formTable'
72
+ export default {
73
+ components: {
74
+ i18nDataDialog
75
+ },
76
+ mixins: [formTable],
77
+ data() {
78
+ return {
79
+ name: 'dataDictionary',
80
+ title: '数据字典-修改',
81
+ visible: false,
82
+ keyOpts: []
83
+ }
84
+ },
85
+ computed: {
86
+ ...mapGetters(['dataDictionary'])
87
+ },
88
+ mounted: function() {},
89
+ methods: {
90
+ onDataReceive(data) {
91
+ const { visible, row } = data
92
+ const _this = this
93
+ if (visible) {
94
+ this.currentUserResourcesGroupBycArea({ modnumb: '5fbe1cf8-fcca-4df8-a6f4-21393b335f2c' }).then(result => {
95
+ const { resFieldList, resButtonList } = result
96
+ this.tableAttr.columns = resFieldList.table
97
+ this.tableAttr.formConfig.form = resFieldList.form
98
+ this.tableAttr.toolbar = resButtonList.table || []
99
+
100
+ this.$store.dispatch(`${this.name}/editInitById`, {
101
+ id: row.id
102
+ }).then((res) => {
103
+ _this.tableAttr.model = res.result.childList
104
+ _this.$refs['kunkka-ux-grid'].$refs['kunkka-ux-grid'].reloadData(res.result.childList)
105
+
106
+ this.tableAttr.formConfig.model = {
107
+ ...res.result.authDict,
108
+ cMeta: res.result.authDict.cMeta ? _.reduce(JSON.parse(res.result.authDict.cMeta), function(result, value, key) {
109
+ result.push({
110
+ 'key': key,
111
+ 'value': value
112
+ })
113
+ return result
114
+ }, []) : []
115
+ }
116
+ })
117
+
118
+ queryByXuhao({ cXuhao: 'DICTATTR' }).then(res => {
119
+ this.keyOpts = res.result
120
+ })
121
+ this.visible = true
122
+ })
123
+ }
124
+ },
125
+ // 弹窗确定回调
126
+ handleOk() {
127
+ this.$refs.registerModal.changeOkLoading(true)
128
+
129
+ const model = this.tableAttr.formConfig.model
130
+ const cMetaObj = _.reduce(model.cMeta, function(result, value, key) {
131
+ result[value.key] = value.value
132
+ return result
133
+ }, {})
134
+ model.cMeta = JSON.stringify(cMetaObj)
135
+ model.authDictList = this.tableAttr.model
136
+
137
+ this.$store.dispatch(`${this.name}/updateSaveById`, { authDict: {
138
+ ...model
139
+ },
140
+ authDictList: this.tableAttr.model
141
+ }
142
+ ).then(() => {
143
+ this.visible = false
144
+ this.$emit('handleSubmit')
145
+ }).finally(() => {
146
+ this.$refs.registerModal.changeOkLoading(false)
147
+ })
148
+ },
149
+ inputSearchClick(data) {
150
+ this.$store.dispatch('i18nDataDialog/show', {
151
+ nParentId: this.tableAttr.formConfig.model['id'],
152
+ cBname: 'AUTH_DICT', // 业务表名
153
+ cFname: 'C_NAME', // 业务字段
154
+ cDataKey: this.tableAttr.formConfig.model[data.prop]
155
+ })
156
+ }
157
+ }
158
+ }
159
+ </script>
@@ -0,0 +1,103 @@
1
+ <template>
2
+ <div>
3
+ <div ref="kunkka-ux-grid-toolbar" class="kunkka-ux-grid-toolbar">
4
+ <el-button
5
+ v-for="(item,key) in toolbar"
6
+ :key="key"
7
+ :size="item.size"
8
+ :loading="item.loading"
9
+ :type="item.type"
10
+ :icon="item.icon"
11
+ @click="toggleToolbarClick(item)"
12
+ >
13
+ {{ item.label }}
14
+ </el-button>
15
+ </div>
16
+ <ux-grid
17
+ ref="addDialog"
18
+ border
19
+ show-overflow
20
+ keep-source
21
+ :data="tableData"
22
+ :highlight-current-row="false"
23
+ :edit-config="{trigger: 'click', mode: 'cell'}"
24
+ @select="toggleSelectRow"
25
+ >
26
+ <ux-table-column type="checkbox" width="40" />
27
+ <ux-table-column
28
+ v-for="(item, index) in columns"
29
+ :key="index"
30
+ :field="item.prop"
31
+ :title="item.label"
32
+ :edit-render="{autofocus: '.el-input__inner'}"
33
+ >
34
+ <template #edit="scope">
35
+ <el-input v-model="scope.row[item.prop]" />
36
+ </template>
37
+ <template #default="scope">
38
+ <span class="my-input-sc">{{ scope.row[item.prop] }}</span>
39
+ </template>
40
+ </ux-table-column>
41
+ </ux-grid>
42
+ </div>
43
+ </template>
44
+
45
+ <script>
46
+ import { mapGetters } from 'vuex'
47
+
48
+ export default {
49
+ components: {
50
+
51
+ },
52
+ props: {
53
+ toolbar: {
54
+ type: Array,
55
+ default: () => { return [] }
56
+ },
57
+ columns: {
58
+ type: Array,
59
+ default: () => { return [] }
60
+ },
61
+ tableData: {
62
+ type: Array,
63
+ default: () => { return [] }
64
+ }
65
+ },
66
+ data() {
67
+ return {
68
+ name: 'i18nConfig'
69
+ }
70
+ },
71
+ computed: {
72
+ ...mapGetters(['i18nConfig'])
73
+ },
74
+ methods: {
75
+ toggleToolbarClick: function(data) {
76
+ this.$store.dispatch(data.handle)
77
+ },
78
+ toggleSelectRow: function(row) {
79
+ const self = this
80
+ self[self.name].addDialog.selectRow = row
81
+ }
82
+ }
83
+ }
84
+ </script>
85
+ <style>
86
+ .my-input-sc {
87
+ display: inline-block;
88
+ line-height: 30px;
89
+ height: 30px;
90
+ -webkit-appearance: none;
91
+ background-color: #FFFFFF;
92
+ background-image: none;
93
+ border-radius : 4px;
94
+ border: 1px solid #DCDFE6;
95
+ box-sizing: border-box;
96
+ color: #606266;
97
+ font-size: inherit;
98
+ outline: none;
99
+ padding: 0 15px;
100
+ transition: border-color 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
101
+ width: 100%;
102
+ }
103
+ </style>
@@ -0,0 +1,76 @@
1
+ <template>
2
+ <div>
3
+ <el-drawer
4
+ :visible.sync="i18nConfig.editDialog.visible"
5
+ direction="rtl"
6
+ size="70%"
7
+ >
8
+ <el-table
9
+ :data="i18nConfig.editDialog.data"
10
+ height="80vh"
11
+ border
12
+ >
13
+ <el-table-column
14
+ v-for="(item,index) in i18nConfig.editDialog.conditions"
15
+ :key="index"
16
+ :label="item.label"
17
+ >
18
+ <template slot-scope="scope">
19
+ <span v-if="item.components === 'spanselect'">
20
+ {{ filterSelect(scope.row[item.prop], item.optionlist) }}
21
+ </span>
22
+ <span v-else-if="item.components === 'Input'">
23
+ <el-input
24
+ v-model="scope.row[item.prop]"
25
+ :disabled="disabledFilter(item)"
26
+ />
27
+ </span>
28
+ <span v-else>{{ scope.row[item.prop] }}</span>
29
+ </template>
30
+ </el-table-column>
31
+ </el-table>
32
+ <div class="i18nEd__footer">
33
+ <el-button
34
+ type="primary"
35
+ :loading="loading"
36
+ @click="submitForm()"
37
+ >确定</el-button>
38
+ </div>
39
+ </el-drawer>
40
+ </div>
41
+ </template>
42
+
43
+ <script>
44
+ import { mapGetters } from 'vuex'
45
+ import { filterSelect } from '@/mixins/configurationFile/utils'
46
+ export default {
47
+ data() {
48
+ return {
49
+ name: 'i18nConfig',
50
+ loading: false
51
+ }
52
+ },
53
+ computed: {
54
+ ...mapGetters(['i18nConfig'])
55
+ },
56
+ methods: {
57
+ disabledFilter(item) {
58
+ return item.prop === 'nType' || item.prop === 'cResname' || item.prop === 'cKey'
59
+ },
60
+ submitForm() {
61
+ this.$store.dispatch('i18nConfig/updateSaveAction')
62
+ },
63
+ filterSelect
64
+ }
65
+ }
66
+ </script>
67
+
68
+ <style lang="scss">
69
+ .i18nEd__footer {
70
+ height: 10vh;
71
+ display: flex;
72
+ align-items: center;
73
+ justify-content: flex-end;
74
+ padding: 0 20px;
75
+ }
76
+ </style>