Browse Source

公共组件

lilei 4 years ago
parent
commit
efd07f8e8d

+ 29 - 4
src/views/common/editInput.js

@@ -1,11 +1,14 @@
 const EditableCell = {
   template: `
       <div style="display:flex;align-items: center;">
+        <span>
+        {{punit}} 
+        </span>
         <div class="editable-cell-input-wrapper">
           <a-input-number 
-          size="small" 
-          :min="0.1" 
-          :max="100000" 
+          :size="size"
+          :min="min" 
+          :max="max" 
           :value="value" 
           :precision="precision"
           :step="step"
@@ -15,7 +18,8 @@ const EditableCell = {
         <a-icon
           type="check"
           slot="suffix"
-          :style="{color: editable?'#08c':'#666', marginLeft: '10px' }"
+          :title="editable?'保存':''"
+          :style="{color: editable?'#08c':'#666', marginLeft: '5px' }"
           @click="check"
         />
       </div>
@@ -29,6 +33,22 @@ const EditableCell = {
     step: {
       type: [Number],
       default: 1
+    },
+    min: {
+      type: [Number],
+      default: 0
+    },
+    max: {
+      type: [Number],
+      default: 999999
+    },
+    size: {
+      type: String,
+      default: 'default'
+    },
+    punit: {
+      type: String,
+      default: ''
     }
   },
   data() {
@@ -37,6 +57,11 @@ const EditableCell = {
       editable: false,
     };
   },
+  watch:{
+    text(newVal,oldVal){
+      this.value = newVal
+    }
+  },
   methods: {
     handleChange(value) {
       this.value = value;

+ 68 - 0
src/views/common/productBrand.js

@@ -0,0 +1,68 @@
+import { dealerProductBrandQuery } from '@/api/dealerProductBrand'
+const ProductBrand = {
+  template: `
+      <a-select
+        placeholder="请选择产品品牌"
+        :id="id"
+        allowClear
+        :value="defaultVal"
+        :showSearch="true"
+        @change="handleChange"
+        option-filter-prop="children"
+        :filter-option="filterOption">
+        <a-select-option v-for="item in productBrandList" :key="item.brandSn" :value="item.brandSn">{{ item.brandName }}</a-select-option>
+      </a-select>
+    `,
+  props: {
+    value: {
+      type: String,
+      defatut: ''
+    },
+    id: {
+      type: String,
+      default: ''
+    },
+    sysFlag: {
+      type: String,
+      default: '1'
+    }
+  },
+  data() {
+    return {
+      defaultVal: this.value,
+      productBrandList: []
+    };
+  },
+  mounted() {
+    this.getProductBrand()
+  },
+  watch: {
+    value(newValue, oldValue) {
+      this.defaultVal = newValue
+    }
+  },
+  methods: {
+    filterOption (input, option) {
+      return (
+        option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
+      )
+    },
+    handleChange(value) {
+      this.defaultVal = value;
+      this.$emit('change', value);
+      this.$emit('input', value);
+    },
+    //  产品品牌列表, sysFlag: 1 箭冠 0 自建
+    getProductBrand () {
+      dealerProductBrandQuery({ 'sysFlag': this.sysFlag }).then(res => {
+        if (res.status == 200) {
+          this.productBrandList = res.data
+        } else {
+          this.productBrandList = []
+        }
+      })
+    },
+  },
+};
+
+export default ProductBrand

+ 59 - 0
src/views/common/productType.js

@@ -0,0 +1,59 @@
+import { productTypeQuery } from '@/api/productType'
+const ProductType = {
+  template: `
+      <a-cascader
+        @change="handleChange"
+        change-on-select
+        :value="defaultVal"
+		expand-trigger="hover"
+        :options="productTypeList"
+        :fieldNames="{ label: 'productTypeName', value: 'productTypeSn', children: 'children' }"
+        :id="id"
+        placeholder="请选择产品分类"
+        allowClear />
+    `,
+  props: {
+    value: {
+      type: Array,
+      defatut: function(){
+        return []
+      }
+    },
+    id: {
+      type: String,
+      default: ''
+    },
+  },
+  data() {
+    return {
+      defaultVal: this.value,
+      productTypeList: []
+    };
+  },
+  watch: {
+    value(newValue, oldValue) {
+      this.defaultVal = newValue
+    }
+  },
+  mounted() {
+    this.getProductType()
+  },
+  methods: {
+    handleChange(value) {
+      this.defaultVal = value;
+      this.$emit('change', this.value);
+    },
+    //  产品分类列表
+    getProductType () {
+      productTypeQuery({}).then(res => {
+        if (res.status == 200) {
+          this.productTypeList = res.data
+        } else {
+          this.productTypeList = []
+        }
+      })
+    }
+  },
+};
+
+export default ProductType

+ 2 - 2
src/views/salesManagement/examineVerify/list.vue

@@ -30,13 +30,13 @@
             </a-form-item>
           </a-col>
           <a-col :md="6" :sm="24">
-            <a-form-item label="出库类型">
+            <a-form-item label="打印状态">
               <v-select
                 v-model="queryParam.billStatus"
                 ref="billStatus"
                 id="examineVerifyList-billStatus"
                 code="PAYMENT_TYPE"
-                placeholder="请选择出库类型"
+                placeholder="请选择打印状态"
                 allowClear></v-select>
             </a-form-item>
           </a-col>