sohelp-eleplus 1.1.22 → 1.1.25

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.
@@ -63,9 +63,8 @@
63
63
 
64
64
  <template #footer>
65
65
  <el-button @click="userModal = false">取消</el-button>
66
- <el-button type="primary" @click="saveByUser(todoType, users)" v-loading="loading" :disabled="!users.length">{{
67
- moreOption[todoType]
68
- }}
66
+ <el-button type="primary" @click="saveByUser(todoType, users)" v-loading="loading" :disabled="!users.length"
67
+ >{{ moreOption[todoType] }}
69
68
  </el-button>
70
69
  </template>
71
70
  </ele-modal>
@@ -74,10 +73,10 @@
74
73
  <el-button plain size="small" @click="updateModelValue(false)">关闭</el-button>
75
74
  <span v-if="showOpera">
76
75
  <el-button type="primary" size="small" @click="openModal('agree')" v-permission="'todo.wf.agree'"
77
- >同意</el-button
76
+ >同意</el-button
78
77
  >
79
78
  <el-button type="danger" size="small" @click="openModal('reject')" v-permission="'todo.wf.reject'"
80
- >拒绝</el-button
79
+ >拒绝</el-button
81
80
  >
82
81
  <ele-dropdown trigger="click" :items="getMore" @command="onOperate($event)" v-if="getMore.length > 0">
83
82
  <el-button plain="" size="small" title="更多" :icon="MoreFilled"></el-button>
@@ -88,224 +87,214 @@
88
87
  </template>
89
88
 
90
89
  <script setup>
91
- import { buttonAuth, getTodoDetail, moreOption, todoOperate } from "@/api/todo/index.js";
92
- import { EleMessage } from "@/components/ele-admin-plus/components";
93
- import { MoreFilled } from "@element-plus/icons-vue";
94
- import { ElMessageBox } from "element-plus/es";
95
- import { usePermission } from "@/utils/use-permission";
96
- import { computed, reactive, ref, watch } from "vue";
97
- import FormTab from "./components/form.vue";
98
- import TableTab from "./components/table.vue";
99
- import TimelineTab from "./components/timeline.vue";
100
- import WorkflowTab from "./components/workflow.vue";
101
- import ApprovalModal from "./components/approval-modal.vue";
90
+ import { buttonAuth, getTodoDetail, moreOption, todoOperate } from '@/api/todo/index.js';
91
+ import { EleMessage } from '@/components/ele-admin-plus/components';
92
+ import { MoreFilled } from '@element-plus/icons-vue';
93
+ import { ElMessageBox } from 'element-plus/es';
94
+ import { usePermission } from '@/utils/use-permission';
95
+ import { computed, reactive, ref, watch } from 'vue';
96
+ import FormTab from './components/form.vue';
97
+ import TableTab from './components/table.vue';
98
+ import TimelineTab from './components/timeline.vue';
99
+ import WorkflowTab from './components/workflow.vue';
100
+ import ApprovalModal from './components/approval-modal.vue';
102
101
 
103
- const permission = usePermission();
102
+ const permission = usePermission();
104
103
 
105
- const props = defineProps({
106
- modelValue: Boolean,
107
- data: Object,
108
- showOpera: {
109
- type: Boolean,
110
- default: true
111
- }
112
- });
104
+ const props = defineProps({
105
+ modelValue: Boolean,
106
+ data: Object,
107
+ showOpera: {
108
+ type: Boolean,
109
+ default: true
110
+ }
111
+ });
113
112
 
114
- const emit = defineEmits(["opera","update:data","update:showOpera","update:modelValue", "reload", "close"]);
113
+ const emit = defineEmits(['opera', 'update:data', 'update:showOpera', 'update:modelValue', 'reload', 'close']);
115
114
 
116
- const tabs = reactive([
117
- { label: "表单", name: "form" },
118
- { label: "流程图", name: "workflow" },
119
- { label: "表格", name: "table" },
120
- { label: "时间轴", name: "timeline" }
121
- ]);
122
- const active = ref("form");
123
- const detail = ref();
115
+ const tabs = reactive([
116
+ { label: '表单', name: 'form' },
117
+ { label: '流程图', name: 'workflow' },
118
+ { label: '表格', name: 'table' },
119
+ { label: '时间轴', name: 'timeline' }
120
+ ]);
121
+ const active = ref('form');
122
+ const detail = ref();
124
123
 
125
- const todoType = ref(null);
126
- const userModal = ref(false);
127
- const drawerVisible = ref(false);
128
- const loading = ref(false);
129
- const users = ref([]);
124
+ const todoType = ref(null);
125
+ const userModal = ref(false);
126
+ const drawerVisible = ref(false);
127
+ const loading = ref(false);
128
+ const users = ref([]);
130
129
 
