index.vue 178 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542
  1. <template>
  2. <div class="app-container">
  3. <div class="operation">
  4. <!-- 临时隐藏 -->
  5. <!-- <el-button v-if="isRoleEdit" class="successBorder" style="float: left;" @click="handleNutritional">营养评估</el-button> -->
  6. <!-- 临时隐藏 -->
  7. <div class="search">
  8. <el-select v-model="table.getdataListParm.parammaps.barid" clearable filterable placeholder="请选择栏舍" style="width: 180px;" class="filter-item">
  9. <el-option v-for="item in barList" :key="item.id" :label="item.bname" :value="item.id" />
  10. </el-select>
  11. <el-select v-model="table.getdataListParm.parammaps.tname" clearable filterable placeholder="请输入配方名称" style="width: 180px;" class="filter-item">
  12. <el-option v-for="(item,index) in tnameList" :key="index" :label="item.tname" :value="item.tname" />
  13. </el-select>
  14. <!-- <el-input v-model="table.getdataListParm.parammaps.tname" placeholder="请输入配方名称" style="width: 180px;" class="filter-item" /> -->
  15. <el-button class="successBorder" @click="form_search">查询</el-button>
  16. <el-button v-if="isRoleEdit" class="successBorder" @click="handleDryMatterRegulation">干物质调节</el-button>
  17. <el-button v-if="isRoleEdit && isSynchronous" class="successBorder" @click="handleSynchronous">软件牛头数同步</el-button>
  18. <el-button v-if="isRoleEdit && !isproportion" class="successBorder" @click="handle_batchEdit">批量编辑</el-button>
  19. <el-button v-if="isRoleEdit && isproportion" icon="el-icon-folder-checked" class="success" @click="handle_batchEdit_save">保存</el-button>
  20. <el-button v-if="isRoleEdit && isproportion" icon="el-icon-close" class="sortCancel" @click="cancelChangeEdit">取消</el-button>
  21. <el-upload style="float: right;" :headers="headers" :data="uploadData" :action="uploadExcelUrl" :show-file-list="false" :before-upload="beforeImport" :on-success="handleImportSuccess">
  22. <el-button v-if="isRoleEdit" class="import" icon="el-icon-download" style="float: right;">导入</el-button>
  23. </el-upload>
  24. <el-dropdown style="float: right;margin-right: 10px;">
  25. <el-button class="export" icon="el-icon-upload2">导出</el-button>
  26. <el-dropdown-menu slot="dropdown">
  27. <el-dropdown-item @click.native="handleExport(1)">导出模板</el-dropdown-item>
  28. <el-dropdown-item @click.native="handleExport(2)">导出数据</el-dropdown-item>
  29. </el-dropdown-menu>
  30. </el-dropdown>
  31. <el-button class="export" style="float: right;margin-right: 10px;" @click="handleHistoryRecords">历史记录</el-button>
  32. </div>
  33. </div>
  34. <div class="search" />
  35. <div class="table">
  36. <el-table
  37. :key="table.tableKey"
  38. ref="table"
  39. v-loading="table.listLoading"
  40. element-loading-text="给我一点时间"
  41. :data="table.list"
  42. border
  43. fit
  44. highlight-current-row
  45. style="width: 100%;"
  46. :row-style="rowStyle"
  47. :cell-style="cellStyle"
  48. class="elTable table-fixed"
  49. :max-height="myHeight"
  50. @header-click="headerClick"
  51. @selection-change="handleSelect"
  52. @cell-dblclick="celldblclick"
  53. >
  54. <el-table-column type="selection" width="40" />
  55. <el-table-column :key="1" label="序号" align="center" type="index" width="50px" class-name="small-padding fixed-width" fixed="left" />
  56. <el-table-column label="栏舍名称" min-width="60px" align="center" class-name="small-padding fixed-width" fixed="left">
  57. <template slot-scope="scope">
  58. <span>{{ scope.row.barname }}</span>
  59. </template>
  60. </el-table-column>
  61. <el-table-column :key="2" label="软件牛头数" min-width="60px" align="center">
  62. <template slot-scope="scope">
  63. <span>{{ scope.row.softccount }}</span>
  64. </template>
  65. </el-table-column>
  66. <el-table-column :key="3" label="实际牛头数" min-width="80px" align="center">
  67. <template slot-scope="scope">
  68. <span v-if="scope.row.NoEdit && !isproportion">{{ scope.row.ccount }}</span>
  69. <el-input v-if="scope.row.Edit || isproportion" v-model="scope.row.ccount" step="0.01" type="number" style="width:100%;padding:10px 0;" @blur="blurCcount(scope.row)" :placeholder="scope.row.placeholder_ccount" @focus="focusData(scope.row)" />
  70. </template>
  71. </el-table-column>
  72. <el-table-column :key="4" label="系数(%)" min-width="85px" align="center">
  73. <template slot-scope="scope">
  74. <span v-if="scope.row.NoEdit">{{ scope.row.ratio }}</span>
  75. <el-input v-if="scope.row.Edit" v-model="scope.row.ratio" step="0.01" type="number" style="width:100%;padding:10px 0;" @blur="blurRatio(scope.row)" :placeholder="scope.row.placeholder_ratio" />
  76. </template>
  77. </el-table-column>
  78. <el-table-column :key="5" label="系数头数" min-width="85px" align="center">
  79. <template slot-scope="scope">
  80. <span v-if="scope.row.NoEdit">{{ scope.row.ccountratio }}</span>
  81. <el-input v-if="scope.row.Edit" v-model="scope.row.ccountratio" type="number" style="width:100%;padding:10px 0;" @blur="blurCcountratio(scope.row)" :placeholder="scope.row.placeholder_ccountratio" />
  82. </template>
  83. </el-table-column>
  84. <el-table-column :key="6" label="配方模板" min-width="100px" align="center">
  85. <template slot-scope="scope">
  86. <span v-if="scope.row.NoEdit">{{ scope.row.ftname }}</span>
  87. <el-select v-if="scope.row.Edit" v-model="scope.row.ftid" filterable placeholder="配方模板" class="filter-item" style="width:99%;" @change="(value)=> {changeRecipeTemplate(value, scope.row)}">
  88. <el-option v-for="item in recipeTemplateList" :key="item.id" :label="item.tname" :value="item.id" />
  89. </el-select>
  90. </template>
  91. </el-table-column>
  92. <el-table-column v-if="table.isPtsfname" :key="7" label="补料配方" min-width="100px" align="center">
  93. <template slot-scope="scope">
  94. <span v-if="scope.row.NoEdit">{{ scope.row.ptsfname }}</span>
  95. <el-select v-if="scope.row.Edit" v-model="scope.row.ptsfid" clearable filterable placeholder="补料配方" class="filter-item" style="width:100%;padding:10px 0;" @change="(value)=> {changeFeedingFormula(value, scope.row)}">
  96. <el-option v-for="item in feedingFormulaList" :key="item.id" :label="item.tname" :value="item.id" />
  97. </el-select>
  98. </template>
  99. </el-table-column>
  100. <el-table-column v-if="table.isRW1" :key="8" label="第一班比例(%)" min-width="85px" align="center">
  101. <template slot-scope="scope">
  102. <span v-if="scope.row.NoEdit && !isproportion">{{ scope.row.r1 }}</span>
  103. <el-input v-if="scope.row.Edit || isproportion" v-model="scope.row.r1" :disabled="scope.row.isOneWeight" step="0.01" type="number" style="width:100%;padding:10px 0;" @blur="blurR(scope.row,1)" :placeholder="scope.row.placeholder_r1" @focus="focusData(scope.row)"/>
  104. </template>
  105. </el-table-column>
  106. <el-table-column v-if="table.isRW1" :key="9" label="第一班重量" min-width="100px" align="center" :render-header="renderHeader">
  107. <template slot-scope="scope">
  108. <span v-if="scope.row.NoEdit">{{ scope.row.w1 }}</span>
  109. <el-input v-if="scope.row.Edit" v-model="scope.row.w1" :disabled="scope.row.isOneWeight" step="0.01" type="number" style="width:100%;padding:10px 0;" @blur="blurWeight(scope.row,1)" :placeholder="scope.row.placeholder_w1" />
  110. </template>
  111. </el-table-column>
  112. <el-table-column v-if="table.isRW1 && table.isPtsfname" :key="10" label="第一班补料重量" min-width="100px" align="center">
  113. <template slot-scope="scope">
  114. <span v-if="scope.row.NoEdit && !isproportion">{{ scope.row.bw1 }}</span>
  115. <el-input v-if="scope.row.Edit" v-model="scope.row.bw1" :disabled="scope.row.ptsfid == '-1' || scope.row.ptsfid == ''" step="0.01" type="number" style="width:100%;padding:10px 0;" @blur="blurBw(scope.row)" :placeholder="scope.row.placeholder_bw1" />
  116. </template>
  117. </el-table-column>
  118. <el-table-column v-if="table.isRW2" :key="11" label="第二班比例(%)" min-width="85px" align="center">
  119. <template slot-scope="scope">
  120. <span v-if="scope.row.NoEdit && !isproportion">{{ scope.row.r2 }}</span>
  121. <el-input v-if="scope.row.Edit || isproportion" v-model="scope.row.r2" step="0.01" type="number" :disabled="scope.row.isTwoWeight" style="width:100%;padding:10px 0;" @blur="blurR(scope.row,2)" :placeholder="scope.row.placeholder_r2" @focus="focusData(scope.row)"/>
  122. </template>
  123. </el-table-column>
  124. <el-table-column v-if="table.isRW2" :key="12" label="第二班重量" min-width="100px" align="center" :render-header="renderHeader">
  125. <template slot-scope="scope">
  126. <span v-if="scope.row.NoEdit">{{ scope.row.w2 }}</span>
  127. <el-input v-if="scope.row.Edit" v-model="scope.row.w2" :disabled="scope.row.isTwoWeight" step="0.01" type="number" style="width:100%;padding:10px 0;" @blur="blurWeight(scope.row,2)" :placeholder="scope.row.placeholder_w2" />
  128. </template>
  129. </el-table-column>
  130. <el-table-column v-if="table.isRW2 && table.isPtsfname" :key="13" label="第二班补料重量" min-width="100px" align="center">
  131. <template slot-scope="scope">
  132. <span v-if="scope.row.NoEdit">{{ scope.row.bw2 }}</span>
  133. <el-input v-if="scope.row.Edit" v-model="scope.row.bw2" :disabled="scope.row.ptsfid == '-1' || scope.row.ptsfid == ''" step="0.01" type="number" style="width:100%;padding:10px 0;" @blur="blurBw(scope.row)" :placeholder="scope.row.placeholder_bw2" />
  134. </template>
  135. </el-table-column>
  136. <el-table-column v-if="table.isRW3" :key="14" label="第三班比例(%)" min-width="85px" align="center">
  137. <template slot-scope="scope">
  138. <span v-if="scope.row.NoEdit && !isproportion">{{ scope.row.r3 }}</span>
  139. <el-input v-if="scope.row.Edit || isproportion" v-model="scope.row.r3" step="0.01" type="number" :disabled="scope.row.isThreeWeight" style="width:100%;padding:10px 0;" @blur="blurR(scope.row,3)" :placeholder="scope.row.placeholder_r3" @focus="focusData(scope.row)"/>
  140. </template>
  141. </el-table-column>
  142. <el-table-column v-if="table.isRW3" :key="15" label="第三班重量" min-width="100px" align="center" :render-header="renderHeader">
  143. <template slot-scope="scope">
  144. <span v-if="scope.row.NoEdit">{{ scope.row.w3 }}</span>
  145. <el-input v-if="scope.row.Edit" v-model="scope.row.w3" :disabled="scope.row.isThreeWeight" step="0.01" type="number" style="width:100%;padding:10px 0;" @blur="blurWeight(scope.row,3)" :placeholder="scope.row.placeholder_w3" />
  146. </template>
  147. </el-table-column>
  148. <el-table-column v-if="table.isRW3 && table.isPtsfname" :key="16" label="第三班补料重量" min-width="100px" align="center">
  149. <template slot-scope="scope">
  150. <span v-if="scope.row.NoEdit">{{ scope.row.bw3 }}</span>
  151. <el-input v-if="scope.row.Edit" v-model="scope.row.bw3" :disabled="scope.row.ptsfid == '-1' || scope.row.ptsfid == ''" step="0.01" type="number" style="width:100%;padding:10px 0;" @blur="blurBw(scope.row)" :placeholder="scope.row.placeholder_bw3" />
  152. </template>
  153. </el-table-column>
  154. <el-table-column v-if="table.isRW4" :key="17" label="第四班比例(%)" min-width="85px" align="center">
  155. <template slot-scope="scope">
  156. <span v-if="scope.row.NoEdit && !isproportion">{{ scope.row.r4 }}</span>
  157. <el-input v-if="scope.row.Edit || isproportion" v-model="scope.row.r4" step="0.01" type="number" :disabled="scope.row.isFourWeight" style="width:100%;padding:10px 0;" @blur="blurR(scope.row,4)" :placeholder="scope.row.placeholder_r4" @focus="focusData(scope.row)"/>
  158. </template>
  159. </el-table-column>
  160. <el-table-column v-if="table.isRW4" :key="18" label="第四班重量" min-width="100px" align="center" :render-header="renderHeader">
  161. <template slot-scope="scope">
  162. <span v-if="scope.row.NoEdit">{{ scope.row.w4 }}</span>
  163. <el-input v-if="scope.row.Edit" v-model="scope.row.w4" :disabled="scope.row.isFourWeight" step="0.01" type="number" style="width:100%;padding:10px 0;padding:10px 0;" @blur="blurWeight(scope.row,4)" :placeholder="scope.row.placeholder_w4" />
  164. </template>
  165. </el-table-column>
  166. <el-table-column v-if="table.isRW4 && table.isPtsfname" :key="19" label="第四班补料重量" min-width="90px" align="center">
  167. <template slot-scope="scope">
  168. <span v-if="scope.row.NoEdit">{{ scope.row.bw4 }}</span>
  169. <el-input v-if="scope.row.Edit" v-model="scope.row.bw4" :disabled="scope.row.ptsfid == '-1' || scope.row.ptsfid == ''" step="0.01" type="number" style="width:100%;padding:10px 0;" @blur="blurBw(scope.row)" :placeholder="scope.row.placeholder_bw4" />
  170. </template>
  171. </el-table-column>
  172. <el-table-column v-if="table.isRW5" :key="20" label="第五班比例(%)" min-width="85px" align="center">
  173. <template slot-scope="scope">
  174. <span v-if="scope.row.NoEdit && !isproportion">{{ scope.row.r5 }}</span>
  175. <el-input v-if="scope.row.Edit || isproportion" v-model="scope.row.r5" step="0.01" type="number" :disabled="scope.row.isFiveWeight" style="width:100%;padding:10px 0;" @blur="blurR(scope.row,5)" :placeholder="scope.row.placeholder_r5" @focus="focusData(scope.row)"/>
  176. </template>
  177. </el-table-column>
  178. <el-table-column v-if="table.isRW5" :key="21" label="第五班重量" min-width="100px" align="center" :render-header="renderHeader">
  179. <template slot-scope="scope">
  180. <span v-if="scope.row.NoEdit">{{ scope.row.w5 }}</span>
  181. <el-input v-if="scope.row.Edit" v-model="scope.row.w5" :disabled="scope.row.isFiveWeight" step="0.01" type="number" style="width:100%;padding:10px 0;padding:10px 0;" @blur="blurWeight(scope.row,5)" :placeholder="scope.row.placeholder_w5" />
  182. </template>
  183. </el-table-column>
  184. <el-table-column v-if="table.isRW5 && table.isPtsfname" :key="22" label="第五班补料重量" min-width="90px" align="center">
  185. <template slot-scope="scope">
  186. <span v-if="scope.row.NoEdit">{{ scope.row.bw5 }}</span>
  187. <el-input v-if="scope.row.Edit" v-model="scope.row.bw5" :disabled="scope.row.ptsfid == '-1' || scope.row.ptsfid == ''" step="0.01" type="number" style="width:100%;padding:10px 0;" @blur="blurBw(scope.row)" :placeholder="scope.row.placeholder_bw5" />
  188. </template>
  189. </el-table-column>
  190. <el-table-column v-if="table.isRW6" :key="23" label="第六班比例(%)" min-width="85px" align="center">
  191. <template slot-scope="scope">
  192. <span v-if="scope.row.NoEdit && !isproportion">{{ scope.row.r6 }}</span>
  193. <el-input v-if="scope.row.Edit || isproportion" v-model="scope.row.r6" step="0.01" type="number" :disabled="scope.row.isSixWeight" style="width:100%;padding:10px 0;" @blur="blurR(scope.row,6)" :placeholder="scope.row.placeholder_r6" @focus="focusData(scope.row)"/>
  194. </template>
  195. </el-table-column>
  196. <el-table-column v-if="table.isRW6" :key="24" label="第六班重量" min-width="100px" align="center" :render-header="renderHeader">
  197. <template slot-scope="scope">
  198. <span v-if="scope.row.NoEdit">{{ scope.row.w6 }}</span>
  199. <el-input v-if="scope.row.Edit" v-model="scope.row.w6" :disabled="scope.row.isSixWeight" step="0.01" type="number" style="width:100%;padding:10px 0;padding:10px 0;" @blur="blurWeight(scope.row,6)" :placeholder="scope.row.placeholder_w6" />
  200. </template>
  201. </el-table-column>
  202. <el-table-column v-if="table.isRW6 && table.isPtsfname" :key="25" label="第六班补料重量" min-width="90px" align="center">
  203. <template slot-scope="scope">
  204. <span v-if="scope.row.NoEdit">{{ scope.row.bw6 }}</span>
  205. <el-input v-if="scope.row.Edit" v-model="scope.row.bw6" :disabled="scope.row.ptsfid == '-1' || scope.row.ptsfid == ''" step="0.01" type="number" style="width:100%;padding:10px 0;" @blur="blurBw(scope.row)" :placeholder="scope.row.placeholder_bw6" />
  206. </template>
  207. </el-table-column>
  208. <el-table-column :key="26" label="饲喂总比例(%)" min-width="60px" align="center">
  209. <template slot-scope="scope">
  210. <span>{{ scope.row.sumr }}</span>
  211. </template>
  212. </el-table-column>
  213. <el-table-column :key="27" label="饲喂投喂量" min-width="60px" align="center">
  214. <template slot-scope="scope">
  215. <span>{{ scope.row.todayweight }}</span>
  216. </template>
  217. </el-table-column>
  218. <el-table-column :key="28" label="饲喂配方重量" min-width="60px" align="center">
  219. <template slot-scope="scope">
  220. <span>{{ scope.row.ftweight }}</span>
  221. </template>
  222. </el-table-column>
  223. <el-table-column v-if="table.isPtsfname" :key="29" label="补料配方重量" min-width="60px" align="center">
  224. <template slot-scope="scope">
  225. <span>{{ scope.row.supplyweight }}</span>
  226. </template>
  227. </el-table-column>
  228. <!-- <el-table-column :key="22" label="投喂量" min-width="80px" align="center">
  229. <template slot-scope="scope">
  230. <span>{{ scope.row.feedweight }}</span>
  231. </template>
  232. </el-table-column> -->
  233. <el-table-column v-if="table.isPtsfname" :key="30" label="补料投喂量" min-width="60px" align="center">
  234. <template slot-scope="scope">
  235. <span>{{ scope.row.todaysupplement }}</span>
  236. </template>
  237. </el-table-column>
  238. <el-table-column :key="31" label="日投喂量" min-width="60px" align="center">
  239. <template slot-scope="scope">
  240. <span>{{ scope.row.todayfeed }}</span>
  241. </template>
  242. </el-table-column>
  243. <el-table-column :key="32" label="配方干物质" min-width="60px" align="center">
  244. <template slot-scope="scope">
  245. <span>{{ scope.row.dryweight }}</span>
  246. </template>
  247. </el-table-column>
  248. <el-table-column label="操作" align="center" width="80" class-name="small-padding fixed-width" fixed="right">
  249. <template slot-scope="{row}">
  250. <el-button v-if="row.isUpdate && isRoleEdit" :disabled="isproportion" class="miniSuccess" icon="el-icon-edit-outline" @click="handleUpdate(row)" />
  251. <el-button v-if="row.isUpdateSave && isRoleEdit" :disabled="isokDisable" icon="el-icon-folder-checked" class="miniSuccess" @click="updateData(row)" />
  252. <span v-if="row.isUpdateSave && isRoleEdit" class="centerSpan">|</span>
  253. <el-button v-if="row.isUpdateSave && isRoleEdit" class="minCancel" icon="el-icon-close" @click="updateCancel(row)" />
  254. </template>
  255. </el-table-column>
  256. </el-table>
  257. <!-- <pagination v-show="table.total>=0" :total="table.total" :page.sync="table.getdataListParm.offset" :limit.sync="table.getdataListParm.pagecount" @pagination="getList" /> -->
  258. </div>
  259. <!-- 历史记录 -->
  260. <el-dialog :fullscreen="dialogFull" :destroy-on-close="true" :visible.sync="history.dialogFormVisible" :close-on-click-modal="false" width="90%">
  261. <template slot="title">
  262. <div class="avue-crud__dialog__header">
  263. <span class="el-dialog__title">
  264. <span style="display:inline-block;width:3px;height:20px;margin-right:5px; float: left;margin-top:2px" />
  265. {{ textMap[history.dialogStatus] }}
  266. </span>
  267. <div class="avue-crud__dialog__menu" @click="dialogFull? dialogFull=false: dialogFull=true">
  268. <svg-icon v-if="dialogFull" icon-class="exit-fullscreen" />
  269. <svg-icon v-else icon-class="fullscreen" />
  270. </div>
  271. </div>
  272. </template>
  273. <div class="app-history">
  274. <div class="search">
  275. <el-date-picker v-model="history.getdataListParm.parammaps.date" type="date" placeholder="请选择历史记录时间" :clearable="false" style="width: 180px;" format="yyyy-MM-dd" value-format="yyyy-MM-dd" @change="changeDate" />
  276. <el-select v-model="history.getdataListParm.parammaps.barName" clearable filterable placeholder="请选择栏舍" style="width: 180px;" class="filter-item">
  277. <el-option v-for="item in barList" :key="item.id" :label="item.bname" :value="item.bname" />
  278. </el-select>
  279. <!-- <el-input v-model="history.getdataListParm.parammaps.tname" placeholder="请输入配方名称" style="width: 180px;" class="filter-item" /> -->
  280. <el-button class="successBorder" @click="handleHistorySearch">查询</el-button>
  281. <el-button class="export" icon="el-icon-upload2" @click="handleExport(3)">导出</el-button>
  282. </div>
  283. <div class="table">
  284. <u-table
  285. :key="history.tableKey"
  286. v-loading="history.listLoading"
  287. element-loading-text="给我一点时间"
  288. :data="history.list"
  289. border
  290. fit
  291. highlight-current-row
  292. style="width: 100%;"
  293. :row-style="rowStyle"
  294. :cell-style="cellStyle"
  295. class="elTable table-fixed"
  296. :span-method="objectSpanMethod"
  297. :max-height="500"
  298. >
  299. <u-table-column :key="1" label="序号" align="center" type="index" width="50px" class-name="small-padding fixed-width" fixed="left" />
  300. <!-- <u-table-column :key="1" label="序号" align="center" type="index" width="50px" class-name="small-padding fixed-width" fixed="left">
  301. <template slot-scope="scope">
  302. <span>{{ scope.$index + (history.pageNum-1) * history.pageSize + 1 }}</span>
  303. </template>
  304. </u-table-column> -->
  305. <u-table-column :key="2" label="栏舍名称" prop="barname" min-width="90px" align="center" class-name="small-padding fixed-width" fixed="left" />
  306. <u-table-column :key="3" label="班次" prop="times" min-width="90px" align="center" class-name="small-padding fixed-width" fixed="left" />
  307. <u-table-column :key="4" label="软件牛头数" prop="softccount" min-width="70px" align="center" />
  308. <u-table-column :key="5" label="实际牛头数" prop="ccount" min-width="70px" align="center" />
  309. <u-table-column :key="6" label="系数(%)" prop="ratio" min-width="70px" align="center" />
  310. <u-table-column :key="7" label="系数头数" prop="ccountratio" min-width="70px" align="center" />
  311. <u-table-column :key="8" label="配方模板" prop="ptname" min-width="70px" align="center" />
  312. <u-table-column v-if="table.isPtsfname" :key="9" label="补料配方" prop="ptsname" min-width="70px" align="center" />
  313. <u-table-column :key="10" label="班次比例" prop="tratio" min-width="70px" align="center" />
  314. <u-table-column :key="11" label="班次重量" prop="weight" min-width="70px" align="center" />
  315. <u-table-column :key="12" label="配方重量" prop="pweight" min-width="70px" align="center" />
  316. <u-table-column v-if="table.isPtsfname" :key="13" label="补料重量" prop="ptweight" min-width="70px" align="center" />
  317. <u-table-column :key="14" label="配方干物质量" prop="dryweight" min-width="70px" align="center" />
  318. <u-table-column :key="15" label="饲喂干物质量" prop="swdryw" min-width="70px" align="center" />
  319. <u-table-column :key="16" label="采样干物质量" prop="cydryw" min-width="70px" align="center" />
  320. <u-table-column :key="17" label="日投喂量" prop="sumweight" min-width="70px" align="center" />
  321. <u-table-column :key="18" label="操作" prop="sumweight" align="center" width="80" class-name="small-padding fixed-width" fixed="right">
  322. <template slot-scope="scope">
  323. <span style="color: blue;" @click="handleRestore(scope.row)">恢复</span>
  324. </template>
  325. </u-table-column>
  326. </u-table>
  327. <!-- <pagination2 v-show="history.total>0" :total="history.total" :page.sync="history.getdataListParm.offset" :limit.sync="history.getdataListParm.pagecount" @pagination="getHistoryList" /> -->
  328. </div>
  329. </div>
  330. <div slot="footer" class="dialog-footer" style="bottom: 10px;">
  331. <el-button class="cancelClose cancelClose1" @click="history.dialogFormVisible = false;getList() ">关闭</el-button>
  332. </div>
  333. </el-dialog>
  334. <!-- 营养评估 -->
  335. <el-dialog :fullscreen="dialogFull" :visible.sync="nutritional.dialogFormVisible" :close-on-click-modal="false" width="90%">
  336. <template slot="title">
  337. <div class="avue-crud__dialog__header">
  338. <span class="el-dialog__title">
  339. <span style="display:inline-block;width:3px;height:20px;margin-right:5px; float: left;margin-top:2px" />
  340. {{ textMap[nutritional.dialogStatus] }}
  341. </span>
  342. <div class="avue-crud__dialog__menu" @click="dialogFull? dialogFull=false: dialogFull=true">
  343. <svg-icon v-if="dialogFull" icon-class="exit-fullscreen" />
  344. <svg-icon v-else icon-class="fullscreen" />
  345. </div>
  346. </div>
  347. </template>
  348. <div class="app-nutritional">
  349. <h4 style="position: absolute;top:-5px;left:140px;font:16px/30px '' ;color:#303133;">栏舍:{{ nutritional.tab1.temp.barname }}</h4>
  350. <el-tabs v-model="nutritional.activeName" @tab-click="handleNutritionalTab">
  351. <el-tab-pane label="营养评估" name="first">
  352. <el-form ref="temp" :rules="rules" :model="nutritional.tab1.temp" label-position="right" label-width="95px" style="width: 100%;margin-bottom:30px">
  353. <el-row>
  354. <el-col :span="4">
  355. <el-form-item label="类别" prop="cowclassid">
  356. <el-select v-model="nutritional.tab1.temp.cowclassid" :disabled="nutritional.tab1.disabledCowclass" filterable placeholder="" class="filter-item" style="width:100%;">
  357. <el-option v-for="item in livestockTypeList" :key="item.id" :label="item.mixname" :value="item.id" />
  358. </el-select>
  359. </el-form-item>
  360. </el-col>
  361. <el-col :span="4">
  362. <el-form-item label="月龄" prop="avgmonthage">
  363. <el-input ref="avgmonthage" v-model="nutritional.tab1.temp.avgmonthage" class="filter-item" placeholder="" style="width:100%;" />
  364. </el-form-item>
  365. </el-col>
  366. <el-col :span="4">
  367. <el-form-item label="体重(kg)" prop="bw">
  368. <el-input ref="bw" v-model="nutritional.tab1.temp.bw" class="filter-item" placeholder="" style="width:100%;" />
  369. </el-form-item>
  370. </el-col>
  371. <el-col :span="4">
  372. <el-form-item label="日增重(kg)" prop="dayw">
  373. <el-input ref="dayw" v-model="nutritional.tab1.temp.dayw" class="filter-item" placeholder="" style="width:100%;" />
  374. </el-form-item>
  375. </el-col>
  376. <el-col :span="4">
  377. <el-form-item label="胎次(次)" prop="fetal">
  378. <el-input ref="fetal" v-model="nutritional.tab1.temp.fetal" class="filter-item" placeholder="" style="width:100%;" />
  379. </el-form-item>
  380. </el-col>
  381. <el-col :span="4">
  382. <el-form-item label="泌乳天数(天)" prop="avgdim">
  383. <el-input ref="avgdim" v-model="nutritional.tab1.temp.avgdim" class="filter-item" placeholder="" style="width:100%;" />
  384. </el-form-item>
  385. </el-col>
  386. </el-row>
  387. <el-row>
  388. <el-col :span="4">
  389. <el-form-item label="怀孕天数(天)" prop="dayspre">
  390. <el-input ref="dayspre" v-model="nutritional.tab1.temp.dayspre" class="filter-item" placeholder="" style="width:100%;" />
  391. </el-form-item>
  392. </el-col>
  393. <el-col :span="4">
  394. <el-form-item label="产奶量(kg)" prop="product">
  395. <el-input ref="product" v-model="nutritional.tab1.temp.product" class="filter-item" placeholder="" style="width:100%;" />
  396. </el-form-item>
  397. </el-col>
  398. <el-col :span="4">
  399. <el-form-item label="乳脂率(%)" prop="fat">
  400. <el-input ref="fat" v-model="nutritional.tab1.temp.fat" class="filter-item" placeholder="" style="width:100%;" />
  401. </el-form-item>
  402. </el-col>
  403. <el-col :span="4">
  404. <el-form-item label="乳蛋白率(%)" prop="pro">
  405. <el-input ref="pro" v-model="nutritional.tab1.temp.pro" class="filter-item" placeholder="" style="width:100%;" />
  406. </el-form-item>
  407. </el-col>
  408. <el-col :span="4">
  409. <el-form-item label="乳糖率(%)" prop="lactose">
  410. <el-input ref="lactose" v-model="nutritional.tab1.temp.lactose" class="filter-item" placeholder="" style="width:100%;" />
  411. </el-form-item>
  412. </el-col>
  413. <el-col :span="4">
  414. <el-form-item label="温度(℃)" prop="tem">
  415. <el-input ref="tem" v-model="nutritional.tab1.temp.tem" class="filter-item" placeholder="" style="width:100%;" />
  416. </el-form-item>
  417. </el-col>
  418. </el-row>
  419. </el-form>
  420. <div style="height: 50px;">
  421. <el-date-picker v-model="nutritional.tab1.inputDatetime" :picker-options="pickerOptions" class="inputDatetime filter-item" :clearable="false" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" style="width: 250px;margin-right: 10px;" />
  422. <el-button class="el-icon-arrow-left elIconArrowLeft" @click="handleBefore" />
  423. <el-button class="el-icon-arrow-right elIconArrowRight" @click="handleNext" />
  424. <el-button class="successBorder" :disabled="isokDisable" @click="assessmentData()">评估</el-button>
  425. </div>
  426. <div class="table">
  427. <el-table
  428. :key="nutritional.tab1.tableKey"
  429. v-loading="nutritional.tab1.listLoading"
  430. element-loading-text="给我一点时间"
  431. :data="nutritional.tab1.list"
  432. border
  433. fit
  434. highlight-current-row
  435. style="width: 100%;margin-bottom:60px;"
  436. :row-style="rowStyle"
  437. :cell-style="cellStyle"
  438. class="elTable table-fixed"
  439. :row-class-name="tableRowClassName"
  440. >
  441. <el-table-column label="序号" align="center" type="index" width="50px" />
  442. <el-table-column label="指标" min-width="130px" align="center">
  443. <template slot-scope="scope">
  444. <span>{{ scope.row.standard }}</span>
  445. </template>
  446. </el-table-column>
  447. <el-table-column label="奶牛需要" min-width="130px" align="center">
  448. <template slot-scope="scope">
  449. <span>{{ scope.row.cowneed }}</span>
  450. </template>
  451. </el-table-column>
  452. <el-table-column label="配方量" min-width="130px" align="center">
  453. <template slot-scope="scope">
  454. <span>{{ scope.row.ftpro }}</span>
  455. </template>
  456. </el-table-column>
  457. <el-table-column label="TMR料" min-width="130px" align="center">
  458. <template slot-scope="scope">
  459. <span>{{ scope.row.hprov }}</span>
  460. </template>
  461. </el-table-column>
  462. <el-table-column label="采食量" min-width="130px" align="center">
  463. <template slot-scope="scope">
  464. <span>{{ scope.row.sprov }}</span>
  465. </template>
  466. </el-table-column>
  467. </el-table>
  468. </div>
  469. </el-tab-pane>
  470. <el-tab-pane label="牛群评估" name="second">
  471. <el-date-picker v-model="nutritional.tab2.inputDatetime" :picker-options="pickerOptions" :clearable="false" class="inputDatetime filter-item" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" style="width: 250px;margin-right: 10px;" @change="changeTab2Date" />
  472. <el-button class="el-icon-arrow-left elIconArrowLeft" @click="handleBefore" />
  473. <el-button class="el-icon-arrow-right elIconArrowRight" @click="handleNext" />
  474. <el-row>
  475. <el-col :span="24">
  476. <h3 style="text-align: center;">宾州筛分析</h3>
  477. <div class="table">
  478. <el-table
  479. :key="nutritional.tab2.tableKey1"
  480. v-loading="nutritional.tab2.listLoading1"
  481. element-loading-text="给我一点时间"
  482. :data="nutritional.tab2.list1"
  483. border
  484. fit
  485. highlight-current-row
  486. style="width: 100%;margin-bottom:60px;"
  487. :row-style="rowStyle"
  488. :cell-style="cellStyle"
  489. class="elTable table-fixed"
  490. >
  491. <el-table-column label="日期" min-width="130px" align="center">
  492. <template slot-scope="scope">
  493. <span>{{ scope.row.operatetime }}</span>
  494. </template>
  495. </el-table-column>
  496. <el-table-column label="第一层重量(g)" min-width="130px" align="center">
  497. <template slot-scope="scope">
  498. <span>{{ scope.row.oneweight }}</span>
  499. </template>
  500. </el-table-column>
  501. <el-table-column label="第一层百分比" min-width="130px" align="center">
  502. <template slot-scope="scope">
  503. <span>{{ scope.row.onerate }}</span>
  504. </template>
  505. </el-table-column>
  506. <el-table-column label="第二层重量(g)" min-width="130px" align="center">
  507. <template slot-scope="scope">
  508. <span>{{ scope.row.twoweight }}</span>
  509. </template>
  510. </el-table-column>
  511. <el-table-column label="第二层百分比" min-width="130px" align="center">
  512. <template slot-scope="scope">
  513. <span>{{ scope.row.tworate }}</span>
  514. </template>
  515. </el-table-column>
  516. <el-table-column label="第三层重量(g)" min-width="130px" align="center">
  517. <template slot-scope="scope">
  518. <span>{{ scope.row.threeweight }}</span>
  519. </template>
  520. </el-table-column>
  521. <el-table-column label="第三层百分比" min-width="130px" align="center">
  522. <template slot-scope="scope">
  523. <span>{{ scope.row.threerate }}</span>
  524. </template>
  525. </el-table-column>
  526. <el-table-column label="第四层重量(g)" min-width="130px" align="center">
  527. <template slot-scope="scope">
  528. <span>{{ scope.row.fourweight }}</span>
  529. </template>
  530. </el-table-column>
  531. <el-table-column label="第四层百分比" min-width="130px" align="center">
  532. <template slot-scope="scope">
  533. <span>{{ scope.row.fourrate }}</span>
  534. </template>
  535. </el-table-column>
  536. <el-table-column label="参考标准" min-width="130px" align="center">
  537. <template slot-scope="scope">
  538. <span>{{ scope.row.standard }}</span>
  539. </template>
  540. </el-table-column>
  541. </el-table>
  542. </div>
  543. </el-col>
  544. </el-row>
  545. <el-row>
  546. <el-col :span="24">
  547. <h3 style="text-align: center;">粪便筛分析</h3>
  548. <div class="table">
  549. <el-table
  550. :key="nutritional.tab2.tableKey2"
  551. v-loading="nutritional.tab2.listLoading2"
  552. element-loading-text="给我一点时间"
  553. :data="nutritional.tab2.list2"
  554. border
  555. fit
  556. highlight-current-row
  557. style="width: 100%;margin-bottom:60px;"
  558. :row-style="rowStyle"
  559. :cell-style="cellStyle"
  560. class="elTable table-fixed"
  561. >
  562. <el-table-column label="日期" min-width="130px" align="center">
  563. <template slot-scope="scope">
  564. <span>{{ scope.row.operatetime }}</span>
  565. </template>
  566. </el-table-column>
  567. <el-table-column label="第一层重量(g)" min-width="130px" align="center">
  568. <template slot-scope="scope">
  569. <span>{{ scope.row.oneweight }}</span>
  570. </template>
  571. </el-table-column>
  572. <el-table-column label="第一层百分比" min-width="130px" align="center">
  573. <template slot-scope="scope">
  574. <span>{{ scope.row.onerate }}</span>
  575. </template>
  576. </el-table-column>
  577. <el-table-column label="第二层重量(g)" min-width="130px" align="center">
  578. <template slot-scope="scope">
  579. <span>{{ scope.row.twoweight }}</span>
  580. </template>
  581. </el-table-column>
  582. <el-table-column label="第二层百分比" min-width="130px" align="center">
  583. <template slot-scope="scope">
  584. <span>{{ scope.row.tworate }}</span>
  585. </template>
  586. </el-table-column>
  587. <el-table-column label="第三层重量(g)" min-width="130px" align="center">
  588. <template slot-scope="scope">
  589. <span>{{ scope.row.threeweight }}</span>
  590. </template>
  591. </el-table-column>
  592. <el-table-column label="第三层百分比" min-width="130px" align="center">
  593. <template slot-scope="scope">
  594. <span>{{ scope.row.threerate }}</span>
  595. </template>
  596. </el-table-column>
  597. <el-table-column label="参考标准" min-width="130px" align="center">
  598. <template slot-scope="scope">
  599. <span>{{ scope.row.standard }}</span>
  600. </template>
  601. </el-table-column>
  602. </el-table>
  603. </div>
  604. </el-col>
  605. </el-row>
  606. <el-row>
  607. <el-col :span="24">
  608. <h3 style="text-align: center;">BCS评分</h3>
  609. <div class="table">
  610. <el-table
  611. :key="nutritional.tab2.tableKey3"
  612. v-loading="nutritional.tab2.listLoading3"
  613. element-loading-text="给我一点时间"
  614. :data="nutritional.tab2.list3"
  615. border
  616. fit
  617. highlight-current-row
  618. style="width: 100%;margin-bottom:60px;"
  619. :row-style="rowStyle"
  620. :cell-style="cellStyle"
  621. class="elTable table-fixed"
  622. >
  623. <el-table-column label="日期" min-width="130px" align="center">
  624. <template slot-scope="scope">
  625. <span>{{ scope.row.operatetime }}</span>
  626. </template>
  627. </el-table-column>
  628. <el-table-column label="抽查样本数" min-width="130px" align="center">
  629. <template slot-scope="scope">
  630. <span>{{ scope.row.sumcowcount }}</span>
  631. </template>
  632. </el-table-column>
  633. <el-table-column label="单产(kg/头)" min-width="130px" align="center">
  634. <template slot-scope="scope">
  635. <span>{{ scope.row.product }}</span>
  636. </template>
  637. </el-table-column>
  638. <el-table-column label="干物质采食量(kg/头)" min-width="130px" align="center">
  639. <template slot-scope="scope">
  640. <span>{{ scope.row.cowneed }}</span>
  641. </template>
  642. </el-table-column>
  643. <el-table-column label="泌乳天数" min-width="130px" align="center">
  644. <template slot-scope="scope">
  645. <span>{{ scope.row.avgdim }}</span>
  646. </template>
  647. </el-table-column>
  648. <el-table-column label="标准分数" min-width="130px" align="center">
  649. <template slot-scope="scope">
  650. <span>{{ scope.row.standardscore }}</span>
  651. </template>
  652. </el-table-column>
  653. <el-table-column label="2.75-分(数量、百分比)" min-width="130px" align="center">
  654. <template slot-scope="scope">
  655. <span>{{ scope.row.score25 }}({{ scope.row.score25rate }}%)</span>
  656. </template>
  657. </el-table-column>
  658. <el-table-column label="2.75分(数量、百分比)" min-width="130px" align="center">
  659. <template slot-scope="scope">
  660. <span>{{ scope.row.score275 }}({{ scope.row.score275rate }}%)</span>
  661. </template>
  662. </el-table-column>
  663. <el-table-column label="3分(数量、百分比)" min-width="130px" align="center">
  664. <template slot-scope="scope">
  665. <span>{{ scope.row.score3 }}({{ scope.row.score3rate }}%)</span>
  666. </template>
  667. </el-table-column>
  668. <el-table-column label="3.25分(数量、百分比)" min-width="130px" align="center">
  669. <template slot-scope="scope">
  670. <span>{{ scope.row.score325 }}({{ scope.row.score325rate }}%)</span>
  671. </template>
  672. </el-table-column>
  673. <el-table-column label="3.5分(数量、百分比)" min-width="130px" align="center">
  674. <template slot-scope="scope">
  675. <span>{{ scope.row.score35 }}({{ scope.row.score35rate }}%)</span>
  676. </template>
  677. </el-table-column>
  678. <el-table-column label="3.75分(数量、百分比)" min-width="130px" align="center">
  679. <template slot-scope="scope">
  680. <span>{{ scope.row.score375 }}({{ scope.row.score375rate }}%)</span>
  681. </template>
  682. </el-table-column>
  683. <el-table-column label="4+分(数量、百分比)" min-width="130px" align="center">
  684. <template slot-scope="scope">
  685. <span>{{ scope.row.score4 }}({{ scope.row.score4rate }}%)</span>
  686. </template>
  687. </el-table-column>
  688. </el-table>
  689. </div>
  690. </el-col>
  691. </el-row>
  692. <el-row>
  693. <el-col :span="24">
  694. <h3 style="text-align: center;">粪便评分</h3>
  695. <div class="table">
  696. <el-table
  697. :key="nutritional.tab2.tableKey4"
  698. v-loading="nutritional.tab2.listLoading4"
  699. element-loading-text="给我一点时间"
  700. :data="nutritional.tab2.list4"
  701. border
  702. fit
  703. highlight-current-row
  704. style="width: 100%;margin-bottom:60px;"
  705. :row-style="rowStyle"
  706. :cell-style="cellStyle"
  707. class="elTable table-fixed"
  708. >
  709. <el-table-column label="日期" min-width="130px" align="center">
  710. <template slot-scope="scope">
  711. <span>{{ scope.row.operatetime }}</span>
  712. </template>
  713. </el-table-column>
  714. <el-table-column label="抽查样本数" min-width="130px" align="center">
  715. <template slot-scope="scope">
  716. <span>{{ scope.row.sumcowcount }}</span>
  717. </template>
  718. </el-table-column>
  719. <el-table-column label="单产(kg/头)" min-width="130px" align="center">
  720. <template slot-scope="scope">
  721. <span>{{ scope.row.product }}</span>
  722. </template>
  723. </el-table-column>
  724. <el-table-column label="干物质采食量(kg/头)" min-width="130px" align="center">
  725. <template slot-scope="scope">
  726. <span>{{ scope.row.cowneed }}</span>
  727. </template>
  728. </el-table-column>
  729. <el-table-column label="泌乳天数" min-width="130px" align="center">
  730. <template slot-scope="scope">
  731. <span>{{ scope.row.avgdim }}</span>
  732. </template>
  733. </el-table-column>
  734. <el-table-column label="标准分数" min-width="130px" align="center">
  735. <template slot-scope="scope">
  736. <span>{{ scope.row.cowneed }}</span>
  737. </template>
  738. </el-table-column>
  739. <el-table-column label="1分(数量、百分比)" min-width="130px" align="center">
  740. <template slot-scope="scope">
  741. <span>{{ scope.row.score1 }}({{ scope.row.score1rate }}%)</span>
  742. </template>
  743. </el-table-column>
  744. <el-table-column label="2分(数量、百分比)" min-width="130px" align="center">
  745. <template slot-scope="scope">
  746. <span>{{ scope.row.score2 }}({{ scope.row.score2rate }}%)</span>
  747. </template>
  748. </el-table-column>
  749. <el-table-column label="3分(数量、百分比)" min-width="130px" align="center">
  750. <template slot-scope="scope">
  751. <span>{{ scope.row.score3 }}({{ scope.row.score3rate }}%)</span>
  752. </template>
  753. </el-table-column>
  754. <el-table-column label="4分(数量、百分比)" min-width="130px" align="center">
  755. <template slot-scope="scope">
  756. <span>{{ scope.row.score4 }}({{ scope.row.score4rate }}%)</span>
  757. </template>
  758. </el-table-column>
  759. <el-table-column label="5分(数量、百分比)" min-width="130px" align="center">
  760. <template slot-scope="scope">
  761. <span>{{ scope.row.score5 }}({{ scope.row.score5rate }}%)</span>
  762. </template>
  763. </el-table-column>
  764. </el-table>
  765. </div>
  766. </el-col>
  767. </el-row>
  768. </el-tab-pane>
  769. </el-tabs>
  770. <div slot="footer" class="dialog-footer">
  771. <el-button class="cancelClose cancelClose1" @click="nutritional.dialogFormVisible = false; ">关闭</el-button>
  772. </div>
  773. </div>
  774. </el-dialog>
  775. <!-- 干物质调节 -->
  776. <DryMatterRegulation ref="mychild" :show.sync="isShowDialog" @getIsDisplay="getIsDisplay" />
  777. </div>
  778. </template>
  779. <script>
  780. import { GetDataByName, postJson, GetDataByNames, compareSort, ExecDataByConfig, failproccess, PostDataByName, formatNum, checkButtons } from '@/api/common'
  781. import Pagination from '@/components/Pagination'
  782. import Pagination2 from '@/components/Pagination2'
  783. import { parseTime, json2excel, handleTableSpan, handleObjectSpanMethod } from '@/utils/index.js'
  784. import { MessageBox } from 'element-ui'
  785. import Cookies from 'js-cookie'
  786. import axios from 'axios'
  787. import { getToken } from '@/utils/auth'
  788. import DryMatterRegulation from './dryMatterRegulation.vue'
  789. export default {
  790. inject: ['reload'],
  791. name: 'DhedFormula',
  792. components: { Pagination, Pagination2, DryMatterRegulation },
  793. data() {
  794. return {
  795. isproportion:false,
  796. dialogFull: false,
  797. isRoleEdit: [],
  798. isSynchronous:[],
  799. headerList: [],
  800. pickerMinDate: '',
  801. pickerOptions: {
  802. onPick: ({ maxDate, minDate }) => {
  803. this.pickerMinDate = minDate.getTime()
  804. if (maxDate) {
  805. this.pickerMinDate = ''
  806. }
  807. },
  808. // 限制不能选择今天之后的日期
  809. disabledDate: (time) => {
  810. if (this.pickerMinDate !== '') {
  811. const one = 31 * 24 * 3600 * 1000
  812. const minTime = this.pickerMinDate - one
  813. let maxTime = this.pickerMinDate + one
  814. if (maxTime > new Date()) {
  815. maxTime = new Date()
  816. }
  817. return time.getTime() < minTime - 8.64e7 || time.getTime() > maxTime - 8.64e7
  818. }
  819. return time.getTime() > Date.now() - 8.64e7
  820. }
  821. },
  822. requestParams: [
  823. { name: 'getFTSWLSList', offset: 0, pagecount: 0, parammaps: { pastureid: Cookies.get('pastureid') }},
  824. { name: 'getFTBLList', offset: 0, pagecount: 0, parammaps: { pastureid: Cookies.get('pastureid') }},
  825. { name: 'getCowclassListEnable', offset: 0, pagecount: 0, parammaps: { pastureid: Cookies.get('pastureid') }},
  826. { name: 'getBarListEnable', offset: 0, pagecount: 0, parammaps: { pastureid: Cookies.get('pastureid') }},
  827. { name: 'getSysoptEnable', offset: 0, pagecount: 0, parammaps: { pastureid: Cookies.get('pastureid'),"inforname":"udFeedpSync" }}
  828. ],
  829. getFeedTempletNameListParm: {
  830. name: 'getFeedTempletName',
  831. page: 1,
  832. offset: 1,
  833. // pagecount: parseInt(Cookies.get('pageCount')),
  834. pagecount: '',
  835. returntype: 'Map',
  836. parammaps: {
  837. pastureid: Cookies.get('pastureid')
  838. }
  839. },
  840. tnameList: [], // 配方名 称
  841. recipeTemplateList: [], // 配方模板
  842. feedingFormulaList: [], // 补料配方
  843. livestockTypeList: [], // 类别
  844. barList: [],
  845. rules: {
  846. cowclassid: [{ type: 'string', required: true, message: '必填', trigger: 'blur' }]
  847. },
  848. table: {
  849. getdataListParm: {
  850. name: 'getFPList',
  851. page: 1,
  852. offset: 1,
  853. // pagecount: parseInt(Cookies.get('pageCount')),
  854. pagecount: '',
  855. returntype: 'Map',
  856. parammaps: {
  857. pastureid: Cookies.get('pastureid'),
  858. enable: '',
  859. barid: '',
  860. tname: ''
  861. }
  862. },
  863. tableKey: 0,
  864. list: [],
  865. total: 0,
  866. listLoading: true,
  867. temp: {},
  868. rwList: [],
  869. isPtsfname: false, // 补料配方/补料重量
  870. getdataListParm2: {
  871. name: 'getSysoptEnable',
  872. page: 1,
  873. offset: 1,
  874. pagecount: 1,
  875. returntype: 'Map',
  876. parammaps: {
  877. pastureid: Cookies.get('pastureid'),
  878. inforname: 'isEnableSupplyFeed'
  879. }
  880. },
  881. isRW1: false, // 第一班
  882. isRW2: false, // 第二班
  883. isRW3: false, // 第三班
  884. isRW4: false, // 第四班
  885. isRW5: false, // 第五班
  886. isRW6: false, // 第六班
  887. getdataListParm3: {
  888. name: 'getSysoptEnable1',
  889. page: 1,
  890. offset: 1,
  891. pagecount: 1,
  892. returntype: 'Map',
  893. parammaps: {
  894. pastureid: Cookies.get('pastureid'),
  895. inforname: 'times'
  896. }
  897. },
  898. RWLength: '' // 班次长度
  899. },
  900. selectList: [],
  901. // 营养评估
  902. nutritional: {
  903. dialogFormVisible: false,
  904. dialogStatus: '',
  905. activeName: 'first ',
  906. tab1: {
  907. // inputDatetime: [new Date().setTime(new Date().getTime() - 3600 * 1000 * 24 * 1), new Date().setTime(new Date().getTime() - 3600 * 1000 * 24 * 1)],
  908. inputDatetime: [new Date(), new Date()],
  909. listLoading1: true,
  910. getdataListParm1: {
  911. name: 'getnurj',
  912. page: 1,
  913. offset: 1,
  914. pagecount: 10,
  915. returntype: 'Map',
  916. parammaps: {
  917. pastureid: '',
  918. barid: ''
  919. }
  920. },
  921. disabledCowclass: false,
  922. temp: {},
  923. tableKey: 0,
  924. list: [],
  925. total: 0,
  926. listLoading2: true,
  927. getdataListParm2: {
  928. name: 'GETNurJudge',
  929. page: 1,
  930. offset: 1,
  931. pagecount: 10,
  932. returntype: 'Map',
  933. parammaps: {
  934. pastureid: '',
  935. cowclassid: ''
  936. }
  937. }
  938. },
  939. tab2: {
  940. // inputDatetime: [new Date().setTime(new Date().getTime() - 3600 * 1000 * 24 * 1), new Date().setTime(new Date().getTime() - 3600 * 1000 * 24 * 1)],
  941. inputDatetime: [new Date(), new Date()],
  942. listLoading1: true,
  943. tableKey1: 0,
  944. list1: [],
  945. total1: 0,
  946. getdataListParm1: {
  947. name: 'getPennsieveList',
  948. page: 1,
  949. offset: 1,
  950. pagecount: 10,
  951. returntype: 'Map',
  952. parammaps: {
  953. pastureid: '',
  954. barid: '',
  955. startTime: '',
  956. stopTime: '',
  957. inputDatetime: ''
  958. }
  959. },
  960. listLoading2: true,
  961. tableKey2: 0,
  962. list2: [],
  963. total2: 0,
  964. getdataListParm2: {
  965. name: 'getDungsieveList',
  966. page: 1,
  967. offset: 1,
  968. pagecount: 10,
  969. returntype: 'Map',
  970. parammaps: {
  971. pastureid: '',
  972. barid: '',
  973. startTime: '',
  974. stopTime: '',
  975. inputDatetime: ''
  976. }
  977. },
  978. listLoading3: true,
  979. tableKey3: 0,
  980. list3: [],
  981. total3: 0,
  982. getdataListParm3: {
  983. name: 'getBodyscoreList',
  984. page: 1,
  985. offset: 1,
  986. pagecount: 10,
  987. returntype: 'Map',
  988. parammaps: {
  989. pastureid: '',
  990. barid: '',
  991. startTime: '',
  992. stopTime: '',
  993. inputDatetime: ''
  994. }
  995. },
  996. listLoading4: true,
  997. tableKey4: 0,
  998. list4: [],
  999. total4: 0,
  1000. getdataListParm4: {
  1001. name: 'getDungscoreList',
  1002. page: 1,
  1003. offset: 1,
  1004. pagecount: 10,
  1005. returntype: 'Map',
  1006. parammaps: {
  1007. pastureid: '',
  1008. barid: '',
  1009. startTime: '',
  1010. stopTime: '',
  1011. inputDatetime: ''
  1012. }
  1013. }
  1014. }
  1015. },
  1016. history: {
  1017. dialogFormVisible: false,
  1018. dialogStatus: '',
  1019. temp: {},
  1020. rules: {},
  1021. tableKey: 0,
  1022. list: [],
  1023. total: 0,
  1024. listLoading: true,
  1025. getdataListParm: {
  1026. name: 'getPlanModifyFPlist',
  1027. page: 1,
  1028. offset: 1,
  1029. // pagecount: 12,
  1030. pagecount: '',
  1031. returntype: 'Map',
  1032. parammaps: {
  1033. pastureid: Cookies.get('pastureid'),
  1034. date: '',
  1035. barid: '',
  1036. tname: ''
  1037. }
  1038. },
  1039. isPtsfname: false, // 补料配方/补料重量
  1040. getdataListParm2: {
  1041. name: 'getSysoptEnable',
  1042. page: 1,
  1043. offset: 1,
  1044. pagecount: 1,
  1045. returntype: 'Map',
  1046. parammaps: {
  1047. pastureid: Cookies.get('pastureid'),
  1048. inforname: 'isEnableSupplyFeed'
  1049. }
  1050. },
  1051. isRW1: false, // 第一班
  1052. isRW2: false, // 第二班
  1053. isRW3: false, // 第三班
  1054. isRW4: false, // 第四班
  1055. isRW5: false, // 第五班
  1056. isRW6: false, // 第六班
  1057. getdataListParm3: {
  1058. name: 'getSysoptEnable1',
  1059. page: 1,
  1060. offset: 1,
  1061. pagecount: 1,
  1062. returntype: 'Map',
  1063. parammaps: {
  1064. pastureid: Cookies.get('pastureid'),
  1065. inforname: 'times'
  1066. }
  1067. },
  1068. getdataDateParm: {
  1069. name: 'getFPMaxDate',
  1070. page: 1,
  1071. offset: 1,
  1072. pagecount: 10,
  1073. returntype: 'Map',
  1074. parammaps: {
  1075. pastureid: Cookies.get('pastureid')
  1076. }
  1077. }
  1078. },
  1079. textMap: {
  1080. Nutritional: '营养评估',
  1081. history: '历史记录'
  1082. },
  1083. requestParam: {},
  1084. download: {
  1085. getdataListParm: {
  1086. name: 'getFPList',
  1087. page: 1,
  1088. offset: 1,
  1089. pagecount: 0,
  1090. returntype: 'Map',
  1091. parammaps: {
  1092. pastureid: Cookies.get('pastureid'),
  1093. enable: ''
  1094. }
  1095. },
  1096. list: []
  1097. },
  1098. spanObj: {},
  1099. mergekeys: ['barname', 'sumweight'],
  1100. isShowDialog: false,
  1101. isokDisable: false,
  1102. rowStyle: { maxHeight: 30 + 'px', height: 30 + 'px' },
  1103. cellStyle: { padding: 0 + 'px' },
  1104. myHeight: document.documentElement.clientHeight - 85 - 140,
  1105. oldRowList:{},
  1106. oldList:[],
  1107. decimal: parseInt(Cookies.get('decimal')),
  1108. decimalr: parseInt(Cookies.get('decimalr'))
  1109. }
  1110. },
  1111. computed: {
  1112. // 设置请求头
  1113. headers() {
  1114. return {
  1115. token: getToken()
  1116. }
  1117. },
  1118. uploadData() {
  1119. return {
  1120. name: 'checkbarname,checkftsw,checkftbl',
  1121. importParams: '栏舍名称,实际牛头数,系数(%),配方模板,补料配方,第一班比例(%),第二班比例(%),第三班比例(%)',
  1122. sheetname: 'Sheet1',
  1123. // 登录牧场
  1124. pastureid: Cookies.get('pastureid'),
  1125. // 日期参数
  1126. dateParams: '',
  1127. // 必填参数
  1128. requiredParams: '栏舍名称,实际牛头数,系数(%),配方模板,',
  1129. // 为数值的参数
  1130. numParams: '实际牛头数,系数(%),第一班比例(%),第二班比例(%),第三班比例(%),,第四班比例(%)'
  1131. }
  1132. },
  1133. // 设置上传地址
  1134. uploadExcelUrl() {
  1135. return Cookies.get('url') + 'authdata/fpdimportexcel'
  1136. }
  1137. },
  1138. created() {
  1139. this.getButtons()
  1140. this.getDownList()
  1141. this.getFeedTempletNameList()
  1142. },
  1143. methods: {
  1144. handleHistorySearch(){
  1145. this.table
  1146. this.getDateList()
  1147. },
  1148. getButtons() {
  1149. const Edit = 'DhedFormula'
  1150. const isRoleEdit = checkButtons(JSON.parse(sessionStorage.getItem('buttons')), Edit)
  1151. this.isRoleEdit = isRoleEdit
  1152. },
  1153. getDownList() {
  1154. GetDataByNames(this.requestParams).then(response => {
  1155. if(response.data.getSysoptEnable.list[0].inforvalue == 1){
  1156. this.isSynchronous = true
  1157. }else{
  1158. this.isSynchronous = false
  1159. }
  1160. this.recipeTemplateList = response.data.getFTSWLSList.list
  1161. this.feedingFormulaList = response.data.getFTBLList.list
  1162. this.livestockTypeList = response.data.getCowclassListEnable.list
  1163. this.barList = response.data.getBarListEnable.list
  1164. this.getIsDisplay()
  1165. })
  1166. },
  1167. getFeedTempletNameList() {
  1168. GetDataByName(this.getFeedTempletNameListParm).then(response => {
  1169. if (response.data.list !== null) {
  1170. this.tnameList = response.data.list
  1171. } else {
  1172. this.tnameList = []
  1173. }
  1174. })
  1175. },
  1176. getIsDisplay() {
  1177. GetDataByName(this.table.getdataListParm2).then(response => {
  1178. console.log(response.data.list[0].inforvalue)
  1179. if (response.data.list !== null) {
  1180. if (response.data.list[0].inforvalue == 0) {
  1181. this.table.isPtsfname = false
  1182. } else {
  1183. this.table.isPtsfname = true
  1184. }
  1185. }
  1186. })
  1187. GetDataByName(this.table.getdataListParm3).then(response => {
  1188. console.log(response.data.list[0].inforvalue)
  1189. if (response.data.list !== null) {
  1190. this.table.RWLength = response.data.list[0].inforvalue
  1191. if (response.data.list[0].inforvalue == 1) {
  1192. this.table.isRW1 = true
  1193. this.table.isRW2 = false
  1194. this.table.isRW3 = false
  1195. this.table.isRW4 = false
  1196. this.table.isRW5 = false
  1197. this.table.isRW6 = false
  1198. } else if (response.data.list[0].inforvalue == 2) {
  1199. this.table.isRW1 = true
  1200. this.table.isRW2 = true
  1201. this.table.isRW3 = false
  1202. this.table.isRW4 = false
  1203. this.table.isRW5 = false
  1204. this.table.isRW6 = false
  1205. } else if (response.data.list[0].inforvalue == 3) {
  1206. this.table.isRW1 = true
  1207. this.table.isRW2 = true
  1208. this.table.isRW3 = true
  1209. this.table.isRW4 = false
  1210. this.table.isRW5 = false
  1211. this.table.isRW6 = false
  1212. } else if (response.data.list[0].inforvalue == 4) {
  1213. this.table.isRW1 = true
  1214. this.table.isRW2 = true
  1215. this.table.isRW3 = true
  1216. this.table.isRW4 = true
  1217. this.table.isRW5 = false
  1218. this.table.isRW6 = false
  1219. } else if (response.data.list[0].inforvalue == 5) {
  1220. this.table.isRW1 = true
  1221. this.table.isRW2 = true
  1222. this.table.isRW3 = true
  1223. this.table.isRW4 = true
  1224. this.table.isRW5 = true
  1225. this.table.isRW6 = false
  1226. } else if (response.data.list[0].inforvalue == 6) {
  1227. this.table.isRW1 = true
  1228. this.table.isRW2 = true
  1229. this.table.isRW3 = true
  1230. this.table.isRW4 = true
  1231. this.table.isRW5 = true
  1232. this.table.isRW6 = true
  1233. }
  1234. } else {
  1235. this.table.isRW1 = false
  1236. this.table.isRW2 = false
  1237. this.table.isRW3 = false
  1238. this.table.isRW4 = false
  1239. this.table.isRW5 = false
  1240. this.table.isRW6 = false
  1241. }
  1242. })
  1243. this.getList()
  1244. },
  1245. getList() {
  1246. this.table.listLoading = true
  1247. GetDataByName(this.table.getdataListParm).then(response => {
  1248. console.log('table数据', response.data.list)
  1249. if (response.data.list !== null) {
  1250. for (let i = 0; i < response.data.list.length; i++) {
  1251. this.$set(response.data.list[i], 'Edit', false) // 编辑
  1252. this.$set(response.data.list[i], 'NoEdit', true) // 不可编辑/输入
  1253. this.$set(response.data.list[i], 'isUpdate', true) // 编辑操作
  1254. this.$set(response.data.list[i], 'isUpdateSave', false) // 编辑保存
  1255. // if (response.data.list[i].ftid !== undefined && response.data.list[i].ftid !== '') {
  1256. // if (this.recipeTemplateList.find(obj => obj.id == response.data.list[i].ftid) !== undefined) {
  1257. // this.$set(response.data.list[i], 'dryweight', this.recipeTemplateList.find(obj => obj.id == response.data.list[i].ftid).dryweight) // 编辑保存
  1258. // } else {
  1259. // this.$set(response.data.list[i], 'dryweight', '')
  1260. // }
  1261. // }
  1262. if (response.data.list[i].ftid == undefined || response.data.list[i].ftname == '') {
  1263. this.$set(response.data.list[i], 'ftid', '')
  1264. this.$set(response.data.list[i], 'ftname', '')
  1265. }
  1266. if (response.data.list[i].ptsfid == undefined || response.data.list[i].ptsfname == '') {
  1267. this.$set(response.data.list[i], 'ptsfid', '')
  1268. this.$set(response.data.list[i], 'ptsfname', '')
  1269. }
  1270. if (response.data.list[i].ccount == undefined) {
  1271. this.$set(response.data.list[i], 'ccount', '')
  1272. }
  1273. if (response.data.list[i].softccount == undefined) {
  1274. this.$set(response.data.list[i], 'softccount', '')
  1275. }
  1276. if (response.data.list[i].ratio == undefined) {
  1277. this.$set(response.data.list[i], 'ratio', 100)
  1278. }
  1279. if (response.data.list[i].ccountratio == undefined) {
  1280. this.$set(response.data.list[i], 'ccountratio', '')
  1281. }
  1282. if (response.data.list[i].r1 == undefined) {
  1283. this.$set(response.data.list[i], 'r1', '')
  1284. }
  1285. if (response.data.list[i].r2 == undefined) {
  1286. this.$set(response.data.list[i], 'r2', '')
  1287. }
  1288. if (response.data.list[i].r3 == undefined) {
  1289. this.$set(response.data.list[i], 'r3', '')
  1290. }
  1291. if (response.data.list[i].r4 == undefined) {
  1292. this.$set(response.data.list[i], 'r4', '')
  1293. }
  1294. if (response.data.list[i].r5 == undefined) {
  1295. this.$set(response.data.list[i], 'r5', '')
  1296. }
  1297. if (response.data.list[i].r6 == undefined) {
  1298. this.$set(response.data.list[i], 'r6', '')
  1299. }
  1300. if (response.data.list[i].w1 == undefined) {
  1301. this.$set(response.data.list[i], 'w1', '')
  1302. }
  1303. if (response.data.list[i].w2 == undefined) {
  1304. this.$set(response.data.list[i], 'w2', '')
  1305. }
  1306. if (response.data.list[i].w3 == undefined) {
  1307. this.$set(response.data.list[i], 'w3', '')
  1308. }
  1309. if (response.data.list[i].w4 == undefined) {
  1310. this.$set(response.data.list[i], 'w4', '')
  1311. }
  1312. if (response.data.list[i].w5 == undefined) {
  1313. this.$set(response.data.list[i], 'w5', '')
  1314. }
  1315. if (response.data.list[i].w6 == undefined) {
  1316. this.$set(response.data.list[i], 'w6', '')
  1317. }
  1318. if (response.data.list[i].supplyweight == undefined) {
  1319. this.$set(response.data.list[i], 'supplyweight', '')
  1320. }
  1321. if (response.data.list[i].feedweight == undefined || parseFloat(response.data.list[i].feedweight) == 0) {
  1322. this.$set(response.data.list[i], 'feedweight', '')
  1323. }
  1324. this.$set(response.data.list[i], 'dailyWeight', '')
  1325. if (response.data.list[i].Bfweight == undefined) {
  1326. this.$set(response.data.list[i], 'Bfweight', '')
  1327. }
  1328. if (response.data.list[i].Sfweight == undefined) {
  1329. this.$set(response.data.list[i], 'Sfweight', '')
  1330. }
  1331. if (response.data.list[i].isOneWeight == undefined) {
  1332. this.$set(response.data.list[i], 'isOneWeight', false)
  1333. }
  1334. if (response.data.list[i].isTwoWeight == undefined) {
  1335. this.$set(response.data.list[i], 'isTwoWeight', false)
  1336. }
  1337. if (response.data.list[i].isThreeWeight == undefined) {
  1338. this.$set(response.data.list[i], 'isThreeWeight', false)
  1339. }
  1340. if (response.data.list[i].isFourWeight == undefined) {
  1341. this.$set(response.data.list[i], 'isFourWeight', false)
  1342. }
  1343. if (response.data.list[i].isFiveWeight == undefined) {
  1344. this.$set(response.data.list[i], 'isFiveWeight', false)
  1345. }
  1346. if (response.data.list[i].isSixWeight == undefined) {
  1347. this.$set(response.data.list[i], 'isSixWeight', false)
  1348. }
  1349. if (response.data.list[i].timesopt !== undefined) {
  1350. var timesoptArr = response.data.list[i].timesopt.split(',')
  1351. for (let j = 0; j < timesoptArr.length; j++) {
  1352. response.data.list[i]['r' + timesoptArr[j].split(':')[0]] = timesoptArr[j].split(':')[1]
  1353. response.data.list[i]['w' + timesoptArr[j].split(':')[0]] = timesoptArr[j].split(':')[2]
  1354. }
  1355. }
  1356. if (response.data.list[i].bw1 == undefined) {
  1357. this.$set(response.data.list[i], 'bw1', '')
  1358. }
  1359. if (response.data.list[i].bw2 == undefined) {
  1360. this.$set(response.data.list[i], 'bw2', '')
  1361. }
  1362. if (response.data.list[i].bw3 == undefined) {
  1363. this.$set(response.data.list[i], 'bw3', '')
  1364. }
  1365. if (response.data.list[i].bw4 == undefined) {
  1366. this.$set(response.data.list[i], 'bw4', '')
  1367. }
  1368. if (response.data.list[i].bw5 == undefined) {
  1369. this.$set(response.data.list[i], 'bw5', '')
  1370. }
  1371. if (response.data.list[i].bw6 == undefined) {
  1372. this.$set(response.data.list[i], 'bw6', '')
  1373. }
  1374. if (response.data.list[i].supplement !== undefined) {
  1375. var supplementArr = response.data.list[i].supplement.split(',')
  1376. for (let j = 0; j < supplementArr.length; j++) {
  1377. response.data.list[i]['bw' + supplementArr[j].split(':')[0]] = supplementArr[j].split(':')[2]
  1378. }
  1379. }
  1380. }
  1381. // console.log(response.data.list, sumr)
  1382. for (let i = 0; i < response.data.list.length; i++) {
  1383. if (response.data.list[i].r1 == '') {
  1384. response.data.list[i].r1 = 0
  1385. response.data.list[i].w1 = 0
  1386. }
  1387. if (response.data.list[i].r2 == '') {
  1388. response.data.list[i].r2 = 0
  1389. response.data.list[i].w2 = 0
  1390. }
  1391. if (response.data.list[i].r3 == '') {
  1392. response.data.list[i].r3 = 0
  1393. response.data.list[i].w3 = 0
  1394. }
  1395. if (response.data.list[i].r4 == '') {
  1396. response.data.list[i].r4 = 0
  1397. response.data.list[i].w4 = 0
  1398. }
  1399. if (response.data.list[i].r5 == '') {
  1400. response.data.list[i].r5 = 0
  1401. response.data.list[i].w5 = 0
  1402. }
  1403. if (response.data.list[i].r6 == '') {
  1404. response.data.list[i].r6 = 0
  1405. response.data.list[i].w6 = 0
  1406. }
  1407. // this.$set(response.data.list[i], 'sumr', parseFloat(response.data.list[i].r1) + parseFloat(response.data.list[i].r2) + parseFloat(response.data.list[i].r3) + parseFloat(response.data.list[i].r4))
  1408. // response.data.list[i].sumr = formatNum(response.data.list[i].sumr, parseInt(Cookies.get('decimalr')))
  1409. var sumr = 0
  1410. if(response.data.list[i].r1 && !isNaN(response.data.list[i].r1)){
  1411. sumr += parseFloat(response.data.list[i].r1) }
  1412. if(response.data.list[i].r2 && !isNaN(response.data.list[i].r2)){
  1413. sumr += parseFloat(response.data.list[i].r2) }
  1414. if(response.data.list[i].r3 && !isNaN(response.data.list[i].r3)){
  1415. sumr += parseFloat(response.data.list[i].r3) }
  1416. if(response.data.list[i].r4 && !isNaN(response.data.list[i].r4)){
  1417. sumr += parseFloat(response.data.list[i].r4) }
  1418. if(response.data.list[i].r5 && !isNaN(response.data.list[i].r5)){
  1419. sumr += parseFloat(response.data.list[i].r5) }
  1420. if(response.data.list[i].r6 && !isNaN(response.data.list[i].r6)){ sumr += parseFloat(response.data.list[i].r6) }
  1421. console.log(sumr,'sumr')
  1422. response.data.list[i].sumr = formatNum(sumr, parseInt(Cookies.get('decimalr')))
  1423. // this.$set(response.data.list[i],'feedweight',formatNum(parseFloat(response.data.list[i].feedweight) * parseFloat(response.data.list[i].sumr)/100,2))
  1424. this.$set(response.data.list[i], 'dailyWeight', parseFloat(response.data.list[i].w1) + parseFloat(response.data.list[i].w2) + parseFloat(response.data.list[i].w3) + parseFloat(response.data.list[i].w4))
  1425. response.data.list[i].dailyWeight = formatNum(response.data.list[i].dailyWeight, parseInt(Cookies.get('decimal')))
  1426. }
  1427. this.table.list = response.data.list
  1428. console.log(this.table.list, 'this.table.list')
  1429. this.table.pageNum = response.data.pageNum
  1430. this.table.pageSize = response.data.pageSize
  1431. this.table.total = response.data.total
  1432. } else {
  1433. this.table.list = []
  1434. }
  1435. setTimeout(() => {
  1436. this.table.listLoading = false
  1437. }, 100)
  1438. })
  1439. },
  1440. form_search() {
  1441. this.getList()
  1442. },
  1443. renderHeader(h, { column, $index }) { // h即为cerateElement的简写,具体可看vue官方文档
  1444. return h(
  1445. 'div',
  1446. [
  1447. h('span', column.label),
  1448. h('i', {
  1449. class: 'el-icon-unlock',
  1450. ref: 'el-icon-unlock',
  1451. style: 'margin-left:5px;'
  1452. })
  1453. ]
  1454. )
  1455. },
  1456. headerClick(column, event) {
  1457. console.log(column, event)
  1458. this.headerList.push(event)
  1459. if (column.label == '第一班重量') {
  1460. for (let i = 0; i < this.table.list.length; i++) {
  1461. if (this.table.list[i].Edit == true) {
  1462. if (event.target.outerHTML == '<i class="el-icon-unlock" style="margin-left: 5px;"></i>') {
  1463. event.target.className = 'el-icon-lock'
  1464. this.$set(this.table.list[i], 'isOneWeight', true) // 锁住不可编辑
  1465. } else if (event.target.outerHTML == '<i class="el-icon-lock" style="margin-left: 5px;"></i>') {
  1466. event.target.className = 'el-icon-unlock'
  1467. this.$set(this.table.list[i], 'isOneWeight', false) // 解锁可编辑
  1468. }
  1469. }
  1470. }
  1471. } else if (column.label == '第二班重量') {
  1472. for (let i = 0; i < this.table.list.length; i++) {
  1473. if (this.table.list[i].Edit == true) {
  1474. if (event.target.outerHTML == '<i class="el-icon-unlock" style="margin-left: 5px;"></i>') {
  1475. event.target.className = 'el-icon-lock'
  1476. this.$set(this.table.list[i], 'isTwoWeight', true) // 锁住不可编辑
  1477. } else if (event.target.outerHTML == '<i class="el-icon-lock" style="margin-left: 5px;"></i>') {
  1478. event.target.className = 'el-icon-unlock'
  1479. this.$set(this.table.list[i], 'isTwoWeight', false) // 解锁可编辑
  1480. }
  1481. }
  1482. }
  1483. } else if (column.label == '第三班重量') {
  1484. for (let i = 0; i < this.table.list.length; i++) {
  1485. if (this.table.list[i].Edit == true) {
  1486. if (event.target.outerHTML == '<i class="el-icon-unlock" style="margin-left: 5px;"></i>') {
  1487. event.target.className = 'el-icon-lock'
  1488. this.$set(this.table.list[i], 'isThreeWeight', true) // 锁住不可编辑
  1489. } else if (event.target.outerHTML == '<i class="el-icon-lock" style="margin-left: 5px;"></i>') {
  1490. event.target.className = 'el-icon-unlock'
  1491. this.$set(this.table.list[i], 'isThreeWeight', false) // 解锁可编辑
  1492. }
  1493. }
  1494. }
  1495. } else if (column.label == '第四班重量') {
  1496. for (let i = 0; i < this.table.list.length; i++) {
  1497. if (this.table.list[i].Edit == true) {
  1498. if (event.target.outerHTML == '<i class="el-icon-unlock" style="margin-left: 5px;"></i>') {
  1499. event.target.className = 'el-icon-lock'
  1500. this.$set(this.table.list[i], 'isFourWeight', true) // 锁住不可编辑
  1501. } else if (event.target.outerHTML == '<i class="el-icon-lock" style="margin-left: 5px;"></i>') {
  1502. event.target.className = 'el-icon-unlock'
  1503. this.$set(this.table.list[i], 'isFourWeight', false) // 解锁可编辑
  1504. }
  1505. }
  1506. }
  1507. } else if (column.label == '第五班重量') {
  1508. for (let i = 0; i < this.table.list.length; i++) {
  1509. if (this.table.list[i].Edit == true) {
  1510. if (event.target.outerHTML == '<i class="el-icon-unlock" style="margin-left: 5px;"></i>') {
  1511. event.target.className = 'el-icon-lock'
  1512. this.$set(this.table.list[i], 'isFiveWeight', true) // 锁住不可编辑
  1513. } else if (event.target.outerHTML == '<i class="el-icon-lock" style="margin-left: 5px;"></i>') {
  1514. event.target.className = 'el-icon-unlock'
  1515. this.$set(this.table.list[i], 'isFiveWeight', false) // 解锁可编辑
  1516. }
  1517. }
  1518. }
  1519. } else if (column.label == '第六班重量') {
  1520. for (let i = 0; i < this.table.list.length; i++) {
  1521. if (this.table.list[i].Edit == true) {
  1522. if (event.target.outerHTML == '<i class="el-icon-unlock" style="margin-left: 5px;"></i>') {
  1523. event.target.className = 'el-icon-lock'
  1524. this.$set(this.table.list[i], 'isSixWeight', true) // 锁住不可编辑
  1525. } else if (event.target.outerHTML == '<i class="el-icon-lock" style="margin-left: 5px;"></i>') {
  1526. event.target.className = 'el-icon-unlock'
  1527. this.$set(this.table.list[i], 'isSixWeight', false) // 解锁可编辑
  1528. }
  1529. }
  1530. }
  1531. }
  1532. },
  1533. // 配方模板
  1534. changeRecipeTemplate(item, row) {
  1535. row.myccname = this.recipeTemplateList.find(obj => obj.id == item).ccname
  1536. if (row.bigcowclass !== row.myccname) {
  1537. this.$message({ type: 'warning', message: '所选配方模板牲畜类别与栏舍对应牲畜类别不一致', duration: 2000 })
  1538. }
  1539. console.log(row.supplyweight, 'row.supplyweight')
  1540. row.ftname = this.recipeTemplateList.find(obj => obj.id == item).tname
  1541. row.Sfweight = this.recipeTemplateList.find(obj => obj.id == item).Sfweight// Sfweight
  1542. row.SfweightLock = this.recipeTemplateList.find(obj => obj.id == item).SfweightLock// SfweightLock
  1543. row.dryweight = this.recipeTemplateList.find(obj => obj.id == item).dryweight// SfweightLock
  1544. // 补料重量supplyweight
  1545. // 配方重量ftweight
  1546. // 系数头数ccountratio
  1547. // 投喂量feedweight
  1548. // 实际牛头数ccount
  1549. // 投喂量 = 配方重量 + 补料重量
  1550. // 配方重量 = Sfweight * 系数头数 + SfweightLock * 实际牛头数ccount
  1551. console.log(row.Sfweight, 'row.Sfweight')
  1552. console.log(row.ccountratio, '系数头数')
  1553. console.log(row.SfweightLock, 'SfweightLock')
  1554. console.log(row.ccount, '实际牛头数')
  1555. if (row.Sfweight !== '' && row.ccount !== '') {
  1556. this.$set(row, 'ftweight', formatNum(parseFloat(row.Sfweight) * parseFloat(row.ccountratio) + parseFloat(row.SfweightLock) * parseFloat(row.ccount), parseInt(Cookies.get('decimal'))))
  1557. } else {
  1558. row.ftweight = ''
  1559. }
  1560. // console.log(row.ftweight, 'row.ftweight')
  1561. // console.log(row.supplyweight, 'row.supplyweight')
  1562. // console.log(this.table.isPtsfname, 'isPtsfname')
  1563. if (this.table.isPtsfname == false) {
  1564. row.feedweight = formatNum(parseFloat(row.ftweight), parseInt(Cookies.get('decimal')))
  1565. } else {
  1566. if (row.supplyweight == 'NaN') {
  1567. row.supplyweight = 0
  1568. }
  1569. console.log(row.supplyweight)
  1570. if (row.supplyweight !== '' && row.ftweight !== '') {
  1571. row.feedweight = formatNum(parseFloat(row.supplyweight) + parseFloat(row.ftweight), parseInt(Cookies.get('decimal')))
  1572. } else if (row.supplyweight == '' && row.ftweight !== '') {
  1573. row.feedweight = formatNum(parseFloat(row.ftweight), parseInt(Cookies.get('decimal')))
  1574. } else if (row.supplyweight !== '' && row.ftweight !== '') {
  1575. row.feedweight = formatNum(parseFloat(row.supplyweight), parseInt(Cookies.get('decimal')))
  1576. }
  1577. if (row.ccountratio !== '' && row.ftweight !== '') {
  1578. row.ftweight = formatNum(parseFloat(row.Sfweight) * parseFloat(row.ccountratio) + parseFloat(row.SfweightLock) * parseFloat(row.ccount), parseInt(Cookies.get('decimal')))
  1579. }
  1580. if (row.Sfweight !== '' && row.ccount !== '') {
  1581. this.$set(row, 'ftweight', formatNum(parseFloat(row.Sfweight) * parseFloat(row.ccountratio) + parseFloat(row.SfweightLock) * parseFloat(row.ccount), parseInt(Cookies.get('decimal'))))
  1582. } else {
  1583. row.ftweight = ''
  1584. }
  1585. }
  1586. console.log(row.supplyweight)
  1587. if (row.supplyweight == 'NaN') { row.supplyweight = 0 }
  1588. if (row.r1 !== '') { this.$set(row, 'w1', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r1) / 100), parseInt(Cookies.get('decimal')))) }
  1589. if (row.r2 !== '') { this.$set(row, 'w2', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r2) / 100), parseInt(Cookies.get('decimal')))) }
  1590. if (row.r3 !== '') { this.$set(row, 'w3', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r3) / 100), parseInt(Cookies.get('decimal')))) }
  1591. if (row.r4 !== '') { this.$set(row, 'w4', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r4) / 100), parseInt(Cookies.get('decimal')))) }
  1592. if (row.r5 !== '') { this.$set(row, 'w5', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r5) / 100), parseInt(Cookies.get('decimal')))) }
  1593. if (row.r6 !== '') { this.$set(row, 'w6', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r6) / 100), parseInt(Cookies.get('decimal')))) }
  1594. if (row.w1 == '') { row.w1 = 0 }
  1595. if (row.w2 == '') { row.w2 = 0 }
  1596. if (row.w3 == '') { row.w3 = 0 }
  1597. if (row.w4 == '') { row.w4 = 0 }
  1598. if (row.w5 == '') { row.w5 = 0 }
  1599. if (row.w6 == '') { row.w6 = 0 }
  1600. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4)+ parseFloat(row.w5)+ parseFloat(row.w6))
  1601. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  1602. },
  1603. // 补料配方
  1604. changeFeedingFormula(item, row) {
  1605. console.log(item, '=========')
  1606. if (item == '') {
  1607. row.bw1 = 0
  1608. row.bw2 = 0
  1609. row.bw3 = 0
  1610. row.bw4 = 0
  1611. row.bw5 = 0
  1612. row.bw6 = 0
  1613. }
  1614. // 补料重量supplyweight
  1615. // 配方重量ftweight
  1616. // 系数头数ccountratio
  1617. // 投喂量feedweight
  1618. // 实际牛头数ccount
  1619. // 投喂量 = 配方重量 + 补料重量
  1620. row.myccname = this.feedingFormulaList.find(obj => obj.id == item).ccname
  1621. if (row.bigcowclass !== row.myccname) {
  1622. this.$message({ type: 'warning', message: '所选补料配方与栏舍对应牲畜类别不一致', duration: 2000 })
  1623. }
  1624. if (item !== '') {
  1625. console.log(456)
  1626. row.ptsfname = this.feedingFormulaList.find(obj => obj.id == item).tname
  1627. row.BLweight = this.feedingFormulaList.find(obj => obj.id == item).Sfweight
  1628. row.BLSfweightLock = this.feedingFormulaList.find(obj => obj.id == item).SfweightLock
  1629. } else {
  1630. row.ptsfname = ''
  1631. row.BLweight = 0
  1632. row.BLSfweightLock = 0
  1633. }
  1634. // 配方重量 = 系数头数 * Sfweight
  1635. // if (row.ccountratio !== '' && row.ftweight !== '') {
  1636. // row.ftweight = parseFloat(row.Sfweight) * parseFloat(row.ccountratio)
  1637. // }
  1638. // 补料重量 = 系数头数 * BLweight
  1639. // console.log(row.ccountratio)
  1640. // console.log(row.ccount)
  1641. // console.log(row.BLweight)
  1642. // console.log(row.BLSfweightLock)
  1643. if (row.ccountratio !== '' && row.ccount !== '' && row.ccount.BLweight !== '' && row.BLSfweightLock !== '') {
  1644. this.$set(row, 'supplyweight', formatNum(parseFloat(row.BLweight) * parseFloat(row.ccountratio) + parseFloat(row.BLSfweightLock) * parseFloat(row.ccount), parseInt(Cookies.get('decimal'))))
  1645. } else {
  1646. row.supplyweight = ''
  1647. }
  1648. if (this.table.isPtsfname == false) {
  1649. row.feedweight = parseFloat(row.ftweight)
  1650. } else {
  1651. if (row.supplyweight !== '' && row.ftweight !== '') {
  1652. row.feedweight = formatNum(parseFloat(row.supplyweight) + parseFloat(row.ftweight), parseInt(Cookies.get('decimal')))
  1653. } else if (row.supplyweight == '' && row.ftweight !== '') {
  1654. row.feedweight = formatNum(parseFloat(row.ftweight), parseInt(Cookies.get('decimal')))
  1655. } else if (row.supplyweight !== '' && row.ftweight == '') {
  1656. row.feedweight = formatNum(parseFloat(row.supplyweight), parseInt(Cookies.get('decimal')))
  1657. }
  1658. }
  1659. if (row.r1 !== '') { this.$set(row, 'w1', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r1) / 100), parseInt(Cookies.get('decimal')))) }
  1660. if (row.r2 !== '') { this.$set(row, 'w2', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r2) / 100), parseInt(Cookies.get('decimal')))) }
  1661. if (row.r3 !== '') { this.$set(row, 'w3', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r3) / 100), parseInt(Cookies.get('decimal')))) }
  1662. if (row.r4 !== '') { this.$set(row, 'w4', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r4) / 100), parseInt(Cookies.get('decimal')))) }
  1663. if (row.r5 !== '') { this.$set(row, 'w5', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r5) / 100), parseInt(Cookies.get('decimal')))) }
  1664. if (row.r6 !== '') { this.$set(row, 'w6', formatNum(parseFloat(row.feedweight) * (parseFloat(row.r6) / 100), parseInt(Cookies.get('decimal')))) }
  1665. if (row.w1 == '') { row.w1 = 0 }
  1666. if (row.w2 == '') { row.w2 = 0 }
  1667. if (row.w3 == '') { row.w3 = 0 }
  1668. if (row.w4 == '') { row.w4 = 0 }
  1669. if (row.w5 == '') { row.w5 = 0 }
  1670. if (row.w6 == '') { row.w6 = 0 }
  1671. this.$set(row, 'dailyWeight', parseFloat(row.w1) + parseFloat(row.w2) + parseFloat(row.w3) + parseFloat(row.w4) + parseFloat(row.w5) + parseFloat(row.w6))
  1672. row.dailyWeight = formatNum(row.dailyWeight, parseInt(Cookies.get('decimal')))
  1673. },
  1674. // 实际牛头数失去焦点计算
  1675. // ccount实际牛头数
  1676. // ratio系数
  1677. // ccountratio系数牛头数
  1678. blurCcount(row) { // 实际牛头数
  1679. console.log(row,'洗漱---')
  1680. if (row.ftid !== '-1' && row.ftid !== '') {
  1681. row.Sfweight = this.recipeTemplateList.find(obj => obj.id == row.ftid)?.Sfweight || 0
  1682. row.SfweightLock = this.recipeTemplateList.find(obj => obj.id == row.ftid)?.SfweightLock || 0
  1683. }
  1684. if (row.w1 == '' || row.w1 == undefined || isNaN(row.w1)) { row.w1 = 0 }
  1685. if (row.w2 == '' || row.w2 == undefined || isNaN(row.w2)) { row.w2 = 0 }
  1686. if (row.w3 == '' || row.w3 == undefined || isNaN(row.w3)) { row.w3 = 0 }
  1687. if (row.w4 == '' || row.w4 == undefined || isNaN(row.w4)) { row.w4 = 0 }
  1688. if (row.w5 == '' || row.w5 == undefined || isNaN(row.w5)) { row.w5 = 0 }
  1689. if (row.w6 == '' || row.w6 == undefined || isNaN(row.w6)) { row.w6 = 0 }
  1690. // 系数不变
  1691. // 系数头数=实际牛头数*系数
  1692. row.ccountratio = row.ccount * row.ratio / 100
  1693. // 配方重量=实际牛头数*系数*配方模板取Sfweight
  1694. row.ftweight = (row.ccount * row.ratio / 100 * row.Sfweight).toFixed(this.decimal)
  1695. this.public(row)
  1696. this.placeholder(row)
  1697. },
  1698. blurRatio(row) {
  1699. if (row.ftid !== '-1' && row.ftid !== '') {
  1700. row.Sfweight = this.recipeTemplateList.find(obj => obj.id == row.ftid).Sfweight
  1701. row.SfweightLock = this.recipeTemplateList.find(obj => obj.id == row.ftid).SfweightLock
  1702. }
  1703. if (row.w1 == '' || row.w1 == undefined || isNaN(row.w1)) { row.w1 = 0 }
  1704. if (row.w2 == '' || row.w2 == undefined || isNaN(row.w2)) { row.w2 = 0 }
  1705. if (row.w3 == '' || row.w3 == undefined || isNaN(row.w3)) { row.w3 = 0 }
  1706. if (row.w4 == '' || row.w4 == undefined || isNaN(row.w4)) { row.w4 = 0 }
  1707. if (row.w5 == '' || row.w5 == undefined || isNaN(row.w5)) { row.w5 = 0 }
  1708. if (row.w6 == '' || row.w6 == undefined || isNaN(row.w6)) { row.w6 = 0 }
  1709. // 配方重量=实际牛头数*系数*配方模板取Sfweight
  1710. row.ftweight = (row.ccount * row.ratio / 100 * row.Sfweight).toFixed(this.decimal)
  1711. // 实际牛头数不变
  1712. // 系数头数=实际牛头数*系数
  1713. row.ccountratio = (parseFloat(row.ccount)*(parseFloat(row.ratio) / 100)).toFixed(this.decimal)
  1714. this.public(row)
  1715. this.placeholder(row)
  1716. },
  1717. blurCcountratio(row) {
  1718. if (row.ftid !== '-1' && row.ftid !== '') {
  1719. row.Sfweight = this.recipeTemplateList.find(obj => obj.id == row.ftid).Sfweight
  1720. row.SfweightLock = this.recipeTemplateList.find(obj => obj.id == row.ftid).SfweightLock
  1721. }
  1722. if (row.w1 == '' || row.w1 == undefined || isNaN(row.w1)) { row.w1 = 0 }
  1723. if (row.w2 == '' || row.w2 == undefined || isNaN(row.w2)) { row.w2 = 0 }
  1724. if (row.w3 == '' || row.w3 == undefined || isNaN(row.w3)) { row.w3 = 0 }
  1725. if (row.w4 == '' || row.w4 == undefined || isNaN(row.w4)) { row.w4 = 0 }
  1726. if (row.w5 == '' || row.w5 == undefined || isNaN(row.w5)) { row.w5 = 0 }
  1727. if (row.w6 == '' || row.w6 == undefined || isNaN(row.w6)) { row.w6 = 0 }
  1728. // 实际牛头数不变
  1729. // 系数=系数头数/实际牛头数*100
  1730. row.ratio = (parseFloat(row.ccountratio) / parseFloat(row.ccount) * 100).toFixed(this.decimal)
  1731. // 配方重量=实际牛头数*系数*配方模板取Sfweight
  1732. row.ftweight = (row.ccount * row.ratio / 100 * row.Sfweight).toFixed(this.decimal)
  1733. this.public(row)
  1734. this.placeholder(row)
  1735. },
  1736. public(row){
  1737. console.log(row,'row')
  1738. // 未锁定时:各班次比例不变,各班次重量=配方重量*各班次比例
  1739. // 锁定时:未锁定班次比例不变,锁定班次比例=班次重量/配方重量x100%
  1740. if(row.isOneWeight == true){
  1741. if(row.w1 && row.ftweight && !isNaN(parseFloat(row.w1)) && !isNaN(parseFloat(row.ftweight))){
  1742. row.r1 = (parseFloat(row.w1) / parseFloat(row.ftweight) * 100).toFixed(this.decimalr)
  1743. }else{
  1744. row.r1 = 0
  1745. }
  1746. }else{
  1747. if(row.r1 && row.ftweight && !isNaN(parseFloat(row.r1)) && !isNaN(parseFloat(row.ftweight))){
  1748. row.w1 = (parseFloat(row.ftweight) * parseFloat(row.r1) / 100).toFixed(this.decimal)
  1749. }else{
  1750. row.w1 = 0
  1751. }
  1752. }
  1753. if(row.isTwoWeight == true){
  1754. if(row.w2 && row.ftweight && !isNaN(parseFloat(row.w2)) && !isNaN(parseFloat(row.ftweight))){
  1755. row.r2 = (parseFloat(row.w2) / parseFloat(row.ftweight) * 100).toFixed(this.decimalr)
  1756. }else{
  1757. row.r2 = 0
  1758. }
  1759. }else{
  1760. if(row.r2 && row.ftweight && !isNaN(parseFloat(row.r2)) && !isNaN(parseFloat(row.ftweight))){
  1761. row.w2 = (parseFloat(row.ftweight) * parseFloat(row.r2) / 100).toFixed(this.decimal)
  1762. }else{
  1763. row.w2 = 0
  1764. }
  1765. }
  1766. if(row.isThreeWeight == true){
  1767. if(row.w3 && row.ftweight && !isNaN(parseFloat(row.w3)) && !isNaN(parseFloat(row.ftweight))){
  1768. row.r3 = (parseFloat(row.w3) / parseFloat(row.ftweight) * 100).toFixed(this.decimalr)
  1769. }else{
  1770. row.r3 = 0
  1771. }
  1772. }else{
  1773. if(row.r3 && row.ftweight && !isNaN(parseFloat(row.r3)) && !isNaN(parseFloat(row.ftweight))){
  1774. row.w3 = (parseFloat(row.ftweight) * parseFloat(row.r3) / 100).toFixed(this.decimal)
  1775. }else{
  1776. row.w3 = 0
  1777. }
  1778. }
  1779. if(row.isFourWeight == true){
  1780. if(row.w4 && row.ftweight && !isNaN(parseFloat(row.w4)) && !isNaN(parseFloat(row.ftweight))){
  1781. row.r4 = (parseFloat(row.w4) / parseFloat(row.ftweight) * 100).toFixed(this.decimalr)
  1782. }else{
  1783. row.r4 = 0
  1784. }
  1785. }else{
  1786. if(row.r4 && row.ftweight && !isNaN(parseFloat(row.r4)) && !isNaN(parseFloat(row.ftweight))){
  1787. row.w4 = (parseFloat(row.ftweight) * parseFloat(row.r4) / 100).toFixed(this.decimal)
  1788. }else{
  1789. row.w4 = 0
  1790. }
  1791. }
  1792. if(row.isFiveWeight == true){
  1793. if(row.w5 && row.ftweight && !isNaN(parseFloat(row.w5)) && !isNaN(parseFloat(row.ftweight))){
  1794. row.r5 = (parseFloat(row.w5) / parseFloat(row.ftweight) * 100).toFixed(this.decimalr)
  1795. }else{
  1796. row.r5 = 0
  1797. }
  1798. }else{
  1799. if(row.r5 && row.ftweight && !isNaN(parseFloat(row.r5)) && !isNaN(parseFloat(row.ftweight))){
  1800. row.w5 = (parseFloat(row.ftweight) * parseFloat(row.r5) / 100).toFixed(this.decimal)
  1801. }else{
  1802. row.w5 = 0
  1803. }
  1804. }
  1805. if(row.isSixWeight == true){
  1806. if(row.w6 && row.ftweight && !isNaN(parseFloat(row.w6)) && !isNaN(parseFloat(row.ftweight))){
  1807. row.r6 = (parseFloat(row.w6) / parseFloat(row.ftweight) * 100).toFixed(this.decimalr)
  1808. }else{
  1809. row.r5 = 0
  1810. }
  1811. }else{
  1812. if(row.r6 && row.ftweight && !isNaN(parseFloat(row.r6)) && !isNaN(parseFloat(row.ftweight))){
  1813. row.w6 = (parseFloat(row.ftweight) * parseFloat(row.r6) / 100).toFixed(this.decimal)
  1814. }else{
  1815. row.w6 = 0
  1816. }
  1817. }
  1818. console.log(row,'row2')
  1819. if(row.isOneWeight || row.isTWoWeight || row.isThreeWeight || row.isFourWeight || row.isFiveWeight || row.isSixWeight){
  1820. var sumr = 0
  1821. if(row.r1 && !isNaN(row.r1)){ sumr += parseFloat(row.r1) }
  1822. if(row.r2 && !isNaN(row.r2)){ sumr += parseFloat(row.r2) }
  1823. if(row.r3 && !isNaN(row.r3)){ sumr += parseFloat(row.r3) }
  1824. if(row.r4 && !isNaN(row.r4)){ sumr += parseFloat(row.r4) }
  1825. if(row.r5 && !isNaN(row.r5)){ sumr += parseFloat(row.r5) }
  1826. if(row.r6 && !isNaN(row.r6)){ sumr += parseFloat(row.r6) }
  1827. this.$set(row, 'sumr', sumr.toFixed(this.decimalr))
  1828. }else{
  1829. // 总比例不变
  1830. var sumr = 0
  1831. if(row.r1 && !isNaN(row.r1)){ sumr += parseFloat(row.r1) }
  1832. if(row.r2 && !isNaN(row.r2)){ sumr += parseFloat(row.r2) }
  1833. if(row.r3 && !isNaN(row.r3)){ sumr += parseFloat(row.r3) }
  1834. if(row.r4 && !isNaN(row.r4)){ sumr += parseFloat(row.r4) }
  1835. if(row.r5 && !isNaN(row.r5)){ sumr += parseFloat(row.r5) }
  1836. if(row.r6 && !isNaN(row.r6)){ sumr += parseFloat(row.r6) }
  1837. this.$set(row, 'sumr', sumr.toFixed(this.decimalr))
  1838. }
  1839. // 饲喂投喂量 = 所有班次重量之和
  1840. var sumw = 0
  1841. if(row.w1 && !isNaN(row.w1)){ sumw += parseFloat(row.w1) }
  1842. if(row.w2 && !isNaN(row.w2)){ sumw += parseFloat(row.w2) }
  1843. if(row.w3 && !isNaN(row.w3)){ sumw += parseFloat(row.w3) }
  1844. if(row.w4 && !isNaN(row.w4)){ sumw += parseFloat(row.w4) }
  1845. if(row.w5 && !isNaN(row.w5)){ sumw += parseFloat(row.w5) }
  1846. if(row.w6 && !isNaN(row.w6)){ sumw += parseFloat(row.w6) }
  1847. this.$set(row, 'sumw', sumw.toFixed(this.decimal))
  1848. // 日投喂量 = 饲喂投喂量+补料
  1849. if (isNaN(row.bw1) || row.bw1 == '') { this.$set(row, 'bw1', 0) }
  1850. if (isNaN(row.bw2) || row.bw2 == '') { this.$set(row, 'bw2', 0) }
  1851. if (isNaN(row.bw3) || row.bw3 == '') { this.$set(row, 'bw3', 0) }
  1852. if (isNaN(row.bw4) || row.bw4 == '') { this.$set(row, 'bw4', 0) }
  1853. if (isNaN(row.bw5) || row.bw5 == '') { this.$set(row, 'bw5', 0) }
  1854. if (isNaN(row.bw6) || row.bw6 == '') { this.$set(row, 'bw6', 0) }
  1855. // var sumbw = (parseFloat(row.bw1) + parseFloat(row.bw2) + parseFloat(row.bw3) + parseFloat(row.bw4) + parseFloat(row.bw5) + parseFloat(row.bw6)).toFixed(this.decimal)
  1856. var sumbw = 0
  1857. if(row.bw1 && !isNaN(row.bw1)){ sumbw += parseFloat(row.bw1) }
  1858. if(row.bw2 && !isNaN(row.bw2)){ sumbw += parseFloat(row.bw2) }
  1859. if(row.bw3 && !isNaN(row.bw3)){ sumbw += parseFloat(row.bw3) }
  1860. if(row.bw4 && !isNaN(row.bw4)){ sumbw += parseFloat(row.bw4) }
  1861. if(row.bw5 && !isNaN(row.bw5)){ sumbw += parseFloat(row.bw5) }
  1862. if(row.bw6 && !isNaN(row.bw6)){ sumbw += parseFloat(row.bw6) }
  1863. this.$set(row, 'sumbw', sumbw.toFixed(this.decimal))
  1864. var todayfeed = parseFloat(sumw) + parseFloat(sumbw)
  1865. this.$set(row, 'todayfeed', todayfeed)
  1866. },
  1867. blurR(row,item) {
  1868. if (row.ftid !== '-1' && row.ftid !== '') {
  1869. row.Sfweight = this.recipeTemplateList.find(obj => obj.id == row.ftid).Sfweight
  1870. }
  1871. // 配方重量=实际牛头数*系数*配方模板取Sfweight
  1872. row.ftweight = (parseFloat(row.ccount) * parseFloat(row.ratio) / 100 * parseFloat(row.Sfweight)).toFixed(this.decimal)
  1873. console.log(parseFloat(row.ccount),'======ccount')
  1874. console.log(parseFloat(row.ftweight),'======ftweight')
  1875. if(item == 1){
  1876. // 一班比例
  1877. if(!isNaN(parseFloat(row.r1)) && !isNaN(parseFloat(row.ftweight)) && row.r1 && row.ftweight){
  1878. row.w1 = (parseFloat(row.r1)/100 * parseFloat(row.ftweight)).toFixed(this.decimal)
  1879. }else{
  1880. row.w1 = 0
  1881. }
  1882. }else if(item == 2){
  1883. // 二班比例
  1884. if(!isNaN(parseFloat(row.r2)) && !isNaN(parseFloat(row.ftweight)) && row.r2 && row.ftweight){
  1885. row.w2 = (parseFloat(row.r2)/100 * parseFloat(row.ftweight)).toFixed(this.decimal)
  1886. }else{
  1887. row.w2 = 0
  1888. }
  1889. }else if(item == 3){
  1890. // 三班比例
  1891. if(!isNaN(parseFloat(row.r3)) && !isNaN(parseFloat(row.ftweight)) && row.r3 && row.ftweight){
  1892. row.w3 = (parseFloat(row.r3)/100 * parseFloat(row.ftweight)).toFixed(this.decimal)
  1893. }else{
  1894. row.w3 = 0
  1895. }
  1896. }else if(item == 4){
  1897. // 四班比例
  1898. if(!isNaN(parseFloat(row.r4)) && !isNaN(parseFloat(row.ftweight)) && row.r4 && row.ftweight){
  1899. row.w4 = (parseFloat(row.r4)/100 * parseFloat(row.ftweight)).toFixed(this.decimal)
  1900. }else{
  1901. row.w4 = 0
  1902. }
  1903. }else if(item == 5){
  1904. // 五班比例
  1905. if(!isNaN(parseFloat(row.r5)) && !isNaN(parseFloat(row.ftweight)) && row.r5 && row.ftweight){
  1906. row.w5 = (parseFloat(row.r5)/100 * parseFloat(row.ftweight)).toFixed(this.decimal)
  1907. }else{
  1908. row.w5 = 0
  1909. }
  1910. }else if(item == 6){
  1911. // 六班比例
  1912. if(!isNaN(parseFloat(row.r6)) && !isNaN(parseFloat(row.ftweight)) && row.r6 && row.ftweight){
  1913. row.w6 = (parseFloat(row.r6)/100 * parseFloat(row.ftweight)).toFixed(this.decimal)
  1914. }else{
  1915. row.w6 = 0
  1916. }
  1917. }
  1918. // 总比例=所有比例之和
  1919. // 饲喂投喂量 = 所有班次重量之和
  1920. var sumr = 0
  1921. if(row.r1 && !isNaN(row.r1)){ sumr += parseFloat(row.r1) }
  1922. if(row.r2 && !isNaN(row.r2)){ sumr += parseFloat(row.r2) }
  1923. if(row.r3 && !isNaN(row.r3)){ sumr += parseFloat(row.r3) }
  1924. if(row.r4 && !isNaN(row.r4)){ sumr += parseFloat(row.r4) }
  1925. if(row.r5 && !isNaN(row.r5)){ sumr += parseFloat(row.r5) }
  1926. if(row.r6 && !isNaN(row.r6)){ sumr += parseFloat(row.r6) }
  1927. this.$set(row, 'sumr', sumr.toFixed(this.decimalr))
  1928. var sumw = 0
  1929. if(row.w1 && !isNaN(row.w1)){ sumw += parseFloat(row.w1) }
  1930. if(row.w2 && !isNaN(row.w2)){ sumw += parseFloat(row.w2) }
  1931. if(row.w3 && !isNaN(row.w3)){ sumw += parseFloat(row.w3) }
  1932. if(row.w4 && !isNaN(row.w4)){ sumw += parseFloat(row.w4) }
  1933. if(row.w5 && !isNaN(row.w5)){ sumw += parseFloat(row.w5) }
  1934. if(row.w6 && !isNaN(row.w6)){ sumw += parseFloat(row.w6) }
  1935. this.$set(row, 'sumw', sumw.toFixed(this.decimal))
  1936. // 日投喂量 = 饲喂投喂量+补料
  1937. if (isNaN(row.bw1) || row.bw1 == '' || row.bw1 == undefined) { this.$set(row, 'bw1', 0) }
  1938. if (isNaN(row.bw2) || row.bw2 == '' || row.bw1 == undefined) { this.$set(row, 'bw2', 0) }
  1939. if (isNaN(row.bw3) || row.bw3 == '' || row.bw1 == undefined) { this.$set(row, 'bw3', 0) }
  1940. if (isNaN(row.bw4) || row.bw4 == '' || row.bw1 == undefined) { this.$set(row, 'bw4', 0) }
  1941. if (isNaN(row.bw5) || row.bw5 == '' || row.bw1 == undefined) { this.$set(row, 'bw5', 0) }
  1942. if (isNaN(row.bw6) || row.bw6 == '' || row.bw1 == undefined) { this.$set(row, 'bw6', 0) }
  1943. var sumbw = 0
  1944. if(row.bw1 && !isNaN(row.bw1)){ sumbw += parseFloat(row.bw1) }
  1945. if(row.bw2 && !isNaN(row.bw2)){ sumbw += parseFloat(row.bw2) }
  1946. if(row.bw3 && !isNaN(row.bw3)){ sumbw += parseFloat(row.bw3) }
  1947. if(row.bw4 && !isNaN(row.bw4)){ sumbw += parseFloat(row.bw4) }
  1948. if(row.bw5 && !isNaN(row.bw5)){ sumbw += parseFloat(row.bw5) }
  1949. if(row.bw6 && !isNaN(row.bw6)){ sumbw += parseFloat(row.bw6) }
  1950. this.$set(row, 'sumbw', sumbw.toFixed(this.decimal))
  1951. // var sumbw = (parseFloat(row.bw1) + parseFloat(row.bw2) + parseFloat(row.bw3) + parseFloat(row.bw4) + parseFloat(row.bw5) + parseFloat(row.bw6)).toFixed(this.decimal)
  1952. var todayfeed = parseFloat(sumw) + parseFloat(sumbw)
  1953. console.log(todayfeed,'sumw==')
  1954. this.$set(row, 'todayfeed', todayfeed)
  1955. this.placeholder(row)
  1956. },
  1957. placeholder(row){
  1958. this.$set(row, 'placeholder_r1', this.oldRowList.r1)
  1959. this.$set(row, 'placeholder_r2', this.oldRowList.r2)
  1960. this.$set(row, 'placeholder_r3', this.oldRowList.r3)
  1961. this.$set(row, 'placeholder_r4', this.oldRowList.r4)
  1962. this.$set(row, 'placeholder_r5', this.oldRowList.r5)
  1963. this.$set(row, 'placeholder_r6', this.oldRowList.r6)
  1964. this.$set(row, 'placeholder_w1', this.oldRowList.w1)
  1965. this.$set(row, 'placeholder_w2', this.oldRowList.w2)
  1966. this.$set(row, 'placeholder_w3', this.oldRowList.w3)
  1967. this.$set(row, 'placeholder_w4', this.oldRowList.w4)
  1968. this.$set(row, 'placeholder_w5', this.oldRowList.w5)
  1969. this.$set(row, 'placeholder_w6', this.oldRowList.w6)
  1970. this.$set(row, 'placeholder_bw1', this.oldRowList.bw1)
  1971. this.$set(row, 'placeholder_bw2', this.oldRowList.bw2)
  1972. this.$set(row, 'placeholder_bw3', this.oldRowList.bw3)
  1973. this.$set(row, 'placeholder_bw4', this.oldRowList.bw4)
  1974. this.$set(row, 'placeholder_bw5', this.oldRowList.bw5)
  1975. this.$set(row, 'placeholder_bw6', this.oldRowList.bw6)
  1976. this.$set(row, 'placeholder_ccount', this.oldRowList.ccount)
  1977. this.$set(row, 'placeholder_ratio', this.oldRowList.ratio)
  1978. this.$set(row, 'placeholder_ccountratio', this.oldRowList.ccountratio)
  1979. },
  1980. blurWeight(row,item) {
  1981. // 配方重量=实际牛头数*系数*配方模板取Sfweight
  1982. if (row.ftid !== '-1' && row.ftid !== '') {
  1983. row.Sfweight = this.recipeTemplateList.find(obj => obj.id == row.ftid).Sfweight
  1984. }
  1985. if(item == 1){
  1986. // 一班重量
  1987. if(!isNaN(parseFloat(row.w1)) && !isNaN(parseFloat(row.ftweight)) && row.w1 && row.ftweight){
  1988. row.r1 = (parseFloat(row.w1) / parseFloat(row.ftweight) * 100).toFixed(this.decimalr)
  1989. }else{
  1990. row.r1 = 0
  1991. }
  1992. }else if(item == 2){
  1993. // 二班重量
  1994. if(!isNaN(parseFloat(row.w2)) && !isNaN(parseFloat(row.ftweight)) && row.w2 && row.ftweight){
  1995. row.r2 = (parseFloat(row.w2) / parseFloat(row.ftweight) * 100).toFixed(this.decimalr)
  1996. }else{
  1997. row.r2 = 0
  1998. }
  1999. }else if(item == 3){
  2000. // 三班重量
  2001. if(!isNaN(parseFloat(row.w3)) && !isNaN(parseFloat(row.ftweight)) && row.w3 && row.ftweight){
  2002. row.r3 = (parseFloat(row.w3) / parseFloat(row.ftweight) * 100).toFixed(this.decimalr)
  2003. }else{
  2004. row.r3 = 0
  2005. }
  2006. }else if(item == 4){
  2007. // 四班重量
  2008. if(!isNaN(parseFloat(row.w4)) && !isNaN(parseFloat(row.ftweight)) && row.w4 && row.ftweight){
  2009. row.r4 = (parseFloat(row.w4) / parseFloat(row.ftweight) * 100).toFixed(this.decimalr)
  2010. }else{
  2011. row.r4 = 0
  2012. }
  2013. }else if(item == 5){
  2014. // 五班重量
  2015. if(!isNaN(parseFloat(row.w5)) && !isNaN(parseFloat(row.ftweight)) && row.w5 && row.ftweight){
  2016. row.r5 = (parseFloat(row.w5) / parseFloat(row.ftweight) * 100).toFixed(this.decimalr)
  2017. }else{
  2018. row.r5 = 0
  2019. }
  2020. }else if(item == 6){
  2021. // 六班重量
  2022. if(!isNaN(parseFloat(row.w6)) && !isNaN(parseFloat(row.ftweight)) && row.w6 && row.ftweight){
  2023. row.r6 = (parseFloat(row.w6) / parseFloat(row.ftweight) * 100).toFixed(this.decimalr)
  2024. }else{
  2025. row.r6 = 0
  2026. }
  2027. }
  2028. // 总比例=所有比例之和
  2029. // 饲喂投喂量 = 所有班次重量之和
  2030. var sumr = 0
  2031. if(row.r1 && !isNaN(row.r1)){ sumr += parseFloat(row.r1) }
  2032. if(row.r2 && !isNaN(row.r2)){ sumr += parseFloat(row.r2) }
  2033. if(row.r3 && !isNaN(row.r3)){ sumr += parseFloat(row.r3) }
  2034. if(row.r4 && !isNaN(row.r4)){ sumr += parseFloat(row.r4) }
  2035. if(row.r5 && !isNaN(row.r5)){ sumr += parseFloat(row.r5) }
  2036. if(row.r6 && !isNaN(row.r6)){ sumr += parseFloat(row.r6) }
  2037. this.$set(row, 'sumr', sumr.toFixed(this.decimalr))
  2038. var sumw = 0
  2039. if(row.w1 && !isNaN(row.w1)){ sumw += parseFloat(row.w1) }
  2040. if(row.w2 && !isNaN(row.w2)){ sumw += parseFloat(row.w2) }
  2041. if(row.w3 && !isNaN(row.w3)){ sumw += parseFloat(row.w3) }
  2042. if(row.w4 && !isNaN(row.w4)){ sumw += parseFloat(row.w4) }
  2043. if(row.w5 && !isNaN(row.w5)){ sumw += parseFloat(row.w5) }
  2044. if(row.w6 && !isNaN(row.w6)){ sumw += parseFloat(row.w6) }
  2045. this.$set(row, 'sumw', sumw.toFixed(this.decimal))
  2046. // 日投喂量 = 饲喂投喂量+补料
  2047. if (isNaN(row.bw1) || row.bw1 == '' || row.bw1 == undefined) { this.$set(row, 'bw1', 0) }
  2048. if (isNaN(row.bw2) || row.bw2 == '' || row.bw2 == undefined) { this.$set(row, 'bw2', 0) }
  2049. if (isNaN(row.bw3) || row.bw3 == '' || row.bw3 == undefined) { this.$set(row, 'bw3', 0) }
  2050. if (isNaN(row.bw4) || row.bw4 == '' || row.bw4 == undefined) { this.$set(row, 'bw4', 0) }
  2051. if (isNaN(row.bw5) || row.bw5 == '' || row.bw5 == undefined) { this.$set(row, 'bw5', 0) }
  2052. if (isNaN(row.bw6) || row.bw6 == '' || row.bw6 == undefined) { this.$set(row, 'bw6', 0) }
  2053. var sumbw = 0
  2054. if(row.bw1 && !isNaN(row.bw1)){ sumbw += parseFloat(row.bw1) }
  2055. if(row.bw2 && !isNaN(row.bw2)){ sumbw += parseFloat(row.bw2) }
  2056. if(row.bw3 && !isNaN(row.bw3)){ sumbw += parseFloat(row.bw3) }
  2057. if(row.bw4 && !isNaN(row.bw4)){ sumbw += parseFloat(row.bw4) }
  2058. if(row.bw5 && !isNaN(row.bw5)){ sumbw += parseFloat(row.bw5) }
  2059. if(row.bw6 && !isNaN(row.bw6)){ sumbw += parseFloat(row.bw6) }
  2060. this.$set(row, 'sumbw', sumbw.toFixed(this.decimal))
  2061. // var sumbw = (parseFloat(row.bw1) + parseFloat(row.bw2) + parseFloat(row.bw3) + parseFloat(row.bw4) + parseFloat(row.bw5) + parseFloat(row.bw6)).toFixed(this.decimal)
  2062. var todayfeed = parseFloat(sumw) + parseFloat(sumbw)
  2063. this.$set(row, 'todayfeed', todayfeed)
  2064. this.placeholder(row)
  2065. },
  2066. blurBw(row){
  2067. this.placeholder(row)
  2068. },
  2069. celldblclick(row, column, cell, event) {
  2070. console.log(row, '=====')
  2071. if(!this.isproportion){
  2072. this.handleUpdate(row)
  2073. }
  2074. },
  2075. // 编辑
  2076. handleUpdate(row) {
  2077. console.log(row)
  2078. this.oldRowList = {...row}
  2079. for (let i = 0; i < this.table.list.length; i++) {
  2080. if (this.table.list[i].Edit == true) {
  2081. this.$message({ type: 'error', message: '当前内容未保存,请点击取消或保存继续进行操作', duration: 2000 })
  2082. return false
  2083. }
  2084. }
  2085. // 编辑true,不可编辑false
  2086. row.Edit = true
  2087. row.NoEdit = false
  2088. // 编辑false,编辑保存true
  2089. row.isUpdate = false
  2090. row.isUpdateSave = true
  2091. row.ftid = String(row.ftid)
  2092. if (row.ptsfid == '-1') {
  2093. row.ptsfid = ''
  2094. }
  2095. row.ptsfid = String(row.ptsfid)
  2096. // dryweight
  2097. this.table.temp.ftid = row.ftid
  2098. this.table.temp.ftname = row.ftname
  2099. this.table.temp.ptsfid = row.ptsfid
  2100. this.table.temp.ptsfname = row.ptsfname
  2101. },
  2102. updateData(row) {
  2103. if (isNaN(row.r1)) { this.$set(row, 'r1', 0) }
  2104. if (isNaN(row.r2)) { this.$set(row, 'r2', 0) }
  2105. if (isNaN(row.r3)) { this.$set(row, 'r3', 0) }
  2106. if (isNaN(row.r4)) { this.$set(row, 'r4', 0) }
  2107. if (isNaN(row.r5)) { this.$set(row, 'r5', 0) }
  2108. if (isNaN(row.r6)) { this.$set(row, 'r6', 0) }
  2109. if (isNaN(row.w1)) { this.$set(row, 'w1', 0) }
  2110. if (isNaN(row.w2)) { this.$set(row, 'w2', 0) }
  2111. if (isNaN(row.w3)) { this.$set(row, 'w3', 0) }
  2112. if (isNaN(row.w4)) { this.$set(row, 'w4', 0) }
  2113. if (isNaN(row.w5)) { this.$set(row, 'w5', 0) }
  2114. if (isNaN(row.w6)) { this.$set(row, 'w6', 0) }
  2115. if (isNaN(row.bw1)) { this.$set(row, 'bw1', 0) }
  2116. if (isNaN(row.bw2)) { this.$set(row, 'bw2', 0) }
  2117. if (isNaN(row.bw3)) { this.$set(row, 'bw3', 0) }
  2118. if (isNaN(row.bw4)) { this.$set(row, 'bw4', 0) }
  2119. if (isNaN(row.bw5)) { this.$set(row, 'bw5', 0) }
  2120. if (isNaN(row.bw6)) { this.$set(row, 'bw6', 0) }
  2121. var arr = []
  2122. for (let i = 1; i <= this.table.RWLength; i++) {
  2123. var obj = {}
  2124. obj['times'] = i
  2125. obj['pastureid'] = row.pastureid
  2126. obj['barid'] = row.barid
  2127. obj['cowcount'] = row.ccount
  2128. obj['ccountradio'] = row.ccountradio
  2129. obj['ptid'] = row.ftid
  2130. if (row.ptsfid !== '') {
  2131. obj['ptsid'] = row.ptsfid
  2132. } else {
  2133. obj['ptsid'] = '-1'
  2134. }
  2135. obj['weight'] = row['w' + i]
  2136. if(row['bw' + i] == ""){
  2137. obj['supplement'] = 0
  2138. }else{
  2139. obj['supplement'] = row['bw' + i]
  2140. }
  2141. obj['tratio'] = (parseFloat(row['r' + i])).toFixed(parseInt(Cookies.get('decimalr')))
  2142. obj['todaysupplement'] = row.todaysupplement
  2143. obj['todayweight'] = row.todayweight
  2144. arr.push(obj)
  2145. }
  2146. arr.forEach((item)=>{
  2147. if(isNaN(item.tratio)){
  2148. item.tratio = 0
  2149. }
  2150. })
  2151. if (this.table.isPtsfname == 0) {
  2152. row.ptsfid = '-1'
  2153. row.ptsfname = ''
  2154. } else {
  2155. if (row.ptsfid == '') {
  2156. row.ptsfid = '-1'
  2157. row.ptsfname = ''
  2158. }
  2159. }
  2160. if (row.supplyweight == '') {
  2161. row.supplyweight = '0'
  2162. }
  2163. if (this.table.isPtsfname == false) {
  2164. row.supplyweight = '0'
  2165. }
  2166. this.$set(row, 'ratio', Math.floor(parseFloat(row.ratio) * 100) / 100)
  2167. this.$set(row, 'ccountratio', Math.floor(parseFloat(row.ccountratio) * 100) / 100)
  2168. row.ccountratio = String(row.ccountratio)
  2169. row.sumr = Math.round(row.sumr)
  2170. // for(let i=0;i<arr.length;i++){
  2171. // if(arr[i].tratio == undefined ||arr[i].tratio =='' || arr[i].tratio == null){
  2172. // arr[i].tratio = 0
  2173. // }
  2174. // }
  2175. this.table.rwList = arr
  2176. console.log('点击了编辑保存', row)
  2177. if(row.feedweight == ''){
  2178. row.feedweight = row.todayweight
  2179. }
  2180. this.table.temp.pastureid = row.pastureid
  2181. this.table.temp.id = row.id
  2182. this.table.temp.barname = row.barname
  2183. this.table.temp.barid = row.barid
  2184. this.table.temp.ccount = row.ccount
  2185. this.table.temp.ratio = row.ratio
  2186. this.table.temp.ccountratio = row.ccountratio
  2187. this.table.temp.ftid = row.ftid
  2188. this.table.temp.ftname = row.ftname
  2189. this.table.temp.ptsfid = row.ptsfid
  2190. this.table.temp.ptsfname = row.ptsfname
  2191. this.table.temp.ftweight = row.ftweight
  2192. this.table.temp.supplyweight = row.supplyweight
  2193. this.table.temp.feedweight = row.feedweight
  2194. this.table.temp.owner = row.owner
  2195. this.table.temp.sumr = row.sumr
  2196. if (row.softccount == '') {
  2197. row.softccount = 0
  2198. }
  2199. if (row.r1 == '' || isNaN(row.r1)) {
  2200. row.r1 = 0
  2201. }
  2202. if (row.r2 == '' || isNaN(row.r2)) {
  2203. row.r2 = 0
  2204. }
  2205. if (row.r3 == '' || isNaN(row.r3)) {
  2206. row.r3 = 0
  2207. }
  2208. if (row.r4 == '' || isNaN(row.r4)) {
  2209. row.r4 = 0
  2210. }
  2211. if (row.r5 == '' || isNaN(row.r5)) {
  2212. row.r5 = 0
  2213. }
  2214. if (row.r6 == '' || isNaN(row.r6)) {
  2215. row.r6 = 0
  2216. }
  2217. if (row.w1 == '' || isNaN(row.w1)) {
  2218. row.w1 = 0
  2219. }
  2220. if (row.w2 == '' || isNaN(row.w2)) {
  2221. row.w2 = 0
  2222. }
  2223. if (row.w3 == '' || isNaN(row.w3)) {
  2224. row.w3 = 0
  2225. }
  2226. if (row.w4 == '' || isNaN(row.w4)) {
  2227. row.w4 = 0
  2228. }
  2229. if (row.w5 == '' || isNaN(row.w5)) {
  2230. row.w5 = 0
  2231. }
  2232. if (row.w6 == '' || isNaN(row.w6)) {
  2233. row.w6 = 0
  2234. }
  2235. console.log(row, '===========')
  2236. this.table.temp.softccount = row.softccount
  2237. this.table.temp.r1 = Math.round(row.r1)
  2238. this.table.temp.r2 = Math.round(row.r2)
  2239. this.table.temp.r3 = Math.round(row.r3)
  2240. this.table.temp.r4 = Math.round(row.r4)
  2241. this.table.temp.r5 = Math.round(row.r5)
  2242. this.table.temp.r6 = Math.round(row.r6)
  2243. this.table.temp.w1 = row.w1
  2244. this.table.temp.w2 = row.w2
  2245. this.table.temp.w3 = row.w3
  2246. this.table.temp.w4 = row.w4
  2247. this.table.temp.w5 = row.w5
  2248. this.table.temp.w6 = row.w6
  2249. var obj = {}
  2250. obj.userId = Cookies.get('employeid')
  2251. obj.pastureid = row.pastureid
  2252. obj.id = row.id
  2253. obj.data = []
  2254. if(this.oldRowList.w1 !== row.w1){
  2255. obj.data.push({'old':this.oldRowList.w1,'new':row.w1,times:1,'ptid':row.ftid,'ptsid':row.ptsfid})
  2256. }
  2257. if(this.oldRowList.w2 !== row.w2){
  2258. obj.data.push({'old':this.oldRowList.w2,'new':row.w2,times:2,'ptid':row.ftid,'ptsid':row.ptsfid})
  2259. }
  2260. if(this.oldRowList.w3 !== row.w3){
  2261. obj.data.push({'old':this.oldRowList.w3,'new':row.w3,times:3,'ptid':row.ftid,'ptsid':row.ptsfid})
  2262. }
  2263. if(this.oldRowList.w4 !== row.w4){
  2264. obj.data.push({'old':this.oldRowList.w4,'new':row.w4,times:4,'ptid':row.ftid,'ptsid':row.ptsfid})
  2265. }
  2266. if(this.oldRowList.w5 !== row.w5){
  2267. obj.data.push({'old':this.oldRowList.w5,'new':row.w5,times:5,'ptid':row.ftid,'ptsid':row.ptsfid})
  2268. }
  2269. if(this.oldRowList.w6 !== row.w6){
  2270. obj.data.push({'old':this.oldRowList.w6,'new':row.w6,times:6,'ptid':row.ftid,'ptsid':row.ptsfid})
  2271. }
  2272. if(this.oldRowList.bw1 !== row.bw1){
  2273. obj.data.push({'old':this.oldRowList.bw1,'new':row.bw1,times:1,'ptid':row.ftid,'ptsid':row.ptsfid})
  2274. }
  2275. if(this.oldRowList.bw2 !== row.bw2){
  2276. obj.data.push({'old':this.oldRowList.bw2,'new':row.bw2,times:2,'ptid':row.ftid,'ptsid':row.ptsfid})
  2277. }
  2278. if(this.oldRowList.bw3 !== row.bw3){
  2279. obj.data.push({'old':this.oldRowList.bw3,'new':row.bw3,times:3,'ptid':row.ftid,'ptsid':row.ptsfid})
  2280. }
  2281. if(this.oldRowList.bw4 !== row.bw4){
  2282. obj.data.push({'old':this.oldRowList.bw4,'new':row.bw4,times:4,'ptid':row.ftid,'ptsid':row.ptsfid})
  2283. }
  2284. if(this.oldRowList.bw5 !== row.bw5){
  2285. obj.data.push({'old':this.oldRowList.bw5,'new':row.bw5,times:5,'ptid':row.ftid,'ptsid':row.ptsfid})
  2286. }
  2287. if(this.oldRowList.bw6 !== row.bw6){
  2288. obj.data.push({'old':this.oldRowList.bw6,'new':row.bw6,times:6,'ptid':row.ftid,'ptsid':row.ptsfid})
  2289. }
  2290. if (this.table.temp.ccount == '' && this.table.temp.ratio == '' && this.table.temp.ccountratio == '' && this.table.temp.ftid == '') {
  2291. this.$message({ type: 'error', message: '实际牛头数/系数/系数头数/配方模版不能为空', duration: 2000 })
  2292. return false
  2293. }
  2294. if (this.table.temp.ratio == '' && this.table.temp.ccountratio == '' && this.table.temp.ftid == '') {
  2295. this.$message({ type: 'error', message: '系数/系数头数/配方模版不能为空', duration: 2000 })
  2296. return false
  2297. }
  2298. if (this.table.temp.ccountratio == '' && this.table.temp.ftid == '') {
  2299. this.$message({ type: 'error', message: '系数头数/配方模版不能为空', duration: 2000 })
  2300. return false
  2301. }
  2302. console.log(this.table.temp.ccount, '实际牛头数不能为空')
  2303. if (this.table.temp.ccount === '') {
  2304. this.$message({ type: 'error', message: '实际牛头数不能为空', duration: 2000 })
  2305. return false
  2306. }
  2307. if (this.table.temp.ratio === '') {
  2308. this.$message({ type: 'error', message: '系数不能为空', duration: 2000 })
  2309. return false
  2310. }
  2311. if (this.table.temp.ccountratio === '') {
  2312. this.$message({ type: 'error', message: '系数头数不能为空', duration: 2000 })
  2313. return false
  2314. }
  2315. if (this.table.temp.ftid == '') {
  2316. this.$message({ type: 'error', message: '配方模版不能为空', duration: 2000 })
  2317. return false
  2318. }
  2319. const positiveInteger = /^[0-9]\d*$/
  2320. if (!positiveInteger.test(parseFloat(this.table.temp.ccount))) {
  2321. this.$message({
  2322. type: 'error',
  2323. message: '实际牛头数请输入正整数',
  2324. duration: 2000
  2325. })
  2326. return false
  2327. }
  2328. this.isokDisable = true
  2329. setTimeout(() => {
  2330. this.isokDisable = false
  2331. }, 1000)
  2332. let createdate = parseTime(new Date(), '{y}-{m}-{d} {h}:{i}:{s}')
  2333. // this.requestParam.parammaps = this.table.temp
  2334. this.requestParam.common = {
  2335. 'returnmap': '0'
  2336. }
  2337. this.requestParam.data = []
  2338. this.requestParam.data[0] = { 'name': 'updateBigFP', 'type': 'e', 'parammaps': {
  2339. pastureid: row.pastureid,
  2340. id: row.id,
  2341. barname: row.barname,
  2342. barid: row.barid,
  2343. softccount: row.softccount,
  2344. ccount: row.ccount,
  2345. ratio: row.ratio,
  2346. ccountratio: row.ccountratio,
  2347. ftid: row.ftid,
  2348. ftname: row.ftname,
  2349. ptsfid: row.ptsfid,
  2350. ptsfname: row.ptsfname,
  2351. ftweight: row.ftweight,
  2352. supplyweight: row.supplyweight,
  2353. feedweight: row.feedweight,
  2354. owner: row.owner,
  2355. sumr: row.sumr
  2356. }}
  2357. this.requestParam.data[1] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.table.rwList }}
  2358. this.requestParam.data[1].children = []
  2359. this.requestParam.data[1].children[0] = { 'name': 'updateBigFPDetail', 'type': 'e', 'parammaps': {
  2360. pastureid: '@insertSpotList.pastureid',
  2361. barname: row.barname,
  2362. barid: '@insertSpotList.barid',
  2363. times: '@insertSpotList.times',
  2364. tratio: '@insertSpotList.tratio',
  2365. weight: '@insertSpotList.weight',
  2366. cowcount: '@insertSpotList.cowcount',
  2367. ccountradio: row.ccountratio,
  2368. ptid: '@insertSpotList.ptid',
  2369. ptsid: '@insertSpotList.ptsid',
  2370. supplement: '@insertSpotList.supplement',
  2371. feedweight: row.feedweight,
  2372. supplyweight: row.supplyweight,
  2373. ratio: row.ratio
  2374. }}
  2375. // this.requestParam.data[2] = { 'name': 'updateLPPbyFPChange', 'type': 'e', 'parammaps': {
  2376. // pastureid: row.pastureid,
  2377. // fpid: row.id
  2378. // }}
  2379. this.requestParam.data[2] = { 'name': 'insertFeedphistory', 'type': 'e', 'parammaps': {
  2380. createdate:createdate,
  2381. pastureid:row.pastureid,
  2382. barname:row.barname,
  2383. barid:row.barid,
  2384. softccount:row.softccount,
  2385. ccount:row.ccount,
  2386. ratio:row.ratio,
  2387. ccountratio:row.ccountratio,
  2388. ftid:row.ftid,
  2389. ftname:row.ftname,
  2390. ptsfid:row.ptsfid,
  2391. ptsfname:row.ptsfname,
  2392. feedweight:row.feedweight,
  2393. ftweight:row.ftweight,
  2394. supplyweight:row.supplyweight
  2395. }}
  2396. this.requestParam.data[3] = { 'name': 'insertSpotList2', 'resultmaps': { 'list': this.table.rwList }}
  2397. this.requestParam.data[3].children = []
  2398. this.requestParam.data[3].children[0] = { 'name': 'insertFpdetailhistory', 'type': 'e', 'parammaps': {
  2399. createdate:createdate,
  2400. pastureid: '@insertSpotList2.pastureid',
  2401. barname: row.barname,
  2402. barid: '@insertSpotList2.barid',
  2403. times: '@insertSpotList2.times',
  2404. tratio: '@insertSpotList2.tratio',
  2405. weight: '@insertSpotList2.weight',
  2406. cowcount: '@insertSpotList2.cowcount',
  2407. ccountradio: row.ccountratio,
  2408. ptid: '@insertSpotList2.ptid',
  2409. ptsid: '@insertSpotList2.ptsid',
  2410. supplement: '@insertSpotList2.supplement',
  2411. feedweight: row.feedweight,
  2412. supplyweight: row.supplyweight,
  2413. ratio: row.ratio,
  2414. userId: Cookies.get('employeid')
  2415. }}
  2416. ExecDataByConfig(this.requestParam).then(response => {
  2417. console.log('编辑保存发送参数', this.requestParam)
  2418. if (response.msg === 'fail') {
  2419. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  2420. } else {
  2421. if(obj.data.length>0){
  2422. const url = 'authdata/fpdetail/edit'
  2423. const data = obj
  2424. postJson(url, data).then(response => {
  2425. if(response.msg !== 'fail'){
  2426. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  2427. }
  2428. })
  2429. }else{
  2430. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  2431. }
  2432. this.getList()
  2433. for (let i = 0; i < this.headerList.length; i++) {
  2434. if (this.headerList[i].target.className == 'el-icon-lock') {
  2435. this.headerList[i].target.className = 'el-icon-unlock'
  2436. this.$set(this.headerList[i].target, 'className', 'el-icon-unlock')
  2437. }
  2438. }
  2439. }
  2440. })
  2441. },
  2442. updateCancel(row) {
  2443. console.log('点击了编辑取消')
  2444. // 编辑false,不可编辑true
  2445. row.Edit = false
  2446. row.NoEdit = true
  2447. // 编辑true,编辑保存false
  2448. row.isUpdate = true
  2449. row.isUpdateSave = false
  2450. // this.reload()
  2451. for (let i = 0; i < this.headerList.length; i++) {
  2452. if (this.headerList[i].target.className == 'el-icon-lock') {
  2453. this.headerList[i].target.className = 'el-icon-unlock'
  2454. this.$set(this.headerList[i].target, 'className', 'el-icon-unlock')
  2455. }
  2456. }
  2457. console.log(this.table.getdataListParm.offset)
  2458. this.table.getdataListParm.offset = this.table.getdataListParm.offset
  2459. this.getList()
  2460. // this.$router.push('/formulationPlan/dhedFormula')
  2461. },
  2462. handleSelect(val) {
  2463. console.log('勾选数据', val)
  2464. this.selectList = val
  2465. },
  2466. // 营养评估
  2467. handleNutritional() {
  2468. console.log('点击了营养评估')
  2469. this.dialogFull = false
  2470. if (this.selectList.length !== 1) {
  2471. this.$message({ type: 'error', message: '请选择一条栏舍信息进行营养评估', duration: 2000 })
  2472. return false
  2473. } else {
  2474. console.log(this.nutritional.temp)
  2475. this.nutritional.dialogStatus = 'Nutritional'
  2476. this.nutritional.activeName = 'first'
  2477. this.nutritional.dialogFormVisible = true
  2478. this.nutritional.tab1.getdataListParm1.parammaps.pastureid = this.selectList[0].pastureid
  2479. this.nutritional.tab1.getdataListParm1.parammaps.barid = this.selectList[0].barid
  2480. this.getNutritionalList()
  2481. this.nutritional.tab1.list = []
  2482. }
  2483. },
  2484. tableRowClassName({ row }) {
  2485. // console.log(row)
  2486. if (row.isColor == '0') {
  2487. return 'red-row'
  2488. } else {
  2489. return ''
  2490. }
  2491. },
  2492. handleNutritionalTab(item) {
  2493. if (item == 'first ') {
  2494. this.nutritional.tab1.getdataListParm1.parammaps.pastureid = this.selectList[0].pastureid
  2495. this.nutritional.tab1.getdataListParm1.parammaps.barid = this.selectList[0].barid
  2496. this.getNutritionalList()
  2497. this.nutritional.tab1.list = []
  2498. } else {
  2499. console.log('牛群评估')
  2500. this.nutritional.tab2.getdataListParm1.parammaps.pastureid = this.selectList[0].pastureid
  2501. this.nutritional.tab2.getdataListParm1.parammaps.barid = this.selectList[0].barid
  2502. this.nutritional.tab2.getdataListParm1.parammaps.startTime = parseTime(this.nutritional.tab2.inputDatetime[0], '{y}-{m}-{d}')
  2503. this.nutritional.tab2.getdataListParm1.parammaps.stopTime = parseTime(this.nutritional.tab2.inputDatetime[1], '{y}-{m}-{d}')
  2504. this.nutritional.tab2.getdataListParm2.parammaps.pastureid = this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  2505. this.nutritional.tab2.getdataListParm2.parammaps.barid = this.nutritional.tab2.getdataListParm1.parammaps.barid
  2506. this.nutritional.tab2.getdataListParm2.parammaps.startTime = this.nutritional.tab2.getdataListParm1.parammaps.startTime
  2507. this.nutritional.tab2.getdataListParm2.parammaps.stopTime = this.nutritional.tab2.getdataListParm1.parammaps.stopTime
  2508. this.nutritional.tab2.getdataListParm3.parammaps.pastureid = this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  2509. this.nutritional.tab2.getdataListParm3.parammaps.barid = this.nutritional.tab2.getdataListParm1.parammaps.barid
  2510. this.nutritional.tab2.getdataListParm3.parammaps.startTime = this.nutritional.tab2.getdataListParm1.parammaps.startTime
  2511. this.nutritional.tab2.getdataListParm3.parammaps.stopTime = this.nutritional.tab2.getdataListParm1.parammaps.stopTime
  2512. this.nutritional.tab2.getdataListParm4.parammaps.pastureid = this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  2513. this.nutritional.tab2.getdataListParm4.parammaps.barid = this.nutritional.tab2.getdataListParm1.parammaps.barid
  2514. this.nutritional.tab2.getdataListParm4.parammaps.startTime = this.nutritional.tab2.getdataListParm1.parammaps.startTime
  2515. this.nutritional.tab2.getdataListParm4.parammaps.stopTime = this.nutritional.tab2.getdataListParm1.parammaps.stopTime
  2516. this.getTab2NutritionalList1()
  2517. this.getTab2NutritionalList2()
  2518. this.getTab2NutritionalList3()
  2519. this.getTab2NutritionalList4()
  2520. }
  2521. },
  2522. changeTab2Date() {
  2523. this.nutritional.tab2.getdataListParm1.parammaps.pastureid = this.selectList[0].pastureid
  2524. this.nutritional.tab2.getdataListParm1.parammaps.barid = this.selectList[0].barid
  2525. this.nutritional.tab2.getdataListParm1.parammaps.startTime = parseTime(this.nutritional.tab2.inputDatetime[0], '{y}-{m}-{d}')
  2526. this.nutritional.tab2.getdataListParm1.parammaps.stopTime = parseTime(this.nutritional.tab2.inputDatetime[1], '{y}-{m}-{d}')
  2527. this.nutritional.tab2.getdataListParm2.parammaps.pastureid = this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  2528. this.nutritional.tab2.getdataListParm2.parammaps.barid = this.nutritional.tab2.getdataListParm1.parammaps.barid
  2529. this.nutritional.tab2.getdataListParm2.parammaps.startTime = this.nutritional.tab2.getdataListParm1.parammaps.startTime
  2530. this.nutritional.tab2.getdataListParm2.parammaps.stopTime = this.nutritional.tab2.getdataListParm1.parammaps.stopTime
  2531. this.nutritional.tab2.getdataListParm3.parammaps.pastureid = this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  2532. this.nutritional.tab2.getdataListParm3.parammaps.barid = this.nutritional.tab2.getdataListParm1.parammaps.barid
  2533. this.nutritional.tab2.getdataListParm3.parammaps.startTime = this.nutritional.tab2.getdataListParm1.parammaps.startTime
  2534. this.nutritional.tab2.getdataListParm3.parammaps.stopTime = this.nutritional.tab2.getdataListParm1.parammaps.stopTime
  2535. this.nutritional.tab2.getdataListParm4.parammaps.pastureid = this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  2536. this.nutritional.tab2.getdataListParm4.parammaps.barid = this.nutritional.tab2.getdataListParm1.parammaps.barid
  2537. this.nutritional.tab2.getdataListParm4.parammaps.startTime = this.nutritional.tab2.getdataListParm1.parammaps.startTime
  2538. this.nutritional.tab2.getdataListParm4.parammaps.stopTime = this.nutritional.tab2.getdataListParm1.parammaps.stopTime
  2539. this.getTab2NutritionalList1()
  2540. this.getTab2NutritionalList2()
  2541. this.getTab2NutritionalList3()
  2542. this.getTab2NutritionalList4()
  2543. },
  2544. handleBefore() {
  2545. if (this.nutritional.activeName == 'first') {
  2546. if (this.nutritional.tab1.inputDatetime !== '' && this.nutritional.tab1.inputDatetime !== null) {
  2547. var start = new Date(this.nutritional.tab1.inputDatetime[0].setDate(this.nutritional.tab1.inputDatetime[0].getDate() - 1))
  2548. var stop = new Date(this.nutritional.tab1.inputDatetime[1].setDate(this.nutritional.tab1.inputDatetime[1].getDate() - 1))
  2549. this.nutritional.tab1.inputDatetime.length = 0
  2550. this.nutritional.tab1.inputDatetime.push(start, stop)
  2551. this.$forceUpdate()
  2552. }
  2553. } else {
  2554. var start2 = new Date(this.nutritional.tab2.inputDatetime[0].setDate(this.nutritional.tab2.inputDatetime[0].getDate() - 1))
  2555. var stop2 = new Date(this.nutritional.tab2.inputDatetime[1].setDate(this.nutritional.tab2.inputDatetime[1].getDate() - 1))
  2556. this.nutritional.tab2.inputDatetime.length = 0
  2557. this.nutritional.tab2.inputDatetime.push(start2, stop2)
  2558. this.$forceUpdate()
  2559. this.nutritional.tab2.getdataListParm1.parammaps.pastureid = this.selectList[0].pastureid
  2560. this.nutritional.tab2.getdataListParm1.parammaps.barid = this.selectList[0].barid
  2561. this.nutritional.tab2.getdataListParm1.parammaps.startTime = parseTime(this.nutritional.tab2.inputDatetime[0], '{y}-{m}-{d}')
  2562. this.nutritional.tab2.getdataListParm1.parammaps.stopTime = parseTime(this.nutritional.tab2.inputDatetime[1], '{y}-{m}-{d}')
  2563. this.nutritional.tab2.getdataListParm2.parammaps.pastureid = this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  2564. this.nutritional.tab2.getdataListParm2.parammaps.barid = this.nutritional.tab2.getdataListParm1.parammaps.barid
  2565. this.nutritional.tab2.getdataListParm2.parammaps.startTime = parseTime(this.nutritional.tab2.inputDatetime[0], '{y}-{m}-{d}')
  2566. this.nutritional.tab2.getdataListParm2.parammaps.stopTime = parseTime(this.nutritional.tab2.inputDatetime[1], '{y}-{m}-{d}')
  2567. this.nutritional.tab2.getdataListParm3.parammaps.pastureid = this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  2568. this.nutritional.tab2.getdataListParm3.parammaps.barid = this.nutritional.tab2.getdataListParm1.parammaps.barid
  2569. this.nutritional.tab2.getdataListParm3.parammaps.startTime = parseTime(this.nutritional.tab2.inputDatetime[0], '{y}-{m}-{d}')
  2570. this.nutritional.tab2.getdataListParm3.parammaps.stopTime = parseTime(this.nutritional.tab2.inputDatetime[1], '{y}-{m}-{d}')
  2571. this.nutritional.tab2.getdataListParm4.parammaps.pastureid = this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  2572. this.nutritional.tab2.getdataListParm4.parammaps.barid = this.nutritional.tab2.getdataListParm1.parammaps.barid
  2573. this.nutritional.tab2.getdataListParm4.parammaps.startTime = parseTime(this.nutritional.tab2.inputDatetime[0], '{y}-{m}-{d}')
  2574. this.nutritional.tab2.getdataListParm4.parammaps.stopTime = parseTime(this.nutritional.tab2.inputDatetime[1], '{y}-{m}-{d}')
  2575. this.getTab2NutritionalList1()
  2576. this.getTab2NutritionalList2()
  2577. this.getTab2NutritionalList3()
  2578. this.getTab2NutritionalList4()
  2579. }
  2580. },
  2581. handleNext() {
  2582. if (this.nutritional.activeName == 'first') {
  2583. if (this.nutritional.tab1.inputDatetime !== '' && this.nutritional.tab1.inputDatetime !== null) {
  2584. console.log(this.nutritional.tab1.inputDatetime)
  2585. var start3 = new Date(this.nutritional.tab1.inputDatetime[0].setDate(this.nutritional.tab1.inputDatetime[0].getDate() + 1))
  2586. var stop3 = new Date(this.nutritional.tab1.inputDatetime[1].setDate(this.nutritional.tab1.inputDatetime[1].getDate() + 1))
  2587. this.nutritional.tab1.inputDatetime.length = 0
  2588. this.nutritional.tab1.inputDatetime.push(start3, stop3)
  2589. this.$forceUpdate()
  2590. }
  2591. } else {
  2592. var start4 = new Date(this.nutritional.tab2.inputDatetime[0].setDate(this.nutritional.tab2.inputDatetime[0].getDate() + 1))
  2593. var stop4 = new Date(this.nutritional.tab2.inputDatetime[1].setDate(this.nutritional.tab2.inputDatetime[1].getDate() + 1))
  2594. this.nutritional.tab2.inputDatetime.length = 0
  2595. this.nutritional.tab2.inputDatetime.push(start4, stop4)
  2596. this.$forceUpdate()
  2597. this.nutritional.tab2.getdataListParm1.parammaps.pastureid = this.selectList[0].pastureid
  2598. this.nutritional.tab2.getdataListParm1.parammaps.barid = this.selectList[0].barid
  2599. this.nutritional.tab2.getdataListParm1.parammaps.startTime = parseTime(this.nutritional.tab2.inputDatetime[0], '{y}-{m}-{d}')
  2600. this.nutritional.tab2.getdataListParm1.parammaps.stopTime = parseTime(this.nutritional.tab2.inputDatetime[1], '{y}-{m}-{d}')
  2601. this.nutritional.tab2.getdataListParm2.parammaps.pastureid = this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  2602. this.nutritional.tab2.getdataListParm2.parammaps.barid = this.nutritional.tab2.getdataListParm1.parammaps.barid
  2603. this.nutritional.tab2.getdataListParm2.parammaps.startTime = parseTime(this.nutritional.tab2.inputDatetime[0], '{y}-{m}-{d}')
  2604. this.nutritional.tab2.getdataListParm2.parammaps.stopTime = parseTime(this.nutritional.tab2.inputDatetime[1], '{y}-{m}-{d}')
  2605. this.nutritional.tab2.getdataListParm3.parammaps.pastureid = this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  2606. this.nutritional.tab2.getdataListParm3.parammaps.barid = this.nutritional.tab2.getdataListParm1.parammaps.barid
  2607. this.nutritional.tab2.getdataListParm3.parammaps.startTime = parseTime(this.nutritional.tab2.inputDatetime[0], '{y}-{m}-{d}')
  2608. this.nutritional.tab2.getdataListParm3.parammaps.stopTime = parseTime(this.nutritional.tab2.inputDatetime[1], '{y}-{m}-{d}')
  2609. this.nutritional.tab2.getdataListParm4.parammaps.pastureid = this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  2610. this.nutritional.tab2.getdataListParm4.parammaps.barid = this.nutritional.tab2.getdataListParm1.parammaps.barid
  2611. this.nutritional.tab2.getdataListParm4.parammaps.startTime = parseTime(this.nutritional.tab2.inputDatetime[0], '{y}-{m}-{d}')
  2612. this.nutritional.tab2.getdataListParm4.parammaps.stopTime = parseTime(this.nutritional.tab2.inputDatetime[1], '{y}-{m}-{d}')
  2613. this.getTab2NutritionalList1()
  2614. this.getTab2NutritionalList2()
  2615. this.getTab2NutritionalList3()
  2616. this.getTab2NutritionalList4()
  2617. }
  2618. },
  2619. getNutritionalList() {
  2620. this.nutritional.tab1.listLoading1 = true
  2621. GetDataByName(this.nutritional.tab1.getdataListParm1).then(response => {
  2622. console.log('评估上方数据', response.data.list)
  2623. if (response.data.list !== null) {
  2624. response.data.list[0].cowclassid = String(response.data.list[0].cowclassid)
  2625. this.nutritional.tab1.temp = response.data.list[0]
  2626. this.nutritional.tab1.disabledCowclass = true
  2627. this.nutritional.tab1.getdataListParm2.parammaps.name = 'judgenurFT'
  2628. this.nutritional.tab1.getdataListParm2.parammaps.name1 = 'judgenurBarHSL'
  2629. this.nutritional.tab1.getdataListParm2.parammaps.startTime = parseTime(this.nutritional.tab1.inputDatetime[0], '{y}-{m}-{d}')
  2630. this.nutritional.tab1.getdataListParm2.parammaps.stopTime = parseTime(this.nutritional.tab1.inputDatetime[1], '{y}-{m}-{d}')
  2631. this.nutritional.tab1.getdataListParm2.parammaps.bw = parseFloat(this.nutritional.tab1.temp.bw)
  2632. this.nutritional.tab1.getdataListParm2.parammaps.dayw = parseFloat(this.nutritional.tab1.temp.dayw)
  2633. this.nutritional.tab1.getdataListParm2.parammaps.fetal = parseFloat(this.nutritional.tab1.temp.fetal)
  2634. this.nutritional.tab1.getdataListParm2.parammaps.avgdim = parseFloat(this.nutritional.tab1.temp.avgdim)
  2635. this.nutritional.tab1.getdataListParm2.parammaps.dayspre = parseFloat(this.nutritional.tab1.temp.dayspre)
  2636. this.nutritional.tab1.getdataListParm2.parammaps.product = parseFloat(this.nutritional.tab1.temp.product)
  2637. this.nutritional.tab1.getdataListParm2.parammaps.fat = parseFloat(this.nutritional.tab1.temp.fat)
  2638. this.nutritional.tab1.getdataListParm2.parammaps.pro = parseFloat(this.nutritional.tab1.temp.pro)
  2639. this.nutritional.tab1.getdataListParm2.parammaps.lactose = parseFloat(this.nutritional.tab1.temp.lactose)
  2640. this.nutritional.tab1.getdataListParm2.parammaps.source = parseFloat(this.nutritional.tab1.temp.source)
  2641. this.nutritional.tab1.getdataListParm2.parammaps.tem = parseFloat(this.nutritional.tab1.temp.tem)
  2642. this.nutritional.tab1.getdataListParm2.parammaps.cowsum = parseFloat(this.nutritional.tab1.temp.cowsum)
  2643. this.nutritional.tab1.getdataListParm2.parammaps.cowclass = this.nutritional.tab1.temp.cowclass
  2644. this.nutritional.tab1.getdataListParm2.parammaps.cowclassid = this.nutritional.tab1.temp.cowclassid
  2645. this.nutritional.tab1.getdataListParm2.parammaps.bigcowclass = this.nutritional.tab1.temp.bigcowclass
  2646. this.nutritional.tab1.getdataListParm2.parammaps.pastureid = this.selectList[0].pastureid
  2647. this.nutritional.tab1.getdataListParm2.parammaps.barid = this.nutritional.tab1.temp.barid
  2648. this.nutritional.tab1.getdataListParm2.parammaps.date = this.nutritional.tab1.temp.date
  2649. this.getNutritionalList2()
  2650. } else {
  2651. this.nutritional.tab1.temp = []
  2652. this.nutritional.tab1.disabledCowclass = false
  2653. }
  2654. setTimeout(() => {
  2655. this.nutritional.tab1.listLoading = false
  2656. }, 100)
  2657. })
  2658. },
  2659. assessmentData() {
  2660. console.log('评估保存')
  2661. this.$refs['temp'].validate(valid => {
  2662. if (valid) {
  2663. if (this.nutritional.tab1.inputDatetime == '' || this.nutritional.tab1.inputDatetime == null) {
  2664. this.$message({ type: 'error', message: '开始日期结束日期不能为空', duration: 2000 })
  2665. return false
  2666. } else {
  2667. // 牛头数
  2668. const positiveInteger = /^[1-9]\d*$/
  2669. if (this.nutritional.tab1.temp.cowsum !== '') {
  2670. if (!positiveInteger.test(parseFloat(this.nutritional.tab1.temp.cowsum))) {
  2671. this.$message({ type: 'error', message: '牛头数请输入正整数', duration: 2000 })
  2672. return false
  2673. }
  2674. }
  2675. const twoDecimalPlaces = /^\d+(\.\d{1,2})?$/
  2676. // 温度环境
  2677. if (this.nutritional.tab1.temp.tem !== '') {
  2678. if (!twoDecimalPlaces.test(parseFloat(this.nutritional.tab1.temp.tem))) {
  2679. this.$message({ type: 'error', message: '温度环境请保留两位小数', duration: 2000 })
  2680. return false
  2681. }
  2682. }
  2683. // 平均月龄
  2684. if (this.nutritional.tab1.temp.avgmonthage !== '') {
  2685. if (!twoDecimalPlaces.test(parseFloat(this.nutritional.tab1.temp.avgmonthage))) {
  2686. this.$message({ type: 'error', message: '平均月龄请保留两位小数', duration: 2000 })
  2687. return false
  2688. }
  2689. }
  2690. // 体重
  2691. if (this.nutritional.tab1.temp.bw !== '') {
  2692. if (!twoDecimalPlaces.test(parseFloat(this.nutritional.tab1.temp.bw))) {
  2693. this.$message({ type: 'error', message: '体重请保留两位小数', duration: 2000 })
  2694. return false
  2695. }
  2696. }
  2697. // 日增重
  2698. if (this.nutritional.tab1.temp.dayw !== '') {
  2699. if (!twoDecimalPlaces.test(parseFloat(this.nutritional.tab1.temp.dayw))) {
  2700. this.$message({ type: 'error', message: '日增重请保留两位小数', duration: 2000 })
  2701. return false
  2702. }
  2703. }
  2704. const dayspre = /^(([1-9]|([1-9]\d)|(1\d\d)|(2([0-7]\d|7[0-9]))))$/
  2705. // 怀孕天数
  2706. if (this.nutritional.tab1.temp.dayspre !== '') {
  2707. if (!dayspre.test(parseFloat(this.nutritional.tab1.temp.dayspre))) {
  2708. this.$message({ type: 'error', message: '怀孕天数请输入大于0小于280整数', duration: 2000 })
  2709. return false
  2710. }
  2711. }
  2712. const fetal = /^(?:[1-9]|1[0-9])$/
  2713. // 胎次
  2714. if (this.nutritional.tab1.temp.fetal !== '') {
  2715. if (!fetal.test(parseFloat(this.nutritional.tab1.temp.fetal))) {
  2716. this.$message({ type: 'error', message: '胎次请输入大于0小于20整数', duration: 2000 })
  2717. return false
  2718. }
  2719. }
  2720. // 平均泌乳
  2721. if (this.nutritional.tab1.temp.avgdim !== '') {
  2722. if (!positiveInteger.test(parseFloat(this.nutritional.tab1.temp.avgdim))) {
  2723. this.$message({ type: 'error', message: '平均泌乳天数请输入正整数', duration: 2000 })
  2724. return false
  2725. }
  2726. }
  2727. // 产奶量
  2728. if (this.nutritional.tab1.temp.product !== '') {
  2729. if (!twoDecimalPlaces.test(parseFloat(this.nutritional.tab1.temp.product))) {
  2730. this.$message({ type: 'error', message: '产奶量请保留两位小数', duration: 2000 })
  2731. return false
  2732. }
  2733. }
  2734. // 乳脂率
  2735. if (this.nutritional.tab1.temp.fat !== '') {
  2736. if (!twoDecimalPlaces.test(parseFloat(this.nutritional.tab1.temp.fat))) {
  2737. this.$message({ type: 'error', message: '乳脂率请保留两位小数', duration: 2000 })
  2738. return false
  2739. }
  2740. }
  2741. // 乳蛋白率
  2742. if (this.nutritional.tab1.temp.pro !== '') {
  2743. if (!twoDecimalPlaces.test(parseFloat(this.nutritional.tab1.temp.pro))) {
  2744. this.$message({ type: 'error', message: '乳蛋白率请保留两位小数', duration: 2000 })
  2745. return false
  2746. }
  2747. }
  2748. // 乳糖率
  2749. if (this.nutritional.tab1.temp.lactose !== '') {
  2750. if (!twoDecimalPlaces.test(parseFloat(this.nutritional.tab1.temp.lactose))) {
  2751. this.$message({ type: 'error', message: '乳糖率请保留两位小数', duration: 2000 })
  2752. return false
  2753. }
  2754. }
  2755. this.nutritional.tab1.getdataListParm2.parammaps.name = 'judgenurFT'
  2756. this.nutritional.tab1.getdataListParm2.parammaps.name1 = 'judgenurBarHSL'
  2757. this.nutritional.tab1.getdataListParm2.parammaps.startTime = parseTime(this.nutritional.tab1.inputDatetime[0], '{y}-{m}-{d}')
  2758. this.nutritional.tab1.getdataListParm2.parammaps.stopTime = parseTime(this.nutritional.tab1.inputDatetime[1], '{y}-{m}-{d}')
  2759. this.nutritional.tab1.getdataListParm2.parammaps.bw = parseFloat(this.nutritional.tab1.temp.bw)
  2760. this.nutritional.tab1.getdataListParm2.parammaps.dayw = parseFloat(this.nutritional.tab1.temp.dayw)
  2761. this.nutritional.tab1.getdataListParm2.parammaps.fetal = parseFloat(this.nutritional.tab1.temp.fetal)
  2762. this.nutritional.tab1.getdataListParm2.parammaps.avgdim = parseFloat(this.nutritional.tab1.temp.avgdim)
  2763. this.nutritional.tab1.getdataListParm2.parammaps.dayspre = parseFloat(this.nutritional.tab1.temp.dayspre)
  2764. this.nutritional.tab1.getdataListParm2.parammaps.product = parseFloat(this.nutritional.tab1.temp.product)
  2765. this.nutritional.tab1.getdataListParm2.parammaps.fat = parseFloat(this.nutritional.tab1.temp.fat)
  2766. this.nutritional.tab1.getdataListParm2.parammaps.pro = parseFloat(this.nutritional.tab1.temp.pro)
  2767. this.nutritional.tab1.getdataListParm2.parammaps.lactose = parseFloat(this.nutritional.tab1.temp.lactose)
  2768. this.nutritional.tab1.getdataListParm2.parammaps.source = parseFloat(this.nutritional.tab1.temp.source)
  2769. this.nutritional.tab1.getdataListParm2.parammaps.tem = parseFloat(this.nutritional.tab1.temp.tem)
  2770. this.nutritional.tab1.getdataListParm2.parammaps.cowsum = parseFloat(this.nutritional.tab1.temp.cowsum)
  2771. this.nutritional.tab1.getdataListParm2.parammaps.cowclass = this.nutritional.tab1.temp.cowclass
  2772. this.nutritional.tab1.getdataListParm2.parammaps.cowclassid = this.nutritional.tab1.temp.cowclassid
  2773. this.nutritional.tab1.getdataListParm2.parammaps.bigcowclass = this.nutritional.tab1.temp.bigcowclass
  2774. this.nutritional.tab1.getdataListParm2.parammaps.pastureid = this.selectList[0].pastureid
  2775. this.nutritional.tab1.getdataListParm2.parammaps.barid = this.nutritional.tab1.temp.barid
  2776. this.nutritional.tab1.getdataListParm2.parammaps.date = this.nutritional.tab1.temp.date
  2777. this.getNutritionalList2()
  2778. }
  2779. }
  2780. })
  2781. },
  2782. getNutritionalList2() {
  2783. this.nutritional.tab1.listLoading2 = true
  2784. const url = 'authdata/GETNurJudge'
  2785. const data = this.nutritional.tab1.getdataListParm2
  2786. postJson(url, data).then(response => {
  2787. if (response.msg !== 'fail') {
  2788. if (response.data.list !== null) {
  2789. for (let i = 0; i < response.data.length; i++) {
  2790. if (response.data[i].cowneed == null) {
  2791. response.data[i].cowneed = ''
  2792. }
  2793. var reg = RegExp(/>/)
  2794. var reg2 = RegExp(/</)
  2795. var reg3 = RegExp(/-/)
  2796. if (reg.test(response.data[i].cowneed) == true) {
  2797. const cowneed = response.data[i].cowneed.split('>')[1]
  2798. if ((parseFloat(response.data[i].ftpro) < parseFloat(cowneed)) || (parseFloat(response.data[i].hprov) < parseFloat(cowneed)) || parseFloat(response.data[i].sprov) < parseFloat(cowneed)) {
  2799. this.$set(response.data[i], 'isColor', '0')
  2800. } else {
  2801. this.$set(response.data[i], 'isColor', '')
  2802. }
  2803. } else if (reg2.test(response.data[i].cowneed) == true) {
  2804. const cowneed2 = response.data[i].cowneed.split('<')[1]
  2805. if ((parseFloat(response.data[i].ftpro) > parseFloat(cowneed2)) || (parseFloat(response.data[i].hprov) > parseFloat(cowneed2)) || parseFloat(response.data[i].sprov) > parseFloat(cowneed2)) {
  2806. this.$set(response.data[i], 'isColor', '0')
  2807. } else {
  2808. this.$set(response.data[i], 'isColor', '')
  2809. }
  2810. } else if (reg3.test(response.data[i].cowneed) == true) {
  2811. response.data[i].cowneed = String(response.data[i].cowneed)
  2812. if (response.data[i].cowneed.length == 1) {
  2813. const cowneed3 = response.data[i].cowneed.split('-')
  2814. console.log(cowneed3, 'cowneed3')
  2815. if (parseFloat(response.data[i].ftpro) > parseFloat(cowneed3[0]) && parseFloat(response.data[i].ftpro) < parseFloat(cowneed3[1])) {
  2816. this.$set(response.data[i], 'isColor', '')
  2817. } else if (parseFloat(response.data[i].hprov) > parseFloat(cowneed3[0]) && parseFloat(response.data[i].hprov) < parseFloat(cowneed3[1])) {
  2818. this.$set(response.data[i], 'isColor', '')
  2819. } else if (parseFloat(response.data[i].sprov) > parseFloat(cowneed3[0]) && parseFloat(response.data[i].sprov) < parseFloat(cowneed3[1])) {
  2820. this.$set(response.data[i], 'isColor', '')
  2821. } else if (cowneed3[0] == '' && cowneed3[0] == '') {
  2822. this.$set(response.data[i], 'isColor', '')
  2823. } else {
  2824. this.$set(response.data[i], 'isColor', '0')
  2825. }
  2826. } else {
  2827. if ((parseFloat(response.data[i].ftpro) < parseFloat(response.data[i].cowneed)) || (parseFloat(response.data[i].hprov) < parseFloat(response.data[i].cowneed)) || parseFloat(response.data[i].sprov) < parseFloat(response.data[i].cowneed)) {
  2828. this.$set(response.data[i], 'isColor', '0')
  2829. } else {
  2830. this.$set(response.data[i], 'isColor', '')
  2831. }
  2832. }
  2833. } else {
  2834. response.data[i].cowneed = String(response.data[i].cowneed)
  2835. if (response.data[i].cowneed[0] !== '-') {
  2836. if ((parseFloat(response.data[i].ftpro) < parseFloat(response.data[i].cowneed)) || (parseFloat(response.data[i].hprov) < parseFloat(response.data[i].cowneed)) || parseFloat(response.data[i].sprov) < parseFloat(response.data[i].cowneed)) {
  2837. this.$set(response.data[i], 'isColor', '0')
  2838. } else {
  2839. this.$set(response.data[i], 'isColor', '')
  2840. }
  2841. } else {
  2842. this.$set(response.data[i], 'isColor', '')
  2843. }
  2844. }
  2845. }
  2846. console.log(response.data)
  2847. console.log('评估下方数据', response.data)
  2848. this.nutritional.tab1.list = response.data
  2849. this.nutritional.tab1.total = response.data.total
  2850. } else {
  2851. this.nutritional.tab1.list = []
  2852. }
  2853. } else {
  2854. this.$notify({ title: '失败', message: response.data, type: 'warning', duration: 2000 })
  2855. }
  2856. setTimeout(() => {
  2857. this.nutritional.tab1.listLoading2 = false
  2858. }, 100)
  2859. })
  2860. },
  2861. // 牛群评估
  2862. getTab2NutritionalList1() {
  2863. this.nutritional.tab2.listLoading1 = true
  2864. GetDataByName(this.nutritional.tab2.getdataListParm1).then(response => {
  2865. console.log('宾州筛分析', response.data.list)
  2866. if (response.data.list !== null) {
  2867. this.nutritional.tab2.list1 = response.data.list
  2868. this.nutritional.tab2.pageNum1 = response.data.pageNum
  2869. this.nutritional.tab2.pageSize1 = response.data.pageSize
  2870. this.nutritional.tab2.total1 = response.data.total
  2871. } else {
  2872. this.nutritional.tab2.list1 = []
  2873. }
  2874. setTimeout(() => {
  2875. this.nutritional.tab2.listLoading1 = false
  2876. }, 100)
  2877. })
  2878. },
  2879. getTab2NutritionalList2() {
  2880. this.nutritional.tab2.listLoading2 = true
  2881. GetDataByName(this.nutritional.tab2.getdataListParm2).then(response => {
  2882. console.log('粪便筛分析', response.data.list)
  2883. if (response.data.list !== null) {
  2884. this.nutritional.tab2.list2 = response.data.list
  2885. this.nutritional.tab2.pageNum2 = response.data.pageNum
  2886. this.nutritional.tab2.pageSize2 = response.data.pageSize
  2887. this.nutritional.tab2.total2 = response.data.total
  2888. } else {
  2889. this.nutritional.tab2.list2 = []
  2890. }
  2891. setTimeout(() => {
  2892. this.nutritional.tab2.listLoading2 = false
  2893. }, 100)
  2894. })
  2895. },
  2896. getTab2NutritionalList3() {
  2897. this.nutritional.tab2.listLoading3 = true
  2898. GetDataByName(this.nutritional.tab2.getdataListParm3).then(response => {
  2899. console.log('BCS评分', response.data.list)
  2900. if (response.data.list !== null) {
  2901. for (let i = 0; i < response.data.list.length; i++) {
  2902. this.$set(response.data.list[i], 'score25rate', (parseFloat(response.data.list[i].score25) / parseFloat(response.data.list[i].cowsum) * 100).toFixed(parseInt(Cookies.get('decimal'))))
  2903. this.$set(response.data.list[i], 'score275rate', (parseFloat(response.data.list[i].score275) / parseFloat(response.data.list[i].cowsum) * 100).toFixed(parseInt(Cookies.get('decimal'))))
  2904. this.$set(response.data.list[i], 'score3rate', (parseFloat(response.data.list[i].score3) / parseFloat(response.data.list[i].cowsum) * 100).toFixed(parseInt(Cookies.get('decimal'))))
  2905. this.$set(response.data.list[i], 'score325rate', (parseFloat(response.data.list[i].score325) / parseFloat(response.data.list[i].cowsum) * 100).toFixed(parseInt(Cookies.get('decimal'))))
  2906. this.$set(response.data.list[i], 'score35rate', (parseFloat(response.data.list[i].score35) / parseFloat(response.data.list[i].cowsum) * 100).toFixed(parseInt(Cookies.get('decimal'))))
  2907. this.$set(response.data.list[i], 'score375rate', (parseFloat(response.data.list[i].score375) / parseFloat(response.data.list[i].cowsum) * 100).toFixed(parseInt(Cookies.get('decimal'))))
  2908. this.$set(response.data.list[i], 'score4rate', (100 - response.data.list[i].score25rate - response.data.list[i].score275rate - response.data.list[i].score3rate - response.data.list[i].score325rate - response.data.list[i].score35rate - response.data.list[i].score375rate).toFixed(parseInt(Cookies.get('decimal'))))
  2909. }
  2910. this.nutritional.tab2.list3 = response.data.list
  2911. this.nutritional.tab2.pageNum3 = response.data.pageNum
  2912. this.nutritional.tab2.pageSize3 = response.data.pageSize
  2913. this.nutritional.tab2.total3 = response.data.total
  2914. } else {
  2915. this.nutritional.tab2.list3 = []
  2916. }
  2917. setTimeout(() => {
  2918. this.nutritional.tab2.listLoading3 = false
  2919. }, 100)
  2920. })
  2921. },
  2922. getTab2NutritionalList4() {
  2923. this.nutritional.tab2.listLoading4 = true
  2924. GetDataByName(this.nutritional.tab2.getdataListParm4).then(response => {
  2925. console.log('粪便评分', response.data.list)
  2926. if (response.data.list !== null) {
  2927. for (let i = 0; i < response.data.list.length; i++) {
  2928. this.$set(response.data.list[i], 'score1rate', (parseFloat(response.data.list[i].score1) / parseFloat(response.data.list[i].cowsum) * 100).toFixed(parseInt(Cookies.get('decimal'))))
  2929. this.$set(response.data.list[i], 'score2rate', (parseFloat(response.data.list[i].score2) / parseFloat(response.data.list[i].cowsum) * 100).toFixed(parseInt(Cookies.get('decimal'))))
  2930. this.$set(response.data.list[i], 'score3rate', (parseFloat(response.data.list[i].score3) / parseFloat(response.data.list[i].cowsum) * 100).toFixed(parseInt(Cookies.get('decimal'))))
  2931. this.$set(response.data.list[i], 'score4rate', (parseFloat(response.data.list[i].score4) / parseFloat(response.data.list[i].cowsum) * 100).toFixed(parseInt(Cookies.get('decimal'))))
  2932. this.$set(response.data.list[i], 'score5rate', (100 - response.data.list[i].score1rate - response.data.list[i].score2rate - response.data.list[i].score3rate - response.data.list[i].score4rate).toFixed(parseInt(Cookies.get('decimal'))))
  2933. }
  2934. this.nutritional.tab2.list4 = response.data.list
  2935. this.nutritional.tab2.pageNum4 = response.data.pageNum
  2936. this.nutritional.tab2.pageSize4 = response.data.pageSize
  2937. this.nutritional.tab2.total4 = response.data.total
  2938. } else {
  2939. this.nutritional.tab2.list4 = []
  2940. }
  2941. setTimeout(() => {
  2942. this.nutritional.tab2.listLoading4 = false
  2943. }, 100)
  2944. })
  2945. },
  2946. // 历史记录
  2947. handleHistoryRecords() {
  2948. console.log('点击了历史记录')
  2949. this.dialogFull = false
  2950. this.history.dialogStatus = 'history'
  2951. this.history.dialogFormVisible = true
  2952. this.getDateList()
  2953. },
  2954. // 历史时间
  2955. getDateList() {
  2956. GetDataByName(this.history.getdataDateParm).then(response => {
  2957. console.log('table数据', response.data.list)
  2958. if (response.data.list !== null) {
  2959. this.history.getdataListParm.parammaps.date = response.data.list[0].maxdate
  2960. this.getHistoryIsDisplay()
  2961. } else {
  2962. this.history.getdataListParm.parammaps.date = ''
  2963. }
  2964. })
  2965. },
  2966. getHistoryIsDisplay() {
  2967. GetDataByName(this.table.getdataListParm2).then(response => {
  2968. console.log(response.data.list[0].inforvalue)
  2969. if (response.data.list !== null) {
  2970. if (response.data.list[0].inforvalue == 0) {
  2971. this.table.isPtsfname = false
  2972. } else {
  2973. this.table.isPtsfname = true
  2974. }
  2975. }
  2976. })
  2977. GetDataByName(this.table.getdataListParm3).then(response => {
  2978. if (response.data.list !== null) {
  2979. if (response.data.list[0].inforvalue == 1) {
  2980. this.history.isRW1 = true
  2981. this.history.isRW2 = false
  2982. this.history.isRW3 = false
  2983. this.history.isRW4 = false
  2984. this.history.isRW5 = false
  2985. this.history.isRW6 = false
  2986. } else if (response.data.list[0].inforvalue == 2) {
  2987. this.history.isRW1 = true
  2988. this.history.isRW2 = true
  2989. this.history.isRW3 = false
  2990. this.history.isRW4 = false
  2991. this.history.isRW5 = false
  2992. this.history.isRW6 = false
  2993. } else if (response.data.list[0].inforvalue == 3) {
  2994. this.history.isRW1 = true
  2995. this.history.isRW2 = true
  2996. this.history.isRW3 = true
  2997. this.history.isRW4 = false
  2998. this.history.isRW5 = false
  2999. this.history.isRW6 = false
  3000. } else if (response.data.list[0].inforvalue == 4) {
  3001. this.history.isRW1 = true
  3002. this.history.isRW2 = true
  3003. this.history.isRW3 = true
  3004. this.history.isRW4 = true
  3005. this.history.isRW5 = false
  3006. this.history.isRW6 = false
  3007. } else if (response.data.list[0].inforvalue == 5) {
  3008. this.history.isRW1 = true
  3009. this.history.isRW2 = true
  3010. this.history.isRW3 = true
  3011. this.history.isRW4 = true
  3012. this.history.isRW5 = true
  3013. this.history.isRW6 = false
  3014. } else if (response.data.list[0].inforvalue == 6) {
  3015. this.history.isRW1 = true
  3016. this.history.isRW2 = true
  3017. this.history.isRW3 = true
  3018. this.history.isRW4 = true
  3019. this.history.isRW5 = true
  3020. this.history.isRW6 = true
  3021. }
  3022. } else {
  3023. this.history.isRW1 = false
  3024. this.history.isRW2 = false
  3025. this.history.isRW3 = false
  3026. this.history.isRW4 = false
  3027. this.history.isRW5 = false
  3028. this.history.isRW6 = false
  3029. }
  3030. })
  3031. this.getHistoryList()
  3032. },
  3033. getHistoryList() {
  3034. this.history.listLoading = true
  3035. GetDataByName(this.history.getdataListParm).then(response => {
  3036. console.log('table数据', response.data.list)
  3037. if (response.data.list !== null) {
  3038. console.log('table数据', response.data.list)
  3039. for (let i = 0; i < response.data.list.length; i++) {
  3040. if (response.data.list[i].ptid == undefined || response.data.list[i].ptname == '') {
  3041. this.$set(response.data.list[i], 'ptid', '')
  3042. this.$set(response.data.list[i], 'ptname', '')
  3043. }
  3044. }
  3045. this.history.list = response.data.list
  3046. this.handleSpan()
  3047. this.history.pageNum = response.data.pageNum
  3048. this.history.pageSize = response.data.pageSize
  3049. this.history.total = response.data.total
  3050. } else {
  3051. this.history.list = []
  3052. }
  3053. setTimeout(() => {
  3054. this.history.listLoading = false
  3055. }, 100)
  3056. })
  3057. },
  3058. handleSpan() {
  3059. this.mergekeys.forEach(key => {
  3060. this.spanObj[key] = []
  3061. let position = 0
  3062. this.history.list.forEach((item, index) => {
  3063. if (index === 0) {
  3064. this.spanObj[key].push(1)
  3065. position = 0
  3066. } else {
  3067. if (key == 'sumweight') {
  3068. if (this.history.list[index][key] === this.history.list[index - 1][key] && this.history.list[index]['barname'] === this.history.list[index - 1]['barname']) {
  3069. this.spanObj[key][position] += 1
  3070. this.spanObj[key].push(0)
  3071. } else {
  3072. this.spanObj[key].push(1)
  3073. position = index
  3074. }
  3075. } else {
  3076. if (this.history.list[index][key] === this.history.list[index - 1][key]) {
  3077. this.spanObj[key][position] += 1
  3078. this.spanObj[key].push(0)
  3079. } else {
  3080. this.spanObj[key].push(1)
  3081. position = index
  3082. }
  3083. }
  3084. }
  3085. })
  3086. })
  3087. },
  3088. objectSpanMethod({ row, column, rowIndex, columnIndex }) {
  3089. for (let i = 0; i < this.mergekeys.length; i++) {
  3090. if (column.property === this.mergekeys[i]) {
  3091. const _row = this.spanObj[this.mergekeys[i]][rowIndex]
  3092. const _col = _row > 0 ? 1 : 0
  3093. return {
  3094. rowspan: _row,
  3095. colspan: _col
  3096. }
  3097. }
  3098. }
  3099. },
  3100. changeDate() {
  3101. this.getHistoryList()
  3102. },
  3103. // 应用
  3104. handleApplication() {
  3105. console.log('点击了应用')
  3106. MessageBox.confirm('是否确认将' + this.history.getdataListParm.parammaps.date + '的数据应用到当前?', {
  3107. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  3108. }).then(() => {
  3109. this.requestParam.name = 'applyFPdate'
  3110. this.requestParam.parammaps = {}
  3111. this.requestParam.parammaps.pastureid = Cookies.get('pastureid')
  3112. this.requestParam.parammaps.date = this.history.getdataListParm.parammaps.date
  3113. PostDataByName(this.requestParam).then(response => {
  3114. if (response.msg === 'fail') {
  3115. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  3116. } else {
  3117. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  3118. this.getHistoryIsDisplay()
  3119. this.getList()
  3120. }
  3121. })
  3122. }).catch(() => {
  3123. this.$message({ type: 'info', message: '已取消应用' })
  3124. })
  3125. },
  3126. // 导出
  3127. handleExport(item) {
  3128. if (item == 1) {
  3129. console.log('点击了导出模板')
  3130. this.download.getdataListParm.parammaps = this.table.getdataListParm.parammaps
  3131. GetDataByName(this.download.getdataListParm).then(response => {
  3132. if (response.data.list !== null) {
  3133. this.download.list = response.data.list
  3134. } else {
  3135. this.download.list = []
  3136. }
  3137. var downloadList = [
  3138. { 'obj1': '1、文件类型为xlsx类型,对应表格文件名格式为:文件名称.xlsx;' },
  3139. { 'obj1': '2、底部工作表名称不可更改,默认为:Sheet1;' },
  3140. { 'obj1': '3、栏舍名称,实际牛头数,系数(%),系数头数,配方模板,补料配方字体为必填;' },
  3141. { 'obj1': '4、第一列栏舍名称默认为系统中栏舍,不可修改;' },
  3142. { 'obj1': '5、实际牛头数为正整数,系数为正数,至多保留俩位小数;' },
  3143. { 'obj1': '6、配方模板名称必须与系统中配方计划—配方模板中的饲喂配方匹配;若补料配方开启,需与配方模板中的补料配方匹配;' },
  3144. { 'obj1': '7、数据最多可导入200条,超过200条请分多个文件导入。' }
  3145. ]
  3146. var excelDatas = [
  3147. {
  3148. tHeader: ['栏舍名称', '实际牛头数', '系数(%)', '配方模板', '补料配方', '第一班比例(%)', '第二班比例(%)', '第三班比例(%)', '第四班比例(%)','第五班比例(%)','第六班比例(%)'],
  3149. filterVal: ['barname', '', '', '', '', '', '', '', ''],
  3150. tableDatas: this.download.list,
  3151. sheetName: 'Sheet1'
  3152. }, {
  3153. tHeader: ['填写规范:'],
  3154. filterVal: ['obj1'],
  3155. tableDatas: downloadList,
  3156. sheetName: 'Sheet2'
  3157. }
  3158. ]
  3159. json2excel(excelDatas, '栏舍配方导入模板', true, 'xlsx')
  3160. })
  3161. } else if (item == 3){
  3162. GetDataByName(this.history.getdataDateParm).then(response => {
  3163. console.log('历史数据', this.history.list)
  3164. if (response.data.list !== null) {
  3165. var excelDatas = [
  3166. {
  3167. tHeader: ['栏舍名称','班次', '软件牛头数', '实际牛头数', '系数(%)', '系数头数', '配方模板', '班次比例', '班次重量', '配方重量', '配方干物质', '饲喂干物质量','采样干物质量','日投喂量'],
  3168. filterVal: ['barname', 'times','softccount', 'ccount', 'ratio', 'ccountratio', 'ptname', 'tratio', 'weight', 'pweight', 'dryweight', 'swdryw', 'cydryw','sumweight'],
  3169. tableDatas: this.history.list,
  3170. sheetName: 'Sheet1'
  3171. }
  3172. ]
  3173. json2excel(excelDatas, '历史记录栏舍配方', true, 'xlsx')
  3174. }
  3175. })
  3176. }else {
  3177. console.log('点击了导出数据')
  3178. this.download.getdataListParm.parammaps = this.table.getdataListParm.parammaps
  3179. GetDataByName(this.download.getdataListParm).then(response => {
  3180. if (response.data.list !== null) {
  3181. for (let i = 0; i < response.data.list.length; i++) {
  3182. if (response.data.list[i].ftid !== undefined && response.data.list[i].ftid !== '') {
  3183. if (this.recipeTemplateList.find(obj => obj.id == response.data.list[i].ftid) !== undefined) {
  3184. this.$set(response.data.list[i], 'dryweight', this.recipeTemplateList.find(obj => obj.id == response.data.list[i].ftid).dryweight) // 编辑保存
  3185. } else {
  3186. this.$set(response.data.list[i], 'dryweight', '')
  3187. }
  3188. }
  3189. if (response.data.list[i].timesopt !== undefined) {
  3190. var timesoptArr = response.data.list[i].timesopt.split(',')
  3191. for (let j = 0; j < timesoptArr.length; j++) {
  3192. response.data.list[i]['r' + timesoptArr[j].split(':')[0]] = timesoptArr[j].split(':')[1]
  3193. response.data.list[i]['w' + timesoptArr[j].split(':')[0]] = timesoptArr[j].split(':')[2]
  3194. }
  3195. }
  3196. if (response.data.list[i].r1 == '' || response.data.list[i].r1 == undefined) {
  3197. response.data.list[i].r1 = 0
  3198. response.data.list[i].w1 = 0
  3199. }
  3200. if (response.data.list[i].r2 == '' || response.data.list[i].r2 == undefined) {
  3201. response.data.list[i].r2 = 0
  3202. response.data.list[i].w2 = 0
  3203. }
  3204. if (response.data.list[i].r3 == '' || response.data.list[i].r3 == undefined) {
  3205. response.data.list[i].r3 = 0
  3206. response.data.list[i].w3 = 0
  3207. }
  3208. if (response.data.list[i].r4 == '' || response.data.list[i].r4 == undefined) {
  3209. response.data.list[i].r4 = 0
  3210. response.data.list[i].w4 = 0
  3211. }
  3212. if (response.data.list[i].r5 == '' || response.data.list[i].r5 == undefined) {
  3213. response.data.list[i].r5 = 0
  3214. response.data.list[i].w5 = 0
  3215. }
  3216. if (response.data.list[i].r6 == '' || response.data.list[i].r6 == undefined) {
  3217. response.data.list[i].r6 = 0
  3218. response.data.list[i].w6 = 0
  3219. }
  3220. this.$set(response.data.list[i], 'sumr', parseFloat(response.data.list[i].r1) + parseFloat(response.data.list[i].r2) + parseFloat(response.data.list[i].r3) + parseFloat(response.data.list[i].r4) + parseFloat(response.data.list[i].r5) + parseFloat(response.data.list[i].r6))
  3221. response.data.list[i].sumr = formatNum(response.data.list[i].sumr, parseInt(Cookies.get('decimalr')))
  3222. this.$set(response.data.list[i], 'dailyWeight', parseFloat(response.data.list[i].w1) + parseFloat(response.data.list[i].w2) + parseFloat(response.data.list[i].w3) + parseFloat(response.data.list[i].w4) + parseFloat(response.data.list[i].w5) + parseFloat(response.data.list[i].w6))
  3223. response.data.list[i].dailyWeight = formatNum(response.data.list[i].dailyWeight, parseInt(Cookies.get('decimal')))
  3224. }
  3225. this.download.list = response.data.list
  3226. } else {
  3227. this.download.list = []
  3228. }
  3229. if (this.table.isRW1 == true && this.table.isRW2 == false && this.table.isRW3 == false && this.table.isRW4 == false && this.table.isRW5 == false && this.table.isRW6 == false) {
  3230. var excelDatas = [
  3231. {
  3232. tHeader: ['栏舍名称', '软件牛头数', '实际牛头数', '系数(%)', '系数头数', '配方模板', '补料配方', '第一班比例(%)', '第一班重量', '总比例', '日投喂量', '配方重量', '补料重量', '配方干物质'],
  3233. filterVal: ['barname', 'softccount', 'ccount', 'ratio', 'ccountratio', 'ftname', 'ptsfname', 'r1', 'w1', 'sumr', 'dailyWeight', 'ftweight', 'supplyweight', 'dryweight'],
  3234. tableDatas: this.download.list,
  3235. sheetName: 'Sheet1'
  3236. }
  3237. ]
  3238. } else if (this.table.isRW1 == true && this.table.isRW2 == true && this.table.isRW3 == false && this.table.isRW4 == false && this.table.isRW5 == false && this.table.isRW6 == false) {
  3239. var excelDatas = [
  3240. {
  3241. tHeader: ['栏舍名称', '软件牛头数', '实际牛头数', '系数(%)', '系数头数', '配方模板', '补料配方', '第一班比例(%)', '第一班重量', '第二班比例(%)', '第二班重量', '总比例', '日投喂量', '配方重量', '补料重量', '配方干物质'],
  3242. filterVal: ['barname', 'softccount', 'ccount', 'ratio', 'ccountratio', 'ftname', 'ptsfname', 'r1', 'w1', 'r2', 'w2', 'sumr', 'dailyWeight', 'ftweight', 'supplyweight', 'dryweight'],
  3243. tableDatas: this.download.list,
  3244. sheetName: 'Sheet1'
  3245. }
  3246. ]
  3247. } else if (this.table.isRW1 == true && this.table.isRW2 == true && this.table.isRW3 == true && this.table.isRW4 == false && this.table.isRW5 == false && this.table.isRW6 == false) {
  3248. var excelDatas = [
  3249. {
  3250. tHeader: ['栏舍名称', '软件牛头数', '实际牛头数', '系数(%)', '系数头数', '配方模板', '补料配方', '第一班比例(%)', '第一班重量', '第二班比例(%)', '第二班重量', '第三班比例(%)', '第三班重量', '总比例', '日投喂量', '配方重量', '补料重量', '配方干物质'],
  3251. filterVal: ['barname', 'softccount', 'ccount', 'ratio', 'ccountratio', 'ftname', 'ptsfname', 'r1', 'w1', 'r2', 'w2', 'r3', 'w3', 'sumr', 'dailyWeight', 'ftweight', 'supplyweight', 'dryweight'],
  3252. tableDatas: this.download.list,
  3253. sheetName: 'Sheet1'
  3254. }
  3255. ]
  3256. } else if (this.table.isRW1 == true && this.table.isRW2 == true && this.table.isRW3 == true && this.table.isRW4 == true && this.table.isRW5 == false && this.table.isRW6 == false) {
  3257. var excelDatas = [
  3258. {
  3259. tHeader: ['栏舍名称', '软件牛头数', '实际牛头数', '系数(%)', '系数头数', '配方模板', '补料配方', '第一班比例(%)', '第一班重量', '第二班比例(%)', '第二班重量', '第三班比例(%)', '第三班重量', '第四班比例(%)', '第四班重量', '总比例', '日投喂量', '配方重量', '补料重量', '配方干物质'],
  3260. filterVal: ['barname', 'softccount', 'ccount', 'ratio', 'ccountratio', 'ftname', 'ptsfname', 'r1', 'w1', 'r2', 'w2', 'r3', 'w3', 'r4', 'w4', 'sumr', 'dailyWeight', 'ftweight', 'supplyweight', 'dryweight'],
  3261. tableDatas: this.download.list,
  3262. sheetName: 'Sheet1'
  3263. }
  3264. ]
  3265. }else if (this.table.isRW1 == true && this.table.isRW2 == true && this.table.isRW3 == true && this.table.isRW4 == true && this.table.isRW5 == true && this.table.isRW6 == false) {
  3266. var excelDatas = [
  3267. {
  3268. tHeader: ['栏舍名称', '软件牛头数', '实际牛头数', '系数(%)', '系数头数', '配方模板', '补料配方', '第一班比例(%)', '第一班重量', '第二班比例(%)', '第二班重量', '第三班比例(%)', '第三班重量', '第四班比例(%)', '第四班重量','第五班比例(%)', '第五班重量', '总比例', '日投喂量', '配方重量', '补料重量', '配方干物质'],
  3269. filterVal: ['barname', 'softccount', 'ccount', 'ratio', 'ccountratio', 'ftname', 'ptsfname', 'r1', 'w1', 'r2', 'w2', 'r3', 'w3', 'r4', 'w4','r5', 'w5', 'sumr', 'dailyWeight', 'ftweight', 'supplyweight', 'dryweight'],
  3270. tableDatas: this.download.list,
  3271. sheetName: 'Sheet1'
  3272. }
  3273. ]
  3274. }else if (this.table.isRW1 == true && this.table.isRW2 == true && this.table.isRW3 == true && this.table.isRW4 == true && this.table.isRW5 == true && this.table.isRW6 == true) {
  3275. var excelDatas = [
  3276. {
  3277. tHeader: ['栏舍名称', '软件牛头数', '实际牛头数', '系数(%)', '系数头数', '配方模板', '补料配方', '第一班比例(%)', '第一班重量', '第二班比例(%)', '第二班重量', '第三班比例(%)', '第三班重量', '第四班比例(%)', '第四班重量','第五班比例(%)', '第五班重量','第六班比例(%)', '第六班重量', '总比例', '日投喂量', '配方重量', '补料重量', '配方干物质'],
  3278. filterVal: ['barname', 'softccount', 'ccount', 'ratio', 'ccountratio', 'ftname', 'ptsfname', 'r1', 'w1', 'r2', 'w2', 'r3', 'w3', 'r4', 'w4','r5', 'w5','r6', 'w6', 'sumr', 'dailyWeight', 'ftweight', 'supplyweight', 'dryweight'],
  3279. tableDatas: this.download.list,
  3280. sheetName: 'Sheet1'
  3281. }
  3282. ]
  3283. }
  3284. json2excel(excelDatas, '栏舍配方', true, 'xlsx')
  3285. })
  3286. }
  3287. },
  3288. beforeImport(file) {
  3289. const isLt2M = file.size / 1024 / 1024 < 2
  3290. if (!isLt2M) {
  3291. this.$message.error('上传文件大小不能超过 2MB!')
  3292. }
  3293. return isLt2M
  3294. },
  3295. handleImportSuccess(res, file) {
  3296. this.getList()
  3297. if (res.msg === 'ok') {
  3298. this.$message({ title: '成功', message: '导入成功:' + res.data.success + '条!', type: 'success', duration: 2000 })
  3299. if (res.data.err_count > 0) {
  3300. this.$notify({ title: '失败', message: '导入失败:' + res.data.err_count + '条!', type: 'danger', duration: 2000 })
  3301. import('@/vendor/Export2Excel').then(excel => {
  3302. const list1 = res.data.result
  3303. const tHeader = [
  3304. '栏舍名称', '实际牛头数', '系数(%)', '配方模板', '补料配方', '第一班比例(%)', '第二班比例(%)', '第三班比例(%)', '错误信息'
  3305. ]
  3306. const filterVal = [
  3307. '栏舍名称', '实际牛头数', '系数(%)', '配方模板', '补料配方', '第一班比例(%)', '第二班比例(%)', '第三班比例(%)', 'error_msg'
  3308. ]
  3309. const data1 = this.formatJson(filterVal, list1)
  3310. excel.export_json_to_excel({ header: tHeader, data: data1, filename: '栏舍配方导入报错信息', autoWidth: true, bookType: 'xlsx' })
  3311. })
  3312. }
  3313. } else {
  3314. this.$notify({ title: '失败', message: '上传失败', type: 'danger', duration: 2000 })
  3315. }
  3316. },
  3317. formatJson(filterVal, jsonData) {
  3318. return jsonData.map(v =>
  3319. filterVal.map(j => {
  3320. if (j === 'timestamp') {
  3321. return parseTime(v[j])
  3322. } else {
  3323. return v[j]
  3324. }
  3325. })
  3326. )
  3327. },
  3328. // 干物质调节
  3329. handleDryMatterRegulation() {
  3330. console.log('干物质调节')
  3331. this.isShowDialog = true
  3332. this.$refs.mychild.getBalconicFormula()
  3333. this.$refs.mychild.restTemp()
  3334. },
  3335. handleSynchronous(){
  3336. MessageBox.confirm('是否进行软件牛头数同步?', {
  3337. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  3338. }).then(() => {
  3339. const url = 'authdata/ud/feedp/sync'
  3340. const data = {}
  3341. postJson(url, data).then(response => {
  3342. if(response.msg !== 'fail'){
  3343. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  3344. }
  3345. })
  3346. }).catch(() => {
  3347. this.$message({ type: 'info', message: '已取消软件牛头数同步' })
  3348. })
  3349. },
  3350. handle_batchEdit(){
  3351. // this.getList()
  3352. this.isproportion = true
  3353. console.log(this.isproportion)
  3354. this.oldList = JSON.parse(JSON.stringify(this.table.list));
  3355. this.table.list.forEach((item,key)=>{
  3356. item.Edit = false
  3357. item.NoEdit = true
  3358. item.isUpdate = true
  3359. item.isUpdateSave = false
  3360. })
  3361. // row.Edit
  3362. },
  3363. focusData(row){
  3364. // console.log(row,'row')
  3365. this.oldList.forEach((item,key)=>{
  3366. if(row.id == item.id){
  3367. this.oldRowList = { ...item }
  3368. // item = {...row}
  3369. }
  3370. })
  3371. // console.log(this.oldRowList,'row')
  3372. },
  3373. handle_batchEdit_save(){
  3374. console.log(this.oldList, 'oldList')
  3375. console.log(this.table.list, 'this.table.list')
  3376. const arr = this.table.list.filter(item2 => {
  3377. // console.log(item2,'item2')
  3378. return !this.oldList.some(item1 => item1.ccount == item2.ccount && item1.r1 === item2.r1 && item1.r2 === item2.r2 && item1.r3 === item2.r3 && item1.r4 === item2.r4 && item1.r5 === item2.r5 && item1.r6 === item2.r6);
  3379. });
  3380. console.log(arr,'arr')
  3381. const barList = []
  3382. arr.forEach((item)=>{
  3383. let obj = {}
  3384. obj.barname = item.barname
  3385. obj.ccount = item.ccount
  3386. obj.ratio = item.ratio
  3387. obj.ftname = item.ftname
  3388. obj.ptsfname = item.ptsfname
  3389. obj.times1 = item.r1
  3390. obj.times2 = item.r2
  3391. obj.times3 = item.r3
  3392. obj.times4 = item.r4
  3393. obj.times5 = item.r5
  3394. obj.times6 = item.r6
  3395. barList.push(obj)
  3396. })
  3397. console.log(barList,'barList')
  3398. const url = 'authdata/fpdetail/batch/edit'
  3399. let data = {
  3400. pastureId:Cookies.get('pastureid'),
  3401. barList:barList
  3402. }
  3403. postJson(url, data).then(response => {
  3404. if(response.msg !== 'fail'){
  3405. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  3406. }else{
  3407. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  3408. }
  3409. this.isproportion = false
  3410. })
  3411. },
  3412. cancelChangeEdit() {
  3413. // 取消顺序
  3414. this.getList()
  3415. this.isproportion = false
  3416. },
  3417. handleRestore(row){
  3418. // 恢复
  3419. MessageBox.confirm('是否进行恢复?', {
  3420. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  3421. }).then(() => {
  3422. const dataList = this.history.list
  3423. const result = dataList.filter(obj => obj.barname === row.barname);
  3424. console.log(result,'result')
  3425. const barList = []
  3426. result.forEach((item)=>{
  3427. console.log(item,'item')
  3428. let obj = {}
  3429. obj.barname = item.barname
  3430. obj.ccount = item.ccount
  3431. obj.ratio = item.ratio
  3432. obj.ftname = item.ptname
  3433. // obj.ptsfname = item.ptsfname
  3434. if(item.timesin == '1'){ obj.times1 = item.tratio }else{ obj.times1 = 0 }
  3435. if(item.timesin == '2'){ obj.times2 = item.tratio }else{ obj.times2 = 0 }
  3436. if(item.timesin == '3'){ obj.times3 = item.tratio }else{ obj.times3 = 0 }
  3437. if(item.timesin == '4'){ obj.times4 = item.tratio }else{ obj.times4 = 0 }
  3438. if(item.timesin == '5'){ obj.times5 = item.tratio }else{ obj.times5 = 0 }
  3439. if(item.timesin == '6'){ obj.times6 = item.tratio }else{ obj.times6 = 0 }
  3440. barList.push(obj)
  3441. })
  3442. // 根据 "barname" 属性进行分组
  3443. const groupedData = barList.reduce((acc, obj) => {
  3444. const key = obj.barname;
  3445. if (!acc[key]) {
  3446. acc[key] = [obj];
  3447. } else {
  3448. acc[key].push(obj);
  3449. }
  3450. return acc;
  3451. }, {});
  3452. console.log(groupedData,'groupedData')
  3453. console.log(Object.keys(groupedData),'groupedData')
  3454. // 合并相同 "barname" 值的对象
  3455. const consolidatedData = groupedData[Object.keys(groupedData)[0]].reduce((acc, item) => {
  3456. for (const key in item) {
  3457. if (key.startsWith('times')) {
  3458. acc[key] = (acc[key] || 0) + parseFloat(item[key]);
  3459. } else {
  3460. acc[key] = item[key];
  3461. }
  3462. }
  3463. return acc;
  3464. }, {});
  3465. console.log(consolidatedData);
  3466. const url = 'authdata/fpdetail/batch/edit'
  3467. let data = {
  3468. pastureId:Cookies.get('pastureid'),
  3469. barList:[consolidatedData]
  3470. }
  3471. postJson(url, data).then(response => {
  3472. if(response.msg !== 'fail'){
  3473. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  3474. this.getDateList()
  3475. }else{
  3476. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  3477. }
  3478. this.isproportion = false
  3479. })
  3480. }).catch(() => {
  3481. this.$message({ type: 'info', message: '已取消恢复' })
  3482. })
  3483. }
  3484. }
  3485. }
  3486. </script>
  3487. <style lang="scss" scoped>
  3488. .search {
  3489. clear: both;
  3490. }
  3491. .table {
  3492. margin-top: 10px;
  3493. }
  3494. /deep/ .el-input__inner{
  3495. padding:0 5px;
  3496. }
  3497. /deep/ .el-table .cell{
  3498. padding-left: 5px;
  3499. padding-right: 5px;
  3500. }
  3501. </style>
  3502. <style lang="scss">
  3503. .red-row{
  3504. background: #fde2e2 !important;
  3505. }
  3506. </style>