[add] 参数模板列表

This commit is contained in:
zhaomeijing
2022-04-26 17:10:31 +08:00
parent cef82f5883
commit bacf369d88
2 changed files with 351 additions and 52 deletions
@@ -0,0 +1,320 @@
<template>
<a-drawer
:title="title"
:maskClosable="false"
:width="1000"
placement="right"
:closable="true"
@close="handleCancel"
:visible="visible"
style="height: 100%;overflow: auto;padding-bottom: 53px;">
<a-spin :spinning="confirmLoading">
<a-form-model :model="formInline" class="formAdd" :rules="rules" ref="ruleForm">
<a-row :gutter="24">
<a-col :span="12">
<div class="box-title-text">
<div class="title-text">
<span class="title-text-text"
:title="$t('NiONumber')">{{$t('NiONumber')}}</span>
</div>
<a-form-model-item class="itemModel" prop="paramsTemplateName">
<a-input class="box-input"
:disabled="disabled"
v-model="formInline.paramsTemplateName"
:placeholder="$t('PleaseEnter')+$t('NiONumber')"/>
</a-form-model-item>
</div>
</a-col>
<a-col :span="12">
<div class="box-title-text">
<div class="title-text">
<span class="title-text-text" :title="$t('Required')">{{$t('Required')}}</span>
</div>
<a-form-model-item class="itemModel" prop="state">
<a-select>
<a-select-option v-for="(item, key) in isRequired" :key="key" :value="item.value">
<span style="display: inline-block;width: 100%" :title=" item.text || item.label ">
{{ item.text || item.label }}
</span>
</a-select-option>
</a-select>
</a-form-model-item>
</div>
</a-col>
</a-row>
<a-row :gutter="24">
<a-col :span="12">
<div class="box-title-text">
<div class="title-text">
<span class="title-text-text"
:title="$t('NiONumber')">{{$t('NiONumber')}}</span>
</div>
<a-form-model-item class="itemModel" prop="paramsTemplateName">
<a-input class="box-input"
:disabled="disabled"
v-model="formInline.paramsTemplateName"
:placeholder="$t('PleaseEnter')+$t('NiONumber')"/>
</a-form-model-item>
</div>
</a-col>
<a-col :span="12">
<div class="box-title-text">
<div class="title-text">
<span class="title-text-text" :title="$t('Required')">{{$t('Required')}}</span>
</div>
<a-form-model-item class="itemModel" prop="state">
<a-select>
<a-select-option v-for="(item, key) in isRequired" :key="key" :value="item.value">
<span style="display: inline-block;width: 100%" :title=" item.text || item.label ">
{{ item.text || item.label }}
</span>
</a-select-option>
</a-select>
</a-form-model-item>
</div>
</a-col>
</a-row>
</a-form-model>
</a-spin>
<div class="drawer-bootom-button">
<a-button style="margin-right: .8rem" @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: 'addModel',
components: {
PersonnelSelection
},
props: ['url'],
data() {
return {
isRequired: [
{value:1, label: '是' },
{value:0, label: '否' }
],
formInline: {},
confirmLoading: false,
visible: false,
rules: {
ipdInfo: [
{
pattern: /(ht|f)tp(s?)\:\/\/[0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*(:(0-9)*)*(\/?)([a-zA-Z0-9\-\.\?\,\'\/\\\+&amp;%$#_]*)?/,
message: this.$t('pleaseEnterTheCorrectWebAddress')
}
],
vehicleDevelopmentPlan: [
{
pattern: /(ht|f)tp(s?)\:\/\/[0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*(:(0-9)*)*(\/?)([a-zA-Z0-9\-\.\?\,\'\/\\\+&amp;%$#_]*)?/,
message: this.$t('pleaseEnterTheCorrectWebAddress')
}
],
attestationPlan: [
{
pattern: /(ht|f)tp(s?)\:\/\/[0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*(:(0-9)*)*(\/?)([a-zA-Z0-9\-\.\?\,\'\/\\\+&amp;%$#_]*)?/,
message: this.$t('pleaseEnterTheCorrectWebAddress')
}
]
},
disabled: false,
projectNameList: [],
title: ''
}
},
mounted() {
this.getNameList()
},
methods: {
getNameList() {
getAction('project/projectNameInfoEO/list', {}).then((res) => {
if (res.success) {
this.projectNameList = res.result || []
} else {
this.projectNameList = []
}
})
},
addModel() {
this.visible = true
this.title = '新增'
this.formInline = {}
},
editModel(value) {
this.visible = true
this.title = '编辑'
this.$nextTick(() => {
this.formInline = value
})
},
handleCancel() {
this.visible = false
},
handleSubmit() {
this.$refs.ruleForm.validate(valid => {
if (valid) {
let url = ''
let Action
if (this.formInline.id) {
url = this.url.edit
Action = putAction
} else {
url = this.url.add
Action = postAction
}
let query = JSON.parse(JSON.stringify(this.formInline))
Object.keys(query).forEach(res => {
if (query[res] && query[res] instanceof Array) {
query[res] = query[res].join(',')
}
})
this.confirmLoading = true
Action(url, query).then((res) => {
if (res.success) {
this.confirmLoading = false
this.$message.success(this.$t('OperationSuccessful'))
this.visible = false
this.$emit('addModelList')
} 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: calc(100% - 130px);
}
/*.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;
}
</style>
<style scoped>
.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: 48px;
}
.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;
}
.formAdd {
margin-bottom: 40px;
}
.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;
}
</style>
<style>
.ant-input-disabled {
color: rgba(0, 0, 0, 0.65) !important;
}
</style>
@@ -8,7 +8,7 @@
<span>{{$t('NiONumber')}}</span>
</div>
<a-input class="box-input" :placeholder="$t('PleaseEnter')+$t('NiONumber')"
v-model="queryParam.projectName"></a-input>
v-model="queryParam.paramsTemplateName"></a-input>
</div>
</a-col>
<a-col :md="6" :sm="8">
@@ -17,7 +17,7 @@
<span>{{$t('ParameterName')}}</span>
</div>
<a-input class="box-input" :placeholder="$t('PleaseEnter')+$t('ParameterName')"
v-model="queryParam.projectName"></a-input>
v-model="queryParam.paramsTemplateName"></a-input>
</div>
</a-col>
<a-col :md="6" :sm="8">
@@ -25,7 +25,7 @@
<div class="title-text" :title="$t('areaOfResponsibility')">
<span>{{$t('areaOfResponsibility')}}</span>
</div>
<j-dict-select-tag class="box-input" v-model="queryParam.projectStatus"
<j-dict-select-tag class="box-input" v-model="queryParam.state"
:placeholder="$t('PleaseSelect')+$t('areaOfResponsibility')"
:type="'select'"
:triggerChange="false" :dictCode="'duty_territory'"/>
@@ -44,22 +44,9 @@
<a-icon type="plus"/>
{{$t('add')}}
</div>
<div @click="handleModule" class="operator-text" v-has="'document:exportTemplate'">
<a-icon type="download"/>
{{$t('templateDownload')}}
</div>
<div class="operator-text" v-has="'document:importZip'">
<ImportFile :url="url" :isTrue="false" :accept="'.zip'"/>
<a-icon type="download"/>
{{$t('import')}}
</div>
<div @click="handleExport" class="operator-text" v-has="'document:exportExcel'">
<a-icon type="export" :rotate="-90"/>
{{$t('dataExport')}}
</div>
<div @click="handleCompare" class="operator-text" v-has="'document:pullMessage'">
<a-icon type="rocket" :rotate="45"/>
{{$t('releaseVersion')}}
<div @click="handlecody" class="operator-text" v-has="'document:getInfoById'">
<a-icon type="copy"/>
{{$t('copy')}}
</div>
<div @click="handleDel" class="operator-text" v-has="'document:deleteBatch'">
<a-icon type="delete"/>
@@ -78,9 +65,9 @@
:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
:columns="columns"
>
<!-- <span slot="projectName" slot-scope="text,record">-->
<!-- <a @click="entryNameClick(record)">{{text}}</a>-->
<!-- </span>-->
<span slot="projectName" slot-scope="text,record">
<a @click="entryNameClick(record)">{{text}}</a>
</span>
<span slot="operation" slot-scope="text,record">
<a class="text-operation" @click="edit(record)">{{$t('edit')}}</a>
<a class="text-operation" @click="deleteLib(record)">{{$t('deleteLib')}}</a>
@@ -105,13 +92,11 @@
<script>
import { getAction, postAction, downloadFile, deleteAction } from '@/api/manage'
import addModel from './components/addModel'
import PersonnelSelection from '@/components/PersonnelSelection/index'
export default {
name: 'index',
components: {
addModel,
PersonnelSelection
},
data() {
return {
@@ -124,11 +109,11 @@ export default {
dataSource: [],
confirmLoading: false,
url: {
list: 'project/projectLibraryBase/page',
add: 'project/projectLibraryBase/add',
edit: 'project/projectLibraryBase/edit',
deleteBatch: 'project/projectLibraryBase/delete',
deleteAll: 'project/projectLibraryBase/deleteBatch'
list: 'params/template/page',
add: 'params/template/add',
edit: 'params/template/edit',
deleteBatch: 'params/template/delete',
deleteAll: 'params/template/deleteBatch'
},
total: 0,
pageSize: 10,
@@ -138,27 +123,29 @@ export default {
{
title: this.$t('NiONumber'),
align: 'center',
dataIndex: 'projectName'
width: '10%',
dataIndex: 'region_dictText',
},
{
title: this.$t('ParameterName'),
align: 'center',
dataIndex: 'targetMarket_dictText'
dataIndex: 'paramsTemplateName'
},
{
title: this.$t('ParameterDescription'),
align: 'center',
dataIndex: 'projectStatus_dictText'
dataIndex: 'description'
},
{
title: this.$t('areaOfResponsibility'),
align: 'center',
dataIndex: 'studioEngineerName'
dataIndex: 'state_dictText'
},
{
title: this.$t('createTime'),
align: 'center',
dataIndex: 'certificationEngineerName'
width: '10%',
dataIndex: 'createTime'
},
{
title: this.$t('operation'),
@@ -175,18 +162,6 @@ export default {
this.getList()
},
methods: {
handleExport(){
},
handleFileExport() {
},
handleCompare() {
},
handleModule() {
},
handleToggleSearch() {
this.toggleSearchStatus = !this.toggleSearchStatus
},
@@ -196,6 +171,10 @@ export default {
//添加
handleAdd() {
this.$refs.addModelRef.addModel()
},
// 复制
handlecody(){
},
//批量删除
handleDel() {
@@ -205,7 +184,7 @@ export default {
content: _this.$t('ConfirmBatchDeletion'),
onOk() {
let idList = JSON.parse(JSON.stringify(_this.selectedRowKeys))
deleteAction(_this.url.deleteAll, { ids: idList.join(',') }).then((res) => {
postAction(_this.url.deleteAll, { ids: idList.join(',') }).then((res) => {
if (res.success) {
_this.$message.success(_this.$t('OperationSuccessful'))
_this.selectedRowKeys = []
@@ -230,7 +209,7 @@ export default {
this.$confirm({
content: _this.$t('ConfirmDelete'),
onOk() {
deleteAction(_this.url.deleteBatch, { id: val.id }).then((res) => {
getAction(_this.url.deleteBatch, { id: val.id }).then((res) => {
if (res.success) {
_this.$message.success(_this.$t('OperationSuccessful'))
_this.getList()
@@ -243,11 +222,10 @@ export default {
},
//虚拟清单名称事件
entryNameClick(item) {
let newUrl = this.$router.resolve({
path: '/ProjectDetails',
this.$router.push({
path: '/ParameterTemplateList',
query: item
})
window.open(newUrl.href, '_blank')
},
searchQuery() {
this.pageNo = 1
@@ -282,7 +260,7 @@ export default {
...this.queryParam
}
this.loading = true
postAction(this.url.list, query).then((res) => {
getAction(this.url.list, query).then((res) => {
if (res.success) {
if (res.result.current > 1 && res.result.records.length == 0) {
this.pageNo = res.result.current - 1
@@ -290,6 +268,7 @@ export default {
return
}
this.dataSource = res.result.records || []
this.total = res.result.total
this.loading = false
} else {