新增事务功能

pull/59/head
smallchill 7 years ago
parent c7e48d2706
commit b10d0e148a
  1. 34
      src/api/work/process.js
  2. 4
      src/page/index/index.vue
  3. 6
      src/router/views/index.js
  4. 3
      src/store/getters.js
  5. 4
      src/store/index.js
  6. 1
      src/store/modules/common.js
  7. 36
      src/store/modules/dict.js
  8. 2
      src/store/modules/logs.js
  9. 6
      src/store/modules/tags.js
  10. 92
      src/util/func.js
  11. 7
      src/views/work/claim.vue
  12. 7
      src/views/work/done.vue
  13. 23
      src/views/work/process/leave/form.vue
  14. 7
      src/views/work/send.vue
  15. 12
      src/views/work/start.vue
  16. 7
      src/views/work/todo.vue

@ -0,0 +1,34 @@
import request from '@/router/axios';
// =====================参数===========================
export const historyFlowList = (current, size, params) => {
return request({
url: '/api/blade-flow/process/history-flow-list',
method: 'get',
params: {
...params,
current,
size,
}
})
}
// =====================请假流程===========================
export const leaveProcess = (data) => {
return request({
url: '/api/blade-desk/process/leave/start-process',
method: 'post',
data
})
}
export const leaveDetail = (params) => {
return request({
url: '/api/blade-desk/process/leave/detail',
method: 'get',
params
})
}

