Files
laws_weilai/jero-web/src/views/processCenter/procedure/index.vue
T
2022-07-04 15:45:28 +08:00

368 lines
10 KiB
Java

<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"
key="id"
:pagination="false"
:scroll="{x: '100%'}"
:data-source="dataSource"
:loading="loading"
:columns="columns"
@change="tableOnChange"
>
<span slot="operation" slot-scope="record">
<a style="margin-right: 8px" @click="edit(record)">{{$t('edit')}}</a>
<a style="margin-right: 8px" @click="deploy(record.id)">{{$t('Deployment')}}</a>
<!-- <a style="margin-right: 8px" @click="copyModel(record.id)">复制</a>-->
<a style="margin-right: 8px" @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"
:current="pageNo"
@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'
import moment from 'moment'
export default {
name: 'ProcessClassification',
components: {},
data() {
return {
tableDataLoading: false,
total: 0,
visible: false,
formData: {},
title: this.$t('AddProcess'),
columns: [
{
title: this.$t('serialNumber'),
dataIndex: 'index',
align: 'center',
width: 100,
customRender: function(t, r, index) {
return parseInt(index) + 1
}
},
{
title: this.$t('ProcessName'),
dataIndex: 'name',
align: 'center',
ellipsis: true,
width: 240
},
{
title: this.$t('ProcessType'),
dataIndex: 'categoryName',
align: 'center',
ellipsis: true,
width: 240
},
{
title: this.$t('createTime'),
dataIndex: 'createTime',
align: 'center',
ellipsis: true,
width: 240,
customRender: function(t, r, index) {
return moment(t).format('YYYY-MM-DD HH:mm:ss')
}
},
{
title: this.$t('operation'),
width: 210,
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() {
this.loading = true
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
this.loading = false
} else {
this.dataSource = []
this.loading = false
}
})
},
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('ConfirmDeployment'),
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) {
let _this = this
this.$confirm({
content: _this.$t('ConfirmReplication'),
onOk() {
getAction('model/copyModel', { modelId: modelId }).then((res) => {
if (res.success) {
_this.$router.push({
path: '/ProcessMapping',
query: { id: res.result }
})
} else {
_this.$message.warning(_this.$t('operationFailed'))
}
})
}
})
},
// 删除
deleteRow(row) {
let _this = this
this.$confirm({
content: _this.$t('confirmDeletion'),
onOk() {
getAction('model/deleteModel', { modelId: row.id }).then((res) => {
if (res.success) {
_this.$message.success(_this.$t('OperationSuccessful'))
_this.queryTablePage()
} else {
_this.$message.warning(_this.$t('operationFailed'))
}
})
}
})
}
},
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%;
z-index: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>