Browse Source

门类流程管理

master
xuhuajiao 11 months ago
parent
commit
5262b4fe39
  1. 28
      src/api/system/category/process.js
  2. 2
      src/store/modules/api.js
  3. 116
      src/views/system/archivesCategory/processManage/index.vue
  4. 114
      src/views/system/archivesCategory/processManage/module/form.vue
  5. 3
      src/views/system/processManage/processDeployment/index.vue

28
src/api/system/category/process.js

@ -18,4 +18,30 @@ export function FetchInitFlowByCategoryId(params) {
})
}
export default { FetchInitCategoryFlowBase, FetchInitFlowByCategoryId }
// 门类管理-更改流程管理状态
export function FetchChangeCategoryState(data) {
return request({
url: 'api/category/changeCategoryState',
method: 'post',
data
})
}
// 门类流程设计-工作流选择
export function FetchFlowbinding(data) {
return request({
url: 'api/category/flowbinding',
method: 'post',
data
})
}
// 根据门类id和流程基础id获取信息
export function FetchgetCategoryFlow(params) {
return request({
url: 'api/category/getCategoryFlow',
method: 'get',
params
})
}
export default { FetchInitCategoryFlowBase, FetchInitFlowByCategoryId, FetchChangeCategoryState, FetchFlowbinding, FetchgetCategoryFlow }

2
src/store/modules/api.js

