智慧农业后台管理页面
guoshilong
2022-09-17 d239433d0e217480a726a6a2d51ba0aae52e2c33
src/views/farmplant/process.vue
@@ -30,10 +30,6 @@
                        库存量:
                        <span>{{ item.productInventoryNum }}</span>公斤
                    </div>
                    <div class="area">
                        原材料:
                        <span>{{ item.strainName }}</span>
                    </div>
                        <div class="btn">
                            <el-button style="width: 65px;" plain size="small" @click="openWindow(0,item)">
                                <span style="color: #5abf78">销售</span>
@@ -43,12 +39,12 @@
                            </el-button>
                        </div>
                        <div class="btn">
                            <!-- <el-button style="width: 65px;" plain size="small" @click="openWindow(3,item)">
                                <span style="color: #5abf78">出库</span>
                            </el-button>
                            <el-button style="width: 65px;" plain size="small" @click="openWindow(2,item)">
                                加工
                            </el-button> -->
                        <el-button style="width: 65px;" plain size="small" @click="openWindow(3,item)">
                            <span style="color: #5abf78">出库</span>
                        </el-button>
                        <el-button style="width: 65px;" plain size="small" @click="openWindow(2,item)">
                            加工
                        </el-button>
                        </div>
                </div>
            </div>
@@ -154,7 +150,7 @@
        </el-dialog>
        <!-- 加工产品 -->
        <el-dialog
            title="加工产品"
            title="加工产品加工"
            :modal-append-to-body="false"
            :append-to-body="true"
            :close-on-click-modal="false"
@@ -195,7 +191,7 @@
        </el-dialog>
        <!--出库-->
        <el-dialog
            title="出库产品"
            title="加工产品出库"
            :modal-append-to-body="false"
            :append-to-body="true"
            :close-on-click-modal="false"
@@ -211,7 +207,7 @@
                        <el-tag type="success">{{ formCK.name }}</el-tag>
                    </div>
                </template>
                <template slot-scope="{disabled,size}" slot="saleDestination">
                <!-- <template slot-scope="{disabled,size}" slot="saleDestination">
                    <div>
                        <el-cascader
                            style="width: 100%;"
@@ -222,7 +218,7 @@
                            v-model="saleDestination"
                        ></el-cascader>
                    </div>
                </template>
                </template> -->
                <template slot-scope="{disabled,size}" slot="saleNum">
                    <div style="margin-bottom: -20px">
                        <el-input type="number" placeholder="请输入出库数量" v-model="formCK.saleNum">
@@ -261,8 +257,15 @@
} from "@/api/sale/sale"
import {
    addjg
    submitProcessJG
} from "@/api/process/process"
import {
    submitProcess
} from "@/api/retrieval/retrieval"
import {
    selectInfo
} from "@/api/machining/machining"
import { mapGetters } from "vuex"
import { regionData } from 'element-china-area-data'
import fixed from "@/util/mathHandler"
@@ -279,8 +282,8 @@
            form: {
                name: "",
                proid: "",
                landId: "",
                strainId: "",
                // landId: "",
                // strainId: "",
                saleTime: "",
                saleNum: "",
                saleDestination: "",
@@ -298,8 +301,8 @@
            formCK: {
                name: "",
                proid: "",
                landId: "",
                strainId: "",
                // landId: "",
                // strainId: "",
                saleTime: "",
                saleNum: "",
                saleDestination: "",
@@ -308,14 +311,15 @@
                createUser: "",
                remarks: "",
                type:"1",
                processName:""
            },
            //损耗字段
            formKC: {
                name: "",
                proid: "",
                landId: "",
                strainId: "",
                // landId: "",
                // strainId: "",
                saleNum: "",
                remarks: "",
                lossTime: "",
@@ -327,15 +331,16 @@
            formJG: {
                name: "",
                proid: "",
                landId: "",
                strainId: "",
                // landId: "",
                // strainId: "",
                saleNum: "",
                processNum: "",
                remarks: "",
                reason: "0",
                saleTime: "",
                processName:""
                processName:"",
                parentId:"",
            },
            visible: false,
            visibleKC: false,
@@ -417,18 +422,18 @@
                        prop: "saleBrand",
                        span: 24,
                    },
                    {
                        label: "操作人",
                        prop: "realName",
                        span: 24,
                        rules: [
                            {
                                required: true,
                                message: "请输入操作人",
                                trigger: "blur",
                            },
                        ],
                    },
                    // {
                    //     label: "操作人",
                    //     prop: "realName",
                    //     span: 24,
                    //     rules: [
                    //         {
                    //             required: true,
                    //             message: "请输入操作人",
                    //             trigger: "blur",
                    //         },
                    //     ],
                    // },
                ]
            },
            //库存损耗配置
