kz-ui-base 1.0.13 → 1.0.16

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.
@@ -44,10 +44,117 @@ function makeDialog(option) {
44
44
  // return this.setting.isShow;
45
45
  //}
46
46
  },
47
+ created() {
48
+ // this.$nextTick(() => {
49
+ // console.log(option.setting.length)
50
+ // console.log(option.setting.height)
51
+ // if (option.setting.height) {
52
+ // this.$refs.dialogtop.$el.firstChild.style.height =
53
+ // option.setting.height;
54
+ // }
55
+ // // if (option.setting.fixedTitle) {
56
+ // // this.$refs.dialogtop.$el.children[0].children[0].style.position =
57
+ // // "fixed";
58
+ // // // this.$refs.dialogtop.$el.children[0].children[0].style.top = "2px";
59
+ // // this.$refs.dialogtop.$el.children[0].children[0].style.width =
60
+ // // "inherit";
61
+ // // this.$refs.dialogtop.$el.children[0].children[0].style["z-index"] =
62
+ // // "999";
63
+ // // this.$refs.dialogtop.$el.children[0].children[0].style[
64
+ // // "background-color"
65
+ // // ] = "#FFF";
66
+ // // }
67
+ //
68
+ // // console.log(this.$refs.dialogtop.$el.children[0].children[0].style.position='fixed');
69
+ // });
70
+ },
71
+ methods: {
72
+ //��ǰ��ʵ���ֶ�ֵ����¼�
73
+ onChangeEvent(args) {
74
+ this.$emit("change", args);
75
+ //args: { property: this.column.property, value: value, entity: this.entity, column: this.column }
76
+ //console.log(args);
77
+ },
78
+ beforeClose(done) {
79
+ if (option.beforeClose) {
80
+ option.beforeClose(done);
81
+ } else {
82
+ done();
83
+ }
84
+ },
85
+ close() {
86
+ this.isShow = false;
87
+ this.setting.isShow = false;
88
+ this.$forceUpdate();
89
+ if (option.close) {
90
+ option.close();
91
+ }
92
+ },
93
+ onCustomOpMenuClick() {},
94
+ onCancelClick() {
95
+ this.isShow = false;
96
+ this.setting.isShow = false;
97
+ this.close();
98
+ },
99
+ onSaveClick(result) {
100
+ this.isShow = false;
101
+ this.setting.isShow = false;
102
+ this.$forceUpdate();
103
+ option.onSaveClick && option.onSaveClick(result);
104
+ option.confirm && option.confirm(result);
105
+ },
106
+ },
107
+ components: {
108
+ dialogContent: option.component,
109
+ },
110
+ });
111
+ return vue;
112
+ }
113
+ function makeDrawer(option) {
114
+ var dom = document.createElement("div");
115
+ document.getElementsByTagName("body")[0].appendChild(dom);
116
+ let tpl =
117
+ '\
118
+ <el-drawer \
119
+ ref="drawertop"\
120
+ v-if="isShow"\
121
+ :custom-class="customClass" \
122
+ :title="setting.title || title" \
123
+ :visible="setting.isShow" \
124
+ :size="setting.width || \'60%\'" \
125
+ resizeable \
126
+ :before-close="beforeClose" \
127
+ append-to-body \
128
+ @close="close">\
129
+ <dialogContent :setting.sync="setting" @change="onChangeEvent" @onCustomOpMenuClick="onCustomOpMenuClick" @onSaveClick="onSaveClick" @onCancelClick="onCancelClick" @close="onCancelClick" @confirm="onSaveClick" v-model="dialogData"></dialogContent>\
130
+ </el-drawer>';
131
+
132
+ var vue = new Vue({
133
+ el: dom,
134
+ data: function () {
135
+ return {
136
+ title: option.title,
137
+ setting: option.setting,
138
+ dialogData: option.data || option.setting.data,
139
+ isShow: true,
140
+ fixedTitle: true,
141
+ };
142
+ },
143
+ template: tpl,
144
+ computed: {
145
+ customClass() {
146
+ return `el-dialog--width-${option.size || "auto"} customDrawer`;
147
+ },
148
+
149
+ //isShow() {
150
+ // console.log('isShow:' + this.setting.isShow);
151
+ // return this.setting.isShow;
152
+ //}
153
+ },
47
154
  created() {
48
155
  this.$nextTick(() => {
49
156
  if (option.setting.height) {
50
- this.$refs.dialogtop.$el.firstChild.style.height =
157
+ this.$refs.drawertop.$el.firstChild.style.height =
51
158
  option.setting.height;
52
159
  }
53
160
  // if (option.setting.fixedTitle) {
@@ -113,6 +220,10 @@ export default {
113
220
  open(options) {
114
221
  options.isShow = true;
115
222
  options.setting.isShow = true;
116
- return makeDialog(options);
223
+ if(options.setting?.showType == "drawer"){
224
+ return makeDrawer(options)
225
+ }else{
226
+ return makeDialog(options);
227
+ }
117
228
  },
118
229
  };
@@ -1,9 +1,11 @@
1
1
  import Vue from "vue";
2
2
  import dialog from "@components/base/dialog/Dialog";
3
3
  import router from "@/router/index.js";
4
+ import store from "@/store/index.js";
5
+ import { constantRoutes } from "@/router";
4
6
  Vue.prototype.dialog = dialog;
5
7
  const open = (options) => {
6
- if (options.setting&&options.setting.jumpUrl) {
8
+ if (options.setting?.jumpUrl) {
7
9
  router.push({
8
10
  name: options.setting.jumpUrl
9
11
  .toLowerCase()
@@ -13,29 +15,49 @@ const open = (options) => {
13
15
  return;
14
16
  }
15
17
  if (typeof options.component === "string") {
16
- let component = options&&options.component;
18
+ let component = options?.component;
17
19
  options.component = (resolve) => {
18
20
  require([`@/${component}`], resolve);
19
21
  };
20
22
  }
21
- if (options&&options.setting&&options.setting.showType == "menuTab") {
23
+ if (options?.setting?.showType == "menuTab") {
24
+ let num = store.state.tagsView.num;
25
+ for (let i = 0; i < constantRoutes[0].children.length; i++) {
26
+ if (options.setting.title == constantRoutes[0].children[i].meta.title) {
27
+ num = constantRoutes[0].children[i].meta.num;
28
+ break
29
+ }
30
+ if (i == constantRoutes[0].children.length - 1) {
31
+ store.dispatch("tagsView/addTabNum");
32
+ num = store.state.tagsView.num;
33
+ }
34
+ }
35
+
22
36
  let url = new Date().getTime();
23
- if (options.setting&&options.setting.entityId) {
37
+ if (options.setting?.entityId) {
24
38
  url = options.setting.entityId;
25
39
  }
26
- router.addRoute("tabmenu", {
40
+
41
+ constantRoutes[0].children.unshift({
27
42
  path: `/tabmenu/${url}`,
28
43
  component: (resolve) =>
29
- require([`@/components/base/tabMenuRoute`], resolve),
44
+ require([`@/components/base/Menus/tabMenuRoute` + num], resolve),
30
45
  name: url,
31
46
  meta: {
32
47
  title: options.setting.title,
48
+ redirectOnClose: options.setting.redirectOnClose,
49
+ num: num,
33
50
  },
34
51
  });
52
+ router.addRoute(constantRoutes[0]);
53
+ localStorage.setItem(
54
+ "optionTabCodeData",
55
+ JSON.stringify(options.setting.redirectOnClose)
56
+ );
35
57
  router.push({
36
58
  name: url,
37
59
  params: { options },
38
- });
60
+ },()=>{}, ()=>{});
39
61
  return;
40
62
  }
41
63
  try {
@@ -49,7 +71,7 @@ const open = (options) => {
49
71
  ) {
50
72
  Vue.prototype.openDialog(options.component)({
51
73
  ...options,
52
- ...options&&options.setting&&options.setting.data,
74
+ ...options?.setting?.data,
53
75
  });
54
76
  } else {
55
77
  Vue.prototype.dialog.open(options);
@@ -60,17 +82,17 @@ const open = (options) => {
60
82
  const ComponentClass = Vue.extend(options.component);
61
83
  const instance = new ComponentClass();
62
84
  instance.$mount();
85
+
63
86
  if (String(instance.dialogType) === "2") {
64
87
  Vue.prototype.openDialog(options.component)({
65
88
  ...options,
66
- ...options&&options.setting&&options.setting.data,
89
+ ...options?.setting?.data,
67
90
  });
68
91
  } else {
69
92
  Vue.prototype.dialog.open(options);
70
93
  }
71
94
  }
72
95
  } catch (e) {
73
- console.error(options.component, "弹窗error");
74
96
  Vue.prototype.dialog.open(options);
75
97
  }
76
98
  };
@@ -0,0 +1,192 @@
1
+ <template>
2
+ <!-- 添加或修改参数配置对话框 -->
3
+ <el-dialog
4
+ :title="setting.title"
5
+ :visible.sync="setting.isShow"
6
+ :width="width"
7
+ :close-on-click-modal="false"
8
+ append-to-body
9
+ v-dialogDrag
10
+ v-dialogDragHeight
11
+ >
12
+ <slot name="entityForm">
13
+ <el-form
14
+ ref="entity"
15
+ :model="entity"
16
+ :rules="rules"
17
+ :label-width="labelWidth"
18
+ >
19
+ <el-row>
20
+ <FormColumns ref="FormColumns"
21
+ :columns.sync="columns"
22
+ :entity.sync="entity"
23
+ @change="onChangeEvent"
24
+ ></formColumns>
25
+ </el-row>
26
+ </el-form>
27
+ </slot>
28
+ <slot name="footer">
29
+ <div class="dialog-footer">
30
+ <el-button
31
+ type="primary"
32
+ :loading="setting.submitLoading"
33
+ @click="submitForm"
34
+ >确 定</el-button
35
+ >
36
+ <el-button @click="cancel">取 消</el-button>
37
+ <el-button
38
+ v-for="opMenu in customOpMenus"
39
+ :key="opMenu.name"
40
+ @click="handleCustomOpMenuClick(opMenu)"
41
+ >{{ opMenu.text }}</el-button
42
+ >
43
+ </div>
44
+ </slot>
45
+ </el-dialog>
46
+ </template>
47
+
48
+ <script>
49
+ import { addEntity, updateEntity } from "../../../api/common/common";
50
+
51
+ import FormColumns from "@components/customForm/formColumns";
52
+
53
+ export default {
54
+ name: "EditDialog",
55
+ components: {
56
+ FormColumns,
57
+ },
58
+ props: {
59
+ //微服务模块名称
60
+ moduleName: {
61
+ type: String,
62
+ default: function () {
63
+ return undefined;
64
+ },
65
+ },
66
+ //实体名称-服务名称
67
+ serviceName: {
68
+ type: String,
69
+ default: function () {
70
+ return undefined;
71
+ },
72
+ },
73
+ setting: {
74
+ type: Object,
75
+ default: function () {
76
+ return {
77
+ pkField: "id",
78
+ // 提交状态
79
+ submitLoading: false,
80
+ // 弹出层标题
81
+ title: "",
82
+ // 是否显示弹出层
83
+ isShow: false,
84
+ // 保存时是否自动关闭
85
+ isCloseOnSave: true,
86
+ };
87
+ },
88
+ },
89
+ // 列信息
90
+ columns: {
91
+ type: Array,
92
+ default: function () {
93
+ return [
94
+ //{ key: 0, text: `用户编码`, property: "userNo", visible: true },
95
+ //{ key: 1, text: `用户账号`, property: "userAccount", visible: true },
96
+ ];
97
+ },
98
+ },
99
+ // 表单参数
100
+ entity: {
101
+ type: Object,
102
+ default: function () {
103
+ return {};
104
+ },
105
+ },
106
+ // 表单校验
107
+ rules: {
108
+ type: Object,
109
+ default: function () {
110
+ return {};
111
+ },
112
+ },
113
+ //编辑界面自定义按钮菜单 - 若无自定义按钮,不需要重写
114
+ customOpMenus: {
115
+ type: Array,
116
+ default: function () {
117
+ return [
118
+ //{ name: "custom1", visable: true, icon: "ion-plus-round", text: "自定义1" }
119
+ ];
120
+ },
121
+ },
122
+ },
123
+ data() {
124
+ return {
125
+ //表格宽度
126
+ width: this.setting.width || "60%",
127
+ //input框宽度
128
+ labelWidth: this.setting.labelWidth || "100px",
129
+ };
130
+ },
131
+ watch: {},
132
+ created() {},
133
+ mounted() {},
134
+ activated() {
135
+ console.log("editDialog");
136
+ },
137
+ methods: {
138
+ //当前绑定实体字段值变更事件
139
+ onChangeEvent(args) {
140
+ this.$emit("change", args);
141
+ //args: { property: this.column.property, value: value, entity: this.entity, column: this.column }
142
+ //console.log(args);
143
+ },
144
+ show() {
145
+ this.setting.isShow = true;
146
+ },
147
+ /** 组件内更新属性值 */
148
+ updateEntity(args) {},
149
+ // 取消按钮
150
+ cancel() {
151
+ this.setting.isShow = false;
152
+ //this.reset()
153
+ this.$emit("onCancelClick", { data: this.entity, setting: this.setting });
154
+ },
155
+ // 表单重置
156
+ reset() {
157
+ for (var column of this.columns) {
158
+ this.entity[column.property] = column.default;
159
+ }
160
+ this.resetForm("entity");
161
+ },
162
+ /** 提交按钮 */
163
+ submitForm: function () {
164
+ var self = this;
165
+ this.setting.submitLoading = true;
166
+ this.$refs["entity"].validate((valid) => {
167
+ if (valid) {
168
+ this.$emit("onSaveClick", {
169
+ data: this.entity,
170
+ setting: this.setting,
171
+ });
172
+ }
173
+ });
174
+ this.setting.submitLoading = false;
175
+ },
176
+ /** 自定义操作菜单按钮点击处理 */
177
+ handleCustomOpMenuClick(opMenu) {
178
+ this.$emit("onCustomOpMenuClick", {
179
+ opMenu: opMenu,
180
+ data: this.entity,
181
+ setting: this.setting,
182
+ });
183
+ },
184
+ },
185
+ };
186
+ </script>
187
+
188
+ <style scoped>
189
+ .wrapper-container-supplement {
190
+ min-height: 415px;
191
+ }
192
+ </style>
@@ -0,0 +1,224 @@
1
+ <template>
2
+ <!-- 添加或修改参数配置对话框 -->
3
+ <div>
4
+ <SearchTable
5
+ :moduleName="setting.moduleName"
6
+ :serviceName="setting.serviceName"
7
+ :url="setting.url"
8
+ :parameter="setting.parameter"
9
+ :listColumns.sync="setting.listColumns"
10
+ :listQueryParams.sync="setting.listQueryParams"
11
+ :setting.sync="setting.listSetting"
12
+ :searchRules.sync="setting.searchRules"
13
+ :isMultiple="setting.isMultiple"
14
+ :treeSetting="setting.treeSetting"
15
+ :isAutoGenerationColumns="true"
16
+ :listCustomOpMenus="setting.listCustomOpMenus"
17
+ @change="onChangeEvent"
18
+ @onListCustomOpMenuClick="onListCustomOpMenuClick"
19
+ />
20
+ <slot name="footer" v-if="setting.footerButton">
21
+ <div class="dialog-footer">
22
+ <el-button
23
+ type="primary"
24
+ :loading="tableSetting.submitLoading"
25
+ @click="submitForm"
26
+ >确 定</el-button
27
+ >
28
+ <el-button @click="cancel">取 消</el-button>
29
+ </div>
30
+ </slot>
31
+ </div>
32
+ </template>
33
+
34
+ <script>
35
+ import SearchTable from "../../customForm/searchTable.vue";
36
+ export default {
37
+ name: "lookupDialog",
38
+
39
+ components: {
40
+ SearchTable,
41
+ },
42
+ props: {
43
+ setting: {
44
+ type: Object,
45
+ default: function () {
46
+ return undefined;
47
+ },
48
+ },
49
+ },
50
+ data() {
51
+ return {
52
+ // 当前选中行实体
53
+ currentEntity: undefined,
54
+ // 当前选中行实体集合
55
+ currentEntities: undefined,
56
+ tableSetting: {
57
+ //类型,支持以下类型:
58
+ type: undefined,
59
+ //微服务模块名称
60
+ moduleName: undefined,
61
+ //实体名称-服务名称
62
+ serviceName: undefined,
63
+ pkField: "id",
64
+ // 提交状态
65
+ submitLoading: false,
66
+ // 弹出层标题
67
+ title: "请选择",
68
+ // 保存时是否自动关闭
69
+ isCloseOnSave: true,
70
+ // 启用多选模式
71
+ isMultiple: false,
72
+ //自定义操作菜单设定 - 若无自定义按钮,不需要重写
73
+ customOpMenus: [
74
+ //{
75
+ // visable: true,
76
+ // text: "按钮1",
77
+ // icon: "el-icon-plus",
78
+ // permission: "",
79
+ // name: "custom1",
80
+ // isShowText: false,
81
+ // cssType: "success",
82
+ //},
83
+ ],
84
+ // 列表分页参数
85
+ listQueryParams: {
86
+ pageNum: 1,
87
+ pageSize: 5,
88
+ totalPages: 1,
89
+ total: 0,
90
+ orderBy: "id",
91
+ },
92
+ listSetting: {
93
+ //获取列表数据的api方法名
94
+ getListAction: "list",
95
+ //主键字段
96
+ pkField: this.pkField,
97
+ // 遮罩层
98
+ loading: false,
99
+ //是否显示合计行
100
+ isShowSumRow: true,
101
+ //是否启用行内编辑模式
102
+ isOpenInlineEditMode: false,
103
+ //是否显示分页栏
104
+ isShowPager: true,
105
+ //是否显示操作栏
106
+ isShowOpColumn: false,
107
+ },
108
+ // 列表列信息
109
+ listColumns: [
110
+ //{ key: 0, text: `用户编码`, property: "userNo", type: "string", visible: true },
111
+ //{ key: 1, text: `用户账号`, property: "userAccount", visible: true },
112
+ ],
113
+
114
+ //列表自定义操作菜单设定 - 若无自定义按钮,不需要重写
115
+ listCustomOpMenus: [
116
+ // {
117
+ // visable: true,
118
+ // text: "按钮1",
119
+ // icon: "el-icon-edit",
120
+ // permission: "",
121
+ // name: "custom1",
122
+ // isShowText: false,
123
+ // },
124
+ ],
125
+ // 列表查询条件
126
+ searchRules: [
127
+ //{ key: 0, text: `用户编码`, property: "userNo", value: "", visible: true },
128
+ //{ key: 1, text: `用户账号`, property: "userAccount", value: "", visible: true },
129
+ ],
130
+ //弹框是否显示确定 取消
131
+ footerButton: this.setting.footerButton != false,
132
+ },
133
+ };
134
+ },
135
+
136
+ created() {
137
+ this.init();
138
+ for (var key in this.tableSetting) {
139
+ var ignore = false;
140
+ for (var keySetting in this.setting) {
141
+ if (key == keySetting) {
142
+ ignore = true;
143
+ break;
144
+ }
145
+ }
146
+ if (ignore) continue;
147
+
148
+ this.setting[key] = this.tableSetting[key];
149
+ }
150
+ this.$emit("update:setting", this.setting);
151
+ },
152
+ mounted() {},
153
+ activated() {},
154
+ methods: {
155
+ onChangeEvent(value) {
156
+ if (this.setting.isMultiple) this.currentEntities = value;
157
+ else this.currentEntity = value;
158
+ },
159
+ // 取消按钮
160
+ cancel() {
161
+ //this.reset()
162
+ this.$emit("onCancelClick", {
163
+ data: this.setting.isMultiple
164
+ ? this.currentEntities
165
+ : this.currentEntity,
166
+ setting: this.setting,
167
+ });
168
+ },
169
+ init() {
170
+ if (this.setting.type) {
171
+ switch (this.setting.type) {
172
+ case "User":
173
+ this.setting.moduleName = "system";
174
+ this.setting.serviceName = "user";
175
+ this.setting.displayField = "nickName";
176
+ this.setting.valueField = "userId";
177
+
178
+ break;
179
+ case "Dept":
180
+ this.setting.moduleName = "system";
181
+ this.setting.serviceName = "dept";
182
+ this.setting.displayField = "deptName";
183
+ this.setting.valueField = "deptId";
184
+ this.setting.dataField = "data";
185
+ break;
186
+ case "Post":
187
+ this.setting.moduleName = "system";
188
+ this.setting.serviceName = "post";
189
+ this.setting.displayField = "postName";
190
+ this.setting.valueField = "postId";
191
+ break;
192
+ case "Role":
193
+ this.setting.moduleName = "system";
194
+ this.setting.serviceName = "role";
195
+ this.setting.displayField = "roleName";
196
+ this.setting.valueField = "roleId";
197
+ break;
198
+ }
199
+ }
200
+ },
201
+ /** 列表表格自定义按钮点击处理 */
202
+ onListCustomOpMenuClick(args) {
203
+ //console.log("ListBasePage:onListCustomOpMenuClick:" + args.opMenu.name);
204
+ },
205
+ /** 提交按钮 */
206
+ submitForm: function () {
207
+ var self = this;
208
+
209
+ this.$emit("onSaveClick", {
210
+ data: this.setting.isMultiple
211
+ ? this.currentEntities
212
+ : this.currentEntity,
213
+ setting: this.setting,
214
+ });
215
+ },
216
+ },
217
+ };
218
+ </script>
219
+
220
+ <style scoped>
221
+ .wrapper-container-supplement {
222
+ min-height: 415px;
223
+ }
224
+ </style>
@@ -132,7 +132,7 @@ export default {
132
132
  name: "PrintDialog",
133
133
 
134
134
  components: {
135
- SearchTable: () => import("@/components/customForm/searchTable"),
135
+ SearchTable: () => import("../../customForm/searchTable"),
136
136
  },
137
137
  props: {
138
138
  //微服务模块名称
@@ -56,12 +56,16 @@
56
56
  <script>
57
57
  import {
58
58
  listEntity,
59
- } from "@/api/common/common";
59
+ } from "../../../api/common/common";
60
+ import EditTable from "../../customForm/editTable.vue";
61
+
62
+ import EditDialog from "./editDialog.vue";
60
63
  export default {
61
64
  name: "tableDialog",
62
65
  extends: EditDialog,
63
66
 
64
67
  components: {
68
+ EditTable,
65
69
  },
66
70
  props: {
67
71
  springFrametable: {
@@ -34,8 +34,21 @@
34
34
  </template>
35
35
 
36
36
  <script>
37
+ import {
38
+ listUser,
39
+ getUser,
40
+ delUser,
41
+ addUser,
42
+ updateUser,
43
+ resetUserPwd,
44
+ changeUserStatus,
45
+ changeUserRole
46
+ } from "@/api/system/user"
37
47
  import {getToken} from "@utils/auth"
48
+ import {treeSelect} from "@/api/system/post"
49
+ import Treeselect from "@riophae/vue-treeselect"
38
50
  import "@riophae/vue-treeselect/dist/vue-treeselect.css"
51
+ import {optionSelect} from "@/api/system/role"
39
52
 
40
53
  export default {
41
54
  name: "UploadDialog",