<template>
|
<div>
|
<div class="list-content">
|
<FormList
|
:info="formInfo"
|
:isShowDetail="isShowDetail"
|
@handleClick="isShowDetail = !isShowDetail"
|
@updateValue="updateValue"
|
@onSubmit="onSubmit"
|
@setValueInfo="setValueInfo"
|
:isChangeArray="false"
|
></FormList>
|
|
<p class="export-excle">
|
<el-button type="primary" icon="el-icon-circle-plus-outline" @click="handleAdd" size="medium">新增项目合同</el-button>
|
</p>
|
|
<TableList
|
:pageInfo="pageInfo"
|
@doAction="doAction"
|
@handleCurrentChange="handleCurrentChange"
|
@handleSizeChange="handleSizeChange"
|
:isAutoIndex="true"
|
:list="records"
|
:header="tableHeader"
|
:loading="loading"
|
></TableList>
|
</div>
|
</div>
|
</template>
|
<script>
|
/**
|
* 贷款合同发送
|
*/
|
import FormList from './components/FormList'
|
import TableList from './components/TableList'
|
import {
|
delArchiveDetail,
|
pageArchiveDetail,
|
getDictionaryList,
|
queryDictionaryByCode
|
} from '@comprehensive/serve/public'
|
import { projectContractHeader } from '@comprehensive/utils/tableHeaders'
|
import { projectContractSearch } from '@comprehensive/utils/formItems'
|
import common from "@/utils/common";
|
|
const recordButtons = [
|
{
|
label: '合同详情',
|
id: 0,
|
prop: 'businessDetailButton'
|
},
|
{
|
label: '修改合同',
|
id: 1,
|
prop: 'sendDetailButton'
|
},
|
{
|
label: '删除合同',
|
id: 2,
|
prop: 'sendUpdateButton'
|
},
|
]
|
|
export default {
|
components: {
|
FormList,
|
TableList,
|
},
|
data() {
|
return {
|
// 是否显示详情页
|
isShowList: true,
|
|
// 搜索表单字段及描述
|
formInfo: [...projectContractSearch],
|
// 表单结果数据
|
valueInfo: {},
|
records: [],
|
tempRecord: {},
|
objectType: 'ContractSendApply',
|
transCode: 'T1008',
|
dirNo: 'T1008',
|
tableHeader: [...projectContractHeader],
|
pageInfo: {
|
currentPage: 1,
|
pageSize: 10,
|
total: 0
|
},
|
// 是否显示所有表单项
|
isShowDetail: false,
|
loading: false
|
}
|
},
|
created() {
|
this.init()
|
},
|
methods: {
|
// 页面初始化处理
|
init() {
|
this.getList()
|
this.setSelectOptions()
|
},
|
|
// 设置表单结果数据
|
setValueInfo(info = {}) {
|
this.valueInfo = info
|
},
|
|
// 获取当前数据列表
|
async getList() {
|
this.loading = true
|
const { valueInfo = {}, pageInfo } = this
|
const res = await pageArchiveDetail({
|
"useType": "01",
|
...valueInfo,
|
...pageInfo
|
})
|
const { records = [], total } = res.result
|
this.loading = false
|
this.records = records.map(item => {
|
return { ...item, buttons: [...recordButtons] }
|
})
|
|
this.pageInfo = {
|
...pageInfo,
|
total
|
}
|
},
|
|
// 更新数据
|
updateValue(value, item) {
|
let { name } = item
|
this.setOrGetFormInfo(name, { value })
|
},
|
|
// 更新表单数据或查找某项数据
|
setOrGetFormInfo(nameKey, newInfo) {
|
let { formInfo } = this
|
let index = formInfo.findIndex(({ name }) => name === nameKey)
|
let result = {}
|
if (!isNaN(index)) {
|
this.$set(this.formInfo, index, { ...formInfo[index], ...newInfo })
|
result = this.formInfo[index]
|
}
|
if (typeof newInfo === 'undefined') {
|
return result
|
}
|
},
|
|
// 设置表单下拉菜单
|
async setSelectOptions() {
|
const { result } = await queryDictionaryByCode({codeNo: 'ItemType'})
|
this.setOrGetFormInfo('archiveType', {
|
options: result
|
})
|
},
|
|
// 获取select中options数据
|
async getDictionaryList(name, info = {}) {
|
const { result } = await getDictionaryList(info)
|
this.setOrGetFormInfo(name, {
|
options: result
|
})
|
},
|
|
// 查询操作
|
onSubmit() {
|
this.pageInfo.currentPage = 1
|
this.getList()
|
},
|
|
// 表单事件回调
|
doAction(name, item, { id, label }) {
|
// 查看详情
|
if (id === 0) {
|
// 跳转到之前贷前的详情 待完善
|
this.$router.push({
|
path: `/comprehensiveTransaction/editProjectContract`,
|
query: {
|
archiveNo: item.archiveNo,
|
archiveName: item.archiveName,
|
type: 'detail'
|
}
|
})
|
}
|
|
// 修改
|
if (id === 1) {
|
this.$router.push({
|
path: `/comprehensiveTransaction/editProjectContract`,
|
query: {
|
archiveNo: item.archiveNo,
|
archiveName: item.archiveName,
|
type: 'edit'
|
}
|
})
|
}
|
|
// 修改
|
if (id === 2) {
|
this.handleDelete(item.archiveNo)
|
}
|
|
},
|
handleAdd() {
|
this.$router.push({
|
path: `/comprehensiveTransaction/editProjectContract`,
|
query: {
|
type: 'add'
|
}
|
})
|
},
|
|
handleDelete(archiveNo) {
|
common.comfirm("提示", "合同删除后不可恢复,请确认是否删除?", () => {
|
delArchiveDetail({ archiveNo: archiveNo }).then(res => {
|
if (res.code === "00") {
|
this.$message.success("删除成功");
|
this.getList()
|
}
|
});
|
});
|
},
|
// 修改翻页条数
|
handleSizeChange(val) {
|
this.pageInfo.pageSize = val
|
this.getList()
|
},
|
|
// 修改翻页数
|
handleCurrentChange(val) {
|
this.pageInfo.currentPage = val
|
this.getList()
|
},
|
}
|
}
|
</script>
|
<style lang="postcss" scoped>
|
.list-content {
|
font-size: 14px;
|
}
|
.export-excle {
|
margin: 20px 0;
|
}
|
</style>
|