智慧农业后台管理页面
去掉数字输入框后的加减按钮。农产品、加工产品、农资数字输入框不能为负数
4 files modified
106 ■■■■■ changed files
src/App.vue 14 ●●●●● patch | view | raw | blame | history
src/views/farmplant/farmproductstock.vue 44 ●●●● patch | view | raw | blame | history
src/views/farmplant/process.vue 22 ●●●● patch | view | raw | blame | history
src/views/stock/stockmanage.vue 26 ●●●●● 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,6 +908,13 @@
            this.$refs.form.validate((vaild, done) => {
                if (vaild) {
                    this.form.id = ""
                    if(this.form.saleNum <0 || this.form.salePrice <0){
                        this.$message({
                            type: "warning",
                            message: "销售数量和销售价格不能为负数!"
                        })
                        done()
                    }else{
                    add(this.form).then(() => {
                        this.onLoad(this.page)
                        this.$message({
@@ -924,6 +931,7 @@
                        done()
                    })
                }
                }
            })
        },
        //加工产品
@@ -933,6 +941,13 @@
                if (vaild) {
                    this.formJG.id = ""
                    Object.assign(this.formJG,this.JG)
                    if(this.formJG.saleNum <0 || this.formJG.processNum<0){
                        this.$message({
                            type: "warning",
                            message: "加工数量和产品数量不能为负数!"
                        })
                        done()
                    }else{
                    addjg(this.formJG).then(() => {
                        this.onLoad(this.page)
                        this.$message({
@@ -949,6 +964,7 @@
                        done()
                    })
                }
                }
            })
        },
        //库存消耗
@@ -957,6 +973,13 @@
            this.$refs.form.validate((vaild, done) => {
                if (vaild) {
                    this.formKC.id = ""
                    if(this.formKC.saleNum <0){
                        this.$message({
                            type: "warning",
                            message: "损耗数量不能为负数!"
                        })
                        done()
                    }else{
                    addKC(this.formKC).then(() => {
                        this.onLoad(this.page)
                        this.$message({
@@ -973,6 +996,7 @@
                        done()
                    })
                }
                }
            })
        },
        //出库
@@ -981,6 +1005,13 @@
            this.$refs.form.validate((vaild, done) => {
                if (vaild) {
                    this.formCK.id = ""
                    if(this.formCK.saleNum<0){
                        this.$message({
                            type: "warning",
                            message: "出库数量不能为负数!"
                        })
                        done()
                    }else{
                    addck(this.formCK).then(() => {
                        this.onLoad(this.page)
                        this.$message({
@@ -997,6 +1028,7 @@
                        done()
                    })
                }
                }
            })
        },
        handleChange (value) {
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,6 +725,13 @@
            var that = this
            this.$refs.form.validate((vaild, done) => {
                if (vaild) {
                    if(this.form.saleNum<0 || this.form.salePrice<0){
                        this.$message({
                            type: "warning",
                            message: "销售数量和销售价格不能为负数!"
                        })
                        done()
                    }else{
                    insert(this.form).then(() => {
                        this.onLoad(this.page)
                        this.$message({
@@ -740,6 +747,7 @@
                        that.cleanData()
                        done()
                    })
                    }
                }
            })
        },
@@ -771,6 +779,13 @@
            var that = this
            this.$refs.form.validate((vaild, done) => {
                if (vaild) {
                    if(this.formKC.saleNum<0){
                        this.$message({
                            type: "warning",
                            message: "损耗数量不能为负数!"
                        })
                        done()
                    }else{
                    insertKC(this.formKC).then(() => {
                        this.onLoad(this.page)
                        this.$message({
@@ -787,6 +802,7 @@
                        done()
                    })
                }
                }
            })
        },
        //出库表单提交
src/views/stock/stockmanage.vue
@@ -758,6 +758,13 @@
    //农资入库按钮
    submitK(row, done, loading) {
      row.deptId=this.userInfo.dept_id;
      if(row.amount<0 || row.specs <0){
        this.$message({
          type:"warning",
          message:"规格和入库数量不能为负数"
        })
          done();
      }else{
      add(row).then(() => {
        this.onLoad(this.page);
        this.$message({
@@ -766,16 +773,24 @@
        });
        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;
      if(row.amount1<0){
        this.$message({
          type:"warning",
          message:"入库数量不能为负数"
        })
        done();
      }else{
      add1(row).then(
        () => {
          that.onLoad(this.page);
@@ -793,11 +808,19 @@
        }
      );
    }
    }
    ,
//出库
    submitC(row, done, loading) {
      var that = this;
      row.deptId=this.userInfo.dept_id;
      if(row.amount1<0 || row.num<row.amount1){
        this.$message({
          type:"warning",
          message:"出库数量不能为负数且出库数量不能大于库存数"
        })
        done();
      }else{
      add1(row).then(
        () => {
          that.onLoad(this.page);
@@ -816,6 +839,7 @@
        }
      );
    }
    }
    ,
// 往入库页面填充数据
    modifiedGrades(row) {