智慧农业后台管理页面
加工产品库存显示更新,删除加工记录表中数据,农产品和加工产品数据回滚
2 files modified
1 files added
115 ■■■■ changed files
src/api/processinv/processinv.js 61 ●●●●● patch | view | raw | blame | history
src/views/farmplant/process.vue 20 ●●●●● patch | view | raw | blame | history
src/views/farmplant/processlist.vue 34 ●●●● patch | view | raw | blame | history
src/api/processinv/processinv.js
New file
@@ -0,0 +1,61 @@
import request from '@/router/axios';
export const getList = (current, size, params) => {
  return request({
    url: '/api/processinv/processinv/list',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}
export const getPage = (current, size, params) => {
    return request({
      url: '/api/processinv/processinv/page',
      method: 'get',
      params: {
        ...params,
        current,
        size,
      }
    })
  }
export const getDetail = (id) => {
  return request({
    url: '/api/processinv/processinv/detail',
    method: 'get',
    params: {
      id
    }
  })
}
export const remove = (ids) => {
  return request({
    url: '/api/processinv/processinv/remove',
    method: 'post',
    params: {
      ids,
    }
  })
}
export const add = (row) => {
  return request({
    url: '/api/processinv/processinv/submit',
    method: 'post',
    data: row
  })
}
export const update = (row) => {
  return request({
    url: '/api/processinv/processinv/submit',
    method: 'post',
    data: row
  })
}
src/views/farmplant/process.vue
@@ -28,7 +28,11 @@
                    <div class="cai">{{ item.processName }}</div>
                    <div class="area">
                        库存量:
                        <span>{{ item.processNum }}</span>公斤
                        <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)">
@@ -193,10 +197,12 @@
</template>
<script>
import {
    getList,
} from "@/api/process/process"
//获取加工产品库存数据
import{
    getPage,
} from "@/api/processinv/processinv"
//向销售表和损耗表中添加数据
import {
    insert,insertKC
} from "@/api/sale/sale"
@@ -735,7 +741,7 @@
            if (index == 0) {   //销售
                this.form.name = this.userInfo.nick_name
                this.form.createUser = this.userInfo.user_id
                this.form.weight = data.processNum
                this.form.weight = data.productInventoryNum
                this.form.proid = data.id
                this.form.landId = data.landId
                this.form.strainId = data.strainId
@@ -746,7 +752,7 @@
            } else if (index == 1) {    //库存损耗   
                this.formKC.name = this.userInfo.nick_name
                this.formKC.createUser = this.userInfo.user_id
                this.formKC.weight = data.processNum
                this.formKC.weight = data.productInventoryNum
                this.formKC.proid = data.id
                this.formKC.landId = data.landId
                this.formKC.strainId = data.strainId
@@ -796,7 +802,7 @@
        onLoad (page, params = {}) {
            params['tenantId'] = this.userInfo.tenant_id
            params['deptId'] = this.userInfo.dept_id
            getList(
            getPage(
                page.currentPage,
                page.pageSize,
                Object.assign(params, this.query)
src/views/farmplant/processlist.vue
@@ -15,13 +15,13 @@
            @size-change="sizeChange"
            @refresh-change="refreshChange"
            @on-load="onLoad"
        ></avue-crud>
            @row-del="rowDel">
        </avue-crud>
    </basic-container>
</template>
<script>
import { getList } from "@/api/process/process"
import { getList,remove } from "@/api/process/process"
export default {
    data () {
        return {
@@ -36,15 +36,17 @@
                total: 0,
            },
            selectionList: [],
            align: "center",
            menu: true,
            option: {
                tip: false,
                searchShow: true,
                searchMenuSpan: 6,
                height: 520,
                editBtn: false,
                addBtn: false,
                delBtn: true,
                viewBtn: true,
                delBtnText:'删除',
                delBtnIcon:'el-icon-delete',
                editBtn:false,
                menuWidth: 200,
                menuAlign: "center",
                align: "center",
@@ -54,7 +56,7 @@
                selectionFixed: false,
                expandFixed: false,
                menuFixed: false,
                menu: false,
                menu: true,
                column: [
                    {
                        label: "品种",
@@ -86,7 +88,7 @@
                        prop: "processNum"
                    },
                    {
                        label: "销售时间",
                        label: "加工时间",
                        prop: "saleTime",
                    },
                ],
@@ -108,7 +110,6 @@
            this.loading = true
            getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then((res) => {
                if (res.data.code == 200) {
                    console.log(res)
                    this.data = res.data.data.records
                    this.page.total = res.data.data.total
                    this.loading = false
@@ -125,6 +126,21 @@
            this.onLoad(this.page, params)
            done()
        },
        rowDel (row) {
            this.$confirm("确定将选择数据删除?", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning"
            }).then(() => {
                    return remove(row.id)
                }).then((res) => {
                    this.onLoad(this.page)
                    this.$message({
                        type: "success",
                        message: "操作成功!"
                    })
                })
        },
    }
}
</script>