diff --git a/src/api/flow/index.js b/src/api/flow/index.js index 9236005..2f28286 100644 --- a/src/api/flow/index.js +++ b/src/api/flow/index.js @@ -195,7 +195,7 @@ export function statistics(type, params, isLoading=true) { }) } -export function updateTime(params,isLoading=true) { +export function updateNodeTime(params,isLoading=true) { return request({ method: 'get', url: '/api/oa/flow/update-time', @@ -203,3 +203,12 @@ export function updateTime(params,isLoading=true) { isLoading }) } + +export function updateFlowTime(params,isLoading=true) { + return request({ + method: 'get', + url: '/api/oa/flow/update-flow-time', + params, + isLoading + }) +} diff --git a/src/components/MobileMultipleSelect/index.vue b/src/components/MobileMultipleSelect/index.vue new file mode 100644 index 0000000..e0eb8c3 --- /dev/null +++ b/src/components/MobileMultipleSelect/index.vue @@ -0,0 +1,181 @@ + + + diff --git a/src/store/modules/user.js b/src/store/modules/user.js index f5691a8..de1542a 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -7,6 +7,7 @@ const getDefaultState = () => { token: getToken(), name: '', avatar: '', + username: '', adminId: '', department: {}, role: [], @@ -36,6 +37,9 @@ const mutations = { }, SET_DEPARTMENT: (state, department) => { state.department = department + }, + SET_USERNAME: (state, username) => { + state.username = username } } @@ -61,13 +65,14 @@ const actions = { return new Promise((resolve, reject) => { getInfo(state.token).then(response => { - const { name, avatar, id, role, department } = response + const { name, avatar, id, role, department, username } = response commit('SET_DEPARTMENT',department) commit('SET_NAME', name) commit('SET_AVATAR', avatar) commit('SET_ADMIN_ID', id) commit('SET_ROLE', role) + commit('SET_USERNAME', username) resolve(response) }).catch(error => { reject(error) diff --git a/src/utils/formBuilder.js b/src/utils/formBuilder.js index 6946693..d8ba4f0 100644 --- a/src/utils/formBuilder.js +++ b/src/utils/formBuilder.js @@ -508,6 +508,40 @@ export default function formBuilder(device, info, h, row, pWrite = false,pReadab ) ); break; + case "relation-flow": + formItem = h( + formBuilderMap(device).get(info.type), + { + props: { + value: row ? row[info.name] : this.form[info.name], + clearable: true, + placeholder: info.help_text, + multiple: true, + }, + attrs: { + placeholder: info.help_text, + }, + style: { + width: '100%' + }, + on: { + input: (e) => { + row + ? this.$set(row, info.name, e) + : this.$set(this.form, info.name, e); + }, + }, + }, + options.map((option) => + h("el-option", { + props: { + label: option, + value: option, + }, + }) + ) + ); + break; case "relation": formItem = h( "vxe-table", @@ -665,7 +699,7 @@ export default function formBuilder(device, info, h, row, pWrite = false,pReadab case "select": let findValue = options.find((i) => typeof i === "object" - ? i.id === this.form[info.name] + ? i.id == this.form[info.name] : i === this.form[info.name] ); formItem = h( @@ -675,7 +709,48 @@ export default function formBuilder(device, info, h, row, pWrite = false,pReadab color: "#333", }, }, - typeof findValue === "object" ? findValue.name : findValue + info.multiple ? this.form[info.name]?.split('|').map(j => { + return options.find((i) => + typeof i === "object" + ? i.id == j + : i === j + )?.name; + })?.toString() : typeof findValue === "object" ? findValue.name : findValue + ); + break; + case "choice": + formItem = h( + "span", + { + style: { + color: "#333", + }, + }, + this.form[info.name]?.split('|').map(j => { + return options.find((i) => i.id == j)?.name; + })?.toString() + ); + break; + case "choices": + let findChoicesValue = options.find((i) => + typeof i === "object" + ? i.id == this.form[info.name] + : i === this.form[info.name] + ); + formItem = h( + "span", + { + style: { + color: "#333", + }, + }, + info.multiple ? this.form[info.name]?.split('|').map(j => { + return options.find((i) => + typeof i === "object" + ? i.id == j + : i === j + )?.name; + })?.toString() : typeof findChoicesValue === "object" ? findChoicesValue.name : findChoicesValue ); break; case "file": @@ -757,7 +832,8 @@ export default function formBuilder(device, info, h, row, pWrite = false,pReadab { props: { prop: info.name, - label: info.label, + label: info.label_show ? info.label : '', + 'label-width': !info.label_show ? '0': '' }, style: { "grid-column-start": info.gs_x + 1, @@ -771,6 +847,11 @@ export default function formBuilder(device, info, h, row, pWrite = false,pReadab } } if (device === "mobile") { + let findValue = options?.find((i) => + typeof i === "object" + ? i.id === (row ? row[info.name] : this.form[info.name]) + : i === (row ? row[info.name] : this.form[info.name]) + ); if (info._writeable || pWrite) { switch (info.type) { case "text": @@ -860,11 +941,6 @@ export default function formBuilder(device, info, h, row, pWrite = false,pReadab }); break; case "select": - let findValue = options.find((i) => - typeof i === "object" - ? i.id === (row ? row[info.name] : this.form[info.name]) - : i === (row ? row[info.name] : this.form[info.name]) - ); formItem = h("van-field", { props: { readonly: true, @@ -885,6 +961,28 @@ export default function formBuilder(device, info, h, row, pWrite = false,pReadab }, }); break; + case "choice": + formItem = h("van-field", { + props: { + readonly: true, + clickable: true, + name: info.name, + label: info.label, + value: typeof findValue === "object" ? findValue.name : findValue, + clearable: true, + placeholder: info.help_text, + }, + on: { + click: (_) => { + this.multipleSelectOption.forFormName = info.name; + this.multipleSelectOption.originalObj = row; + this.$set(this.multipleSelectOption, "columns", options); + this.$set(this.multipleSelectOption, "multipleLimit", info.multiple); + this.$set(this.multipleSelectOption, "isShow", true); + }, + }, + }); + break; case "file": formItem = h('van-cell',{ props: { diff --git a/src/utils/formBuilderMap.js b/src/utils/formBuilderMap.js index a4067d2..e3b269f 100644 --- a/src/utils/formBuilderMap.js +++ b/src/utils/formBuilderMap.js @@ -8,12 +8,13 @@ export default function (device) { ['select', 'el-select'], ['radio', 'el-radio-group'], ['file', 'el-upload'], - ['label', 'el-tag'], + ['label', 'div'], ['static', 'el-link'], ['hr', 'el-divider'], ['choice', 'el-select'], ['choices', 'el-select'], - ['sign', 'el-image'] + ['sign', 'el-image'], + ['relation-flow','el-select'] ]) : new Map([ ['text', 'van-field'], diff --git a/src/views/flow/DesktopForm.vue b/src/views/flow/DesktopForm.vue index 0e86c89..66f4ab3 100644 --- a/src/views/flow/DesktopForm.vue +++ b/src/views/flow/DesktopForm.vue @@ -102,7 +102,7 @@ export default { render(h) { const authFields = this.fields.map(field => ({ ...field, - _readable: this.readable.indexOf(field.id) !== -1, + _readable: this.readable.indexOf(field.id) !== -1 || field.type === 'label', _writeable: this.writeable.indexOf(field.id) !== -1, })) authFields.unshift({ @@ -113,6 +113,7 @@ export default { gs_y: 0, gs_width: 12, gs_height: 1, + label_show: 1, _readable: !this.isFirstNode, _writeable: this.isFirstNode }) diff --git a/src/views/flow/MobileForm.vue b/src/views/flow/MobileForm.vue index bfb3550..b1cd1a4 100644 --- a/src/views/flow/MobileForm.vue +++ b/src/views/flow/MobileForm.vue @@ -1,9 +1,13 @@