From 3bd59622961f569ac181a0f17aeffd44858efa4f Mon Sep 17 00:00:00 2001
From: haoxuan <haoxuan>
Date: 星期日, 28 四月 2024 17:19:13 +0800
Subject: [PATCH] 价税合计和数量,采购单价 3者之间计算管理的逻辑处理
---
src/views/supplierManage/supplier/AddSupplier.vue | 185 ++++++++++++++++++++++++++++++++++++++-------
1 files changed, 154 insertions(+), 31 deletions(-)
diff --git a/src/views/supplierManage/supplier/AddSupplier.vue b/src/views/supplierManage/supplier/AddSupplier.vue
index 415c271..7b737ed 100644
--- a/src/views/supplierManage/supplier/AddSupplier.vue
+++ b/src/views/supplierManage/supplier/AddSupplier.vue
@@ -14,7 +14,7 @@
:model="editConfig.infomation"
:rules="rules"
label-position="right"
- label-width="308px"
+ label-width="150px"
size="mini"
>
<!-- 淇℃伅 -->
@@ -25,7 +25,21 @@
<el-row>
<el-col :span="12">
<el-form-item label="渚涘簲鍟嗙紪鍙�" prop="number">
- <el-input v-model="editConfig.infomation.number"></el-input>
+ <!-- <el-input v-model="editConfig.infomation.number"></el-input> -->
+ <el-input
+ style="width: 85%"
+ v-if="
+ editConfig.title == '淇敼' ||
+ (editConfig.title == '鏂板缓' && codenumer && (explain != '' || isIdDisabled))
+ "
+ :disabled="editConfig.title != '鏂板缓'"
+ v-model="editConfig.infomation.number"
+ placeholder="璇疯緭鍏ョ紪鐮�"
+ >
+ </el-input>
+ <span v-else-if="editConfig.title == '鏂板缓'" style="color: #f56c6c; width: 85%"
+ >璇蜂紭鍏堥厤缃紪鐮佽鑼� <el-button type="text" @click="numberClick"> 閰嶇疆瑙勮寖 </el-button></span
+ >
</el-form-item>
</el-col>
<el-col :span="12">
@@ -91,15 +105,20 @@
</el-form-item>
</el-col>
<el-col :span="12">
- <el-form-item label="閿�鍞礋璐d汉" prop="responsiblePersonId">
+ <el-form-item label="閿�鍞礋璐d汉" prop="responsiblePersonName">
<!-- <el-input v-model="editConfig.infomation.responsiblePersonId"></el-input> -->
<el-select
- v-model="editConfig.infomation.responsiblePersonId"
+ v-model="editConfig.infomation.responsiblePersonName"
placeholder="璇烽�夋嫨"
size="mini"
style="width: 63%"
>
- <el-option v-for="item in memberOptions" :key="item.id" :label="item.username" :value="item.id">
+ <el-option
+ v-for="(item, index) in memberOptions"
+ :key="index"
+ :label="item.username"
+ :value="item.userName"
+ >
</el-option>
</el-select>
</el-form-item>
@@ -155,11 +174,12 @@
<span style="margin-left: 5px">鍚堝悓闄勪欢</span>
</div>
</template>
- <div class="annex-view">
+ <div v-if="file_id === 0" class="annex-view">
<div @click="addAnnexClick">
<el-upload
class="upload-demo"
- action="https://jsonplaceholder.typicode.com/posts/"
+ :headers="headers"
+ action=""
:limit="1"
:before-upload="beforeAvatarUpload"
:on-exceed="handleExceed"
@@ -173,13 +193,15 @@
</el-upload>
</div>
</div>
- <div v-if="file_name && file_name.length > 0" class="file-content">
+ <!-- v-if="file_name && file_name.length > 0" -->
+ <div v-else class="file-content">
<div>{{ file_name }}</div>
<div>
- <el-button type="text">棰勮</el-button>
- <el-button type="text">涓嬭浇</el-button>
- <el-button type="text">鍒犻櫎</el-button>
+ <el-button type="text" @click="previewClick" style="margin-left: 10px">棰勮</el-button>
+ <el-button type="text" @click="downloadClick">涓嬭浇</el-button>
+ <el-button type="text" @click="delContractClick">鍒犻櫎</el-button>
</div>
+ <div ref="file"></div>
</div>
</el-form-item>
</el-col>
@@ -198,11 +220,24 @@
</template>
<script>
-import { createSupplier, createContract, updateSupplier, getIndustryList } from "@/api/supplierManage/supplier"
+import {
+ createSupplier,
+ createContract,
+ updateSupplier,
+ getIndustryList,
+ getSupplierTypeList
+ // downloadContract
+ // previewContract
+} from "@/api/supplierManage/supplier"
import EditDropdownDialog from "@/views/other/commonDialog/EditDropdownDialog"
-import { getSupplierTypeList } from "@/api/supplierManage/supplier"
+import { getMemberListFromGrpc } from "@/api/common/other"
+import download from "downloadjs"
+// import { renderAsync } from "docx-preview"
+import axios from "axios"
+import codeMixin from "@/components/mixin/codeMixin"
export default {
name: "AddSupplierDialog",
+ mixins: [codeMixin],
props: {
addCommonConfig: {
type: Object,
@@ -216,14 +251,20 @@
}
},
components: { EditDropdownDialog },
- computed: {},
+ computed: {
+ headers() {
+ const authorization =
+ "Bearer " + document.cookie.replace(/(?:(?:^|.*;\s*)token\s*=\s*([^;]*).*$)|^.*$/, "$1") || ""
+ return { authorization }
+ }
+ },
data() {
return {
- dialogWidth: "80%",
+ dialogWidth: "50%",
editConfig: this.addCommonConfig,
rules: {
name: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
- responsiblePersonId: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
+ responsiblePersonName: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
phone: [
{ required: false, message: "", trigger: "blur" },
{ len: 11, message: "闀垮害鍦�11涓瓧绗�", trigger: "blur" },
@@ -240,7 +281,8 @@
message: "璇疯緭鍏ユ纭殑閭鏍煎紡",
trigger: "blur"
}
- ]
+ ],
+ number: [{ required: true, validator: this.validateCheckCode, trigger: ["change", "blur"] }]
},
supplierTypeOptions: [{ id: 1, name: "渚涘簲鍟嗙被鍨�1" }], // 渚涘簲鍟嗙被鍨�
industryOptions: [{ id: 1, name: "鎵�灞炶涓�1" }], // 鎵�灞炶涓�
@@ -251,22 +293,47 @@
infomation: {}
},
fileList: [],
- file_name: "",
- file_id: this.addCommonConfig.infomation.fileId
+ file_name: this.addCommonConfig.infomation.file_name,
+ file_id: this.addCommonConfig.infomation.fileId,
+ previewUrl: "",
+ loading: false
}
},
created() {
this.getSupplierTypeList()
this.getIndustryList()
+ this.getMemberList()
+ if (this.editConfig.title === "淇敼") {
+ // this.previewContract()
+ }
+ this.formInfo()
},
methods: {
+ formInfo() {
+ this.objCode.type = "渚涘簲鍟嗙紪鐮�"
+ this.objCode.codeStandID = ""
+ if (this.editConfig.infomation.codeStandardID) {
+ this.objCode.codeStandID = this.editConfig.infomation.codeStandardID
+ }
+ this.getRCodeStandardList()
+ },
+ // 閿�鍞礋璐d汉
+ async getMemberList() {
+ await getMemberListFromGrpc({
+ page: 1,
+ pageSize: 100
+ }).then((res) => {
+ console.log(res)
+ this.memberOptions = res.data.list
+ })
+ },
// 渚涘簲鍟嗙被鍨�
async getSupplierTypeList() {
await getSupplierTypeList({
page: 1,
pageSize: 100
}).then((res) => {
- this.supplierTypeOptions = res.data.data.list
+ this.supplierTypeOptions = res.data.list
})
},
// 鎵�灞炶涓�
@@ -275,7 +342,7 @@
page: 1,
pageSize: 100
}).then((res) => {
- this.industryOptions = res.data.data.list
+ this.industryOptions = res.data.list
})
},
handleClose() {
@@ -301,6 +368,7 @@
console.log(err)
})
} else {
+ params.id=this.editConfig.infomation.id
updateSupplier(params).then((res) => {
this.editConfig.visible = false
if (res.code === 200) {
@@ -325,12 +393,13 @@
detailAddress: data.detailAddress || "",
email: data.email || "",
fileId: this.file_id || 0,
- id: data.ID || 0,
+ // id: data.id || 0,
industry: data.industry || "",
name: data.name || "",
number: data.number || "",
phone: data.phone || "",
- responsiblePersonId: data.responsiblePersonId || 0,
+ responsiblePersonName:
+ data.responsiblePersonName || document.cookie.replace(/(?:(?:^|.*;\s*)username\s*=\s*([^;]*).*$)|^.*$/, "$1"),
status: data.status || 0,
supplierType: data.supplierType || "",
url: data.url || ""
@@ -370,10 +439,9 @@
fd.append("name", file.name)
// 璋冪敤鎺ュ彛
createContract(fd).then((res) => {
- if (res.status == 200) {
- console.log(res.data.data)
+ if (res.code == 200) {
this.file_name = file.name
- this.file_id = res.data.data.id
+ this.file_id = res.data.id
}
})
}
@@ -382,6 +450,66 @@
handleExceed(files, fileList) {
console.log(fileList)
this.$message.warning(`褰撳墠闄愬埗閫夋嫨 1 涓枃浠讹紝鏈閫夋嫨浜� ${files.length} 涓枃浠禶)
+ },
+ // 涓嬭浇鍚堝悓
+ downloadClick() {
+ let url = "/api-srm/downloadContract?id=" + this.file_id
+ download(url, "", "")
+ },
+ // 鍒犻櫎鍚堝悓
+ delContractClick() {
+ // deleteContract({
+ // id: this.file_id
+ // }).then((res) => {
+ // console.log(res)
+ // this.$message.success(res.msg)
+ this.file_id = 0
+ // })
+ },
+ // 棰勮鍚堝悓
+ // async previewClick() {
+ // this.previewUrl = "/api-srm/con/previewContract?id=" + this.file_id
+ // if (this.file_name.includes("pdf")) {
+ // window.open(this.previewUrl, "_blank")
+ // } else {
+ // let routeUrl = this.$router.resolve({
+ // path: "/PreviewFile",
+ // query: {
+ // //瑕佷紶鐨勫弬鏁�
+ // previewUrl: this.previewUrl
+ // }
+ // })
+ // window.open(routeUrl.href, "_blank")
+ // }
+ // }
+ async previewClick() {
+ this.previewUrl = "/api-srm/previewContract?id=" + this.file_id
+ if (this.file_name.includes("pdf")) {
+ console.log("鏄痯df鏂囦欢")
+ await axios
+ .get(this.previewUrl, {
+ headers: {
+ Authorization: "Bearer " + document.cookie.replace(/(?:(?:^|.*;\s*)token\s*=\s*([^;]*).*$)|^.*$/, "$1")
+ }
+ })
+ .then((response) => {
+ window.open(this.previewUrl, "_blank")
+ console.log("response", response, this.previewUrl)
+ })
+ .catch((error) => {
+ console.error(error)
+ })
+ } else {
+ console.log(this.previewUrl, "鐪嬬湅鏄暐瀛�")
+ let routeUrl = this.$router.resolve({
+ path: "/PreviewFile",
+ query: {
+ //瑕佷紶鐨勫弬鏁�
+ previewUrl: this.previewUrl
+ }
+ })
+ window.open(routeUrl.href, "_blank")
+ }
}
}
}
@@ -429,11 +557,6 @@
.file-content {
display: flex;
}
- }
- .dialog-footer {
- background-color: #f5f5f5;
- height: 55px;
- line-height: 55px;
}
}
}
--
Gitblit v1.8.0