index.vue 160 KB

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