| | |
| | | <div class="main"> |
| | | <div class="contain"> |
| | | <div class="title">{{title}}</div> |
| | | <el-form ref="form" :model="form" label-width="10em"> |
| | | <!-- 节点动作管理 --> |
| | | <el-form ref="form" :model="form" label-width="10em" v-if="pageType==3"> |
| | | <el-form-item label="节点名称:"> |
| | | <el-input v-model="form.linkName" placeholder="请输入节点名称" disabled></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="节点层级:"> |
| | | <el-select v-model="form.linkType" placeholder="请选择节点层级" disabled> |
| | | <el-option :label="value" :value="key" v-for="(value,key,index) in linkLevel" :key="index"></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="角色:" v-for="(item,i) in form.roleList" :key="i"> |
| | | <el-input v-model="item.name" style="margin-right:8px" placeholder="请输入角色名称" disabled></el-input> |
| | | <el-input v-model="item.type" style="margin-right:8px" type="number" placeholder="请输入角色编码" disabled></el-input> |
| | | <el-checkbox-group v-model="item.actiontype" v-if="item.actiontype"> |
| | | <el-checkbox :label="key" v-for="(value,key,index) in actionType" :key="index">{{value}}</el-checkbox> |
| | | </el-checkbox-group> |
| | | </el-form-item> |
| | | <el-form-item label="所属工单类型:"> |
| | | <el-select v-model="form.type" placeholder="请选择所属工单类型" disabled> |
| | | <el-option :label="value" :value="key" v-for="(value,key,index) in workType" :key="index"></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" @click="onSubmit" v-if="pageType==1">确认提交</el-button> |
| | | <el-button type="primary" @click="onSubmit" v-else-if="pageType==2">确认修改</el-button> |
| | | <el-button type="primary" @click="onSubmit" v-else-if="pageType==3">确认修改</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | <!-- 节点管理 --> |
| | | <el-form ref="form" :model="form" label-width="10em" v-else> |
| | | <el-form-item label="节点名称:"> |
| | | <el-input v-model="form.linkName" placeholder="请输入节点名称"></el-input> |
| | | </el-form-item> |
| | |
| | | <el-form-item label="节点所含角色:"> |
| | | <el-button type="primary" size="mini" @click="addRole">添加角色</el-button> |
| | | </el-form-item> |
| | | <el-form-item label="角色" v-for="(item,i) in form.roleList" :key="i"> |
| | | <el-form-item label="角色:" v-for="(item,i) in form.roleList" :key="i"> |
| | | <el-input v-model="item.name" style="margin-right:8px" placeholder="请输入角色名称"></el-input> |
| | | <el-input v-model="item.type" style="margin-right:8px" type="number" placeholder="请输入角色编码"></el-input> |
| | | <i class="el-icon-delete delIcon" @click="removeList(i)"></i> |
| | |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" @click="onSubmit" v-if="pageType==1">确认提交</el-button> |
| | | <el-button type="primary" @click="onSubmit" v-else>确认修改</el-button> |
| | | <el-button type="primary" @click="onSubmit" v-else-if="pageType==2">确认修改</el-button> |
| | | <el-button type="primary" @click="onSubmit" v-else-if="pageType==3">确认修改</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </div> |
| | |
| | | <script> |
| | | import { |
| | | addWorkflowProperty, |
| | | editWorkflowProperty |
| | | editWorkflowProperty, |
| | | getActionTypeList, |
| | | updateAction, |
| | | } from '../js/api'; |
| | | import { |
| | | workType, |
| | | linkLevel |
| | | linkLevel, |
| | | actionType, |
| | | } from '@/assets/js/constants'; |
| | | export default { |
| | | name: "", |
| | |
| | | return { |
| | | workType, |
| | | linkLevel, |
| | | actionType, |
| | | title: '新建流程节点', |
| | | form: { |
| | | linkName: "", |
| | |
| | | roleList: [], |
| | | type: '', |
| | | }, |
| | | pageType: 1 |
| | | pageType: 1, |
| | | }; |
| | | }, |
| | | components: {}, |
| | |
| | | onSubmit() { |
| | | if (this.pageType == 1) { |
| | | this.addFrom() |
| | | } else { |
| | | } else if (this.pageType == 2) { |
| | | this.editFrom() |
| | | } else if (this.pageType == 3) { |
| | | this.editAction() |
| | | } |
| | | }, |
| | | editFrom() { |
| | |
| | | console.log(err) |
| | | }); |
| | | }, |
| | | editAction() { |
| | | let postData = [] |
| | | this.form.roleList.map(item => { |
| | | let action = JSON.parse(JSON.stringify(item)).actiontype; |
| | | let actionTypeList = action.map(item => { |
| | | return Number(item) |
| | | }) |
| | | let obj = { |
| | | actionTypeList: actionTypeList, |
| | | linkType: Number(this.form.linkType), |
| | | roleType: Number(item.type), |
| | | type: Number(this.form.type), |
| | | } |
| | | postData.push(obj) |
| | | }) |
| | | updateAction(postData).then((res) => { |
| | | if (res.data.code == 1) { |
| | | this.$message({ |
| | | message: '修改成功!', |
| | | type: 'success' |
| | | }); |
| | | setTimeout(() => { |
| | | this.$router.go(-1) |
| | | }, 1000) |
| | | } |
| | | }).catch((err) => { |
| | | console.log(err) |
| | | }); |
| | | }, |
| | | loadAction() { |
| | | let postData = { |
| | | linkType: this.form.linkType, |
| | | type: this.form.type, |
| | | } |
| | | getActionTypeList(postData).then((res) => { |
| | | if (res.data.code == 1) { |
| | | let resData = res.data.data; |
| | | console.log(this.form.roleList) |
| | | this.form.roleList.map(item => { |
| | | resData.map(jtem => { |
| | | if (item.type == jtem.roleType) { |
| | | item.actiontype.push(jtem.actionType + '') |
| | | } |
| | | }) |
| | | }) |
| | | } |
| | | }).catch((err) => { |
| | | console.log(err) |
| | | }); |
| | | }, |
| | | }, |
| | | |
| | | mounted() { |
| | | let postData = JSON.parse(this.$route.query.data); |
| | | console.log(postData) |
| | | if (postData.action) { |
| | | this.title = '节点动作管理' |
| | | this.pageType = 3; |
| | | this.form.linkName = postData.linkName; |
| | | this.form.linkType = postData.linkType + ''; |
| | | this.form.roleList = postData.roleList; |
| | | this.form.type = postData.type + ''; |
| | | this.form.roleList.map(item => { |
| | | this.$set(item, 'actiontype', []) |
| | | }) |
| | | this.$nextTick(() => { |
| | | this.loadAction() |
| | | this.$forceUpdate() |
| | | }) |
| | | |
| | | } else { |
| | | if (postData.linkName) { |
| | | this.title = '编辑流程节点' |
| | | this.pageType = 2; |
| | |
| | | this.title = '新建流程节点' |
| | | this.pageType = 1 |
| | | } |
| | | } |
| | | }, |
| | | }; |
| | | </script> |