diff --git a/src/main.js b/src/main.js index 5ecaada..94cd89c 100644 --- a/src/main.js +++ b/src/main.js @@ -56,6 +56,10 @@ Vue.use(window.AvueFormDesign) Vue.use(window.WfDesign.default, { i18n: (key, value) => i18n.t(key, value) }) + +import WfCustomFields from './views/plugin/workflow/components' +Vue.use(WfCustomFields) + Vue.config.productionTip = false; new Vue({ diff --git a/src/views/plugin/workflow/components/index.js b/src/views/plugin/workflow/components/index.js new file mode 100644 index 0000000..1dea7c0 --- /dev/null +++ b/src/views/plugin/workflow/components/index.js @@ -0,0 +1,21 @@ +// ./为当前目录, true为是否匹配当前文件夹 /\.vue$/为匹配插件(匹配.vue结尾的插件) +const requireComponent = require.context('./', true, /\.vue$/); +const install = (Vue) => { + + if (install.installed) return + else install.installed + + requireComponent.keys().forEach(fileName => { + const config = requireComponent(fileName) + const componentName = config.default.name + Vue.component('wf-' + componentName, config.default || config) + }) +} + +if (typeof window !== 'undefined' && window.Vue) { + install(window.Vue) +} + +export default { + install +} \ No newline at end of file diff --git a/src/views/plugin/workflow/components/wf-user-select/index.vue b/src/views/plugin/workflow/components/wf-user-select/index.vue new file mode 100644 index 0000000..6311513 --- /dev/null +++ b/src/views/plugin/workflow/components/wf-user-select/index.vue @@ -0,0 +1,263 @@ + + + \ No newline at end of file diff --git a/src/views/plugin/workflow/design/button.vue b/src/views/plugin/workflow/design/button.vue index 348d880..c1dea15 100644 --- a/src/views/plugin/workflow/design/button.vue +++ b/src/views/plugin/workflow/design/button.vue @@ -62,7 +62,7 @@ export default { column: [ { label: "key", - prop: "key", + prop: "buttonKey", rules: [{ required: true, message: "请输入key", diff --git a/src/views/plugin/workflow/design/form-history.vue b/src/views/plugin/workflow/design/form-history.vue index 1d48b4f..bd23968 100644 --- a/src/views/plugin/workflow/design/form-history.vue +++ b/src/views/plugin/workflow/design/form-history.vue @@ -86,7 +86,7 @@ export default { column: [ { label: "表单key", - prop: "key", + prop: "formKey", search: true }, { diff --git a/src/views/plugin/workflow/design/form.vue b/src/views/plugin/workflow/design/form.vue index bbbbba8..36637d1 100644 --- a/src/views/plugin/workflow/design/form.vue +++ b/src/views/plugin/workflow/design/form.vue @@ -6,6 +6,7 @@ :page.sync="page" :search.sync="query" :permission="permissionList" + :before-open="beforeOpen" v-model="form" @row-update="rowUpdate" @row-save="rowSave" @@ -74,7 +75,10 @@ import { getList, add, update, remove, listType } from "@/api/plugin/workflow/form"; import { mapGetters } from "vuex"; +import customFields from '../mixins/custom-fields' + export default { + mixins: [customFields], data() { return { formVisible: false, @@ -103,7 +107,7 @@ export default { column: [ { label: "表单key", - prop: "key", + prop: "formKey", rules: [{ required: true, message: "请输入表单key", @@ -153,18 +157,11 @@ export default { ] }, data: [], - customFields: [{ - label: '批复意见', - prop: 'comment', - type: 'textarea', - span: 24, - display: true - }], defaultValues: {}, copyOption: { column: [{ label: "表单key", - prop: "key", + prop: "formKey", rules: [{ required: true, message: "请输入表单key", @@ -391,6 +388,12 @@ export default { this.$refs.crud.toggleSelection(); }); }, + beforeOpen(done, type) { + if (["add"].includes(type)) { + this.$set(this.form, 'status', 1) + } + done(); + }, searchReset() { this.query = {}; this.onLoad(this.page); diff --git a/src/views/plugin/workflow/design/index.vue b/src/views/plugin/workflow/design/index.vue index 975ae9b..a33373b 100644 --- a/src/views/plugin/workflow/design/index.vue +++ b/src/views/plugin/workflow/design/index.vue @@ -22,7 +22,8 @@
- @@ -190,13 +190,13 @@ export default { }, props: { label: 'name', - value: 'key' + value: 'formKey' }, event: { change: (val) => { this.step1.option1 = {} if (val) { - getFormByKey({ key: val }).then(res => { + getFormByKey({ formKey: val }).then(res => { _this.step1.option1 = { ...eval('(' + res.data.data.content + ')'), menuBtn: false, readonly: true } _this.step1.option.group[1].display = true setTimeout(() => { @@ -370,7 +370,7 @@ export default { const list = res.data.data.records.map(l => { return { label: l.name, - prop: l.key, + prop: l.buttonKey, display: true } }) diff --git a/src/views/plugin/workflow/mixins/custom-fields.js b/src/views/plugin/workflow/mixins/custom-fields.js new file mode 100644 index 0000000..ea4e692 --- /dev/null +++ b/src/views/plugin/workflow/mixins/custom-fields.js @@ -0,0 +1,18 @@ +export default { + data() { + return { + customFields: [{ + title: '业务字段', + list: [{ + label: '人员选择', + prop: 'user', + component: 'wf-user-select', + span: 12, + params: { + checkType: 'checkbox' + } + }] + }] + } + } +} \ No newline at end of file diff --git a/src/views/plugin/workflow/process/claim.vue b/src/views/plugin/workflow/process/claim.vue index 1cb5e52..8c4393a 100644 --- a/src/views/plugin/workflow/process/claim.vue +++ b/src/views/plugin/workflow/process/claim.vue @@ -44,7 +44,10 @@ import { claimList as getList, claimTask, detail } from "@/api/plugin/workflow/process"; import { mapGetters } from "vuex"; +import exForm from '../mixins/ex-form' + export default { + mixins: [exForm], data() { return { form: {}, @@ -144,7 +147,7 @@ export default { }, methods: { handleClaim(row) { - this.$confirm('确定要签收此任务吗?签收成功后会进入代办事宜。', '提示', { + this.$confirm('确定要签收此任务吗?签收成功后会进入待办事宜。', '提示', { type: 'warning' }).then(() => { claimTask({ taskId: row.taskId }).then(() => { diff --git a/src/views/plugin/workflow/process/components/button.vue b/src/views/plugin/workflow/process/components/button.vue index 55f7ef9..4250efc 100644 --- a/src/views/plugin/workflow/process/components/button.vue +++ b/src/views/plugin/workflow/process/components/button.vue @@ -4,42 +4,42 @@ - 通过 - 驳回 - 转办 - 委托 - 打印 - 指定回退 - 终止 - @@ -94,6 +95,7 @@ export default { data() { return { activeName: 'first', + defaults: {}, form: {}, option: {}, vars: [], // 需要提交的字段 diff --git a/src/views/plugin/workflow/process/components/form.vue b/src/views/plugin/workflow/process/components/form.vue index cc6aec9..08b75df 100644 --- a/src/views/plugin/workflow/process/components/form.vue +++ b/src/views/plugin/workflow/process/components/form.vue @@ -9,6 +9,7 @@ v-model="form" ref="form" :option="option" + :defaults.sync="defaults" @submit="handleSubmit" @error="loading = false" :upload-preview="handleUploadPreview"> @@ -79,6 +80,7 @@ export default { }, data() { return { + defaults: {}, form: {}, option: {}, process: {}, diff --git a/src/views/plugin/workflow/process/start.vue b/src/views/plugin/workflow/process/start.vue index 1535ed5..e946e73 100644 --- a/src/views/plugin/workflow/process/start.vue +++ b/src/views/plugin/workflow/process/start.vue @@ -12,6 +12,13 @@ @current-change="currentChange" @size-change="sizeChange" @on-load="onLoad"> +