index.vue 160 KB

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