From 809a043745ecf5d8986998ea30933e019f4f4f4d Mon Sep 17 00:00:00 2001
From: zuozhengqing <a13193816592@163.com>
Date: 星期六, 21 十月 2023 16:35:52 +0800
Subject: [PATCH] 报废单编辑接口参数调整
---
src/views/productManage/productCategory/AddProductCategoryDialog.vue | 71 ++++++++++++++++++++++++++++++++---
1 files changed, 65 insertions(+), 6 deletions(-)
diff --git a/src/views/productManage/productCategory/AddProductCategoryDialog.vue b/src/views/productManage/productCategory/AddProductCategoryDialog.vue
index e0833be..b8453ee 100644
--- a/src/views/productManage/productCategory/AddProductCategoryDialog.vue
+++ b/src/views/productManage/productCategory/AddProductCategoryDialog.vue
@@ -1,14 +1,14 @@
<template>
<div class="add-common">
<el-dialog
- :title="editCommonConfig.title + '浜у搧绫诲埆'"
+ :title="modalTitle + '浜у搧绫诲埆'"
:visible.sync="editConfig.visible"
:width="dialogWidth"
:before-close="handleClose"
>
<!-- 澶� -->
<div slot="title" class="dialog-header">
- <span>{{ editCommonConfig.title + "浜у搧绫诲埆" }}</span>
+ <span>{{ modalTitle + "浜у搧绫诲埆" }}</span>
<div class="header_btns">
<!-- <span class="btn">
<i class="el-icon-printer"></i>
@@ -38,7 +38,7 @@
size="mini"
>
<div class="basic-info">
- <FormBtnsView :showProduct="true" @productClick="productClick" />
+ <FormBtnsView :showProduct="true" :countObject="statisticsMap" @productClick="productClick" />
<div class="basic-info-view">
<!-- <el-row> -->
<!-- <el-col :span="24">
@@ -173,6 +173,7 @@
import { addProductCategory, updateProductCategory, deleteProductCategory } from "@/api/product/productCategory"
import { getDataByType } from "@/api/data"
+import {getProductList} from "@/api/product/product";
export default {
name: "AddProductCategoryDialog",
props: {
@@ -182,7 +183,8 @@
return {
visible: false,
title: "鏂板缓",
- infomation: { type: [] }
+ infomation: { type: [] },
+ autoEdit: false,
}
}
},
@@ -194,7 +196,17 @@
}
},
components: {},
- computed: {},
+ computed: {
+ modalTitle(){
+ if (this.editConfig.title === '缂栬緫' && this.editConfig.autoEdit){
+ return '缂栬緫'
+ }else if (this.editConfig.title === '缂栬緫') {
+ return !this.showEdit ? '缂栬緫' : '鏌ョ湅'
+ }else {
+ return '鏂板缓'
+ }
+ }
+ },
data() {
return {
dialogWidth: "50%",
@@ -212,13 +224,59 @@
showButton: true,
showEdit: false, // 鏄惁鏄剧ず缂栬緫鎸夐挳
isDelClick: false, // 鍒犻櫎鎸夐挳鏄惁鍙偣鍑�
- showFooter: false // 鏄惁鏄剧ず鍙栨秷淇濆瓨
+ showFooter: false, // 鏄惁鏄剧ず鍙栨秷淇濆瓨,
+ statisticsMap:{
+ product: 0 // 浜у搧鏁伴噺
+ }
}
},
created() {
this.setBottonView()
+ this.getProductCount()
+ if (this.editConfig.autoEdit){
+ this.editClick()
+ }
+ this.setOptionalFieldsToEmpty()
},
methods: {
+ /**
+ * 闈炲繀濉」鍚庣杩斿洖鐨勬槸鏁板瓧 0,琛ㄥ崟闇�瑕佺┖涓叉墠鑳借涓烘湭閫夋嫨鍥炴樉
+ */
+ setOptionalFieldsToEmpty(){
+ ['parentId','costingMethod','inventoryValuation','forceRemovalStrategy']
+ .filter(filed => this.editConfig.infomation[filed] === 0)
+ .forEach(filed => {
+ this.editConfig.infomation[filed] = ''
+ })
+ },
+ /**
+ * 鍚庣鍙帴鍙楁暟瀛楀舰寮�, 淇濆瓨鏃惰繕寰楀啀杞洖鍘�
+ */
+ unsetFieldsToNumber(){
+ ['parentId','costingMethod','inventoryValuation','forceRemovalStrategy']
+ .filter(filed => this.editConfig.infomation[filed] === '')
+ .forEach(filed => {
+ this.editConfig.infomation[filed] = 0
+ })
+ },
+ // 鑾峰彇浜у搧鏁伴噺
+ getProductCount(){
+ getProductList({
+ keyWord: '',
+ categoryId: this.editConfig.title === "鏂板缓" ? null : this.editConfig.infomation.id,
+ page: 1,
+ pageSize: 1
+ }).then((res) => {
+ if (res.code === 200) {
+ this.statisticsMap.product = res?.total ?? 0
+ }else{
+ this.statisticsMap.product = 0
+ }
+ }).catch(err=>{
+ console.error(err)
+ this.statisticsMap.product = 0
+ })
+ },
// 璁剧疆鍒犻櫎/鎵撳嵃/缂栬緫鏄惁鏄剧ず
setBottonView() {
if (this.editConfig.title === "鏂板缓") {
@@ -254,6 +312,7 @@
this.showFooter = true
},
saveParams() {
+ this.unsetFieldsToNumber()
let data = JSON.parse(JSON.stringify(this.editConfig.infomation))
let params = {
--
Gitblit v1.8.0