添加工作流

This commit is contained in:
qq787203167
2022-03-07 15:10:40 +08:00
parent 709ae56014
commit f29e33bc95
11 changed files with 1545 additions and 3 deletions
@@ -0,0 +1,368 @@
<template>
<div style="padding: 24px">
<div style="height: 100%;">
<div class="content">
<div class="table-operator">
<div @click="handleAdd" class="operator-text">
<a-icon type="delete"/>
{{$t('add')}}
</div>
</div>
<a-table
class="table"
:pagination="false"
:scroll="{x: true}"
:data-source="dataSource"
:loading="loading"
:columns="columns"
@change="tableOnChange"
>
<span slot="operation" slot-scope="record">
<a @click="edit(record)">{{$t('edit')}}</a>
<a @click="deploy(record.id)">部署</a>
<a @click="copyModel(record.id)">复制</a>
<a @click="deleteRow(record)">{{$t('delete')}}</a>
</span>
</a-table>
</div>
<div class="page" v-if="dataSource.length > 0">
<a-pagination
:show-total="total => $t('total')+` ${total} `+$t('strip')"
show-quick-jumper
show-size-changer
:page-size.sync="pageSize"
:total="total"
@change="onChange"
@showSizeChange="SizeChange"
/>
</div>
<a-drawer
:title="title"
:maskClosable="false"
:width="600"
placement="right"
:closable="true"
@close="handleCancel"
:visible="visible"
style="height: 100%;overflow: auto;padding-bottom: 53px;">
<a-form-model :model="formData" class="formAdd" ref="ruleForm">
<a-row :gutter="24">
<a-col :span="24">
<div class="box-title-text">
<div class="title-text">
<span class="title-text-text" title="模型类型">模型类型</span>
</div>
<a-form-model-item class="itemModel">
<a-select v-model="formData.category" :placeholder="$t('pleaseSelect')+'模型类型'">
<a-select-option v-for="opt in typeList" :value="opt.value" :key="opt.value">
{{ opt.label }}
</a-select-option>
</a-select>
</a-form-model-item>
</div>
</a-col>
<a-col :span="24">
<div class="box-title-text">
<div class="title-text">
<span class="title-text-text" title="模型名称">模型名称</span>
</div>
<a-form-model-item class="itemModel">
<a-input class="box-input"
v-model="formData.name"
:placeholder="$t('PleaseEnter')+'模型名称'"/>
</a-form-model-item>
</div>
</a-col>
<a-col :span="24">
<div class="box-title-text">
<div class="title-text">
<span class="title-text-text" title="模型描述">模型描述</span>
</div>
<a-form-model-item class="itemModel">
<a-input class="box-input"
v-model="formData.desc"
:placeholder="$t('PleaseEnter')+'模型描述'"/>
</a-form-model-item>
</div>
</a-col>
</a-row>
</a-form-model>
<div class="drawer-bootom-button">
<a-button style="margin-right: .8rem" @click="handleCancel">{{$t('cancel')}}</a-button>
<a-button @click="handleSubmit" type="primary">{{$t('submit')}}</a-button>
</div>
</a-drawer>
</div>
</div>
</template>
<script>
import { getAction, postAction, deleteAction, downloadFile } from '@/api/manage'
import eventBUs from '../../../common/event'
export default {
name: 'ProcessClassification',
components: {},
data() {
return {
tableDataLoading: false,
total: 0,
visible: false,
formData: {},
title: '添加流程',
columns: [
{
title: '序号',
dataIndex: 'index',
align: 'center',
ellipsis: true
},
{
title: '流程名称',
dataIndex: 'name',
align: 'center',
ellipsis: true
},
{
title: '流程类型',
dataIndex: 'categoryName',
align: 'center',
ellipsis: true
},
{
title: '创建时间',
dataIndex: 'createTime',
align: 'center',
ellipsis: true
},
{
title: '操作',
width: 100,
align: 'center',
fixed: 'right',
scopedSlots: { customRender: 'operation' }
}
],
dataSource: [],
loading: false,
selectRoleId: '',
typeList: [],
searchForm: {
standardKey: ''
},
pageNo: 1,
pageSize: 10,
editRowDialogVisible: false,
editRowDialogData: undefined // 新增时为 undefined null 或者 false 即可
}
},
methods: {
tableOnChange() {
},
handleAdd() {
this.formData = {}
this.visible = true
},
handleSubmit() {
let formData = {
category: this.formData.category,
desc: this.formData.desc,
name: this.formData.name
}
getAction('model/createModel', formData).then((res) => {
if (res.success) {
this.$message.success(res.message)
this.visible = false
this.queryTablePage()
}
})
},
querytypeList() {
getAction('category/categoryList', {}).then((res) => {
this.typeList = res.result.map(item => {
return {
label: item.type,
value: item.objectId
}
})
})
},
onChange(page, pageSize) {
this.pageNo = page
this.queryTablePage()
},
SizeChange(page, pageSize) {
this.pageSize = pageSize
this.queryTablePage()
},
// 查询、加载表格
queryTablePage() {
const formData = {
current: this.pageNo,
size: this.pageSize
}
getAction('workFlow/modelListPage', formData).then((res) => {
if (res.success) {
this.dataSource = res.result.records || []
this.total = res.result.total
} else {
this.dataSource = []
}
})
},
edit(item) {
this.$router.push({
path: '/ProcessMapping',
query: { id: item.id }
})
},
handleCancel() {
this.visible = false
},
deploy(modelId) {
let _this = this
this.$confirm({
content: _this.$t('ConfirmBatchDeletion'),
onOk() {
getAction('/model/deploy', { modelId: modelId }).then((res) => {
if (res.success) {
_this.$message.success(_this.$t('OperationSuccessful'))
this.queryTablePage()
} else {
_this.$message.warning(_this.$t('operationFailed'))
}
})
}
})
},
copyModel(modelId) {
this.$confirm('确认复制该条数据?', '确认复制', {
confirmButtonText: '确定',
cancelButtonText: '取消',
confirmButtonClass: 'common-button-primary',
roundButton: true,
type: 'warning'
}).then(() => {
this.$http.get('/lawss/activiti/copyModel', {
modelId: modelId
}, {
_this: this
}, res => {
if (res.success) {
this.$router.push({
path: '/ProcessMapping',
query: { id: res.result }
})
}
}, e => {
})
}).catch(() => {
})
},
// 删除
deleteRow(row) {
this.$confirm('确认删除该条数据?', '确认删除', {
confirmButtonText: '确定',
cancelButtonText: '取消',
confirmButtonClass: 'common-button-primary',
roundButton: true,
type: 'warning'
}).then(() => {
const id = row.id
var oDate1 = new Date('2021-09-22 15:00:00')
var oDate2 = new Date(row.createTime)
if (oDate1.getTime() > oDate2.getTime()) {
this.$message.warning('原始流程不可以删除')
} else {
this.$http.get('/lawss/activiti/deleteModel', {
modelId: id
}, {
_this: this
}, res => {
this.$message.success(res.message)
this.queryTablePage()
}, e => {
})
}
}).catch(() => {
})
}
},
created() {
this.queryTablePage()
this.querytypeList()
}
}
</script>
<style lang="less" scoped>
@import '~@assets/less/common.less';
.content {
padding: 0 10px;
height: calc(~'100% - 55px - 50px');
}
.page {
text-align: right;
margin-top: 20px;
}
.drawer-bootom-button {
position: absolute;
bottom: 0;
width: 100%;
border-top: 1px solid #e8e8e8;
padding: 10px 16px;
text-align: right;
left: 0;
background: #fff;
border-radius: 0 0 2px 2px;
}
.box-title-text {
line-height: 1.4;
display: flex;
/*align-items: center;*/
}
.title-text {
width: 114px;
text-align: right;
display: inline-block;
font-weight: 500;
font-size: 14px;
margin-right: 16px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
height: 42px;
line-height: 42px;
}
.box-input {
display: inline-block;
height: 38px;
width: 100%;
}
.itemModel {
width: calc(100% - 130px);
display: inline-block;
margin-top: 2px;
}
.Required {
color: red;
margin-right: 4px;
}
.title-text-text {
margin-top: 9px;
}
</style>