index.vue 160 KB

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