fdd783d3a0228ec5686b5985e7fbdb60685a5d67.svn-base 155 KB

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