智慧农业后台管理页面
guoshilong
2022-09-17 d239433d0e217480a726a6a2d51ba0aae52e2c33
加工产品新增出库、加工功能,列表记录样式改变
9 files modified
450 ■■■■■ changed files
src/api/machining/machining.js 7 ●●●●● patch | view | raw | blame | history
src/api/process/process.js 12 ●●●● patch | view | raw | blame | history
src/api/retrieval/retrieval.js 9 ●●●●● patch | view | raw | blame | history
src/views/farmplant/farmproductstock.vue 98 ●●●● patch | view | raw | blame | history
src/views/farmplant/inventorylist.vue 14 ●●●● patch | view | raw | blame | history
src/views/farmplant/process.vue 271 ●●●●● patch | view | raw | blame | history
src/views/farmplant/processlist.vue 13 ●●●●● patch | view | raw | blame | history
src/views/farmplant/retrievallist.vue 11 ●●●●● patch | view | raw | blame | history
src/views/farmplant/salelist.vue 15 ●●●● patch | view | raw | blame | history
src/api/machining/machining.js
@@ -48,3 +48,10 @@
  })
}
export const selectInfo = () => {
  return request({
    url: '/api/machining/machining/selectInfo',
    method: 'get',
  })
}
src/api/process/process.js
@@ -22,12 +22,12 @@
  })
}
export const remove = (ids) => {
export const remove = (ids,farmId) => {
  return request({
    url: '/api/process/process/remove',
    method: 'post',
    params: {
      ids,
      ids,farmId
    }
  })
}
@@ -40,6 +40,14 @@
  })
}
export const submitProcessJG = (row) => {
  return request({
    url: '/api/process/process/submitProcess',
    method: 'post',
    data: row
  })
}
export const update = (row) => {
  return request({
    url: '/api/process/process/submit',
src/api/retrieval/retrieval.js
@@ -52,6 +52,15 @@
  })
}
//销售加工产品
export const submitProcess = (row) => {
  return request({
    url: '/api/retrieval/retrieval/submitProcess',
    method: 'post',
    data: row
  })
}
export const update = (row) => {
  return request({
    url: '/api/retrieval/retrieval/submit',
src/views/farmplant/farmproductstock.vue
@@ -388,6 +388,7 @@
                createUser: "",
                remarks: "",
                saleDestination1:"",
                type:"0",
            },
            //损耗字段
            formKC: {
@@ -520,18 +521,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",
                    //         },
                    //     ],
                    // },
                ]
            },
            //库存损耗配置
@@ -631,18 +632,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",
                    //         },
                    //     ],
                    // },
                ]
            },
            //加工配置
@@ -756,18 +757,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",
                    //         },
                    //     ],
                    // },
                ]
            },
            //出库配置
