基本配置修改 优化
This commit is contained in:
		
							parent
							
								
									aa81840f1c
								
							
						
					
					
						commit
						f214efc8f7
					
				| 
						 | 
				
			
			@ -85,11 +85,23 @@
 | 
			
		|||
                    <el-table-column label="计量单位" align="center" prop="unitName" :show-overflow-tooltip="true" />
 | 
			
		||||
                    <el-table-column label="货品规格" align="center" prop="size" :show-overflow-tooltip="true">
 | 
			
		||||
                    </el-table-column>
 | 
			
		||||
                    <el-table-column label="采购数量" align="center" prop="purNum" :show-overflow-tooltip="true">
 | 
			
		||||
                   <!--  <el-table-column label="采购数量" align="center" prop="purNum" :show-overflow-tooltip="true">
 | 
			
		||||
                        <template slot-scope="scope">
 | 
			
		||||
                            <el-input  v-model.number="scope.row.purNum" placeholder="请输入" maxlength="10" clearable @input="(v)=>(scope.row.purNum=v.replace(/[^\d]/g,''))"/>
 | 
			
		||||
                        </template>
 | 
			
		||||
                    </el-table-column> -->
 | 
			
		||||
                    <el-table-column label="采购数量" align="center" prop="purNum" :show-overflow-tooltip="true">
 | 
			
		||||
                    <template slot-scope="scope">
 | 
			
		||||
                        <el-input
 | 
			
		||||
                        v-model.number="scope.row.purNum"
 | 
			
		||||
                        placeholder="请输入"
 | 
			
		||||
                        clearable
 | 
			
		||||
                        maxlength="11"
 | 
			
		||||
                        @input="(v) => limitDecimalInput(v, scope.row, 'purNum')"
 | 
			
		||||
                        />
 | 
			
		||||
                    </template>
 | 
			
		||||
                    </el-table-column>
 | 
			
		||||
 | 
			
		||||
                    <el-table-column label="备注" align="center" prop="notes" :show-overflow-tooltip="true">
 | 
			
		||||
                        <template slot-scope="scope">
 | 
			
		||||
                            <el-input  v-model="scope.row.notes" placeholder="请输入备注" maxlength="20" clearable/>
 | 
			
		||||
| 
						 | 
				
			
			@ -268,6 +280,35 @@ export default {
 | 
			
		|||
        },
 | 
			
		||||
    },
 | 
			
		||||
    methods: {
 | 
			
		||||
     limitDecimalInput(value, row, key) {
 | 
			
		||||
            // 只允许数字和小数点
 | 
			
		||||
            let val = value.replace(/[^\d.]/g, '');
 | 
			
		||||
 | 
			
		||||
            // 不允许开头是多个 0(除非小数)
 | 
			
		||||
            val = val.replace(/^0+(\d)/, '$1');
 | 
			
		||||
            val = val.replace(/^\./, '');
 | 
			
		||||
 | 
			
		||||
            // 只保留第一个小数点
 | 
			
		||||
            val = val.replace('.', '#').replace(/\./g, '').replace('#', '.');
 | 
			
		||||
 | 
			
		||||
            // 限制整数7位,小数最多3位
 | 
			
		||||
            if (val.includes('.')) {
 | 
			
		||||
            let [intPart, decPart] = val.split('.');
 | 
			
		||||
            intPart = intPart.slice(0, 7);
 | 
			
		||||
            decPart = decPart.slice(0, 3);
 | 
			
		||||
            val = intPart + '.' + decPart;
 | 
			
		||||
            } else {
 | 
			
		||||
            val = val.slice(0, 7); // 纯整数最多7位
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // 限制最大值为 9999999.999
 | 
			
		||||
            const max = 9999999.999;
 | 
			
		||||
            if (parseFloat(val) > max) {
 | 
			
		||||
            val = max.toString();
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            row[key] = val;
 | 
			
		||||
        },
 | 
			
		||||
        // 返回列表页
 | 
			
		||||
        jumpList() {
 | 
			
		||||
            const obj = { path: "/foodManage/purchaseManage/goodsInquiryEdit" };
 | 
			
		||||
| 
						 | 
				
			
			@ -283,7 +324,7 @@ export default {
 | 
			
		|||
            getGoodsInquiryInfoApi(param).then((response) => {
 | 
			
		||||
                this.baseInfo = response.data;
 | 
			
		||||
                console.log("this.baseInfo",this.baseInfo);
 | 
			
		||||
                this.$set(this.baseInfo,'dateRange',[this.baseInfo.startTime,this.baseInfo.endTime]) 
 | 
			
		||||
                this.$set(this.baseInfo,'dateRange',[this.baseInfo.startTime,this.baseInfo.endTime])
 | 
			
		||||
                this.materialList = this.baseInfo.detailList;
 | 
			
		||||
                supplierPageApi({ isPaging:1,areaIdList:[] }).then((response) => {
 | 
			
		||||
                    this.supplierOptions = response.rows||[];
 | 
			
		||||
| 
						 | 
				
			
			@ -362,7 +403,7 @@ export default {
 | 
			
		|||
        resetQuery() {
 | 
			
		||||
            this.queryParams = {
 | 
			
		||||
                pageNum: 1,
 | 
			
		||||
                pageSize: 10, 
 | 
			
		||||
                pageSize: 10,
 | 
			
		||||
            }
 | 
			
		||||
            this.resetForm("queryForm");
 | 
			
		||||
            this.handleQuery();
 | 
			
		||||
| 
						 | 
				
			
			@ -393,11 +434,11 @@ export default {
 | 
			
		|||
        confirmChosen(){
 | 
			
		||||
            if(this.batchChosenMaterial.length>0){
 | 
			
		||||
                this.loading = true
 | 
			
		||||
                let items = [...this.materialList,...this.batchChosenMaterial] 
 | 
			
		||||
                let items = [...this.materialList,...this.batchChosenMaterial]
 | 
			
		||||
                let uniqueItems = items.filter((item, index, array) => {
 | 
			
		||||
                    return array.findIndex((t) => (t.materialId === item.materialId)) === index;
 | 
			
		||||
                });
 | 
			
		||||
                this.materialList = uniqueItems 
 | 
			
		||||
                this.materialList = uniqueItems
 | 
			
		||||
                this.materialList.forEach(item=>{
 | 
			
		||||
                    this.$set(item,"unitPrice",item.unitPrice/100)
 | 
			
		||||
                })
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue