08633d0da947b3a95a4db5e7caa6a785f254eec3.svn-base 171 KB

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