12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106 |
- <template>
- <div class="app-container">
- <!-- 配方模板表 -->
- <div ref="template" class="template">
- <div class="recipeTemplate">
- <p>日执行计划</p>
- </div>
- <div class="operation">
- <el-button class="success" @click="handleCreate">新生成</el-button>
- <el-button class="success" @click="handleRevisePlan">修改计划</el-button>
- <el-button class="export" style="float: right;margin-right: 80px;" @click="handleHistoryRecord">历史记录</el-button>
- <el-button class="export" style="float: right;margin-right: 10px;" @click="handleMaterialPlan">撒料计划</el-button>
- <el-button class="export" style="float: right;margin-right: 10px;" @click="handlePremixedPlan">预混计划</el-button>
- <el-button class="export" style="float: right;margin-right: 10px;" @click="handleShedFormula">栏舍配方</el-button>
- <el-button class="export" style="float: right;margin-right: 10px;" @click="handleRecipeemplate">配方模板</el-button>
- </div>
- <div class="search">
- <el-date-picker v-model="table.getdataListParm.parammaps.mydate" type="date" placeholder="选择日期" style="width: 150px;" format="yyyy-MM-dd" value-format="yyyy-MM-dd" :clearable="false" @change="changeDate" />
- <el-button class="el-icon-arrow-left elIconArrowLeft" @click="handleBefore" />
- <el-button class="el-icon-arrow-right elIconArrowRight" @click="handleNext" />
- <el-select v-model="table.getdataListParm.parammaps.lpplantype" filterable placeholder="计划类型" class="filter-item" clearable style="width: 120px;" @change="changePlanType">
- <el-option v-for="item in planTypeList" :key="item.value" :label="item.lable" :value="item.value" />
- </el-select>
- <el-select v-model="table.getdataListParm.parammaps.times" filterable placeholder="班次" class="filter-item" style="width: 120px;" clearable @change="changeFrequency">
- <el-option v-for="item in frequencyList" :key="item.id" :label="item.name" :value="item.id" />
- </el-select>
- <el-select v-model="table.getdataListParm.parammaps.enable" filterable placeholder="打印类型" class="filter-item" clearable style="width: 120px;">
- <el-option v-for="item in printingTypeList" :key="item.value" :label="item.label" :value="item.value" />
- </el-select>
- <el-select v-model="table.getdataListParm.parammaps.enable" filterable placeholder="计划维度" class="filter-item" style="width: 120px;" clearable>
- <el-option v-for="item in planningDimensionList" :key="item.value" :label="item.label" :value="item.value" />
- </el-select>
- <el-select v-model="table.getdataListParm.parammaps.enable" filterable placeholder="导出类型" class="filter-item" style="width: 120px;" clearable>
- <el-option v-for="item in exportTypeList" :key="item.value" :label="item.label" :value="item.value" />
- </el-select>
- <el-button class="export" @click="handleExport">导出</el-button>
- </div>
- <!-- 日执行计划 -->
- <div class="table">
- <el-table
- :key="table.tableKey"
- v-loading="table.listLoading"
- element-loading-text="给我一点时间"
- :data="table.list"
- border
- fit
- highlight-current-row
- style="width: 98%;"
- :row-style="rowStyle"
- :cell-style="cellStyle"
- class="elTable table-fixed"
- @row-click="tableRowClick"
- >
- <el-table-column label="序号" align="center" type="index" width="50px" />
- <el-table-column label="计划名称" min-width="130px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.projname }}</span>
- </template>
- </el-table-column>
- <el-table-column label="计划类型" prop="weight" min-width="130px" align="center" :formatter="lpplantype" />
- <el-table-column label="TMR编号" min-width="130px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.tmrtname }}</span>
- </template>
- </el-table-column>
- <el-table-column label="驾驶员" min-width="130px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.driver }}</span>
- </template>
- </el-table-column>
- <el-table-column label="已执行" min-width="130px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.havebutton }}</span>
- </template>
- </el-table-column>
- <el-table-column label="班次" min-width="180px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.times }}</span>
- </template>
- </el-table-column>
- <el-table-column label="理论量" min-width="180px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.lweight }}</span>
- </template>
- </el-table-column>
- <el-table-column label="时间" min-width="180px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.plantime }}</span>
- </template>
- </el-table-column>
- <el-table-column label="发料位" min-width="180px" align="left">
- <template slot-scope="scope">
- <span>{{ scope.row.barnames }}</span>
- </template>
- </el-table-column>
- </el-table>
- </div>
- </div>
- <!-- 预混料 -->
- <div v-if="table3.getdataListParm.parammaps.lpplantype == 4" class="content">
- <div class="table2">
- <div class="contentOperation">
- <p>计划内容<br>操作详情</p>
- </div>
- <div class="content-table">
- <el-table
- :key="table2.tableKey"
- v-loading="table2.listLoading"
- element-loading-text="给我一点时间"
- :data="table2.list"
- fit
- highlight-current-row
- style="width: 100%;"
- height="450"
- :row-style="rowStyle"
- :cell-style="cellStyle"
- class="elTable table-fixed"
- >
- <el-table-column label="操作序号" min-width="130px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.sort }}</span>
- </template>
- </el-table-column>
- <el-table-column label="饲料名称" prop="fname" min-width="130px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.fname }}</span>
- </template>
- </el-table-column>
- <el-table-column label="设计重量(KG)" prop="weight" min-width="130px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.weight }}</span>
- </template>
- </el-table-column>
- </el-table>
- </div>
- </div>
- </div>
- <!-- 撒料 -->
- <div v-if="table3.getdataListParm.parammaps.lpplantype == 0" class="content">
- <div class="table2">
- <div class="contentOperation">
- <p>计划内容<br>操作详情</p>
- </div>
- <div class="content-table">
- <el-table
- :key="table2.tableKey"
- v-loading="table2.listLoading"
- element-loading-text="给我一点时间"
- :data="table2.list"
- fit
- highlight-current-row
- style="width: 100%;"
- height="450"
- :row-style="rowStyle"
- :cell-style="cellStyle"
- class="elTable table-fixed"
- >
- <el-table-column label="操作序号" min-width="130px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.sort }}</span>
- </template>
- </el-table-column>
- <el-table-column label="饲料名称" prop="fname" min-width="130px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.fname }}</span>
- </template>
- </el-table-column>
- <el-table-column label="设计重量(KG)" prop="weight" min-width="130px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.weight }}</span>
- </template>
- </el-table-column>
- </el-table>
- </div>
- </div>
- <div class="table3">
- <div class="contentOperation">
- <p>计划内容<br>栏舍详情</p>
- </div>
- <div class="content-table">
- <el-table
- :key="table3.tableKey"
- v-loading="table3.listLoading"
- element-loading-text="给我一点时间"
- :data="table3.list"
- height="450"
- fit
- highlight-current-row
- style="width: 100%;"
- :row-style="rowStyle"
- :cell-style="cellStyle"
- class="elTable table-fixed"
- >
- <el-table-column label=" 操作序号" min-width="130px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.sort }}</span>
- </template>
- </el-table-column>
- <el-table-column label="栏舍" min-width="130px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.fname }}</span>
- </template>
- </el-table-column>
- <el-table-column label="设计重量(KG)" prop="weight" min-width="130px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.weight }}</span>
- </template>
- </el-table-column>
- </el-table>
- </div>
- </div>
- </div>
- <!-- 剩料 -->
- <div v-if="table3.getdataListParm.parammaps.lpplantype == 3" class="content">
- <div class="table2">
- <div class="contentOperation">
- <p>计划内容<br>操作详情</p>
- </div>
- <div class="content-table">
- <el-table
- :key="table2.tableKey"
- v-loading="table2.listLoading"
- element-loading-text="给我一点时间"
- :data="table2.list"
- fit
- highlight-current-row
- style="width: 100%;"
- height="450"
- :row-style="rowStyle"
- :cell-style="cellStyle"
- class="elTable table-fixed"
- >
- <el-table-column label="操作序号" min-width="130px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.sort }}</span>
- </template>
- </el-table-column>
- <el-table-column label="取料栏舍" prop="fname" min-width="130px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.fname }}</span>
- </template>
- </el-table-column>
- <el-table-column label="处理方式" prop="useinbar" min-width="130px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.useinbar }}</span>
- </template>
- </el-table-column>
- </el-table>
- </div>
- </div>
- <div class="table3">
- <div class="contentOperation">
- <p>计划内容<br>栏舍详情</p>
- </div>
- <div class="content-table">
- <el-table
- :key="table3.tableKey"
- v-loading="table3.listLoading"
- element-loading-text="给我一点时间"
- :data="table3.list"
- height="450"
- fit
- highlight-current-row
- style="width: 100%;"
- :row-style="rowStyle"
- :cell-style="cellStyle"
- class="elTable table-fixed"
- >
- <el-table-column label="操作序号" min-width="130px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.sort }}</span>
- </template>
- </el-table-column>
- <el-table-column label="转投栏舍" min-width="130px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.fname }}</span>
- </template>
- </el-table-column>
- </el-table>
- </div>
- </div>
- </div>
- <!-- 撒料计划-混料 -->
- <div v-if="table3.getdataListParm.parammaps.lpplantype == 1 || table3.getdataListParm.parammaps.lpplantype == 5" class="content">
- <div class="table2">
- <div class="contentOperation">
- <p>计划内容<br>操作详情</p>
- </div>
- <div class="content-table">
- <el-table
- :key="table2.tableKey"
- v-loading="table2.listLoading"
- element-loading-text="给我一点时间"
- :data="table2.list"
- fit
- highlight-current-row
- style="width: 100%;"
- height="450"
- :row-style="rowStyle"
- :cell-style="cellStyle"
- class="elTable table-fixed"
- >
- <el-table-column label="操作序号" min-width="130px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.sort }}</span>
- </template>
- </el-table-column>
- <el-table-column label="饲料名称" prop="fname" min-width="130px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.fname }}</span>
- </template>
- </el-table-column>
- <el-table-column label="设计重量(KG)" prop="weight" min-width="130px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.weight }}</span>
- </template>
- </el-table-column>
- </el-table>
- </div>
- </div>
- <div class="table3">
- <div class="contentOperation">
- <p>计划内容<br>栏舍详情</p>
- </div>
- <div class="content-table">
- <el-table
- :key="table3.tableKey"
- v-loading="table3.listLoading"
- element-loading-text="给我一点时间"
- :data="table3.list"
- height="450"
- fit
- highlight-current-row
- style="width: 100%;"
- :row-style="rowStyle"
- :cell-style="cellStyle"
- class="elTable table-fixed"
- >
- <el-table-column label=" 操作序号" min-width="130px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.sort }}</span>
- </template>
- </el-table-column>
- <el-table-column label="撒料车辆" min-width="130px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.fname }}</span>
- </template>
- </el-table-column>
- <el-table-column label="设计重量(KG)" min-width="130px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.weight }}</span>
- </template>
- </el-table-column>
- </el-table>
- </div>
- </div>
- </div>
- <!-- 撒料计划-撒料 -->
- <div v-if="table3.getdataListParm.parammaps.lpplantype == 2" class="content">
- <div class="table3">
- <div class="contentOperation">
- <p>计划内容<br>栏舍详情</p>
- </div>
- <div class="content-table">
- <el-table
- :key="table3.tableKey"
- v-loading="table3.listLoading"
- element-loading-text="给我一点时间"
- :data="table3.list"
- height="450"
- fit
- highlight-current-row
- style="width: 100%;"
- :row-style="rowStyle"
- :cell-style="cellStyle"
- class="elTable table-fixed"
- >
- <el-table-column label=" 操作序号" min-width="130px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.sort }}</span>
- </template>
- </el-table-column>
- <el-table-column label="撒料车辆" min-width="130px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.fname }}</span>
- </template>
- </el-table-column>
- <el-table-column label="设计重量(KG)" min-width="130px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.weight }}</span>
- </template>
- </el-table-column>
- </el-table>
- </div>
- </div>
- <div class="table2">
- <div class="contentOperation">
- <p>计划内容<br>操作详情</p>
- </div>
- <div class="content-table">
- <el-table
- :key="table2.tableKey"
- v-loading="table2.listLoading"
- element-loading-text="给我一点时间"
- :data="table2.list"
- fit
- highlight-current-row
- style="width: 100%;"
- height="450"
- :row-style="rowStyle"
- :cell-style="cellStyle"
- class="elTable table-fixed"
- >
- <el-table-column label="操作序号" min-width="130px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.sort }}</span>
- </template>
- </el-table-column>
- <el-table-column label="栏舍名称" prop="fname" min-width="130px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.fname }}</span>
- </template>
- </el-table-column>
- <el-table-column label="设计重量(KG)" prop="weight" min-width="130px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.weight }}</span>
- </template>
- </el-table-column>
- </el-table>
- </div>
- </div>
- </div>
- <!-- 新生成 -->
- <el-dialog :title="textMap[newGeneration.dialogStatus]" :destroy-on-close="true" :visible.sync="newGeneration.dialogFormVisible" :close-on-click-modal="false" width="50%">
- <div class="newGeneration">
- <el-form ref="temp" :rules="newGeneration.rules" :model="newGeneration.temp" label-position="right" label-width="155px" style="width: 100%;margin:0 auto 50px">
- <el-row>
- <el-col :span="16">
- <el-form-item label="时间范围:" prop="inputDatetime">
- <el-date-picker v-model="newGeneration.temp.inputDatetime" class="inputDatetime filter-item" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" style="width: 100%;" :clearable="false" />
- </el-form-item>
- </el-col>
- </el-row>
- </el-form>
- <div slot="footer" class="dialog-footer" style="bottom:10px">
- <el-button class="cancelClose" @click="newGeneration.dialogFormVisible = false;getList()">取消</el-button>
- <el-button class="success" :disabled="isokDisable" @click="newGenerationData()">确认</el-button>
- </div>
- </div>
- </el-dialog>
- <!-- 历史记录 -->
- <el-dialog :title="textMap[historyRecord.dialogStatus]" :destroy-on-close="true" :visible.sync="historyRecord.dialogFormVisible" :close-on-click-modal="false" width="90%">
- <div class="historyRecord">
- <keep-alive>
- <component :is="historyRecord.myComponent" ref="historyRecord" />
- </keep-alive>
- </div>
- <div slot="footer" class="dialog-footer" style="bottom: 10px;">
- <el-button class="cancelClose" @click="historyRecord.dialogFormVisible = false; ">关闭</el-button>
- </div>
- </el-dialog>
- <!-- 修改计划 -->
- <RevisePlan :show.sync="isShowDialog" :parent-active-name="activeName" :parent-date="parentDate" />
- </div>
- </template>
- <script>
- import { GetDataByName, GetDataByNames, ExecDataByConfig } from '@/api/common'
- import RevisePlan from './revisePlan.vue'
- import { parseTime } from '@/utils/index.js'
- import Cookies from 'js-cookie'
- export default {
- name: 'DailyExecutionPlan',
- components: {
- RevisePlan
- },
- data() {
- return {
- requestParams: [
- // { name: 'getDictByName', offset: 0, pagecount: 0, params: ['牲畜父类'] }
- ],
- planTypeList: [{ lable: '预混计划', value: '4' }, { lable: '撒料计划', value: '0' }, { lable: '剩料计划', value: '3' }, { lable: '撒料计划-混料', value: '1' }, { lable: '撒料计划-撒料', value: '2' }], // 计划类型
- printingTypeList: [{ lable: '所有', value: '0' }, { lable: '精料', value: '1' }, { lable: '铲车', value: '2' }], // 打印类型
- frequencyList: [], // 班次
- planningDimensionList: [{ lable: '发料顺序', value: '0' }, { lable: 'TMR', value: '1' }], // 发料顺序
- exportTypeList: [{ lable: '投料简打', value: '0' }, { lable: '投料简打', value: '1' }], // 导出类型
- // 班次
- maxTime: {
- getMaxTimesParm: {
- name: 'getSysoptEnable',
- page: 1,
- offset: 1,
- pagecount: 1,
- returntype: 'Map',
- parammaps: {
- pastureid: Cookies.get('pastureid'),
- inforname: 'times'
- }
- }
- },
- table: {
- getdataListParm: {
- name: 'getDownloadedplanList',
- page: 1,
- offset: 1,
- pagecount: '',
- returntype: 'Map',
- parammaps: {
- pastureid: Cookies.get('pastureid'),
- barid: '',
- mydate: parseTime(new Date(), '{y}-{m}-{d}'),
- times: '',
- lpplantype: ''
- }
- },
- tableKey: 0,
- list: [],
- total: 0,
- listLoading: false
- },
- // 计划内容操作详情
- table2: {
- getdataListParm: {
- name: 'getDownloadplandtl1ListV2',
- page: 1,
- offset: 1,
- returntype: 'Map',
- parammaps: {
- pastureid: Cookies.get('pastureid'),
- date: '',
- id: ''
- }
- },
- tableKey: 0,
- list: [],
- total: 0,
- listLoading: false
- },
- // 计划内容 舍栏详情
- table3: {
- getdataListParm: {
- name: 'getDownloadplandt2ListV2',
- page: 1,
- offset: 1,
- returntype: 'Map',
- parammaps: {
- pastureid: Cookies.get('pastureid'),
- date: '',
- id: ''
- }
- },
- tableKey: 0,
- list: [],
- total: 0,
- listLoading: false
- },
- // 新生成
- newGeneration: {
- dialogFormVisible: false,
- dialogStatus: '',
- getdataListParm: {
- name: 'checkLLPIsDistribution',
- page: 1,
- offset: 1,
- pagecount: 1,
- returntype: 'Map',
- parammaps: {
- pastureid: Cookies.get('pastureid')
- }
- },
- temp: {},
- rules: {
- inputDatetime: [{ type: 'array', required: true, message: '必填', trigger: 'blur' }]
- }
- },
- historyRecord: {
- dialogFormVisible: false,
- dialogStatus: '',
- myComponent: null
- },
- textMap: {
- newGeneration: '新生成',
- historyRecord: '历史记录',
- revisePlan: '修改计划'
- },
- isokDisable: false,
- requestParam: {},
- rowStyle: { maxHeight: 50 + 'px', height: 45 + 'px' },
- cellStyle: { padding: 0 + 'px' },
- isShowDialog: false,
- activeName: '栏舍配方',
- parentDate: ''
- }
- },
- created() {
- this.parentDate = this.table.getdataListParm.parammaps.mydate
- this.getList()
- this.getDownList()
- this.getIsDisplay()
- },
- mounted() {
- this.table.getdataListParm.parammaps.mydate = parseTime(new Date(), '{y}-{m}-{d}')
- },
- methods: {
- getIsDisplay() {
- GetDataByName(this.maxTime.getMaxTimesParm).then(response => {
- console.log(response.data.list[0].inforvalue)
- if (response.data.list[0].inforvalue == 1) {
- this.frequencyList = [{ id: '1', name: '第一班' }]
- } else if (response.data.list[0].inforvalue == 2) {
- this.frequencyList = [{ id: '1', name: '第一班' }, { id: '2', name: '第二班' }]
- } else if (response.data.list[0].inforvalue == 3) {
- this.frequencyList = [{ id: '1', name: '第一班' }, { id: '2', name: '第二班' }, { id: '3', name: '第三班' }]
- } else if (response.data.list[0].inforvalue == 4) {
- this.frequencyList = [{ id: '1', name: '第一班' }, { id: '2', name: '第二班' }, { id: '3', name: '第三班' }, { id: '4', name: '第四班' }]
- }
- })
- },
- getDownList() {
- GetDataByNames(this.requestParams).then(response => {
- // this.livestockTypeList = response.data.getDictByName.list
- })
- },
- // -------------------日执行计划-----------------------------
- handleBefore() {
- if (this.table.getdataListParm.parammaps.mydate !== '' && this.table.getdataListParm.parammaps.mydate !== null) {
- this.table.getdataListParm.parammaps.mydate = new Date(this.table.getdataListParm.parammaps.mydate)
- var start = new Date(this.table.getdataListParm.parammaps.mydate.setDate(this.table.getdataListParm.parammaps.mydate.getDate() - 1))
- // var start = this.table.getdataListParm.parammaps.mydate - 1
- this.table.getdataListParm.parammaps.mydate = parseTime(start, '{y}-{m}-{d}')
- // this.$forceUpdate()
- this.getList()
- }
- },
- handleNext() {
- if (this.table.getdataListParm.parammaps.mydate !== '' && this.table.getdataListParm.parammaps.mydate !== null) {
- this.table.getdataListParm.parammaps.mydate = new Date(this.table.getdataListParm.parammaps.mydate)
- var stop = new Date(this.table.getdataListParm.parammaps.mydate.setDate(this.table.getdataListParm.parammaps.mydate.getDate() + 1))
- this.table.getdataListParm.parammaps.mydate = parseTime(stop, '{y}-{m}-{d}')
- this.getList()
- }
- },
- getList() {
- this.table.listLoading = true
- GetDataByName(this.table.getdataListParm).then(response => {
- console.log('table数据', response.data.list)
- if (response.data.list !== null) {
- this.table.list = response.data.list
- this.table.pageNum = response.data.pageNum
- this.table.pageSize = response.data.pageSize
- this.table.total = response.data.total
- console.log('计划类型', response.data.list[0].lpplantype)
- if (response.data.list[0].lpplantype == 0) {
- // 撒料
- this.table2.getdataListParm.name = 'getDownloadplandtl1ListV2'
- this.table3.getdataListParm.name = 'getDownloadplandt2ListV2'
- this.table2.getdataListParm.parammaps.useinbartype = ''
- this.table3.getdataListParm.parammaps.useinbartype = ''
- this.table2.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
- this.table3.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
- this.table2.getdataListParm.parammaps.id = response.data.list[0].id
- this.table3.getdataListParm.parammaps.id = response.data.list[0].id
- this.table3.getdataListParm.parammaps.lpplantype = response.data.list[0].lpplantype
- this.getList2()
- this.getList3()
- } else if (response.data.list[0].lpplantype == 1) {
- // 撒料计划-混料
- this.table2.getdataListParm.name = 'getDownloadplandtl1ListV2'
- this.table3.getdataListParm.name = 'getDownloadplandt2ListV2'
- this.table2.getdataListParm.parammaps.useinbartype = ''
- this.table3.getdataListParm.parammaps.useinbartype = ''
- this.table2.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
- this.table3.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
- this.table2.getdataListParm.parammaps.id = response.data.list[0].id
- this.table3.getdataListParm.parammaps.id = response.data.list[0].id
- this.table3.getdataListParm.parammaps.lpplantype = response.data.list[0].lpplantype
- this.getList2()
- this.getList3()
- } else if (response.data.list[0].lpplantype == 2) {
- // 撒料计划-撒料
- this.table2.getdataListParm.name = 'getDownloadplandt2ListV2'
- this.table3.getdataListParm.name = 'getDownloadplandtl1ListV2'
- this.table2.getdataListParm.parammaps.useinbartype = ''
- this.table3.getdataListParm.parammaps.useinbartype = ''
- this.table2.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
- this.table3.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
- this.table2.getdataListParm.parammaps.id = response.data.list[0].id
- this.table3.getdataListParm.parammaps.id = response.data.list[0].id
- this.table3.getdataListParm.parammaps.lpplantype = response.data.list[0].lpplantype
- this.getList2()
- this.getList3()
- } else if (response.data.list[0].lpplantype == 3) {
- // 剩料
- this.table2.getdataListParm.name = 'getDownloadplandt2ListV2'
- this.table3.getdataListParm.name = 'getDownloadplandt2ListV2'
- this.table2.getdataListParm.parammaps.useinbartype = 0
- this.table3.getdataListParm.parammaps.useinbartype = 1
- this.table2.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
- this.table3.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
- this.table2.getdataListParm.parammaps.id = response.data.list[0].id
- this.table3.getdataListParm.parammaps.id = response.data.list[0].id
- this.table3.getdataListParm.parammaps.lpplantype = response.data.list[0].lpplantype
- this.getList2()
- this.getList3()
- } else if (response.data.list[0].lpplantype == 4) {
- // 预混
- this.table2.getdataListParm.name = 'getDownloadplandtl1ListV2'
- this.table2.getdataListParm.parammaps.useinbartype = ''
- this.table3.getdataListParm.parammaps.useinbartype = ''
- this.table2.getdataListParm.parammaps.id = response.data.list[0].id
- this.table3.getdataListParm.parammaps.lpplantype = response.data.list[0].lpplantype
- this.getList2()
- } else if (response.data.list[0].lpplantype == 5) {
- // 预称重计划
- this.table2.getdataListParm.name = 'getDownloadplandtl1ListV2'
- this.table3.getdataListParm.name = 'getDownloadplandt2ListV2'
- this.table2.getdataListParm.parammaps.useinbartype = ''
- this.table3.getdataListParm.parammaps.useinbartype = ''
- this.table2.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
- this.table3.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
- this.table2.getdataListParm.parammaps.id = response.data.list[0].id
- this.table3.getdataListParm.parammaps.id = response.data.list[0].id
- this.table3.getdataListParm.parammaps.lpplantype = response.data.list[0].lpplantype
- this.getList2()
- this.getList3()
- }
- } else {
- this.table.list = []
- this.table3.getdataListParm.parammaps.lpplantype = ''
- this.table2.getdataListParm.parammaps.id = ''
- this.table3.getdataListParm.parammaps.id = ''
- // this.getList2()
- // this.getList3()
- this.table2.list = []
- this.table3.list = []
- }
- setTimeout(() => {
- this.table.listLoading = false
- }, 100)
- })
- },
- lpplantype: function(cellValue) {
- if (cellValue.lpplantype == 0) {
- return '撒料计划'
- } else if (cellValue.lpplantype == 1) {
- return '撒料计划-混料'
- } else if (cellValue.lpplantype == 2) {
- return '撒料计划-撒料'
- } else if (cellValue.lpplantype == 3) {
- return '剩料计划'
- } else if (cellValue.lpplantype == 4) {
- return '预混计划'
- } else if (cellValue.lpplantype == 5) {
- return '预称重计划'
- }
- },
- changeDate(val) {
- console.log('选择了日期', val)
- this.getList()
- this.getList2()
- this.getList3()
- },
- changePlanType(val) {
- console.log('选择了计划类型', val)
- this.getList()
- this.getList2()
- this.getList3()
- },
- changeFrequency(val) {
- console.log('选择了班次', val)
- this.getList()
- this.getList2()
- this.getList3()
- },
- // 日执行计划行点击
- tableRowClick(row, column, event) {
- console.log(row, column, event)
- console.log('点击计划类型', row.lpplantype)
- // 撒料计划0/撒料计划-混料1/撒料计划-撒料2/剩料计划3/预混计划4/预称重计划5
- if (row.lpplantype == 0) {
- // 撒料
- this.table2.getdataListParm.name = 'getDownloadplandtl1ListV2'
- this.table3.getdataListParm.name = 'getDownloadplandt2ListV2'
- this.table2.getdataListParm.parammaps.useinbartype = ''
- this.table3.getdataListParm.parammaps.useinbartype = ''
- this.table2.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
- this.table3.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
- this.table2.getdataListParm.parammaps.id = row.id
- this.table3.getdataListParm.parammaps.id = row.id
- this.table3.getdataListParm.parammaps.lpplantype = row.lpplantype
- this.getList2()
- this.getList3()
- } else if (row.lpplantype == 1) {
- // 撒料计划-混料
- this.table2.getdataListParm.name = 'getDownloadplandtl1ListV2'
- this.table3.getdataListParm.name = 'getDownloadplandt2ListV2'
- this.table2.getdataListParm.parammaps.useinbartype = ''
- this.table3.getdataListParm.parammaps.useinbartype = ''
- this.table2.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
- this.table3.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
- this.table2.getdataListParm.parammaps.id = row.id
- this.table3.getdataListParm.parammaps.id = row.id
- this.table3.getdataListParm.parammaps.lpplantype = row.lpplantype
- this.getList2()
- this.getList3()
- } else if (row.lpplantype == 2) {
- // 撒料计划-撒料
- this.table2.getdataListParm.name = 'getDownloadplandt2ListV2'
- this.table3.getdataListParm.name = 'getDownloadplandtl1ListV2'
- this.table2.getdataListParm.parammaps.useinbartype = ''
- this.table3.getdataListParm.parammaps.useinbartype = ''
- this.table2.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
- this.table3.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
- this.table2.getdataListParm.parammaps.id = row.id
- this.table3.getdataListParm.parammaps.id = row.id
- this.table3.getdataListParm.parammaps.lpplantype = row.lpplantype
- this.getList2()
- this.getList3()
- console.log(this.table3.getdataListParm.parammaps.lpplantype)
- } else if (row.lpplantype == 3) {
- // 剩料
- this.table2.getdataListParm.name = 'getDownloadplandt2ListV2'
- this.table3.getdataListParm.name = 'getDownloadplandt2ListV2'
- this.table2.getdataListParm.parammaps.useinbartype = 0
- this.table3.getdataListParm.parammaps.useinbartype = 1
- this.table2.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
- this.table3.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
- this.table2.getdataListParm.parammaps.id = row.id
- this.table3.getdataListParm.parammaps.id = row.id
- this.table3.getdataListParm.parammaps.lpplantype = row.lpplantype
- this.getList2()
- this.getList3()
- } else if (row.lpplantype == 4) {
- // 预混
- this.table2.getdataListParm.name = 'getDownloadplandtl1ListV2'
- this.table3.getdataListParm.name = 'getDownloadplandt2ListV2'
- this.table2.getdataListParm.parammaps.useinbartype = ''
- this.table3.getdataListParm.parammaps.useinbartype = ''
- this.table2.getdataListParm.parammaps.id = row.id
- this.table3.getdataListParm.parammaps.lpplantype = row.lpplantype
- this.getList2()
- } else if (row.lpplantype == 5) {
- // 预称重计划
- this.table2.getdataListParm.name = 'getDownloadplandtl1ListV2'
- this.table3.getdataListParm.name = 'getDownloadplandt2ListV2'
- this.table2.getdataListParm.parammaps.useinbartype = ''
- this.table3.getdataListParm.parammaps.useinbartype = ''
- this.table2.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
- this.table3.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
- this.table2.getdataListParm.parammaps.id = row.id
- this.table3.getdataListParm.parammaps.id = row.id
- this.table3.getdataListParm.parammaps.lpplantype = row.lpplantype
- this.getList2()
- this.getList3()
- }
- this.$forceUpdate()
- },
- // 计划内容操作详情
- getList2() {
- this.table2.listLoading = true
- this.table2.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
- GetDataByName(this.table2.getdataListParm).then(response => {
- console.log('table数据', response.data.list)
- if (response.data.list !== null) {
- this.table2.list = response.data.list
- // 撒料计划0/撒料计划-混料1/撒料计划-撒料2/剩料计划3/预混计划4
- if (this.table3.getdataListParm.parammaps.lpplantype == 0 || this.table3.getdataListParm.parammaps.lpplantype == 1 || this.table3.getdataListParm.parammaps.lpplantype == 4) {
- const arr = []
- var a = 0
- let b = this.table2.list[0].sort
- let c = 0
- for (let i = 0; i < this.table2.list.length; i++) {
- if (b !== parseInt(this.table2.list[i].sort)) {
- b = this.table2.list[i].sort
- arr.push({ 'sort': '小计', 'weight': a.toFixed(2) })
- a = 0
- }
- a = a + parseFloat(this.table2.list[i].weight)
- c = c + parseFloat(this.table2.list[i].weight)
- arr.push(this.table2.list[i])
- }
- arr.push({ 'sort': '小计', 'weight': a })
- arr.push({ 'sort': '总计', 'weight': c.toFixed(2) })
- this.table2.list = arr
- }
- if (this.table3.getdataListParm.parammaps.lpplantype == 2) {
- const arr = []
- var aa = 0
- let bb = this.table2.list[0].sort
- let cc = 0
- for (let i = 0; i < this.table2.list.length; i++) {
- if (bb !== parseInt(this.table2.list[i].sort)) {
- bb = this.table2.list[i].sort
- aa = 0
- }
- aa = aa + parseFloat(this.table2.list[i].weight)
- cc = cc + parseFloat(this.table2.list[i].weight)
- arr.push(this.table2.list[i])
- }
- arr.push({ 'sort': '总计', 'weight': cc.toFixed(2) })
- this.table2.list = arr
- console.log('this.table2.list', this.table2.list)
- console.log(this.table3.getdataListParm.parammaps.lpplantype)
- }
- console.log(this.table2.list)
- this.table2.pageNum = response.data.pageNum
- this.table2.pageSize = response.data.pageSize
- this.table2.total = response.data.total
- } else {
- this.table2.list = []
- }
- setTimeout(() => {
- this.table2.listLoading = false
- }, 100)
- })
- },
- // 计划内容栏舍详情
- getList3() {
- this.table3.listLoading = true
- this.table3.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
- GetDataByName(this.table3.getdataListParm).then(response => {
- console.log('table数据', response.data.list)
- if (response.data.list !== null) {
- this.table3.list = response.data.list
- if (this.table3.getdataListParm.parammaps.lpplantype == 0) {
- const arr = []
- var a = 0
- let b = this.table3.list[0].sort
- let c = 0
- for (let i = 0; i < this.table3.list.length; i++) {
- if (b !== parseInt(this.table3.list[i].sort)) {
- b = this.table3.list[i].sort
- a = 0
- }
- a = a + parseFloat(this.table3.list[i].weight)
- c = c + parseFloat(this.table3.list[i].weight)
- arr.push(this.table3.list[i])
- }
- arr.push({ 'sort': '总计', 'weight': c.toFixed(2) })
- this.table3.list = arr
- }
- this.table3.pageNum = response.data.pageNum
- this.table3.pageSize = response.data.pageSize
- this.table3.total = response.data.total
- } else {
- this.table3.list = []
- }
- setTimeout(() => {
- this.table3.listLoading = false
- }, 100)
- })
- },
- // 新生成
- handleCreate() {
- console.log('点击了新生成')
- this.newGeneration.temp = {}
- this.newGeneration.dialogStatus = 'newGeneration'
- this.newGeneration.dialogFormVisible = true
- GetDataByName(this.newGeneration.getdataListParm).then(response => {
- console.log('table数据', response.data.list)
- if (response.data.list !== null) {
- if (response.data.list[0].vmsg == '存在未分配') {
- this.$message({ type: 'warning', message: '撒料计划中存在未分配完栏舍,建议及时进行分配', duration: 2000 })
- }
- }
- })
- },
- DateDiff(sDate1, sDate2) {
- console.log(sDate1, sDate2)
- var aDate, oDate1, oDate2, iDays
- aDate = sDate1.split('-')
- oDate1 = new Date(aDate[0], aDate[1], aDate[2]) // 转换为12-18-2006格式
- aDate = sDate2.split('-')
- oDate2 = new Date(aDate[0], aDate[1], aDate[2])
- iDays = parseInt(Math.abs(oDate1 - oDate2) / 1000 / 60 / 60 / 24) // 把相差的毫秒数转换为天数
- this.newGeneration.temp.days = parseInt(iDays) + 1
- return iDays
- },
- newGenerationData() {
- console.log('点击了新生成保存', this.newGeneration.temp)
- this.isokDisable = true
- setTimeout(() => {
- this.isokDisable = false
- }, 5000)
- this.$refs['temp'].validate(valid => {
- if (valid) {
- this.newGeneration.temp.startTime = parseTime(this.newGeneration.temp.inputDatetime[0], '{y}-{m}-{d}')
- this.newGeneration.temp.stopTime = parseTime(this.newGeneration.temp.inputDatetime[1], '{y}-{m}-{d}')
- this.DateDiff(this.newGeneration.temp.stopTime, this.newGeneration.temp.startTime)
- this.requestParam = {}
- this.requestParam.common = { 'returnmap': '0' }
- this.requestParam.data = []
- this.requestParam.data[0] = { 'name': 'checkDLPIsStart', 'type': 'v', 'parammaps': {
- pastureid: Cookies.get('pastureid'),
- startTime: this.newGeneration.temp.startTime
- }}
- this.requestParam.data[1] = { 'name': 'checkPreMixStorage', 'type': 'e', 'parammaps': {
- pastureid: Cookies.get('pastureid'),
- days: this.newGeneration.temp.days
- }}
- this.requestParam.data[2] = { 'name': 'createdownloadedplan', 'type': 'e', 'parammaps': {
- pastureid: Cookies.get('pastureid'),
- startTime: this.newGeneration.temp.startTime,
- stopTime: this.newGeneration.temp.stopTime
- }}
- ExecDataByConfig(this.requestParam).then(response => {
- console.log('新生成保存发送参数', this.requestParam)
- if (response.msg === 'fail') {
- this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
- } else {
- this.$notify({ title: '', message: '保存成功', type: 'success', duration: 2000 })
- this.newGeneration.dialogFormVisible = false
- this.getList()
- }
- })
- }
- })
- },
- // 配方模板
- handleRecipeemplate() {
- console.log('点击了配方模板,页面待画')
- },
- handleShedFormula() {
- console.log('点击了栏舍配方,页面待画')
- },
- handlePremixedPlan() {
- console.log('点击了预混计划,页面待画')
- },
- handleMaterialPlan() {
- console.log('点击了撒料计划,页面待画')
- },
- handleRevisePlan(data) {
- console.log('点击了修改计划1', this.activeName)
- this.isShowDialog = true
- this.activeName = '栏舍配方'
- console.log('点击了修改计划2', this.activeName)
- },
- createNewDomain(domainForm) {
- // createDomain(domainForm).then(res => {
- // // do something
- // }).catch(err => {
- // // do something
- // console.log('err', err)
- // })
- this.isShowDialog = false
- },
- handleHistoryRecord() {
- console.log('点击了历史记录,页面待画')
- this.historyRecord.dialogStatus = 'historyRecord'
- this.historyRecord.dialogFormVisible = true
- const vue = this
- var myComponent = () => import('./historyRecord.vue')
- return vue.historyRecord.myComponent = myComponent
- },
- handleExport() {
- console.log('点击了导出')
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .operation{margin-bottom:10px;}
- .search{margin-top:10px;}
- .table{margin-top:10px;}
- .template{
- background: #fff;
- position: relative;
- }
- .table2{
- float: left;width: 49%;margin-right: 1%;background: red;
- background: #fff;
- position: relative;
- .content-table{margin-top: 70px;}
- }
- .table3{
- float: left;
- width: 49%;
- background: #fff;
- position: relative;
- .content-table{margin-top: 70px;}
- }
- </style>
|