@@ -502,18 +507,18 @@
                        prop: "remarks",
                        span: 24,
                    },
                    {
                        label: "操作人",
                        prop: "realName",
                        span: 24,
                        rules: [
                            {
                                required: true,
                                message: "请输入操作人",
                                trigger: "blur",
                            },
                        ],
                    },
                    // {
                    //     label: "操作人",
                    //     prop: "realName",
                    //     span: 24,
                    //     rules: [
                    //         {
                    //             required: true,
                    //             message: "请输入操作人",
                    //             trigger: "blur",
                    //         },
                    //     ],
                    // },
                ]
            },
            //加工配置
@@ -568,7 +573,14 @@
                        prop: "processId",
                        span: 24,
                        type: "tree",
                        dicUrl: "/api/machining/machining/selectInfo",
                        dicData:[],
                        // dicUrl: "/api/machining/machining/selectInfo",
                        // dicFormatter:(res)=>{
                        //     res = res.data.filter(e=>{
                        //         return e.processId != this.formJG.parentId
                        //     })
                        //     return res
                        // },
                        props: {
                            label: "processName",
                            value: "processId"
@@ -599,18 +611,18 @@
                        prop: "remarks",
                        span: 24,
                    },
                    {
                        label: "操作人",
                        prop: "realName",
                        span: 24,
                        rules: [
                            {
                                required: true,
                                message: "请输入操作人",
                                trigger: "blur",
                            },
                        ],
                    },
                    // {
                    //     label: "操作人",
                    //     prop: "realName",
                    //     span: 24,
                    //     rules: [
                    //         {
                    //             required: true,
                    //             message: "请输入操作人",
                    //             trigger: "blur",
                    //         },
                    //     ],
                    // },
                ]
            },
            //出库配置
@@ -620,8 +632,8 @@
                gutter: 30,
                column: [
                    {
                        label: "出库品种",
                        prop: "strainName",
                        label: "出库产品",
                        prop: "processName",
                        span: 24,
                        disabled: true,
                        rules: [
@@ -660,14 +672,33 @@
                            },
                        ],
                    },
                    // {
                    //     label: "出库去向",
                    //     prop: "saleDestination",
                    //     span: 24,
                    //     rules: [
                    //         {
                    //             required: true,
                    //             message: "请选择出库去向",
                    //             trigger: "blur",
                    //         },
                    //     ],
                    // },
                    {
                        label: "出库去向",
                        prop: "saleDestination",
                        prop: "saleDestination1",
                        span: 24,
                        type: "select",
                        // value: "0",
                        dicUrl:"/api/blade-system/dict-biz/dictionary?code=reDestination",
                        props: {
                            label: "dictValue",
                            value: "dictKey"
                        },
                        rules: [
                            {
                                required: true,
                                message: "请选择出库去向",
                                message: "请选择损耗原因",
                                trigger: "blur",
                            },
                        ],
@@ -677,18 +708,18 @@
                        prop: "remarks",
                        span: 24,
                    },
                    {
                        label: "操作人",
                        prop: "realName",
                        span: 24,
                        rules: [
                            {
                                required: true,
                                message: "请输入操作人",
                                trigger: "blur",
                            },
                        ],
                    },
                    // {
                    //     label: "操作人",
                    //     prop: "realName",
                    //     span: 24,
                    //     rules: [
                    //         {
                    //             required: true,
                    //             message: "请输入操作人",
                    //             trigger: "blur",
                    //         },
                    //     ],
                    // },
                ]
            },
            selectionList: [],
