马宇豪
2023-12-19 d5f70e01396783b1d2b84b49344b6d2798eb1097
仓储管理
已修改13个文件
已添加10个文件
2526 ■■■■■ 文件已修改
config/dev.env.js 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
config/index.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/warehouse.js 213 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/layout/Layout.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/layout/components/AppMain.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/license/licenseInfo/components/licenseDelayForm.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/license/licenseInfo/components/licenseInfoForm.vue 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/license/licenseInfo/components/licenseModForm.vue 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/purchase/dailySaleReport.vue 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/purchase/person.vue 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/specialCheck/index.vue 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/stock/components/enterprisePurchaseDetail.vue 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/stock/enterprisePurchaseStatistics.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/stock/stockManage.vue 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/warehouse/components/addStock.vue 365 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/warehouse/components/deliverUsage.vue 139 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/warehouse/components/editStock.vue 146 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/warehouse/components/enterpriseStock.vue 103 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/warehouse/components/recordDetail.vue 162 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/warehouse/components/stockRecords.vue 261 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/warehouse/stockAnalyse.vue 425 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/warehouse/stockManage.vue 218 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/warehouse/stockSupervision.vue 403 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
config/dev.env.js
@@ -18,8 +18,10 @@
//     IMG_API: '"http://39.104.85.193:4105/upload/"',
//
//
//       BASE_API: '"http://192.168.0.31:8100"',
//       IMG_API: '"http://192.168.0.31:8100/upload/"',
//       BASE_API: '"http://192.168.0.70:8100"',
//       IMG_API: '"http://192.168.0.70:8100/upload/"',
    // 正式地址
    BASE_API: '"http://39.104.85.193:4105"',
    IMG_API: '"http://39.104.85.193:4105/upload/"',
  //    IMG_API: '"http://127.0.0.1:8100/upload/"',
config/index.js
@@ -15,7 +15,7 @@
    // can be overwritten by process.env.HOST
    // if you want dev by ip, please set host: '0.0.0.0'
    host: 'localhost',
    host: '192.168.0.65',
    port: 8101, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
    autoOpenBrowser: true,
    errorOverlay: true,
src/api/warehouse.js
对比新文件
@@ -0,0 +1,213 @@
import request from '@/utils/request'
import { getToken } from '@/utils/auth'
export function getStorehouseDataByUser(data) {
    return request({
        headers: {
            'Authorization': getToken()
        },
        url: process.env.BASE_API + '/reserveManage/select/getStorehouseDataByUser',
        method: 'post',
        data
    })
}
export function getReservesForUser(params) {
    return request({
        headers: {
            'Authorization': getToken()
        },
        url: process.env.BASE_API + '/reserveManage/select/getReservesForUser',
        method: 'get',
        params: params || {}
    })
}
export function saveReserveInfo(data) {
    return request({
        headers: {
            'Authorization': getToken()
        },
        url: process.env.BASE_API + '/reserveManage/insert/saveReserveInfo',
        method: 'post',
        data
    })
}
export function editReserveInfo(data) {
    return request({
        headers: {
            'Authorization': getToken()
        },
        url: process.env.BASE_API + '/reserveManage/update/editReserveInfo',
        method: 'post',
        data
    })
}
export function getInfoById(params) {
    return request({
        headers: {
            'Authorization': getToken()
        },
        url: process.env.BASE_API + '/reserveManage/select/getReserveAndStorehouseInfo',
        method: 'get',
        params: params || {}
    })
}
// 授权信息
export function listStockhouseEnterpriseUserInfo(params) {
    return request({
        headers: {
            'Authorization': getToken()
        },
        url: process.env.BASE_API + '/reserveManage/select/listStockhouseEnterpriseUserInfo',
        method: 'get',
        params: params || {}
    })
}
// 修改授权信息
export function editEnterpriseUserAuthority(data) {
    return request({
        headers: {
            'Authorization': getToken()
        },
        url: process.env.BASE_API + '/reserveManage/update/editEnterpriseUserAuthority',
        method: 'post',
        data
    })
}
// 各企业存货信息
export function listStockDataByStorehouseId(params) {
    return request({
        headers: {
            'Authorization': getToken()
        },
        url: process.env.BASE_API + '/reserveManage/select/listStockDataByStorehouseId',
        method: 'get',
        params: params || {}
    })
}
// 进行盘库
export function updateStorehouseData(data) {
    return request({
        headers: {
            'Authorization': getToken()
        },
        url: process.env.BASE_API + '/reserveManage/update/updateStorehouseData',
        method: 'post',
        data
    })
}
// 进行盘库
export function getStorehouseData(params) {
    return request({
        headers: {
            'Authorization': getToken()
        },
        url: process.env.BASE_API + '/reserveManage/select/getStorehouseData',
        method: 'get',
        params: params || {}
    })
}
// 开关盘库
export function changeInventory(data) {
    return request({
        headers: {
            'Authorization': getToken()
        },
        url: process.env.BASE_API + '/reserveManage/update/openInventory',
        method: 'post',
        data
    })
}
export function delStore(params) {
    return request({
        headers: {
            'Authorization': getToken()
        },
        url: process.env.BASE_API + '/reserveManage/delete/deleteStorehouseById',
        method: 'get',
        params: params || {}
    })
}
// 监管
export function getSupervisionStatistics(data) {
    return request({
        headers: {
            'Authorization': getToken()
        },
        url: process.env.BASE_API + '/warehouse/supervision/statistics',
        method: 'post',
        data
    })
}
// 出库记录
export function getOutboundQuery(data) {
    return request({
        headers: {
            'Authorization': getToken()
        },
        url: process.env.BASE_API + '/delivery/store/house/outbound-query',
        method: 'post',
        data
    })
}
// 出库详情
export function getOutboundDetail(data) {
    return request({
        headers: {
            'Authorization': getToken()
        },
        url: process.env.BASE_API + '/delivery/store/house/outbound-detail',
        method: 'post',
        data
    })
}
// 入库记录
export function getInboundQuery(data) {
    return request({
        headers: {
            'Authorization': getToken()
        },
        url: process.env.BASE_API + '/entry/store/house/inbound-query',
        method: 'post',
        data
    })
}
// 入库详情
export function getInboundDetail(data) {
    return request({
        headers: {
            'Authorization': getToken()
        },
        url: process.env.BASE_API + '/entry/store/house/inbound-detail',
        method: 'post',
        data
    })
}
// 汇总分析
export function getAnalysis(data) {
    return request({
        headers: {
            'Authorization': getToken()
        },
        url: process.env.BASE_API + '/warehouse/analysis/statistics',
        method: 'post',
        data
    })
}
src/views/layout/Layout.vue
@@ -18,8 +18,8 @@
                      :label="item.meta.title"
                      :name="item.path"
                  >
                      <div class="main-container">
                          <app-main />
                      <div class="main-container" v-if="editableTabsValue == item.path">
                          <app-main/>
                      </div>
                  </el-tab-pane>
              </el-tabs>
src/views/layout/components/AppMain.vue
@@ -2,7 +2,7 @@
  <section class="app-main">
    <transition name="fade-transform" mode="out-in">
      <keep-alive :include="cachedViews">
        <router-view :key="key" />
        <router-view :key="key"/>
      </keep-alive>
    </transition>
  </section>
