123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971 |
- <template>
- <div class="app-container">
- <!-- 配方模板表 -->
- <div ref="template" class="template">
- <div class="recipeTemplate">
- <p>日执行计划</p>
- </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.printType" filterable placeholder="打印类型" class="filter-item" :clearable="false" style="width: 120px;">
- <el-option v-for="item in printingTypeList" :key="item.value" :label="item.lable" :value="item.value" />
- </el-select>
- <el-select v-model="table.getdataListParm.parammaps.plandimen" filterable placeholder="计划维度" class="filter-item" style="width: 120px;" :clearable="false">
- <el-option v-for="item in planningDimensionList" :key="item.value" :label="item.lable" :value="item.value" />
- </el-select>
- <el-select v-model="table.getdataListParm.parammaps.enable3" filterable placeholder="导出类型" class="filter-item" style="width: 120px;" :clearable="false">
- <el-option v-for="item in exportTypeList" :key="item.value" :label="item.lable" :value="item.value" />
- </el-select>
- <el-button class="export" icon="el-icon-upload2" @click="handleExport">导出</el-button>
- </div>
- <div class="operation" style="margin-bottom: 10px;">
- <el-button v-if="isRoleEdit" class="success" icon="el-icon-plus" @click="handleCreate">新生成</el-button>
- <el-button v-if="isRoleEdit" class="success" icon="el-icon-edit-outline" @click="handleRevisePlan">修改计划</el-button>
- <el-button v-if="isRoleEdit" class="copy" icon="el-icon-copy-document" @click="handleCopy">复制计划</el-button>
- <el-button v-if="isOrder && isRoleEdit" icon="el-icon-sort" class="success" @click="handleChangeOrder">更改顺序</el-button>
- <div v-else style="margin-left: 10px;display: inline-block;">
- <el-button v-if="isRoleEdit" icon="el-icon-folder-checked" class="success" @click="saveChangeOrder">保存</el-button>
- <el-button v-if="isRoleEdit" icon="el-icon-close" class="sortCancel" @click="cancelChangeOrder">取消</el-button>
- </div>
- <el-button v-if="dataSynchronization.isDataSynchronization && isRoleEdit" class="success" @click="handleDataSynchronization">数据同步</el-button>
- </div>
- <!-- 日执行计划 -->
- <div class="table">
- <el-table
- id="table1"
- ref="parent"
- :key="table.tableKey"
- v-loading="table.listLoading"
- element-loading-text="给我一点时间"
- :data="table.list"
- border
- fit
- highlight-current-row
- style="width: 98%;"
- row-key="sort"
- :row-style="rowStyle"
- :cell-style="cellStyle"
- class="elTable table-fixed"
- :row-class-name="tableRowClassName"
- :height="370"
- @row-click="tableRowClick"
- >
- <el-table-column label="序号" align="center" prop="sort" width="50px" />
- <el-table-column label="计划名称" min-width="90px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.projname }}</span>
- </template>
- </el-table-column>
- <el-table-column label="计划类型" prop="weight" min-width="90px" align="center" :formatter="lpplantype" />
- <el-table-column label="TMR编号" min-width="90px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.tmrtname }}</span>
- </template>
- </el-table-column>
- <el-table-column label="驾驶员" min-width="80px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.driver }}</span>
- </template>
- </el-table-column>
- <el-table-column label="已执行" min-width="70px" align="center">
- <template slot-scope="scope">
- <span v-if="scope.row.havebutton == 0">否</span>
- <span v-else>是</span>
- </template>
- </el-table-column>
- <el-table-column label="班次" min-width="80px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.times }}</span>
- </template>
- </el-table-column>
- <el-table-column label="理论量" min-width="80px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.lweight }}</span>
- </template>
- </el-table-column>
- <el-table-column label="启用" min-width="70px" align="center">
- <template slot-scope="scope">
- <el-switch v-if="dataDisabled == false" v-model="scope.row.enable" :disabled="scope.row.havebutton == 1" active-color="#13ce66" inactive-color="#ff4949" :active-value="1" :inactive-value="0" @change="handleEnableChange(scope.row)" />
- <el-switch v-else v-model="scope.row.enable" disabled active-color="#13ce66" inactive-color="#ff4949" :active-value="1" :inactive-value="0" @change="handleEnableChange(scope.row)" />
- </template>
- </el-table-column>
- <el-table-column label="时间" min-width="80px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.plantime }}</span>
- </template>
- </el-table-column>
- <el-table-column label="配方名称" min-width="100px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.ftname }}</span>
- </template>
- </el-table-column>
- <el-table-column label="牛头数" min-width="80px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.cowcount }}</span>
- </template>
- </el-table-column>
- <el-table-column label="描述" min-width="80px" align="center">
- <template slot-scope="scope">
- <span>{{ scope.row.display }}</span>
- </template>
- </el-table-column>
- <el-table-column label="发料位" min-width="80px" align="left">
- <template slot-scope="scope">
- <span>{{ scope.row.barnames }}</span>
- </template>
- </el-table-column>
- <el-table-column align="center" width="100" label="操作" class-name="small-padding fixed-width" fixed="right">
- <template slot-scope="{row}">
- <el-button class="miniDanger" icon="el-icon-delete" @click="handleRowDelete(row)" />
- </template>
- </el-table-column>
- </el-table>
- <span v-if="table.listLoading == false" style="margin-right: 30px;margin-top: 10px;font-size: 14px;">共{{ table.total }}条</span>
- </div>
- </div>
- <!-- 预混料 -->
- <div v-if="table3.getdataListParm.parammaps.lpplantype == 4" class="content">
- <el-row :gutter="20">
- <el-col :span="12">
- <div class="table2">
- <div class="contentOperation">
- <p>计划详情</p>
- </div>
- <div class="content-table">
- <el-table
- :key="table2.tableKey"
- v-loading="table2.listLoading"
- element-loading-text="给我一点时间"
- :data="table2.list"
- fit
- border
- 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>
- </el-col>
- </el-row>
- </div>
- <!-- 撒料 -->
- <div v-if="table3.getdataListParm.parammaps.lpplantype == 0" class="content">
- <el-row :gutter="20">
- <el-col :span="12">
- <div class="table2">
- <div class="contentOperation">
- <p>计划详情</p>
- </div>
- <div class="content-table">
- <el-table
- :key="table2.tableKey"
- v-loading="table2.listLoading"
- element-loading-text="给我一点时间"
- :data="table2.list"
- fit
- border
- 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>
- </el-col>
- <el-col :span="12">
- <div class="table3">
- <div class="contentOperation">
- <p>栏舍详情</p>
- </div>
- <div class="content-table">
- <el-table
- :key="table3.tableKey"
- v-loading="table3.listLoading"
- element-loading-text="给我一点时间"
- :data="table3.list"
- height="450"
- fit
- border
- 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>
- </el-col>
- </el-row>
- </div>
- <!-- 剩料 -->
- <div v-if="table3.getdataListParm.parammaps.lpplantype == 3" class="content">
- <el-row :gutter="20">
- <el-col :span="12"><div class="table2">
- <div class="contentOperation">
- <p>计划详情</p>
- </div>
- <div class="content-table">
- <el-table
- :key="table2.tableKey"
- v-loading="table2.listLoading"
- element-loading-text="给我一点时间"
- :data="table2.list"
- fit
- border
- 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>
- </el-col>
- <el-col :span="12">
- <div class="table3">
- <div class="contentOperation">
- <p>栏舍详情</p>
- </div>
- <div class="content-table">
- <el-table
- :key="table3.tableKey"
- v-loading="table3.listLoading"
- element-loading-text="给我一点时间"
- :data="table3.list"
- height="450"
- fit
- border
- 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>
- </el-col>
- </el-row>
- </div>
- <!-- 撒料计划-混料 -->
- <div v-if="table3.getdataListParm.parammaps.lpplantype == 1 || table3.getdataListParm.parammaps.lpplantype == 5" class="content">
- <el-row :gutter="20">
- <el-col :span="12">
- <div class="table2">
- <div class="contentOperation">
- <p>计划详情</p>
- </div>
- <div class="content-table">
- <el-table
- :key="table2.tableKey"
- v-loading="table2.listLoading"
- element-loading-text="给我一点时间"
- :data="table2.list"
- fit
- border
- 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>
- </el-col>
- <el-col :span="12">
- <div class="table3">
- <div class="contentOperation">
- <p>栏舍详情</p>
- </div>
- <div class="content-table">
- <el-table
- :key="table3.tableKey"
- v-loading="table3.listLoading"
- element-loading-text="给我一点时间"
- :data="table3.list"
- height="450"
- fit
- border
- 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>
- </el-col>
- </el-row>
- </div>
- <!-- 撒料计划-撒料 -->
- <div v-if="table3.getdataListParm.parammaps.lpplantype == 2" class="content">
- <el-row :gutter="20">
- <el-col :span="12">
- <div class="table3">
- <div class="contentOperation">
- <p>栏舍详情</p>
- </div>
- <div class="content-table">
- <el-table
- :key="table3.tableKey"
- v-loading="table3.listLoading"
- element-loading-text="给我一点时间"
- :data="table3.list"
- height="450"
- fit
- border
- 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>
- </el-col>
- <el-col :span="12">
- <div class="table2">
- <div class="contentOperation">
- <p>计划详情</p>
- </div>
- <div class="content-table">
- <el-table
- :key="table2.tableKey"
- v-loading="table2.listLoading"
- element-loading-text="给我一点时间"
- :data="table2.list"
- fit
- border
- 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>
- </el-col>
- </el-row>
- </div>
- <!-- 新生成 -->
- <el-dialog :title="textMap[newGeneration.dialogStatus]" :destroy-on-close="true" :visible.sync="newGeneration.dialogFormVisible" :close-on-click-modal="false" width="30%">
- <div class="newGeneration">
- <el-form ref="temp" :rules="newGeneration.rules" :model="newGeneration.temp" label-position="right" label-width="100px" style="width: 100%;margin:0 auto 50px">
- <el-row v-if="newGeneration.dialogStatus== 'newGeneration'">
- <el-col :span="24">
- <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" :picker-options="pickerOptions2" />
- </el-form-item>
- </el-col>
- </el-row>
- <el-row v-else>
- <el-col :span="24">
- <el-form-item label="时间范围:" prop="copyInputDatetime">
- <el-date-picker v-model="newGeneration.temp.copyInputDatetime" :picker-options="pickerOptions" 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 v-if="newGeneration.dialogStatus== 'newGeneration'" class="save" :disabled="isokDisable" @click="newGenerationData()">确认</el-button>
- <el-button v-else class="save" :disabled="isokDisable" @click="copyData()">确认</el-button>
- </div>
- </div>
- </el-dialog>
- <!-- 历史记录 -->
- <el-dialog :fullscreen="dialogFull" :destroy-on-close="true" :visible.sync="historyRecord.dialogFormVisible" :close-on-click-modal="false" width="90%">
- <template slot="title">
- <div class="avue-crud__dialog__header">
- <span class="el-dialog__title">
- <span style="display:inline-block;width:3px;height:20px;margin-right:5px; float: left;margin-top:2px" />
- {{ textMap[historyRecord.dialogStatus] }}
- </span>
- <div class="avue-crud__dialog__menu" @click="dialogFull? dialogFull=false: dialogFull=true">
- <svg-icon v-if="dialogFull" icon-class="exit-fullscreen" />
- <svg-icon v-else icon-class="fullscreen" />
- </div>
- </div>
- </template>
- <div class="historyRecord">
- <keep-alive>
- <component :is="historyRecord.myComponent" ref="historyRecord" />
- </keep-alive>
- </div>
- <div slot="footer" class="dialog-footer">
- <el-button class="cancelClose cancelClose1" @click="historyRecord.dialogFormVisible = false; ">关闭</el-button>
- </div>
- </el-dialog>
- <!-- 正在同步中 -->
- <el-dialog :destroy-on-close="true" :visible.sync="dataSynchronization.dialogFormVisible" :close-on-click-modal="false" width="30%">
- <div class="dataSynchronization" style="text-align: center;font-size: 18px;">
- <i class="el-icon-loading" />
- <span>正在同步</span>
- <div slot="footer" class="dialog-footer" style="bottom:10px">
- <el-button class="miniPrimary" @click="dataSynchronization.dialogFormVisible = false;">确认</el-button>
- </div>
- </div>
- </el-dialog>
- <!-- 修改计划 -->
- <RevisePlan :show.sync="isShowDialog" :parent-active-name="activeName" :parent-date="parentDate" />
- </div>
- </template>
- <script>
- import { GetDataByName, GetDataByNames, ExecDataByConfig, PostDataByName, getDorm, GetReportform, checkButtons } from '@/api/common'
- import RevisePlan from './revisePlan.vue'
- import { parseTime, json2excel } from '@/utils/index.js'
- import Cookies from 'js-cookie'
- import Sortable from 'sortablejs'
- import { MessageBox } from 'element-ui'
- export default {
- name: 'DailyExecutionPlan',
- components: {
- RevisePlan
- },
- data() {
- return {
- dialogFull: false,
- isRoleEdit: [],
- dataDisabled: false,
- requestParams: [
- // { name: 'getDictByName', offset: 0, pagecount: 0, params: ['牲畜父类'] }
- ],
- planTypeList: [{ lable: '预混计划', value: '4' }, { lable: '撒料计划', value: '0' }, { lable: '剩料计划', value: '3' }, { lable: '撒料计划-混料', value: '1' }, { lable: '撒料计划-撒料', value: '2' }, { lable: '预称重计划', value: '5' }], // 计划类型
- printingTypeList: [{ lable: '精料', value: '1' }, { lable: '铲车', value: '2' }], // 打印类型
- frequencyList: [], // 班次
- planningDimensionList: [{ lable: '发料顺序', value: '0' }, { lable: 'TMR', value: '1' }], // 发料顺序
- exportTypeList: [{ lable: '投料简打', value: '0' }, { lable: '累加投料', value: '1' }, { lable: '撒料简打', value: '2' }, { lable: '投撒料简打', value: '3' }, { lable: '投撒料累加', value: '4' }, { lable: '包装简打', value: '5' }, { lable: '实发简打', value: '6' }], // 导出类型
- // 班次
- maxTime: {
- getMaxTimesParm: {
- name: 'getSysoptEnable',
- page: 1,
- offset: 1,
- pagecount: 1,
- returntype: 'Map',
- parammaps: {
- pastureid: Cookies.get('pastureid'),
- inforname: 'times'
- }
- }
- },
- isOrder: true,
- 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: '',
- printType: '',
- plandimen: '0',
- enable3: '0'
- }
- },
- 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: {
- inputDatetime: [parseTime(new Date(), '{y}-{m}-{d}'), parseTime(new Date(), '{y}-{m}-{d}')]
- },
- rules: {
- inputDatetime: [{ type: 'array', required: true, message: '必填', trigger: 'blur' }],
- copyInputDatetime: [{ type: 'array', required: true, message: '必填', trigger: 'blur' }]
- }
- },
- pickerMinDate: '',
- pickerOptions: {
- onPick: ({ maxDate, minDate }) => {
- this.pickerMinDate = minDate.getTime()
- if (maxDate) {
- this.pickerMinDate = ''
- }
- },
- disabledDate: (time) => {
- if (this.pickerMinDate !== '') {
- const one = 31 * 24 * 3600 * 1000
- const minTime = this.pickerMinDate
- const maxTime = this.pickerMinDate + one
- return time.getTime() < minTime || time.getTime() > maxTime - 8.64e7
- }
- return time.getTime() < Date.now() - 8.64e7
- }
- },
- pickerOptions2: {
- onPick: ({ maxDate, minDate }) => {
- this.pickerMinDate = minDate.getTime()
- if (maxDate) {
- this.pickerMinDate = ''
- }
- },
- disabledDate: (time) => {
- if (this.pickerMinDate !== '') {
- const one = 14 * 24 * 3600 * 1000
- const minTime = this.pickerMinDate
- const maxTime = this.pickerMinDate + one
- return time.getTime() < minTime || time.getTime() > maxTime - 8.64e7
- }
- return time.getTime() < Date.now() - 8.64e7
- }
- },
- historyRecord: {
- dialogFormVisible: false,
- dialogStatus: '',
- myComponent: null
- },
- dataSynchronization: {
- dialogFormVisible: false,
- dialogStatus: '',
- getdataListParm: {
- name: 'getSysoptEnable',
- page: 1,
- offset: 1,
- pagecount: 1,
- returntype: 'Map',
- parammaps: {
- pastureid: Cookies.get('pastureid'),
- inforname: 'isDataSync'
- }
- },
- isDataSynchronization: false
- },
- textMap: {
- newGeneration: '新生成',
- historyRecord: '历史记录',
- revisePlan: '修改计划',
- copy: '复制计划'
- },
- isokDisable: false,
- requestParam: {},
- rowStyle: { maxHeight: 30 + 'px', height: 30 + 'px' },
- cellStyle: { padding: 0 + 'px' },
- isShowDialog: false,
- activeName: '栏舍配方',
- parentDate: '',
- downLoad: {
- getdataListParm: {
- name: '',
- page: 1,
- offset: 1,
- pagecount: '',
- returntype: 'Map',
- parammaps: {
- pastureid: Cookies.get('pastureid'),
- date: ''
- }
- },
- list: [],
- labelList: []
- }
- }
- },
- created() {
- this.parentDate = this.table.getdataListParm.parammaps.mydate
- console.log(this.parentDate, 'this.parentDate')
- this.getDataSynchronization()
- this.getButtons()
- this.getList()
- this.getDownList()
- this.getIsDisplay()
- },
- mounted() {
- this.table.getdataListParm.parammaps.mydate = parseTime(new Date(), '{y}-{m}-{d}')
- },
- methods: {
- getButtons() {
- const Edit = 'DailyExecutionPlan'
- const isRoleEdit = checkButtons(JSON.parse(sessionStorage.getItem('buttons')), Edit)
- this.isRoleEdit = isRoleEdit
- },
- getDataSynchronization() {
- GetDataByName(this.dataSynchronization.getdataListParm).then(response => {
- console.log(response.data.list[0])
- if (response.data.list[0].inforvalue == 0) {
- this.dataSynchronization.isDataSynchronization = false
- } else {
- this.dataSynchronization.isDataSynchronization = true
- }
- })
- },
- 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.parentDate = this.table.getdataListParm.parammaps.mydate
- this.getList()
- }
- var d = this.table.getdataListParm.parammaps.mydate
- var curDate = parseTime(new Date(), '{y}-{m}-{d}')
- if (d < curDate) {
- this.dataDisabled = true
- } else {
- this.dataDisabled = false
- }
- console.log(this.dataDisabled)
- },
- 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.parentDate = this.table.getdataListParm.parammaps.mydate
- this.getList()
- }
- var d = this.table.getdataListParm.parammaps.mydate
- var curDate = parseTime(new Date(), '{y}-{m}-{d}')
- if (d < curDate) {
- this.dataDisabled = true
- } else {
- this.dataDisabled = false
- }
- console.log(this.dataDisabled)
- },
- getList() {
- this.table.listLoading = true
- GetDataByName(this.table.getdataListParm).then(response => {
- console.log('table数据', response.data.list)
- if (response.data.list !== null) {
- // var obj = { 'id': '580999', 'havebutton': '0', 'lpplantype': 2, 'pid': '3283220207862547456', 'times': '第二班', 'projname': '2.666' }
- // response.data.list[6] = obj
- this.getIsColor(response.data.list)
- 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)
- })
- },
- handleEnableChange(row) {
- this.requestParam.name = 'updatedownloadenable'
- this.requestParam.parammaps = {}
- this.requestParam.parammaps.pastureid = row.pastureid
- this.requestParam.parammaps.id = row.id
- this.requestParam.parammaps.enable = row.enable
- PostDataByName(this.requestParam).then(response => {
- if (response.msg === 'fail') {
- this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
- } else {
- this.$notify({ title: '', message: '保存成功', type: 'success', duration: 2000 })
- this.getList()
- }
- })
- },
- getIsColor(arr) {
- var map = {}
- var dest = []
- for (var i = 0; i < arr.length; i++) {
- var ai = arr[i]
- if (!map[ai.pid]) {
- dest.push({
- pid: ai.pid,
- data: [ai]
- })
- map[ai.pid] = ai
- } else {
- for (var j = 0; j < dest.length; j++) {
- var dj = dest[j]
- if (dj.pid == ai.pid) {
- dj.data.push(ai)
- break
- }
- }
- }
- }
- console.log(dest)
- var newArr1 = []
- for (var i = 0; i < dest.length; i++) {
- var newArr = dest[i].data
- for (var j = 0; j < dest[i].data.length; j++) {
- dest[i].data[j].isColor = i
- newArr1.push(dest[i].data[j])
- }
- }
- console.log(newArr1)
- this.table.list = newArr1
- },
- tableRowClassName({ row }) {
- if (row.isColor % 2 == 0) {
- return 'warning-row'
- } else {
- return 'success-row'
- }
- },
- 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()
- var d = this.table.getdataListParm.parammaps.mydate
- var curDate = parseTime(new Date(), '{y}-{m}-{d}')
- if (d < curDate) {
- this.dataDisabled = true
- } else {
- this.dataDisabled = false
- }
- console.log(this.dataDisabled)
- this.parentDate = this.table.getdataListParm.parammaps.mydate
- console.log(this.parentDate, 'this.parentDate')
- },
- 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(parseInt(Cookies.get('decimal'))) })
- 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.toFixed(parseInt(Cookies.get('decimal'))) })
- arr.push({ 'sort': '总计', 'weight': c.toFixed(parseInt(Cookies.get('decimal'))) })
- 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(parseInt(Cookies.get('decimal'))) })
- 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(parseInt(Cookies.get('decimal'))) })
- 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.inputDatetime = [parseTime(new Date(), '{y}-{m}-{d}'), parseTime(new Date(), '{y}-{m}-{d}')]
- 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
- 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 })
- this.isokDisable = false
- } else {
- this.$notify({ title: '', message: '保存成功', type: 'success', duration: 2000 })
- this.newGeneration.dialogFormVisible = false
- this.getList()
- this.isokDisable = false
- }
- })
- }
- })
- },
- // 修改计划
- handleRevisePlan(data) {
- this.dialogFull = false
- var arr = []
- if (this.table.list.length > 0) {
- for (let i = 0; i < this.table.list.length; i++) {
- if (this.table.list[i].havebutton == 1) {
- arr.push(this.table.list[i])
- }
- }
- }
- if (arr.length !== this.table.list.length) {
- console.log('点击了修改计划1', this.activeName)
- this.isShowDialog = true
- this.activeName = '栏舍配方'
- console.log('点击了修改计划2', this.activeName)
- } else {
- this.$message({ type: 'error', message: '当前日期不可修改计划,请重新选择日期' })
- }
- },
- handleExport() {
- this.downLoad.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
- this.downLoad.getdataListParm.parammaps.lpplantype = this.table.getdataListParm.parammaps.lpplantype
- this.downLoad.getdataListParm.parammaps.times = this.table.getdataListParm.parammaps.times
- this.downLoad.getdataListParm.parammaps.enable = this.table.getdataListParm.parammaps.enable
- this.downLoad.getdataListParm.parammaps.enable2 = this.table.getdataListParm.parammaps.enable2
- var exportTitle = ''
- if (this.table.getdataListParm.parammaps.plandimen == '1') {
- if (this.table.getdataListParm.parammaps.enable3 == '0') {
- this.downLoad.getdataListParm.name = 'downloadPlanTLJDTMR'
- exportTitle = this.table.getdataListParm.parammaps.mydate + '投料简打'
- } else if (this.table.getdataListParm.parammaps.enable3 == '1') {
- this.downLoad.getdataListParm.name = 'downloadPlanTLLDTMR'
- exportTitle = this.table.getdataListParm.parammaps.mydate + '累加投料'
- } else if (this.table.getdataListParm.parammaps.enable3 == '2') {
- this.downLoad.getdataListParm.name = 'downloadPlanSLJDTMR'
- exportTitle = this.table.getdataListParm.parammaps.mydate + '撒料简打'
- } else if (this.table.getdataListParm.parammaps.enable3 == '3') {
- this.downLoad.getdataListParm.name = 'downloadPlanTSLJDTMR'
- exportTitle = this.table.getdataListParm.parammaps.mydate + '投撒料简打'
- } else if (this.table.getdataListParm.parammaps.enable3 == '4') {
- this.downLoad.getdataListParm.name = 'downloadPlanTSLLDTMR'
- exportTitle = this.table.getdataListParm.parammaps.mydate + '投撒料累加'
- } else if (this.table.getdataListParm.parammaps.enable3 == '5') {
- this.downLoad.getdataListParm.name = 'downloadPlanBZJDTMR'
- exportTitle = this.table.getdataListParm.parammaps.mydate + '包装简打'
- } else {
- this.downLoad.getdataListParm.name = 'downloadPlanSFJDTMR'
- exportTitle = this.table.getdataListParm.parammaps.mydate + '实发简打'
- }
- } else {
- if (this.table.getdataListParm.parammaps.enable3 == '0') {
- this.downLoad.getdataListParm.name = 'downloadPlanTLJD'
- exportTitle = this.table.getdataListParm.parammaps.mydate + '投料简打'
- } else if (this.table.getdataListParm.parammaps.enable3 == '1') {
- this.downLoad.getdataListParm.name = 'downloadPlanTLLD'
- exportTitle = this.table.getdataListParm.parammaps.mydate + '累加投料'
- } else if (this.table.getdataListParm.parammaps.enable3 == '2') {
- this.downLoad.getdataListParm.name = 'downloadPlanSLJD'
- exportTitle = this.table.getdataListParm.parammaps.mydate + '撒料简打'
- } else if (this.table.getdataListParm.parammaps.enable3 == '3') {
- this.downLoad.getdataListParm.name = 'downloadPlanTSLJD'
- exportTitle = this.table.getdataListParm.parammaps.mydate + '投撒料简打'
- } else if (this.table.getdataListParm.parammaps.enable3 == '4') {
- this.downLoad.getdataListParm.name = 'downloadPlanTSLLD'
- exportTitle = this.table.getdataListParm.parammaps.mydate + '投撒料累加'
- } else if (this.table.getdataListParm.parammaps.enable3 == '5') {
- this.downLoad.getdataListParm.name = 'downloadPlanBZJD'
- exportTitle = this.table.getdataListParm.parammaps.mydate + '包装简打'
- } else {
- this.downLoad.getdataListParm.name = 'downloadPlanSFJD'
- exportTitle = this.table.getdataListParm.parammaps.mydate + '实发简打'
- }
- }
- GetReportform(this.downLoad.getdataListParm).then(response => {
- if (response.data.list !== null) {
- this.downLoad.labelList = []
- var filterValArr = []
- for (let i = 0; i < response.data.list.data1.length; i++) {
- this.downLoad.labelList.push(response.data.list.data1[i].label)
- filterValArr.push(response.data.list.data1[i].prop)
- }
- this.downLoad.list = response.data.list.data2
- } else {
- this.downLoad.list = []
- }
- var multiHeaderArr = []
- for (let i = 0; i < this.downLoad.labelList.length; i++) {
- if (i == 0) {
- multiHeaderArr.push(exportTitle)
- } else {
- multiHeaderArr.push('')
- }
- }
- import('@/vendor/Export5Excel').then(excel => {
- const multiHeader = [
- multiHeaderArr
- ]
- const multiHeader2 = [
- this.downLoad.labelList
- ]
- const filterVal = filterValArr
- const data = this.downLoad.list.map((v) => filterVal.map((j) => v[j]))
- const merges = []
- excel.export_json_to_excel({ multiHeader, multiHeader2, data, filename: exportTitle, merges })
- })
- })
- },
- rowDrop() {
- console.log(document.querySelector('#table1 .el-table__body-wrapper tbody'))
- const tbody = document.querySelector('#table1 .el-table__body-wrapper tbody')
- // this.sorTable()
- const that = this
- var sortable = Sortable.create(tbody, {
- disabled: that.dropState,
- onChoose({ newIndex, oldIndex }) {
- console.log(that.isOrder, 'that.isOrder == false')
- console.log(that.dropState, 'that.dropState')
- if (that.dropState == true || that.isOrder == true) {
- sortable.destroy()
- }
- },
- onEnd(evt) {
- var tableList = [...that.table.list] // 保留拖动前数据
- const targetRow = that.table.list.splice(evt.oldIndex, 1)[0] // 拖动数据
- const targetRow2 = that.table.list[evt.newIndex] // 拖动后下方数据
- const targetRow3 = that.table.list[evt.newIndex - 1] // 拖动后上方数据
- console.log(targetRow, 'targetRow')
- console.log(targetRow2, 'targetRow2')
- console.log(targetRow3, 'targetRow3')
- that.table.list.splice(evt.newIndex, 0, targetRow)
- // ==========
- // 已执行的计划不可拖动
- if (targetRow.havebutton == 1) {
- that.$nextTick(() => {
- that.$set(that.table, 'list', tableList)
- })
- that.$message({ type: 'error', message: '因已执行的计划不可调整顺序', duration: 2000 })
- return false
- }
- // 相同班次之间可以拖动
- if (targetRow2 !== undefined && targetRow3 !== undefined) {
- if (targetRow.times !== targetRow2.times && targetRow.times !== targetRow3.times) {
- that.$nextTick(() => {
- that.$set(that.table, 'list', tableList)
- })
- that.$message({ type: 'error', message: '因班次不同不可调整顺序', duration: 2000 })
- return false
- }
- } else if (targetRow2 !== undefined && targetRow3 == undefined) {
- if (targetRow.times !== targetRow2.times) {
- that.$nextTick(() => {
- that.$set(that.table, 'list', tableList)
- })
- that.$message({ type: 'error', message: '因班次不同不可调整顺序', duration: 2000 })
- return false
- }
- } else if (targetRow2 == undefined && targetRow3 !== undefined) {
- if (targetRow.times !== targetRow3.times) {
- that.$nextTick(() => {
- that.$set(that.table, 'list', tableList)
- })
- that.$message({ type: 'error', message: '因班次不同不可调整顺序', duration: 2000 })
- return false
- }
- }
- // 撒料计划0,
- // 撒料计划-混料1
- // 撒料计划-撒料2
- // 剩料计划3
- // 预混计划4
- // 预称重计划5
- if (targetRow.lpplantype == 1) { // 拖动数据为撒料计划-混料
- if (targetRow2 == undefined) {
- that.$nextTick(() => {
- that.$set(that.table, 'list', tableList)
- })
- } else if (targetRow2 !== undefined && targetRow2.pid == targetRow.pid) {
- that.$nextTick(() => {
- that.$set(that.table, 'list', tableList)
- })
- } else {
- var pidArr = [] // pid相同的值
- var pidArr1 = [] //
- var index // 索引
- for (let i = 0; i < tableList.length; i++) {
- if (tableList[i].pid == targetRow.pid) {
- pidArr.push(tableList[i])
- } else {
- pidArr1.push(tableList[i])
- }
- }
- // 找到对应上方pid 的ID
- // 比如说id 580243 找到对应的索引
- if (targetRow3 !== undefined) {
- for (let i = 0; i < pidArr1.length; i++) {
- if (pidArr1[i].id == targetRow3.id) {
- index = i
- }
- }
- } else {
- for (let i = 0; i < pidArr1.length; i++) {
- if (pidArr1[i].id == targetRow2.id) {
- index = i - 1
- }
- }
- }
- pidArr1.splice(index + 1, 0, ...pidArr)
- console.log(pidArr1)
- that.$nextTick(() => {
- that.table.list = pidArr1
- })
- }
- if (targetRow2 !== undefined && targetRow3 !== undefined) {
- if (targetRow2.pid == targetRow3.pid) {
- that.$nextTick(() => {
- that.$set(that.table, 'list', tableList)
- })
- that.$message({ type: 'error', message: '不可将其他计划拖动至预称重计划之间', duration: 2000 })
- return false
- }
- }
- } else if (targetRow.lpplantype == 5) { // 拖动数据为预称重计划
- if (targetRow2 !== undefined) {
- console.log(targetRow3, targetRow2, 'zhidao')
- if (targetRow3 !== undefined) {
- if (targetRow3.pid !== targetRow.pid && targetRow2.pid !== targetRow.pid) {
- that.$nextTick(() => {
- that.$set(that.table, 'list', tableList)
- })
- that.$message({ type: 'error', message: '预称重计划不可拖动至其他位置', duration: 2000 })
- return false
- } else {
- console.log('wojinlaile', targetRow2, targetRow)
- if (targetRow3.lpplantype == 0 && targetRow2.pid !== targetRow.pid) {
- that.$nextTick(() => {
- that.$set(that.table, 'list', tableList)
- })
- that.$message({ type: 'error', message: '预称重计划不可拖动至撒料计划下方', duration: 2000 })
- return false
- }
- if (targetRow2.lpplantype !== 5 && targetRow3.lpplantype !== 5) {
- that.$nextTick(() => {
- that.$set(that.table, 'list', tableList)
- })
- that.$message({ type: 'error', message: '预称重计划不可拖动至其他位置', duration: 2000 })
- return false
- }
- }
- } else {
- if (targetRow2.pid !== targetRow.pid) {
- that.$nextTick(() => {
- that.$set(that.table, 'list', tableList)
- })
- that.$message({ type: 'error', message: '预称重计划不可拖动至其他位置', duration: 2000 })
- return false
- } else {
- if (targetRow2.pid !== targetRow.pid) {
- that.$nextTick(() => {
- that.$set(that.table, 'list', tableList)
- })
- that.$message({ type: 'error', message: '预称重计划不可拖动至撒料计划下方', duration: 2000 })
- return false
- }
- }
- }
- } else {
- if (targetRow2 == undefined) {
- that.$nextTick(() => {
- that.$set(that.table, 'list', tableList)
- })
- that.$message({ type: 'error', message: '预称重计划不可拖动至其他位置', duration: 2000 })
- return false
- } else if (targetRow3.pid !== targetRow.pid) {
- that.$nextTick(() => {
- that.$set(that.table, 'list', tableList)
- })
- that.$message({ type: 'error', message: '预称重计划不可拖动至其他位置', duration: 2000 })
- return false
- } else {
- if (targetRow3.lpplantype == 0) {
- that.$nextTick(() => {
- that.$set(that.table, 'list', tableList)
- })
- that.$message({ type: 'error', message: '预称重计划不可拖动至撒料计划下方', duration: 2000 })
- return false
- }
- }
- }
- if (targetRow2 !== undefined && targetRow3 !== undefined) {
- if (targetRow2.pid !== targetRow.pid && targetRow3.pid !== targetRow.pid) {
- that.$nextTick(() => {
- that.$set(that.table, 'list', tableList)
- })
- that.$message({ type: 'error', message: '不可将其他计划拖动至预称重计划之间', duration: 2000 })
- return false
- } else if (targetRow3.pid == targetRow.pid && (targetRow3.lpplantype == 1 || targetRow3.lpplantype == 2)) {
- that.$nextTick(() => {
- that.$set(that.table, 'list', tableList)
- })
- that.$message({ type: 'error', message: '预称重计划不可拖动至其他位置', duration: 2000 })
- return false
- }
- }
- } else if (targetRow.lpplantype == 2) { // 拖动数据为撒料计划-撒料
- if (targetRow2 == undefined) {
- if (targetRow3.pid !== targetRow.pid) {
- that.$nextTick(() => {
- that.$set(that.table, 'list', tableList)
- })
- that.$message({ type: 'error', message: '撒料计划-撒料不可拖动至其他位置', duration: 2000 })
- return false
- }
- } else {
- if (targetRow2.lpplantype == 1 && (targetRow2.pid == targetRow.pid || targetRow2 == undefined)) {
- // 拖动数据下方为撒料计划-混料时且pid相同,不可拖动,提示
- that.$nextTick(() => {
- that.$set(that.table, 'list', tableList)
- })
- that.$message({ type: 'error', message: '撒料计划-撒料不可拖动至撒料计划-混料上方', duration: 2000 })
- return false
- } else if (targetRow.lpplantype == 2 && (targetRow2.pid == targetRow.pid || targetRow3.pid == targetRow.pid || targetRow2 == undefined || targetRow3 == undefined)) {
- console.log('正常拖动')
- } else {
- that.$nextTick(() => {
- that.$set(that.table, 'list', tableList)
- })
- that.$message({ type: 'error', message: '撒料计划-撒料不可拖动至其他位置', duration: 2000 })
- return false
- }
- }
- if (targetRow2 !== undefined && targetRow3 !== undefined) {
- if (targetRow2.pid == targetRow3.pid) {
- that.$nextTick(() => {
- that.$set(that.table, 'list', tableList)
- })
- that.$message({ type: 'error', message: '不可将其他计划拖动至预称重计划之间', duration: 2000 })
- return false
- }
- }
- } else if (targetRow.lpplantype == 0) { // 拖动数据为撒料计划
- console.log('遍历有相同的pid,一起跟着拖动3')
- var pidArr = [] // pid相同的值
- var pidArr1 = [] //
- var index // 索引
- for (let i = 0; i < tableList.length; i++) {
- if (tableList[i].pid == targetRow.pid) {
- pidArr.push(tableList[i])
- } else {
- pidArr1.push(tableList[i])
- }
- }
- if (pidArr.length > 0) {
- // 找到对应上方pid 的ID
- // 比如说id 580243 找到对应的索引
- if (targetRow3 !== undefined) {
- for (let i = 0; i < pidArr1.length; i++) {
- if (pidArr1[i].id == targetRow3.id) {
- index = i
- }
- }
- } else {
- for (let i = 0; i < pidArr1.length; i++) {
- if (pidArr1[i].id == targetRow2.id) {
- index = i - 1
- }
- }
- }
- pidArr1.splice(index + 1, 0, ...pidArr)
- console.log(pidArr1)
- that.$nextTick(() => {
- that.table.list = pidArr1
- })
- }
- if (targetRow2 !== undefined && targetRow3 !== undefined) {
- if (targetRow2.pid == targetRow3.pid) {
- that.$nextTick(() => {
- that.$set(that.table, 'list', tableList)
- })
- that.$message({ type: 'error', message: '不可拖动至其他计划中间;', duration: 2000 })
- return false
- }
- }
- } else if (targetRow.lpplantype == 3 || targetRow.lpplantype == 4) {
- if (targetRow2 !== undefined && targetRow3 !== undefined) {
- if (targetRow2.pid == targetRow3.pid) {
- if (targetRow2.lpplantype == 5 && targetRow3.lpplantype == 5) {
- that.$nextTick(() => {
- that.$set(that.table, 'list', tableList)
- })
- that.$message({ type: 'error', message: '不可拖动至预称重计划跟预称重计划之间', duration: 2000 })
- return false
- } else if (targetRow.pid == targetRow2.pid && targetRow.lpplantype == 3 && targetRow2.lpplantype == 3 || targetRow.pid == targetRow3.pid && targetRow.lpplantype == 3 && targetRow3.lpplantype == 3) {
- console.log('剩料之间可以互相拖动')
- console.log(tableList)
- } else {
- that.$nextTick(() => {
- that.$set(that.table, 'list', tableList)
- })
- // 撒料计划0,
- // 撒料计划-混料1
- // 撒料计划-撒料2
- // 剩料计划3
- // 预混计划4
- // 预称重计划5
- if (targetRow3.lpplantype == 0) {
- that.$set(targetRow3, 'mylpplantype', '撒料计划')
- } else if (targetRow3.lpplantype == 1) {
- that.$set(targetRow3, 'mylpplantype', '撒料计划-混料')
- } else if (targetRow3.lpplantype == 2) {
- that.$set(targetRow3, 'mylpplantype', '撒料计划-撒料')
- } else if (targetRow3.lpplantype == 3) {
- that.$set(targetRow3, 'mylpplantype', '剩料计划')
- } else if (targetRow3.lpplantype == 4) {
- that.$set(targetRow3, 'mylpplantype', '预混计划')
- } else if (targetRow3.lpplantype == 5) {
- that.$set(targetRow3, 'mylpplantype', '预称重计划')
- }
- if (targetRow2.lpplantype == 0) {
- that.$set(targetRow2, 'mylpplantype', '撒料计划')
- } else if (targetRow2.lpplantype == 1) {
- that.$set(targetRow2, 'mylpplantype', '撒料计划-混料')
- } else if (targetRow2.lpplantype == 2) {
- that.$set(targetRow2, 'mylpplantype', '撒料计划-撒料')
- } else if (targetRow2.lpplantype == 3) {
- that.$set(targetRow2, 'mylpplantype', '剩料计划')
- } else if (targetRow2.lpplantype == 4) {
- that.$set(targetRow2, 'mylpplantype', '预混计划')
- } else if (targetRow2.lpplantype == 5) {
- that.$set(targetRow2, 'mylpplantype', '预称重计划')
- }
- var message = '不可拖动至' + targetRow3.mylpplantype + '跟' + targetRow2.mylpplantype + '之间'
- that.$message({ type: 'error', message: message, duration: 2000 })
- return false
- }
- }
- }
- // ========
- // var pidArr = [] // pid相同的值
- // var pidArr1 = [] //
- // var index // 索引
- // for (let i = 0; i < tableList.length; i++) {
- // if (tableList[i].pid == targetRow.pid) {
- // pidArr.push(tableList[i])
- // } else {
- // pidArr1.push(tableList[i])
- // }
- // }
- // if (pidArr.length > 0) {
- // // 找到对应上方pid 的ID
- // // 比如说id 580243 找到对应的索引
- // if (targetRow3 !== undefined) {
- // for (let i = 0; i < pidArr1.length; i++) {
- // if (pidArr1[i].id == targetRow3.id) {
- // index = i
- // }
- // }
- // } else {
- // for (let i = 0; i < pidArr1.length; i++) {
- // if (pidArr1[i].id == targetRow2.id) {
- // index = i - 1
- // }
- // }
- // }
- // pidArr1.splice(index + 1, 0, ...pidArr)
- // console.log(pidArr1)
- // that.$nextTick(() => {
- // that.table.list = pidArr1
- // })
- // }
- // if (targetRow2 !== undefined && targetRow3 !== undefined) {
- // if (targetRow2.pid == targetRow3.pid) {
- // that.$nextTick(() => {
- // that.$set(that.table, 'list', tableList)
- // })
- // that.$message({ type: 'error', message: '不可将其他计划拖动至预称重计划之间9999', duration: 2000 })
- // return false
- // }
- // }
- }
- // ===
- }
- })
- },
- // 复制
- handleCopy() {
- if (this.table.list.length > 0) {
- this.newGeneration.temp = {}
- this.newGeneration.dialogStatus = 'copy'
- this.newGeneration.dialogFormVisible = true
- } else {
- this.$message({ type: 'error', message: '当前无计划可复制' })
- }
- },
- copyData() {
- console.log(this.newGeneration.temp.copyInputDatetime)
- this.isokDisable = true
- setTimeout(() => {
- this.isokDisable = false
- }, 5000)
- this.$refs['temp'].validate(valid => {
- if (valid) {
- this.requestParam.name = 'copydownloadedplan'
- this.requestParam.parammaps = {}
- this.requestParam.parammaps.pastureid = Cookies.get('pastureid')
- this.requestParam.parammaps.date = this.table.getdataListParm.parammaps.mydate
- this.requestParam.parammaps.startTime = parseTime(this.newGeneration.temp.copyInputDatetime[0], '{y}-{m}-{d}')
- this.requestParam.parammaps.stopTime = parseTime(this.newGeneration.temp.copyInputDatetime[1], '{y}-{m}-{d}')
- PostDataByName(this.requestParam).then(response => {
- 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()
- }
- })
- }
- })
- },
- handleChangeOrder() {
- // 拖动顺序
- this.isOrder = false
- this.rowDrop()
- },
- saveChangeOrder() {
- // 保存顺序
- var sortList = []
- for (let i = 0; i < this.table.list.length; i++) {
- var obj = {}
- obj.sort = i
- obj.pastureid = this.table.list[i].pastureid
- obj.id = this.table.list[i].id
- sortList.push(obj)
- }
- console.log(sortList)
- this.requestParam = {}
- this.requestParam.common = { 'returnmap': '0' }
- this.requestParam.data = []
- this.requestParam.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': sortList }}
- this.requestParam.data[0].children = []
- this.requestParam.data[0].children[0] = { 'name': 'updatedownloadesort', 'type': 'e', 'parammaps': {
- id: '@insertSpotList.id',
- pastureid: '@insertSpotList.pastureid',
- sort: '@insertSpotList.sort'
- }}
- 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.getList()
- this.isOrder = true
- }
- })
- },
- cancelChangeOrder() {
- // 取消顺序
- this.getList()
- this.isOrder = true
- },
- handleDataSynchronization() {
- MessageBox.confirm('是否确认同步数据?', {
- confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
- }).then(() => {
- this.requestParam = {}
- this.requestParam.pastureid = Cookies.get('pastureid')
- // this.$alert('正在同步', { confirmButtonText: '确定' })
- this.dataSynchronization.dialogFormVisible = true
- getDorm(this.requestParam).then(response => {
- console.log(response)
- if (response.msg == 'ok') {
- this.dataSynchronization.dialogFormVisible = false
- this.$notify({ title: '同步成功', message: '同步成功', type: 'success', duration: 2000 })
- } else {
- this.$notify({ title: '同步失败', message: response.data, type: 'warning', duration: 2000 })
- this.dataSynchronization.dialogFormVisible = false
- }
- })
- }).catch(() => {
- this.$message({ type: 'info', message: '已取消数据同步' })
- })
- },
- handleRowDelete(row) {
- console.log('删除')
- MessageBox.confirm('是否确认删除此信息?', {
- confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
- }).then(() => {
- this.selectList = []
- this.requestParam = {}
- this.requestParam.name = 'delDownloadedplan'
- this.requestParam.parammaps = {}
- this.requestParam.parammaps.pastureid = row.pastureid
- this.requestParam.parammaps.id = row.id
- PostDataByName(this.requestParam).then(response => {
- if (response.msg === 'fail') {
- this.$notify({ title: '删除失败', message: response.data, type: 'warning', duration: 2000 })
- } else {
- this.$notify({ title: '成功', message: '删除成功', type: 'success', duration: 2000 })
- this.getList()
- }
- })
- }).catch(() => {
- this.$message({ type: 'info', message: '已取消删除' })
- })
- }
- }
- }
- </script>
- <style>
- .el-table .warning-row {
- background: oldlace;
- }
- .el-table .success-row {
- background: #f0f9eb;
- }
- </style>
- <style lang="scss" scoped>
- .app-container{background: #fff;}
- .operation{}
- .search{margin-top:10px;}
- .table{margin-bottom:20px;}
- .template{
- background: #fff;
- position: relative;
- }
- .table2{
- // float: left;width: 50%;
- background: #fff;
- position: relative;
- .content-table{margin-top: 20px;}
- .contentOperation{right: -50px;z-index: 1;}
- }
- .table3{
- // float: left;width: 50%;
- background: #fff;
- position: relative;
- .content-table{margin-top: 20px;}
- .contentOperation{right: -50px;z-index: 1;}
- }
- </style>
|