Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
柳 佳乐
finance
Commits
7ec49759
Commit
7ec49759
authored
Nov 08, 2022
by
cx49085
Browse files
合同管理
parent
a26f9114
Changes
9
Hide whitespace changes
Inline
Side-by-side
finance
@
6e137f66
Subproject commit 6e137f66e7646a55ebb0681483b9c502249d0d84
src/api/contract.js
0 → 100644
View file @
7ec49759
import
request
from
'
@/utils/request
'
/************* 合同类型管理 ************/
// 合同类型
export
function
selectContractTypeList
(
data
)
{
return
request
({
url
:
'
/contractType/queryBypage
'
,
method
:
'
post
'
,
data
})
}
// 所有合同类型
export
function
selectAllContractTypeList
(
data
)
{
return
request
({
url
:
'
/contractType/selectAll
'
,
method
:
'
post
'
,
data
})
}
// 增加合同类型
export
function
addContractType
(
data
)
{
return
request
({
url
:
'
/contractType/insertBatch
'
,
method
:
'
post
'
,
data
})
}
// 更新合同类型
export
function
updateContractType
(
data
)
{
return
request
({
url
:
'
/contractType/update
'
,
method
:
'
post
'
,
data
})
}
/************* 合同管理 ************/
// 获取合同列表
export
function
selectContractList
(
data
)
{
return
request
({
url
:
'
/contract/queryBypage
'
,
method
:
'
post
'
,
data
})
}
// 获取全部合同列表
export
function
selectAllContractList
(
data
)
{
return
request
({
url
:
'
/contract/selectAll
'
,
method
:
'
post
'
,
data
})
}
// 增加合同
export
function
addContract
(
data
)
{
return
request
({
url
:
'
/contract/insert
'
,
method
:
'
post
'
,
data
})
}
// 获取某一个合同
export
function
getContractById
(
data
)
{
return
request
({
url
:
'
/contract/selectByContractId
'
,
method
:
'
post
'
,
data
})
}
// 更新某一个合同
export
function
updateContract
(
data
)
{
return
request
({
url
:
'
/contract/update
'
,
method
:
'
post
'
,
data
})
}
// 删除某一个合同
export
function
deleteContract
(
data
)
{
return
request
({
url
:
'
/contractFile/delete
'
,
method
:
'
post
'
,
data
})
}
//获取合同中的合同文件
export
function
selectContractFiles
(
data
)
{
return
request
({
url
:
'
/contractFile/selectByContractId
'
,
method
:
'
post
'
,
data
})
}
\ No newline at end of file
src/router/index.js
View file @
7ec49759
...
...
@@ -85,6 +85,7 @@ export const componentMap = {
'
contract_list
'
:()
=>
import
(
'
@/views/contract/contractList
'
).
then
(
m
=>
m
.
default
),
'
contract_type
'
:()
=>
import
(
'
@/views/contract/contractType
'
).
then
(
m
=>
m
.
default
),
'
add_contract
'
:()
=>
import
(
'
@/views/contract/components/addContract
'
).
then
(
m
=>
m
.
default
),
}
...
...
src/styles/element-ui.scss
View file @
7ec49759
...
...
@@ -11,6 +11,21 @@
}
}
.el-contract-upload
{
//.el-upload-list--picture-card .el-upload-list__item
.el-upload--picture-card
{
width
:
60px
;
height
:
60px
;
line-height
:
70px
;
}
.el-contract-upload
,
.el-upload-list--picture-card
{
.el-upload-list__item
{
width
:
auto
;
height
:
60px
;
}
}
}
.el-upload__input
{
display
:
none
;
}
...
...
@@ -82,3 +97,12 @@
.el-range-separator
{
box-sizing
:
content-box
;
}
.contract-description-form
{
.required
{
&
::after
{
content
:
'*'
;
color
:
red
;
}
}
}
src/utils/download.js
0 → 100644
View file @
7ec49759
/**
* @param {string} url
* @param {string} fileName
*/
import
axios
from
'
axios
'
export
const
downloadPDFFile
=
function
(
url
,
fileName
)
{
axios
({
method
:
'
get
'
,
url
,
responseType
:
'
blob
'
}).
then
((
res
)
=>
{
// console.log('headers', res.headers)
// handle(res.data, fileName)
if
(
!
res
.
data
)
{
return
}
let
url
=
window
.
URL
.
createObjectURL
(
new
Blob
([
res
.
data
],
{
type
:
'
application/pdf
'
}))
const
a
=
document
.
createElement
(
'
a
'
)
a
.
style
.
display
=
'
none
'
a
.
download
=
fileName
a
.
href
=
url
a
.
click
()
if
(
document
.
body
.
contains
(
a
))
{
document
.
body
.
removeChild
(
a
)
}
})
}
\ No newline at end of file
src/views/contract/components/addContract.vue
0 → 100644
View file @
7ec49759
<
template
>
<!--
<el-drawer
:visible.sync=
"drawerVisible"
size=
"75%"
:with-header=
"false"
@
closed=
"closeDrawer"
>
-->
<div>
<div
class=
"header"
>
{{
isEdit
?
'
编辑合同
'
:
'
新增合同
'
}}
<!--
<i
class=
"el-icon-close"
@
click=
"closeDrawer"
></i>
-->
</div>
<div
class=
"container"
>
<el-form>
<el-descriptions
:column=
"3"
border
class=
"contract-description-form"
>
<el-descriptions-item
label=
"母合同名称"
:span=
"3"
v-if=
"formData.contractNature === '2'"
>
<el-select
v-model=
"formData.contractParent"
:style=
"
{ width: '100%' }" placeholder="请选择母合同名称">
<el-option
v-for=
"(item, index) in contractParentList"
:key=
"item.contractId"
:value=
"item.contractId"
:label=
"item.name"
></el-option>
</el-select>
</el-descriptions-item>
<el-descriptions-item
label=
"合同名称"
:span=
"2"
labelClassName=
"required"
content-class-name=
"my-content"
>
<el-input
placeholder=
"请输入合同名称"
v-model=
"formData.contractName"
></el-input>
</el-descriptions-item>
<el-descriptions-item
label=
"合同性质"
labelClassName=
"required"
>
{{
contractNatures
[
formData
.
contractNature
]
}}
</el-descriptions-item>
<el-descriptions-item
label=
"合同乙方"
labelClassName=
"required"
>
<el-input
placeholder=
"请输入合同名称合同乙方"
v-model=
"formData.contractPaetyb"
></el-input>
</el-descriptions-item>
<el-descriptions-item
label=
"合同编号"
labelClassName=
"required"
>
<el-input
placeholder=
"请输入合同编号"
v-model=
"formData.contractNumber"
></el-input>
</el-descriptions-item>
<el-descriptions-item
label=
"合同类型"
labelClassName=
"required"
>
<el-select
v-model=
"formData.typeId"
:style=
"
{ width: '100%' }" placeholder="请选择合同类型">
<el-option
v-for=
"(item, index) in contractTypeList"
:key=
"item.id"
:value=
"item.id"
:label=
"item.name"
></el-option>
</el-select>
</el-descriptions-item>
<el-descriptions-item
label=
"客户名称(甲方)"
labelClassName=
"required"
>
<el-input
placeholder=
"请输入客户名称(甲方)"
v-model=
"formData.contractFirstParty"
></el-input>
</el-descriptions-item>
<el-descriptions-item
label=
"甲方签订人"
labelClassName=
"required"
>
<el-input
placeholder=
"请输入甲方签订人"
v-model=
"formData.firstParty"
></el-input>
</el-descriptions-item>
<el-descriptions-item
label=
"客户联系电话"
labelClassName=
"required"
>
<el-input
placeholder=
"请输入客户联系电话"
v-model=
"formData.firstPartyPhone"
></el-input>
</el-descriptions-item>
<el-descriptions-item
label=
"客户联系地址"
labelClassName=
"required"
>
<el-input
placeholder=
"请输入客户联系地址"
v-model=
"formData.firstPartyAddress"
></el-input>
</el-descriptions-item>
<el-descriptions-item
label=
"合同开始日期"
labelClassName=
"required"
>
<el-date-picker
align=
"right"
type=
"datetime"
:style=
"
{ width: '100%' }" placeholder="请输入合同签订时间"
format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss"
v-model="formData.contractStartTime">
</el-date-picker>
</el-descriptions-item>
<el-descriptions-item
label=
"合同结束日期"
labelClassName=
"required"
>
<el-date-picker
align=
"right"
type=
"datetime"
:style=
"
{ width: '100%' }" placeholder="请输入合同签订时间"
v-model="formData.contractEndTime" format="yyyy-MM-dd HH:mm:ss"
value-format="yyyy-MM-dd HH:mm:ss">
</el-date-picker>
</el-descriptions-item>
<el-descriptions-item
label=
"合同金额"
labelClassName=
"required"
>
<el-input
placeholder=
"请输入合同金额"
type=
"number"
v-model=
"formData.contractMoney"
step=
“0.01”
>
</el-input>
</el-descriptions-item>
<el-descriptions-item
label=
"是否含税"
labelClassName=
"required"
>
<el-radio-group
v-model=
"formData.tax"
>
<el-radio
label=
"0"
>
含税
</el-radio>
<el-radio
label=
"1"
>
不含税
</el-radio>
</el-radio-group>
</el-descriptions-item>
<el-descriptions-item
label=
"税点"
labelClassName=
"required"
>
<el-input
placeholder=
"请输入税点"
type=
"number"
v-model=
"formData.taxPoint"
min=
“0.00”
step=
“0.01”
>
</el-input>
</el-descriptions-item>
<el-descriptions-item
label=
"合同附件"
>
<el-upload
ref=
"uploadContractFile"
list-type=
"picture-card"
:action=
"action"
:file-list=
"fileList"
:data=
"fileParams"
:auto-upload=
"false"
:on-change=
"uploadOnchange"
multiple
accept=
'.pdf'
class=
'el-contract-upload'
>
<i
slot=
"default"
class=
"el-icon-plus"
></i>
<div
slot=
"file"
slot-scope=
"
{file}" class="file-list">
<div
class=
"avator"
><i
class=
"el-icon-document"
></i></div>
<div
class=
"file-content"
:title=
"file.name"
>
{{
file
.
name
}}
</div>
<div
class=
"file-operate"
>
<span
class=
""
@
click=
"handleDownload(file)"
>
<i
class=
"el-icon-download"
></i>
</span>
<span
class=
""
@
click=
"handleRemove(file)"
>
<i
class=
"el-icon-delete"
></i>
</span>
</div>
</div>
<!--
<div
class=
"el-upload__text"
>
将文件拖到此处,或
<em>
点击上传
</em></div>
<div
class=
"el-upload__tip"
slot=
"tip"
>
只能上传pdf文件,且不超过500kb
</div>
-->
</el-upload>
</el-descriptions-item>
</el-descriptions>
<div
class=
"cell-border"
:style=
"
{ borderBottom: 0 }">
签订信息
</div>
<el-descriptions
:column=
"3"
border
class=
"contract-description-form"
>
<el-descriptions-item
label=
"乙方签订人"
labelClassName=
"required"
>
<el-input
placeholder=
"请输入乙方签订人"
v-model=
"formData.partybName"
></el-input>
</el-descriptions-item>
<el-descriptions-item
label=
"合同签订时间"
labelClassName=
"required"
>
<el-date-picker
v-model=
"formData.signingTime"
align=
"right"
type=
"datetime"
placeholder=
"请输入合同签订时间"
format=
"yyyy-MM-dd HH:mm:ss"
value-format=
"yyyy-MM-dd HH:mm:ss"
>
</el-date-picker>
</el-descriptions-item>
<el-descriptions-item
label=
"合同制定人"
labelClassName=
"required"
>
<el-input
placeholder=
"请输入合同制定人"
v-model=
"formData.preparedBy"
></el-input>
</el-descriptions-item>
<el-descriptions-item
label=
"合同保管人"
labelClassName=
"required"
>
<el-input
placeholder=
"请输入合同保管人"
v-model=
"formData.safekeeping"
></el-input>
</el-descriptions-item>
</el-descriptions>
<div
class=
"cell-border"
>
备注
</div>
<div
class=
"cell-border"
>
<el-input
type=
"textarea"
v-model=
"formData.contarctRemarks"
></el-input>
</div>
<br
/>
<el-form-item>
<el-button
type=
"primary"
@
click=
"addContract"
>
{{
!
isEdit
?
'
立即创建
'
:
'
修改
'
}}
</el-button>
<!--
<el-button
@
click=
"closeDrawer"
>
取消
</el-button>
-->
</el-form-item>
</el-form>
</div>
<!--
</el-drawer>
-->
</div>
</
template
>
<
script
>
import
{
selectAllContractTypeList
,
selectAllContractList
,
addContract
,
getContractById
,
updateContract
,
selectContractFiles
,
deleteContract
}
from
'
@/api/contract
'
import
{
deepClone
}
from
'
@/utils
'
import
{
contractNatures
}
from
'
../contractStaticData
'
import
{
mapGetters
}
from
'
vuex
'
import
{
downloadPDFFile
}
from
'
@/utils/download
'
export
default
{
// props: ['drawerVisible'],
data
()
{
return
{
// checkedContractNature: this.$route.query.contractNature,
formData
:
{
firstParty
:
''
,
contractName
:
''
,
contractNature
:
this
.
$route
.
query
.
checkedContractNature
,
contarctRemarks
:
'
'
,
contractStartTime
:
''
,
contractFirstParty
:
''
,
contractMoney
:
0
,
contractNumber
:
''
,
contractPaetyb
:
''
,
contractEndTime
:
''
,
signingTime
:
''
,
partybName
:
''
,
taxPoint
:
''
,
tax
:
'
0
'
,
typeId
:
''
,
safekeeping
:
''
,
firstPartyAddress
:
''
,
preparedBy
:
''
,
firstPartyPhone
:
''
,
contractParent
:
''
},
fileList
:
[],
fileParams
:
{},
contractTypeList
:
[],
contractParentList
:
[],
contractNatures
:
deepClone
(
contractNatures
),
isEdit
:
false
,
action
:
''
,
}
},
computed
:
{
...
mapGetters
([
'
companyId
'
])
},
watch
:
{
'
$route.query.checkedContractNature
'
:
function
()
{
this
.
$route
.
query
.
checkedContractNature
&&
(
this
.
formData
.
contractNature
=
this
.
$route
.
query
.
checkedContractNature
);
}
},
created
()
{
this
.
action
=
process
.
env
.
VUE_APP_BASE_API
+
'
/file/updataContractDocuments
'
},
mounted
()
{
const
{
contractId
}
=
this
.
$route
.
query
this
.
getContractTypeList
()
//获取合同类型
this
.
getContractFiles
(
contractId
)
//获取合同文件
// 编辑
if
(
this
.
$route
.
path
.
indexOf
(
'
/editContract
'
)
>=
0
&&
contractId
)
{
this
.
isEdit
=
true
;
this
.
getContractDetail
(
contractId
)
// getCon
// 添加
}
else
if
(
this
.
$route
.
path
.
indexOf
(
'
/addContract
'
)
>=
0
&&
this
.
$route
.
query
.
checkedContractNature
!==
undefined
)
{
this
.
isEdit
=
false
;
if
(
this
.
$route
.
query
.
checkedContractNature
.
toString
()
===
'
2
'
)
{
this
.
getParentContractList
()
//获取母合同列表
}
else
{
}
}
else
{
this
.
$router
.
back
()
}
},
methods
:
{
// closeDrawer() {
// this.$emit('closeDrawer')
// },
getParentContractList
()
{
const
params
=
{
companyId
:
this
.
companyId
||
this
.
$store
.
getters
.
companyId
}
selectAllContractList
(
params
).
then
(
res
=>
{
if
(
res
.
success
)
{
// console.log(res.data)
this
.
contractParentList
=
res
.
data
}
else
{
this
.
$message
.
warning
(
"
获取合同类型失败
"
)
}
})
},
addContract
()
{
let
validRes
=
this
.
validFormData
()
if
(
validRes
.
length
)
{
this
.
$message
.
warning
(
"
带 * 号必填,请正确填写信息
"
)
return
}
const
params
=
{
companyId
:
this
.
companyId
||
this
.
$store
.
getters
.
companyId
,
...
this
.
formData
}
const
toNumberKeys
=
[
'
contractNature
'
,
'
contractParent
'
,
'
contractMoney
'
]
toNumberKeys
.
forEach
(
key
=>
{
params
[
key
]
=
Number
(
params
[
key
])
})
!
this
.
formData
.
contarctRemarks
&&
(
params
.
contarctRemarks
=
'
'
)
if
(
!
this
.
isEdit
)
{
addContract
(
params
).
then
(
res
=>
{
if
(
res
.
success
)
{
this
.
$message
.
success
(
"
成功添加合同
"
)
this
.
addContractFile
(
res
.
id
)
// setTimeout(() => {
// this.$router.push({path: '/contractList'})
// }, 1500);
}
else
{
this
.
$message
.
warning
(
"
添加合同失败
"
)
}
})
}
else
{
this
.
addContractFile
(
this
.
formData
.
contractId
)
updateContract
(
params
).
then
(
res
=>
{
if
(
res
.
success
)
{
this
.
$message
.
success
(
"
成功修改合同
"
)
setTimeout
(()
=>
{
// this.$router.push({path: '/contractList'})
},
1500
);
}
else
{
this
.
$message
.
warning
(
"
添加修改失败
"
)
}
})
}
},
uploadOnchange
(
file
,
fileList
)
{
console
.
log
(
file
,
fileList
)
},
addContractFile
(
contractId
)
{
this
.
fileParams
.
Id
=
String
(
contractId
)
this
.
$refs
.
uploadContractFile
.
submit
()
},
getContractTypeList
()
{
const
params
=
{
state
:
0
,
companyId
:
this
.
companyId
||
this
.
$store
.
getters
.
companyId
}
selectAllContractTypeList
(
params
).
then
(
res
=>
{
if
(
res
.
success
)
{
// console.log(res.data)
this
.
contractTypeList
=
res
.
data
}
else
{
this
.
$message
.
warning
(
"
获取合同类型失败
"
)
}
})
},
getContractDetail
(
contractId
)
{
if
(
contractId
)
{
const
params
=
{
contractId
}
getContractById
(
params
).
then
(
res
=>
{
if
(
res
.
success
)
{
// console.log(res.data)
if
(
res
.
data
.
contractNature
.
toString
()
===
'
2
'
)
{
this
.
getParentContractList
()
}
this
.
formData
=
res
.
data
}
else
{
this
.
$message
.
warning
(
"
获取合同失败
"
)
}
})
// get()
}
},
getContractFiles
(
contractId
)
{
const
params
=
{
contractId
}
selectContractFiles
(
params
).
then
(
res
=>
{
if
(
res
.
success
)
{
this
.
fileList
=
res
.
data
.
map
(
item
=>
{
item
.
name
=
item
.
filePath
.
slice
(
item
.
filePath
.
lastIndexOf
(
'
/
'
)
+
1
,
item
.
filePath
.
length
)
return
item
})
}
else
{
this
.
fileList
=
[]
}
})
},
handleDownload
(
file
)
{
let
{
name
,
filePath
}
=
file
let
url
=
process
.
env
.
VUE_APP_BASE_API
+
filePath
;
downloadPDFFile
(
url
,
name
)
},
handleRemove
(
file
)
{
deleteContract
(
file
).
then
(
res
=>
{
if
(
res
.
success
){
this
.
$message
.
success
(
"
成功删除合同文件
"
)
this
.
getContractFiles
(
file
.
contractId
)
}
else
{
this
.
$message
.
warning
(
"
删除合同文件失败
"
)
}
})
},
validFormData
()
{
let
requiredParams
=
deepClone
(
this
.
formData
);
delete
requiredParams
.
contractParentName
let
result
=
[]
delete
requiredParams
.
contarctRemarks
if
(
!
this
.
$route
.
query
.
checkedContractNature
||
this
.
$route
.
query
.
checkedContractNature
.
toString
()
!==
'
2
'
){
delete
requiredParams
.
contractParent
//非母合同
}
for
(
const
key
in
requiredParams
)
{
if
(
!
requiredParams
[
key
]){
result
.
push
(
key
)
}
}
return
result
}
}
}
</
script
>
<
style
rel=
"stylesheet/scss"
scoped
lang=
"scss"
>
.header
{
padding
:
25px
15px
;
i
{
float
:
right
;
color
:
gray
;
cursor
:
pointer
;
}
}
.container
{
padding
:
0
15px
;
.cell-border
{
border
:
1px
solid
#e6ebf5
;
border-top
:
0
;
// border-bottom: 0;
padding
:
12px
10px
;
font-weight
:
600
;
font-size
:
14px
;
}
}
.file-list
{
display
:
flex
;
justify-content
:
flex-start
;
align-items
:
center
;
width
:
250px
;
padding
:
0
5px
;
.avator
{
width
:
10%
;
font-size
:
32px
;
color
:
#d75b5b
;
}
.file-content
{
width
:
80%
;
overflow
:
hidden
;
text-overflow
:
ellipsis
;
white-space
:
nowrap
;
padding-left
:
10px
;
}
.file-operate
{
width
:
15%
;
font-size
:
16px
;
display
:
flex
;
justify-content
:
space-around
;
align-items
:
center
;
span
{
cursor
:
pointer
;
}
}
}
</
style
>
\ No newline at end of file
src/views/contract/contractList.vue
View file @
7ec49759
<
template
>
<div
class=
"main"
>
<div
class=
"header"
>
<el-form
:inline=
"true"
:model=
"co
mpanyQure
y"
>
<el-form
:inline=
"true"
:model=
"co
ntractQuer
y"
>
<el-form-item>
<el-select
v-model=
"type"
placeholder=
"合同类别"
>
<el-option
...
...
@@ -35,7 +35,7 @@
<el-form-item>
<el-button
type=
"primary"
icon=
"el-icon-search"
@
click=
"qurey()"
>
查询
</el-button>
<el-button
type=
"primary"
icon=
"el-icon-refresh-right"
@
click=
"reset()"
>
重置
</el-button>
<el-button
type=
"success"
icon=
"el-icon-circle-plus-outline"
@
click=
"
addcompany()
"
>
添加合同
</el-button>
<el-button
type=
"success"
icon=
"el-icon-circle-plus-outline"
@
click=
"
dialogTableVisible = true
"
>
添加合同
</el-button>
</el-form-item>
</el-form>
</div>
...
...
@@ -44,30 +44,124 @@
:data=
"contractList"
style=
"width: 100%;text-align: center;"
border
>
<el-table-column
label=
"编号"
width=
"50px"
/>
<el-table-column
prop=
"companyName"
label=
"状态"
/>
<el-table-column
prop=
"companyAddress"
label=
"合同编号"
width=
"150px"
/>
<el-table-column
prop=
"companyPhone"
label=
"合同名称"
/>
<el-table-column
prop=
"companyCreateTime"
label=
"合同类别"
/>
<el-table-column
prop=
"companyInformation"
label=
"合同性质"
/>
<el-table-column
prop=
"companyCreateTime"
label=
"合同金额/元"
/>
<el-table-column
prop=
"companyCreateTime"
label=
"签定人"
/>
<el-table-column
prop=
"companyCreateTime"
label=
"保管人"
/>
<el-table-column
prop=
"companyCreateTime"
label=
"签订时间"
/>
<el-table-column
prop=
"companyCreateTime"
label=
"操作"
/>
<el-table-column
label=
"编号"
width=
"50px"
>
<template
slot-scope=
"scope"
>
{{
(
contractQuery
.
pageNum
-
1
)
*
contractQuery
.
pageSize
+
scope
.
$index
+
1
}}
</
template
>
</el-table-column>
<!-- <el-table-column prop="companyName" label="状态"/> -->
<el-table-column
prop=
"contractNumber"
label=
"合同编号"
width=
"120px"
/>
<el-table-column
prop=
"contractName"
label=
"合同名称"
width=
"200px"
/>
<el-table-column
label=
"合同类别"
>
<
template
slot-scope=
"scope"
>
<!--
{{
Object
.
values
(
contractTypeList
.
find
(
item
=>
item
.
id
===
scope
.
row
.
typeId
)).
toString
()
}}
-->
{{
contractTypeList
.
find
(
item
=>
item
.
id
===
scope
.
row
.
typeId
)
&&
contractTypeList
.
find
(
item
=>
item
.
id
=
scope
.
row
.
typeId
).
name
}}
</
template
>
</el-table-column>
<el-table-column
prop=
"contractNature"
label=
"合同性质"
>
<
template
slot-scope=
"scope"
>
{{
contractNatures
[
scope
.
row
.
typeId
]
}}
</
template
>
</el-table-column>
<el-table-column
prop=
"contractMoney"
label=
"合同金额/元"
/>
<el-table-column
prop=
"partybName"
label=
"签定人"
width=
"100px"
/>
<el-table-column
prop=
"safekeeping"
label=
"保管人"
width=
"100px"
/>
<el-table-column
prop=
"contractStartTime"
label=
"签订时间"
/>
<el-table-column
prop=
"companyCreateTime"
label=
"操作"
>
<
template
slot-scope=
"scope"
>
<el-button
type=
"text"
icon=
"el-icon-edit"
@
click=
"$router.push(
{path: '/editContract', query: {contractId: String(scope.row.contractId)}})">编辑
</el-button>
</
template
>
</el-table-column>
</el-table>
</div>
<div
class=
"footer"
>
<el-pagination
@
current-change=
"getContractList"
:current-page.sync=
"contractQuery.pageNum"
:page-size=
"contractQuery.pageSize"
layout=
"total, prev, pager, next"
:total=
"total"
>
</el-pagination>
</div>
<el-dialog
title=
"添加合同"
:visible.sync=
"dialogTableVisible"
>
<el-radio-group
v-model=
"checkedContractNature"
>
<el-radio
v-for=
"(item, index) in contractNatures"
:key=
"index"
:label=
"index"
>
{{item}}
</el-radio>
</el-radio-group>
<span
slot=
"footer"
class=
"dialog-footer"
>
<el-button
type=
"primary"
@
click=
"$router.push({path: '/addContract', query: {checkedContractNature: String(checkedContractNature)}})"
>
下一步
</el-button>
<el-button
@
click=
"dialogVisible = false"
>
取消
</el-button>
</span>
</el-dialog>
<!-- <add-conctract :drawerVisible="drawerVisible" @addConctract="addConctract" @closeDrawer="drawerVisible=false"></add-conctract> -->
</div>
</template>
<
script
>
// import AddConctract from './components/addContract.vue'
import
{
selectContractList
,
selectAllContractTypeList
}
from
"
@/api/contract
"
import
{
deepClone
}
from
"
@/utils
"
import
{
mapGetters
}
from
'
vuex
'
import
{
contractNatures
as
contractNatureList
}
from
'
./contractStaticData
'
export
default
{
// components: {
// AddConctract
// },
computed
:
{
...
mapGetters
([
'
companyId
'
]),
},
data
()
{
return
{
co
mpanyQure
y
:
{},
co
ntractQuer
y
:
{},
contractList
:
[],
contractTypeList
:
[],
typeList
:
[],
type
:
''
type
:
''
,
total
:
0
,
contractQuery
:
{
pageSize
:
10
,
pageNum
:
1
,
},
contractNatures
:
deepClone
(
contractNatureList
),
dialogTableVisible
:
false
,
checkedContractNature
:
0
// drawerVisible: false,
}
},
mounted
(){
this
.
getContractTypeList
()
this
.
getContractList
()
},
methods
:
{
getContractTypeList
()
{
const
params
=
{
state
:
0
,
companyId
:
this
.
companyId
||
this
.
$store
.
getters
.
companyId
}
selectAllContractTypeList
(
params
).
then
(
res
=>
{
if
(
res
.
success
)
{
// console.log(res.data)
this
.
contractTypeList
=
res
.
data
}
else
{
this
.
$message
.
warning
(
"
获取合同类型失败
"
)
}
})
},
getContractList
()
{
const
params
=
{
...
this
.
contractQuery
,
companyId
:
this
.
companyId
||
this
.
$store
.
getters
.
companyId
}
selectContractList
(
params
).
then
(
res
=>
{
if
(
res
.
success
){
this
.
total
=
res
.
data
.
total
this
.
contractList
=
res
.
data
.
list
}
else
{
this
.
$message
.
error
(
"
获取数据失败
"
)
}
})
},
addConctract
(
params
)
{
console
.
log
(
params
)
}
}
}
...
...
src/views/contract/contractStaticData.js
0 → 100644
View file @
7ec49759
export
const
contractNatures
=
[
'
普通合同
'
,
'
框架合同
'
,
'
补充协议
'
,
'
其它合同
'
]
\ No newline at end of file
src/views/contract/contractType.vue
View file @
7ec49759
<
template
>
<div
class=
"main"
>
<div
class=
"header"
>
<el-button
type=
"success"
icon=
"el-icon-circle-plus-outline"
@
click=
"addcompany()"
>
添加类型
</el-button>
<el-button
type=
"success"
icon=
"el-icon-circle-plus-outline"
@
click=
"dialogFormVisible = true;"
>
添加类型
</el-button>
</div>
<div
class=
"container"
>
<el-table
:data=
"contractList"
style=
"width: 100%;text-align: center;"
border
>
<el-table-column
label=
"编号"
width=
"50px"
/>
<el-table-column
prop=
"companyName"
label=
"类别名称"
/>
<el-table-column
prop=
"companyAddress"
label=
"状态"
width=
"50px"
/>
<el-table-column
prop=
"companyPhone"
label=
"操作"
width=
"150px"
/>
<el-table
:data=
"contractTypeList"
style=
"width: 100%;text-align: center;"
border
>
<el-table-column
label=
"序号"
width=
"50px"
>
<template
slot-scope=
"scope"
>
{{
(
contractTypeQuey
.
pageNum
-
1
)
*
contractTypeQuey
.
pageSize
+
scope
.
$index
+
1
}}
</
template
>
</el-table-column>
<el-table-column
prop=
"name"
label=
"类别名称"
/>
<el-table-column
prop=
"state"
label=
"启用状态"
width=
"100px"
>
<
template
slot-scope=
"scope"
>
<el-switch
v-model=
"scope.row.state"
@
change=
"update(
{ ...scope.row, state: Math.abs(scope.row.state - 1) })"
active-color="#13ce66" inactive-color="#ff4949">
</el-switch>
</
template
>
</el-table-column>
<el-table-column
label=
"操作"
width=
"100px"
>
<
template
slot-scope=
"scope"
>
<el-button
type=
"text"
icon=
"el-icon-edit"
@
click=
"edit(scope.row)"
>
编辑
</el-button>
</
template
>
</el-table-column>
</el-table>
</div>
<div
class=
"footer"
>
<el-pagination
@
current-change=
"getContractTypeList"
:current-page.sync=
"contractTypeQuey.pageNum"
:page-size=
"contractTypeQuey.pageSize"
layout=
"total, prev, pager, next"
:total=
"total"
>
</el-pagination>
</div>
<el-dialog
:title=
"(isEdit ? '修改' : '添加') + '合同类型'"
:visible.sync=
"dialogFormVisible"
@
closed=
"resetData"
>
<el-form
ref=
"form"
:model=
"dynamicValidateForm"
label-width=
"130px"
>
<el-form-item
label=
"合同类型名称"
prop=
"name"
:rules=
"[{ required: true, message: '请输入合同类型名称'}]"
>
<el-input
v-model=
"dynamicValidateForm.name"
autocomplete=
"off"
></el-input>
</el-form-item>
<el-form-item
v-show=
"!isEdit"
v-for=
"(name, index) in dynamicValidateForm.names"
:label=
"'合同类型名称' + (parseInt(index) + 1)"
:prop=
"'names.' + index + '.value'"
:key=
"index"
:rules=
"[{
required: true, message: '合同类型名称不能为空', trigger: 'blur'
}]"
>
<el-input
v-model=
"name.value"
>
<el-button
slot=
"append"
icon=
"el-icon-delete"
@
click.prevent=
"dynamicValidateForm.names.splice(index, 1)"
>
删除
</el-button>
</el-input>
</el-form-item>
</el-form>
<div
slot=
"footer"
class=
"dialog-footer"
>
<el-button
v-if=
"!isEdit"
@
click=
"dynamicValidateForm.names.push({ value: '' });"
>
增加类型
</el-button>
<el-button
@
click=
"resetData"
>
取 消
</el-button>
<el-button
v-if=
"isEdit"
type=
"primary"
@
click=
"update(dynamicValidateForm)"
>
确 定
</el-button>
<el-button
v-else
type=
"primary"
@
click=
"addContractType"
>
确 定
</el-button>
</div>
</el-dialog>
</div>
</template>
<
script
>
import
{
selectContractTypeList
,
addContractType
as
insert
,
updateContractType
}
from
'
@/api/contract
'
import
{
mapGetters
}
from
'
vuex
'
export
default
{
computed
:
{
...
mapGetters
([
'
companyId
'
])
},
data
()
{
return
{
companyQurey
:
{},
contractList
:
[],
contractTypeQuey
:
{
pageSize
:
10
,
pageNum
:
1
,
},
total
:
0
,
contractTypeList
:
[],
typeList
:
[],
type
:
''
dialogFormVisible
:
false
,
dynamicValidateForm
:
{
names
:
[]},
isEdit
:
false
}
},
mounted
()
{
this
.
getContractTypeList
()
},
methods
:
{
resetData
(){
this
.
isEdit
=
false
;
this
.
dialogFormVisible
=
false
this
.
dynamicValidateForm
=
{
names
:
[],
name
:
''
}
this
.
$refs
.
form
.
resetFields
();
},
edit
(
data
)
{
this
.
isEdit
=
true
;
this
.
dialogFormVisible
=
true
;
this
.
dynamicValidateForm
=
{
...
data
}
},
getContractTypeList
(
data
)
{
const
params
=
{
companyId
:
this
.
companyId
||
this
.
$store
.
getters
.
companyId
,
// "name": "string", //select
// "searchCount": true, //select
// "state": 0, //select
...
this
.
contractTypeQuey
,
...
data
}
selectContractTypeList
(
params
).
then
((
res
)
=>
{
if
(
res
.
success
)
{
this
.
contractTypeList
=
res
.
data
.
list
.
map
(
item
=>
{
return
{
...
item
,
state
:
parseInt
(
item
.
state
)
===
0
}
})
this
.
total
=
res
.
data
.
total
}
else
{
this
.
contractTypeList
=
[]
this
.
total
=
0
}
})
},
update
(
data
)
{
function
updateCore
()
{
const
params
=
{
companyId
:
this
.
companyId
||
this
.
$store
.
getters
.
companyId
,
...
data
}
!
Number
.
isInteger
(
data
.
state
)
&&
(
params
.
state
=
Number
(
!
data
.
state
))
updateContractType
(
params
).
then
(
res
=>
{
if
(
res
.
success
)
{
this
.
$message
.
success
(
"
修改成功
"
)
this
.
dialogFormVisible
&&
(
this
.
dialogFormVisible
=
false
)
this
.
getContractTypeList
()
}
})
}
if
(
this
.
$refs
.
form
)
{
this
.
$refs
.
form
.
validate
((
valida
)
=>
{
if
(
valida
){
updateCore
.
call
(
this
)
}
})
}
else
{
updateCore
.
call
(
this
)
}
},
addContractType
()
{
this
.
$refs
.
form
.
validate
((
valida
)
=>
{
if
(
valida
)
{
const
data
=
{
state
:
0
,
//默认开启,
companyId
:
this
.
companyId
||
this
.
$store
.
getters
.
companyId
,
}
let
params
=
[{
...
data
,
name
:
this
.
dynamicValidateForm
.
name
}]
if
(
this
.
dynamicValidateForm
.
names
.
length
)
{
params
=
params
.
concat
(
this
.
dynamicValidateForm
.
names
.
map
(
name
=>
{
return
{
...
data
,
name
:
name
.
value
}
}))
}
insert
(
params
).
then
((
res
)
=>
{
if
(
res
.
success
)
{
this
.
$message
.
success
(
"
添加成功
"
)
this
.
resetData
()
this
.
getContractTypeList
()
}
else
{
this
.
$message
.
error
(
res
.
msg
)
}
})
}
})
}
}
}
</
script
>
<
style
scoped
lang=
"scss"
>
.main
{
padding
:
15px
;
.header
{
margin-bottom
:
10px
;
}
.main
{
padding
:
15px
;
.header
{
margin-bottom
:
10px
;
}
}
</
style
>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment