4ca0fe92c46c1d86b21ddac48ebc53072a34881f.svn-base 163 KB

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