[update] 认证参数收集-編輯

This commit is contained in:
zhaomeijing
2022-05-06 23:50:31 +08:00
parent b06236449d
commit a200c37cb8
2 changed files with 108 additions and 93 deletions
@@ -68,7 +68,8 @@
/>
</div>
<a-modal v-model="areaVisible" :title="$t('parameterTemplate')" width='750px' :footer="null">
<parameter-template v-if='areaVisible' @areaVisible='handleCancel'></parameter-template>
<parameter-template v-if='areaVisible' @areaVisible='handleCancel' :templateTitle='templatetitle'
:selectedRowKeyS='selectedRowKeys' :rowId='rowId' :version='version'></parameter-template>
</a-modal>
</a-card>
</template>
@@ -137,6 +138,7 @@
list: 'params/manifest/page',
add: 'params/manifest/add',
edit: 'params/manifest/edit',
queryById: 'params/manifest/queryById',
deleteBatch: 'params/manifest/delete',
deleteAll: 'params/manifest/deleteBatch',
},
@@ -147,6 +149,10 @@
pageSize: 10,
total: 0,
selectedRowKeysArray: '',
templatetitle: '',
templatetitleId: '',
rowId: '',
version: 0
}
},
mounted() {
@@ -190,7 +196,23 @@
this.selectedRowKeysArray = val.join(',')
},
edit(edit){
this.areaVisible = true
let _this = this
let query = {
id: edit.id
}
getAction(_this.url.queryById, query).then((res) => {
if (res.success) {
console.log(res,'res..')
this.templatetitle = res.result.title
this.selectedRowKeys = res.result.paramsTemplateId.split(',')
this.rowId = res.result.id
this.version = res.result.paramsTemplatePublishVersion
console.log(this.selectedRowKeys,'this.selectedRowKeys')
console.log(typeof this.version)
} else {
}
})
},
handleExport(){
@@ -13,24 +13,24 @@
<a-col :span='9'>
<a-form-model-item :label="$t('title')" prop='templatetitle' :rules='rules'>
<a-input style='width: 420px'
v-model='templatetitle' />
v-model='templatetitle' />
</a-form-model-item>
</a-col>
<a-col :span='9'>
</a-col>
<a-col :span='6'>
<a-button class="box-button" type="primary" @click="searchQuery">{{$t('query')}}</a-button>
<a-button class="box-button" style="margin-left: 8px" @click="searchReset">{{$t('reset')}}</a-button>
<a-button class='box-button' type='primary' @click='searchQuery'>{{ $t('query') }}</a-button>
<a-button class='box-button' style='margin-left: 8px' @click='searchReset'>{{ $t('reset') }}</a-button>
</a-col>
</a-row>
<a-row :gutter='24'>
<a-col :span='9'>
<a-form-model-item ref='region' :label="$t('zoneOfApplication')" prop='region'>
<a-form-model-item class="itemModel" prop="region">
<j-dict-select-tag class="box-input" v-model="form.region"
<a-form-model-item class='itemModel' prop='region'>
<j-dict-select-tag class='box-input' v-model='form.region'
:placeholder="$t('PleaseSelect')+$t('zoneOfApplication')"
:type="'select'"
:triggerChange="false" :dictCode="'region'"/>
:triggerChange='false' :dictCode="'region'" />
</a-form-model-item>
</a-form-model-item>
</a-col>
@@ -62,9 +62,9 @@
v-has="'area:delete'">{{ $t('delete') }}</a>
</span>
</a-table>
<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 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>
</div>
</template>
@@ -77,13 +77,10 @@ export default {
components: {},
data() {
return {
templatetitle: '',
title: this.$t('add'),
total: 0,
selectedRowKeys: [],
selectedRowKeysDate: {},
loading: false,
ipagination: true,
editId: '',
columns: [
{
@@ -118,10 +115,33 @@ export default {
areaTable: [],
flag: false, //表单提交标识
spinLoading: false,
confirmLoading: false
confirmLoading: false,
templatetitle: '',
selectedRowKeys: []
}
},
props: {
templateTitle: {
type: String,
default: '',
required: false
},
selectedRowKeyS: {
type: Array,
default: '',
required: false
},
rowId: {
type: String,
default: '',
required: false
},
version: {
type: Number,
default: '',
required: false
}
},
props: {},
mounted() {
this.loadData()
},
@@ -141,16 +161,16 @@ export default {
})
},
searchQuery() {
this.loadData()
this.loadData()
},
searchReset() {
this.form = {}
this.loadData()
this.form = {}
this.loadData()
},
handleCancel() {
this.$emit('areaVisible',false)
this.$emit('areaVisible', false)
},
onSelectChange(selectedRowKeys,selectedRowKeysDate) {
onSelectChange(selectedRowKeys, selectedRowKeysDate) {
this.selectedRowKeysDate = selectedRowKeysDate
this.selectedRowKeys = selectedRowKeys
},
@@ -163,62 +183,31 @@ export default {
},
//新增
handleSubmit() {
if(this.selectedRowKeys.length == 0) {
if (this.selectedRowKeys.length == 0) {
this.$message.warning(this.$t('pleaseSelectData'))
} else if(this.selectedRowKeys.length > 1) {
} else if (this.selectedRowKeys.length > 1) {
this.$message.warning(this.$t('OnlyOneSelected'))
} else {
this.$refs.ruleForm.validate(valid => {
if (valid) {
this.flag = true
this.spinLoading = true
//编辑
if (this.form.id) {
// putAction(`tag/onlCgformArea/edit`, this.form).then((res) => {
// if (res.success) {
// this.$message.success(this.$t('OperationSuccessful'))
// this.loadData()
// this.form = {
// isModel: '',
// showArea: '',
// enName: '',
// sort: ''
// }
// } else {
// this.$message.warning(res.message)
// this.form = {
// isModel: '',
// showArea: '',
// enName: '',
// sort: ''
// }
// }
// }).finally(() => {
// this.flag = false
// this.spinLoading = false
// this.newVisible = false
// this.form = {
// isModel: '',
// showArea: '',
// enName: '',
// sort: ''
// }
// })
} else {
// 新增之前 判断 标题唯一
getAction(`params/manifest/verifyTitle?projectId=${this.$route.query.id}&title=${this.templatetitle}`, {}).then(res => {
if (res.success) {
console.log(this.selectedRowKeys[0])
let postDate = {
title: this.templatetitle,
paramsTemplateId : this.selectedRowKeysDate[0].id,
paramsTemplatePublishVersion: this.selectedRowKeysDate[0].version
}
//新增
postAction(`params/manifest/add`, postDate).then(res => {
// 新增編輯之前 判断 标题唯一
getAction(`params/manifest/verifyTitle?projectId=${this.$route.query.id}
&title=${this.templatetitle}`, {})
.then(res => {
if (res.success) {
let postDate = {
title: this.templatetitle,
paramsTemplateId: this.rowId || this.selectedRowKeysDate[0].id,
paramsTemplatePublishVersion: this.version || this.selectedRowKeysDate[0].version
}
if (this.rowId) {
//编辑
postAction(`params/manifest/edit`, postDate).then(res => {
if (res.success) {
this.newVisible = false
this.$emit('areaVisible',false)
this.$emit('areaVisible', false)
this.$message.success(this.$t('OperationSuccessful'))
} else {
this.$message.warning(res.message)
@@ -230,12 +219,28 @@ export default {
this.newVisible = false
})
} else {
this.$message.warning(res.message)
//新增
postAction(`params/manifest/add`, postDate).then(res => {
if (res.success) {
this.newVisible = false
this.$emit('areaVisible', false)
this.$message.success(this.$t('OperationSuccessful'))
} else {
this.$message.warning(res.message)
}
}
).finally(() => {
this.flag = false
this.spinLoading = false
this.newVisible = false
})
}
}).finally(() => {
this.loading = false
})
}
} else {
this.$message.warning(res.message)
}
}).finally(() => {
this.loading = false
})
} else {
return false
}
@@ -286,29 +291,17 @@ export default {
}
})
}
},
watch: {
templateTitle(val) {
this.templatetitle = val
},
//点击页数
onChangePage(page, pageSize) {
this.queryParams.pageNo = page
this.loadData()
},
//一页显示条数
SizeChange(page, pageSize) {
this.queryParams.pageSize = pageSize
this.queryParams.pageNo = 1
this.loadData()
},
//正则替换小数点
limitNumber(value) {
if (typeof value === 'string') {
return !isNaN(Number(value)) ? value.replace(/\./g, '') : 0
} else if (typeof value === 'number') {
return !isNaN(value) ? String(value).replace(/\./g, '') : 0
} else {
return 0
}
selectedRowKeyS(val) {
this.selectedRowKeys = val
}
}
}
</script>