@ -1,7 +1,5 @@
// 适配 Nginx 反向代理
const baseUrl = process.env.VUE_APP_BASE_API === '/' ? window.g.ApiUrl : process.env.VUE_APP_BASE_API
console.log(process.env.VUE_APP_BASE_API)
console.log('window.g.ApiUrl', window.g.ApiUrl)
const api = {
state: {
// 部署包上传

116
src/views/system/archivesCategory/processManage/index.vue

@ -2,45 +2,15 @@
<div class="process-container">
<div v-for="item in flowBaseList" :key="item.id" class="process-item">
<span>{{ item.name }}</span>
<p>01-归档审批流程<i class="iconfont icon-shezhi" @click="toProcessSelected()" /></p>
<el-switch v-model="manageEnable" class="isEnable-chapter" />
<p>{{ item.flowName }}<i class="iconfont icon-shezhi" @click="toProcessSelected(item)" /></p>
<el-switch v-model="item.status" class="isEnable-chapter" @change="changeCategoryState(item)" />
</div>
<!-- <div class="process-item">
<span>退接收库流程</span>
<p>02-退回审批流程<i class="iconfont icon-shezhi" /></p>
<el-switch v-model="returnEnable" class="isEnable-chapter" />
</div>
<div class="process-item">
<span>内部移交流程</span>
<p>03-内部移交流程<i class="iconfont icon-shezhi" /></p>
<el-switch v-model="insideEnable" class="isEnable-chapter" />
</div>
<div class="process-item">
<span>外部移交流程</span>
<p>04-外部移交流程<i class="iconfont icon-shezhi" /></p>
<el-switch v-model="externalEnable" class="isEnable-chapter" />
</div>
<div class="process-item">
<span>借阅审批流程</span>
<p>05-借阅审批流程<i class="iconfont icon-shezhi" /></p>
<el-switch v-model="borrowEnable" class="isEnable-chapter" />
</div>
<div class="process-item">
<span>销毁审批流程</span>
<p>06-销毁审批流程<i class="iconfont icon-shezhi" /></p>
<el-switch v-model="destroyEnable" class="isEnable-chapter" />
</div>
<div class="process-item">
<span>开放审批流程</span>
<p>07-开放审批流程<i class="iconfont icon-shezhi" /></p>
<el-switch v-model="developEnable" class="isEnable-chapter" />
</div> -->
<eForm ref="cuform" />
<eForm ref="cuform" :selected-category="selectedCategory" :edit-info-flow="editInfoFlow" @refresh="getInitCategoryFlowBase" />
</div>
</template>
<script>
import { FetchInitCategoryFlowBase, FetchInitFlowByCategoryId } from '@/api/system/category/process'
import { FetchInitCategoryFlowBase, FetchInitFlowByCategoryId, FetchChangeCategoryState, FetchgetCategoryFlow } from '@/api/system/category/process'
import eForm from './module/form'
export default {
name: 'ProcessManage',
@ -55,42 +25,94 @@ export default {
},
data() {
return {
manageEnable: true,
returnEnable: true,
insideEnable: true,
externalEnable: true,
borrowEnable: false,
destroyEnable: false,
developEnable: false,
flowBaseList: [],
flowSetting: []
flowSetting: [],
editInfoFlow: null
}
},
watch: {
},
mounted() {
this.getInitCategoryFlowBase()
this.getInitFlowByCategoryId()
},
methods: {
getInitCategoryFlowBase() {
FetchInitCategoryFlowBase().then((res) => {
console.log('1', res)
this.flowBaseList = res
this.flowBaseList = res.map(item => {
return {
...item,
status: false
}
})
this.getInitFlowByCategoryId()
}).catch(err => {
console.log(err)
})
},
getInitFlowByCategoryId() {
FetchInitFlowByCategoryId({ 'categoryId': this.selectedCategory.id }).then((res) => {
console.log('2', res)
this.flowSetting = res
this.flowBaseList.forEach(item => {
this.flowSetting.forEach(v => {
if (item.id === v.flowManageId) {
item.status = !!v.status
item.flowName = v.flowName
}
})
})
}).catch(err => {
console.log(err)
})
},
toProcessSelected() {
toProcessSelected(item) {
const params = {
'categoryId': this.selectedCategory.id,
'manageId': item.id
}
FetchgetCategoryFlow(params).then((res) => {
if (res) {
// null
if (this.allValuesNull(res)) {
// console.log(' null')
this.editInfoFlow = null
} else {
// console.log(' null')
this.editInfoFlow = res
}
} else {
this.editInfoFlow = null
this.$message({ message: '数据请求失败', type: 'error', offset: 8 })
}
}).catch(err => {
console.log(err)
})
this.$refs.cuform.cuDialogVisible = true
this.$refs.cuform.setPocessCurrent = item
},
changeCategoryState(item) {
const filterItem = this.flowSetting.find(v => item.id === v.flowManageId)
const params = {
'categoryId': this.selectedCategory.id,
'id': filterItem.id,
'status': item.status ? 1 : 0
}
FetchChangeCategoryState(params).then((res) => {
if (res === 'SUCCESS') {
this.$message({ message: '操作成功', type: 'success', offset: 8 })
} else {
this.$message({ message: '操作失败', type: 'error', offset: 8 })
}
}).catch(err => {
console.log(err)
})
},
allValuesNull(jsonObject) {
for (const key in jsonObject) {
if (jsonObject[key] !== null) {
return false
}
}
return true
}
}
}

114
src/views/system/archivesCategory/processManage/module/form.vue

@ -3,18 +3,18 @@
<div class="setting-dialog">
<el-form ref="form" class="process-form" inline :model="form" :rules="rules" size="small" label-width="80px">
<div class="process-template">
<el-form-item label="流程模板" prop="modelId">
<el-form-item label="流程模板" prop="model">
<el-select
v-model="form.modelId"
v-model="form.model"
placeholder="请选择"
style="width: 580px;"
:value-key="'label'"
value-key="modelId"
@change="selectModel"
>
<el-option
v-for="item in modelOptions"
:key="item.value"
:label="item.label"
:key="item.modelId"
:label="item.deployName"
:value="item"
/>
</el-select>
@ -29,7 +29,7 @@
<div v-for="(task,index) in taskList" :key="index" class="task-item">
<p>任务{{ index+1 }} {{ task.nodeName }}</p>
<el-form-item label="执行岗位" :prop="`task${index+1}`" :rules="dynamicRules(index)">
<el-select v-model="form[`task${index+1}`]" @change="selectJob($event,index)">
<el-select v-model="form[`task${index+1}`]" value-key="id" @change="selectJob($event,index)">
<el-option v-for="item in jobOptions" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
@ -56,14 +56,30 @@
<script>
import { FetchInitFlowAll, FetchFindFolwImgByModelId, FetchUserTaskAllByDeployId } from '@/api/system/flowable'
import { FetchPostAll, FetchFindUserByPost } from '@/api/system/job'
import { FetchFlowbinding } from '@/api/system/category/process'
export default {
props: {
selectedCategory: {
type: Object,
default: function() {
return {}
}
},
editInfoFlow: {
type: Object,
default: function() {
return {}
}
}
},
data() {
return {
cuDialogVisible: false,
loading: false,
loadingImg: false,
form: {
modelId: null
model: null
},
modelOptions: [],
srcImg: '',
@ -75,12 +91,14 @@ export default {
}
],
rules: {
modelId: [
model: [
{ required: true, message: '流程模板不可为空', trigger: 'change' }
]
},
userTableData: [],
taskList: []
taskList: [],
selectFlowVal: null,
setPocessCurrent: null
}
},
computed: {
@ -94,26 +112,43 @@ export default {
}
}
},
watch: {
editInfoFlow: function(n, oldValue) {
if (n) {
const findItem = this.findIdByModelId(n.flowId)
this.form.model = findItem
this.selectModel(findItem)
n.categoryFlowDetails.forEach((item, index) => {
this.$set(this.form, `task${index + 1}`, item.postId)
this.$nextTick(() => {
this.selectJob(item.postId, index)
})
})
}
}
},
mounted() {
this.getAllFlowable()
this.getAllJob()
},
methods: {
findIdByModelId(modelId) {
const item = this.modelOptions.find(data => data.modelId === modelId)
if (item) {
return item
} else {
return null
}
},
getAllFlowable() {
FetchInitFlowAll().then((res) => {
this.modelOptions = res.map(item => {
const json = {}
json.procdefId = item.procdefId
json.deployId = item.deployId
json.value = item.modelKey
json.label = item.deployName
return json
})
this.modelOptions = res
}).catch(err => {
console.log(err)
})
},
selectModel(val) {
this.selectFlowVal = val
this.loadingImg = true
FetchFindFolwImgByModelId({ 'processDefinitionId': val.procdefId }).then((res) => {
this.srcImg = 'data:image/jpeg;base64,' + res
@ -121,16 +156,15 @@ export default {
}).catch(err => {
console.log(err)
})
console.log(val)
FetchUserTaskAllByDeployId({ 'deployId': val.deployId }).then((res) => {
this.taskList = res.map(item => {
return {
...item,
isExpend: false,
userTableData: []
userTableData: [],
postId: null
}
})
console.log(this.taskList)
}).catch(err => {
console.log(err)
})
@ -148,20 +182,51 @@ export default {
})
},
selectJob(val, index) {
this.$forceUpdate()
FetchFindUserByPost({ 'postId': val }).then((res) => {
this.taskList.forEach((item, i) => {
if (index === i) { item.userTableData = res }
if (index === i) {
item.postId = val
item.userTableData = res
}
})
}).catch(err => {
console.log(err)
})
},
save() {
// this.loading = true
this.loading = true
this.$refs['form'].validate((valid) => {
console.log(this.form)
if (valid) {
// this.loading = false
const detailsDTOs = this.taskList.map((item, index) => {
const json = {}
json.id = this.editInfoFlow && this.editInfoFlow.categoryFlowDetails.length !== 0 ? this.editInfoFlow.categoryFlowDetails[index].id : null
json.postId = item.postId
json.taskId = item.nodeId
return json
})
const params = {
'categoryId': this.selectedCategory.id,
'detailsDTOs': detailsDTOs,
'flowId': this.selectFlowVal.modelId,
'flowName': this.selectFlowVal.deployName,
'flowKey': this.selectFlowVal.modelKey,
'flowManageId': this.setPocessCurrent.id,
'id': this.editInfoFlow && this.editInfoFlow.id,
'status': this.editInfoFlow && this.editInfoFlow.status
}
FetchFlowbinding(params).then((res) => {
if (res === 'SUCCESS') {
this.$message({ message: '操作成功', type: 'success', offset: 8 })
} else {
this.$message({ message: '操作失败', type: 'error', offset: 8 })
}
this.handleCloseDialog()
this.$emit('refresh')
this.loading = false
}).catch(err => {
console.log(err)
})
} else {
return false
}
@ -172,6 +237,7 @@ export default {
this.$refs.form.resetFields()
this.srcImg = ''
this.taskList = []
this.form = {}
this.cuDialogVisible = false
}
}

3
src/views/system/processManage/processDeployment/index.vue

@ -325,7 +325,8 @@ export default {
overflow: hidden;
& img{
display: block;
width: 100%;
// width: 100%;
// height: 100%;
}
}
}

Loading…
Cancel
Save