|
@@ -8,50 +8,91 @@
|
|
|
<div class="body">
|
|
|
<div class="content">
|
|
|
<a-form ref="searchForm" layout="inline">
|
|
|
- <a-row :gutter="24" style="margin: 0;" class="rowList">
|
|
|
- <a-col :span="24" >
|
|
|
- <a-form-item
|
|
|
- style="font-weight: bold;"
|
|
|
- label="知识管理审核流程:"
|
|
|
- name="title"
|
|
|
- >
|
|
|
- </a-form-item>
|
|
|
- </a-col>
|
|
|
- </a-row>
|
|
|
- <a-row :gutter="24" style="margin: 0;" v-for="(item,index) in formData" :key="index" class="rowList">
|
|
|
- <a-col :span="6" >
|
|
|
- <a-form-item
|
|
|
- label="节点名称"
|
|
|
- name="title"
|
|
|
- >
|
|
|
- <a-input :disabled="item.isFinal == 1" v-model="item.name" placeholder="请输入"/>
|
|
|
- </a-form-item>
|
|
|
- </a-col>
|
|
|
- <a-col :span="6">
|
|
|
- <a-form-item
|
|
|
- label="审批人"
|
|
|
- name="createTime"
|
|
|
- >
|
|
|
- <div @click="handleShowAuditClick(index)">
|
|
|
- <a-select v-model="item.approverName" :showArrow="false" :open="false" placeholder="请选择组织部门授予知识访问权限"></a-select>
|
|
|
- </div>
|
|
|
- </a-form-item>
|
|
|
- </a-col>
|
|
|
- <a-col :span="6">
|
|
|
- <a-row :gutter="24" type="flex" justify="end">
|
|
|
- <a-button :style="{display: item.isFinal == 1 ? 'none':''}" @click="delRow(index)" shape="circle" icon="delete"></a-button>
|
|
|
- <a-button v-if="formData.length != (index + 1)||formData.length==1" type="primary" @click="addRow(index)" shape="circle" icon="plus"></a-button>
|
|
|
+ <a-tabs v-model="tabsKeys" size="large" :animated="false">
|
|
|
+ <a-button type="primary" slot="tabBarExtraContent" @click="handleAddFlowClick">
|
|
|
+ 添加流程
|
|
|
+ </a-button>
|
|
|
+ <a-tab-pane :tab="itez.flowerName" v-for="(itez,indez) in tabPaneList" :key="indez + 1">
|
|
|
+ <a-row v-if="indez != 0" :gutter="24" style="margin: 0;" class="rowList">
|
|
|
+ <a-col :span="12" >
|
|
|
+ <a-form-item
|
|
|
+ label="流程名称:"
|
|
|
+ name="flowerName"
|
|
|
+ >
|
|
|
+ <a-input v-model="itez.flowerName" placeholder="请输入"/>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
</a-row>
|
|
|
- </a-col>
|
|
|
- </a-row>
|
|
|
- <a-row :gutter="24" style="margin: 40px 0;" class="rowList">
|
|
|
- <a-col :span="6" :push="12">
|
|
|
- <a-row :gutter="24" type="flex" justify="end">
|
|
|
- <a-button @click="$router.back()">取消</a-button>
|
|
|
- <a-button type="primary" @click="handleSaveClick" :loading="saveLoading">保存</a-button>
|
|
|
- </a-row>
|
|
|
- </a-col>
|
|
|
- </a-row>
|
|
|
+ <a-row v-if="indez != 0" :gutter="24" style="margin: 0;" class="rowList">
|
|
|
+ <a-col :span="12" >
|
|
|
+ <a-form-item
|
|
|
+ label="关联分类:"
|
|
|
+ name="categoryId"
|
|
|
+ >
|
|
|
+ <!-- <a-cascader v-model="itez.categoryId"
|
|
|
+ class="set-input scroll-ckunk"
|
|
|
+ :popupStyle="{
|
|
|
+ maxWidth: widthVar + 'px',
|
|
|
+ 'overflow-x': 'auto'
|
|
|
+ }"
|
|
|
+ :getPopupContainer="triggerNode => { return triggerNode.parentNode }"
|
|
|
+ :options="classifyList"
|
|
|
+ :fieldNames="{ label: 'name', value: 'pkId', children: 'children' }"
|
|
|
+ placeholder="请选择"
|
|
|
+ changeOnSelect
|
|
|
+ @change="handleClassifyChange" /> -->
|
|
|
+ <a-tree-select
|
|
|
+ :replaceFields="{ key: 'pkId',title: 'name', value: 'pkId', children: 'children' }"
|
|
|
+ v-model="itez.categoryId"
|
|
|
+ style="width: 100%"
|
|
|
+ :tree-data="classifyList"
|
|
|
+ tree-checkable
|
|
|
+ :maxTagCount="10"
|
|
|
+ :treeCheckStrictly="true"
|
|
|
+ :show-checked-strategy="SHOW_All"
|
|
|
+ search-placeholder="请选择关联分类"
|
|
|
+ @select="selectTree"
|
|
|
+ />
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ </a-row>
|
|
|
+ <a-row :gutter="24" style="margin: 0;" v-for="(item,index) in itez.knowledgeApprovalNode" :key="index" class="rowList">
|
|
|
+ <a-col :span="6" >
|
|
|
+ <a-form-item
|
|
|
+ label="节点名称"
|
|
|
+ name="name"
|
|
|
+ >
|
|
|
+ <a-input :disabled="item.isFinal == 1" v-model="item.name" placeholder="请输入"/>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :span="6">
|
|
|
+ <a-form-item
|
|
|
+ label="审批人"
|
|
|
+ name="approverName"
|
|
|
+ >
|
|
|
+ <div @click="handleShowAuditClick(index,indez)">
|
|
|
+ <a-select v-model="item.approverName" :showArrow="false" :open="false" placeholder="请选择组织部门授予知识访问权限"></a-select>
|
|
|
+ </div>
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :span="6">
|
|
|
+ <a-row :gutter="24" type="flex" justify="start">
|
|
|
+ <a-button :style="{display: (item.isFinal == 1 || itez.knowledgeApprovalNode.length == 1) ? 'none' : ''}" @click="delRow(index,indez)" shape="circle" icon="delete"></a-button>
|
|
|
+ <a-button v-if="itez.knowledgeApprovalNode.length != (index + 1) || itez.knowledgeApprovalNode.length==1" type="primary" @click="addRow(index,indez)" shape="circle" icon="plus"></a-button>
|
|
|
+ </a-row>
|
|
|
+ </a-col>
|
|
|
+ </a-row>
|
|
|
+ <a-row :gutter="24" style="margin: 40px 0;" class="rowList">
|
|
|
+ <a-col :span="6" :push="12">
|
|
|
+ <a-row :gutter="24" type="flex" justify="end">
|
|
|
+ <a-button @click="$router.back()">取消</a-button>
|
|
|
+ <a-button v-if="indez != 0" style="margin-right:20px;" @click="handleDelFlowClick(itez.pkId,indez)">删除</a-button>
|
|
|
+ <a-button type="primary" @click="handleSaveClick" :loading="saveLoading">保存</a-button>
|
|
|
+ </a-row>
|
|
|
+ </a-col>
|
|
|
+ </a-row>
|
|
|
+ </a-tab-pane>
|
|
|
+ </a-tabs>
|
|
|
</a-form>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -71,9 +112,12 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import { TreeSelect } from 'ant-design-vue';
|
|
|
import breadcrumb from '../components/breadcrumb'
|
|
|
import orgPeople from './components/orgPeople'
|
|
|
import api from '@/api/knowledge/auditProcess'
|
|
|
+import classApi from '@/api/knowledge/classify'
|
|
|
+const SHOW_All = TreeSelect.SHOW_All;
|
|
|
export default {
|
|
|
name: 'auditProcessMaintain',
|
|
|
components: {
|
|
@@ -82,73 +126,185 @@ export default {
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
+ SHOW_All,
|
|
|
showAuditFlag: false,
|
|
|
api,
|
|
|
saveLoading: false,
|
|
|
+ classifyList: [],
|
|
|
+ classifyListArr: [],
|
|
|
tempDataIndex: '',
|
|
|
+ tempDataIndez: '',
|
|
|
formData:[],
|
|
|
approverData: {
|
|
|
approverId: '',
|
|
|
approverName: ''
|
|
|
- }
|
|
|
+ },
|
|
|
+ tabsKeys: 1,
|
|
|
+ tabPaneList: [
|
|
|
+ // {
|
|
|
+ // flowerName: '系统默认流程',
|
|
|
+ // categoryId: [],
|
|
|
+ // knowledgeApprovalNode: [
|
|
|
+ // {
|
|
|
+ // name: '',
|
|
|
+ // approverId: '',
|
|
|
+ // approverName: undefined,
|
|
|
+ // isFinal: 1
|
|
|
+ // }
|
|
|
+ // ]
|
|
|
+ // }
|
|
|
+ ]
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
- this.init()
|
|
|
+ this.init(true)
|
|
|
},
|
|
|
methods: {
|
|
|
- init() {
|
|
|
- let queryParam = {
|
|
|
- "pageNo": 1,
|
|
|
- "pageSize": 1000,
|
|
|
- "sortField": "",
|
|
|
- "sortOrder": "asc",
|
|
|
- "params": {}
|
|
|
+ async init(arg = false) {
|
|
|
+ if(arg) {
|
|
|
+ let res = await classApi.getAllByCategoryId()
|
|
|
+ this.classifyList = this.formatData(res.data.children)
|
|
|
+ // this.formatDataAddPstr(this.classifyList,"","")
|
|
|
}
|
|
|
- api.findAllApprovalNodes(queryParam).then(res => {
|
|
|
- this.formData = res.result.data.map(item => {
|
|
|
- return {
|
|
|
- name: item.name,
|
|
|
- approverId: item.approverId,
|
|
|
- approverName: item.approverName,
|
|
|
- isFinal: item.isFinal
|
|
|
+ let raw = await api.findAllNodes()
|
|
|
+ this.tabPaneList = raw.data.map(item => {
|
|
|
+ // console.log(item.category)
|
|
|
+ let categoryArr = []
|
|
|
+ for(let i=0;i<item.category.length;i++) {
|
|
|
+ categoryArr.push({
|
|
|
+ value:item.category[i],label:item.categoryName[i]
|
|
|
+ })
|
|
|
+ }
|
|
|
+ return {
|
|
|
+ pkId: item.pkId,
|
|
|
+ flowerName: item.flowerName,
|
|
|
+ categoryId: categoryArr,
|
|
|
+ knowledgeApprovalNode: item.knowledgeApprovalNode
|
|
|
+ }
|
|
|
+ })
|
|
|
+ // newData={value:element.pkId,label:element.name}
|
|
|
+ this.saveLoading = false
|
|
|
+ },
|
|
|
+ //格式化数据,递归将空的children置为undefined
|
|
|
+ formatData(data) {
|
|
|
+ const that = this
|
|
|
+ data.forEach((element) => {
|
|
|
+ if (element.children && element.children.length > 0) {
|
|
|
+ that.formatData(element.children)
|
|
|
+ } else {
|
|
|
+ delete element.children
|
|
|
+ }
|
|
|
+ })
|
|
|
+ return data
|
|
|
+ },
|
|
|
+ // formatDataAddPstr(data,base,pkId) {
|
|
|
+ // const that = this
|
|
|
+ // base = base+","+pkId+"&"
|
|
|
+ // data.forEach((element) => {
|
|
|
+ // element.Pstr = base
|
|
|
+ // this.classifyListArr.push(element)
|
|
|
+ // if (element.children && element.children.length > 0) {
|
|
|
+ // that.formatDataAddPstr(element.children,base,element.pkId)
|
|
|
+ // } else {
|
|
|
+ // delete element.children
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // return data
|
|
|
+ // },
|
|
|
+ selectTree(value, node, extra){
|
|
|
+ console.log(value.value)
|
|
|
+ console.log(this.classifyListArr)
|
|
|
+ let that=this
|
|
|
+ setTimeout(function(){
|
|
|
+ let childArr=that.classifyListArr.filter(item=>{
|
|
|
+ return item.Pstr.indexOf(','+value.value+"&")>-1
|
|
|
+ })
|
|
|
+ childArr.forEach((element) => {
|
|
|
+ let isHave=that.tabPaneList[that.tabsKeys-1].categoryId.filter(item0=>{return item0.value==element.pkId})
|
|
|
+ if(isHave.length==0){
|
|
|
+ let newData={value:element.pkId,label:element.name}
|
|
|
+ that.tabPaneList[that.tabsKeys-1].categoryId.push(newData)
|
|
|
}
|
|
|
})
|
|
|
- this.saveLoading = false
|
|
|
- })
|
|
|
+ },200)
|
|
|
},
|
|
|
async handleSaveClick() {
|
|
|
- console.log(this.formData)
|
|
|
- for(let i of this.formData) {
|
|
|
+ // 判断流程名是否重复
|
|
|
+ if(this.tabPaneList.filter(item => item.flowerName == this.tabPaneList[this.tabsKeys-1].flowerName).length > 1) {
|
|
|
+ this.$message.error("流程名称重复");
|
|
|
+ return
|
|
|
+ }
|
|
|
+ // 判断信息是否填全
|
|
|
+ for(let i of this.tabPaneList[this.tabsKeys-1].knowledgeApprovalNode) {
|
|
|
if(!i.name || !i.approverId) {
|
|
|
- console.log(i)
|
|
|
this.$message.error("请将信息填全");
|
|
|
return
|
|
|
}
|
|
|
}
|
|
|
+ if(this.tabPaneList[this.tabsKeys-1].categoryId && this.tabPaneList[this.tabsKeys-1].categoryId.length) {
|
|
|
+ this.tabPaneList[this.tabsKeys-1].categoryId = this.tabPaneList[this.tabsKeys-1].categoryId.map(item => item.value)
|
|
|
+ }
|
|
|
this.saveLoading = true
|
|
|
- await api.batchInsertApprovalNodes(this.formData)
|
|
|
+ await api.insertApprovalNodes(this.tabPaneList[this.tabsKeys-1])
|
|
|
await this.init()
|
|
|
},
|
|
|
- delRow(num){
|
|
|
- this.formData.splice(num, 1);
|
|
|
+ handleAddFlowClick() {
|
|
|
+ this.tabPaneList.push({
|
|
|
+ flowerName: '流程'+ this.tabPaneList.length,
|
|
|
+ categoryId: [],
|
|
|
+ knowledgeApprovalNode: [
|
|
|
+ {
|
|
|
+ name: '最终节点',
|
|
|
+ approverId: '',
|
|
|
+ approverName: undefined,
|
|
|
+ isFinal: 1
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ })
|
|
|
+ },
|
|
|
+ handleDelFlowClick(pkId = null,indez) {
|
|
|
+ if(!pkId) {
|
|
|
+ this.tabPaneList.splice(indez,1)
|
|
|
+ this.tabsKeys-=1
|
|
|
+ } else {
|
|
|
+ let that = this
|
|
|
+ this.$confirm({
|
|
|
+ title: `确认要删除这个${this.tabPaneList[indez].flowerName}吗?`,
|
|
|
+ content: `您删除后的${this.tabPaneList[indez].flowerName},将无法恢复,请谨慎操作.`,
|
|
|
+ centered: true,
|
|
|
+ icon: 'info-circle',
|
|
|
+ okText: '确定',
|
|
|
+ cancelText: '取消',
|
|
|
+ async onOk() {
|
|
|
+ await that.api.delApprovalNode({pkId})
|
|
|
+ that.tabsKeys-=1
|
|
|
+ that.init()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
},
|
|
|
- addRow(index){
|
|
|
- let tempData={
|
|
|
+ addRow(index,indez){
|
|
|
+ let tempData= {
|
|
|
name:'',
|
|
|
approverId: '',
|
|
|
approverName: undefined,
|
|
|
isFinal: 0
|
|
|
}
|
|
|
- if(this.formData.length == 1) {
|
|
|
- this.formData.unshift(tempData)
|
|
|
+ let info = this.tabPaneList[indez].knowledgeApprovalNode
|
|
|
+ if(info.length == 1) {
|
|
|
+ info.unshift(tempData)
|
|
|
} else {
|
|
|
- this.formData.splice(index+1, 0,tempData)
|
|
|
+ info.splice(index+1, 0,tempData)
|
|
|
}
|
|
|
},
|
|
|
- handleShowAuditClick(index) {
|
|
|
+ delRow(index,indez){
|
|
|
+ this.tabPaneList[indez].knowledgeApprovalNode.splice(index, 1);
|
|
|
+ },
|
|
|
+ handleShowAuditClick(index,indez) {
|
|
|
this.showAuditFlag = true,
|
|
|
this.tempDataIndex = index
|
|
|
+ this.tempDataIndez = indez
|
|
|
},
|
|
|
transCheckedTarget(arg) {
|
|
|
console.log(arg)
|
|
@@ -156,9 +312,15 @@ export default {
|
|
|
this.approverData.approverName = arg.approverName
|
|
|
},
|
|
|
handleOk() {
|
|
|
- this.formData[this.tempDataIndex].approverId = this.approverData.approverId
|
|
|
- this.formData[this.tempDataIndex].approverName = this.approverData.approverName
|
|
|
+ this.tabPaneList[this.tempDataIndez].knowledgeApprovalNode[this.tempDataIndex].approverId = this.approverData.approverId
|
|
|
+ this.tabPaneList[this.tempDataIndez].knowledgeApprovalNode[this.tempDataIndex].approverName = this.approverData.approverName
|
|
|
this.showAuditFlag = false
|
|
|
+ },
|
|
|
+ // 清除分类事件
|
|
|
+ handleClassifyChange(arg) {
|
|
|
+ if(!arg.length) {
|
|
|
+ this.tabPaneList[this.tabsKeys-1].categoryId = []
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -198,4 +360,16 @@ export default {
|
|
|
/deep/ .ant-modal-body {
|
|
|
padding: 0;
|
|
|
}
|
|
|
+/* /deep/ .ant-cascader-menus {
|
|
|
+ left: 0!important;
|
|
|
+}
|
|
|
+/deep/ .ant-cascader-menu:last-child {
|
|
|
+ margin-right: 0;
|
|
|
+} */
|
|
|
+/deep/ .ant-tabs-tabpane-active {
|
|
|
+ min-height: 500px;
|
|
|
+}
|
|
|
+/deep/ .ant-select-dropdown-content {
|
|
|
+ height: 100px;
|
|
|
+}
|
|
|
</style>
|