src/views/license/licenseInfo/components/licenseDelayForm.vue
@@ -734,8 +734,8 @@
            checkMore4:[],
            checkMore5:[],
            checkMore6:[],
            checkList1:['C级'],
            checkList2:['D级'],
            checkList1:['C级','D级'],
            checkList2:['C级','D级'],
            checkMoreList:['C级','D级'],
            storage1:{
                id:null,
src/views/license/licenseInfo/components/licenseInfoForm.vue
@@ -732,8 +732,8 @@
            checkMore4:[],
            checkMore5:[],
            checkMore6:[],
            checkList1:['C级'],
            checkList2:['D级'],
            checkList1:['C级','D级'],
            checkList2:['C级','D级'],
            checkMoreList:['C级','D级'],
            storage1:{
                id:null,
@@ -1088,13 +1088,13 @@
        justifySingle(value){
            if(value === 1){
                if(this.checked1 === true){
                    this.checkMore1 = ['C级']
                    this.checkMore1 = ['C级','D级']
                }else{
                    this.checkMore1 = []
                }
            }else if(value ===2){
                if(this.checked2 === true){
                    this.checkMore2 = ['D级']
                    this.checkMore2 = ['C级','D级']
                }else{
                    this.checkMore2 = []
                }
@@ -1106,7 +1106,7 @@
                }
            }else if(value === 4){
                if(this.checked4 === true){
                    this.checkMore4 = ['C级']
                    this.checkMore4 = ['C级','D级']
                }else{
                    this.checkMore4 = []
                }
@@ -1118,7 +1118,7 @@
                }
            }else{
                if(this.checked6 === true){
                    this.checkMore6 = ['D级']
                    this.checkMore6 = ['C级','D级']
                }else{
                    this.checkMore6 = []
                }
src/views/license/licenseInfo/components/licenseModForm.vue
@@ -737,8 +737,8 @@
            checkMore4:[],
            checkMore5:[],
            checkMore6:[],
            checkList1:['C级'],
            checkList2:['D级'],
            checkList1:['C级','D级'],
            checkList2:['C级','D级'],
            checkMoreList:['C级','D级'],
            storage1:{
                id:null,
@@ -980,13 +980,13 @@
        justifySingle(value){
            if(value === 1){
                if(this.checked1 === true){
                    this.checkMore1 = ['C级']
                    this.checkMore1 = ['C级','D级']
                }else{
                    this.checkMore1 = []
                }
            }else if(value ===2){
                if(this.checked2 === true){
                    this.checkMore2 = ['D级']
                    this.checkMore2 = ['C级','D级']
                }else{
                    this.checkMore2 = []
                }
@@ -998,7 +998,7 @@
                }
            }else if(value === 4){
                if(this.checked4 === true){
                    this.checkMore4 = ['C级']
                    this.checkMore4 = ['C级','D级']
                }else{
                    this.checkMore4 = []
                }
@@ -1010,7 +1010,7 @@
                }
            }else{
                if(this.checked6 === true){
                    this.checkMore6 = ['D级']
                    this.checkMore6 = ['C级','D级']
                }else{
                    this.checkMore6 = []
                }
src/views/purchase/dailySaleReport.vue
@@ -1,6 +1,6 @@
<template>
    <div class="container">
      <div class="filter-container">
      <div class="filter-container" style="padding: 20px">
        <el-row>
          时间:&emsp;&emsp;
          <el-date-picker
@@ -11,16 +11,16 @@
            :clearable="false"
            :default-time="['00:00:00','23:59:59']">
          </el-date-picker>
            <el-button class="filter-item" style="margin-left: 10px;margin-bottom: 0" type="primary" icon="el-icon-back"
                       @click="dayForward">前一天</el-button>
            <el-button class="filter-item" style="margin-left: 10px;margin-bottom: 0" type="primary" icon="el-icon-right"
                       @click="dayBackward">后一天</el-button>
<!--            <el-button class="filter-item" style="margin-left: 10px;margin-bottom: 0" type="primary" icon="el-icon-search"-->
<!--                       @click="queryHandle"/>-->
        </el-row>
        <el-row style="padding-top: 10px">
          <el-button class="filter-item" style="margin-left: 10px;" type="primary" icon="el-icon-back"
                     @click="dayForward">前一天</el-button>
          <el-button class="filter-item" style="margin-left: 10px;" type="primary" icon="el-icon-right"
                     @click="dayBackward">后一天</el-button>
          <el-button class="filter-item" style="margin-left: 10px;" type="primary" icon="el-icon-search"
                     @click="queryHandle"/>
        </el-row>
      </div>
      <div class="table_content">
@@ -114,9 +114,9 @@
      this.queryDateHandle();
    },
    methods:{
      queryHandle(){
        this.getReportList();
      },
      // queryHandle(){
      //   this.getReportList();
      // },
      getReportList(){
        const _this = this;
        const params = {};
@@ -178,6 +178,7 @@
          end.setMinutes(59);
          end.setSeconds(59);
          this.dateRange = [start,end]
            this.getReportList()
        }
      },
      dayBackward(){
@@ -193,6 +194,7 @@
          end.setMinutes(59);
          end.setSeconds(59);
          this.dateRange = [start,end]
            this.getReportList()
        }
      },
      queryDateHandle(){
@@ -207,6 +209,7 @@
        this.dateRange.push(start,end);
        this.startDate = start;
        this.endDate = end;
        this.getReportList()
      },
      sortChange(param){
        this.sort = param.prop;
src/views/purchase/person.vue
@@ -206,7 +206,7 @@
import Cookies from "js-cookie";
export default {
    name: "addSelfExam",
    name: "person",
    data(){
        return{
            tableKey:'',
@@ -282,6 +282,7 @@
      uploadDialog
    },
    created() {
        console.log('Component created:', this.$options.name);
      this.initValidTime()
      this.getPersonProductList()
      this.getProvince()
src/views/specialCheck/index.vue
@@ -109,8 +109,10 @@
                t.$refs.wholesale.currentPage = 1
                t.$refs.wholesale.pageSize = 10
                if(key.split('-')[1] == '1' || key.split('-')[1] == '2'){
                    console.log(keyPath,'path')
                    t.$refs.wholesale.taskId = Number(keyPath[0].split('-')[0])
                    t.$refs.wholesale.taskName = keyPath[0].split('-')[1]
                    t.$refs.wholesale.taskName = keyPath[0].split('-').slice(1).join('-')
                    console.log(t.$refs.wholesale.taskName,'name')
                    t.$refs.wholesale.enterpriseType = Number(key.split('-')[1])
                    t.$refs.wholesale.getEnterpriseCompleteInfoList()
                }else{
src/views/stock/components/enterprisePurchaseDetail.vue
@@ -6,7 +6,7 @@
        :append-to-body="true"
    >
        <div class="app-container">
            <div class="table_title">新疆吉庆烟花爆竹有限公司<span v-if="timeValue!==''">({{ timeValue }})</span>进货情况</div>
            <div class="table_title">{{company}}<span v-if="timeValue!==''">({{ timeValue }})</span>进货情况</div>
            <div class="table_content">
                <el-table
                    v-loading="listLoading"
@@ -50,6 +50,7 @@
            return{
                scList: [],
                timeValue: '',
                company: '',
                tableKey:'',
                listLoading:false,
                purchaseDetailVisible:false,
@@ -57,8 +58,9 @@
        },
        components: {},
        methods:{
            open(scItems,timeRange,startTime,endTime){
                this.scList = scItems;
            open(data,timeRange,startTime,endTime){
                this.scList = data.scItems
                this.company = data.pifaCompany
                for(let i of this.scList){
                    i.firecracker = i.items.filter(it=>it.type === '爆竹类').length>0?i.items.filter(it=>it.type === '爆竹类')[0].boxCount:0
                    i.spray = i.items.filter(it=>it.type === '喷花类').length>0?i.items.filter(it=>it.type === '喷花类')[0].boxCount:0
@@ -72,6 +74,7 @@
                if(timeRange){
                    this.timeValue = startTime.split(' ')[0] + '~' + endTime.split(' ')[0]
                }
            }
        }
    }
src/views/stock/enterprisePurchaseStatistics.vue
@@ -379,9 +379,9 @@
            },
            showDetail(param){
                if( this.validTime !== null ){
                    this.$refs.purchaseDetail.open(param.scItems,true,this.validTime[0],this.validTime[1])
                    this.$refs.purchaseDetail.open(param,true,this.validTime[0],this.validTime[1])
                }else{
                    this.$refs.purchaseDetail.open(param.scItems,false)
                    this.$refs.purchaseDetail.open(param,false)
                }
            },
        },
src/views/stock/stockManage.vue
@@ -94,9 +94,9 @@
    },
    created() {
        const t = this
        setTimeout(()=>{
            t.$refs.deliverUsage.open()
        },1000)
        // setTimeout(()=>{
        //     t.$refs.deliverUsage.open()
        // },1000)
    },
    mounted() {
    },
src/views/warehouse/components/addStock.vue
对比新文件
@@ -0,0 +1,365 @@
<template>
    <el-dialog :visible.sync="dialogVisible" :modal-append-to-body="false" :close-on-click-modal="false" :title="dialogTitle" center
               width="75%" @close="reset()">
        <el-form ref="dataForm" :rules="dataFormRules" :model="dataForm" label-position="right" label-width="150px" element-loading-text="保存中...">
            <div class="part-title">
                <span>库区基本信息填写</span>
            </div>
            <el-divider></el-divider>
            <div>
                <el-row :gutter="20">
                    <el-col :span="12">
                        <el-form-item label="库区名称:" prop="reserveName" >
                            <el-input v-model.trim="dataForm.reserveName"/>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="所属企业:">
                            <el-input disabled v-model.trim="dataForm.company"/>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row :gutter="20">
                    <el-col :span="10">
                        <el-form-item label="所属省份:" prop="province">
                            <el-select v-model="dataForm.province" clearable @change="changeArea('province')" style="width: 100%;">
                                <el-option
                                    v-for="item in provinceList"
                                    :key="item.id"
                                    :label="item.name"
                                    :value="item.name"
                                >
                                </el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="6">
                        <el-form-item prop="city" class="selector">
                            <el-select v-model="dataForm.city" prop="city" clearable @change="changeArea('city')" style="width: 100%;">
                                <el-option
                                    v-for="item in cityList"
                                    :key="item.id"
                                    :label="item.name"
                                    :value="item.name"
                                >
                                </el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="6">
                        <el-form-item prop="area" class="selector">
                            <el-select v-model="dataForm.area" clearable filterable @change="changeArea('district')" style="width: 100%;">
                                <el-option
                                    v-for="item in districtList"
                                    :key="item.id"
                                    :label="item.name"
                                    :value="item.name"
                                >
                                </el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="22">
                        <el-form-item label="库区地址:" prop="reserveAddress" >
                            <el-input v-model.trim="dataForm.reserveAddress"/>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row :gutter="20">
                    <el-col :span="11">
                        <el-form-item label="库区总面积:" prop="square" class="numInput">
                            <el-input type="number" v-model.number="dataForm.square"><template slot="append">㎡</template></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="11">
                        <el-form-item label="有效仓储面积:" prop="effectiveStorageSquare" class="numInput">
                            <el-input type="number" v-model.number="dataForm.effectiveStorageSquare"><template slot="append">㎡</template></el-input>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row :gutter="20">
                    <el-col :span="11">
                        <el-form-item label="核定储量:" prop="approvedReserves" class="numInput">
                            <el-input type="number" v-model.number="dataForm.approvedReserves"><template slot="append">箱</template></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="11">
                        <el-form-item label="核药量:" prop="nuclearDose" class="numInput">
                            <el-input type="number" v-model.number="dataForm.nuclearDose"><template slot="append">kg</template></el-input>
                        </el-form-item>
                    </el-col>
                </el-row>
            </div>
            <div class="part-title">
                <span>库房列表</span>
            </div>
            <el-divider></el-divider>
            <tr>
                <td class="w-12">序号</td>
                <td class="w-20">库房名称</td>
                <td>库房面积</td>
                <td>有效仓储面积</td>
                <td>核定储量(箱)</td>
                <td>等级</td>
                <td>核药量</td>
                <td>操作</td>
            </tr>
            <tr v-for="(item,index) in dataForm.storehouseInfos" :key="index">
                <td class="w-12">
                    {{ index + 1 }}
                </td>
                <td class="w-20">
                    <el-input v-model="item.storehouseName"></el-input>
                </td>
                <td>
                    <el-input type="number" v-model.number="item.square"><template slot="append">㎡</template></el-input>
                </td>
                <td>
                    <el-input type="number" v-model.number="item.effectiveStorageSquare"><template slot="append">㎡</template></el-input>
                </td>
                <td>
                    <el-input type="number" v-model.number="item.approvedReserves"><template slot="append">箱</template></el-input>
                </td>
                <td>
                    <el-select v-model="item.storehouseLevel" clearable filterable>
                        <el-option label="1.1" :value="1.1"></el-option>
                        <el-option label="1.3" :value="1.3"></el-option>
                    </el-select>
                </td>
                <td>
                    <el-input type="number" v-model.number="item.nuclearDose"><template slot="append">kg</template></el-input>
                </td>
                <td>
                    <el-button type="danger" @click="delItem(item,index)">删除</el-button>
                </td>
            </tr>
            <el-button type="primary" style="margin-top: 20px" @click="addItem()">新增仓库</el-button>
        </el-form>
        <br>
        <span slot="footer" class="dialog-footer">
            <el-button @click="dialogVisible = false">取 消</el-button>
            <el-button type="primary" @click="handleSubmit">保 存</el-button>
        </span>
    </el-dialog>
</template>
<script>
    import {mapGetters} from "vuex";
    import {getCityListData, getProvinceListData} from "../../../api/area";
    import {saveReserveInfo, getInfoById, editReserveInfo} from '../../../api/warehouse'
    import Cookies from 'js-cookie'
    export default {
        name: "addStock",
        data() {
            return {
                dialogVisible: false,
                dialogTitle: '新增库区',
                dataForm: {
                    id: null,
                    enterpriseId: null,
                    reserveName: '',
                    company: '',
                    reserveAddress: '',
                    province: '',
                    city: '',
                    area: '',
                    square: null,
                    effectiveStorageSquare: null,
                    approvedReserves: null,
                    nuclearDose: null,
                    storehouseInfos: []
                },
                listLoading: false,
                provinceList:[],
                cityList:[],
                districtList:[],
                dataFormRules:{
                    reserveName:[{ required: true, message: '请填写库区名称', trigger: 'blur' }],
                    province:[{ required: true, message: '请选择所在区划', trigger: 'blur' }],
                    city:[{ required: true, message: '请选择所在区划', trigger: 'blur' }],
                    area:[{ required: true, message: '请选择所在区划', trigger: 'blur' }],
                    reserveAddress:[{ required: true, message: '请填写库区地址', trigger: 'blur' }],
                    square:[{ required: true, message: '请填写库区总面积', trigger: 'blur' }],
                    effectiveStorageSquare:[{ required: true, message: '请填写库区有效仓储面积', trigger: 'blur' }],
                    approvedReserves:[{ required: true, message: '请填写库区核定储量', trigger: 'blur' }],
                    nuclearDose:[{ required: true, message: '请填写库区核药量', trigger: 'blur' }]
                },
            }
        },
        created() {
            const t = this
        },
        computed: {
            ...mapGetters([
                'userType',
                'username'
            ])
        },
        methods: {
            open(type,data){
                this.getProvince()
                if(type == 'add'){
                    this.dataForm.company = Cookies.get('company')
                    this.dialogTitle = '新增库区'
                }else{
                    this.dialogTitle = '编辑库区'
                    getInfoById({id: data.topId}).then((res)=>{
                        if(res.data.code == 200){
                            if(res.data.result){
                                for(let i in this.dataForm){
                                    if(this.isKey(i,res.data.result)){
                                        this.dataForm[i] = res.data.result[i]
                                    }
                                }
                            }
                            this.dataForm['storehouseInfos'] = res.data.result.storehouseInfo.map((i)=>{
                                const{reserveId,...data} = i
                                return data
                            })
                            this.dataForm['company'] = data.enterpriseName
                            this.dataForm['enterpriseId'] = res.data.result.enterpriseId
                        }
                    }).catch((res)=>{
                        this.$message.warning(res.data.message)
                    })
                }
                this.dialogVisible = true
            },
            isKey(key,obj){
              return key in obj
            },
            delItem(item,index){
                this.dataForm.storehouseInfos.splice(index,1);
            },
            addItem(){
              const obj = {
                  storehouseName: '',
                  square: null,
                  effectiveStorageSquare: null,
                  approvedReserves: null,
                  storehouseLevel: null,
                  nuclearDose: null
              }
              this.dataForm.storehouseInfos.push(obj)
            },
            async getProvince(){
                let res = await getProvinceListData()
                if(res.data.code === "200"){
                    this.provinceList = res.data.result.provinceList
                }
            },
            async changeArea(value) {
                if (value === 'province') {
                    this.dataForm.city = ''
                    this.dataForm.area = ''
                    let res = await getCityListData({type:2, parenttype:1, parentname:this.dataForm.province})
                    if (res.data.code === "200") {
                        this.cityList = res.data.result
                    }
                } else if (value === 'city') {
                    this.dataForm.area = ''
                    let res = await getCityListData({type:3, parenttype:2, parentname:this.dataForm.city})
                    if (res.data.code === "200") {
                        this.districtList = res.data.result
                    }
                }
            },
            handleSubmit(){
                if(this.dataForm.storehouseInfos == 0){
                    this.$message.warning('库区应至少包含一间仓库')
                    return
                }
                if(this.dataForm.storehouseInfos.find(i=>i.storehouseName == ''|| i.square == null || i.effectiveStorageSquare == null || i.approvedReserves == null||i.storehouseLevel == null|| i.nuclearDose == null)){
                    this.$message.warning('请完善部分仓库信息')
                    return
                }
                this.$refs.dataForm.validate(async (valid) => {
                    if (valid) {
                        if(this.dialogTitle == '新增库区'){
                            const {company,id,enterpriseId,...data} = this.dataForm
                            const res = await saveReserveInfo(data)
                            if(res.data.code == 200){
                                this.$message.success(res.data.message)
                                this.$refs.dataForm.resetFields()
                                this.$refs.dataForm.clearValidate()
                                this.$emit('refresh')
                                this.dialogVisible = false
                            }else{
                                this.$message({
                                    type:'warning',
                                    message: res.data.message
                                })
                            }
                        }else{
                            const {company,...data} = this.dataForm
                            const res = await editReserveInfo(data)
                            if(res.data.code == 200){
                                this.$message.success(res.data.message)
                                this.$refs.dataForm.resetFields()
                                this.$refs.dataForm.clearValidate()
                                this.$emit('refresh')
                                this.dialogVisible = false
                            }else{
                                this.$message({
                                    type:'warning',
                                    message: res.data.message
                                })
                            }
                        }
                    }
                })
            },
            reset(){
                this.$refs.dataForm.resetFields()
                this.$refs.dataForm.clearValidate()
            }
        }
    }
</script>
<style lang="scss" scoped>
    .part-title{
        font-size: 16px;
        font-weight: bolder;
    }
    .selector{
        /deep/ .el-form-item__content{
            margin-left: 0 !important;
        }
    }
    .editForm{
        .el-form-item{
            display: flex !important;
        }
        /deep/ .el-form-item__content{
            width: 100%;
            margin-left: 0 !important;
        }
    }
    .numInput{
        /deep/ .el-input__inner{
            padding-right: 0;
        }
    }
    tr{
        display: flex;
        td{
            flex: 1;
            display: flex;
            justify-content: center;
            padding: 5px;
            align-items: center;
        }
        .w-12{
            flex: 0.5;
        }
        .w-20{
            flex: 2;
        }
    }
</style>
src/views/warehouse/components/deliverUsage.vue
对比新文件
@@ -0,0 +1,139 @@
<template>
    <el-dialog
        :visible.sync="deliverDialog"
        :close-on-click-modal="false"
        width="50%"
        :append-to-body="true"
        :title=stockName
        center
        size="medium"
    >
        <div class="app-container">
            <div class="upTitle">
                请勾选或取消勾选允许使用该仓库的批发企业,您允许使用的企业可将货物入库到该仓库。
            </div>
            <div class="table_content">
                <el-checkbox-group v-model="authorityCorts" @change="changeData">
                    <el-checkbox v-for="item in companyList" :key="item.enterpriseId" :label="item.enterpriseId" :disabled="item.enterpriseAuthority == 1? true: false" border style="display: block">
                        {{item.enterpriseName}}
                    </el-checkbox>
                </el-checkbox-group>
            </div>
        </div>
        <span slot="footer" class="dialog-footer">
                <el-button @click="deliverDialog = false">取 消</el-button>
                <el-button type="primary" @click="handleSubmit()">提 交</el-button>
            </span>
    </el-dialog>
</template>
<script>
    import {computePageCount} from "@/utils";
    import {listStockhouseEnterpriseUserInfo,editEnterpriseUserAuthority} from "../../../api/warehouse";
    export default {
        name: "deliverUsage",
        components: {},
        data(){
            return{
                tableStatus: true,
                tableKey:'',
                stockName: '',
                listLoading:false,
                companyList:[],
                authorityCorts: [],
                deliverDialog:false,
                reserveId: null,
                storehouseId: null,
                submitForm: {
                    addEnterprises: [],
                    addStatus: false,
                    deleteEnterprises: [],
                    deleteStatus: false
                }
            }
        },
        created() {
            const t = this
        },
        methods:{
            open(data){
                this.submitForm = {
                    addEnterprises: [],
                    addStatus: false,
                    deleteEnterprises: [],
                    deleteStatus: false
                }
                this.reserveId = data.topId
                this.storehouseId = data.id
                listStockhouseEnterpriseUserInfo({id: data.id}).then((res)=>{
                    this.stockName = '仓库【'+ data.storehouseName + '】使用权分配'
                    if(res.data.code == 200){
                        this.companyList = res.data.result.enterpriseUserAuthorityInfo
                        this.authorityCorts = this.companyList.filter(item=>item.enterpriseAuthority == 1 || item.enterpriseAuthority == 2).map(i=>{return i.enterpriseId})
                    }else{
                        this.$message.warning(res.data.message)
                    }
                    this.deliverDialog = true
                }).catch(()=>{
                    this.$message.warning('数据获取失败')
                })
            },
            changeData(value){
                console.log(value,'val')
            },
            async handleSubmit(){
                const originList = this.companyList.filter(i=>i.enterpriseAuthority == 1 || i.enterpriseAuthority==2)
                const companyIds = originList.map(i=>i.enterpriseId)
                const addedElementsSet = new Set(this.authorityCorts.filter(element => !companyIds.includes(element)))
                const removedElementsSet = new Set(companyIds.filter(element => !this.authorityCorts.includes(element)))
                const addedElements = Array.from(addedElementsSet)
                const removedElements = Array.from(removedElementsSet)
                if(addedElements.length>0){
                    this.submitForm.addStatus = true
                    this.submitForm.addEnterprises = addedElements.map((i)=>{
                        return {
                            enterpriseId: i,
                            reserveId: this.reserveId,
                            storehouseId: this.storehouseId
                        }
                    })
                }
                if(removedElements.length>0){
                    this.submitForm.deleteStatus = true
                    for(let i of this.companyList){
                        if(removedElements.find(item=>item == i.enterpriseId)){
                            this.submitForm.deleteEnterprises.push({
                                id: i.id?i.id:null,
                                enterpriseId: i.enterpriseId,
                                reserveId: this.reserveId,
                                storehouseId: this.storehouseId
                            })
                        }
                    }
                }
                const res = await editEnterpriseUserAuthority(this.submitForm)
                if(res.data.code == 200){
                    this.$message.success('仓库使用权修改成功')
                }else{
                    this.$message.warning(res.data.message)
                }
                this.deliverDialog = false
                this.$emit('refresh')
            }
        }
    }
</script>
<style lang="scss" scoped>
    .upTitle{
        font-size: 16px;
        margin-bottom: 20px;
    }
    /deep/ .el-checkbox{
        width: 80%;
        margin-left: 0 !important;
        margin-right: 0 !important;
        margin-bottom: 10px !important;
    }
</style>
src/views/warehouse/components/editStock.vue
对比新文件
@@ -0,0 +1,146 @@
<template>
    <el-dialog :visible.sync="editDialogVisible" :modal-append-to-body="false" :close-on-click-modal="false" title="批发企业盘库(单位:箱)" center
               width="30%">
        <el-form :model="stockInfo" label-width="140px" class="editForm">
            <el-form-item label="企业名称:"><el-input readonly v-model="stockInfo.enterpriseName"/></el-form-item>
            <el-form-item label="当前库区:"><el-input readonly v-model="stockInfo.reserveName"/></el-form-item>
            <el-form-item label="当前库房:"><el-input readonly v-model="stockInfo.storehouseName"/></el-form-item>
            <el-form-item label="当前总库存:"><el-input readonly v-model="stockInfo.totalInventory"/></el-form-item>
        </el-form>
        <el-divider></el-divider>
        <el-form ref="editForm" :rules="editFormRules" :model="editForm" label-width="140px" class="editForm">
            <el-form-item label="爆竹类:" prop="firecracker" class="numInput">
                <el-input type="number" v-model.number="editForm.firecracker"/>
            </el-form-item>
            <el-form-item label="喷花类:" prop="spray" class="numInput">
                <el-input type="number" v-model.number="editForm.spray"/>
            </el-form-item>
            <el-form-item label="旋转类:" prop="rotation" class="numInput">
                <el-input type="number" v-model.number="editForm.rotation"/>
            </el-form-item>
            <el-form-item label="吐珠类:" prop="bead" class="numInput">
                <el-input type="number" v-model.number="editForm.bead"/>
            </el-form-item>
            <el-form-item label="玩具类:" prop="toy" class="numInput">
                <el-input type="number" v-model.number="editForm.toy"/>
            </el-form-item>
            <el-form-item label="组合类:" prop="combined" class="numInput">
                <el-input type="number" v-model.number="editForm.combined"/>
            </el-form-item>
        </el-form>
        <span slot="footer" class="dialog-footer">
            <el-button @click="editDialogVisible = false">取 消</el-button>
            <el-button type="primary" @click="handleUpdate()">完 成</el-button>
        </span>
    </el-dialog>
</template>
<script>
    import {mapGetters} from "vuex";
    import {getStorehouseData, updateStorehouseData} from '../../../api/warehouse'
    export default {
        name: "editStock",
        data() {
            return {
                editDialogVisible: false,
                stockInfo:{
                    enterpriseName: '',
                    reserveName: '',
                    storehouseName: '',
                    totalInventory: null
                },
                editForm: {
                    id: null,
                    enterpriseId: null,
                    storehouseId: 0,
                    bead: 0,
                    combined: 0,
                    firecracker: 0,
                    rotation: 0,
                    spray: 0,
                    toy: 0
                },
                listLoading: false,
                editFormRules:{
                    firecracker:[{ required: true, message: '请填写数量', trigger: 'blur'}],
                    spray:[{ required: true, message: '请填写数量', trigger: 'blur'}],
                    rotation:[{ required: true, message: '请填写数量', trigger: 'blur'}],
                    bead:[{ required: true, message: '请填写数量', trigger: 'blur'}],
                    toy:[{ required: true, message: '请填写数量', trigger: 'blur'}],
                    combined:[{ required: true, message: '请填写数量', trigger: 'blur'}]
                }
            }
        },
        created() {
            const t = this
        },
        computed: {
            ...mapGetters([
                'userType',
                'username'
            ])
        },
        methods: {
            open(data){
                this.editDialogVisible = true
                this.stockInfo.enterpriseName = data.enterpriseName
                this.stockInfo.reserveName = data.reserveName
                this.stockInfo.storehouseName = data.storehouseName
                this.stockInfo.totalInventory = data.totalInventory
                getStorehouseData({id: data.id}).then((res)=>{
                    if(res.data.code == 200){
                        this.editForm = res.data.result
                        this.editForm['id'] = data.topId
                        this.editForm['enterpriseId'] = data.enterpriseUserId
                        this.editForm['storehouseId'] = data.id
                    }else{
                        this.$message.warning(res.data.message)
                    }
                }).catch(()=>{
                    this.$message.warning('数据获取失败')
                })
            },
            handleUpdate(){
                this.$refs.editForm.validate(async (valid) => {
                    if (valid) {
                        const res = await updateStorehouseData(this.editForm)
                        if(res.data.code == 200){
                            this.$message.success('盘库提交成功')
                        }else{
                            this.$message.warning(res.data.message)
                        }
                        this.editDialogVisible = false
                    }
                })
            }
        }
    }
</script>
<style lang="scss" scoped>
    .part-title{
        font-size: 16px;
        font-weight: bolder;
    }
    .selector{
        /deep/ .el-form-item__content{
            margin-left: 0 !important;
        }
    }
    .editForm{
        .el-form-item{
            display: flex !important;
        }
        /deep/ .el-form-item__content{
            width: 100%;
            margin-left: 0 !important;
        }
    }
    .numInput{
        /deep/ .el-input__inner{
            padding-right: 0;
        }
    }
</style>
src/views/warehouse/components/enterpriseStock.vue
对比新文件
@@ -0,0 +1,103 @@
<template>
    <el-dialog
        :visible.sync="dialogVisible"
        width="70%"
        :append-to-body="true"
        :title="title"
    >
        <div class="app-container">
            <div class="table_content">
                <el-table
                    v-loading="listLoading"
                    :key="tableKey"
                    :data="listData"
                    border
                    fit
                    highlight-current-row
                    style="width: 100%;"
                    show-summary
                >
                    <el-table-column label="企业名称" prop="enterpriseUser" align="center">
                    </el-table-column>
                    <el-table-column label="总库存" prop="totalStock" align="center">
                    </el-table-column>
                    <el-table-column label="爆竹类(箱)" prop="firecracker" align="center">
                    </el-table-column>
                    <el-table-column label="喷花类(箱)" prop="spray" align="center">
                    </el-table-column>
                    <el-table-column label="旋转类(箱)" prop="rotation" align="center">
                    </el-table-column>
                    <el-table-column label="吐珠类(箱)" prop="bead" align="center">
                    </el-table-column>
                    <el-table-column label="玩具类(箱)" prop="toy" align="center">
                    </el-table-column>
                    <el-table-column label="组合烟花类(箱)" prop="combined" align="center">
                    </el-table-column>
                </el-table>
                <br>
<!--                <el-pagination-->
<!--                    v-show="recordTotal>0"-->
<!--                    :current-page="currentPage"-->
<!--                    :page-sizes="[10, 15]"-->
<!--                    :page-size="pageSize"-->
<!--                    :total="recordTotal"-->
<!--                    layout="total, sizes, prev, pager, next, jumper"-->
<!--                    background-->
<!--                    style="float:right;"-->
<!--                    @size-change="handleSizeChange"-->
<!--                    @current-change="handleCurrentChange"-->
<!--                />-->
<!--                <br>-->
            </div>
        </div>
    </el-dialog>
</template>
<script>
    import {computePageCount} from "@/utils";
    import {listStockDataByStorehouseId} from "../../../api/warehouse";
    export default {
        name: "index",
        data(){
            return{
                title:'',
                tableKey:'',
                listLoading:false,
                listData:[],
                dialogVisible:false,
            }
        },
        components: {},
        methods:{
            open(data){
                this.getList(data.id || data.storehouseId)
                this.dialogVisible = true
            },
            async getList(id){
                this.listLoading = true
                let res = await listStockDataByStorehouseId({id: id})
                if(res.data.code === "200"){
                    this.listData = res.data.result.stockDataInfos
                    this.title = '库区:'+res.data.result.reserveName +' 仓库:'+ res.data.result.storehouseName + '各企业库存情况'
                }else{
                    this.$message({
                        type:'warning',
                        message:res.data.message
                    })
                }
                this.listLoading = false
            }
        }
    }
</script>
<style scoped>
    .basic_search{
        display:inline-block;
    }
    .table_title{
        font-size: 18px;
        margin-bottom: 20px;
    }
</style>
src/views/warehouse/components/recordDetail.vue
对比新文件
@@ -0,0 +1,162 @@
<template>
    <el-dialog :visible.sync="detailVisible" append-to-body :close-on-click-modal="false" :title="title" center
               width="75%">
        <div class="app-container">
            <div class="table_content">
                <el-table
                    v-loading="listLoading"
                    :data="detailRecords"
                    border
                    fit
                    highlight-current-row
                    style="width: 100%;"
                >
                    <el-table-column label="序号" type="index" align="center" width="60"/>
                    <el-table-column v-if="title == '出库详情'" label="产品名称" prop="itemname" align="center"></el-table-column>
                    <el-table-column v-if="title == '入库详情'" label="产品名称" prop="productname" align="center"></el-table-column>
                    <el-table-column label="产品包装码" prop="itemcode" align="center"></el-table-column>
                    <el-table-column label="类型" prop="type" align="center"></el-table-column>
                    <el-table-column label="规格" prop="specification" align="center"></el-table-column>
                    <el-table-column label="含药量" prop="explosivecontent" align="center"></el-table-column>
                    <el-table-column label="箱含量" prop="boxnumber" align="center"></el-table-column>
                    <el-table-column :label="title == '入库详情'?'入库数量':'出库数量'" prop="num" align="center"></el-table-column>
                </el-table>
                <el-pagination
                    v-show="recordTotal>0"
                    :current-page="currentPage"
                    :page-sizes="[10, 20, 30, 50]"
                    :page-size="pageSize"
                    :total="recordTotal"
                    layout="total, sizes, prev, pager, next, jumper"
                    background
                    style="float:right;"
                    @size-change="handleSizeChange"
                    @current-change="handleCurrentChange"
                />
            </div>
        </div>
    </el-dialog>
</template>
<script>
    import {mapGetters} from "vuex";
    import {getInboundDetail, getOutboundDetail} from '../../../api/warehouse'
    import Cookies from "_js-cookie@2.2.0@js-cookie";
    export default {
        name: "recordDetail",
        data() {
            return {
                detailVisible: false,
                title: '',
                stockInfo:{
                    enterpriseName: '',
                    reserveName: '',
                    storehouseName: '',
                    totalInventory: null
                },
                detailRecords: [],
                listLoading: false,
                pageSize: 10,
                recordTotal: 0,
                currentPage: 1,
                listQuery: {
                    pageIndex: 1,
                    pageSize: 10,
                    filter: {
                        storehouseId: null,
                        code: ''
                    }
                }
            }
        },
        created() {
            const t = this
        },
        computed: {
            ...mapGetters([
                'userType',
                'username'
            ])
        },
        methods: {
            open(type,data,storehouseId){
                this.detailRecords = []
                this.detailVisible = true
                this.listQuery.filter.storehouseId = storehouseId
                if(type=='out'){
                    this.title = '出库详情'
                    this.listQuery.filter.code = data.ordercode
                    this.getOut()
                }else{
                    this.title = '入库详情'
                    this.listQuery.filter.code = data.code
                    this.getIn()
                }
            },
            async getOut(){
              const res = await getOutboundDetail(this.listQuery)
                if(res.data.code == 200){
                    this.detailRecords = res.data.result.records
                    this.recordTotal = res.data.result.total
                }else{
                    this.$message.warning(res.data.message)
                }
            },
            async getIn(){
                const res = await getInboundDetail(this.listQuery)
                if(res.data.code == 200){
                    this.detailRecords = res.data.result.records
                    this.recordTotal = res.data.result.total
                }else{
                    this.$message.warning(res.data.message)
                }
            },
            handleSizeChange(val) {
                this.listQuery.pageSize = val
                if(this.title == '出库详情'){
                    this.getOut()
                }else{
                    this.getIn()
                }
            },
            handleCurrentChange(val) {
                this.listQuery.pageIndex = val
                if(this.title == '出库详情'){
                    this.getOut()
                }else{
                    this.getIn()
                }
            },
        }
    }
</script>
<style lang="scss" scoped>
    .part-title{
        font-size: 16px;
        font-weight: bolder;
    }
    .selector{
        /deep/ .el-form-item__content{
            margin-left: 0 !important;
        }
    }
    .editForm{
        .el-form-item{
            display: flex !important;
        }
        /deep/ .el-form-item__content{
            width: 100%;
            margin-left: 0 !important;
        }
    }
    .numInput{
        /deep/ .el-input__inner{
            padding-right: 0;
        }
    }
</style>
src/views/warehouse/components/stockRecords.vue
对比新文件
@@ -0,0 +1,261 @@
<template>
    <el-dialog
        :visible.sync="recordDialog"
        :close-on-click-modal="false"
        width="75%"
        :title="tableStatus?'仓库出库记录':'仓库入库记录'"
        center
        append-to-body
    >
        <div class="app-container">
            <div class="filter-container">
                <div style="display: flex;justify-content: space-between">
                    <div class="basic_search" style="padding-top: 10px">
                        <span style="font-size: 16px">在</span>
                        <el-date-picker
                            value-format="yyyy-MM-dd HH:mm:ss"
                            v-model="validTime"
                            type="datetimerange"
                            :default-time="['00:00:00','23:59:59']"
                            range-separator="至"
                            start-placeholder="开始日期"
                            end-placeholder="结束日期"
                            @change="updateTime"
                        >
                        </el-date-picker>
<!--                        <span v-if="tableStatus" style="font-size: 16px">期间总计出库</span>-->
<!--                        <span v-else style="font-size: 16px">期间总计入库</span>-->
<!--                        <span style="font-size: 16px">2333</span>-->
<!--                        <span style="font-size: 16px">箱</span>-->
                    </div>
                    <div class="basic_search" style="margin-right: 10px;padding-top: 10px">
                        <el-radio-group v-model="tableStatus" @input="changeStatus">
                            <el-radio-button :label="true">出库记录</el-radio-button>
                            <el-radio-button :label="false">入库记录</el-radio-button>
                        </el-radio-group>
                    </div>
                </div>
            </div>
            <div class="table_content">
                <el-table
                    v-loading="listLoading"
                    :key="tableKey"
                    :data="stockRecords"
                    border
                    fit
                    highlight-current-row
                    style="width: 100%;"
                    v-if="tableStatus"
                >
                    <el-table-column label="序号" type="index" align="center" width="60"/>
                    <el-table-column label="出库单号" prop="ordercode" align="center"></el-table-column>
                    <el-table-column label="出库企业" prop="shop" align="center"></el-table-column>
                    <el-table-column label="创建时间" prop="createat" align="center"></el-table-column>
                    <el-table-column label="运输证号" prop="transportcert" align="center"></el-table-column>
                    <el-table-column label="数量(箱)" prop="realboxnum" align="center"></el-table-column>
                    <el-table-column prop="type" align="center">
                        <template slot-scope="scope">
                            <span type="text">{{scope.row.type == 1? '常规出库':scope.row.type == 2? '快速出库':scope.row.type == 3? '退货出库':'--'}}</span>
                        </template>
                    </el-table-column>
                    <el-table-column label="操作" align="center" width="120" class-name="small-padding fixed-width" fixed="right">
                        <template slot-scope="scope">
                            <el-button type="text" @click="showDetails('out',scope.row)">查看</el-button>
                        </template>
                    </el-table-column>
                </el-table>
                <el-table
                    v-loading="listLoading"
                    :key="tableKey"
                    :data="stockRecords"
                    border
                    fit
                    highlight-current-row
                    style="width: 100%;"
                    v-if="!tableStatus"
                >
                    <el-table-column label="序号" type="index" align="center" width="60"/>
                    <el-table-column label="入库单号" prop="code" align="center"></el-table-column>
                    <el-table-column label="入库企业" prop="unit" align="center"></el-table-column>
                    <el-table-column label="创建时间" prop="createddate" align="center"></el-table-column>
                    <el-table-column label="运输证号" prop="transportcert" align="center"></el-table-column>
                    <el-table-column label="数量(箱)" prop="boxnum" align="center"></el-table-column>
                    <el-table-column :label="tableStatus?'出库类型':'入库类型'" prop="type" align="center">
                        <template slot-scope="scope">
                            <span type="text">{{scope.row.type == 1? '常规入库':scope.row.type == 2? '快速入库':scope.row.type == 3? '退货入库':'--'}}</span>
                        </template>
                    </el-table-column>
                    <el-table-column label="操作" align="center" width="120" class-name="small-padding fixed-width" fixed="right">
                        <template slot-scope="scope">
                            <el-button type="text" @click="showDetails('in',scope.row)">查看</el-button>
                        </template>
                    </el-table-column>
                </el-table>
                <el-pagination
                    v-show="recordTotal>0"
                    :current-page="currentPage"
                    :page-sizes="[10, 20, 30, 50]"
                    :page-size="pageSize"
                    :total="recordTotal"
                    layout="total, sizes, prev, pager, next, jumper"
                    background
                    style="float:right;"
                    @size-change="handleSizeChange"
                    @current-change="handleCurrentChange"
                />
                <record-detail ref="detailRef"></record-detail>
            </div>
        </div>
    </el-dialog>
</template>
<script>
    import {computePageCount} from "@/utils";
    import {getInboundQuery, getOutboundQuery} from "../../../api/warehouse"
    import recordDetail from "./recordDetail";
    import Cookies from "_js-cookie@2.2.0@js-cookie";
    export default {
        name: "stockRecords",
        components: {recordDetail},
        data(){
            return{
                tableStatus: true,
                tableKey:'',
                listLoading:false,
                pageSize: 10,
                recordTotal: 0,
                currentPage: 1,
                validTime: ['', ''],
                stockRecords:[],
                recordDialog:false,
                listQuery: {
                    pageIndex: 1,
                    pageSize: 10,
                    filter: {
                        storehouseId: null,
                        starttime: '',
                        endtime: ''
                    }
                },
            }
        },
        created() {
            const t = this
        },
        methods:{
            open(row){
                this.listQuery.pageIndex = 1
                this.listQuery.filter.storehouseId = row.storehouseId
                this.initValidTime()
                if(this.tableStatus){
                    this.getOutbound()
                }else{
                    this.getInbound()
                }
                this.recordDialog = true
            },
            async getOutbound(){
                const res = await getOutboundQuery(this.listQuery)
                if(res.data.code == 200){
                   this.stockRecords = res.data.result.records
                    this.recordTotal = res.data.result.total
                }else{
                    this.$message({
                        type:'warning',
                        message: res.data.message
                    })
                }
            },
            async getInbound(){
                const res = await getInboundQuery(this.listQuery)
                if(res.data.code == 200){
                    this.stockRecords = res.data.result.records
                    this.recordTotal = res.data.result.total
                }else{
                    this.$message({
                        type:'warning',
                        message: res.data.message
                    })
                }
            },
            initValidTime() {
                const end = new Date();
                if (end.getDate() - 1 === 0) {
                    this.validTime[0] = [end.getFullYear(), end.getMonth()-1, this.returnDay(end.getMonth()-1, end.getFullYear())].join("-") + " 00:00:00";
                    this.validTime[1] = [end.getFullYear(), end.getMonth(), this.returnDay(end.getMonth(), end.getFullYear())].join("-") + " 23:59:59";
                } else if (end.getDate() - 1 === 0 && end.getMonth() === 0) {
                    this.validTime[0] = [end.getFullYear() - 1, 11, 30].join("-") + " 00:00:00";
                    this.validTime[1] = [end.getFullYear() - 1, 12, 31].join("-") + " 23:59:59";
                } else {
                    this.validTime[0] = [end.getFullYear(), end.getMonth(), end.getDate() - 1].join("-") + " 00:00:00";
                    this.validTime[1] = [end.getFullYear(), end.getMonth() + 1, end.getDate() - 1].join("-") + " 23:59:59";
                }
                this.listQuery.filter.starttime = this.validTime[0]
                this.listQuery.filter.endtime = this.validTime[1]
            },
            returnDay(value, year) {
                if (value === 1 || value === 3 || value === 5 || value === 7 || value === 8 || value === 10 || value === 12) {
                    return 31
                } else if (value === 2) {
                    if (year % 4 === 0) {
                        return 29
                    } else {
                        return 28
                    }
                } else {
                    return 30
                }
            },
            changeStatus(val){
              this.listQuery.pageIndex = 1
              if(val == true){
                  this.getOutbound()
              }else{
                  this.getInbound()
              }
            },
            updateTime(){
                this.listQuery.pageIndex = 1
                this.listQuery.filter.starttime = this.validTime[0]
                this.listQuery.filter.endtime = this.validTime[1]
                if(this.tableStatus == true){
                    this.getOutbound()
                }else{
                    this.getInbound()
                }
            },
            handleSizeChange(val) {
                this.listQuery.pageSize = val
                if(this.tableStatus == true){
                    this.getOutbound()
                }else{
                    this.getInbound()
                }
            },
            handleCurrentChange(val) {
                this.listQuery.pageIndex = val
                if(this.tableStatus == true){
                    this.getOutbound()
                }else{
                    this.getInbound()
                }
            },
            showDetails(type,row){
                this.$refs.detailRef.open(type,row,this.listQuery.filter.storehouseId)
            }
        }
    }
</script>
<style scoped>
    .basic_search{
        display:inline-block;
    }
</style>
src/views/warehouse/stockAnalyse.vue
对比新文件
@@ -0,0 +1,425 @@
<template>
    <div class="app-container">
        <div class="filter-container">
            <div style="display: block;">
<!--                <div class="basic_search">-->
<!--                    <span>区域:</span>-->
<!--                    <el-select v-model="listQuery.province" clearable filterable @change="changeArea('province')">-->
<!--                        <el-option-->
<!--                            v-for="item in provinceList"-->
<!--                            :key="item.id"-->
<!--                            :label="item.name"-->
<!--                            :value="item.name"-->
<!--                        >-->
<!--                        </el-option>-->
<!--                    </el-select>-->
<!--                </div>-->
<!--                <div class="basic_search">-->
<!--                    <el-select v-model="listQuery.city" prop="city" clearable filterable @change="changeArea('city')">-->
<!--                        <el-option-->
<!--                            v-for="item in cityList"-->
<!--                            :key="item.id"-->
<!--                            :label="item.name"-->
<!--                            :value="item.name"-->
<!--                        >-->
<!--                        </el-option>-->
<!--                    </el-select>-->
<!--                </div>-->
<!--                <div class="basic_search">-->
<!--                    <el-select v-model="listQuery.area" clearable filterable @change="changeArea('area')">-->
<!--                        <el-option-->
<!--                            v-for="item in districtList"-->
<!--                            :key="item.id"-->
<!--                            :label="item.name"-->
<!--                            :value="item.name"-->
<!--                        >-->
<!--                        </el-option>-->
<!--                    </el-select>-->
<!--                </div>-->
                <div class="basic_search">
                    <span>企业名称:</span>
                    <el-input filterable clearable v-model="listQuery.enterpriseName" style="width:200px">
                    </el-input>
                </div>
<!--                <div class="basic_search">-->
<!--                    <span>库区名称:</span>-->
<!--                    <el-input filterable clearable v-model="listQuery.reserveName" style="width:200px">-->
<!--                    </el-input>-->
<!--                </div>-->
                <div class="basic_search" style="margin-right: 10px">
                    <el-button style="margin-left: 10px;" type="primary" @click="reset()">重置</el-button>
                    <el-button style="margin-left: 10px;" type="primary" icon="el-icon-search" @click="searchData()">查询</el-button>
                </div>
            </div>
        </div>
        <div class="table_content">
            <el-table
                v-loading="listLoading"
                :data="stateStockData"
                :span-method="objectSpanMethod"
                :cell-class-name="tableRowClassName" @cell-mouse-leave="cellMouseLeave"  @cell-mouse-enter="cellMouseEnter"
                border
                :stripe="false"
                style="width: 100%;"
            >
                <el-table-column label="企业名称" prop="gName" align="center" fixed="left"></el-table-column>
                <el-table-column label="企业总库存" prop="gStock" align="center" fixed="left"></el-table-column>
                <el-table-column label="库区" prop="reserveName" align="center">
                    <template slot-scope="scope">
                        <span v-if="scope.row.reserveName =='合计'">{{scope.row.reserveName}}</span>
                        <el-link v-else type="primary" @click="openStock('edit',scope.row)">{{scope.row.reserveName}}</el-link>
                    </template>
                </el-table-column>
                <el-table-column label="库区总库存" prop="gName" align="center"></el-table-column>
                <el-table-column label="库区面积/㎡" prop="topSquare" align="center"></el-table-column>
                <el-table-column label="有效存储总面积/㎡" prop="topStorageSquare" align="center"></el-table-column>
<!--                <el-table-column label="总库容量" prop="topApprovedReserves" align="center"></el-table-column>-->
                <el-table-column label="总核药量" prop="topNuclearDose" align="center"></el-table-column>
                <el-table-column label="库房名称" prop="storehouseName" align="center">
                    <template slot-scope="scope">
                        <span v-if="scope.row.storehouseName == '本库区合计'||scope.row.storehouseName == '合计'">{{scope.row.storehouseName}}</span>
                        <el-link v-else type="primary" @click="openRecord(scope.row)">{{scope.row.storehouseName}}</el-link>
                    </template>
                </el-table-column>
                <el-table-column label="库房面积/㎡" prop="square" align="center"></el-table-column>
                <el-table-column label="有效存储面积/㎡" prop="storageSquare" align="center"></el-table-column>
                <el-table-column label="库容量/箱" prop="approvedReserves" align="center"></el-table-column>
                <el-table-column label="核药量/kg" prop="nuclearDose" align="center"></el-table-column>
                <el-table-column label="当前总库存" prop="totalStock" align="center"></el-table-column>
                <el-table-column label="爆竹类(箱)" prop="firecracker" align="center"></el-table-column>
                <el-table-column label="喷花类(箱)" prop="spray" align="center"></el-table-column>
                <el-table-column label="旋转类(箱)" prop="rotation" align="center"></el-table-column>
                <el-table-column label="吐珠类(箱)" prop="bead" align="center"></el-table-column>
                <el-table-column label="玩具类(箱)" prop="toy" align="center"></el-table-column>
                <el-table-column label="组合烟花类(箱)" prop="combined" align="center"></el-table-column>
                <el-table-column label="是否超量" prop="overShoot" align="center">
                    <template slot-scope="scope">
                        <span>{{scope.row.overShoot ==0?'否':scope.row.overShoot ==1?'是':'--'}}</span>
                    </template>
                </el-table-column>
                <el-table-column label="是否允许盘库" prop="inventoryStatus" align="center">
                    <template slot-scope="scope">
                        <span v-if="scope.row.inventoryStatus == null">--</span>
                        <el-switch :disabled="disable" v-else v-model="scope.row.inventoryStatus" :active-value="1" :inactive-value="0" @change="changeStatus($event,scope.row)"></el-switch>
                    </template>
                </el-table-column>
                <el-table-column label="操作" align="center" width="120" class-name="small-padding fixed-width" fixed="right">
                    <template slot-scope="scope" v-if="scope.row.storehouseName !== '本库区合计' && scope.row.storehouseName !== '合计'">
                        <el-button type="text" @click="showEnterprises(scope.row)">查看详情</el-button>
                        <el-button type="text" @click="delData(scope.row)">删除</el-button>
                    </template>
                </el-table-column>
            </el-table>
            <br>
            <add-stock ref="addStock" @refresh="getList"></add-stock>
            <stock-records ref="stockRecords"></stock-records>
            <enterprise-stock ref="enterStock"></enterprise-stock>
        </div>
    </div>
</template>
<script>
import {computePageCount} from "../../utils";
import {delStore, getReservesForUser, getSupervisionStatistics, changeInventory, getAnalysis} from "../../api/warehouse"
import addStock from "./components/addStock"
import stockRecords from "./components/stockRecords"
import enterpriseStock from "./components/enterpriseStock"
import Cookies from "js-cookie"
import {getCityListData, getProvinceListData} from "../../api/area";
import {MessageBox} from "_element-ui@2.14.1@element-ui";
export default {
    name: "stockAnalyse",
    components: {addStock,stockRecords, enterpriseStock},
    data() {
        return {
            tableKey: '',
            disable: false,
            provinceList: [],
            cityList: [],
            districtList: [],
            Cookies: Cookies,
            listLoading: false,
            stateStockData: [],
            rowIndex: '-1',
            OrderIndexArr: [],
            hoverOrderArr: [],
            listQuery: {
                enterpriseName: '',
            },
        }
    },
    created() {
        const t = this
        t.getList()
        t.getProvince()
        const roles = JSON.parse(Cookies.get('roles'))
        if(roles.find(i=>i.name == '管理员'|| i.name == '监管部门')){
            this.disable = false
        }else{
            this.disable = true
        }
    },
    mounted() {
    },
    watch: {},
    methods: {
        async getList(){
          const res = await getAnalysis(this.listQuery)
            if(res.data.code == 200){
                this.stateStockData=[]
                const tableData = res.data.result.enterprises
                let gData = []
                if(Array.isArray(tableData)){
                    tableData.map(item=>{
                        if(Array.isArray(item.reserves)){
                            item.reserves.map((subRes, subIndex)=>{
                                let content = {}
                                content = subRes
                                content['gId'] = item.enterpriseId
                                content['gStock'] = item.enterpriseStock
                                content['gName'] = item.enterpriseName
                                // 重点!赋值合并的行数数值,只需要取子循环的第一个数赋值待合并的行数即可
                                if(subIndex == 0){
                                    content['gNum'] = item.reserves.length
                                }
                                gData.push(content)
                            })
                        }
                    })
                }
                console.log(gData,'gData')
                if(Array.isArray(gData)){
                    gData.map(item=>{
                        if(Array.isArray(item.storehouse.warehouses) && item.storehouse.whTotal){
                            let obj = {
                                approvedReserves: item.storehouse.whTotal.wtotalApprovedReserves,
                                bead: item.storehouse.whTotal.wtotalBead,
                                combined: item.storehouse.whTotal.wtotalCombined,
                                firecracker: item.storehouse.whTotal.wtotalFirecracker,
                                inventoryStatus: null,
                                nuclearDose: item.storehouse.whTotal.wtotalNuclearDose,
                                overShoot: null,
                                rotation: item.storehouse.whTotal.wtotalRotation,
                                spray: item.storehouse.whTotal.wtotalSpray,
                                square: item.storehouse.whTotal.wtotalSquare,
                                storageSquare: item.storehouse.whTotal.wtotalStorageSquare,
                                storehouseId: null,
                                storehouseName: item.storehouse.whTotal.wname,
                                totalStock: item.storehouse.whTotal.wtotalStock,
                                toy: item.storehouse.whTotal.wtotalToy,
                            }
                            item.storehouse.warehouses.push(obj)
                            item.storehouse.warehouses.map((subRes, subIndex)=>{
                                let content2 = {}
                                content2 = subRes
                                content2['gId'] = item.enterpriseId
                                content2['gStock'] = item.gStock
                                content2['gName'] = item.gName
                                content2['gNum'] = item.gNum || null
                                content2['topId'] = item.reserveId
                                content2['reserveName'] = item.reserveName
                                content2['topSquare'] = item.square
                                content2['topStorageSquare'] = item.storageSquare
                                content2['topApprovedReserves'] = item.approvedReserves
                                content2['topNuclearDose'] = item.nuclearDose
                                // 重点!赋值合并的行数数值,只需要取子循环的第一个数赋值待合并的行数即可
                                if(subIndex == 0){
                                    content2['rowNum'] = item.storehouse.warehouses.length
                                }
                                this.stateStockData.push(content2)
                            })
                        }
                    })
                }
                if(res.data.result.total){
                    const total = res.data.result.total
                    let totalObj = {
                        topId: null,
                        reserveName: total.name,
                        gId: null,
                        gName: total.name,
                        gStock: total.enterpriseTotalStock,
                        storehouseName: total.name,
                        gNum: 1,
                        rowNum: 1,
                        topSquare: total.resTotalSquare,
                        topStorageSquare: total.resTotalStorageSquare,
                        topApprovedReserves: total.resTotalApprovedReserves,
                        topNuclearDose: total.resTotalNuclearDose,
                        firecracker: total.totalFirecracker,
                        rotation: total.totalRotation,
                        spray: total.totalSpray,
                        totalStock: total.totalStock,
                        toy: total.totalToy,
                        bead: total.totalBead,
                        combined: total.totalCombined,
                        approvedReserves: total.whTotalApprovedReserves,
                        square: total.whTotalSquare,
                        storageSquare: total.whTotalStorageSquare,
                        nuclearDose: total.whTotalNuclearDose,
                    }
                    this.stateStockData.push(totalObj)
                }
            }else{
                this.$message({
                    type:'warning',
                    message: res.data.message
                })
            }
        },
        searchData(){
            this.getList()
        },
        reset(){
            this.listQuery={
                enterpriseName: ''
            }
            this.getList()
        },
        showEnterprises(row){
            const t = this
            t.$refs.enterStock.open(row)
        },
        openStock(type,data){
            const t = this
            t.$refs.addStock.open(type,data)
        },
        openRecord(row){
            const t = this
            t.$refs.stockRecords.open(row)
        },
        delData(row){
            const t = this
            MessageBox.confirm('确定删除库房名为:' + row.storehouseName + '的信息', '确定删除', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
            }).then(() => {
                t.deleteStore(row.storehouseId)
            }).catch(() => {
                console.log('已取消删除')
            })
        },
        async deleteStore(id){
          const res = await delStore({id: id})
            if(res.data.code == 200){
                this.$message({
                    type:'success',
                    message: '删除成功'
                })
            }else{
                this.$message({
                    type:'warning',
                    message: res.data.message
                })
            }
        },
        async getProvince(){
            let res = await getProvinceListData()
            if(res.data.code === "200"){
                this.provinceList = res.data.result.provinceList
            }
        },
        changeStatus(val,row){
            MessageBox.confirm('确定删除库房名为:' + row.storehouseName + '的盘库许可状态', '确定修改', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
            }).then(async () => {
                const res = await changeInventory({inventoryStatus: val,id: row.storehouseId})
                if(res.data.code == 200){
                    this.$message({
                        type:'success',
                        message: '修改成功'
                    })
                }else{
                    this.$message({
                        type:'warning',
                        message: res.data.message
                    })
                }
            }).catch(() => {
                this.getList()
            })
        },
        async changeArea(value) {
            if (value === 'province') {
                this.listQuery.city = ''
                this.listQuery.area = ''
                let res = await getCityListData({type:2, parenttype:1, parentname:this.listQuery.province})
                if (res.data.code === "200") {
                    this.cityList = res.data.result
                }
            } else if (value === 'city') {
                this.listQuery.area = ''
                let res = await getCityListData({type:3, parenttype:2, parentname:this.listQuery.city})
                if (res.data.code === "200") {
                    this.districtList = res.data.result
                }
            }
        },
        objectSpanMethod({ row, column, rowIndex, columnIndex }) {
            // columnIndex 代表列数,从0开始计数,我们要合并的字段属于第一列,取0
            if(columnIndex ==0 || columnIndex ==1){
                return {
                    rowspan: row.gNum * row.rowNum, // 待合并行数 -- 合并的行数长度就等于之前赋值的子数据的长度;未赋值的即表示0,不显示
                    colspan: row.gNum>0?1:0  // 待合并列数 -- 合并的列数自身占一列,被合并的要返回0,表示不显示
                };
            }
            if(columnIndex >1 && columnIndex < 7){
                return {
                    rowspan: row.rowNum, // 待合并行数 -- 合并的行数长度就等于之前赋值的子数据的长度;未赋值的即表示0,不显示
                    colspan: row.rowNum>0?1:0  // 待合并列数 -- 合并的列数自身占一列,被合并的要返回0,表示不显示
                };
            }
        },
        tableRowClassName({row,rowIndex}) {
            let arr = this.hoverOrderArr
            for (let i = 0; i < arr.length; i++) {
                if (rowIndex == arr[i]) {
                    return 'hovered-row'
                }
            }
        },
        cellMouseEnter(row, column, cell, event) {
            this.rowIndex = row.rowIndex;
            this.hoverOrderArr = [];
            this.OrderIndexArr.forEach(element => {
                if (element.indexOf(this.rowIndex) >= 0) {
                    this.hoverOrderArr = element
                }
            })
        },
        cellMouseLeave(row, column, cell, event) {
            this.rowIndex = '-1'
            this.hoverOrderArr = [];
        },
    },
}
</script>
<style>
.el-table .hovered-row {
    background: #f5f7fa;
}
</style>
<style scoped>
.basic_search {
    display: inline-block;
}
/deep/.el-table .el-table__body-wrapper table tr:nth-child(2n) td{
    background: #fff !important;
}
</style>
src/views/warehouse/stockManage.vue
对比新文件
@@ -0,0 +1,218 @@
<template>
    <div class="app-container">
        <div class="filter-container">
            <div style="display: block;">
                <div class="basic_search" style="margin-right: 10px;padding-top: 10px">
                    <el-button style="margin-left: 10px;" type="primary" @click="openStock('add',{})">创建库区</el-button>
                </div>
            </div>
        </div>
        <div class="table_content">
            <el-table
                v-loading="listLoading"
                :data="stateStockData"
                :span-method="objectSpanMethod"
                :cell-class-name="tableRowClassName" @cell-mouse-leave="cellMouseLeave"  @cell-mouse-enter="cellMouseEnter"
                border
                :stripe="false"
                style="width: 100%;"
            >
                <el-table-column label="库区名称" prop="reserveName" align="center" fixed="left">
                    <template slot-scope="scope">
                        <el-link type="primary" @click="openStock('edit',scope.row)">{{scope.row.reserveName}}</el-link>
                    </template>
                </el-table-column>
                <el-table-column label="区域" align="center" fixed="left">
                    <template slot-scope="scope">
                        {{ scope.row.province }}/{{scope.row.city}}/{{scope.row.area}}
                    </template>
                </el-table-column>
                <el-table-column label="所属企业" prop="enterpriseName" align="center"></el-table-column>
                <el-table-column label="地址" prop="reserveAddress" align="center"></el-table-column>
                <el-table-column label="库区面积/㎡" prop="topSquare" align="center"></el-table-column>
                <el-table-column label="有效存储总面积/㎡" prop="topEffectiveStorageSquare" align="center"></el-table-column>
                <el-table-column label="核药量/kg" prop="topNuclearDose" align="center"></el-table-column>
                <el-table-column label="库房名称" prop="storehouseName" align="center">
                    <template slot-scope="scope">
                        <el-link type="primary" @click="openRecord(scope.row)">{{scope.row.storehouseName}}</el-link>
                    </template>
                </el-table-column>
                <el-table-column label="库房面积/㎡" prop="square" align="center"></el-table-column>
                <el-table-column label="有效存储面积/㎡" prop="effectiveStorageSquare" align="center"></el-table-column>
                <el-table-column label="等级" prop="storehouseLevel" align="center"></el-table-column>
                <el-table-column label="库容量/箱" prop="approvedReserves" align="center"></el-table-column>
                <el-table-column label="核药量/kg" prop="nuclearDose" align="center"></el-table-column>
                <el-table-column label="当前总库存" prop="totalInventory" align="center"></el-table-column>
                <el-table-column label="本公司库存" prop="inventoryOfTheCompany" align="center"></el-table-column>
                <el-table-column label="爆竹类(箱)" prop="firecracker" align="center"></el-table-column>
                <el-table-column label="喷花类(箱)" prop="spray" align="center"></el-table-column>
                <el-table-column label="旋转类(箱)" prop="rotation" align="center"></el-table-column>
                <el-table-column label="吐珠类(箱)" prop="bead" align="center"></el-table-column>
                <el-table-column label="玩具类(箱)" prop="toy" align="center"></el-table-column>
                <el-table-column label="组合烟花类(箱)" prop="combined" align="center"></el-table-column>
                <el-table-column label="操作" align="center" width="120" class-name="small-padding fixed-width" fixed="right">
                    <template slot-scope="scope">
                        <el-button type="text" @click="showEnterprises(scope.row)">存货企业</el-button>
                        <el-button type="text" @click="deliverUsage(scope.row)">分配使用权</el-button>
                    </template>
                </el-table-column>
                <el-table-column label="是否允许盘库" align="center" width="120" class-name="small-padding fixed-width" fixed="right">
                    <template slot-scope="scope">
                        <span type="text" v-if="scope.row.inventoryStatus == 1">否</span>
                        <el-button v-if="scope.row.inventoryStatus == 0" type="text" @click="stockEdit(scope.row)">允许盘库</el-button>
                    </template>
                </el-table-column>
            </el-table>
            <br>
            <add-stock ref="addStock" @refresh="getList"></add-stock>
            <deliver-usage ref="deliverUsage" @refresh="getList"></deliver-usage>
            <stock-records ref="stockRecords"></stock-records>
            <edit-stock ref="editStock"></edit-stock>
            <enterprise-stock ref="enterStock"></enterprise-stock>
        </div>
    </div>
</template>
<script>
import {computePageCount} from "../../utils";
import {getReservesForUser, getStorehouseDataByUser} from "../../api/warehouse"
import addStock from "./components/addStock"
import deliverUsage from "./components/deliverUsage"
import stockRecords from "./components/stockRecords"
import editStock from "./components/editStock"
import enterpriseStock from "./components/enterpriseStock"
import Cookies from "js-cookie"
export default {
    name: "stockManage",
    components: {enterpriseStock,addStock,deliverUsage,stockRecords,editStock},
    data() {
        return {
            tableKey: '',
            provinceList: [],
            cityList: [],
            districtList: [],
            Cookies: Cookies,
            listLoading: false,
            stateStockData: [],
            rowIndex: '-1',
            OrderIndexArr: [],
            hoverOrderArr: []
        }
    },
    created() {
        const t = this
        t.getList()
    },
    mounted() {
    },
    watch: {},
    methods: {
        async getList(){
          const res = await getStorehouseDataByUser()
            if(res.data.code == 200){
                this.stateStockData=[]
                if(res.data.result.reserveData && Array.isArray(res.data.result.reserveData)){
                    const tableData = res.data.result.reserveData
                    if(tableData.length>0){
                        tableData.map(item=>{
                            if(Array.isArray(item.storehouseInfos)){
                                item.storehouseInfos.map((subRes, subIndex)=>{
                                    let content = {}
                                    content = subRes
                                    content['topId'] = item.id
                                    content['reserveName'] = item.reserveName
                                    content['enterpriseName'] = item.enterpriseName
                                    content['province'] = item.province
                                    content['city'] = item.city
                                    content['area'] = item.area
                                    content['reserveAddress'] = item.reserveAddress
                                    content['topSquare'] = item.square
                                    content['topEffectiveStorageSquare'] = item.effectiveStorageSquare
                                    content['topNuclearDose'] = item.nuclearDose
                                    // 重点!赋值合并的行数数值,只需要取子循环的第一个数赋值待合并的行数即可
                                    if(subIndex == 0){
                                        content['rowNum'] = item.storehouseInfos.length
                                    }
                                    this.stateStockData.push(content)
                                })
                            }
                        })
                    }
                }
            }else{
                this.$message({
                    type:'warning',
                    message: res.data.message
                })
            }
        },
        openStock(type,data){
            const t = this
            t.$refs.addStock.open(type,data)
        },
        openRecord(row){
            const t = this
            t.$refs.stockRecords.open()
        },
        showEnterprises(row){
            const t = this
            t.$refs.enterStock.open(row)
        },
        deliverUsage(row){
            const t = this
            t.$refs.deliverUsage.open(row)
        },
        stockEdit(row){
            const t = this
            t.$refs.editStock.open(row)
        },
        objectSpanMethod({ row, column, rowIndex, columnIndex }) {
            // columnIndex 代表列数,从0开始计数,我们要合并的字段属于第一列,取0
            if(columnIndex <= 6){
                return {
                    rowspan: row.rowNum, // 待合并行数 -- 合并的行数长度就等于之前赋值的子数据的长度;未赋值的即表示0,不显示
                    colspan: row.rowNum>0?1:0  // 待合并列数 -- 合并的列数自身占一列,被合并的要返回0,表示不显示
                };
            }
        },
        tableRowClassName({row,rowIndex}) {
            let arr = this.hoverOrderArr
            for (let i = 0; i < arr.length; i++) {
                if (rowIndex == arr[i]) {
                    return 'hovered-row'
                }
            }
        },
        cellMouseEnter(row, column, cell, event) {
            this.rowIndex = row.rowIndex;
            this.hoverOrderArr = [];
            this.OrderIndexArr.forEach(element => {
                if (element.indexOf(this.rowIndex) >= 0) {
                    this.hoverOrderArr = element
                }
            })
        },
        cellMouseLeave(row, column, cell, event) {
            this.rowIndex = '-1'
            this.hoverOrderArr = [];
        },
    },
}
</script>
<style>
.el-table .hovered-row {
    background: #f5f7fa;
}
</style>
<style scoped>
.basic_search {
    display: inline-block;
}
/deep/.el-table .el-table__body-wrapper table tr:nth-child(2n) td{
    background: #fff !important;
}
</style>
src/views/warehouse/stockSupervision.vue
对比新文件
@@ -0,0 +1,403 @@
<template>
    <div class="app-container">
        <div class="filter-container">
            <div style="display: block;">
                <div class="basic_search">
                    <span>区域:</span>
                    <el-select v-model="listQuery.province" clearable filterable @change="changeArea('province')">
                        <el-option
                            v-for="item in provinceList"
                            :key="item.id"
                            :label="item.name"
                            :value="item.name"
                        >
                        </el-option>
                    </el-select>
                </div>
                <div class="basic_search">
                    <el-select v-model="listQuery.city" prop="city" clearable filterable @change="changeArea('city')">
                        <el-option
                            v-for="item in cityList"
                            :key="item.id"
                            :label="item.name"
                            :value="item.name"
                        >
                        </el-option>
                    </el-select>
                </div>
                <div class="basic_search">
                    <el-select v-model="listQuery.area" clearable filterable @change="changeArea('area')">
                        <el-option
                            v-for="item in districtList"
                            :key="item.id"
                            :label="item.name"
                            :value="item.name"
                        >
                        </el-option>
                    </el-select>
                </div>
                <div class="basic_search">
                    <span>企业名称:</span>
                    <el-input filterable clearable v-model="listQuery.enterpriseName" style="width:200px">
                    </el-input>
                </div>
                <div class="basic_search">
                    <span>库区名称:</span>
                    <el-input filterable clearable v-model="listQuery.reserveName" style="width:200px">
                    </el-input>
                </div>
                <div class="basic_search" style="margin-right: 10px">
                    <el-button style="margin-left: 10px;" type="primary" @click="reset()">重置</el-button>
                    <el-button style="margin-left: 10px;" type="primary" icon="el-icon-search" @click="searchData()">查询</el-button>
                </div>
            </div>
        </div>
        <div class="table_content">
            <el-table
                v-loading="listLoading"
                :data="stateStockData"
                :span-method="objectSpanMethod"
                :cell-class-name="tableRowClassName" @cell-mouse-leave="cellMouseLeave"  @cell-mouse-enter="cellMouseEnter"
                border
                :stripe="false"
                style="width: 100%;"
            >
                <el-table-column label="库区名称" prop="reserveName" align="center" fixed="left">
                    <template slot-scope="scope">
                        <span v-if="scope.row.reserveName =='合计'">{{scope.row.reserveName}}</span>
                        <el-link v-else type="primary" @click="openStock('edit',scope.row)">{{scope.row.reserveName}}</el-link>
                    </template>
                </el-table-column>
                <el-table-column label="所属区域" prop="region" align="center" fixed="left"/>
                <el-table-column label="所属企业" prop="enterpriseName" align="center"></el-table-column>
                <el-table-column label="地址" prop="topAddress" align="center"></el-table-column>
                <el-table-column label="库区面积/㎡" prop="topSquare" align="center"></el-table-column>
                <el-table-column label="有效存储总面积/㎡" prop="topStorageSquare" align="center"></el-table-column>
                <el-table-column label="总库容量" prop="topApprovedReserves" align="center"></el-table-column>
                <el-table-column label="总核药量" prop="topNuclearDose" align="center"></el-table-column>
                <el-table-column label="库房名称" prop="storehouseName" align="center">
                    <template slot-scope="scope">
                        <span v-if="scope.row.storehouseName == '本库区合计'||scope.row.storehouseName == '合计'">{{scope.row.storehouseName}}</span>
                        <el-link v-else type="primary" @click="openRecord(scope.row)">{{scope.row.storehouseName}}</el-link>
                    </template>
                </el-table-column>
                <el-table-column label="库房面积/㎡" prop="square" align="center"></el-table-column>
                <el-table-column label="有效存储面积/㎡" prop="storageSquare" align="center"></el-table-column>
                <el-table-column label="库容量/箱" prop="approvedReserves" align="center"></el-table-column>
                <el-table-column label="核药量/kg" prop="nuclearDose" align="center"></el-table-column>
                <el-table-column label="当前总库存" prop="totalStock" align="center"></el-table-column>
                <el-table-column label="爆竹类(箱)" prop="firecracker" align="center"></el-table-column>
                <el-table-column label="喷花类(箱)" prop="spray" align="center"></el-table-column>
                <el-table-column label="旋转类(箱)" prop="rotation" align="center"></el-table-column>
                <el-table-column label="吐珠类(箱)" prop="bead" align="center"></el-table-column>
                <el-table-column label="玩具类(箱)" prop="toy" align="center"></el-table-column>
                <el-table-column label="组合烟花类(箱)" prop="combined" align="center"></el-table-column>
                <el-table-column label="是否超量" prop="overShoot" align="center">
                    <template slot-scope="scope">
                        <span>{{scope.row.overShoot ==0?'否':scope.row.overShoot ==1?'是':'--'}}</span>
                    </template>
                </el-table-column>
                <el-table-column label="是否允许盘库" prop="inventoryStatus" align="center">
                    <template slot-scope="scope">
                        <span v-if="scope.row.inventoryStatus == null">--</span>
                        <el-switch :disabled="disable" v-else v-model="scope.row.inventoryStatus" :active-value="1" :inactive-value="0" @change="changeStatus($event,scope.row)"></el-switch>
                    </template>
                </el-table-column>
                <el-table-column label="操作" align="center" width="120" class-name="small-padding fixed-width" fixed="right">
                    <template slot-scope="scope" v-if="scope.row.storehouseName !== '本库区合计' && scope.row.storehouseName !== '合计'">
                        <el-button type="text" @click="showEnterprises(scope.row)">查看详情</el-button>
                        <el-button type="text" @click="delData(scope.row)">删除</el-button>
                    </template>
                </el-table-column>
            </el-table>
            <br>
            <add-stock ref="addStock" @refresh="getList"></add-stock>
            <stock-records ref="stockRecords"></stock-records>
            <enterprise-stock ref="enterStock"></enterprise-stock>
        </div>
    </div>
</template>
<script>
import {computePageCount} from "../../utils";
import {delStore, getReservesForUser, getSupervisionStatistics, changeInventory} from "../../api/warehouse"
import addStock from "./components/addStock"
import stockRecords from "./components/stockRecords"
import enterpriseStock from "./components/enterpriseStock"
import Cookies from "js-cookie"
import {getCityListData, getProvinceListData} from "../../api/area";
import {MessageBox} from "_element-ui@2.14.1@element-ui";
export default {
    name: "stockSupervision",
    components: {addStock,stockRecords, enterpriseStock},
    data() {
        return {
            tableKey: '',
            disable: false,
            provinceList: [],
            cityList: [],
            districtList: [],
            Cookies: Cookies,
            listLoading: false,
            stateStockData: [],
            rowIndex: '-1',
            OrderIndexArr: [],
            hoverOrderArr: [],
            listQuery: {
                province: '',
                city: '',
                area: '',
                enterpriseName: '',
                reserveName: '',
            },
        }
    },
    created() {
        const t = this
        t.getList()
        t.getProvince()
        const roles = JSON.parse(Cookies.get('roles'))
        if(roles.find(i=>i.name == '管理员'|| i.name == '监管部门')){
            this.disable = false
        }else{
            this.disable = true
        }
    },
    mounted() {
    },
    watch: {},
    methods: {
        async getList(){
          const res = await getSupervisionStatistics(this.listQuery)
            if(res.data.code == 200){
                this.stateStockData=[]
                const tableData = res.data.result.reserves
                if(Array.isArray(tableData)){
                    tableData.map(item=>{
                        if(Array.isArray(item.storehouse.warehouses) && item.storehouse.whTotal){
                            let obj = {
                                approvedReserves: item.storehouse.whTotal.wtotalApprovedReserves,
                                bead: item.storehouse.whTotal.wtotalBead,
                                combined: item.storehouse.whTotal.wtotalCombined,
                                firecracker: item.storehouse.whTotal.wtotalFirecracker,
                                inventoryStatus: null,
                                nuclearDose: item.storehouse.whTotal.wtotalNuclearDose,
                                overShoot: null,
                                rotation: item.storehouse.whTotal.wtotalRotation,
                                spray: item.storehouse.whTotal.wtotalSpray,
                                square: item.storehouse.whTotal.wtotalSquare,
                                storageSquare: item.storehouse.whTotal.wtotalStorageSquare,
                                storehouseId: null,
                                storehouseName: item.storehouse.whTotal.wname,
                                totalStock: item.storehouse.whTotal.wtotalStock,
                                toy: item.storehouse.whTotal.wtotalToy,
                            }
                            item.storehouse.warehouses.push(obj)
                            item.storehouse.warehouses.map((subRes, subIndex)=>{
                                let content = {}
                                content = subRes
                                content['topId'] = item.reserveId
                                content['reserveName'] = item.reserveName
                                content['enterpriseName'] = item.enteripriseName
                                content['region'] = item.region
                                content['topAddress'] = item.reserveAddress
                                content['topSquare'] = item.square
                                content['topStorageSquare'] = item.storageSquare
                                content['topApprovedReserves'] = item.approvedReserves
                                content['topNuclearDose'] = item.nuclearDose
                                // 重点!赋值合并的行数数值,只需要取子循环的第一个数赋值待合并的行数即可
                                if(subIndex == 0){
                                    content['rowNum'] = item.storehouse.warehouses.length
                                }
                                this.stateStockData.push(content)
                            })
                        }
                    })
                }
                if(res.data.result.total){
                    const total = res.data.result.total
                    let totalObj = {
                        topId: null,
                        reserveName: total.name,
                        region: '--',
                        topAddress: '--',
                        enterpriseName: '--',
                        storehouseName: '合计',
                        rowNum: 1,
                        topSquare: total.resTotalSquare,
                        topStorageSquare: total.resTotalStorageSquare,
                        topApprovedReserves: total.resTotalApprovedReserves,
                        topNuclearDose: total.resTotalNuclearDose,
                        firecracker: total.totalFirecracker,
                        rotation: total.totalRotation,
                        spray: total.totalSpray,
                        totalStock: total.totalStock,
                        toy: total.totalToy,
                        approvedReserves: total.whTotalApprovedReserves,
                        square: total.whTotalSquare,
                        storageSquare: total.whTotalStorageSquare,
                        nuclearDose: total.whTotalNuclearDose,
                        bead: total.totalBead,
                        combined: total.totalCombined
                    }
                    this.stateStockData.push(totalObj)
                }
            }else{
                this.$message({
                    type:'warning',
                    message: res.data.message
                })
            }
        },
        searchData(){
            this.getList()
        },
        reset(){
            this.listQuery={
                province: '',
                city: '',
                area: '',
                enterpriseName: '',
                reserveName: ''
            }
            this.getList()
        },
        showEnterprises(row){
            const t = this
            t.$refs.enterStock.open(row)
        },
        openStock(type,data){
            const t = this
            t.$refs.addStock.open(type,data)
        },
        openRecord(row){
            const t = this
            t.$refs.stockRecords.open(row)
        },
        delData(row){
            const t = this
            MessageBox.confirm('确定删除库房名为:' + row.storehouseName + '的信息', '确定删除', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
            }).then(() => {
                t.deleteStore(row.storehouseId)
            }).catch(() => {
                console.log('已取消删除')
            })
        },
        async deleteStore(id){
          const res = await delStore({id: id})
            if(res.data.code == 200){
                this.$message({
                    type:'success',
                    message: '删除成功'
                })
            }else{
                this.$message({
                    type:'warning',
                    message: res.data.message
                })
            }
        },
        async getProvince(){
            let res = await getProvinceListData()
            if(res.data.code === "200"){
                this.provinceList = res.data.result.provinceList
            }
        },
        changeStatus(val,row){
            MessageBox.confirm('确定删除库房名为:' + row.storehouseName + '的盘库许可状态', '确定修改', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
            }).then(async () => {
                const res = await changeInventory({inventoryStatus: val,id: row.storehouseId})
                if(res.data.code == 200){
                    this.$message({
                        type:'success',
                        message: '修改成功'
                    })
                }else{
                    this.$message({
                        type:'warning',
                        message: res.data.message
                    })
                }
            }).catch(() => {
                this.getList()
            })
        },
        async changeArea(value) {
            if (value === 'province') {
                this.listQuery.city = ''
                this.listQuery.area = ''
                let res = await getCityListData({type:2, parenttype:1, parentname:this.listQuery.province})
                if (res.data.code === "200") {
                    this.cityList = res.data.result
                }
            } else if (value === 'city') {
                this.listQuery.area = ''
                let res = await getCityListData({type:3, parenttype:2, parentname:this.listQuery.city})
                if (res.data.code === "200") {
                    this.districtList = res.data.result
                }
            }
        },
        objectSpanMethod({ row, column, rowIndex, columnIndex }) {
            // columnIndex 代表列数,从0开始计数,我们要合并的字段属于第一列,取0
            if(columnIndex <= 7){
                return {
                    rowspan: row.rowNum, // 待合并行数 -- 合并的行数长度就等于之前赋值的子数据的长度;未赋值的即表示0,不显示
                    colspan: row.rowNum>0?1:0  // 待合并列数 -- 合并的列数自身占一列,被合并的要返回0,表示不显示
                };
            }
        },
        tableRowClassName({row,rowIndex}) {
            let arr = this.hoverOrderArr
            for (let i = 0; i < arr.length; i++) {
                if (rowIndex == arr[i]) {
                    return 'hovered-row'
                }
            }
        },
        cellMouseEnter(row, column, cell, event) {
            this.rowIndex = row.rowIndex;
            this.hoverOrderArr = [];
            this.OrderIndexArr.forEach(element => {
                if (element.indexOf(this.rowIndex) >= 0) {
                    this.hoverOrderArr = element
                }
            })
        },
        cellMouseLeave(row, column, cell, event) {
            this.rowIndex = '-1'
            this.hoverOrderArr = [];
        },
    },
}
</script>
<style>
.el-table .hovered-row {
    background: #f5f7fa;
}
</style>
<style scoped>
.basic_search {
    display: inline-block;
}
/deep/.el-table .el-table__body-wrapper table tr:nth-child(2n) td{
    background: #fff !important;
}
</style>