diff --git a/src/utils/formBuilder.js b/src/utils/formBuilder.js index 468bfd7..f5db7c0 100644 --- a/src/utils/formBuilder.js +++ b/src/utils/formBuilder.js @@ -8,6 +8,16 @@ import { flowList } from "@/api/flow"; import MobilePicker from '@/components/MobilePicker/index.vue'; import MobileMultipleSelect from "@/components/MobileMultipleSelect/index.vue"; import { Message } from 'element-ui' +function isJSON(str) { + if (typeof str !== 'string') return false; + try { + const result = JSON.parse(str); + const type = Object.prototype.toString.call(result); + return type === '[object Object]' || type === '[object Array]'; + } catch (e) { + return false; + } +} /** * @param {String} device 'desktop' | 'mobile' * @param {Object} info field参数 @@ -428,12 +438,17 @@ export default function formBuilder( break; case "relation-flow": if (!this.flows[info.name]) { + let extraParam = {} + if (isJSON(info.stub)) { + extraParam = JSON.parse(info.stub) + } flowList("all", { page: 1, page_size: 9999, is_simple: 1, - custom_model_id: info.stub, + custom_model_id: isJSON(info.stub) ? '' : info.stub, is_auth: 1, + ...extraParam }).then((res) => { this.$set(this.flows, info.name, res.data.data); }); @@ -441,6 +456,7 @@ export default function formBuilder( formItem = h( "el-select", { + ref: `relation-flow-${info.name}`, props: { value: target[info.name] ? target[info.name] @@ -484,13 +500,42 @@ export default function formBuilder( h("div", { }, [ h("span", {},option.title), - h("span", { + h("el-button", { style: { - color: '#999', - float: 'right', - 'font-size': '12px' + float: 'right' + }, + props: { + type: 'primary', + size: 'mini', + icon: 'el-icon-search' + }, + on: { + click: e => { + e.stopPropagation() + let target = this.$router.resolve({ + path: "/flow/detail", + query: { + module_id: option.custom_model_id, + flow_id: option.id, + isSinglePage: 1, + }, + }); + this.modalRender = (h) => + h("iframe", { + attrs: { + src: target.href, + }, + style: { + border: "none", + width: "100%", + height: "100%", + }, + }); + this.isShowModal = true; + this.$refs[`relation-flow-${info.name}`]?.blur() + } } - },option.no) + }, '查看') ]) ]) ) @@ -728,12 +773,17 @@ export default function formBuilder( break; case "relation-flow": if (!this.flows[info.name]) { + let extraParam = {} + if (isJSON(info.stub)) { + extraParam = JSON.parse(info.stub) + } flowList("all", { page: 1, page_size: 9999, is_simple: 1, - custom_model_id: info.stub, + custom_model_id: isJSON(info.stub) ? '' : info.stub, is_auth: 1, + ...extraParam }).then((res) => { this.$set(this.flows, info.name, res.data.data); }); @@ -1356,12 +1406,17 @@ export default function formBuilder( break; case "relation-flow": if (!this.flows[info.name]) { + let extraParam = {} + if (isJSON(info.stub)) { + extraParam = JSON.parse(info.stub) + } flowList("all", { page: 1, page_size: 9999, is_simple: 1, - custom_model_id: info.stub, + custom_model_id: isJSON(info.stub) ? '' : info.stub, is_auth: 1, + ...extraParam }).then((res) => { this.$set(this.flows, info.name, res.data.data); }); @@ -1670,12 +1725,17 @@ export default function formBuilder( break; case "relation-flow": if (!this.flows[info.name]) { + let extraParam = {} + if (isJSON(info.stub)) { + extraParam = JSON.parse(info.stub) + } flowList("all", { page: 1, page_size: 9999, is_simple: 1, - custom_model_id: info.stub, + custom_model_id: isJSON(info.stub) ? '' : info.stub, is_auth: 1, + ...extraParam }).then((res) => { this.$set(this.flows, info.name, res.data.data); }); diff --git a/src/views/attendance/SignHandle.vue b/src/views/attendance/SignHandle.vue index a03dc3c..eb179cc 100644 --- a/src/views/attendance/SignHandle.vue +++ b/src/views/attendance/SignHandle.vue @@ -15,6 +15,30 @@ 搜索 补卡 + + + + - - - + + + + + - - - + + + + + + + + + - + @@ -53,12 +98,18 @@ import { userListNoAuth } from "@/api/common"; import { index } from '@/api/attendance'; import AddSign from "./components/AddSign.vue"; +import { deepCopy } from "@/utils"; +import { updateSign } from "@/api/attendance"; +import { getToken } from "@/utils/auth"; + export default { components: { AddSign }, data() { return { + action: `${process.env.VUE_APP_BASE_API}/api/oa/statistics/import-overtime`, + isShowAdd: false, select: { month: this.$moment().format('YYYY-MM'), @@ -70,6 +121,59 @@ export default { } }, methods: { + getToken, + uploadData() { + this.$refs.upload.submit(); + }, + uploadSuccess(response) { + console.log(response) + if (response.hasOwnProperty('errcode')) { + this.$message.error(response.errmsg) + } else { + this.$message.success(`已导入${response.total}条`) + this.getList(true) + } + }, + editRowEvent(row) { + if (!row.attendance.id) { + this.$message.warning("当前日期无打卡") + return + } + if (this.$refs['table']) { + this.$refs['table'].setEditRow(row) + } + }, + cancelRowEvent(row) { + if (this.$refs['table']) { + this.$refs['table'].clearEdit().then(() => { + // 还原行数据 + this.$refs['table'].revertData(row) + }) + } + }, + async saveRowEvent(row) { + try { + await this.$confirm('确认保存?', '提示', { + confirmButtonText: '确认', + cancelButtonText: '取消' + }) + await this.$refs['table'].clearEdit() + console.log(row) + this.loading = true + await updateSign({ + user_id: this.select.user_id, + date: row.date, + sign_in_at: row.attendance.sign_in_at, + sign_out_at: row.attendance.sign_out_at, + status: row.attendance.status + }) + await this.getList() + this.loading = false + } catch (err) { + this.loading = false + } + }, + async getUsers () { try { const res = await userListNoAuth({ @@ -93,6 +197,13 @@ export default { } }, computed: { + isActiveStatus() { + return function(row) { + if (this.$refs['table']) { + return this.$refs['table'].isEditByRow(row) + } + } + } }, created() { this.getUsers() diff --git a/src/views/flow/DesktopForm.vue b/src/views/flow/DesktopForm.vue index 6d1b5e0..aa833cb 100644 --- a/src/views/flow/DesktopForm.vue +++ b/src/views/flow/DesktopForm.vue @@ -1,7 +1,7 @@ + + diff --git a/src/views/flow/components/rollback.vue b/src/views/flow/components/rollback.vue index 93e8914..46cf667 100644 --- a/src/views/flow/components/rollback.vue +++ b/src/views/flow/components/rollback.vue @@ -27,7 +27,7 @@ -

请输入退回原因:

+

* 请输入退回原因:

@@ -84,6 +84,10 @@ export default { this.$message.warning("请选择退回步骤!") return } + if(!this.form.reason) { + this.$message.warning("请填写退回原因!") + return + } try { this.form.id = this.flow.id; const res = await rollback(this.form) diff --git a/src/views/flow/create.vue b/src/views/flow/create.vue index ce0af0d..0ff5660 100644 --- a/src/views/flow/create.vue +++ b/src/views/flow/create.vue @@ -14,37 +14,38 @@