zhangqi 1 سال پیش
والد
کامیت
d911a2d29b
3فایلهای تغییر یافته به همراه32 افزوده شده و 7 حذف شده
  1. 9 1
      src/DRP/SDrpManagement/order/detail/index.vue
  2. 2 2
      src/stores/modules/base.js
  3. 21 4
      src/template/selectProduct/index.vue

+ 9 - 1
src/DRP/SDrpManagement/order/detail/index.vue

@@ -165,6 +165,7 @@
                 :isSelect="!isPromotion"
                 :selectAll="isPromotion"
                 :columns="utils.TBLayout('orderAddTable')"
+                :needQuestSearch="isPromotion ? false : true"
                 :disabled="
                   utils.isDisabled(
                     orderData.status,
@@ -668,6 +669,7 @@ const showQtyModal = (val)=>{
 }
 const hideModal = ()=>{
   qtyModal.value = false
+  promotionQty.value = null
   selectProd.value.visible = false
 }
 const promotionToBillBody = ()=>{
@@ -686,7 +688,13 @@ const addProductToBody = async (val) => {
       items: val,
     },
   };
-  base.addRepeatProd(param).then((res) => {
+  base.addRepeatProd(param,()=>{
+    if (isPromotion) {
+      message.error('该套餐已存在,请勿重复添加!')
+      return false
+    }
+  }).then((res) => {
+    console.log(res)
     const allowAdd = (e) => {
       if (e.iscustomsize == 1) {
         if (!e.length || !e.width) {

+ 2 - 2
src/stores/modules/base.js

@@ -163,7 +163,7 @@ export const useBaseStore = defineStore('base', {
     /**
      * 判断订单是否允许添加重复商品
      */
-    addRepeatProd (data) {
+    addRepeatProd (data,callback) {
       return new Promise(async (resolve, reject) => {
         const res = await Api.requested(data)
         if (!res.data.isrepeat && res.data.items.length > 0) {
@@ -176,7 +176,7 @@ export const useBaseStore = defineStore('base', {
             okText:'确认添加',
             content: `${res.data.items.map(e=>e.itemname).join(',')}已存在,是否继续添加?`,
             onOk() {
-              resolve()
+              callback ? callback():resolve()
             },
             onCancel() {
               console.log('Cancel');

+ 21 - 4
src/template/selectProduct/index.vue

@@ -14,7 +14,8 @@
         <a-button style="margin-right: 8px" @click="onClose">关闭</a-button>
         <a-button type="primary" :disabled="tableRecord.length == 0" @click="onOK">添加</a-button>
       </template>
-      <a-input class="search-panel" v-model:value="search" placeholder="搜索内容" @keyup.enter="searchData" allowClear></a-input>
+      <a-input v-if="needQuestSearch" class="search-panel" v-model:value="search" placeholder="搜索内容" @keyup.enter="searchData" allowClear></a-input>
+      <a-input v-else class="search-panel" v-model:value="search" placeholder="静态搜索内容" @keyup.enter="filterItems" allowClear></a-input>
       <slot name="more"></slot>
       <a-table
         :loading="loading"
@@ -67,7 +68,8 @@
     loading:Boolean,
     tableid:Number,
     rowKey:String,
-    selectAll:Boolean
+    selectAll:Boolean,
+    needQuestSearch:Boolean
   })
   const propsColumns = ref(props.columns)
   const visible = ref(false)
@@ -149,7 +151,7 @@
     props.param.content.pageSize = pagination.pageSize
     listData()
   }
-  const listData = async (dataIndex,value)=> {
+  const listData = async (fn)=> {
     props.param.content.where.tablefilter = {}
     propsColumns.value.forEach((e)=>{
       e.value?props.param.content.where.tablefilter[e.dataIndex] = e.value:''
@@ -165,6 +167,9 @@
       tableRecord.value = res.data
       selectedRowKeys.value = res.data.map(e=>e.itemid)
     }
+
+    // 开启列表数据静态过滤
+    props.needQuestSearch ? fn() :''
   }
   const onSelect = async (record, selected, selectedRows, nativeEvent)=>{
     if (!selected) {
@@ -178,11 +183,23 @@
     props.param.content.pageNumber = 1
     listData()
   }
-
   const reloadSelect = () =>{
     selectedRowKeys.value = []
     tableRecord.value = []
   }
+  const filterItems = async (searchText)=> {
+    listData(()=>{
+      const items =  ['itemname', 'itemno', 'standards', 'model', 'spec']
+      data.value = data.value.filter(item => {  
+        // 假设我们搜索name和description字段  
+        return (
+          items.some(field => item[field].toLowerCase().includes(search.value.toLowerCase())) 
+        );  
+      });
+    })
+    
+  }  
+
   defineExpose({
     visible,
     listData,