智慧农业后台管理页面
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()
                        })
                    }
                }
            })
        },