From fc188397419e76da8e97c0782599f757fb34bd30 Mon Sep 17 00:00:00 2001
From: yangfeng <wanwan926_4@163.com>
Date: 星期四, 14 十二月 2023 16:13:26 +0800
Subject: [PATCH] 增加编码规范功能及新建供应商和采购页面增加编码
---
src/views/supplierManage/supplier/index.vue | 27
src/components/makepager/TableCommonView.vue | 3
src/api/common/standard.js | 20
src/views/supplierManage/supplier/AddSupplier.vue | 93 +++-
src/views/purchaseManage/purchase/components/AddPurchase.vue | 686 ++++++++++++++++----------------
src/views/purchaseManage/purchase/index.vue | 258 ++++++-----
src/components/mixin/codeMixin.js | 133 ++++++
7 files changed, 712 insertions(+), 508 deletions(-)
diff --git a/src/api/common/standard.js b/src/api/common/standard.js
new file mode 100644
index 0000000..6d2565a
--- /dev/null
+++ b/src/api/common/standard.js
@@ -0,0 +1,20 @@
+import request from "@/common/untils/request"
+export function getCodeStandardList(data) {
+ // return axios.get(`/api/code/getCodeList`, {
+ // params: data
+ // })
+
+ return request({
+ url: "/api/code/getCodeList",
+ method: "get",
+ params: data
+ })
+}
+// 鑾峰彇鑷姩缂栫爜
+export function getAutoCode(data) {
+ return request({
+ url: "/api/code/getAutoCode",
+ method: "post",
+ data
+ })
+}
diff --git a/src/components/makepager/TableCommonView.vue b/src/components/makepager/TableCommonView.vue
index a8e9b4c..42f2469 100644
--- a/src/components/makepager/TableCommonView.vue
+++ b/src/components/makepager/TableCommonView.vue
@@ -400,6 +400,9 @@
.el-table .cell .el-button--text.el-button--small {
padding: 4px 0;
}
+ .el-table .onSelect {
+ background: #ebf2ff;
+ }
}
.overSpread1 {
diff --git a/src/components/mixin/codeMixin.js b/src/components/mixin/codeMixin.js
new file mode 100644
index 0000000..1a69a49
--- /dev/null
+++ b/src/components/mixin/codeMixin.js
@@ -0,0 +1,133 @@
+import { getCodeStandardList, getAutoCode } from "@/api/common/standard"
+export default {
+ components: {},
+ data() {
+ return {
+ // 缂栫爜
+ // 鏄惁鑷姩鐢熸垚
+ isIdDisabled: false,
+ inputValue: [],
+ explain: "",
+ codenumer: 0, //姣忔杈撳叆鐨勭紪鐮�
+ codenumberList: [], //鏁存潯缂栫爜
+ sum: 0,
+ method: 0,
+ objCode: { name: "", page: 0, pageSize: 0, type: "鐗╂枡缂栫爜", codeStandID: "" },
+ codeRule: {},
+ codeLength: 0,
+ autoCodeObj: {}
+ }
+ },
+
+ methods: {
+ async getRCodeStandardList() {
+ try {
+ if (this.editConfig.title == "鏂板缓") {
+ const res = await getCodeStandardList(this.objCode)
+ this.codenumer = []
+ this.sum = 0
+ this.explain = ""
+ this.codeLength = 0
+ if (res.code == 200) {
+ const { List = [], ID, AutoRule = {}, Method } = res.data ? res.data.list[0] : []
+ this.codeRule = res.data ? res.data.list[0] : {}
+ let autoRule = AutoRule
+ let method = Method ? Method : 0
+ this.method = method
+ let rules = List
+ this.editConfig.infomation.ID = ID
+ if (method == 0 && res.data.list.length > 0) {
+ console.log("sss")
+ rules.forEach((item, index) => {
+ // setTimeout(() => {
+ // this.codenumer = item.length;
+ // this.sum++;
+ // }, 200);
+ this.codenumer.push(item.Length)
+ this.codeLength += item.Length
+ this.sum++
+ this.explain += item.Name + (index === rules.Length - 1 ? "" : "/")
+ })
+ }
+ console.log(method)
+ if (method == 1) {
+ if (Object.keys(autoRule).length > 0) {
+ this.isIdDisabled = true
+ if (autoRule.PrefixMethod == 1) {
+ let prefix = autoRule.PrefixValue.split("").length
+
+ this.codenumer.push(prefix)
+ this.codeLength += prefix
+ if (autoRule.SuffixMethod == 2) {
+ this.codenumer.push(8)
+ this.codeLength += 8
+ }
+ if (autoRule.AutoLength) {
+ this.codenumer.push(autoRule.AutoLength)
+ this.codeLength += autoRule.AutoLength
+ }
+ this.sum = prefix + Number(autoRule.AutoLength)
+ // this.codeList(
+ // this.editConfig.infomation.id ? this.editConfig.infomation.id : autoRule.PrefixValue
+ // )
+ }
+ }
+ }
+
+ this.$forceUpdate()
+ } else {
+ this.$message.error(res.data.msg ? res.data.msg : "鑾峰彇缂栫爜瑙勮寖澶辫触锛岃閲嶈瘯锛�")
+ }
+ this.getAutoCodeValue()
+ } else {
+ this.codeList(this.editConfig.infomation.number)
+ }
+ } catch (err) {
+ console.log(err)
+ }
+ },
+ async getAutoCodeValue() {
+ if (Object.keys(this.codeRule).length > 0) {
+ const res = await getAutoCode(this.codeRule)
+ if (res.code == 200) {
+ let p = {
+ id: "",
+ codeStandardID: "",
+ maxAutoIncr: ""
+ }
+ this.autoCodeObj = res.data ? res.data : p
+ this.$set(this.editConfig.infomation, "number", this.autoCodeObj.id)
+ } else {
+ this.$set(
+ this.editConfig.infomation,
+ "number",
+ this.codeRule.AutoRule.PrefixValue ? this.codeRule.AutoRule.PrefixValue : ""
+ )
+ }
+ }
+ },
+ codeList(val) {
+ this.inputValue = val
+ this.codenumberList = val.toString()
+ this.editConfig.infomation.number = this.codenumberList.length > 0 ? this.codenumberList.replace(/,/g, "") : ""
+ console.log(this.codenumberList.replace(/,/g, ""))
+ },
+ // 璁㈠崟缂栫爜鍗曠嫭鏍¢獙
+ validateCheckCode(rule, value, callback) {
+ if (value && value.length > 0) {
+ if (this.editConfig.title == "鏂板缓") {
+ if (value.length != this.codeLength) {
+ callback(new Error("璇峰~鍐�" + this.codeLength + "浣嶇殑缂栫爜锛�"))
+ }
+ }
+ callback()
+ } else {
+ callback(new Error("璇疯緭鍏ョ紪鐮�"))
+ }
+ },
+ // 閰嶇疆缂栫爜瑙勮寖鐨勮烦杞�
+ numberClick() {
+ window.open("http://www.fai365.com:9080/facilty", "_blank")
+ }
+ }
+}
diff --git a/src/views/purchaseManage/purchase/components/AddPurchase.vue b/src/views/purchaseManage/purchase/components/AddPurchase.vue
index a69d2d1..541e76c 100644
--- a/src/views/purchaseManage/purchase/components/AddPurchase.vue
+++ b/src/views/purchaseManage/purchase/components/AddPurchase.vue
@@ -24,12 +24,27 @@
<div class="basic-info-view">
<el-row>
<el-col :span="12">
- <el-form-item
- label="閲囪喘绫诲瀷"
- prop="purchaseTypeId"
- class="float_left"
- style="width:100%;"
- >
+ <el-form-item label="閲囪喘鍗曞彿" prop="number">
+ <!-- <el-input v-model="editConfig.infomation.number"></el-input> -->
+ <el-input
+ style="width: 85%"
+ v-if="
+ editConfig.title == '缂栬緫' ||
+ 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">
+ <el-form-item label="閲囪喘绫诲瀷" prop="purchaseTypeId" class="float_left" style="width: 100%">
<el-select
:disabled="editConfig.isDisabled"
placeholder="璇烽�夋嫨閲囪喘绫诲瀷"
@@ -41,7 +56,7 @@
v-for="ele in plcBrandList"
:key="ele.name"
:label="ele.name"
- :value="ele.ID"
+ :value="ele.id"
></el-option>
</el-select>
<i
@@ -62,41 +77,29 @@
v-model="editConfig.infomation.supplierName"
:fetch-suggestions="
(queryString, callback) => {
- querySearchAsync(queryString, callback, 'supplier');
+ querySearchAsync(queryString, callback, 'supplier')
}
"
value-key="name"
placeholder="璇烽�夋嫨"
@select="handleSelectClient('client', $event)"
></el-autocomplete>
- <div
- v-if="!editConfig.isDisabled"
- class="common-select-btn"
- @click="selClientClick('client')"
- >
+ <div v-if="!editConfig.isDisabled" class="common-select-btn" @click="selClientClick('client')">
<i class="el-icon-circle-plus-outline" title="閫夋嫨"></i>
</div>
<div
- v-if="
- editConfig.infomation.supplierName &&
- editConfig.infomation.supplierName.length > 0
- "
+ v-if="editConfig.infomation.supplierName && editConfig.infomation.supplierName.length > 0"
class="common-select-btn"
@click="clearupClient('client')"
>
- <i class="el-icon-remove-outline"
- v-if="!editConfig.isDisabled" title="娓呴櫎"></i>
+ <i class="el-icon-remove-outline" v-if="!editConfig.isDisabled" title="娓呴櫎"></i>
</div>
</div>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="鍗曟嵁鏉ユ簮" prop="orderSource">
- <el-input
- v-model="editConfig.infomation.orderSource"
- disabled
- placeholder="璇峰~鍐�"
- ></el-input>
+ <el-input v-model="editConfig.infomation.orderSource" disabled placeholder="璇峰~鍐�"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
@@ -177,7 +180,7 @@
<div class="basic-info-title" style="display: flex">浜у搧淇℃伅</div>
<div class="product-view">
<CommonFormTableView
- :detailEnter=editCommonConfig.detailEnter
+ :detailEnter="editCommonConfig.detailEnter"
:show-summary="showSummary"
:recalculateShow="false"
:product-table-list="productTableList"
@@ -281,226 +284,225 @@
</template>
<script>
-import CommonFormTableView from "@/components/makepager/CommonFormTableView";
-import BomDialog from "@/components/makepager/BomDialog";
+import CommonFormTableView from "@/components/makepager/CommonFormTableView"
+import BomDialog from "@/components/makepager/BomDialog"
import { getProductList } from "@/api/productManage/product"
-
-import {
- addPurchase,
- updatePurchase,
- savePurchaseType,
- getPurchaseType,
-} from "@/api/purchaseManage/purchase";
-
-import SelectSupplierDialog from "@/views/purchaseManage/purchase/components/SelectSupplierDialog";
+import { addPurchase, updatePurchase, savePurchaseType, getPurchaseType } from "@/api/purchaseManage/purchase"
+import SelectSupplierDialog from "@/views/purchaseManage/purchase/components/SelectSupplierDialog"
// import { formToJSON } from "axios";
+import codeMixin from "@/components/mixin/codeMixin"
+
export default {
name: "QuotationDialog",
- components: { SelectSupplierDialog, CommonFormTableView,BomDialog },
+ components: { SelectSupplierDialog, CommonFormTableView, BomDialog },
+ mixins: [codeMixin],
props: {
editCommonConfig: {
type: Object,
default: () => {
return {
- detailEnter:true,
+ detailEnter: true,
visible: false,
- title: "鍒涘缓",
- infomation: {},
- };
- },
- },
+ title: "鏂板缓",
+ infomation: {}
+ }
+ }
+ }
},
data() {
return {
editConfig: this.editCommonConfig,
rules: {
- purchaseTypeId:[{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
+ purchaseTypeId: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
supplierName: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
phone: [
{
required: false,
message: "璇峰~鍐�",
- trigger: "change",
+ trigger: "change"
},
- { validator: this.validatorPhone, trigger: "change" },
+ { validator: this.validatorPhone, trigger: "change" }
],
wholeDiscount: [
{
required: false,
message: "璇峰~鍐�0-100鐨勬暟瀛�",
- trigger: "change",
+ trigger: "change"
},
- { validator: this.validatorNum, trigger: "change" },
+ { validator: this.validatorNum, trigger: "change" }
],
priceAdjustment: [
{
required: false,
message: "璇峰~鍐�",
- trigger: "change",
+ trigger: "change"
},
- { validator: this.validatorNumThree, trigger: "change" },
+ { validator: this.validatorNumThree, trigger: "change" }
],
+ number: [{ required: true, validator: this.validateCheckCode, trigger: ["change", "blur"] }]
},
productTableList: {},
showSummary: {
show: true,
total: false,
sumProp: ["price", "total"],
- multiply:['amount','price'],
- titleProp: [
- "缂栧彿",
- "浜у搧鍚嶇О",
- "浜у搧缂栧彿",
- "璁¢噺鍗曚綅",
- "瑙勬牸鍨嬪彿",
- "閲囪喘鍗曚环",
- "鎻忚堪",
- ],
+ multiply: ["amount", "price"],
+ titleProp: ["缂栧彿", "浜у搧鍚嶇О", "浜у搧缂栧彿", "璁¢噺鍗曚綅", "瑙勬牸鍨嬪彿", "閲囪喘鍗曚环", "鎻忚堪"],
mergeNumber: 4,
- totalName:'灏忚'
+ totalName: "灏忚"
},
editSelectSupplierConfig: {
editVisible: false,
title: "",
- infomation: {},
+ infomation: {}
},
supplierId: this.editCommonConfig.infomation.supplierId,
tableData: [],
productIndex: 0,
- productId:'',
+ productId: "",
isNoProduct: true,
clientList: [],
- plcBrandList:[],
- editRow:{
- isDefault:'pin'
+ plcBrandList: [],
+ editRow: {
+ isDefault: "pin"
},
- total:0,
- totalTwo:0,
- productListIdx:0,
- lacks:[],
- };
+ total: 0,
+ totalTwo: 0,
+ productListIdx: 0,
+ lacks: []
+ }
},
created() {
- this.handleGetBomKindDictList();
+ this.handleGetBomKindDictList()
this.$store.dispatch("getSupplier")
+ this.formInfo()
},
computed: {
supplierList() {
return this.$store.state.getSupplierName.supplierList
}
},
- watch:{
- 'editCommonConfig.visible':{
- immediate:true,
- handler:function(){
-
- this.handleGetBomKindDictList(true);
+ watch: {
+ "editCommonConfig.visible": {
+ immediate: true,
+ handler: function () {
+ this.handleGetBomKindDictList(true)
}
}
},
methods: {
+ formInfo() {
+ this.objCode.type = "閲囪喘鍗曠紪鐮�"
+ this.objCode.codeStandID = ""
+ if (this.editConfig.infomation.codeStandardID) {
+ this.objCode.codeStandID = this.editConfig.infomation.codeStandardID
+ }
+ this.getRCodeStandardList()
+ },
validatorNum(rule, value, callback) {
- if(this.editConfig.infomation.wholeDiscountType==1){
- if(value==undefined||value==null||(!value&&value!=0)){
- callback(new Error("璇疯緭鍏ユ湁鏁堟暟瀛�"));
- }else{
- var reg=/^\+?[0-9]\d*$/
- if(!reg.test(value)){
- callback(new Error('璇峰~鍐�0-100鐨勬暟瀛�'))
- }else{
- if(Number(value)>100){
- callback(new Error('璇峰~鍐�0-100鐨勬暟瀛�'))
- }else{
+ if (this.editConfig.infomation.wholeDiscountType == 1) {
+ if (value == undefined || value == null || (!value && value != 0)) {
+ callback(new Error("璇疯緭鍏ユ湁鏁堟暟瀛�"))
+ } else {
+ var reg = /^\+?[0-9]\d*$/
+ if (!reg.test(value)) {
+ callback(new Error("璇峰~鍐�0-100鐨勬暟瀛�"))
+ } else {
+ if (Number(value) > 100) {
+ callback(new Error("璇峰~鍐�0-100鐨勬暟瀛�"))
+ } else {
callback()
}
}
- }
- }else{
+ }
+ } else {
this.validatorNumThree(rule, value, callback)
- }
+ }
},
- validatorNumThree(rule, value, callback){
- if(value){
- if(value==undefined||value==null){
- callback(new Error("璇疯緭鍏ユ湁鏁堟暟瀛�"));
- }else{
- let reg2=/(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/
- if(!reg2.test(value)){
- callback(new Error('璇峰~鍐�2浣嶅皬鏁扮殑鏁板瓧'))
- }else{
+ validatorNumThree(rule, value, callback) {
+ if (value) {
+ if (value == undefined || value == null) {
+ callback(new Error("璇疯緭鍏ユ湁鏁堟暟瀛�"))
+ } else {
+ let reg2 = /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/
+ if (!reg2.test(value)) {
+ callback(new Error("璇峰~鍐�2浣嶅皬鏁扮殑鏁板瓧"))
+ } else {
callback()
}
}
- }else{
+ } else {
callback()
- }
+ }
},
// PLC閰嶇疆璁剧疆
handleShow() {
- this.handleGetBomKindDictList();
- this.$refs.editDialog.editDialogVisible = true;
+ this.handleGetBomKindDictList()
+ this.$refs.editDialog.editDialogVisible = true
},
// PLC閰嶇疆
handleGetBomKindDictList(val) {
getPurchaseType().then((res) => {
- this.plcBrandList = res.data;
+ this.plcBrandList = res.data
this.setTableForm()
if (val) {
for (let i in this.plcBrandList) {
if (this.plcBrandList[i][this.editRow.isDefault]) {
this.editConfig.infomation.purchaseTypeId = this.editConfig.infomation.purchaseTypeId
? this.editConfig.infomation.purchaseTypeId
- : this.plcBrandList[i].ID;
- this.$set(this.editConfig.infomation, "purchaseTypeId", this.editConfig.infomation.purchaseTypeId);
-
- break;
+ : this.plcBrandList[i].id
+ this.$set(this.editConfig.infomation, "purchaseTypeId", this.editConfig.infomation.purchaseTypeId)
+
+ break
}
}
}
- });
+ })
},
handleConfirmSave(data) {
- console.log(data,'data')
- data.forEach(ele=>{
+ console.log(data, "data")
+ data.forEach((ele) => {
delete ele.created_at
})
- savePurchaseType(data).then((res) => {
- if (res.code === 200) {
+ savePurchaseType(data).then(
+ (res) => {
+ if (res.code === 200) {
+ this.$message({
+ message: "鎿嶄綔鎴愬姛锛�",
+ type: "success"
+ })
+ this.$refs.editDialog.editDialogVisible = false
+ this.handleGetBomKindDictList(true)
+ }
+ },
+ (err) => {
+ console.error(err)
this.$message({
- message: "鎿嶄綔鎴愬姛锛�",
- type: "success",
- });
- this.$refs.editDialog.editDialogVisible = false;
- this.handleGetBomKindDictList(true);
+ message: "鎿嶄綔澶辫触锛�",
+ type: "warning"
+ })
}
- },(err)=>{
- console.error(err)
- this.$message({
- message: "鎿嶄綔澶辫触锛�",
- type: "warning",
- });
- });
+ )
},
validatorPhone(rule, value, callback) {
if (value) {
if (value == undefined || value == null) {
- callback(new Error("璇疯緭鍏�"));
+ callback(new Error("璇疯緭鍏�"))
} else {
if (value.length != 11) {
- callback(new Error("闀垮害鍦�11涓瓧绗︼紒"));
+ callback(new Error("闀垮害鍦�11涓瓧绗︼紒"))
} else {
- var reg =
- /^1(3\d|4[5-9]|5[0-35-9]|6[2567]|7[0-8]|8\d|9[0-35-9])\d{8}$/;
+ var reg = /^1(3\d|4[5-9]|5[0-35-9]|6[2567]|7[0-8]|8\d|9[0-35-9])\d{8}$/
if (!reg.test(value)) {
- callback(new Error("璇峰~鍐欐纭殑鑱旂郴鐢佃瘽锛�"));
+ callback(new Error("璇峰~鍐欐纭殑鑱旂郴鐢佃瘽锛�"))
} else {
- callback();
+ callback()
}
}
}
} else {
- callback();
+ callback()
}
},
// 淇濆瓨
@@ -509,248 +511,245 @@
if (valid) {
for (let i = 0; i < this.tableData.length; i++) {
if (this.tableData[i].name.length === 0) {
- this.isNoProduct = true;
- break;
+ this.isNoProduct = true
+ break
} else {
- this.isNoProduct = false;
+ this.isNoProduct = false
}
}
if (this.isNoProduct) {
- this.$message.error("浜у搧鍚嶇О涓嶈兘涓虹┖");
+ this.$message.error("浜у搧鍚嶇О涓嶈兘涓虹┖")
} else {
- const params = this.saveParams();
+ const params = this.saveParams()
//鏂板缓
- if (this.editConfig.title === "鍒涘缓") {
- this.lacks=[]
- this.tableData.forEach((item)=>{
- if(this.productTableList.tableProductList.map(obj => obj.number).includes(item.number)) {
- console.log(`${item.name} 鍦ㄦ暟缁勪腑瀛樺湪`);
+ if (this.editConfig.title === "鏂板缓") {
+ this.lacks = []
+ this.tableData.forEach((item) => {
+ if (this.productTableList.tableProductList.map((obj) => obj.number).includes(item.number)) {
+ console.log(`${item.name} 鍦ㄦ暟缁勪腑瀛樺湪`)
} else {
this.lacks.push(item.name)
}
})
- if(this.lacks.length>0){
- this.$confirm(`褰撳墠渚涘簲鍟嗕笉鑳芥彁渚涙偍閫夋嫨鐨勪骇鍝�:${this.lacks}, 鏄惁缁х画鍒涘缓閲囪喘鍗�?`, '鎻愮ず', {
- confirmButtonText: '纭畾',
- cancelButtonText: '鍙栨秷',
- type: 'warning'
- }).then(() => {
- console.log("纭畾鍒涘缓")
- //鍒涘缓閲囪喘鍗�
- addPurchase(params).then((res) => {
- this.editConfig.visible = false;
- if (res.code === 200) {
- this.$message.success("鍒涘缓鎴愬姛");
- this.$parent.getData();
- }
- });
- }).catch(() => {
- console.log("鍙栨秷鍒涘缓")
- });
- }else{
+ if (this.lacks.length > 0) {
+ this.$confirm(`褰撳墠渚涘簲鍟嗕笉鑳芥彁渚涙偍閫夋嫨鐨勪骇鍝�:${this.lacks}, 鏄惁缁х画鍒涘缓閲囪喘鍗�?`, "鎻愮ず", {
+ confirmButtonText: "纭畾",
+ cancelButtonText: "鍙栨秷",
+ type: "warning"
+ })
+ .then(() => {
+ console.log("纭畾鍒涘缓")
+ //鍒涘缓閲囪喘鍗�
+ addPurchase(params).then((res) => {
+ this.editConfig.visible = false
+ if (res.code === 200) {
+ this.$message.success("鍒涘缓鎴愬姛")
+ this.$parent.getData()
+ }
+ })
+ })
+ .catch(() => {
+ console.log("鍙栨秷鍒涘缓")
+ })
+ } else {
addPurchase(params).then((res) => {
- this.editConfig.visible = false;
+ this.editConfig.visible = false
if (res.code === 200) {
- this.$message.success("鍒涘缓鎴愬姛");
- this.$parent.getData();
+ this.$message.success("鍒涘缓鎴愬姛")
+ this.$parent.getData()
}
- });
+ })
}
} else {
// 缂栬緫
getProductList({
- supplierId:this.editConfig.infomation.supplierId,
- page:1,
- pageSize:100
- }).then((res)=>{
- if(res.code===200){
- this.lacks=[]
+ supplierId: this.editConfig.infomation.supplierId,
+ page: 1,
+ pageSize: 100
+ }).then((res) => {
+ if (res.code === 200) {
+ this.lacks = []
// 缂栬緫鍓嶅厛鐪嬬湅褰撳墠渚涘簲鍟嗗搴旂殑浜у搧鍒楄〃
this.productTableList.tableProductList = res.data.list
//褰撳墠浜у搧鏄惁鍦ㄥ綋鍓嶄緵搴斿晢涓嬪瓨鍦�
- this.tableData.forEach((item)=>{
- if(this.productTableList.tableProductList.map(obj => obj.number).includes(item.number)) {
- console.log(`${item.name} 鍦ㄦ暟缁勪腑瀛樺湪`);
+ this.tableData.forEach((item) => {
+ if (this.productTableList.tableProductList.map((obj) => obj.number).includes(item.number)) {
+ console.log(`${item.name} 鍦ㄦ暟缁勪腑瀛樺湪`)
} else {
this.lacks.push(item.name)
}
})
// 涓嶅瓨鍦ㄧ殑浜у搧淇℃伅
- if(this.lacks.length>0){
- this.$confirm(`褰撳墠渚涘簲鍟嗕笉鑳芥彁渚涙偍閫夋嫨鐨勪骇鍝�:${this.lacks}, 鏄惁缁х画鏇存柊閲囪喘鍗�?`, '鎻愮ず', {
- confirmButtonText: '纭畾',
- cancelButtonText: '鍙栨秷',
- type: 'warning'
- }).then(() => {
- console.log("纭畾鏇存柊")
- //鏇存柊閲囪喘鍗�
- updatePurchase(params).then((res) => {
- this.editConfig.visible = false;
- if (res.code === 200) {
- this.$message.success("鏇存柊鎴愬姛");
- this.$parent.getData();
- }
- });
- }).catch(() => {
- console.log("鍙栨秷鏇存柊")
- });
- }else {
+ if (this.lacks.length > 0) {
+ this.$confirm(`褰撳墠渚涘簲鍟嗕笉鑳芥彁渚涙偍閫夋嫨鐨勪骇鍝�:${this.lacks}, 鏄惁缁х画鏇存柊閲囪喘鍗�?`, "鎻愮ず", {
+ confirmButtonText: "纭畾",
+ cancelButtonText: "鍙栨秷",
+ type: "warning"
+ })
+ .then(() => {
+ console.log("纭畾鏇存柊")
+ //鏇存柊閲囪喘鍗�
+ updatePurchase(params).then((res) => {
+ this.editConfig.visible = false
+ if (res.code === 200) {
+ this.$message.success("鏇存柊鎴愬姛")
+ this.$parent.getData()
+ }
+ })
+ })
+ .catch(() => {
+ console.log("鍙栨秷鏇存柊")
+ })
+ } else {
updatePurchase(params).then((res) => {
- this.editConfig.visible = false;
+ this.editConfig.visible = false
if (res.code === 200) {
- this.$message.success("鏇存柊鎴愬姛");
- this.$parent.getData();
+ this.$message.success("鏇存柊鎴愬姛")
+ this.$parent.getData()
}
- });
+ })
}
}
})
-
}
}
} else {
- console.log("error submit");
- return false;
+ console.log("error submit")
+ return false
}
- });
+ })
},
saveParams() {
- let data =JSON.parse(JSON.stringify(this.editConfig.infomation));
-
- if(this.editConfig.infomation.wholeDiscountType==2&&this.editConfig.infomation.wholeDiscount){
- if(Number(this.editConfig.infomation.wholeDiscount)>Number(this.totalTwo)){
- this.$message.error('鐩存帴闄嶄环涓嶈兘瓒呰繃浠风◣鍚堣鐨勬�诲拰锛�')
- return true;
+ let data = JSON.parse(JSON.stringify(this.editConfig.infomation))
+
+ if (this.editConfig.infomation.wholeDiscountType == 2 && this.editConfig.infomation.wholeDiscount) {
+ if (Number(this.editConfig.infomation.wholeDiscount) > Number(this.totalTwo)) {
+ this.$message.error("鐩存帴闄嶄环涓嶈兘瓒呰繃浠风◣鍚堣鐨勬�诲拰锛�")
+ return true
}
}
let params = {
- productList:this.tableData,
- purchase:{
- supplierId:data.supplierId,
- signingDate:data.signingDate||'',
- remark:data.remark,
- orderSource:data.orderSource||'',
- purchaseTypeId:data.purchaseTypeId||0,
- phone:data.phone||'',
- name:data.name||'',
- deliveryDate:data.deliveryDate||'',
- contact:data.contact,
- wholeDiscountType:data.wholeDiscountType?data.wholeDiscountType:0,
- wholeDiscount:data.wholeDiscount?Number(data.wholeDiscount):0,
- priceAdjustmentType:data.priceAdjustmentType?data.priceAdjustmentType:0,
- priceAdjustment:data.priceAdjustment?Number(data.priceAdjustment):0,
- realTotalPrice:this.total?Number(this.total):0,
- totalPrice:this.totalTwo?Number(this.totalTwo):0,
- status:data.status,
- quantity:data.quantity, // 閲囪喘鏁伴噺
+ productList: this.tableData,
+ purchase: {
+ number: data.number || "",
+ supplierId: data.supplierId,
+ signingDate: data.signingDate || "",
+ remark: data.remark,
+ orderSource: data.orderSource || "",
+ purchaseTypeId: data.purchaseTypeId || 0,
+ phone: data.phone || "",
+ name: data.name || "",
+ deliveryDate: data.deliveryDate || "",
+ contact: data.contact,
+ wholeDiscountType: data.wholeDiscountType ? data.wholeDiscountType : 0,
+ wholeDiscount: data.wholeDiscount ? Number(data.wholeDiscount) : 0,
+ priceAdjustmentType: data.priceAdjustmentType ? data.priceAdjustmentType : 0,
+ priceAdjustment: data.priceAdjustment ? Number(data.priceAdjustment) : 0,
+ realTotalPrice: this.total ? Number(this.total) : 0,
+ totalPrice: this.totalTwo ? Number(this.totalTwo) : 0,
+ status: data.status,
+ quantity: data.quantity // 閲囪喘鏁伴噺
}
- };
- if(data.ID){
- params.purchase.id=data.ID
}
- return params;
+ if (data.ID) {
+ params.purchase.id = data.ID
+ }
+ return params
},
handleClose() {
- this.editConfig.visible = false;
+ this.editConfig.visible = false
},
// 閫夋嫨瀹㈡埛鐩稿叧鏂规硶
querySearchAsync(queryString, cb, value) {
- this.productTableList.tableProductList=[]
- var restaurants = [];
+ this.productTableList.tableProductList = []
+ var restaurants = []
if (value === "supplier") {
- restaurants = this.supplierList;
- }
- var results = queryString
- ? restaurants.filter(this.createStateFilter(queryString))
- : restaurants;
- cb(results);
+ restaurants = this.supplierList
+ }
+ var results = queryString ? restaurants.filter(this.createStateFilter(queryString)) : restaurants
+ cb(results)
},
createStateFilter(queryString) {
return (state) => {
- return (
- state.name.toLowerCase().indexOf(queryString.toLowerCase()) === 0
- );
- };
+ return state.name.toLowerCase().indexOf(queryString.toLowerCase()) === 0
+ }
},
// 閫夋嫨渚涘簲鍟�
async handleSelectClient(value, item) {
- this.productTableList.supplierId=item.ID
+ this.productTableList.supplierId = item.ID
if (value === "client") {
- this.supplierId = item.id;
- this.editConfig.infomation.supplierId=item.ID
+ this.supplierId = item.id
+ this.editConfig.infomation.supplierId = item.ID
}
await getProductList({
- supplierId:item.ID,
- page:1,
- pageSize:100
- }).then((res)=>{
- if(res.code===200){
+ supplierId: item.ID,
+ page: 1,
+ pageSize: 100
+ }).then((res) => {
+ if (res.code === 200) {
this.productTableList.tableProductList = res.data.list
- console.log(this.productTableList.tableProductList,"pop")
+ console.log(this.productTableList.tableProductList, "pop")
}
})
},
selClientClick() {
- this.editSelectSupplierConfig.editVisible = true;
+ this.editSelectSupplierConfig.editVisible = true
},
async selClient(row) {
await getProductList({
- supplierId:row.ID,
- page:1,
- pageSize:100
- }).then((res)=>{
- if(res.code===200){
+ supplierId: row.ID,
+ page: 1,
+ pageSize: 100
+ }).then((res) => {
+ if (res.code === 200) {
this.productTableList.tableProductList = res.data.list
}
})
- this.$set(this.editConfig.infomation,'supplierName',row.name)
- this.editConfig.infomation.contact = row.contact;
- this.editConfig.infomation.phone = row.phone;
- this.editConfig.infomation.supplierId = row.ID;
+ this.$set(this.editConfig.infomation, "supplierName", row.name)
+ this.editConfig.infomation.contact = row.contact
+ this.editConfig.infomation.phone = row.phone
+ this.editConfig.infomation.supplierId = row.ID
},
// 娓呴櫎宸查�夋嫨鐢ㄦ埛
clearupClient(value) {
if (value == "client") {
- this.$set(this.editConfig.infomation, "supplierName", "");
- this.supplierId = null;
- this.$forceUpdate();
+ this.$set(this.editConfig.infomation, "supplierName", "")
+ this.supplierId = null
+ this.$forceUpdate()
}
},
setTableForm() {
- if (
- !this.editConfig.infomation.ID ||
- this.editConfig.infomation.productList.length === 0
- ) {
+ if (!this.editConfig.infomation.ID || this.editConfig.infomation.productList.length === 0) {
this.tableData = [
{
- purchaseId:0,
+ purchaseId: 0,
productId: this.productId,
- productIndex:this.productIndex,
+ productIndex: this.productIndex,
amount: 0,
name: "",
number: "",
price: 0,
total: 0,
- remark:'',
- unit:'',
- purchasePrice:'',
- deliveryTime:"",
- shippingDuration:"",
- specifications:"",
- modelNumber:"",
- },
- ];
+ remark: "",
+ unit: "",
+ purchasePrice: "",
+ deliveryTime: "",
+ shippingDuration: "",
+ specifications: "",
+ modelNumber: ""
+ }
+ ]
} else {
- this.tableData = this.editConfig.infomation.productList;
+ this.tableData = this.editConfig.infomation.productList
// this.tableData.map((item, index) => {
// item.productId = index + 1;
// });
}
this.productTableList = {
- tableProductList:[],
- supplierId:undefined,
+ tableProductList: [],
+ supplierId: undefined,
tableData: this.tableData,
- disabled:this.editConfig.isDisabled,
+ disabled: this.editConfig.isDisabled,
tableColumn: [
{
label: "浜у搧鍚嶇О",
@@ -758,88 +757,87 @@
min: 180,
productName: true,
isRequird: true,
- disabled:this.editConfig.isDisabled,
+ disabled: this.editConfig.isDisabled
},
- { label: "浜у搧缂栧彿", prop: "number", min: 150,},
+ { label: "浜у搧缂栧彿", prop: "number", min: 150 },
{ label: "璁¢噺鍗曚綅", prop: "unit" },
- { label: "瑙勬牸鍨嬪彿", prop: "specifications",},
- { label: "鏁伴噺", prop: "amount", inputNumber: true,disabled:this.editConfig.isDisabled, },
+ { label: "瑙勬牸鍨嬪彿", prop: "specifications" },
+ { label: "鏁伴噺", prop: "amount", inputNumber: true, disabled: this.editConfig.isDisabled },
{
label: "閲囪喘鍗曚环",
prop: "price",
inputFloat: true,
isRequird: true,
- disabled:this.editConfig.isDisabled,
+ disabled: this.editConfig.isDisabled
},
- { label: "浠风◣鍚堣", prop: "total", inputFloat: true,disabled:this.editConfig.isDisabled,multiply:true, },
- { label: "鎻忚堪", prop: "remark", input: true,disabled:this.editConfig.isDisabled},
- ],
- };
- this.toal=this.editConfig.infomation.realTotalPrice
-
+ { label: "浠风◣鍚堣", prop: "total", inputFloat: true, disabled: this.editConfig.isDisabled, multiply: true },
+ { label: "鎻忚堪", prop: "remark", input: true, disabled: this.editConfig.isDisabled }
+ ]
+ }
+ this.toal = this.editConfig.infomation.realTotalPrice
},
// 浜у搧鍒楄〃杈撳叆
inputContent(val, prop, row) {
// this.productId = row.productId;
- this.productIndex=row.productIndex;
- let num=0
+ this.productIndex = row.productIndex
+ let num = 0
this.tableData.map((item) => {
- num+=item.amount
+ num += item.amount
if (item.productIndex === row.productIndex) {
- item[prop] = val;
+ item[prop] = val
}
- });
- if(prop==="amount"){
- this.editConfig.infomation.quantity=num
+ })
+ if (prop === "amount") {
+ this.editConfig.infomation.quantity = num
}
},
- getSummaries(total){
- this.totalTwo= JSON.parse(JSON.stringify(total));
- this.total=total;
+ getSummaries(total) {
+ this.totalTwo = JSON.parse(JSON.stringify(total))
+ this.total = total
this.getTotal()
},
- getTotal(){
- let prie=0
- if(this.editConfig.infomation.priceAdjustmentType==1){
- prie=Number(this.editConfig.infomation.priceAdjustment)
- }else if(this.editConfig.infomation.priceAdjustmentType==2){
- prie=(-1)*Number(this.editConfig.infomation.priceAdjustment)
- }else{
- prie=0
+ getTotal() {
+ let prie = 0
+ if (this.editConfig.infomation.priceAdjustmentType == 1) {
+ prie = Number(this.editConfig.infomation.priceAdjustment)
+ } else if (this.editConfig.infomation.priceAdjustmentType == 2) {
+ prie = -1 * Number(this.editConfig.infomation.priceAdjustment)
+ } else {
+ prie = 0
}
- let t=0
- if(this.editConfig.infomation.wholeDiscountType==1){
- t=this.totalTwo*Number(this.editConfig.infomation.wholeDiscount)/100
- }else if(this.editConfig.infomation.wholeDiscountType==2){
- t=Number(this.editConfig.infomation.wholeDiscount)
- }else{
- t=0
+ let t = 0
+ if (this.editConfig.infomation.wholeDiscountType == 1) {
+ t = (this.totalTwo * Number(this.editConfig.infomation.wholeDiscount)) / 100
+ } else if (this.editConfig.infomation.wholeDiscountType == 2) {
+ t = Number(this.editConfig.infomation.wholeDiscount)
+ } else {
+ t = 0
}
- this.total=this.totalTwo-t+Number(prie)
+ this.total = this.totalTwo - t + Number(prie)
},
// 浜у搧鏂板
addProductClick() {
- this.productIndex++;
+ this.productIndex++
this.tableData.push({
productIndex: this.productIndex,
- productId:'',
+ productId: "",
id: 0,
amount: 0,
desc: "",
name: "",
number: "",
price: 0,
- total: 0,
- });
- this.showSummary.show = true;
+ total: 0
+ })
+ this.showSummary.show = true
},
// 浜у搧娓呯┖
emptyProductClick() {
- this.productIndex = 1;
+ this.productIndex = 1
this.tableData = [
{
- productId: '',
- productIndex:this.productIndex,
+ productId: "",
+ productIndex: this.productIndex,
id: 0,
amount: "0",
desc: "",
@@ -847,26 +845,26 @@
number: "",
price: 0,
total: 0
- },
- ];
- this.productTableList.tableData = this.tableData;
+ }
+ ]
+ this.productTableList.tableData = this.tableData
},
clearupProduct(data) {
- this.tableData = data;
- this.productTableList.tableData = this.tableData;
+ this.tableData = data
+ this.productTableList.tableData = this.tableData
},
//閫夋嫨琛�
- rowClick(row){
- console.log(row,"xuanze")
- this.productListIdx=row.productIndex
+ rowClick(row) {
+ console.log(row, "xuanze")
+ this.productListIdx = row.productIndex
},
//閫変腑浜у搧
- handleProduct(item){
- this.tableData[this.productListIdx].productId=item.ID
- console.log(item,"閫変腑浜у搧",this.tableData)
+ handleProduct(item) {
+ this.tableData[this.productListIdx].productId = item.ID
+ console.log(item, "閫変腑浜у搧", this.tableData)
}
- },
-};
+ }
+}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
diff --git a/src/views/purchaseManage/purchase/index.vue b/src/views/purchaseManage/purchase/index.vue
index 806d08f..2c70931 100644
--- a/src/views/purchaseManage/purchase/index.vue
+++ b/src/views/purchaseManage/purchase/index.vue
@@ -1,16 +1,16 @@
<template>
- <div class="purchase" v-loading="tableLoading">
+ <div class="purchase" v-loading="tableLoading">
<div class="filter">
<div class="filter-card">
<CommonSearch
- :show-add="true"
- add-title="鏂板缓"
- @addCommonClick="addBtnClick"
- :show-download="false"
- :amount-view="false"
- :show-action-btn="false"
- :placeholder="'璇疯緭鍏ヤ緵搴斿晢鍚嶇О/鐗╂枡鍚嶇О/閲囪喘鍗曞悕绉�'"
- @searchClick="onFilterSearch"
+ :show-add="true"
+ add-title="鏂板缓"
+ @addCommonClick="addBtnClick"
+ :show-download="false"
+ :amount-view="false"
+ :show-action-btn="false"
+ :placeholder="'璇疯緭鍏ヤ緵搴斿晢鍚嶇О/鐗╂枡鍚嶇О/閲囪喘鍗曞悕绉�'"
+ @searchClick="onFilterSearch"
/>
</div>
</div>
@@ -19,30 +19,45 @@
<div class="body-card">
<div class="list-view">
<TableCommonView
- ref="tableListRef"
- :table-list="tableList"
- @selCommonClick="selCommonClick"
- @selTableCol="selTableCol"
+ ref="tableListRef"
+ :table-list="tableList"
+ @selCommonClick="selCommonClick"
+ @selTableCol="selTableCol"
>
<template slot="tableButton">
- <el-table-column label="鐘舵��" width="120">
+ <el-table-column label="鐘舵��" width="120">
<template slot-scope="scope">
{{ getpurchaseStatus(scope.row.status) }}
</template>
</el-table-column>
<el-table-column label="鎿嶄綔" width="220" fixed="right">
<template slot-scope="scope">
- <el-button v-if="scope.row.status===1" type="text" size="small" @click="btnConfirm(scope.row)" style="margin-right: 5px"
- >纭</el-button
+ <el-button
+ v-if="scope.row.status === 1"
+ type="text"
+ size="small"
+ @click="btnConfirm(scope.row)"
+ style="margin-right: 5px"
+ >纭</el-button
>
- <el-button v-if="scope.row.status===1" type="text" size="small" @click="btnEdit(scope.row)" style="margin-right: 5px"
- >缂栬緫</el-button
+ <el-button
+ v-if="scope.row.status === 1"
+ type="text"
+ size="small"
+ @click="btnEdit(scope.row)"
+ style="margin-right: 5px"
+ >缂栬緫</el-button
>
<el-button type="text" size="small" @click="btnLook(scope.row)" style="margin-right: 5px"
- >鏌ョ湅</el-button
+ >鏌ョ湅</el-button
>
- <el-button v-if="scope.row.status===1" type="text" size="small" @click="btnCancel(scope.row)" style="margin-right: 5px"
- >鍙栨秷</el-button
+ <el-button
+ v-if="scope.row.status === 1"
+ type="text"
+ size="small"
+ @click="btnCancel(scope.row)"
+ style="margin-right: 5px"
+ >鍙栨秷</el-button
>
<!-- <el-button v-if="scope.row.status===1" type="text" size="small" @click="btnDelete(scope.row)" style="margin-right: 5px"
>鍒犻櫎</el-button
@@ -59,7 +74,6 @@
</div>
</div>
-
<!-- 鏂板缓/缂栬緫閿�鍞嚎绱� -->
<!-- <AddSalesLeadDialog v-if="editSalesLeadConfig.visible" :edit-rightContent-config="editSalesLeadConfig" /> -->
<!-- 璇︽儏 -->
@@ -71,11 +85,11 @@
<script>
import pageMixin from "@/components/makepager/pager/mixin/pageMixin"
-import { getPurchaseList, getPurchaseInfo, submitPurchase,deletePurchase } from "@/api/purchaseManage/purchase"
+import { getPurchaseList, getPurchaseInfo, submitPurchase, deletePurchase } from "@/api/purchaseManage/purchase"
import DetailSupplier from "@/views/purchaseManage/purchase/DetailSupplier"
import AddPurchase from "@/views/purchaseManage/purchase/components/AddPurchase"
import { getSupplierList } from "@/api/supplierManage/supplier"
-import { getDataByType } from "@/api/data";
+import { getDataByType } from "@/api/data"
export default {
name: "SupplierManage",
props: {},
@@ -84,7 +98,7 @@
computed: {},
data() {
return {
- purchaseStatusList:getDataByType('purchaseStatus'),
+ purchaseStatusList: getDataByType("purchaseStatus"),
tableLoading: false,
tableList: {}, // 鍒楄〃
selValueList: [],
@@ -97,15 +111,15 @@
editConfig: {
visible: false,
title: "鍒涘缓",
- isDisabled:false,
- detailEnter:false,
+ isDisabled: false,
+ detailEnter: false,
infomation: {
- supplierList:[]
+ supplierList: []
}
},
tableColumn: [
{ label: "鍗曟嵁绫诲瀷", prop: "orderType", min: 130 },
- { label: "閲囪喘鍗曞彿", prop: "number", min: 150, isCommonClick: true ,default:true},
+ { label: "閲囪喘鍗曞彿", prop: "number", min: 150, isCommonClick: true, default: true },
{ label: "閲囪喘鍗曞悕绉�", prop: "name", min: 130, isCommonClick: true },
{ label: "渚涘簲鍟嗗悕绉�", prop: "supplierName", min: 130 },
{ label: "閲囪喘鏁伴噺", prop: "quantity", min: 130 },
@@ -113,22 +127,18 @@
{ label: "缁忓姙浜�", prop: "handledBy", min: 130 },
{ label: "鍒跺崟浜�", prop: "creator", min: 130 }
],
- showCol: ['閲囪喘鍗曞彿', '閲囪喘鍗曞悕绉�', '鍗曟嵁绫诲瀷', '渚涘簲鍟嗗悕绉�', '閲囪喘鏁伴噺', '鏀惰揣浠撳簱','缁忓姙浜�','鍒跺崟浜�'],
- pagerOptions:{
- pageSize:15,
- currPage:1,
- },
+ showCol: ["閲囪喘鍗曞彿", "閲囪喘鍗曞悕绉�", "鍗曟嵁绫诲瀷", "渚涘簲鍟嗗悕绉�", "閲囪喘鏁伴噺", "鏀惰揣浠撳簱", "缁忓姙浜�", "鍒跺崟浜�"]
}
},
created() {
- console.log(this.$route.params,"璺敱鍙傛暟")
- if(this.$route.params.supplierId){
+ console.log(this.$route.params, "璺敱鍙傛暟")
+ if (this.$route.params.supplierId) {
this.editConfig.visible = true
this.editConfig.infomation = {
productList: [],
purchaseTypeId: "",
- supplierId: this.$route.params.supplierId||'',
- supplierName: this.$route.params.supplierName||'',
+ supplierId: this.$route.params.supplierId || "",
+ supplierName: this.$route.params.supplierName || "",
orderSource: "鎵嬪姩鍒涘缓",
name: "",
contact: "",
@@ -159,11 +169,11 @@
return "--"
}
},
- setColumnVisible(showCol){
- return this.tableColumn.map(ele=>{
+ setColumnVisible(showCol) {
+ return this.tableColumn.map((ele) => {
return {
...ele,
- isShowColumn:showCol.includes(ele.label)
+ isShowColumn: showCol.includes(ele.label)
}
})
},
@@ -173,64 +183,62 @@
selectIndex: true,
showcol: this.showCol,
allcol: [],
- tableColumn:this.setColumnVisible(this.showCol)
+ tableColumn: this.setColumnVisible(this.showCol)
}
- this.tableList.allcol = this.tableList.tableColumn.filter(ele=>!ele.default).map(ele=>ele.label);
+ this.tableList.allcol = this.tableList.tableColumn.filter((ele) => !ele.default).map((ele) => ele.label)
},
selTableCol(val) {
- this.showcol = val;
- this.tableList.tableColumn = this.setColumnVisible(val);
+ this.showcol = val
+ this.tableList.tableColumn = this.setColumnVisible(val)
},
// 璇锋眰鏁版嵁
async getData() {
await getPurchaseList({
- keyword: this.search||'',
+ keyword: this.search || "",
page: this.pagerOptions.currPage,
pageSize: this.pagerOptions.pageSize
})
- .then((res) => {
- if (res.code === 200) {
- let list = res.data.list
- list.map((item)=>{
- item.supplierName=item.supplier.name
- })
- this.tableList.tableInfomation = list || []
- this.pagerOptions.totalCount = res.data.total
- }
- })
- .catch((err) => {
- console.log(err)
- })
+ .then((res) => {
+ if (res.code === 200) {
+ let list = res.data.list
+ list.map((item) => {
+ item.supplierName = item.supplier.name
+ })
+ this.tableList.tableInfomation = list || []
+ this.pagerOptions.totalCount = res.data.total
+ }
+ })
+ .catch((err) => {
+ console.log(err)
+ })
},
// 鑾峰彇渚涘簲鍟嗘暟鎹�
async getSupplierData() {
await getSupplierList({
// [val]: content,
- status:1,
- page:1,
+ status: 1,
+ page: 1,
pageSize: 10
- })
- .then((res) => {
+ }).then((res) => {
if (res.data.code == 200) {
- this.editConfig.infomation.supplierList=res.data.data.list
-
+ this.editConfig.infomation.supplierList = res.data.data.list
}
})
},
// 鎼滅储
- onFilterSearch(searchText){
- this.search = searchText ?? ''
+ onFilterSearch(searchText) {
+ this.search = searchText ?? ""
this.pagerOptions.currPage = 1
this.getData()
},
// 鏂板缓
addBtnClick() {
- this.editConfig.detailEnter=false
- this.editConfig.isDisabled=false
+ this.editConfig.detailEnter = false
+ this.editConfig.isDisabled = false
// this.editRow = {};
// this.$refs.add.islook = true;
this.editConfig.visible = true
- this.editConfig.title = "鍒涘缓"
+ this.editConfig.title = "鏂板缓"
this.editConfig.infomation = {
productList: [],
purchaseTypeId: "",
@@ -238,6 +246,7 @@
supplierName: "",
orderSource: "鎵嬪姩鍒涘缓",
name: "",
+ number: "",
contact: "",
phone: "",
signingDate: "",
@@ -253,16 +262,16 @@
// 缂栬緫
btnEdit(row) {
- this.editConfig.detailEnter=false
- this.editConfig.isDisabled=false
+ this.editConfig.detailEnter = false
+ this.editConfig.isDisabled = false
this.tableLoading = true
- getPurchaseInfo({ id: row.ID }).then((res) => {
+ getPurchaseInfo({ id: row.id }).then((res) => {
if (res.code == 200) {
this.tableLoading = false
this.editConfig.visible = true
this.editConfig.title = "缂栬緫"
- res.data.productList.map((item,index)=>{
- item.productIndex=index
+ res.data.productList.map((item, index) => {
+ item.productIndex = index
})
this.editConfig.infomation = {
productList: res.data.productList,
@@ -281,20 +290,20 @@
},
// 纭鍙戣揣
btnConfirm(row) {
- let string='鏄惁鎻愪氦锛�'
- if(!row.supplierName){
- string='鎮ㄦ湁蹇呭~瀛楁鏈綍鍏ワ紝璇锋鏌ユ暟鎹畬鏁存�с��'
+ let string = "鏄惁鎻愪氦锛�"
+ if (!row.supplierName) {
+ string = "鎮ㄦ湁蹇呭~瀛楁鏈綍鍏ワ紝璇锋鏌ユ暟鎹畬鏁存�с��"
}
this.$confirm(string, "鎻愮ず", {
confirmButtonText: "纭畾",
cancelButtonText: "鍙栨秷",
type: "warning"
- })
- .then(() => {
- if(!row.supplierName){
- this.btnEdit(row)
- }else{
- submitPurchase({ id: row.ID,status:2 }).then((response) => {
+ }).then(
+ () => {
+ if (!row.supplierName) {
+ this.btnEdit(row)
+ } else {
+ submitPurchase({ id: row.ID, status: 2 }).then((response) => {
if (response.code === 200) {
this.$message.success("鎻愪氦鎴愬姛")
this.getData()
@@ -303,38 +312,42 @@
}
})
}
-
- },(e)=>{
+ },
+ (e) => {
console.error(e)
- })
+ }
+ )
},
// 鍙栨秷
- btnCancel(row){
+ btnCancel(row) {
this.$confirm("鏄惁鍙栨秷?", "鎻愮ず", {
confirmButtonText: "纭畾",
cancelButtonText: "鍙栨秷",
type: "warning"
- })
- .then(() => {
- submitPurchase({ id: row.ID,status:5 }).then((response) => {
- if (response.code === 200) {
- this.$message.success("宸插彇娑�")
- this.getData()
- } else {
- // this.$message.warning("鎻愪氦澶辫触")
- }
- })
- },(e)=>{
- console.error(e)
- })
+ }).then(
+ () => {
+ submitPurchase({ id: row.ID, status: 5 }).then((response) => {
+ if (response.code === 200) {
+ this.$message.success("宸插彇娑�")
+ this.getData()
+ } else {
+ // this.$message.warning("鎻愪氦澶辫触")
+ }
+ })
+ },
+ (e) => {
+ console.error(e)
+ }
+ )
},
// 鍒犻櫎
- btnDelete(row){
- this.$confirm('姝ゆ搷浣滃皢姘镐箙鍒犻櫎璇ユ枃浠�, 鏄惁缁х画?', '鎻愮ず', {
- confirmButtonText: '纭畾',
- cancelButtonText: '鍙栨秷',
- type: 'warning'
- }).then(() => {
+ btnDelete(row) {
+ this.$confirm("姝ゆ搷浣滃皢姘镐箙鍒犻櫎璇ユ枃浠�, 鏄惁缁х画?", "鎻愮ず", {
+ confirmButtonText: "纭畾",
+ cancelButtonText: "鍙栨秷",
+ type: "warning"
+ })
+ .then(() => {
deletePurchase({ id: row.ID }).then((response) => {
if (response.code === 200) {
this.$message.success("鍒犻櫎鎴愬姛")
@@ -343,19 +356,20 @@
this.$message.warning("鍒犻櫎澶辫触")
}
})
- }).catch(() => {
+ })
+ .catch(() => {
this.$message({
- type: 'info',
- message: '宸插彇娑堝垹闄�'
- });
- });
+ type: "info",
+ message: "宸插彇娑堝垹闄�"
+ })
+ })
},
// 鏌ョ湅
- btnLook(row){
- this.editConfig.detailEnter=true
- this.editConfig.isDisabled=true
+ btnLook(row) {
+ this.editConfig.detailEnter = true
+ this.editConfig.isDisabled = true
this.tableLoading = true
- getPurchaseInfo({ id: row.ID }).then((res) => {
+ getPurchaseInfo({ id: row.id }).then((res) => {
if (res.code == 200) {
this.tableLoading = false
this.editConfig.visible = true
@@ -376,9 +390,9 @@
// 璇︽儏
selCommonClick(row) {
this.tableLoading = true
- getPurchaseInfo({ id: row.ID }).then((res) => {
+ getPurchaseInfo({ id: row.id }).then((res) => {
if (res.code == 200) {
- console.log(res,"浜у搧璇︽儏")
+ console.log(res, "浜у搧璇︽儏")
this.tableLoading = false
this.commonDetail.visible = true
this.commonDetail.infomation = {
@@ -399,16 +413,16 @@
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="scss" scoped>
-.purchase{
+.purchase {
height: 100%;
overflow: hidden;
background-color: transparent;
- .filter{
+ .filter {
height: 80px;
display: flex;
align-items: center;
padding: 12px 20px 0 20px;
- &-card{
+ &-card {
height: 80px;
display: flex;
align-items: center;
@@ -419,7 +433,7 @@
background-color: #fff;
}
}
- .body{
+ .body {
box-sizing: border-box;
padding: 10px 20px;
border-radius: 12px;
diff --git a/src/views/supplierManage/supplier/AddSupplier.vue b/src/views/supplierManage/supplier/AddSupplier.vue
index c8dbfa4..37b31a4 100644
--- a/src/views/supplierManage/supplier/AddSupplier.vue
+++ b/src/views/supplierManage/supplier/AddSupplier.vue
@@ -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">
@@ -100,8 +114,8 @@
style="width: 63%"
>
<el-option
- v-for="item in memberOptions"
- :key="item.id"
+ v-for="(item, index) in memberOptions"
+ :key="index"
:label="item.username"
:value="item.userName"
>
@@ -211,7 +225,7 @@
createContract,
updateSupplier,
getIndustryList,
- getSupplierTypeList,
+ getSupplierTypeList
// downloadContract
// previewContract
} from "@/api/supplierManage/supplier"
@@ -220,8 +234,10 @@
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,
@@ -237,7 +253,8 @@
components: { EditDropdownDialog },
computed: {
headers() {
- const authorization = "Bearer "+document.cookie.replace(/(?:(?:^|.*;\s*)token\s*=\s*([^;]*).*$)|^.*$/, "$1")|| ''
+ const authorization =
+ "Bearer " + document.cookie.replace(/(?:(?:^|.*;\s*)token\s*=\s*([^;]*).*$)|^.*$/, "$1") || ""
return { authorization }
}
},
@@ -264,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" }], // 鎵�灞炶涓�
@@ -288,8 +306,17 @@
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({
@@ -365,12 +392,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 || "",
- responsiblePersonName: data.responsiblePersonName || document.cookie.replace(/(?:(?:^|.*;\s*)username\s*=\s*([^;]*).*$)|^.*$/, "$1"),
+ responsiblePersonName:
+ data.responsiblePersonName || document.cookie.replace(/(?:(?:^|.*;\s*)username\s*=\s*([^;]*).*$)|^.*$/, "$1"),
status: data.status || 0,
supplierType: data.supplierType || "",
url: data.url || ""
@@ -453,29 +481,34 @@
// window.open(routeUrl.href, "_blank")
// }
// }
- async previewClick() {
- this.previewUrl = "/api/previewContract?id=" + this.file_id
- if (this.file_name.includes("pdf")) {
+ async previewClick() {
+ this.previewUrl = "/api/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")
- }
+ 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")
+ }
}
}
}
diff --git a/src/views/supplierManage/supplier/index.vue b/src/views/supplierManage/supplier/index.vue
index 72e8400..3a98c79 100644
--- a/src/views/supplierManage/supplier/index.vue
+++ b/src/views/supplierManage/supplier/index.vue
@@ -119,7 +119,7 @@
<script>
import pageMixin from "@/components/makepager/pager/mixin/pageMixin"
import { getSupplierList, changeSupplierStatus } from "@/api/supplierManage/supplier"
-import {getPurchaseList} from "@/api/purchaseManage/purchase"
+import { getPurchaseList } from "@/api/purchaseManage/purchase"
import DetailSupplier from "@/views/supplierManage/supplier/DetailSupplier"
import AddSupplier from "@/views/supplierManage/supplier/AddSupplier"
import RaleteSupplierList from "@/views/supplierManage/supplier/RaleteSupplierList"
@@ -144,7 +144,7 @@
commonDetail: {
visible: false,
infomation: {},
- productListInfo:[]
+ productListInfo: []
},
editConfig: {
visible: false,
@@ -277,14 +277,14 @@
await getSupplierList({
name: this.searchSupplierName,
page: this.pagerOptions.currPage,
- pageSize: this.pagerOptions.pageSize,
+ pageSize: this.pagerOptions.pageSize
}).then((res) => {
console.log(res)
if (res.code === 200) {
const list = res.data.list.map((item) => {
return {
...item,
- id: item.ID,
+ id: item.id,
status_name: item.status === 0 ? "鏈惎鐢�" : "鍚敤"
}
})
@@ -292,7 +292,7 @@
this.tableList.tableInfomation = list || []
this.pagerOptions.totalCount = res.data.total
if (list && list.length > 0) {
- this.supplierId = this.tableList.tableInfomation[0].ID
+ this.supplierId = this.tableList.tableInfomation[0].id
this.selectRow = this.tableList.tableInfomation.length > 0 ? this.tableList.tableInfomation[0] : {}
} else {
this.supplierId = 0
@@ -347,7 +347,10 @@
addBtnClick() {
this.editConfig.visible = true
this.editConfig.title = "鏂板缓"
- this.editConfig.infomation = { fileId: 0,responsiblePersonName:document.cookie.replace(/(?:(?:^|.*;\s*)username\s*=\s*([^;]*).*$)|^.*$/, "$1")}
+ this.editConfig.infomation = {
+ fileId: 0,
+ responsiblePersonName: document.cookie.replace(/(?:(?:^|.*;\s*)username\s*=\s*([^;]*).*$)|^.*$/, "$1")
+ }
},
// 鍚敤渚涘簲鍟�
async enableClick(row, value) {
@@ -395,7 +398,7 @@
type: "warning"
})
.then(() => {
- deleteProduct({ id: row.ID }).then((response) => {
+ deleteProduct({ id: row.id }).then((response) => {
if (response.code === 200) {
this.$message.success("鍒犻櫎鎴愬姛")
this.getProductList()
@@ -418,13 +421,13 @@
console.log(row)
this.productPagerOptions.currPage = 1
this.selectRow = row
- this.supplierId = row.ID
+ this.supplierId = row.id
this.getProductList()
},
// 璇︽儏
async selCommonClick(row) {
- await getPurchaseList({pageSize:10,page:1,supplierId:row.ID}).then((res)=>{
- this.commonDetail.productListInfo=res.data.list
+ await getPurchaseList({ pageSize: 10, page: 1, supplierId: row.ID }).then((res) => {
+ this.commonDetail.productListInfo = res.data.list
})
this.commonDetail.visible = true
this.commonDetail.infomation = { ...row }
@@ -442,9 +445,9 @@
// 鍒涘缓閲囪喘鍗�
creatPurchase() {
this.editPurchaseConfig.visible = true
- this.editPurchaseConfig.title = "鍒涘缓"
+ this.editPurchaseConfig.title = "鏂板缓"
this.editPurchaseConfig.infomation = {
- supplierId: this.selectRow.ID,
+ supplierId: this.selectRow.id,
supplierName: this.selectRow.name
}
}
--
Gitblit v1.8.0