@ -74,7 +74,7 @@
showCollapse() {
this.$store.commit("SET_COLLAPSE");
},
//
//
init() {
this.$store.commit("SET_SCREEN", admin.getScreen());
window.onresize = () => {
@ -82,6 +82,8 @@
this.$store.commit("SET_SCREEN", admin.getScreen());
}, 0);
};
this.$store.dispatch("FlowRoutes").then(() => {
});
},
// token
refreshToken() {

@ -44,7 +44,7 @@ export default [{
component: Layout,
redirect: '/work/process/leave/form',
children: [{
path: 'form',
path: 'form/:processDefinitionId',
name: '请假流程',
meta: {
i18n: 'work'
@ -52,7 +52,7 @@ export default [{
component: () =>
import( /* webpackChunkName: "views" */ '@/views/work/process/leave/form')
}, {
path: 'handle',
path: 'handle/:taskId/:processInstanceId/:businessId',
name: '处理请假流程',
meta: {
i18n: 'work'
@ -60,7 +60,7 @@ export default [{
component: () =>
import( /* webpackChunkName: "views" */ '@/views/work/process/leave/handle')
}, {
path: 'detail',
path: 'detail/:processInstanceId/:businessId',
name: '请假流程详情',
meta: {
i18n: 'work'

@ -21,6 +21,7 @@ const getters = {
menuAll: state => state.user.menuAll,
logsList: state => state.logs.logsList,
logsLen: state => state.logs.logsList.length || 0,
logsFlag: (state, getters) => getters.logsLen === 0
logsFlag: (state, getters) => getters.logsLen === 0,
flowRoutes: state => state.dict.flowRoutes,
}
export default getters

@ -4,6 +4,7 @@ import user from './modules/user'
import common from './modules/common'
import tags from './modules/tags'
import logs from './modules/logs'
import dict from './modules/dict'
import getters from './getters'
Vue.use(Vuex)
@ -12,7 +13,8 @@ const store = new Vuex.Store({
user,
common,
logs,
tags
tags,
dict
},
getters,
})

@ -4,6 +4,7 @@ import {
removeStore
} from '@/util/store'
import website from '@/config/website'
const common = {
state: {

@ -0,0 +1,36 @@
import {getStore, setStore} from '@/util/store'
import {getDictionary} from '@/api/system/dict'
const dict = {
state: {
flowRoutes: getStore({name: 'flowRoutes'}) || {},
},
actions: {
//发送错误日志
FlowRoutes({commit}) {
return new Promise((resolve, reject) => {
getDictionary({code: 'flow'}).then(res => {
commit('SET_FLOW_ROUTES', res.data.data);
resolve();
}).catch(error => {
reject(error)
})
})
},
},
mutations: {
SET_FLOW_ROUTES: (state, data) => {
state.flowRoutes = data.map(item => {
return {
routeKey: `${item.code}_${item.dictKey}`,
routeValue: item.remark,
};
});
setStore({name: 'flowRoutes', content: state.flowRoutes, type: 'session'})
},
}
};
export default dict;

@ -1,12 +1,12 @@
import {setStore, getStore} from '@/util/store'
import {dateFormat} from '@/util/date'
import {sendLogs} from '@/api/user'
const logs = {
state: {
logsList: getStore({name: 'logsList'}) || [],
},
actions: {
//发送错误日志
SendLogs({state, commit}) {
return new Promise((resolve, reject) => {
sendLogs(state.logsList).then(() => {

@ -1,6 +1,7 @@
import {setStore, getStore} from '@/util/store'
import {diff} from '@/util/util'
import website from '@/config/website'
const isFirstPage = website.isFirstPage;
const tagWel = website.fistPage;
const tagObj = {
@ -11,6 +12,7 @@ const tagObj = {
meta: {},//额外参数
group: [], //分组
}
//处理首个标签
function setFistTag(list) {
if (list.length == 1) {
@ -33,9 +35,7 @@ const navs = {
tag: getStore({name: 'tag'}) || tagObj,
tagWel: tagWel
},
actions: {
},
actions: {},
mutations: {
ADD_TAG: (state, action) => {
state.tag = action;

@ -0,0 +1,92 @@
/**
* 不为空
* @param val
* @returns {boolean}
*/
export function notEmpty(val) {
return !this.isEmpty(val);
}
/**
* 为空
* @param val
* @returns {boolean}
*/
export function isEmpty(val) {
if (
val === null ||
typeof val === 'undefined' ||
(typeof val === 'string' && val === '' && val !== 'undefined')
) {
return true;
}
return false;
}
/**
* 强转int型
* @param val
* @param defaultValue
* @returns {number}
*/
export function toInt(val, defaultValue) {
if (this.isEmpty(val)) {
return defaultValue === undefined ? -1 : defaultValue;
}
const num = parseInt(val, 0);
return Number.isNaN(num) ? (defaultValue === undefined ? -1 : defaultValue) : num;
}
/**
* Json强转为Form类型
* @param obj
* @returns {FormData}
*/
export function toFormData(obj) {
const data = new FormData();
Object.keys(obj).forEach(key => {
data.append(key, Array.isArray(obj[key]) ? obj[key].join(',') : obj[key]);
});
return data;
}
/**
* date类转为字符串格式
* @param date
* @param format
* @returns {null}
*/
export function format(date, format = 'YYYY-MM-DD HH:mm:ss') {
return date ? date.format(format) : null;
}
/**
* 根据逗号联合
* @param arr
* @returns {string}
*/
export function join(arr) {
return arr ? arr.join(',') : '';
}
/**
* 根据逗号分隔
* @param str
* @returns {string}
*/
export function split(str) {
return str ? String(str).split(',') : '';
}
/**
* 根据key获取流程路由
* @param routes
* @param key
*/
export function getFlowRoute(routes, key) {
const data = routes.filter(d => {
return d.routeKey === key;
});
return data.length === 0 ? [] : data[0].routeValue;
}

@ -61,8 +61,9 @@
</template>
<script>
import {claimList} from "@/api/work/work";
import {mapGetters} from "vuex";
import {claimList} from "@/api/work/work";
import {getFlowRoute} from "@/util/func";
export default {
data() {
@ -127,7 +128,7 @@
};
},
computed: {
...mapGetters(["permission"]),
...mapGetters(["permission", "flowRoutes"]),
ids() {
let ids = [];
this.selectionList.forEach(ele => {
@ -150,7 +151,7 @@
},
handleDetail(row) {
this.$router.push({path: `/work/process/${this.routes[row.category]}/detail?processInstanceId=${row.processInstanceId}&businessId=${row.businessId}`});
this.$router.push({ path: `/work/process/${getFlowRoute(this.flowRoutes, row.category)}/detail/${row.processInstanceId}/${row.businessId}` });
},
handleImage(row) {
this.flowUrl = `/api/blade-flow/process/diagram-view?processInstanceId=${row.processInstanceId}`;

@ -54,8 +54,9 @@
</template>
<script>
import {doneList} from "@/api/work/work";
import {mapGetters} from "vuex";
import {doneList} from "@/api/work/work";
import {getFlowRoute} from "@/util/func";
export default {
data() {
@ -120,7 +121,7 @@
};
},
computed: {
...mapGetters(["permission"]),
...mapGetters(["permission", "flowRoutes"]),
ids() {
let ids = [];
this.selectionList.forEach(ele => {
@ -140,7 +141,7 @@
this.selectionList = list;
},
handleDetail(row) {
this.$router.push({path: `/work/process/${this.routes[row.category]}/detail?processInstanceId=${row.processInstanceId}&businessId=${row.businessId}`});
this.$router.push({ path: `/work/process/${getFlowRoute(this.flowRoutes, row.category)}/detail/${row.processInstanceId}/${row.businessId}` });
},
handleImage(row) {
this.flowUrl = `/api/blade-flow/process/diagram-view?processInstanceId=${row.processInstanceId}`;

@ -5,12 +5,12 @@
</template>
<script>
import {leaveProcess} from "@/api/work/process";
export default {
data() {
return {
form: {
},
form: {},
option: {
group: [
{
@ -40,6 +40,7 @@
label: '开始时间',
prop: 'startTime',
type: 'datetime',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
rules: [
{
required: true,
@ -52,6 +53,7 @@
label: '结束时间',
prop: 'endTime',
type: 'datetime',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
rules: [
{
required: true,
@ -81,7 +83,20 @@
},
methods: {
handleSubmit() {
this.$message.success('当前数据' + JSON.stringify(this.form))
const params = {
processDefinitionId: this.$route.params.processDefinitionId,
...this.form,
};
leaveProcess(params).then(resp => {
const data = resp.data;
if (data.success) {
this.$message.success(data.msg);
this.$router.$avueRouter.closeTag();
this.$router.push({path: `/work/start`});
} else {
this.$message.error(data.msg || '提交失败');
}
});
}
}
}

@ -58,8 +58,9 @@
</template>
<script>
import {sendList} from "@/api/work/work";
import {mapGetters} from "vuex";
import {sendList} from "@/api/work/work";
import {getFlowRoute} from "@/util/func";
export default {
data() {
@ -129,7 +130,7 @@
};
},
computed: {
...mapGetters(["permission"]),
...mapGetters(["permission", "flowRoutes"]),
ids() {
let ids = [];
this.selectionList.forEach(ele => {
@ -149,7 +150,7 @@
this.selectionList = list;
},
handleDetail(row) {
this.$router.push({path: `/work/process/${this.routes[row.category]}/detail?processInstanceId=${row.processInstanceId}&businessId=${row.businessId}`});
this.$router.push({ path: `/work/process/${getFlowRoute(this.flowRoutes, row.category)}/detail/${row.processInstanceId}/${row.businessId}` });
},
handleImage(row) {
this.flowUrl = `/api/blade-flow/process/diagram-view?processInstanceId=${row.processInstanceId}`;

@ -62,16 +62,13 @@
</template>
<script>
import {startList} from "@/api/work/work";
import {mapGetters} from "vuex";
import {startList} from "@/api/work/work";
import {getFlowRoute} from "@/util/func";
export default {
data() {
return {
routes: {
flow_1: 'leave',
flow_2: 'expense',
},
form: {},
selectionId: '',
selectionList: [],
@ -136,7 +133,7 @@
};
},
computed: {
...mapGetters(["permission"]),
...mapGetters(["permission", "flowRoutes"]),
ids() {
let ids = [];
this.selectionList.forEach(ele => {
@ -156,7 +153,8 @@
this.selectionList = list;
},
handleStart(row) {
this.$router.push({ path: `/work/process/${this.routes[row.category]}/form?id=${row.id}` });
console.log(this.flowRoutes)
this.$router.push({path: `/work/process/${getFlowRoute(this.flowRoutes, row.category)}/form/${row.id}`});
},
handleImage(row) {
this.flowUrl = `/api/blade-flow/process/resource-view?processDefinitionId=${row.id}`;

@ -61,8 +61,9 @@
</template>
<script>
import {todoList} from "@/api/work/work";
import {mapGetters} from "vuex";
import {todoList} from "@/api/work/work";
import {getFlowRoute} from "@/util/func";
export default {
data() {
@ -127,7 +128,7 @@
};
},
computed: {
...mapGetters(["permission"]),
...mapGetters(["permission", "flowRoutes"]),
ids() {
let ids = [];
this.selectionList.forEach(ele => {
@ -150,7 +151,7 @@
},
handleDetail(row) {
this.$router.push({ path: `/work/process/${this.routes[row.category]}/detail?processInstanceId=${row.processInstanceId}&businessId=${row.businessId}` });
this.$router.push({ path: `/work/process/${getFlowRoute(this.flowRoutes, row.category)}/detail/${row.processInstanceId}/${row.businessId}` });
},
handleImage(row) {
this.flowUrl = `/api/blade-flow/process/diagram-view?processInstanceId=${row.processInstanceId}`;

Loading…
Cancel
Save