[add] 历史版本

This commit is contained in:
zhaomeijing
2022-05-18 18:14:01 +08:00
parent a7746bac73
commit c6904eb63b
2 changed files with 40 additions and 149 deletions
@@ -81,7 +81,7 @@
<configure ref="configureRef" :url='url' :itemId='itemId'/> <configure ref="configureRef" :url='url' :itemId='itemId'/>
<!-- 历史版本--> <!-- 历史版本-->
<a-modal v-model="historicalVisible" :title="$t('historicalVersion')" width='750px' :footer="null"> <a-modal v-model="historicalVisible" :title="$t('historicalVersion')" width='750px' :footer="null">
<historical-version v-if='historicalVisible' ></historical-version> <historical-version v-if='historicalVisible' :historicalRow='historicalRow'></historical-version>
</a-modal> </a-modal>
</a-card> </a-card>
</template> </template>
@@ -174,7 +174,8 @@
rowId: '', rowId: '',
version: 0, version: 0,
itemId: '', itemId: '',
historicalVisible: false historicalVisible: false,
historicalRow: {}, // 历史版本得数据
} }
}, },
mounted() { mounted() {
@@ -208,10 +209,11 @@
handleTableChange() { handleTableChange() {
}, },
// // 历史版本
historicalVersion() { historicalVersion(historicalRow) {
console.log(historicalRow)
this.historicalVisible = true this.historicalVisible = true
console.log('历史版本。。。。') this.historicalRow = historicalRow
}, },
// 配置 // 配置
configure(item) { configure(item) {
@@ -9,30 +9,27 @@
:dataSource='areaTable' :dataSource='areaTable'
:pagination='false' :pagination='false'
:loading='loading' :loading='loading'
:scroll='{x: 600}' :scroll='{x: 600}'>
@change='handleTableChange'>
<a slot='name' slot-scope='text'>{{ text }}</a> <a slot='name' slot-scope='text'>{{ text }}</a>
<span slot='action' slot-scope='text, record'> <span slot='action' slot-scope='text, record'>
<a class='action-edit' @click='editArea(record.id)' v-has="'area:edit'">{{ $t('edit') }}</a> <a class='action-edit' @click='editArea(record.id)' v-has="'area:edit'">{{ $t('edit') }}</a>
<a style='color:red' href='javascript:;' @click=' deleteArea(record.id)'
v-has="'area:delete'">{{ $t('delete') }}</a>
</span> </span>
</a-table> </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>
</div> </div>
</template> </template>
<script> <script>
import { putAction, postAction, getAction, deleteAction } from '@/api/manage' import { putAction, postAction, getAction, deleteAction } from '@/api/manage'
import axios from 'axios'
import { ACCESS_TOKEN } from '@/store/mutation-types'
import Vue from 'vue'
export default { export default {
name: 'diolagArea', name: 'diolagArea',
components: {}, components: {},
data() { data() {
return { return {
token:Vue.ls.get(ACCESS_TOKEN),
title: this.$t('add'), title: this.$t('add'),
total: 0, total: 0,
selectedRowKeysDate: {}, selectedRowKeysDate: {},
@@ -63,143 +60,44 @@ export default {
} }
}, },
props: { props: {
historicalRow: {
type: Object,
default: {},
require: true
}
}, },
mounted() { mounted() {
this.loadData() this.loadData()
}, },
methods: { methods: {
loadData() { loadData() {
this.loading = true let _this = this
let params = { axios({
...this.form url: `/jero-boot/params/collectManifestHistory/getConfigById?id=${this.historicalRow.id}`,
} method: 'get',
getAction(`params/manifest/getParamsTemplateList`, params).then(res => { transformRequest: [function (data) {
if (res.success) { let ret = ''
this.areaTable = [...res.result] for (let it in data) {
this.total = res.result.total ret += encodeURIComponent(it) + '=' + encodeURIComponent(data[it]) + '&'
}
return ret
}],
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'X-Access-Token':_this.token
} }
}).finally(() => {
this.loading = false
}) })
}, .then( (res) =>{
searchQuery() { console.log(res)
this.loadData() if (res.data.success) {
}, console.log(res,'lll')
searchReset() { }else{
this.form = {} _this.$message.warning(res.data.result)
this.loadData()
},
handleCancel() {
this.$emit('areaVisible', false)
},
onSelectChange(selectedRowKeys, selectedRowKeysDate) {
this.selectedRowKeysDate = selectedRowKeysDate
this.selectedRowKeys = selectedRowKeys
},
handleTableChange(val) {
},
showModal() {
this.title = this.$t('add')
this.newVisible = true
this.form = {}
},
//新增
handleSubmit() {
if (this.selectedRowKeys.length == 0) {
this.$message.warning(this.$t('pleaseSelectData'))
} 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
// 新增編輯之前 判断 标题唯一
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,
projectId: this.projectId
}
if (this.rowId) {
//编辑
postAction(`params/manifest/edit`, 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
})
} else {
//新增
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
})
}
} else {
this.$message.warning(res.message)
}
}).finally(() => {
this.loading = false
})
} else {
return false
} }
}) })
} .catch( (error) =>{
}, console.log(error);
cancelModel() { });
this.newVisible = false
this.$refs.ruleForm.resetFields()
},
//删除按钮
deleteArea(val) {
this.$confirm({
title: this.$t('confirmDeletion'),
content: '',
onOk:
async () => {
getAction(`tag/onlCgformArea/delete`, { id: val }).then((res) => {
if (res.success) {
this.$message.success(this.$t('OperationSuccessful'))
if (this.areaTable.length == 1 && this.queryParams.pageNo != 1) {
this.queryParams.pageNo = this.queryParams.pageNo - 1
}
this.loadData()
} else {
// this.$message.warning(res.message)
if (res.message == '该展示区域有关联数据无法删除') {
this.$message.warning(this.$t('noDelete'))
} else {
this.$message.warning(this.$t('operationFailed'))
}
}
})
}
})
}, },
//编辑按钮 //编辑按钮
editArea(val) { editArea(val) {
@@ -217,15 +115,6 @@ export default {
}) })
} }
}, },
watch: {
templateTitle(val) {
this.templatetitle = val
},
selectedRowKeyS(val) {
this.selectedRowKeys = val
}
}
} }
</script> </script>