@@ -718,6 +749,18 @@
            handler (newName, oldName) {
                this.query ={}
                this.onLoad(this.page)
            }
        },
        'formJG.parentId':{
            handler(newName,oldName){
                const column = this.findObject(this.optionJG.column, "processId")
                selectInfo().then(res=>{
                    var data = res.data.data.filter(e=>{
                        return e.processId != newName
                    })
                    column.dicData = data
                })
            }
        }
    },    
@@ -768,7 +811,8 @@
            var that = this
            this.$refs.form.validate((vaild, done) => {
                if (vaild) {
                    addjg(this.formJG).then(() => {
                    this.formJG['farmId'] = this.$farmId
                    submitProcessJG(this.formJG).then(() => {
                        this.onLoad(this.page)
                        this.$message({
                            type: "success",
@@ -817,29 +861,29 @@
                }
            })
        },
        //出库表单提交
        // submitCK () {
        //     var that = this
        //     this.$refs.form.validate((vaild, done) => {
        //         if (vaild) {
        //             addck(this.formCK).then(() => {
        //                 this.onLoad(this.page)
        //                 this.$message({
        //                     type: "success",
        //                     message: "操作成功!"
        //                 })
        //                 //提交完成,关闭窗口清空数据
        //                 that.cleanCKData()
        //                 done()
        //             }, error => {
        //                 window.console.log(error)
        //                 //提交失败,关闭窗口清空数据
        //                 that.cleanCKData()
        //                 done()
        //             })
        //         }
        //     })
        // },
        // 出库表单提交
        submitCK () {
            var that = this
            this.$refs.form.validate((vaild, done) => {
                if (vaild) {
                    submitProcess(this.formCK).then(() => {
                        this.onLoad(this.page)
                        this.$message({
                            type: "success",
                            message: "操作成功!"
                        })
                        //提交完成,关闭窗口清空数据
                        that.cleanCKData()
                        done()
                    }, error => {
                        window.console.log(error)
                        //提交失败,关闭窗口清空数据
                        that.cleanCKData()
                        done()
                    })
                }
            })
        },
        handleChange (value) {
            if (value != null) {
                this.form.saleDestination = value[0]
@@ -864,8 +908,8 @@
                this.form.createUser = this.userInfo.user_id
                this.form.weight = data.productInventoryNum
                this.form.proid = data.id
                this.form.landId = data.landId
                this.form.strainId = data.strainId
                // this.form.landId = data.landId
                // this.form.strainId = data.strainId
                this.form.strainName = data.strainName
                this.form.processName = data.processName
@@ -875,8 +919,8 @@
                this.formKC.createUser = this.userInfo.user_id
                this.formKC.weight = data.productInventoryNum
                this.formKC.proid = data.id
                this.formKC.landId = data.landId
                this.formKC.strainId = data.strainId
                // this.formKC.landId = data.landId
                // this.formKC.strainId = data.strainId
                this.formKC.strainName = data.strainName
                this.formKC.processName = data.processName
@@ -886,23 +930,24 @@
                this.formJG.name = this.userInfo.nick_name
                this.formJG.createUser = this.userInfo.user_id
                this.formJG.proid = data.id
                this.formJG.landId = data.landId
                // this.formJG.landId = data.landId
                this.formJG.weight = data.productInventoryNum
                this.formJG.strainId = data.strainId
                // this.formJG.strainId = data.strainId
                this.formJG.strainName = data.strainName
                this.formKC.processName = data.processName
                this.formJG.processName = data.processName
                this.formJG.parentId = data.productId
                this.visibleJG = true
            }else if (index == 3) { //出库
                this.formCK.name = this.userInfo.nick_name
                this.formCK.createUser = this.userInfo.user_id
                this.formCK.weight = data.productInventoryNum
                this.formCK.proid = data.id
                this.formCK.landId = data.landId
                this.formCK.strainId = data.strainId
                // this.formCK.landId = data.landId
                // this.formCK.strainId = data.strainId
                this.formCK.strainName = data.strainName
                this.formKC.processName = data.processName
                this.formCK.processName = data.processName
                this.visibleCK = true
            }
        },
@@ -989,7 +1034,7 @@
            .farm {
                width: 168px;
                height: 300px;
                height: 310px;
                /*height: 315px;*/
                background-color: #f7f9fb;
                border-radius: 5px;