智慧农业后台管理页面
去掉数字输入框后的加减按钮。农产品、加工产品、农资数字输入框不能为负数
4 files modified
336 ■■■■■ changed files
src/App.vue 14 ●●●●● patch | view | raw | blame | history
src/views/farmplant/farmproductstock.vue 140 ●●●●● patch | view | raw | blame | history
src/views/farmplant/process.vue 72 ●●●●● patch | view | raw | blame | history
src/views/stock/stockmanage.vue 110 ●●●●● patch | view | raw | blame | history
src/App.vue
@@ -27,4 +27,18 @@
.avue--detail .el-col{
  margin-bottom: 0;
}
    input::-webkit-inner-spin-button {
    -webkit-appearance: none !important;
    }
    input::-webkit-outer-spin-button{
    -webkit-appearance: none !important;
    }
    input[type="number"]{
    -moz-appearance: textfield;
    }
</style>
src/views/farmplant/farmproductstock.vue
@@ -161,7 +161,7 @@
                </template>
                <template slot-scope="{disabled,size}" slot="saleNum">
                    <div style="margin-bottom: -20px">
                        <el-input type="number" placeholder="请输入销售数量" v-model="form.saleNum">
                        <el-input type="number" min="0" @mousewheel.native.prevent @DOMMouseScroll.native.prevent placeholder="请输入销售数量" v-model="form.saleNum">
                            <i slot="suffix" style="font-style:normal;margin-right: 5px;">公斤</i>
                        </el-input>
                        <div style="text-align: right;color: #ffb218">可销售量:{{ form.weight }}公斤</div>
@@ -169,7 +169,7 @@
                </template>
                <template slot-scope="{disabled,size}" slot="salePrice">
                    <div style="margin-bottom: -20px">
                        <el-input type="number" placeholder="请输入销售价格" v-model="form.salePrice">
                        <el-input type="number" min="0" @mousewheel.native.prevent @DOMMouseScroll.native.prevent placeholder="请输入销售价格" v-model="form.salePrice">
                            <i slot="suffix" style="font-style:normal;margin-right: 5px;">元/公斤</i>
                        </el-input>
                    </div>
@@ -201,7 +201,7 @@
                </template>
                <template slot-scope="{disabled,size}" slot="saleNum">
                    <div style="margin-bottom: -20px">
                        <el-input type="number" placeholder="请输入损耗数量" v-model="formKC.saleNum">
                        <el-input type="number" min="0" @mousewheel.native.prevent @DOMMouseScroll.native.prevent placeholder="请输入损耗数量" v-model="formKC.saleNum">
                            <i slot="suffix" style="font-style:normal;margin-right: 5px;">公斤</i>
                        </el-input>
                        <div style="text-align: right;color: #ffb218">库存量:{{ formKC.weight }}公斤</div>
@@ -235,7 +235,7 @@
                </template>
                <template slot-scope="{disabled,size}" slot="saleNum">
                    <div style="margin-bottom: -20px">
                        <el-input type="number" placeholder="请输入加工数量" v-model="formJG.saleNum">
                        <el-input type="number" min="0" @mousewheel.native.prevent @DOMMouseScroll.native.prevent placeholder="请输入加工数量" v-model="formJG.saleNum">
                            <i slot="suffix" style="font-style:normal;margin-right: 5px;">公斤</i>
                        </el-input>
                        <div style="text-align: right;color: #ffb218">库存量:{{ formJG.weight }}公斤</div>
@@ -243,7 +243,7 @@
                </template>
                <template slot-scope="{disabled,size}" slot="processNum">
                    <div style="margin-bottom: -20px">
                        <el-input type="number" placeholder="请输入产品数量" v-model="formJG.processNum">
                        <el-input type="number" min="0" @mousewheel.native.prevent @DOMMouseScroll.native.prevent placeholder="请输入产品数量" v-model="formJG.processNum">
                            <i slot="suffix" style="font-style:normal;margin-right: 5px;">公斤</i>
                        </el-input>
                    </div>
