Commit 84c167da by 韩达

Merge branch 'feature/handa/20230527_pur_contract' into 'master'

Feature/handa/20230527 pur contract

See merge request !24
parents 968c4252 404f5404
...@@ -10,8 +10,8 @@ ...@@ -10,8 +10,8 @@
"dependencies": { "dependencies": {
"axios": "^0.21.1", "axios": "^0.21.1",
"core-js": "^3.6.5", "core-js": "^3.6.5",
"echarts": "^5.1.1", "echarts": "^5.4.2",
"element-ui": "^2.15.1", "element-ui": "^2.15.13",
"vue": "^2.6.11", "vue": "^2.6.11",
"vue-clipboard2": "^0.3.1", "vue-clipboard2": "^0.3.1",
"vue-router": "^3.2.0" "vue-router": "^3.2.0"
......
...@@ -17,6 +17,7 @@ switch (envs) { ...@@ -17,6 +17,7 @@ switch (envs) {
case 'development': case 'development':
//开发环境 //开发环境
NODE_ENVS = 'http://cloud.liexindev.net'; NODE_ENVS = 'http://cloud.liexindev.net';
// NODE_ENVS = 'http://cloud.hd.liexinlocal.com';
NODE_ENVS_MSG = 'http://192.168.1.252:16543'; NODE_ENVS_MSG = 'http://192.168.1.252:16543';
break; break;
case 'test': case 'test':
...@@ -32,7 +33,7 @@ switch (envs) { ...@@ -32,7 +33,7 @@ switch (envs) {
} }
export const http = (method, url, param, loading) => { export const http = (method, url, param, loading, responseType) => {
//axios.defaults.withCredentials = true; // 携带cookie //axios.defaults.withCredentials = true; // 携带cookie
//loading 默认加载loading 传1 不加载 //loading 默认加载loading 传1 不加载
param = param && typeof param === 'object' ? param : {}; param = param && typeof param === 'object' ? param : {};
...@@ -58,6 +59,11 @@ export const http = (method, url, param, loading) => { ...@@ -58,6 +59,11 @@ export const http = (method, url, param, loading) => {
} else if (method === 'get' || method == 'GET') { } else if (method === 'get' || method == 'GET') {
config.params = param; config.params = param;
} }
if ( responseType ){
config.responseType = responseType;
}
return axios(config); return axios(config);
} }
......
...@@ -28,6 +28,58 @@ ...@@ -28,6 +28,58 @@
<div class="">币种:{{ infos.currency_val }}</div> <div class="">币种:{{ infos.currency_val }}</div>
</el-col> </el-col>
</el-row> </el-row>
<div class="xktitle" style="margin-bottom:10px;">合同信息</div>
<div class="operation-button row verCenter" style="margin-bottom:10px;">
<el-button type="primary" @click="downloadContract">下载猎芯合同</el-button>
<el-select v-model="selectedLang" placeholder="" style="margin-left:10px;width: 5%;">
<el-option v-for="option in langOptions" :label="option.label" :value="option.value" :key="option.value"></el-option>
</el-select>
</div>
<div class="data-box th-all" style="margin-bottom:20px;">
<el-table :data="contractData" border>
<el-table-column prop="languageType" label="语言" min-width="30"></el-table-column>
<el-table-column prop="contractSn" label="合同编号" min-width="100"></el-table-column>
<el-table-column prop="contractBuildTime" label="生成时间" min-width="80"></el-table-column>
<el-table-column label="合同附件" min-width="150">
<template slot-scope="scope">
<el-link v-if="scope.row.contractFileUrl!=''" :href=" scope.row.contractFileUrl " target="_blank">{{ scope.row.contractFileUrl }}</el-link>
</template>
</el-table-column>
<el-table-column prop="contractReturnDate" label="回传时间" width="150"></el-table-column>
<el-table-column prop="createName" label="上传人" width="120"></el-table-column>
<el-table-column fixed="right" label="操作" width="150" align="center">
<template slot-scope="scope">
<!-- 订单状态不是“完成,作废”,合同状态为有效 -->
<!-- 采购组织为“深贸电子”时,下载猎芯合同有中文,英文两种选择;列表有中文,英文两行,列表按钮分别为“上传PI,上传合同” -->
<div v-if="infos.company_id==2 && infos.status!=4 && infos.status!=-3 && scope.row.status ==1">
<el-button type="primary" v-if=" scope.row.contractFileUrl!='' " @click="delContract(scope.row)" >
<span>删除合同</span>
</el-button>
<el-upload v-else-if=" scope.row.languageType=='中文' " :headers="{ Authorization: 'Bearer ' + token }" :data="{supplier_id:supplier_id,contract_id:scope.row.contractId,type:'upload'}" :action="uploadUrl" :on-success="handleUploadSuccess" >
<el-button type="primary">上传PI</el-button>
</el-upload>
<el-upload v-else-if=" scope.row.languageType=='英文' " :headers="{ Authorization: 'Bearer ' + token }" :data="{supplier_id:supplier_id,contract_id:scope.row.contractId,type:'upload'}" :action="uploadUrl" :on-success="handleUploadSuccess" >
<el-button type="primary">上传合同</el-button>
</el-upload>
</div>
<!-- 采购组织为“猎芯科技”时,下载猎芯合同只能选择中文,列表也只有中文一行,列表按钮为“上传合同” -->
<div v-if="infos.company_id==1 && infos.status!=4 && infos.status!=-3 && scope.row.status ==1">
<el-button type="primary" v-if=" scope.row.contractFileUrl!='' " @click="delContract(scope.row)" >
<span>删除合同</span>
</el-button>
<el-upload v-else-if=" scope.row.languageType=='中文' " :headers="{ Authorization: 'Bearer ' + token }" :data="{supplier_id:supplier_id,contract_id:scope.row.contractId,type:'upload'}" :action="uploadUrl" :on-success="handleUploadSuccess" >
<el-button type="primary">上传合同</el-button>
</el-upload>
</div>
</template>
</el-table-column>
</el-table>
</div>
<div class="xktitle" style="margin-bottom:20px;">型号明细</div> <div class="xktitle" style="margin-bottom:20px;">型号明细</div>
<div class="data-box th-all" v-if="tableData"> <div class="data-box th-all" v-if="tableData">
<el-table :data="tableData" border> <el-table :data="tableData" border>
...@@ -49,23 +101,39 @@ ...@@ -49,23 +101,39 @@
</template> </template>
<script> <script>
import Vue from 'vue'; import Vue from 'vue';
import Tool from '../../tool'
import Menu from "@/components/menu.vue"; import Menu from "@/components/menu.vue";
import {Col, Message, Pagination, Row, Table, TableColumn} from 'element-ui' import {Col, Message, Pagination, Row, Table, TableColumn, Select, Option, Link, Upload} from 'element-ui';
import axios from 'axios';
import {NODE_ENVS} from "../../ajax";
Vue.prototype.$message = Message; Vue.prototype.$message = Message;
Vue.use(Pagination); Vue.use(Pagination);
Vue.use(TableColumn).use(Table).use(Row).use(Col); Vue.use(TableColumn).use(Table).use(Row).use(Col).use(Select).use(Option).use(Link).use(Upload);
export default { export default {
name: "orderTrackGoodsDetail", name: "orderTrackGoodsDetail",
data() { data() {
return { return {
token: Tool.getCookie('token'),
supplier_id: 0,
infos: {}, infos: {},
tableData: "", tableData: "",
purchase_id: "" purchase_id: "",
contractData: [],
langOptions: [],
selectedLang: '',
uploadUrl: NODE_ENVS + '/api/purContract/updateOrderContract',
fileData: {
token: this.token,
contract_id: 0,
oss_file_id: '',
},
}; };
}, },
created() { created() {
this.getData(this.$route.query.purchase_id); this.getData(this.$route.query.purchase_id);
this.supplier_id = localStorage.getItem('supplier_id');
}, },
watch: { watch: {
$route(to, from) { $route(to, from) {
...@@ -84,9 +152,26 @@ export default { ...@@ -84,9 +152,26 @@ export default {
this.$http('post', "/api/purchase/purOrderDetail", { this.$http('post', "/api/purchase/purOrderDetail", {
id: id id: id
}).then(res => { }).then(res => {
console.log(res);
if (res.code === 0) { if (res.code === 0) {
this.infos = res.data.purchase_info; this.infos = res.data.purchase_info;
this.tableData = res.data.purchase_item_list || []; this.tableData = res.data.purchase_item_list || [];
this.contractData = res.data.pur_contract_list || [];
// 1猎芯科技,2深茂电子
if( this.infos.company_id == 1 ){
this.langOptions = [
{ label: '中文', value: 1 },
];
this.selectedLang = 1;
}else{
this.langOptions = [
{ label: '中文', value: 2 },
{ label: '英文', value: 3 },
];
this.selectedLang = 2;
}
} else { } else {
this.$message({ this.$message({
message: res.msg, message: res.msg,
...@@ -94,8 +179,76 @@ export default { ...@@ -94,8 +179,76 @@ export default {
}); });
} }
}) })
},
handleUploadSuccess(file, fileList) {
if (file.code === 0) {
this.$message({
message: '上传成功',
type: 'success',
});
window.location.reload();
} else {
this.$message({
message: file.msg,
type: 'warning'
});
}
},
//下载猎芯合同
downloadContract() {
// var that = this;
console.log(this.selectedLang);
let pdf_url = ""
if( this.selectedLang == 1 ){
pdf_url = "/api/purContract/pdf";
}
if( this.selectedLang == 2 ){
pdf_url = "/api/purContract/pdfHk";
}
if( this.selectedLang == 3 ){
pdf_url = "/api/purContract/pdfUs";
}
this.$http('get', pdf_url, {
id: this.$route.query.purchase_id
}, true, 'blob').then(res => {
// 包装成 Blob 对象
const blob = new Blob([res], { type: 'application/pdf' });
// 创建 URL 对象
let pdfUrl = window.URL.createObjectURL(blob);
window.open(pdfUrl, '_blank');
})
},
// 3 删除合同
delContract(contractItem){
this.$http('post', "/api/purContract/updateOrderContract", {
contract_id:contractItem.contractId,
type:'delete',
}).then(res => {
console.log(res);
if( res.code === 0 ){
this.$message({
message: '删除成功',
type: 'success',
});
window.location.reload();
}else{
this.$message({
message: file.msg,
type: 'warning'
});
} }
})
}, },
},
components: { components: {
Menu Menu
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment