|
@@ -2,26 +2,17 @@
|
|
|
<div class="app-container">
|
|
|
<div class="operation">
|
|
|
|
|
|
- <div class="search">
|
|
|
+
|
|
|
+ <el-button v-if="isRoleEdit" class="success" icon="el-icon-plus" style="float: left;" @click="handleCreate">设置推料时间</el-button>
|
|
|
+ <el-button v-if="isRoleEdit" class="success" icon="el-icon-plus" style="float: left;" @click="handleCreate">设置允许误差时间</el-button>
|
|
|
+
|
|
|
|
|
|
-
|
|
|
- <el-button v-if="isRoleEdit" icon="el-icon-plus" class="success" style="float: left;margin-right:10px;" @click="handleCreate">设置推料时间</el-button>
|
|
|
- <el-button class="successBorder" @click="handleSearch">查询</el-button>
|
|
|
- </div>
|
|
|
- <el-button v-if="isRoleEdit" class="successBorder" style="float: left;" @click="handleDryMatterRegulation">干物质调节</el-button>
|
|
|
- <el-upload style="float: right;" :headers="headers" :data="uploadData" :action="uploadExcelUrl" :show-file-list="false" :before-upload="beforeImport" :on-success="handleImportSuccess">
|
|
|
- <el-button v-if="isRoleEdit" class="import" icon="el-icon-download" style="float: right;">导入</el-button>
|
|
|
- </el-upload>
|
|
|
- <el-dropdown style="float: right;margin-right: 10px;">
|
|
|
- <el-button class="export" icon="el-icon-upload2">导出</el-button>
|
|
|
- <el-dropdown-menu slot="dropdown">
|
|
|
- <el-dropdown-item @click.native="handleExport(1)">导出模板</el-dropdown-item>
|
|
|
- <el-dropdown-item @click.native="handleExport(2)">导出数据</el-dropdown-item>
|
|
|
- </el-dropdown-menu>
|
|
|
- </el-dropdown>
|
|
|
- <el-button class="export" style="float: right;margin-right: 10px;" @click="handleHistoryRecords">历史记录</el-button>
|
|
|
+ <el-button v-if="isRoleEdit" class="success" icon="el-icon-open" style="float: left;" @click="handleTakeEffect">启用</el-button>
|
|
|
+ <el-button v-if="isRoleEdit" class="danger" icon="el-icon-turn-off" style="float: left;" @click="handleDisable">禁用</el-button>
|
|
|
+ <el-button v-if="isRoleEdit" class="success" style="float: left;" @click="handleCheck">校验</el-button>
|
|
|
+
|
|
|
</div>
|
|
|
- <div class="search" />
|
|
|
+
|
|
|
<div class="table">
|
|
|
<el-table
|
|
|
:key="table.tableKey"
|
|
@@ -49,157 +40,30 @@
|
|
|
<span>{{ scope.row.barname }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column :key="2" label="软件牛头数" min-width="70px" align="center">
|
|
|
+ <el-table-column :key="2" label="推料车名称" min-width="70px" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
<span>{{ scope.row.softccount }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column :key="3" label="实际牛头数" min-width="90px" align="center">
|
|
|
+ <el-table-column :key="3" label="推料车编号" min-width="90px" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
<span v-if="scope.row.NoEdit">{{ scope.row.ccount }}</span>
|
|
|
<el-input v-if="scope.row.Edit" v-model="scope.row.ccount" step="0.01" type="number" style="width:95%;padding:10px 0;" @blur="blurCcount(scope.row)" />
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column :key="4" label="系数(%)" min-width="85px" align="center">
|
|
|
+ <el-table-column :key="4" label="推料时间(每天)" min-width="85px" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
<span v-if="scope.row.NoEdit">{{ scope.row.ratio }}</span>
|
|
|
<el-input v-if="scope.row.Edit" v-model="scope.row.ratio" step="0.01" type="number" style="width:95%;padding:10px 0;" @blur="blurRatio(scope.row)" />
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column :key="5" label="系数头数" min-width="85px" align="center">
|
|
|
+ <el-table-column :key="5" label="允许误差时间(分钟)" min-width="85px" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
<span v-if="scope.row.NoEdit">{{ scope.row.ccountratio }}</span>
|
|
|
<el-input v-if="scope.row.Edit" v-model="scope.row.ccountratio" type="number" style="width:95%;padding:10px 0;" @blur="blurCcountratio(scope.row)" />
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column :key="6" label="配方模板" min-width="130px" align="center">
|
|
|
- <template slot-scope="scope">
|
|
|
- <span v-if="scope.row.NoEdit">{{ scope.row.ftname }}</span>
|
|
|
- <el-select v-if="scope.row.Edit" v-model="scope.row.ftid" filterable placeholder="配方模板" class="filter-item" style="width:99%;" @change="(value)=> {changeRecipeTemplate(value, scope.row)}">
|
|
|
- <el-option v-for="item in recipeTemplateList" :key="item.id" :label="item.tname" :value="item.id" />
|
|
|
- </el-select>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column v-if="table.isPtsfname" :key="7" label="补料配方" min-width="130px" align="center">
|
|
|
- <template slot-scope="scope">
|
|
|
- <span v-if="scope.row.NoEdit">{{ scope.row.ptsfname }}</span>
|
|
|
- <el-select v-if="scope.row.Edit" v-model="scope.row.ptsfid" clearable filterable placeholder="补料配方" class="filter-item" style="width:95%;padding:10px 0;" @change="(value)=> {changeFeedingFormula(value, scope.row)}">
|
|
|
- <el-option v-for="item in feedingFormulaList" :key="item.id" :label="item.tname" :value="item.id" />
|
|
|
- </el-select>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column v-if="table.isRW1" :key="8" label="第一班比例(%)" min-width="80px" align="center">
|
|
|
- <template slot-scope="scope">
|
|
|
- <span v-if="scope.row.NoEdit">{{ scope.row.r1 }}</span>
|
|
|
- <el-input v-if="scope.row.Edit" v-model="scope.row.r1" :disabled="scope.row.isOneWeight" step="0.01" type="number" style="width:95%;padding:10px 0;" @blur="blurR(scope.row)" />
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column v-if="table.isRW1" :key="9" label="第一班重量" min-width="120px" align="center" :render-header="renderHeader">
|
|
|
- <template slot-scope="scope">
|
|
|
- <span v-if="scope.row.NoEdit">{{ scope.row.w1 }}</span>
|
|
|
- <el-input v-if="scope.row.Edit" v-model="scope.row.w1" :disabled="scope.row.isOneWeight" step="0.01" type="number" style="width:95%;padding:10px 0;" @blur="blurW(scope.row)" @focus="focusW(scope.row)" />
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column v-if="table.isRW1 && table.isPtsfname" :key="10" label="第一班补料重量" min-width="120px" align="center">
|
|
|
- <template slot-scope="scope">
|
|
|
- <span v-if="scope.row.NoEdit">{{ scope.row.bw1 }}</span>
|
|
|
- <el-input v-if="scope.row.Edit" v-model="scope.row.bw1" :disabled="scope.row.ptsfid == '-1' || scope.row.ptsfid == ''" step="0.01" type="number" style="width:95%;padding:10px 0;" @blur="blurBw(scope.row)" @focus="focusBw(scope.row)" />
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column v-if="table.isRW2" :key="11" label="第二班比例(%)" min-width="80px" align="center">
|
|
|
- <template slot-scope="scope">
|
|
|
- <span v-if="scope.row.NoEdit">{{ scope.row.r2 }}</span>
|
|
|
- <el-input v-if="scope.row.Edit" v-model="scope.row.r2" step="0.01" type="number" :disabled="scope.row.isTwoWeight" style="width:95%;padding:10px 0;" @blur="blurR(scope.row)" />
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column v-if="table.isRW2" :key="12" label="第二班重量" min-width="120px" align="center" :render-header="renderHeader">
|
|
|
- <template slot-scope="scope">
|
|
|
- <span v-if="scope.row.NoEdit">{{ scope.row.w2 }}</span>
|
|
|
- <el-input v-if="scope.row.Edit" v-model="scope.row.w2" :disabled="scope.row.isTwoWeight" step="0.01" type="number" style="width:95%;padding:10px 0;" @blur="blurW2(scope.row)" @focus="focusW2(scope.row)" />
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column v-if="table.isRW2 && table.isPtsfname" :key="13" label="第二班补料重量" min-width="120px" align="center">
|
|
|
- <template slot-scope="scope">
|
|
|
- <span v-if="scope.row.NoEdit">{{ scope.row.bw2 }}</span>
|
|
|
- <el-input v-if="scope.row.Edit" v-model="scope.row.bw2" :disabled="scope.row.ptsfid == '-1' || scope.row.ptsfid == ''" step="0.01" type="number" style="width:95%;padding:10px 0;" @blur="blurBw(scope.row)" @focus="focusBw(scope.row)" />
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column v-if="table.isRW3" :key="14" label="第三班比例(%)" min-width="80px" align="center">
|
|
|
- <template slot-scope="scope">
|
|
|
- <span v-if="scope.row.NoEdit">{{ scope.row.r3 }}</span>
|
|
|
- <el-input v-if="scope.row.Edit" v-model="scope.row.r3" step="0.01" type="number" :disabled="scope.row.isThreeWeight" style="width:95%;padding:10px 0;" @blur="blurR(scope.row)" />
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column v-if="table.isRW3" :key="15" label="第三班重量" min-width="120px" align="center" :render-header="renderHeader">
|
|
|
- <template slot-scope="scope">
|
|
|
- <span v-if="scope.row.NoEdit">{{ scope.row.w3 }}</span>
|
|
|
- <el-input v-if="scope.row.Edit" v-model="scope.row.w3" :disabled="scope.row.isThreeWeight" step="0.01" type="number" style="width:95%;padding:10px 0;" @blur="blurW3(scope.row)" @focus="focusW3(scope.row)" />
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column v-if="table.isRW3 && table.isPtsfname" :key="16" label="第三班补料重量" min-width="120px" align="center">
|
|
|
- <template slot-scope="scope">
|
|
|
- <span v-if="scope.row.NoEdit">{{ scope.row.bw3 }}</span>
|
|
|
- <el-input v-if="scope.row.Edit" v-model="scope.row.bw3" :disabled="scope.row.ptsfid == '-1' || scope.row.ptsfid == ''" step="0.01" type="number" style="width:95%;padding:10px 0;" @blur="blurBw(scope.row)" @focus="focusBw(scope.row)" />
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column v-if="table.isRW4" :key="17" label="第四班比例(%)" min-width="80px" align="center">
|
|
|
- <template slot-scope="scope">
|
|
|
- <span v-if="scope.row.NoEdit">{{ scope.row.r4 }}</span>
|
|
|
- <el-input v-if="scope.row.Edit" v-model="scope.row.r4" step="0.01" type="number" :disabled="scope.row.isFourWeight" style="width:95%;padding:10px 0;" @blur="blurR(scope.row)" />
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column v-if="table.isRW4" :key="18" label="第四班重量" min-width="120px" align="center" :render-header="renderHeader">
|
|
|
- <template slot-scope="scope">
|
|
|
- <span v-if="scope.row.NoEdit">{{ scope.row.w4 }}</span>
|
|
|
- <el-input v-if="scope.row.Edit" v-model="scope.row.w4" :disabled="scope.row.isFourWeight" step="0.01" type="number" style="width:95%;padding:10px 0;" @blur="blurW4(scope.row)" @focus="focusW4(scope.row)" />
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column v-if="table.isRW4 && table.isPtsfname" :key="19" label="第四班补料重量" min-width="120px" align="center">
|
|
|
- <template slot-scope="scope">
|
|
|
- <span v-if="scope.row.NoEdit">{{ scope.row.bw4 }}</span>
|
|
|
- <el-input v-if="scope.row.Edit" v-model="scope.row.bw4" :disabled="scope.row.ptsfid == '-1' || scope.row.ptsfid == ''" step="0.01" type="number" style="width:95%;padding:10px 0;" @blur="blurBw(scope.row)" @focus="focusBw(scope.row)" />
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column :key="20" label="饲喂总比例(%)" min-width="80px" align="center">
|
|
|
- <template slot-scope="scope">
|
|
|
- <span>{{ scope.row.sumr }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column :key="21" label="饲喂投喂量" min-width="80px" align="center">
|
|
|
- <template slot-scope="scope">
|
|
|
- <span>{{ scope.row.todayweight }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column :key="22" label="饲喂配方重量" min-width="70px" align="center">
|
|
|
- <template slot-scope="scope">
|
|
|
- <span>{{ scope.row.ftweight }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column v-if="table.isPtsfname" :key="23" label="补料配方重量" min-width="100px" align="center">
|
|
|
- <template slot-scope="scope">
|
|
|
- <span>{{ scope.row.supplyweight }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <!-- <el-table-column :key="22" label="投喂量" min-width="80px" align="center">
|
|
|
- <template slot-scope="scope">
|
|
|
- <span>{{ scope.row.feedweight }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column> -->
|
|
|
- <el-table-column v-if="table.isPtsfname" :key="24" label="补料投喂量" min-width="70px" align="center">
|
|
|
- <template slot-scope="scope">
|
|
|
- <span>{{ scope.row.todaysupplement }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column :key="25" label="日投喂量" min-width="70px" align="center">
|
|
|
- <template slot-scope="scope">
|
|
|
- <span>{{ scope.row.todayfeed }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column :key="26" label="配方干物质" min-width="70px" align="center">
|
|
|
- <template slot-scope="scope">
|
|
|
- <span>{{ scope.row.dryweight }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
+
|
|
|
<el-table-column label="操作" align="center" width="80" class-name="small-padding fixed-width" fixed="right">
|
|
|
<template slot-scope="{row}">
|
|
|
<el-button v-if="row.isUpdate && isRoleEdit" class="miniSuccess" icon="el-icon-edit-outline" @click="handleUpdate(row)" />
|
|
@@ -1051,31 +915,8 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
- // 设置请求头
|
|
|
- headers() {
|
|
|
- return {
|
|
|
- token: getToken()
|
|
|
- }
|
|
|
- },
|
|
|
- uploadData() {
|
|
|
- return {
|
|
|
- name: 'checkbarname,checkftsw,checkftbl,updateBigFPUpload,updateBigFPfeedweightUpload,updateBigFPDetailUpload,updateBigFPDetailUploadV1,updateBigFPDetailUploadV2,updateBigFPDetailUploadV3',
|
|
|
- importParams: '栏舍名称,实际牛头数,系数(%),配方模板,补料配方,第一班比例(%),第二班比例(%),第三班比例(%)',
|
|
|
- sheetname: 'Sheet1',
|
|
|
- // 登录牧场
|
|
|
- pastureid: Cookies.get('pastureid'),
|
|
|
- // 日期参数
|
|
|
- dateParams: '',
|
|
|
- // 必填参数
|
|
|
- requiredParams: '栏舍名称,实际牛头数,系数(%),配方模板,',
|
|
|
- // 为数值的参数
|
|
|
- numParams: '实际牛头数,系数(%),第一班比例(%),第二班比例(%),第三班比例(%),,第四班比例(%)'
|
|
|
- }
|
|
|
- },
|
|
|
- // 设置上传地址
|
|
|
- uploadExcelUrl() {
|
|
|
- return process.env.VUE_APP_BASE_API + 'authdata/ImportExcel'
|
|
|
- }
|
|
|
+
|
|
|
+
|
|
|
},
|
|
|
created() {
|
|
|
this.getButtons()
|
|
@@ -1439,73 +1280,7 @@ export default {
|
|
|
this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
|
|
|
row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
|
|
|
},
|
|
|
- // 补料配方
|
|
|
- changeFeedingFormula(item, row) {
|
|
|
- console.log(item, '=========')
|
|
|
- if (item == '') {
|
|
|
- row.bw1 = 0
|
|
|
- row.bw2 = 0
|
|
|
- row.bw3 = 0
|
|
|
- row.bw4 = 0
|
|
|
- }
|
|
|
- // 补料重量supplyweight
|
|
|
- // 配方重量ftweight
|
|
|
- // 系数头数ccountratio
|
|
|
- // 投喂量feedweight
|
|
|
- // 实际牛头数ccount
|
|
|
- // 投喂量 = 配方重量 + 补料重量
|
|
|
- row.myccname = this.feedingFormulaList.find(obj => obj.id == item).ccname
|
|
|
- if (row.bigcowclass !== row.myccname) {
|
|
|
- this.$message({ type: 'warning', message: '所选补料配方与栏舍对应牲畜类别不一致', duration: 2000 })
|
|
|
- }
|
|
|
- if (item !== '') {
|
|
|
- console.log(456)
|
|
|
- row.ptsfname = this.feedingFormulaList.find(obj => obj.id == item).tname
|
|
|
- row.BLweight = this.feedingFormulaList.find(obj => obj.id == item).Sfweight
|
|
|
- row.BLSfweightLock = this.feedingFormulaList.find(obj => obj.id == item).SfweightLock
|
|
|
- } else {
|
|
|
- row.ptsfname = ''
|
|
|
- row.BLweight = 0
|
|
|
- row.BLSfweightLock = 0
|
|
|
- }
|
|
|
- // 配方重量 = 系数头数 * Sfweight
|
|
|
- // if (row.ccountratio !== '' && row.ftweight !== '') {
|
|
|
- // row.ftweight = parseFloat(row.Sfweight) * parseFloat(row.ccountratio)
|
|
|
- // }
|
|
|
-
|
|
|
- // 补料重量 = 系数头数 * BLweight
|
|
|
- // console.log(row.ccountratio)
|
|
|
- // console.log(row.ccount)
|
|
|
- // console.log(row.BLweight)
|
|
|
- // console.log(row.BLSfweightLock)
|
|
|
- if (row.ccountratio !== '' && row.ccount !== '' && row.ccount.BLweight !== '' && row.BLSfweightLock !== '') {
|
|
|
- this.$set(row, 'supplyweight', formatNum(parseFloat(row.BLweight) * parseFloat(row.ccountratio) + parseFloat(row.BLSfweightLock) * parseFloat(row.ccount), parseInt(Cookies.get('decimal'))))
|
|
|
- } else {
|
|
|
- row.supplyweight = ''
|
|
|
- }
|
|
|
-
|
|
|
- if (this.table.isPtsfname == false) {
|
|
|
- row.feedweight = parseFloat(row.ftweight)
|
|
|
- } else {
|
|
|
- if (row.supplyweight !== '' && row.ftweight !== '') {
|
|
|
- row.feedweight = formatNum(parseFloat(row.supplyweight) + parseFloat(row.ftweight), parseInt(Cookies.get('decimal')))
|
|
|
- } else if (row.supplyweight == '' && row.ftweight !== '') {
|
|
|
- row.feedweight = formatNum(parseFloat(row.ftweight), parseInt(Cookies.get('decimal')))
|
|
|
- } else if (row.supplyweight !== '' && row.ftweight == '') {
|
|
|
- row.feedweight = formatNum(parseFloat(row.supplyweight), parseInt(Cookies.get('decimal')))
|
|
|
- }
|
|
|
- }
|
|
|
- if (row.r1 !== '') { this.$set(row, 'w1', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r1) / 100), parseInt(Cookies.get('decimal')))) }
|
|
|
- if (row.r2 !== '') { this.$set(row, 'w2', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r2) / 100), parseInt(Cookies.get('decimal')))) }
|
|
|
- if (row.r3 !== '') { this.$set(row, 'w3', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r3) / 100), parseInt(Cookies.get('decimal')))) }
|
|
|
- if (row.r4 !== '') { this.$set(row, 'w4', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r4) / 100), parseInt(Cookies.get('decimal')))) }
|
|
|
- if (row.w1 == '') { row.w1 = 0 }
|
|
|
- if (row.w2 == '') { row.w2 = 0 }
|
|
|
- if (row.w3 == '') { row.w3 = 0 }
|
|
|
- if (row.w4 == '') { row.w4 = 0 }
|
|
|
- this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4))
|
|
|
- row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
|
|
|
- },
|
|
|
+
|
|
|
// 实际牛头数失去焦点计算
|
|
|
// ccount实际牛头数
|
|
|
// ratio系数
|
|
@@ -4988,26 +4763,8 @@ export default {
|
|
|
}, 100)
|
|
|
})
|
|
|
},
|
|
|
- // 历史记录
|
|
|
- handleHistoryRecords() {
|
|
|
- console.log('点击了历史记录')
|
|
|
- this.dialogFull = false
|
|
|
- this.history.dialogStatus = 'history'
|
|
|
- this.history.dialogFormVisible = true
|
|
|
- this.getDateList()
|
|
|
- },
|
|
|
- // 历史时间
|
|
|
- getDateList() {
|
|
|
- GetDataByName(this.history.getdataDateParm).then(response => {
|
|
|
- console.log('table数据', response.data.list)
|
|
|
- if (response.data.list !== null) {
|
|
|
- this.history.getdataListParm.parammaps.date = response.data.list[0].maxdate
|
|
|
- this.getHistoryIsDisplay()
|
|
|
- } else {
|
|
|
- this.history.getdataListParm.parammaps.date = ''
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
+
|
|
|
+
|
|
|
getHistoryIsDisplay() {
|
|
|
GetDataByName(this.table.getdataListParm2).then(response => {
|
|
|
console.log(response.data.list[0].inforvalue)
|
|
@@ -5144,157 +4901,8 @@ export default {
|
|
|
this.$message({ type: 'info', message: '已取消应用' })
|
|
|
})
|
|
|
},
|
|
|
- // 导出
|
|
|
- handleExport(item) {
|
|
|
- if (item == 1) {
|
|
|
- console.log('点击了导出模板')
|
|
|
- this.download.getdataListParm.parammaps = this.table.getdataListParm.parammaps
|
|
|
- GetDataByName(this.download.getdataListParm).then(response => {
|
|
|
- if (response.data.list !== null) {
|
|
|
- this.download.list = response.data.list
|
|
|
- } else {
|
|
|
- this.download.list = []
|
|
|
- }
|
|
|
- var downloadList = [
|
|
|
- { 'obj1': '1、文件类型为xlsx类型,对应表格文件名格式为:文件名称.xlsx;' },
|
|
|
- { 'obj1': '2、底部工作表名称不可更改,默认为:Sheet1;' },
|
|
|
- { 'obj1': '3、栏舍名称,实际牛头数,系数(%),系数头数,配方模板,补料配方字体为必填;' },
|
|
|
- { 'obj1': '4、第一列栏舍名称默认为系统中栏舍,不可修改;' },
|
|
|
- { 'obj1': '5、实际牛头数为正整数,系数为正数,至多保留俩位小数;' },
|
|
|
- { 'obj1': '6、配方模板名称必须与系统中配方计划—配方模板中的饲喂配方匹配;若补料配方开启,需与配方模板中的补料配方匹配;' },
|
|
|
- { 'obj1': '7、数据最多可导入200条,超过200条请分多个文件导入。' }
|
|
|
- ]
|
|
|
- var excelDatas = [
|
|
|
- {
|
|
|
- tHeader: ['栏舍名称', '实际牛头数', '系数(%)', '配方模板', '补料配方', '第一班比例(%)', '第二班比例(%)', '第三班比例(%)', '第四班比例(%)'],
|
|
|
- filterVal: ['barname', '', '', '', '', '', '', '', ''],
|
|
|
- tableDatas: this.download.list,
|
|
|
- sheetName: 'Sheet1'
|
|
|
- }, {
|
|
|
- tHeader: ['填写规范:'],
|
|
|
- filterVal: ['obj1'],
|
|
|
- tableDatas: downloadList,
|
|
|
- sheetName: 'Sheet2'
|
|
|
- }
|
|
|
- ]
|
|
|
- json2excel(excelDatas, '栏舍配方导入模板', true, 'xlsx')
|
|
|
- })
|
|
|
- } else {
|
|
|
- console.log('点击了导出数据')
|
|
|
- this.download.getdataListParm.parammaps = this.table.getdataListParm.parammaps
|
|
|
- GetDataByName(this.download.getdataListParm).then(response => {
|
|
|
- if (response.data.list !== null) {
|
|
|
- for (let i = 0; i < response.data.list.length; i++) {
|
|
|
- if (response.data.list[i].ftid !== undefined && response.data.list[i].ftid !== '') {
|
|
|
- if (this.recipeTemplateList.find(obj => obj.id == response.data.list[i].ftid) !== undefined) {
|
|
|
- this.$set(response.data.list[i], 'dryweight', this.recipeTemplateList.find(obj => obj.id == response.data.list[i].ftid).dryweight) // 编辑保存
|
|
|
- } else {
|
|
|
- this.$set(response.data.list[i], 'dryweight', '')
|
|
|
- }
|
|
|
- }
|
|
|
- if (response.data.list[i].timesopt !== undefined) {
|
|
|
- var timesoptArr = response.data.list[i].timesopt.split(',')
|
|
|
- for (let j = 0; j < timesoptArr.length; j++) {
|
|
|
- response.data.list[i]['r' + timesoptArr[j].split(':')[0]] = timesoptArr[j].split(':')[1]
|
|
|
- response.data.list[i]['w' + timesoptArr[j].split(':')[0]] = timesoptArr[j].split(':')[2]
|
|
|
- }
|
|
|
- }
|
|
|
- if (response.data.list[i].r1 == '' || response.data.list[i].r1 == undefined) {
|
|
|
- response.data.list[i].r1 = 0
|
|
|
- response.data.list[i].w1 = 0
|
|
|
- }
|
|
|
- if (response.data.list[i].r2 == '' || response.data.list[i].r2 == undefined) {
|
|
|
- response.data.list[i].r2 = 0
|
|
|
- response.data.list[i].w2 = 0
|
|
|
- }
|
|
|
- if (response.data.list[i].r3 == '' || response.data.list[i].r3 == undefined) {
|
|
|
- response.data.list[i].r3 = 0
|
|
|
- response.data.list[i].w3 = 0
|
|
|
- }
|
|
|
- if (response.data.list[i].r4 == '' || response.data.list[i].r4 == undefined) {
|
|
|
- response.data.list[i].r4 = 0
|
|
|
- response.data.list[i].w4 = 0
|
|
|
- }
|
|
|
- this.$set(response.data.list[i], 'sumr', parseFloat(response.data.list[i].r1) + parseFloat(response.data.list[i].r2) + parseFloat(response.data.list[i].r3) + parseFloat(response.data.list[i].r4))
|
|
|
- response.data.list[i].sumr = formatNum(response.data.list[i].sumr, parseInt(Cookies.get('decimal')))
|
|
|
- this.$set(response.data.list[i], 'dailyWeight', parseFloat(response.data.list[i].w1) + parseFloat(response.data.list[i].w2) + parseFloat(response.data.list[i].w3) + parseFloat(response.data.list[i].w4))
|
|
|
- response.data.list[i].dailyWeight = formatNum(response.data.list[i].dailyWeight, parseInt(Cookies.get('decimal')))
|
|
|
- }
|
|
|
- this.download.list = response.data.list
|
|
|
- } else {
|
|
|
- this.download.list = []
|
|
|
- }
|
|
|
- if (this.table.isRW1 == true && this.table.isRW2 == false && this.table.isRW3 == false && this.table.isRW4 == false) {
|
|
|
- var excelDatas = [
|
|
|
- {
|
|
|
- tHeader: ['栏舍名称', '软件牛头数', '实际牛头数', '系数(%)', '系数头数', '配方模板', '补料配方', '第一班比例(%)', '第一班重量', '总比例', '日投喂量', '配方重量', '补料重量', '配方干物质'],
|
|
|
- filterVal: ['barname', 'softccount', 'ccount', 'ratio', 'ccountratio', 'ftname', 'ptsfname', 'r1', 'w1', 'sumr', 'dailyWeight', 'ftweight', 'supplyweight', 'dryweight'],
|
|
|
- tableDatas: this.download.list,
|
|
|
- sheetName: 'Sheet1'
|
|
|
- }
|
|
|
- ]
|
|
|
- } else if (this.table.isRW1 == true && this.table.isRW2 == true && this.table.isRW3 == false && this.table.isRW4 == false) {
|
|
|
- var excelDatas = [
|
|
|
- {
|
|
|
- tHeader: ['栏舍名称', '软件牛头数', '实际牛头数', '系数(%)', '系数头数', '配方模板', '补料配方', '第一班比例(%)', '第一班重量', '第二班比例(%)', '第二班重量', '总比例', '日投喂量', '配方重量', '补料重量', '配方干物质'],
|
|
|
- filterVal: ['barname', 'softccount', 'ccount', 'ratio', 'ccountratio', 'ftname', 'ptsfname', 'r1', 'w1', 'r2', 'w2', 'sumr', 'dailyWeight', 'ftweight', 'supplyweight', 'dryweight'],
|
|
|
- tableDatas: this.download.list,
|
|
|
- sheetName: 'Sheet1'
|
|
|
- }
|
|
|
- ]
|
|
|
- } else if (this.table.isRW1 == true && this.table.isRW2 == true && this.table.isRW3 == true && this.table.isRW4 == false) {
|
|
|
- var excelDatas = [
|
|
|
- {
|
|
|
- tHeader: ['栏舍名称', '软件牛头数', '实际牛头数', '系数(%)', '系数头数', '配方模板', '补料配方', '第一班比例(%)', '第一班重量', '第二班比例(%)', '第二班重量', '第三班比例(%)', '第三班重量', '总比例', '日投喂量', '配方重量', '补料重量', '配方干物质'],
|
|
|
- filterVal: ['barname', 'softccount', 'ccount', 'ratio', 'ccountratio', 'ftname', 'ptsfname', 'r1', 'w1', 'r2', 'w2', 'r3', 'w3', 'sumr', 'dailyWeight', 'ftweight', 'supplyweight', 'dryweight'],
|
|
|
- tableDatas: this.download.list,
|
|
|
- sheetName: 'Sheet1'
|
|
|
- }
|
|
|
- ]
|
|
|
- } else {
|
|
|
- var excelDatas = [
|
|
|
- {
|
|
|
- tHeader: ['栏舍名称', '软件牛头数', '实际牛头数', '系数(%)', '系数头数', '配方模板', '补料配方', '第一班比例(%)', '第一班重量', '第二班比例(%)', '第二班重量', '第三班比例(%)', '第三班重量', '第四班比例(%)', '第四班重量', '总比例', '日投喂量', '配方重量', '补料重量', '配方干物质'],
|
|
|
- filterVal: ['barname', 'softccount', 'ccount', 'ratio', 'ccountratio', 'ftname', 'ptsfname', 'r1', 'w1', 'r2', 'w2', 'r3', 'w3', 'r4', 'w4', 'sumr', 'dailyWeight', 'ftweight', 'supplyweight', 'dryweight'],
|
|
|
- tableDatas: this.download.list,
|
|
|
- sheetName: 'Sheet1'
|
|
|
- }
|
|
|
- ]
|
|
|
- }
|
|
|
- json2excel(excelDatas, '栏舍配方', true, 'xlsx')
|
|
|
- })
|
|
|
- }
|
|
|
- },
|
|
|
-
|
|
|
- beforeImport(file) {
|
|
|
- const isLt2M = file.size / 1024 / 1024 < 2
|
|
|
- if (!isLt2M) {
|
|
|
- this.$message.error('上传文件大小不能超过 2MB!')
|
|
|
- }
|
|
|
- return isLt2M
|
|
|
- },
|
|
|
- handleImportSuccess(res, file) {
|
|
|
- this.getList()
|
|
|
- if (res.msg === 'ok') {
|
|
|
- this.$message({ title: '成功', message: '导入成功:' + res.data.success + '条!', type: 'success', duration: 2000 })
|
|
|
- if (res.data.err_count > 0) {
|
|
|
- this.$notify({ title: '失败', message: '导入失败:' + res.data.err_count + '条!', type: 'danger', duration: 2000 })
|
|
|
- import('@/vendor/Export2Excel').then(excel => {
|
|
|
- const list1 = res.data.result
|
|
|
- const tHeader = [
|
|
|
- '栏舍名称', '实际牛头数', '系数(%)', '配方模板', '补料配方', '第一班比例(%)', '第二班比例(%)', '第三班比例(%)', '错误信息'
|
|
|
- ]
|
|
|
- const filterVal = [
|
|
|
- '栏舍名称', '实际牛头数', '系数(%)', '配方模板', '补料配方', '第一班比例(%)', '第二班比例(%)', '第三班比例(%)', 'error_msg'
|
|
|
- ]
|
|
|
- const data1 = this.formatJson(filterVal, list1)
|
|
|
- excel.export_json_to_excel({ header: tHeader, data: data1, filename: '栏舍配方导入报错信息', autoWidth: true, bookType: 'xlsx' })
|
|
|
- })
|
|
|
- }
|
|
|
- } else {
|
|
|
- this.$notify({ title: '失败', message: '上传失败', type: 'danger', duration: 2000 })
|
|
|
- }
|
|
|
- },
|
|
|
+
|
|
|
+
|
|
|
formatJson(filterVal, jsonData) {
|
|
|
return jsonData.map(v =>
|
|
|
filterVal.map(j => {
|
|
@@ -5306,13 +4914,7 @@ export default {
|
|
|
})
|
|
|
)
|
|
|
},
|
|
|
- // 干物质调节
|
|
|
- handleDryMatterRegulation() {
|
|
|
- console.log('干物质调节')
|
|
|
- this.isShowDialog = true
|
|
|
- this.$refs.mychild.getBalconicFormula()
|
|
|
- this.$refs.mychild.restTemp()
|
|
|
- },
|
|
|
+
|
|
|
blurBw(row) {
|
|
|
console.log(row)
|
|
|
},
|