@@ -288,7 +288,7 @@
                </template>
                <template slot-scope="{disabled,size}" slot="saleNum">
                    <div style="margin-bottom: -20px">
                        <el-input type="number" placeholder="请输入出库数量" v-model="formCK.saleNum">
                        <el-input type="number" min="0" @mousewheel.native.prevent @DOMMouseScroll.native.prevent placeholder="请输入出库数量" v-model="formCK.saleNum">
                            <i slot="suffix" style="font-style:normal;margin-right: 5px;">公斤</i>
                        </el-input>
                        <div style="text-align: right;color: #ffb218">可出库量:{{ formCK.weight }}公斤</div>
@@ -908,21 +908,29 @@
            this.$refs.form.validate((vaild, done) => {
                if (vaild) {
                    this.form.id = ""
                    add(this.form).then(() => {
                        this.onLoad(this.page)
                    if(this.form.saleNum <0 || this.form.salePrice <0){
                        this.$message({
                            type: "success",
                            message: "操作成功!"
                            type: "warning",
                            message: "销售数量和销售价格不能为负数!"
                        })
                        //提交完成,关闭窗口清空数据
                        that.cleanData()
                        done()
                    }, error => {
                        window.console.log(error)
                        //提交失败,关闭窗口清空数据
                        that.cleanData()
                        done()
                    })
                    }else{
                        add(this.form).then(() => {
                            this.onLoad(this.page)
                            this.$message({
                                type: "success",
                                message: "操作成功!"
                            })
                            //提交完成,关闭窗口清空数据
                            that.cleanData()
                            done()
                        }, error => {
                            window.console.log(error)
                            //提交失败,关闭窗口清空数据
                            that.cleanData()
                            done()
                        })
                    }
                }
            })
        },
@@ -933,21 +941,29 @@
                if (vaild) {
                    this.formJG.id = ""
                    Object.assign(this.formJG,this.JG)
                    addjg(this.formJG).then(() => {
                        this.onLoad(this.page)
                    if(this.formJG.saleNum <0 || this.formJG.processNum<0){
                        this.$message({
                            type: "success",
                            message: "操作成功!"
                            type: "warning",
                            message: "加工数量和产品数量不能为负数!"
                        })
                        //提交完成,关闭窗口清空数据
                        that.cleanJGData()
                        done()
                    }, error => {
                        window.console.log(error)
                        //提交失败,关闭窗口清空数据
                        that.cleanJGData()
                        done()
                    })
                    }else{
                        addjg(this.formJG).then(() => {
                            this.onLoad(this.page)
                            this.$message({
                                type: "success",
                                message: "操作成功!"
                            })
                            //提交完成,关闭窗口清空数据
                            that.cleanJGData()
                            done()
                        }, error => {
                            window.console.log(error)
                            //提交失败,关闭窗口清空数据
                            that.cleanJGData()
                            done()
                        })
                    }
                }
            })
        },
@@ -957,21 +973,29 @@
            this.$refs.form.validate((vaild, done) => {
                if (vaild) {
                    this.formKC.id = ""
                    addKC(this.formKC).then(() => {
                        this.onLoad(this.page)
                    if(this.formKC.saleNum <0){
                        this.$message({
                            type: "success",
                            message: "操作成功!"
                            type: "warning",
                            message: "损耗数量不能为负数!"
                        })
                        //提交完成,关闭窗口清空数据
                        that.cleanKCData()
                        done()
                    }, error => {
                        window.console.log(error)
                        //提交失败,关闭窗口清空数据
                        that.cleanKCData()
                        done()
                    })
                    }else{
                        addKC(this.formKC).then(() => {
                            this.onLoad(this.page)
                            this.$message({
                                type: "success",
                                message: "操作成功!"
                            })
                            //提交完成,关闭窗口清空数据
                            that.cleanKCData()
                            done()
                        }, error => {
                            window.console.log(error)
                            //提交失败,关闭窗口清空数据
                            that.cleanKCData()
                            done()
                        })
                    }
                }
            })
        },
@@ -981,21 +1005,29 @@
            this.$refs.form.validate((vaild, done) => {
                if (vaild) {
                    this.formCK.id = ""
                    addck(this.formCK).then(() => {
                        this.onLoad(this.page)
                    if(this.formCK.saleNum<0){
                        this.$message({
                            type: "success",
                            message: "操作成功!"
                            type: "warning",
                            message: "出库数量不能为负数!"
                        })
                        //提交完成,关闭窗口清空数据
                        that.cleanCKData()
                        done()
                    }, error => {
                        window.console.log(error)
                        //提交失败,关闭窗口清空数据
                        that.cleanCKData()
                        done()
                    })
                    }else{
                        addck(this.formCK).then(() => {
                            this.onLoad(this.page)
                            this.$message({
                                type: "success",
                                message: "操作成功!"
                            })
                            //提交完成,关闭窗口清空数据
                            that.cleanCKData()
                            done()
                        }, error => {
                            window.console.log(error)
                            //提交失败,关闭窗口清空数据
                            that.cleanCKData()
                            done()
                        })
                    }
                }
            })
        },
src/views/farmplant/process.vue
@@ -97,7 +97,7 @@
                </template>
                <template slot-scope="{disabled,size}" slot="saleNum">
                    <div style="margin-bottom: -20px">
                        <el-input type="number" placeholder="请输入销售数量" v-model="form.saleNum">
                        <el-input type="number" min="0" @mousewheel.native.prevent @DOMMouseScroll.native.prevent placeholder="请输入销售数量" v-model="form.saleNum">
                            <i slot="suffix" style="font-style:normal;margin-right: 5px;">公斤</i>
                        </el-input>
                        <div style="text-align: right;color: #ffb218">可销售量:{{ form.weight }}公斤</div>
@@ -105,7 +105,7 @@
                </template>
                <template slot-scope="{disabled,size}" slot="salePrice">
                    <div style="margin-bottom: -20px">
                        <el-input type="number" placeholder="请输入销售价格" v-model="form.salePrice">
                        <el-input type="number"  min="0" @mousewheel.native.prevent @DOMMouseScroll.native.prevent placeholder="请输入销售价格" v-model="form.salePrice">
                            <i slot="suffix" style="font-style:normal;margin-right: 5px;">元/公斤</i>
                        </el-input>
                    </div>
@@ -137,7 +137,7 @@
                </template>
                <template slot-scope="{disabled,size}" slot="saleNum">
                    <div style="margin-bottom: -20px">
                        <el-input type="number" placeholder="请输入损耗数量" v-model="formKC.saleNum">
                        <el-input type="number" @mousewheel.native.prevent @DOMMouseScroll.native.prevent placeholder="请输入损耗数量" v-model="formKC.saleNum">
                            <i slot="suffix" style="font-style:normal;margin-right: 5px;">公斤</i>
                        </el-input>
                        <div style="text-align: right;color: #ffb218">库存量:{{ formKC.weight }}公斤</div>
@@ -725,21 +725,29 @@
            var that = this
            this.$refs.form.validate((vaild, done) => {
                if (vaild) {
                    insert(this.form).then(() => {
                        this.onLoad(this.page)
                    if(this.form.saleNum<0 || this.form.salePrice<0){
                        this.$message({
                            type: "success",
                            message: "操作成功!"
                            type: "warning",
                            message: "销售数量和销售价格不能为负数!"
                        })
                        //提交完成,关闭窗口清空数据
                        that.cleanData()
                        done()
                    }, error => {
                        window.console.log(error)
                        //提交失败,关闭窗口清空数据
                        that.cleanData()
                        done()
                    })
                        done()
                    }else{
                        insert(this.form).then(() => {
                            this.onLoad(this.page)
                            this.$message({
                                type: "success",
                                message: "操作成功!"
                            })
                            //提交完成,关闭窗口清空数据
                            that.cleanData()
                            done()
                        }, error => {
                            window.console.log(error)
                            //提交失败,关闭窗口清空数据
                            that.cleanData()
                            done()
                        })
                    }
                }
            })
        },
@@ -771,21 +779,29 @@
            var that = this
            this.$refs.form.validate((vaild, done) => {
                if (vaild) {
                    insertKC(this.formKC).then(() => {
                        this.onLoad(this.page)
                    if(this.formKC.saleNum<0){
                        this.$message({
                            type: "success",
                            message: "操作成功!"
                            type: "warning",
                            message: "损耗数量不能为负数!"
                        })
                        //提交完成,关闭窗口清空数据
                        that.cleanKCData()
                        done()
                    }, error => {
                        window.console.log(error)
                        //提交失败,关闭窗口清空数据
                        that.cleanKCData()
                        done()
                    })
                    }else{
                        insertKC(this.formKC).then(() => {
                            this.onLoad(this.page)
                            this.$message({
                                type: "success",
                                message: "操作成功!"
                            })
                            //提交完成,关闭窗口清空数据
                            that.cleanKCData()
                            done()
                        }, error => {
                            window.console.log(error)
                            //提交失败,关闭窗口清空数据
                            that.cleanKCData()
                            done()
                        })
                    }
                }
            })
        },
src/views/stock/stockmanage.vue
@@ -758,63 +758,87 @@
    //农资入库按钮
    submitK(row, done, loading) {
      row.deptId=this.userInfo.dept_id;
      add(row).then(() => {
        this.onLoad(this.page);
      if(row.amount<0 || row.specs <0){
        this.$message({
          type: "success",
          message: "操作成功!"
          type:"warning",
          message:"规格和入库数量不能为负数"
        })
          done();
      }else{
        add(row).then(() => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!"
          });
          this.$refs.formK.resetFields();
          this.gradec = false;
        }, error => {
          loading();
          window.console.log(error);
        });
        this.$refs.formK.resetFields();
        this.gradec = false;
        done();
      }, error => {
        loading();
        window.console.log(error);
      });
      }
    },
//入库
    submitR(row, done, loading) {
      row.deptId=this.userInfo.dept_id;
      var that = this;
      add1(row).then(
        () => {
          that.onLoad(this.page);
          that.$refs.formR.resetFields();
          that.$message({
            type: "success",
            message: "操作成功!",
          });
          that.gradeBoxVisible = false;
          done();
        },
        (error) => {
          window.console.log(error);
          done();
        }
      );
      if(row.amount1<0){
        this.$message({
          type:"warning",
          message:"入库数量不能为负数"
        })
        done();
      }else{
        add1(row).then(
          () => {
            that.onLoad(this.page);
            that.$refs.formR.resetFields();
            that.$message({
              type: "success",
              message: "操作成功!",
            });
            that.gradeBoxVisible = false;
            done();
          },
          (error) => {
            window.console.log(error);
            done();
          }
        );
      }
    }
    ,
//出库
    submitC(row, done, loading) {
      var that = this;
      row.deptId=this.userInfo.dept_id;
      add1(row).then(
        () => {
          that.onLoad(this.page);
          that.$refs.formC.resetFields();
          that.$message({
            type: "success",
            message: "操作成功!",
          });
          that.gradeBoxVisible1 = false;
      if(row.amount1<0 || row.num<row.amount1){
        this.$message({
          type:"warning",
          message:"出库数量不能为负数且出库数量不能大于库存数"
        })
        done();
      }else{
        add1(row).then(
          () => {
            that.onLoad(this.page);
            that.$refs.formC.resetFields();
            that.$message({
              type: "success",
              message: "操作成功!",
            });
            that.gradeBoxVisible1 = false;
          done();
        },
        (error) => {
          window.console.log(error);
          done();
        }
      );
            done();
          },
          (error) => {
            window.console.log(error);
            done();
          }
        );
      }
    }
    ,
// 往入库页面填充数据