index.vue 173 KB

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