Browse Source

供应商合同

java8
rq 5 months ago
parent
commit
a759feebc4
  1. 2
      src/api/srm/srmSupplier.js
  2. 23
      src/views/modules/srmSupplier/com_srmSupplier_Contract.vue
  3. 718
      src/views/modules/srmSupplier/supplierContractRequest.vue

2
src/api/srm/srmSupplier.js

@ -10,3 +10,5 @@ export const confirmRequest= (data) => createAPI(`/srmSupplier/confirmRequest`,'
export const createNewSupplierContract = data => createAPI('/srmSupplier/createNewSupplierContract', 'POST', data)
export const getNewSupplierContract= (data) => createAPI(`/srmSupplier/getNewSupplierContract`,'post',data)
export const deleteSupplierContract= (data) => createAPI(`/srmSupplier/deleteSupplierContract`,'post',data)
export const getContractRequestList= (data) => createAPI(`/srmSupplier/getContractRequestList`,'post',data)
export const closeContractRequestList= (data) => createAPI(`/srmSupplier/closeContractRequestList`,'post',data)

23
src/views/modules/srmSupplier/com_srmSupplier_Contract.vue

@ -34,7 +34,7 @@
fixed="right"
label="操作">
<template slot-scope="scope">
<a type="text" size="small" @click="updateModel(scope.row)">Renew |</a>
<a type="text" size="small" v-if="scope.row.needRenew=='Y'" @click="renewModew(scope.row)">Renew |</a>
<a type="text" size="small" @click="editModel(scope.row)">Edit |</a>
<a type="text" size="small" @click="deleteData(scope.row)"> Delete</a>
</template>
@ -224,6 +224,7 @@ export default {
contractName:'',
contractDetail:'',
createdBy:'',
renewflag:'',
},
contractModelFlag:false,
visible:false,
@ -425,6 +426,7 @@ export default {
contractNo:'',
contractName:'',
contractDetail:'',
renewflag:'N',
createBy:this.$store.state.user.name,
}
this.fileList=[]
@ -532,8 +534,27 @@ export default {
})
},
renewModew(row){
this.contractModelData=JSON.parse(JSON.stringify(row));
this.contractModelData.renewflag='Y'
let params={
orderRef1:row.site,
orderRef2:row.contractId,
orderReftype:'SrmSupplierContract',
}
queryOss(params).then(({data})=>{
if (data && data.code === 0){
this.fileList = data.rows;
}else {
this.$message.warning(data.msg);
}
this.queryLoading = false;
})
this.contractModelFlag=true;
},
editModel(row){
this.contractModelData=JSON.parse(JSON.stringify(row));
this.contractModelData.renewflag='N'
let params={
orderRef1:row.site,
orderRef2:row.contractId,

718
src/views/modules/srmSupplier/supplierContractRequest.vue

@ -0,0 +1,718 @@
<template>
<div class="customer-css" >
<!-- 查询时间和产品 -->
<el-form :inline="true" label-position="top" label-width="100px" style="margin-top: 0px;" >
<el-row>
<el-col :span="24" style="">
<el-form-item :label="'Request Date'" >
<el-date-picker
style="width: 130px"
v-model="searchData.startDate"
type="date"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
placeholder="选择日期">
</el-date-picker>
</el-form-item>
<el-form-item :label="'To'" >
<el-date-picker
style="width: 130px"
v-model="searchData.endDate"
type="date"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
placeholder="选择日期">
</el-date-picker>
</el-form-item>
<el-form-item :label="'Status:'">
<el-select v-model="searchData.status" style="width: 130px">
<el-option label="All" value=""></el-option>
<el-option label="未执行" value="未执行"></el-option>
<el-option label="已执行" value="已执行"></el-option>
<el-option label="已取消" value="已取消"></el-option>
</el-select>
</el-form-item>
<el-form-item >
<span style="cursor: pointer" slot="label" @click="getBaseList(1100,1)"><a herf="#">Supplier No</a></span>
<el-input v-model="searchData.supplierNo" style="width: 130px"></el-input>
</el-form-item>
<el-form-item :label="'Supplier Name:'">
<el-input v-model="searchData.supplierName" style="width: 130px"></el-input>
</el-form-item>
<el-form-item :label="'Contract No:'">
<el-input v-model="searchData.contractNo" style="width: 130px"></el-input>
</el-form-item>
<el-form-item :label="' '" >
<el-button class="customer-bun-min" type="primary" @click="getMainData" style="">Query</el-button>
<!-- <el-button class="customer-bun-min" type="primary" @click="requestModel" style="">New Request</el-button>-->
<el-button @click="exportExcel()" type="primary" style="margin-left: 2px">{{'导出'}}</el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-table
:height="height"
:data="mainDataList"
border
ref="mainTable"
highlight-current-row
v-loading="dataListLoading"
style="margin-top: 0px; width: 100%;">
<el-table-column
fixed="right"
header-align="center"
align="center"
width="150"
:label="'Action'">
<template slot-scope="scope">
<a type="text" size="small" v-if="scope.row.status=='未执行'" @click="cancelRequest(scope.row)">取消 </a>
<a type="text" size="small" v-if="scope.row.status=='未执行'" @click="renewModel(scope.row)">| Renew</a>
</template>
</el-table-column>
<el-table-column
v-for="(item,index) in columnList1" :key="index"
:sortable="item.columnSortable"
:prop="item.columnProp"
:header-align="item.headerAlign"
:show-overflow-tooltip="item.showOverflowTooltip"
:align="item.align"
:fixed="item.fixed==''?false:item.fixed"
:min-width="item.columnWidth"
:label="item.columnLabel">
<template slot-scope="scope">
<span v-if="!item.columnHidden"> {{scope.row[item.columnProp]}}</span>
<span v-if="item.columnImage"><img :src="scope.row[item.columnProp]"
style="width: 100px; height: 80px"/></span>
</template>
</el-table-column>
</el-table>
<!-- 分页插件 -->
<el-pagination style="margin-top: 0px"
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[20, 50, 100, 200, 500]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
<el-dialog title="Contract" :close-on-click-modal="false" v-drag :visible.sync="contractModelFlag" width="600px">
<el-form label-position="top" style="margin-top: -5px;">
<el-row :gutter="20">
<el-col :span="6">
<el-form-item :label="'Supplier No'" >
<el-input v-model="contractModelData.supplierNo" disabled style="width: 130px" ></el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item :label="'Supplier Name'" >
<el-input v-model="contractModelData.supplierName" disabled style="width: 130px"></el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item :label="'contract Date'" >
<el-date-picker
style="width: 130px"
v-model="contractModelData.contractDate"
type="date"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
placeholder="选择日期">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item :label="'Valid To'" >
<el-date-picker
style="width: 130px"
v-model="contractModelData.validTo"
type="date"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
placeholder="选择日期">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item :label="'Amout'" >
<el-input v-model="contractModelData.amout" type="number" style="width: 130px"></el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item :label="'Currency'" >
<el-input v-model="contractModelData.currency" style="width: 130px"></el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item :label="'Contract No'" >
<el-input v-model="contractModelData.contractNo" style="width: 130px" ></el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item :label="'Contract Name'" >
<el-input v-model="contractModelData.contractName" style="width: 130px" ></el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item :label="'Contract Detail'">
<el-input type="textarea" :rows="3" v-model="contractModelData.contractDetail" style=""></el-input>
</el-form-item>
</el-col>
<el-col :span="4" style="margin-top: 50px">
<el-button class="customer-bun-min" type="primary" @click="handleUpload" style="">Upload</el-button>
</el-col>
</el-row>
</el-form>
<el-table
:height="240"
:data="fileList"
ref="fileTableRef"
style="width: 100%;" >
<el-table-column
prop="fileName"
header-align="center"
align="left"
min-width="200"
label="File No">
</el-table-column>
<el-table-column
prop="createdBy"
header-align="center"
align="center"
min-width="100"
label="Upload By">
</el-table-column>
<el-table-column
prop="createDate"
header-align="center"
align="center"
min-width="100"
label="Upload Time">
</el-table-column>
<el-table-column
header-align="center"
align="center"
width="100"
fixed="right"
label="Actions">
<template slot-scope="scope">
<a type="text" size="small" @click="handleDownload(scope.row)">View |</a>
<a type="text" size="small" @click="deleteFile(scope.$index)"> delete</a>
</template>
</el-table-column>
</el-table>
<el-footer style="height:40px;margin-top: 10px;text-align:center">
<el-button type="primary" @click="submitData()">Submit</el-button>
<el-button type="primary" @click="contractModelFlag=false">Cancel & Close</el-button>
</el-footer>
</el-dialog>
<el-dialog title="UpLoad" :visible.sync="ossVisible" v-drag width="400px" append-to-body :close-on-click-modal="false">
<el-form ref="form" class="rq" label-width="80px" label-position="top">
<el-row :gutter="10">
<slot></slot>
<el-col :span="24">
<el-form-item label=" " class="auto">
<el-upload drag :file-list="fileList2"
action="#" ref="upload"
:on-remove="onRemoveFile"
:on-change="onChangeFile"
multiple
:auto-upload="false">
<i class="el-icon-upload"></i>
<div class="el-upload__text">将文件拖到此处<em>点击上传</em></div>
</el-upload>
</el-form-item>
</el-col>
<el-col :span="24" >
<el-form-item label="备注" class="auto" >
<el-input type="textarea" v-model="ossForm.remark" resize="none" :autosize="{minRows: 3, maxRows: 3}"></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button type="primary" :loading="uploadLoading" @click="handleUploadFiles">确定</el-button>
<el-button @click="ossVisible = false">关闭</el-button>
</span>
</el-dialog>
<Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist>
</div>
</template>
<script>
/*组件*/
import excel from "@/utils/excel-util.js";
import {
getContractRequestList,getNewSupplierContract,closeContractRequestList,createNewSupplierContract
} from '@/api/srm/srmSupplier.js'
import Chooselist from '@/views/modules/common/Chooselist_eam'
import {ossUploadNoSaveOSS, previewOssFileById, queryOss} from "../../../api/oss/oss";
export default {
data() {
return {
functionId: this.$route.meta.menuId,
height: 200,
currentRow: {},
searchData:{
startDate:'',
endDate:'',
status:'',
supplierNo:'',
supplierName:'',
contractNo:'',
site:this.$store.state.user.site,
page: 1,
limit: 10,
},
contractModelData:{
id:'',
site:"",
contractId:'',
supplierNo:'',
supplierName:'',
contractDate:'',
validTo:'',
amout:'',
currency:'',
contractNo:'',
contractName:'',
contractDetail:'',
createdBy:'',
renewflag:'',
},
exportName: '合同Renew提醒'+this.dayjs().format('YYYYMMDDHHmmss'),
tagNo:'',
tagType:'',
pageIndex: 1,
pageSize: 50,
totalPage: 0,
mainDataList:[],
dataListLoading: false,
contractModelFlag:false,
visible:false,
fileList: [],
fileList2:[],
ossVisible:false,
ossForm:{
remark:'',
},
uploadLoading:false,
columnList1: [
{
userId: this.$store.state.user.name,
functionId: this.functionId,
serialNumber: '811011Table1RequestNo',
tableId: "811011Table1",
tableName: "合同Renew提醒",
columnProp: "requestNo",
headerAlign: "center",
align: "left",
columnLabel: "Request No",
columnWidth: '100',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: false
},
{
userId: this.$store.state.user.name,
functionId: this.functionId,
serialNumber: '811011Table1RequestDate',
tableId: "811011Table1",
tableName: "合同Renew提醒",
columnProp: "requestNo",
headerAlign: "center",
align: "center",
columnLabel: "Request Date",
columnWidth: '100',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: false
},
{
userId: this.$store.state.user.name,
functionId: this.functionId,
serialNumber: '811011Table1SupplierNo',
tableId: "811011Table1",
tableName: "合同Renew提醒",
columnProp: "supplierNo",
headerAlign: "center",
align: "left",
columnLabel: "Supplier No",
columnWidth: '100',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: false
},
{
userId: this.$store.state.user.name,
functionId: this.functionId,
serialNumber: '811011Table1SupplierName',
tableId: "811011Table1",
tableName: "合同Renew提醒",
columnProp: "supplierName",
headerAlign: "center",
align: "left",
columnLabel: "Supplier Name",
columnWidth: '100',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: false
},
{
userId: this.$store.state.user.name,
functionId: this.functionId,
serialNumber: '811011Table1ContractNo',
tableId: "811011Table1",
tableName: "合同Renew提醒",
columnProp: "contractNo",
headerAlign: "center",
align: "left",
columnLabel: "Contract No",
columnWidth: '100',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: false
},
{
userId: this.$store.state.user.name,
functionId: this.functionId,
serialNumber: '811011Table1ContractName',
tableId: "811011Table1",
tableName: "合同Renew提醒",
columnProp: "contractName",
headerAlign: "center",
align: "left",
columnLabel: "Contract Name",
columnWidth: '100',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: false
},
{
userId: this.$store.state.user.name,
functionId: this.functionId,
serialNumber: '811011Table1Status',
tableId: "811011Table1",
tableName: "合同Renew提醒",
columnProp: "status",
headerAlign: "center",
align: "center",
columnLabel: "status",
columnWidth: '100',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: false
},
{
userId: this.$store.state.user.name,
functionId: this.functionId,
serialNumber: '811011Table1RequestBy',
tableId: "811011Table1",
tableName: "合同Renew提醒",
columnProp: "createBy",
headerAlign: "center",
align: "center",
columnLabel: "Request By",
columnWidth: '100',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: false
},
],
}
},
/*组件*/
components: {
Chooselist,
},
watch: {
requestModelData: {
deep: true,
handler: function (newV, oldV) {
this.requestModelData.supplierNo = this.requestModelData.supplierNo.toUpperCase()
}
},
},
mounted() {
this.$nextTick(() => {
this.height = window.innerHeight - 220;
})
},
methods: {
// S
getBaseList(val, type) {
this.tagNo = val
this.tagType = type
this.$nextTick(() => {
let strVal = ''
if (val === 1100) {
if(type==1){
strVal = this.searchData.supplierNo
}
if(type==2){
strVal = this.requestModelData.supplierNo
}
}
this.$refs.baseList.init(val, strVal)
})
},
/* 列表方法的回调 */
getBaseData(val) {
if (this.tagNo === 1100) {
if(this.tagType==1) {
this.searchData.supplierNo = val.supplier_no
}
if(this.tagType==2) {
this.requestModelData.supplierNo = val.supplier_no
this.requestModelData.supplierName = val.supplier_name
this.requestModelData.oldSupplierGroup = val.supplier_group
}
}
},
getMainData(){
this.searchData.limit = this.pageSize
this.searchData.page = this.pageIndex
getContractRequestList(this.searchData).then(({data}) => {
if (data.code === 0) {
this.mainDataList = data.page.list
this.pageIndex = data.page.currPage
this.pageSize = data.page.pageSize
this.totalPage = data.page.totalCount
}
this.dataListLoading = false
})
},
//
sizeChangeHandle (val) {
this.pageSize = val
this.pageIndex = 1
this.getMainData()
},
//
currentChangeHandle (val) {
this.pageIndex = val
this.getMainData()
},
async exportExcel() {
this.searchData.limit = -1
this.searchData.page = 1
excel.exportTable({
url: "/srmSupplier/getContractRequestList",
columnMapping: this.columnList1,//table
mergeSetting: [],//
params: this.searchData,
fileName: this.exportName+".xlsx",
rowFetcher: res => res.data,
columnFormatter: [],
dropColumns: [],//dropColumns: ["netWeight"]
});
},
renewModel(row){
let inData={
site:row.site,
contractId:row.contractId,
}
getNewSupplierContract(inData).then(({data}) => {
//
if (data && data.code == 0) {
if(data.rows.length > 0) {
this.contractModelData=JSON.parse(JSON.stringify(data.rows[0]));
this.contractModelData.renewflag='Y'
let params={
orderRef1:row.site,
orderRef2:row.contractId,
orderReftype:'SrmSupplierContract',
}
queryOss(params).then(({data})=>{
if (data && data.code === 0){
this.fileList = data.rows;
}else {
this.$message.warning(data.msg);
}
this.queryLoading = false;
})
this.contractModelFlag=true;
}else {
this.$message.warning("该合同已经不存在!");
}
} else {
}
});
},
handleUpload(){
this.$nextTick(()=>{
if (this.$refs.upload){
this.$refs.upload.clearFiles();
}
})
this.fileList2 = [];
this.ossForm.remark = '';
this.ossVisible = true
},
onRemoveFile(file, fileList){
this.fileList2 = fileList
},
onChangeFile(file, fileList){
this.fileList2 = fileList
},
handleUploadFiles(){
if (this.fileList2.length === 0){
this.$message.error('请选择文件');
return;
}
let formData = new FormData();
for (let i = 0; i < this.fileList2.length; i++) {
formData.append('file', this.fileList2[i].raw);
}
formData.append('orderRef1', '');
formData.append('orderRef2', '');
formData.append('createdBy', this.$store.state.user.name);
formData.append('fileRemark', this.ossForm.remark);
formData.append('orderReftype', "SrmSupplierContract");
this.uploadLoading = true;
ossUploadNoSaveOSS(formData).then(({data})=>{
if (data && data.code === 0){
this.$message.success(data.msg);
for (let i = 0; i <data.rows.length ; i++) {
this.fileList.push(data.rows[i]);
}
this.ossVisible = false;
}else {
this.$message.warning(data.msg);
}
this.uploadLoading = false;
}).catch((error)=>{
this.$message.error(error);
this.uploadLoading = false;
})
},
handleDownload(row){
// this.$refs.table.clearSelection()
let selectList = [];
selectList.push(row);
for (let i = 0; i < selectList.length; i++) {
let params = {
id:selectList[i].id,
}
previewOssFileById(params).then((response) => {
const blob = new Blob([response.data], { type: response.headers['content-type'] });
const link = document.createElement('a');
link.href = URL.createObjectURL(blob);
link.setAttribute('download', selectList[i].fileName);
link.target = '_blank'; //
link.click();
URL.revokeObjectURL(link.href);
});
}
},
deleteFile(index){
this.fileList.splice(index, 1);
},
submitData(){
if(this.contractModelData.contractDate==''||this.contractModelData.contractDate==null){
this.$message.warning('未选择Contract Date!')
return false
}
if(this.contractModelData.contractNo==''||this.contractModelData.contractNo==null){
this.$message.warning('未输入Contract No!')
return false
}
if(this.contractModelData.contractName==''||this.contractModelData.contractName==null){
this.$message.warning('未输入Contrac tName!')
return false
}
if(this.fileList.length==0){
this.$message.warning('请上传合同!')
return false
}
this.contractModelData.fileList= this.fileList
createNewSupplierContract( this.contractModelData).then(({data})=>{
if (data && data.code === 0){
this.$message.success(data.msg);
this.getMainData();
this.contractModelFlag=false
}else {
this.$message.warning(data.msg);
}
}).catch((error)=>{
this.$message.error(error);
})
},
cancelRequest (row) {
this.$confirm(`是否取消这个提醒?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
closeContractRequestList(row).then(({data}) => {
if (data && data.code === 0) {
this.getMainData()
this.$message.success(data.msg);
} else {
this.$message.warning(data.msg);
}
})
}).catch(() => {
})
},
},
created() {
//
this.getMainData();
},
}
</script>
<!--当前页面的标签样式-->
<style scoped lang="scss">
.rq .auto /deep/ .el-form-item__content{
height: auto;
line-height: 1.5;
}
</style>
Loading…
Cancel
Save