131
- const approvalModalVisible = ref(false);
132
- const approvalData = reactive({
133
- id: "",
134
- refid: ""
135
- });
130
+ const approvalModalVisible = ref(false);
131
+ const approvalData = reactive({
132
+ id: '',
133
+ refid: ''
134
+ });
136
135
 
136
+ /**
137
+ * 显示详情
138
+ * @param params
139
+ */
140
+ const show = (params = {}) => {
141
+ emit('update:data', params);
142
+ emit('update:modelValue', true);
143
+ };
137
144
 
138
- /**
139
- * 显示详情
140
- * @param params
141
- */
142
- const show = (params = {}) => {
143
- emit("update:data",params);
144
- emit("update:modelValue", true);
145
- };
145
+ /** 更新modelValue */
146
+ const updateModelValue = (value) => {
147
+ emit('update:modelValue', value);
148
+ };
146
149
 
147
- /** 更新modelValue */
148
- const updateModelValue = (value) => {
149
- emit("update:modelValue", value);
150
- };
150
+ /**
151
+ * 打开抽屉
152
+ */
153
+ const open = async () => {
154
+ emit('update:showOpera', false);
155
+ const { id, refid } = props.data;
156
+ if (id && refid) {
157
+ await getDetail({ refid, id });
158
+ // //获取可审批的任务
159
+ SohelpHttp.get('/engine/web/workflow/getMyTask', { refid: refid, id: id }).then((res) => {
160
+ if (res.meta.success) {
161
+ emit('update:showOpera', res.data?.id !== '');
162
+ }
163
+ });
164
+ }
165
+ };
151
166
 
152
- /**
153
- * 打开抽屉
154
- */
155
- const open = async () => {
156
- const { id, refid } = props.data;
157
- if (id && refid) {
158
- await getDetail({ refid, id });
159
- } else {
160
- EleMessage.error("缺少id或refid参数");
161
- }
162
- };
167
+ /**
168
+ * 关闭抽屉
169
+ */
170
+ const close = () => {
171
+ active.value = 'form';
172
+ emit('close');
173
+ };
163
174
 
164
- /**
165
- * 关闭抽屉
166
- */
167
- const close = () => {
168
- active.value = "form";
169
- emit("close");
170
- };
175
+ /**
176
+ * 获取详情
177
+ * @param params
178
+ */
179
+ const getDetail = async (params) => {
180
+ loading.value = true;
181
+ const res = await getTodoDetail(params);
182
+ loading.value = false;
183
+ if (res) {
184
+ detail.value = res;
185
+ } else {
186
+ EleMessage.error('获取详情失败');
187
+ }
188
+ };
171
189
 
172
- /**
173
- * 获取详情
174
- * @param params
175
- */
176
- const getDetail = async (params) => {
177
- loading.value = true;
178
- const res = await getTodoDetail(params);
179
- loading.value = false;
180
- if (res) {
181
- detail.value = res;
182
- } else {
183
- EleMessage.error("获取详情失败");
184
- }
185
- };
190
+ /**
191
+ * 更多操作按钮
192
+ */
193
+ const getMore = computed(() => {
194
+ const exclude = ['agree', 'reject', 'batchAgree', 'batchReject', 'submit'];
195
+ return Object.entries(moreOption)
196
+ .filter(([key]) => !exclude.includes(key) && permission.hasPermission(buttonAuth[key]))
197
+ ?.map(([key, value]) => ({ title: value, command: key }));
198
+ });
186
199
 
187
- /**
188
- * 更多操作按钮
189
- */
190
- const getMore = computed(() => {
191
- const exclude = ["agree", "reject", "batchAgree", "batchReject", "submit"];
192
- return Object.entries(moreOption)
193
- .filter(([key]) => !exclude.includes(key) && permission.hasPermission(buttonAuth[key]))
194
- ?.map(([key, value]) => ({ title: value, command: key }));
195
- });
200
+ /**
201
+ * 同意、拒绝弹窗
202
+ * @param type
203
+ */
204
+ const openModal = (type) => {
205
+ todoType.value = type;
206
+ const id = props.data.id;
207
+ Object.assign(approvalData, {
208
+ id: id,
209
+ refid: props.data.refid
210
+ });
211
+ approvalModalVisible.value = true;
212
+ };
196
213
 
197
- /**
198
- * 同意、拒绝弹窗
199
- * @param type
200
- */
201
- const openModal = (type) => {
202
- todoType.value = type;
203
- const id = props.data.id;
204
- Object.assign(approvalData, {
205
- id: id,
206
- refid: props.data.refid
207
- });
208
- approvalModalVisible.value = true;
209
- };
214
+ /**
215
+ * 选择用户弹窗
216
+ */
217
+ const openUserModal = () => {
218
+ users.value = todoType.value === 'delegate' ? '' : [];
219
+ };
210
220
 
211
- /**
212
- * 选择用户弹窗
213
- */
214
- const openUserModal = () => {
215
- users.value = todoType.value === "delegate" ? "" : [];
216
- };
221
+ /**
222
+ * 更多操作
223
+ * @param type 类型
224
+ * @param row
225
+ */
226
+ const onOperate = (type) => {
227
+ todoType.value = type;
217
228
 
218
- /**
219
- * 更多操作
220
- * @param type 类型
221
- * @param row
222
- */
223
- const onOperate = (type) => {
224
- todoType.value = type;
229
+ // 委派、加签、减签
230
+ if (['delegate', 'addSign', 'removeSign'].includes(type)) {
231
+ userModal.value = true;
232
+ return false;
233
+ }
225
234
 
226
- // 委派、加签、减签
227
- if (["delegate", "addSign", "removeSign"].includes(type)) {
228
- userModal.value = true;
229
- return false;
230
- }
235
+ let data = {
236
+ taskId: props.data.taskId
237
+ };
238
+ // 跳转
239
+ if (type === 'jump') {
240
+ data.nodeKey = props.data.nodeKey;
241
+ }
231
242
 
232
- let data = {
233
- taskId: props.data.taskId
243
+ ElMessageBox.confirm(`确定要${moreOption[type]}吗?`, '系统提示', {
244
+ type: 'danger',
245
+ draggable: false
246
+ })
247
+ .then(async () => {
248
+ save(type, data);
249
+ })
250
+ .catch((e) => {});
234
251
  };
235
- // 跳转
236
- if (type === "jump") {
237
- data.nodeKey = props.data.nodeKey;
238
- }
239
252
 
240
- ElMessageBox.confirm(`确定要${moreOption[type]}吗?`, "系统提示", {
241
- type: "danger",
242
- draggable: false
243
- })
244
- .then(async () => {
245
- save(type, data);
246
- })
247
- .catch((e) => {
253
+ // 更新table
254
+ const done = () => {
255
+ updateModelValue(false);
256
+ emit('reload');
257
+ };
258
+
259
+ /**
260
+ * 委派,加签,减签保存
261
+ * @param type
262
+ */
263
+ const saveByUser = (type) => {
264
+ save(type, {
265
+ id: props.data.id,
266
+ [type === 'delegate' ? 'userId' : 'users']: users.value
248
267
  });
249
- };
268
+ };
250
269
 
251
- // 更新table
252
- const done = () => {
253
- updateModelValue(false);
254
- emit("reload");
255
- };
270
+ /**
271
+ * 保存
272
+ * @param type
273
+ * @param data
274
+ */
275
+ const save = (type, data) => {
276
+ loading.value = true;
277
+ todoOperate(type, data)
278
+ .then((msg) => {
279
+ loading.value = false;
280
+ EleMessage.success(msg);
281
+ done();
282
+ if (type == 'agree' || type == 'reject') {
283
+ todoDrawerRef.value?.closeModal();
284
+ }
285
+ if (['delegate', 'addSign', 'removeSign'].includes(type)) {
286
+ userModal.value = false;
287
+ }
288
+ })
289
+ .catch((e) => {
290
+ loading.value = false;
291
+ EleMessage.error(e.message);
292
+ });
293
+ };
256
294
 
257
- /**
258
- * 委派,加签,减签保存
259
- * @param type
260
- */
261
- const saveByUser = (type) => {
262
- save(type, {
263
- id: props.data.id,
264
- [type === "delegate" ? "userId" : "users"]: users.value
295
+ defineExpose({
296
+ show,
297
+ close
265
298
  });
266
- };
267
-
268
- /**
269
- * 保存
270
- * @param type
271
- * @param data
272
- */
273
- const save = (type, data) => {
274
- loading.value = true;
275
- todoOperate(type, data)
276
- .then((msg) => {
277
- loading.value = false;
278
- EleMessage.success(msg);
279
- done();
280
- if (type == "agree" || type == "reject") {
281
- todoDrawerRef.value?.closeModal();
282
- }
283
- if (["delegate", "addSign", "removeSign"].includes(type)) {
284
- userModal.value = false;
285
- }
286
- })
287
- .catch((e) => {
288
- loading.value = false;
289
- EleMessage.error(e.message);
290
- });
291
- };
292
-
293
- defineExpose({
294
- show,
295
- close
296
- });
297
- watch(
298
- () => props.modelValue,
299
- (val) => {
300
- drawerVisible.value = val;
301
- emit("update:showOpera",false);
302
- //获取可审批的任务
303
- SohelpHttp.get("/engine/web/workflow/getMyTasks", { refid: props.data.refid, id: props.data.id }).then(res => {
304
- if (res.meta.success) {
305
- // emit("update:showOpera",res.data.length > 0)
306
- }
307
- });
308
- }
309
- );
310
299
  </script>
311
300
  <style lang="scss" scoped></style>