|
|
@ -1,16 +1,16 @@ |
|
|
<template> |
|
|
<template> |
|
|
<div class="process-container"> |
|
|
<div class="process-container"> |
|
|
<div v-for="item in filteredFlowList" :key="item.id" class="process-item"> |
|
|
|
|
|
<span>{{ item.name }}</span> |
|
|
|
|
|
|
|
|
<div v-for="item in flowSetting" :key="item.id" class="process-item"> |
|
|
|
|
|
<span>{{ item.flowName.split('-')[1] }}</span> |
|
|
<p>{{ item.flowName }}<i class="iconfont icon-shezhi" @click="toProcessSelected(item)" /></p> |
|
|
<p>{{ item.flowName }}<i class="iconfont icon-shezhi" @click="toProcessSelected(item)" /></p> |
|
|
<el-switch v-model="item.status" class="isEnable-chapter" @change="changeCategoryState(item)" /> |
|
|
<el-switch v-model="item.status" class="isEnable-chapter" @change="changeCategoryState(item)" /> |
|
|
</div> |
|
|
</div> |
|
|
<eForm ref="cuform" :selected-category="selectedCategory" :edit-info-flow="editInfoFlow" @refresh="getInitCategoryFlowBase" /> |
|
|
|
|
|
|
|
|
<eForm ref="cuform" :selected-category="selectedCategory" :edit-info-flow="editInfoFlow" @refresh="getReDocumentInitFlowByCategoryId" /> |
|
|
</div> |
|
|
</div> |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
<script> |
|
|
<script> |
|
|
import { FetchInitCategoryFlowBase, FetchInitFlowByCategoryId, FetchChangeCategoryState, FetchgetCategoryFlow } from '@/api/system/category/process' |
|
|
|
|
|
|
|
|
import { FetchReDocumentInitFlowByCategoryId, FetchReDocumentChangeCategoryState } from '@/api/system/category/process' |
|
|
import eForm from './module/form' |
|
|
import eForm from './module/form' |
|
|
export default { |
|
|
export default { |
|
|
name: 'ProcessManage', |
|
|
name: 'ProcessManage', |
|
|
@ -25,93 +25,50 @@ export default { |
|
|
}, |
|
|
}, |
|
|
data() { |
|
|
data() { |
|
|
return { |
|
|
return { |
|
|
flowBaseList: [], |
|
|
|
|
|
flowSetting: [], |
|
|
flowSetting: [], |
|
|
editInfoFlow: null |
|
|
editInfoFlow: null |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
computed: { |
|
|
|
|
|
filteredFlowList() { |
|
|
|
|
|
if (this.selectedCategory.pid === '0' && this.selectedCategory.isType === 1) { |
|
|
|
|
|
return this.flowBaseList.filter(item => item.id === '5') |
|
|
|
|
|
} else { |
|
|
|
|
|
return this.flowBaseList.filter(item => item.id !== '5') |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
watch: { |
|
|
|
|
|
}, |
|
|
|
|
|
mounted() { |
|
|
mounted() { |
|
|
this.getInitCategoryFlowBase() |
|
|
|
|
|
|
|
|
this.getReDocumentInitFlowByCategoryId() |
|
|
}, |
|
|
}, |
|
|
methods: { |
|
|
methods: { |
|
|
getInitCategoryFlowBase() { |
|
|
|
|
|
FetchInitCategoryFlowBase().then((res) => { |
|
|
|
|
|
this.flowBaseList = res.map(item => { |
|
|
|
|
|
|
|
|
getReDocumentInitFlowByCategoryId() { |
|
|
|
|
|
FetchReDocumentInitFlowByCategoryId({ 'documentId': this.selectedCategory.pid !== '0' ? this.selectedCategory.id : null }).then((res) => { |
|
|
|
|
|
this.flowSetting = res.map(item => { |
|
|
return { |
|
|
return { |
|
|
...item, |
|
|
...item, |
|
|
status: false |
|
|
|
|
|
|
|
|
status: !!item.status |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
this.getInitFlowByCategoryId() |
|
|
|
|
|
}).catch(err => { |
|
|
|
|
|
console.log(err) |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
getInitFlowByCategoryId() { |
|
|
|
|
|
console.log(this.selectedCategory) |
|
|
|
|
|
FetchInitFlowByCategoryId({ 'categoryId': this.selectedCategory.pid !== '0' ? this.selectedCategory.id : null }).then((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 |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// 回显到表单 |
|
|
|
|
|
if (this.flowSetting.length > 0) { |
|
|
|
|
|
this.editInfoFlow = this.flowSetting[0] |
|
|
|
|
|
this.$nextTick(() => { |
|
|
|
|
|
this.$refs.cuform.getEditInfoFlow = this.editInfoFlow |
|
|
|
|
|
this.$refs.cuform.handleEditInfoFlow(this.editInfoFlow) |
|
|
}) |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
} |
|
|
}).catch(err => { |
|
|
}).catch(err => { |
|
|
console.log(err) |
|
|
console.log(err) |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
toProcessSelected(item) { |
|
|
toProcessSelected(item) { |
|
|
const params = { |
|
|
|
|
|
'categoryId': this.selectedCategory.pid !== '0' ? this.selectedCategory.id : null, |
|
|
|
|
|
'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 }) |
|
|
|
|
|
} |
|
|
|
|
|
console.log('this.editInfoFlow', this.editInfoFlow) |
|
|
|
|
|
this.$nextTick(() => { |
|
|
|
|
|
this.$refs.cuform.cuDialogVisible = true |
|
|
|
|
|
this.$refs.cuform.setPocessCurrent = item |
|
|
|
|
|
this.$refs.cuform.getEditInfoFlow = this.editInfoFlow ? this.editInfoFlow : {} |
|
|
|
|
|
this.$refs.cuform.handleEditInfoFlow(this.editInfoFlow) |
|
|
|
|
|
}) |
|
|
|
|
|
}).catch(err => { |
|
|
|
|
|
console.log(err) |
|
|
|
|
|
|
|
|
this.editInfoFlow = item |
|
|
|
|
|
this.$nextTick(() => { |
|
|
|
|
|
this.$refs.cuform.cuDialogVisible = true |
|
|
|
|
|
this.$refs.cuform.setPocessCurrent = item |
|
|
|
|
|
this.$refs.cuform.getEditInfoFlow = this.editInfoFlow ? this.editInfoFlow : {} |
|
|
|
|
|
this.$refs.cuform.handleEditInfoFlow(this.editInfoFlow) |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
changeCategoryState(item) { |
|
|
changeCategoryState(item) { |
|
|
const filterItem = this.flowSetting.find(v => item.id === v.flowManageId) |
|
|
|
|
|
const params = { |
|
|
const params = { |
|
|
'categoryId': this.selectedCategory.id, |
|
|
'categoryId': this.selectedCategory.id, |
|
|
'id': filterItem.id, |
|
|
|
|
|
|
|
|
'id': item.id, |
|
|
'status': item.status ? 1 : 0 |
|
|
'status': item.status ? 1 : 0 |
|
|
} |
|
|
} |
|
|
FetchChangeCategoryState(params).then((res) => { |
|
|
|
|
|
|
|
|
FetchReDocumentChangeCategoryState(params).then((res) => { |
|
|
if (res === 'SUCCESS') { |
|
|
if (res === 'SUCCESS') { |
|
|
this.$message({ message: '操作成功', type: 'success', offset: 8 }) |
|
|
this.$message({ message: '操作成功', type: 'success', offset: 8 }) |
|
|
} else { |
|
|
} else { |
|
|
@ -120,14 +77,6 @@ export default { |
|
|
}).catch(err => { |
|
|
}).catch(err => { |
|
|
console.log(err) |
|
|
console.log(err) |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
|
|
|
allValuesNull(jsonObject) { |
|
|
|
|
|
for (const key in jsonObject) { |
|
|
|
|
|
if (jsonObject[key] !== null) { |
|
|
|
|
|
return false |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
return true |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|