约号台账

dev
lilu 2 years ago
parent 921ce8eae7
commit 80ec541c32

@ -0,0 +1,36 @@
import { axios } from '@/utils/request'
/**
* 查询约号台账
*
*/
export function GetParaContractNoPage (parameter) {
return axios({
url: '/Para/GetParaContractNoPage',
method: 'post',
data: parameter
})
}
export function SaveParaContractNoInfo (parameter) {
return axios({
url: '/Para/SaveParaContractNoInfo',
method: 'post',
data: parameter
})
}
export function DeleteParaContractNoInfo (parameter) {
return axios({
url: '/Para/DeleteParaContractNoInfo?Ids=' + parameter,
method: 'post'
})
}
export function GetParaContractNoInfo (parameter) {
return axios({
url: '/Para/GetParaContractNoInfo',
method: 'get',
params: parameter
})
}

@ -0,0 +1,289 @@
<template>
<div>
<a-row :gutter="24">
<a-col :md="24" :sm="24" style="padding: 0 0 0 0" class="content-box">
<x-card>
<div slot="content" class="table-page-search-wrapper">
<a-form layout="inline" :form="form">
<a-row :gutter="48">
<a-col :md="6" :sm="24">
<a-form-item label="合约号编号">
<a-input placeholder="请输入合约号编号" v-decorator="['contractNo', { rules: [{ required: false, message: '' }] }]"/>
</a-form-item>
</a-col>
<a-col :md="6" :sm="24">
<a-form-item label="合约号名称">
<a-input placeholder="请输入合约号名称" v-decorator="['contractName', { rules: [{ required: false, message: '' }] }]"/>
</a-form-item>
</a-col>
<a-col :md="6" :sm="24">
<a-form-item label="创建者名称">
<a-input placeholder="请输入创建者名称" v-decorator="['createUserName', { rules: [{ required: false, message: '' }] }]"/>
</a-form-item>
</a-col>
<a-col :md="6" :sm="24">
<span
class="table-page-search-submitButtons"
style="text-align:right;"
>
<a-button type="primary" @click="tableRefresh"></a-button>
<a-button style="margin-left: 8px" @click="tableReset"></a-button>
</span>
</a-col>
</a-row>
</a-form>
</div>
</x-card>
<x-card class="content-table">
<div slot="content" class="table-page-search-wrapper" :style="{ marginTop: '-8px' }">
<vxe-toolbar>
<template #buttons>
<a-button type="primary" icon="edit" @click="addProject"></a-button>
</template>
<template #tools>
<div class="right">
<span class="tab-btn" @click="tableRefresh">
<a-icon type="redo" :style="{ fontSize: '16px' }" /> 刷新
</span>
</div>
</template>
</vxe-toolbar>
<vxe-grid
ref="xGrid"
v-bind="gridOptions"
row-class-name="line-box"
@page-change="handlePageChange"
style="margin-top: 6px"
>
<template #operate="{ row }">
<vxe-button type="text" icon="vxe-icon-edit" @click="editColumns(row)"></vxe-button>
<vxe-button type="text" icon="vxe-icon-delete" @click="removeColumns(row)"></vxe-button>
</template>
</vxe-grid>
</div>
</x-card>
</a-col>
</a-row>
<add-form ref="addForm" :fromData="addFromData" :type="addFromType" @ok="handleOk"/>
</div>
</template>
<script>
import { XCard } from '@/components'
import initData from './modules/initData'
import columnSetting from '@/components/tableColumnSetting'
import addForm from './modules/addFrom'
import {
GetParaContractNoPage,
SaveParaContractNoInfo,
DeleteParaContractNoInfo,
GetParaContractNoInfo
} from '@/api/modular/main/ContractnoList'
export default {
name: 'BookingLedger',
components: {
XCard,
columnSetting,
addForm
},
data() {
return {
form: this.$form.createForm(this),
setVisible: false,
showColumns: null,
gridOptions: {
border: false,
resizable: true,
showOverflow: true,
loading: true,
round: true,
autoResize: true,
align: 'center',
columnConfig: { resizable: true },
importConfig: {},
exportConfig: {},
pagerConfig: {
total: 0,
currentPage: 1,
pageSize: 10,
pageSizes: [10, 20, 50, 100, 200, 500]
},
columns: JSON.parse(JSON.stringify(initData.columns)),
data: []
},
addFromData: {},
addFromType: 'add',
}
},
created() {
this.showColumns = JSON.parse(JSON.stringify(initData.columns))
this.getList()
},
mounted() {},
methods: {
init (queryParam = {}) {
this.gridOptions.pagerConfig = {
total: 0,
currentPage: 1,
pageSize: 10,
pageSizes: [10, 20, 50, 100, 200, 500]
}
this.gridOptions.data = []
this.getList(queryParam)
},
handlePageChange ({ currentPage, pageSize }) {
console.log(currentPage, pageSize)
const { form: { validateFields } } = this
validateFields((err, values) => {
if (!err) {
if (values.createdTime) {
const time = values.createdTime.map((item, index) => {
const str = this.dateFtt('YYYY-MM-DD', item._d)
return str
})
console.log(time)
values.createdTime = time
}
if (values.updataTime) {
const _time = values.updataTime.map((item, index) => {
const str = this.dateFtt('YYYY-MM-DD', item._d)
return str
})
console.log(_time)
values.updataTime = _time
}
this.gridOptions.pagerConfig.currentPage = currentPage
this.gridOptions.pagerConfig.pageSize = pageSize
this.getList(values)
}
})
},
getList (queryParam = {}) {
const { currentPage, pageSize } = this.gridOptions.pagerConfig
GetParaContractNoPage({
contractNo: queryParam.contractNo,
contractName: queryParam.contractName,
createUserName: queryParam.createUserName,
pageNo: currentPage,
pageSize: pageSize
}).then(res => {
const _data = res.data.items.map((item, index) => {
item.row_id = (currentPage - 1) * pageSize + index
return item
})
this.$set(this.gridOptions.pagerConfig, 'total', res.data.totalCount)
this.$set(this.gridOptions, 'data', JSON.parse(JSON.stringify(_data)))
this.$set(this.gridOptions, 'loading', false)
this.$forceUpdate()
}).catch(err => {
console.log(err)
})
},
editColumns (data) {
this.addFromType = 'edit'
this.addFromId = data.id
GetParaContractNoInfo({
id: this.addFromId
}).then(res => {
if (res.success) {
this.addFromData = res.data
console.log(this.addFromData)
this.$refs.addForm.add()
} else {
this.$message.error(res.msg)
}
})
},
removeColumns (data) {
DeleteParaContractNoInfo(data.id).then(res => {
if (res.success) {
this.$message.success('删除成功')
this.init()
} else {
this.$message.error(res.msg)
}
})
},
addProject () {
this.addFromData = {}
this.addFromType = 'add'
this.addFromId = ''
this.$refs.addForm.add()
},
columnChange (data) {
const arr = []
data.map((item, index) => {
if (item.checked) {
arr.push(item)
}
})
this.showColumns = []
this.showColumns = arr
this.gridOptions.columns = arr
this.$forceUpdate()
},
confirmRemove (e) {
console.log(e)
const select = this.$refs.xGrid.getCheckboxRecords()
const pkIdArr = select.map((item, index) => {
return Number(item.id)
})
console.log(pkIdArr)
debugger
DeleteParaContractNoInfo(pkIdArr).then(res => {
if (res.success) {
this.$message.success('删除成功')
this.init()
} else {
this.$message.error(res.msg)
}
})
},
cancelRemove (e) {
console.log(e)
this.$message.error('取消操作')
},
handleOk () {
const form = this.$refs.addForm.form
form.validateFields((errors, values) => {
if (!errors) {
console.log('values', values)
debugger
SaveParaContractNoInfo({
id: this.addFromId,
contractNo: values.contractNo,
contractName: values.contractName,
contractNote: values.contractNote
}).then(res => {
this.$refs.addForm.$data.confirmLoading = false
if (res.success) {
this.$message.success('保存成功')
this.$refs.addForm.handleCancel()
this.init()
} else {
this.$message.error(res.msg)
}
}).catch((err) => {
console.log(err)
})
}
})
},
tableRefresh() {
const { form: { validateFields } } = this
validateFields((err, values) => {
if (!err) {
this.init(values)
}
})
},
tableReset () {
this.form.resetFields()
this.init()
},
tableHeaderEdit() {},
},
}
</script>

