修改参数模板管理

This commit is contained in:
范强强
2024-01-05 14:03:09 +08:00
parent d977961d1c
commit ffd90f0ffa
4 changed files with 772 additions and 462 deletions
+3
View File
@@ -2038,4 +2038,7 @@ module.exports = {
experienceReference:'Experience reference',
onlyTheDataFilledUrged:'Only the data whose status is to be filled in or To be processed by eng. interface can be urged',
onlyTheDataWhoseStatusUrged:'Only the data whose status is to be filled in can be urged',
maintainer:'Maintainer',
setupMaintainer:'Setup maintainer',
maximumOfBeSelected:'A maximum of 30 personnel can be selected',
}
+3
View File
@@ -3772,4 +3772,7 @@ module.exports = {
experienceReference:'经验参考',
onlyTheDataFilledUrged:'只能催办状态为待填写或待工程接口人处理的数据',
onlyTheDataWhoseStatusUrged:'只能催办状态为待填写的数据',
maintainer:'维护人',
setupMaintainer:'设置维护人',
maximumOfBeSelected:'最多只能选择30个人员',
}
@@ -0,0 +1,253 @@
<template>
<a-drawer
:title="title"
:maskClosable="false"
:width="500"
placement="right"
:closable="true"
@close="handleCancel"
:visible="visible"
style="height: 100%;overflow: auto;padding-bottom: 53px;">
<a-spin :spinning="confirmLoading">
<a-form>
<a-form-model :model="formInline" class="formAdd" :rules="rules" ref="ruleForm">
<a-row :gutter="24">
<a-col :span="24">
<div class="box-title-text">
<div class="title-text">
<span class="Required">*</span>
<span class="title-text-text" :title="$t('maintainer')">{{$t('maintainer')}}</span>
</div>
<a-form-model-item class="itemModel" prop="maintainerName">
<PersonnelSelection :query="{db_field_name:'maintainer',db_field_txt:$t('maintainer')}"
:personneQuery="formInline"
v-if="visible"
class="maintainerClass"
@change="PersonnelSelectionChange"
v-model="formInline.maintainerName"/>
</a-form-model-item>
</div>
</a-col>
</a-row>
</a-form-model>
</a-form>
</a-spin>
<div class="drawer-bootom-button">
<a-button style="margin-right: 8px" @click="handleCancel">{{$t('cancel')}}</a-button>
<a-button @click="handleSubmit" type="primary" :loading="confirmLoading">{{$t('submit')}}</a-button>
</div>
</a-drawer>
</template>
<script>
import PersonnelSelection from '@/components/PersonnelSelection/index'
import { getAction, postAction, downloadFile, putAction } from '@/api/manage'
export default {
name: 'setupMaintainerModel',
components: {
PersonnelSelection
},
props: ['url'],
data() {
return {
formInline: {},
confirmLoading: false,
visible: false,
rules: {
maintainerName: [
{ required: true, message: this.$t('PleaseSelect') + this.$t('maintainer'), trigger: 'change' }
]
},
disabled: false,
projectNameList: [],
title: ''
}
},
mounted() {
},
methods: {
editModel(value) {
this.visible = true
this.title = this.$t('setupMaintainer')
this.$nextTick(() => {
this.formInline = JSON.parse(JSON.stringify(value))
this.$refs['ruleForm'].clearValidate()
})
},
handleCancel() {
this.visible = false
},
handleSubmit() {
this.$refs.ruleForm.validate(valid => {
if (valid) {
let query = JSON.parse(JSON.stringify(this.formInline))
let maintainerName = query.maintainerName.split(',')
if (maintainerName.length > 30) {
this.$message.warning(this.$t('maximumOfBeSelected'))
return
}
Object.keys(query).forEach(res => {
if (query[res] && query[res] instanceof Array) {
query[res] = query[res].join(',')
}
})
this.confirmLoading = true
putAction('params/template/edit', query).then((res) => {
if (res.success) {
this.confirmLoading = false
this.$message.success(this.$t('OperationSuccessful'))
this.visible = false
this.$emit('setupMaintainerModelForm')
} else {
this.$message.warning(this.$t('operationFailed'))
this.confirmLoading = false
}
})
}
})
},
handleInput(value) {
this.$nextTick(() => {
this.formInline = { ...this.formInline }
this.$refs.ruleForm.validateField([value])
})
},
PersonnelSelectionChange(value, id) {
this.formInline[value] = id
this.formInline = { ...this.formInline }
},
projectNameChange(value) {
console.log(value)
}
}
}
</script>
<style>
.formAdd .ant-form-item-label {
width: 130px;
}
.formAdd .ant-form-item-control-wrapper {
display: inline-block;
width: 100%;
}
/*.formAdd .ant-form-item {*/
/* margin-bottom: 20px;*/
/*}*/
.itemModel .ant-form-item-control-wrapper {
width: 100%;
}
.box-input .ant-select-selection--single {
height: 38px;
}
.box-input .ant-select-selection--multiple {
height: 38px;
}
.box-input .ant-select-selection__rendered {
line-height: 38px;
height: 38px;
}
.box-input .ant-select-selection--multiple .ant-select-selection__rendered > ul > li {
margin-top: 6px;
}
.box-input .ant-calendar-picker {
line-height: 38px;
height: 38px;
}
.box-input .ant-calendar-picker-input {
height: 38px;
}
.box-input .ant-input-number-input-wrap {
line-height: 38px;
height: 38px;
}
.ant-input-disabled {
color: rgba(0, 0, 0, 0.65) !important;
}
</style>
<style scoped>
.box-title-text {
line-height: 1.4;
display: flex;
/*align-items: center;*/
}
.title-text {
width: 74px;
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: 48px;
}
.box-input {
display: inline-block;
height: 38px;
width: 100%;
}
.itemModel {
width: calc(100% - 90px);
display: inline-block;
margin-top: 2px;
}
.Required {
color: red;
margin-right: 4px;
}
.title-text-text {
margin-top: 9px;
}
.formAdd {
margin-bottom: 40px;
}
.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;
}
/deep/ .add-input {
min-height: 135px !important;
}
::v-deep .maintainerClass .itemModelStand-input{
height: 120px;
}
::v-deep .maintainerClass .itemModelStand-input .ant-select-selection--multiple{
min-height: 120px;
}
</style>
@@ -69,13 +69,28 @@
{{ text && text.length > 50 ? text.slice(0, 49) + '...' : text }}
</span>
<span slot="operation" slot-scope="text,record">
<a class="text-operation" :disabled="record.status == '1' ? true : false" v-has="'params:template:edit'" @click="edit(record)">{{$t('edit')}}</a>
<a class="text-operation" v-has="'params:template:setupMaintainer'"
@click="setupMaintainerClick(record)">{{$t('setupMaintainer')}}</a>
<a class="text-operation"
:disabled="record.status == '1' || record.authorityFlag == '1'? true : false"
v-has="'params:template:edit'"
@click="edit(record)">{{$t('edit')}}</a>
<a class="text-operation"
v-has="'params:template:publish'"
@click="withdrawOrRelease(record)">{{record.status && record.status == '1'? $t('withdraw') : $t('release')}}</a>
<a class="text-operation" :disabled="record.status == '1' ? true : false" v-has="'params:template:maintenanceTemplate'"
:disabled="record.authorityFlag == '1'? true : false"
@click="withdrawOrRelease(record)">
{{record.status && record.status == '1'? $t('withdraw') : $t('release')}}
</a>
<a class="text-operation"
:disabled="record.status == '1' || record.authorityFlag == '1'? true : false"
v-has="'params:template:maintenanceTemplate'"
@click="maintenanceTemplateClick(record)">{{$t('maintenanceTemplate')}}</a>
<a class="text-operation" :disabled="record.status == '1' ? true : false"
<a class="text-operation"
:disabled="record.status == '1' || record.authorityFlag == '1'? true : false"
v-has="'params:template:delete'" @click="deleteLib(record)">{{$t('deleteLib')}}</a>
</span>
</a-table>
@@ -94,6 +109,7 @@
</div>
<JLoading :loading="JLoading">{{ $t('pleaseWaitWhileRunning') }}</JLoading>
<addModel :url="url" ref="addModelRef" @addModelList="addModelList"/>
<setupMaintainerModel ref="setupMaintainerModelRef" @setupMaintainerModelForm="setupMaintainerModelForm"/>
<a-modal class="show-copy" v-model="areaVisible" :title="$t('templateCopy')" :footer="null" @cancel="hideModal">
<a-form-model :model="formInline" class="formAdd" :rules="rules" ref="ruleForm">
<a-row :gutter="24">
@@ -118,40 +134,44 @@
<a-button @click="handleSubmit" type="primary" :loading="confirmLoading">{{$t('submit')}}</a-button>
</div>
</a-modal>
</a-card>
</template>
<script>
import { getAction, postAction, downloadFile, deleteAction } from '@/api/manage'
import addModel from './components/addModel'
import axios from 'axios'
import { ACCESS_TOKEN } from '@/store/mutation-types'
import eventBUs from '../../../common/event'
import Vue from 'vue'
import { ResizeHeader, ResizeColumnProvide } from '@/mixins/header'
import { getAction, postAction, downloadFile, deleteAction } from '@/api/manage'
import addModel from './components/addModel'
import setupMaintainerModel from './components/setupMaintainerModel'
import axios from 'axios'
import { ACCESS_TOKEN } from '@/store/mutation-types'
import eventBUs from '../../../common/event'
import Vue from 'vue'
import { ResizeHeader, ResizeColumnProvide } from '@/mixins/header'
export default {
export default {
name: 'index',
components: {
addModel,
setupMaintainerModel
},
mixins:[ResizeHeader, ResizeColumnProvide],
mixins: [ResizeHeader, ResizeColumnProvide],
data() {
return {
token:Vue.ls.get(ACCESS_TOKEN),
token: Vue.ls.get(ACCESS_TOKEN),
loading: false,
toggleSearchStatus: false,
JLoading:false,
JLoading: false,
selectedRowKeys: [],
selectedRowKeysArray: '',
orderBy: '1',
orderByField: '',
formInline: {},
rules: {
paramsTemplateName:[
{ required: true, message: this.$t('PleaseEnter')+this.$t('templateName'), trigger: 'change' },
{ min:1, max: 50, message: this.$t('cantExeed')+'50'+this.$t('characters'), trigger: 'blur' },
],
paramsTemplateName: [
{ required: true, message: this.$t('PleaseEnter') + this.$t('templateName'), trigger: 'change' },
{ min: 1, max: 50, message: this.$t('cantExeed') + '50' + this.$t('characters'), trigger: 'blur' }
]
},
visible: false,
dataSource: [],
@@ -174,15 +194,15 @@ export default {
align: 'left',
width: 125,
ellipsis: true,
sorter:true,
dataIndex: 'region_dictText',
sorter: true,
dataIndex: 'region_dictText'
},
{
title: this.$t('parameterTemplate'),
align: 'left',
width: 200,
ellipsis: true,
sorter:true,
sorter: true,
dataIndex: 'paramsTemplateName',
scopedSlots: { customRender: 'projectName' }
},
@@ -215,33 +235,40 @@ export default {
ellipsis: true,
dataIndex: 'createBy'
},
{
title: this.$t('maintainer'),
align: 'left',
width: 120,
ellipsis: true,
dataIndex: 'maintainerName'
},
{
title: this.$t('created'),
align: 'left',
dataIndex: 'createTime',
width: 200,
sorter:true,
ellipsis: true,
sorter: true,
ellipsis: true
},
{
title: this.$t('updated'),
align: 'left',
width: 200,
ellipsis: true,
sorter:true,
sorter: true,
dataIndex: 'updateTime'
},
{
title: this.$t('operation'),
align: 'left',
fixed: 'right',
width: 200,
width: 280,
scopedSlots: { customRender: 'operation' }
}
],
queryParam: {},
areaVisible:false,
paramsTemplateName: '',
areaVisible: false,
paramsTemplateName: ''
}
},
mounted() {
@@ -249,11 +276,11 @@ export default {
},
methods: {
handleCancel() {
this.areaVisible=false
this.areaVisible = false
this.$refs['ruleForm'].resetFields()
},
handleSubmit() {
if( this.formInline.paramsTemplateName !== undefined) {
if (this.formInline.paramsTemplateName !== undefined) {
this.formInline.paramsTemplateName = this.formInline.paramsTemplateName.trim()
}
this.$refs.ruleForm.validate(valid => {
@@ -283,27 +310,27 @@ export default {
this.$refs.addModelRef.addModel()
},
// 复制
handlecody(){
handlecody() {
if (this.selectedRowKeys.length > 1) {
this.$message.warning(this.$t('OnlyOneSelected'))
} else if(this.selectedRowKeys.length == 0){
} else if (this.selectedRowKeys.length == 0) {
this.$message.warning(this.$t('pleaseSelectData'))
} else {
this.areaVisible=true
this.areaVisible = true
this.formInline = {}
}
},
hideModal(){
this.visible = false;
hideModal() {
this.visible = false
this.$refs['ruleForm'].resetFields()
},
withdrawOrRelease(item){
withdrawOrRelease(item) {
let _this = this
this.$confirm({
content: item.status && item.status == '1' ? _this.$t('confirmWithdraw') : _this.$t('confirmRelease'),
onOk() {
_this.JLoading = true
if (item.status && item.status == '1'){
if (item.status && item.status == '1') {
getAction('params/paramsInfo/withdraw', { paramsTemplateId: item.id }).then((res) => {
if (res.success) {
_this.$message.success(res.result)
@@ -314,7 +341,7 @@ export default {
_this.JLoading = false
}
})
}else{
} else {
getAction('params/paramsInfo/publish', { paramsTemplateId: item.id }).then((res) => {
if (res.success) {
_this.$message.success(res.result)
@@ -329,7 +356,7 @@ export default {
}
})
},
maintenanceTemplateClick(item){
maintenanceTemplateClick(item) {
item.titleNameDesgin = 'maintenance'
this.$router.push({
path: '/ParameterTemplateList',
@@ -338,11 +365,25 @@ export default {
},
//批量删除
handleDel() {
let param={
let param = {
ids: this.selectedRowKeysArray
}
if (this.selectedRowKeys.length > 0) {
let _this = this
let dataSource = []
for (let i = 0; i < this.dataSource.length; i++) {
for (let j = 0; j < this.selectedRowKeys.length; j++) {
if (this.dataSource[i].id == this.selectedRowKeys[j]) {
dataSource.push(this.dataSource[i])
}
}
}
for (let i = 0; i < dataSource.length; i++) {
if (dataSource[i].authorityFlag == '1') {
this.$message.warning(this.$t('doNotHavePermissionDeleteData'))
return
}
}
this.$confirm({
content: _this.$t('ConfirmBatchDeletion'),
onOk() {
@@ -350,7 +391,7 @@ export default {
url: '/jero-boot/params/template/deleteBatch',
method: 'post',
data: param,
transformRequest: [function (data) {
transformRequest: [function(data) {
let ret = ''
for (let it in data) {
ret += encodeURIComponent(it) + '=' + encodeURIComponent(data[it]) + '&'
@@ -359,27 +400,33 @@ export default {
}],
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'X-Access-Token':_this.token
'X-Access-Token': _this.token
}
})
.then( (res) =>{
.then((res) => {
if (res.data.success) {
_this.$message.success(_this.$t('OperationSuccessful'))
_this.selectedRowKeys = []
_this.getList()
}else{
} else {
_this.$message.warning(_this.$t('operationFailed'))
}
})
.catch( (error) =>{
console.log(error);
});
.catch((error) => {
console.log(error)
})
}
})
} else {
this.$message.warning(this.$t('selectLeastOne'))
}
},
setupMaintainerModelForm() {
this.getList()
},
setupMaintainerClick(item) {
this.$refs.setupMaintainerModelRef.editModel(item)
},
//编辑
edit(item) {
this.$refs.addModelRef.editModel(JSON.parse(JSON.stringify(item)))
@@ -437,15 +484,15 @@ export default {
},
tableOnChange(pagination, filters, sorter) {
this.orderBy = sorter.order == 'ascend' ? '1' : '2'
if(sorter.columnKey == 'region_dictText'){
if (sorter.columnKey == 'region_dictText') {
this.orderByField = 'region'
} else if(sorter.columnKey == 'paramsTemplateName') {
} else if (sorter.columnKey == 'paramsTemplateName') {
this.orderByField = 'params_template_name'
} else if(sorter.columnKey == 'createTime') {
} else if (sorter.columnKey == 'createTime') {
this.orderByField = 'create_time'
} else if(sorter.columnKey == 'updateTime') {
} else if (sorter.columnKey == 'updateTime') {
this.orderByField = 'update_time'
} else{
} else {
this.orderByField = sorter.columnKey
}
this.getList()
@@ -476,20 +523,20 @@ export default {
})
}
}
}
}
</script>
<style scoped>
@import '~@assets/less/common.less';
@import '~@assets/less/common.less';
.box-title-text {
.box-title-text {
line-height: 1.4;
display: flex;
align-items: center;
margin-bottom: 10px;
}
}
.title-text {
.title-text {
width: 20%;
min-width: 110px;
color: #000F16;
@@ -502,37 +549,39 @@ export default {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
}
.box-input {
.box-input {
display: inline-block;
width: 70%;
height: 38px;
margin-top: 2px;
}
.add-input{
}
.add-input {
width: 82%;
}
.box-button {
}
.box-button {
height: 38px;
/*margin-top: 2px;*/
}
}
.text-operation {
.text-operation {
margin-right: 8px;
}
}
.page {
.page {
text-align: right;
margin-top: 20px;
}
}
.box-title-text-add {
.box-title-text-add {
line-height: 1.4;
display: flex;
}
}
.title-text-add {
.title-text-add {
width: 114px;
text-align: right;
display: inline-block;
@@ -545,37 +594,37 @@ export default {
height: 42px;
line-height: 42px;
margin-top: 3px;
}
}
.box-input-add {
.box-input-add {
display: inline-block;
height: 38px;
width: 100%;
}
}
.itemModel {
.itemModel {
width: calc(100% - 130px);
display: inline-block;
margin-top: 2px;
}
}
.Required {
.Required {
color: red;
margin-right: 4px;
}
}
.title-text-text {
.title-text-text {
margin-top: 9px;
}
}
.formAdd {
.formAdd {
margin-bottom: 40px;
}
}
.drawer-bootom-button {
.drawer-bootom-button {
position: absolute;
bottom: 0;
z-index:100;
z-index: 100;
width: 100%;
border-top: 1px solid #e8e8e8;
padding: 10px 16px;
@@ -583,20 +632,22 @@ export default {
left: 0;
background: #fff;
border-radius: 0 0 2px 2px;
}
.add-text-text{
}
.add-text-text {
margin-top: -14px;
}
::v-deep .ant-table-row:first-child {
background: #fff!important;
}
::v-deep .ant-table-row:first-child {
background: #fff !important;
opacity: 0.9;
}
}
::v-deep .ant-table-body {
background: transparent!important;
}
::v-deep .ant-table-body {
background: transparent !important;
}
::v-deep .ant-table-placeholder{
::v-deep .ant-table-placeholder {
margin-top: 8px !important;
}
}
</style>