[update] 清单编辑

This commit is contained in:
zhaomeijing
2022-05-30 11:44:03 +08:00
parent 22a7491add
commit 812cdc8fed
4 changed files with 39 additions and 46 deletions
+1
View File
@@ -708,6 +708,7 @@ module.exports = {
uploadTime: 'Upload time', uploadTime: 'Upload time',
enclosure: 'Enclosure', enclosure: 'Enclosure',
// 认证 // 认证
changeTheTitle: 'Title already exists, please change the title',
resetPassword: 'reset Password', resetPassword: 'reset Password',
departmentAllocation: 'department Allocation', departmentAllocation: 'department Allocation',
ListTitle: 'List Title', ListTitle: 'List Title',
+1
View File
@@ -718,6 +718,7 @@ module.exports = {
uploadTime: '上传时间', uploadTime: '上传时间',
enclosure: '附件', enclosure: '附件',
// 认证 // 认证
changeTheTitle: '标题已存在请更换标题',
resetPassword: '重置密码', resetPassword: '重置密码',
departmentAllocation: '部门配置', departmentAllocation: '部门配置',
ListTitle: '清单标题', ListTitle: '清单标题',
@@ -76,8 +76,7 @@
</div> </div>
<!-- 参数模板--> <!-- 参数模板-->
<a-modal v-model="areaVisible" :title="$t('parameterTemplate')" width='750px' :footer="null"> <a-modal v-model="areaVisible" :title="$t('parameterTemplate')" width='750px' :footer="null">
<parameter-template-add :url='url' ref='templateRef' v-if='areaVisible' @areaVisible='handleCancel' :templateTitle='templatetitle' <parameter-template-add :url='url' ref='templateRef' v-if='areaVisible' @areaVisible='handleCancel' :version='version'
:selectedRowKeyS='selectedRowKeys' :rowId='rowId' :version='version'
:projectId='this.$route.query.id'></parameter-template-add> :projectId='this.$route.query.id'></parameter-template-add>
</a-modal> </a-modal>
<!-- 配置--> <!-- 配置-->
@@ -357,6 +356,7 @@
pageNo: this.pageNo, pageNo: this.pageNo,
...this.queryParam ...this.queryParam
} }
console.log(query,'projectIdprojectIdbainji ')
getAction(this.url.list, query).then((res) => { getAction(this.url.list, query).then((res) => {
if (res.success) { if (res.success) {
if (res.result.current > 1 && res.result.records.length == 0) { if (res.result.current > 1 && res.result.records.length == 0) {
@@ -11,10 +11,10 @@
> >
<a-row :gutter='24'> <a-row :gutter='24'>
<a-col :span='9'> <a-col :span='9'>
<a-form-model-item :label="$t('title')" prop='templatetitle'> <a-form-model-item :label="$t('title')" prop='title'>
<a-input style='width: 420px' <a-input style='width: 420px'
:placeholder="$t('PleaseEnter')+$t('title')" :placeholder="$t('PleaseEnter')+$t('title')"
v-model='formData.templatetitle' /> v-model='formData.title' />
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
<a-col :span='9'> <a-col :span='9'>
@@ -55,7 +55,7 @@
:pagination='false' :pagination='false'
:loading='loading' :loading='loading'
:scroll='{x: 600}' :scroll='{x: 600}'
:rowSelection='{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}' :rowSelection='{selectedRowKeys: selectedRowKeys, onChange: onSelectChange, getCheckboxProps: onGetCheckboxProps}'
@change='handleTableChange'> @change='handleTableChange'>
</a-table> </a-table>
<div class="page" style='display: flex;justify-content: flex-end;'> <div class="page" style='display: flex;justify-content: flex-end;'>
@@ -116,7 +116,7 @@ export default {
form: {}, form: {},
formData: {}, formData: {},
rules: { rules: {
templatetitle: [ title: [
{ required: true, message: this.$t('enterTitle'), trigger: 'blur' } { required: true, message: this.$t('enterTitle'), trigger: 'blur' }
] ]
}, },
@@ -124,28 +124,12 @@ export default {
flag: false, //表单提交标识 flag: false, //表单提交标识
spinLoading: false, spinLoading: false,
confirmLoading: false, confirmLoading: false,
templatetitle: '',
selectedRowKeys: [], selectedRowKeys: [],
pageNo: 1, pageNo: 1,
pageSize: 10 pageSize: 10
} }
}, },
props: { props: {
templateTitle: {
type: String,
default: '',
required: false
},
selectedRowKeyS: {
type: Array,
default: '',
required: false
},
rowId: {
type: String,
default: '',
required: false
},
version: { version: {
type: Number, type: Number,
default: '', default: '',
@@ -201,11 +185,27 @@ export default {
handleCancel() { handleCancel() {
this.$emit('areaVisible', false) this.$emit('areaVisible', false)
}, },
onGetCheckboxProps(val,value) {
console.log(val)
return({
props: {
// console.log(value,'value')
// // 全部默认禁止选中
// // disabled: true,
// // 某几项默认禁止选中(R: 当state等于1时)
disabled: val.id === 'ce879dab56a243fd99119553d3899e62'
// // 某几项默认选中(R: 当state等于1时)
// // defaultChecked: record.state == 1,
}
})
},
onSelectChange(selectedRowKeys, selectedRowKeysDate) { onSelectChange(selectedRowKeys, selectedRowKeysDate) {
this.selectedRowKeysDate = selectedRowKeysDate this.selectedRowKeysDate = selectedRowKeysDate
this.selectedRowKeys = selectedRowKeys this.selectedRowKeys = selectedRowKeys
}, },
handleTableChange(val) { handleTableChange(val) {
console.log(',,,')
}, },
showModal() { showModal() {
this.title = this.$t('add') this.title = this.$t('add')
@@ -213,18 +213,9 @@ export default {
this.form = {} this.form = {}
}, },
editData(edit) { editData(edit) {
let query = {
id: edit.id this.formData = {...edit}
} this.selectedRowKeys = edit.paramsTemplateId.split(',')
getAction(this.url.queryById, query).then((res) => {
if (res.success) {
this.formData.templatetitle = res.result.title
this.selectedRowKeys = res.result.paramsTemplateId.split(',')
// this.rowId = res.result.id
// this.version = res.result.paramsTemplatePublishVersion
} else {
}
})
}, },
//新增 //新增
handleSubmit() { handleSubmit() {
@@ -239,18 +230,21 @@ export default {
this.spinLoading = true this.spinLoading = true
// 新增編輯之前 判断 标题唯一 // 新增編輯之前 判断 标题唯一
getAction(`params/manifest/verifyTitle?projectId=${this.$route.query.id} getAction(`params/manifest/verifyTitle?projectId=${this.$route.query.id}
&title=${this.formData.templatetitle}`, {}) &title=${this.formData.title}`, {})
.then(res => { .then(res => {
if (res.success) { if (res.result) {
let postDate = { let postDate = {
title: this.formData.templatetitle, title: this.formData.title,
paramsTemplateId: this.rowId || this.selectedRowKeysDate[0].id, paramsTemplateId: this.paramsTemplateId || this.selectedRowKeys[0],
paramsTemplatePublishVersion: this.version || this.selectedRowKeysDate[0].version, paramsTemplatePublishVersion: this.version,
projectId: this.projectId projectId: this.projectId
} }
if (this.rowId) { if (this.formData.id) {
console.log('编辑')
//编辑 //编辑
postDate = {
id : this.formData.id,
...postDate
}
postAction(`params/manifest/edit`, postDate).then(res => { postAction(`params/manifest/edit`, postDate).then(res => {
if (res.success) { if (res.success) {
this.newVisible = false this.newVisible = false
@@ -266,7 +260,6 @@ export default {
this.newVisible = false this.newVisible = false
}) })
} else { } else {
console.log('新增')
//新增 //新增
postAction(`params/manifest/add`, postDate).then(res => { postAction(`params/manifest/add`, postDate).then(res => {
if (res.success) { if (res.success) {
@@ -284,7 +277,8 @@ export default {
}) })
} }
} else { } else {
this.$message.warning(res.message) this.$message.warning(this.$t('changeTheTitle'))
this.spinLoading = false
} }
}).finally(() => { }).finally(() => {
this.loading = false this.loading = false
@@ -328,9 +322,6 @@ export default {
// 编辑 // 编辑
}, },
watch: { watch: {
templateTitle(val) {
this.formData.templatetitle = val
},
selectedRowKeyS(val) { selectedRowKeyS(val) {
this.selectedRowKeys = val this.selectedRowKeys = val
} }