@ -0,0 +1,128 @@
<template>
<a-modal
:title="`规则项目编辑(${type=='edit' ? '修改' : '新增'}`"
:width="900"
:visible="visible"
:confirmLoading="confirmLoading"
cancelText="关闭"
okText="保存"
@ok="handleSubmit"
@cancel="handleCancel"
>
<a-spin :spinning="formLoading">
<a-form :form="form">
<a-row :gutter="16">
<a-col :span="12">
<a-form-item
label="合约号编号"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
has-feedback
>
<a-input placeholder="请输入合约号编号" v-decorator="['contractNo', {rules: [{required: true, message: ''}]}]" />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item
label="合约号名称"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
has-feedback
>
<a-input placeholder="请输入合约号名称" v-decorator="['contractName', {rules: [{required: true, message: ''}]}]" />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item
label="合约号备注"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
has-feedback
>
<a-textarea :rows="4" placeholder="请输入合约号备注" v-decorator="['contractNote']"></a-textarea>
</a-form-item>
</a-col>
</a-row>
</a-form>
</a-spin>
</a-modal>
</template>
<script>
export default {
props: {
type: {
type: String,
default: 'add'
},
fromData: {
type: Object,
default: null
}
},
data () {
return {
labelCol: {
xs: { span: 24 },
sm: { span: 5 }
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 15 }
},
visible: false,
confirmLoading: false,
formLoading: true,
form: this.$form.createForm(this)
}
},
watch: {
fromData: {
handler (nval, oval) {
if (!this.formLoading) {
this.$nextTick(() => {
this.form.setFieldsValue(nval)
})
}
},
deep: true
}
},
methods: {
add () {
this.visible = true
this.formLoading = false
},
handleSubmit () {
const { form: { validateFields } } = this
this.confirmLoading = true
validateFields((errors, values) => {
if (!errors) {
this.$emit('ok', values)
} else {
this.confirmLoading = false
}
})
},
handleCancel () {
this.form.resetFields()
this.visible = false
}
}
}
</script>
<style lang="less" scoped>
.line{
height: 30px;
line-height:30px;
text-align: right;
font-size: 14px;
span{
margin-left: 20px;
}
span:nth-of-type(2){
width: 120px;
display: inline-block;
text-align: left;
}
}
</style>

@ -0,0 +1,10 @@
export default {
columns: [
{ type: 'seq', width: 60, noDraggable: true },
{ field: 'contractNo', title: '合约号编号', showHeaderOverflow: true, sortable: true },
{ field: 'contractName', title: '合约号名称', showHeaderOverflow: true, sortable: true },
{ field: 'contractNote', title: '合约号备注', showHeaderOverflow: true, sortable: true },
{ field: 'createUserName', title: '创建者名称', showHeaderOverflow: true, sortable: true },
{ field: 'operate', title: '操作', width: 150, noDraggable: true, slots: { default: 'operate' }, fixed: 'right', resizable: false }
]
}
Loading…
Cancel
Save