@@ -879,18 +880,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: [],
@@ -975,6 +976,7 @@
                if (vaild) {
                    this.formJG.id = ""
                    Object.assign(this.formJG,this.JG)
                    this.formJG["farmId"] = this.$farmId
                    if(this.formJG.saleNum <0 || this.formJG.processNum<0){
                        this.$message({
                            type: "warning",
src/views/farmplant/inventorylist.vue
@@ -41,7 +41,8 @@
                tip: false,
                searchShow: true,
                searchMenuSpan: 6,
                height: 520,
                height: "auto",
                calcHeight: '80',
                editBtn: false,
                addBtn: false,
                delBtn: true,
@@ -50,7 +51,6 @@
                menuAlign: "center",
                align: "center",
                selection: false,
                showSummary: true,
                indexFixed: false,
                selectionFixed: false,
                expandFixed: false,
@@ -72,8 +72,11 @@
                        }
                    },
                    {
                        label: "品种",
                        prop: "proName"
                        label: "品种 / 产品",
                        prop: "proName",
                        formatter:function(row, column, cellValue, index) {
                            return row.proName?row.proName:row.strainName
                        }
                    },
                    {
                        label: "损耗数量",
@@ -126,9 +129,6 @@
                     //单位处理
                    this.data.forEach((e)=>{
                        e.saleNum = e.saleNum + " 公斤"
                        if(e.type == 1){
                            e.proName = e.proName+"("+e.strainName+")"
                        }
                    })
                    this.page.total = res.data.data.total
                    this.loading = false
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;
src/views/farmplant/processlist.vue
@@ -43,7 +43,8 @@
                tip: false,
                searchShow: true,
                searchMenuSpan: 6,
                height: 520,
                height: "auto",
                calcHeight: '80',
                delBtn: true,
                delBtnText:'删除',
                delBtnIcon:'el-icon-delete',
@@ -52,7 +53,6 @@
                menuAlign: "center",
                align: "center",
                selection: false,
                showSummary: true,
                indexFixed: false,
                selectionFixed: false,
                expandFixed: false,
@@ -74,8 +74,11 @@
                        }
                    },
                    {
                        label:"品种",
                        prop:"strainName"
                        label:"品种 / 来源",
                        prop:"strainName",
                        formatter:function(row, column, cellValue, index) {
                            return row.strainName?row.strainName:row.parentName
                        }
                    },
                    {
                        label:"加工数量",
@@ -151,7 +154,7 @@
                cancelButtonText: "取消",
                type: "warning"
            }).then(() => {
                    return remove(row.id)
                    return remove(row.id,this.$farmId)
                }).then((res) => {
                    this.onLoad(this.page)
                    this.$message({
src/views/farmplant/retrievallist.vue
@@ -41,7 +41,8 @@
                tip: false,
                searchShow: true,
                searchMenuSpan: 6,
                height: 520,
                height: "auto",
                calcHeight: '80',
                editBtn: false,
                addBtn: false,
                delBtn: true,
@@ -50,7 +51,6 @@
                menuAlign: "center",
                align: "center",
                selection: false,
                showSummary: true,
                indexFixed: false,
                selectionFixed: false,
                expandFixed: false,
@@ -72,8 +72,11 @@
                        }
                    },
                    {
                        label: "品种",
                        prop: "strainName"
                        label: "品种 / 产品",
                        prop: "proName",
                        formatter:function(row, column, cellValue, index) {
                            return row.proName?row.proName:row.strainName
                        }
                    },
                    {
                        label: "出库数量",
src/views/farmplant/salelist.vue
@@ -41,7 +41,8 @@
                tip: false,
                searchShow: true,
                searchMenuSpan: 6,
                height: 520,
                height: "auto",
                calcHeight: '80',
                editBtn: false,
                addBtn: false,
                delBtn: true,
@@ -50,7 +51,6 @@
                menuAlign: "center",
                align: "center",
                selection: false,
                showSummary: true,
                indexFixed: false,
                selectionFixed: false,
                expandFixed: false,
@@ -72,8 +72,11 @@
                        }
                    },
                    {
                        label: "品种",
                        prop: "proName"
                        label: "品种 / 产品",
                        prop: "proName",
                        formatter:function(row, column, cellValue, index) {
                            return row.proName?row.proName:row.strainName
                        }
                    },
                    {
                        label: "销售数量",
@@ -126,16 +129,12 @@
            this.loading = true
            params['farmId'] = this.$farmId
            getPage(page.currentPage, page.pageSize, Object.assign(params, this.query)).then((res) => {
                console.log(res)
                if (res.data.code == 200) {
                    this.data = res.data.data.records
                    //单位处理
                    this.data.forEach((e)=>{
                        e.saleNum = e.saleNum + " 公斤"
                        e.salePrice = e.salePrice + " 元/公斤"
                        if(e.type == 1){
                            e.proName = e.proName+"("+e.strainName+")"
                        }
                    })
                    this.page.total = res.data.data.total
                    this.loading = false