index.vue 172 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414
  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 && isSynchronous" class="successBorder" @click="handleSynchronous">软件牛头数同步</el-button>
  18. <el-button v-if="isRoleEdit && !isproportion" class="successBorder" @click="handle_batchEdit">批量编辑</el-button>
  19. <el-button v-if="isRoleEdit && isproportion" icon="el-icon-folder-checked" class="success" @click="handle_batchEdit_save">保存</el-button>
  20. <el-button v-if="isRoleEdit && isproportion" icon="el-icon-close" class="sortCancel" @click="cancelChangeEdit">取消</el-button>
  21. <el-upload style="float: right;" :headers="headers" :data="uploadData" :action="uploadExcelUrl" :show-file-list="false" :before-upload="beforeImport" :on-success="handleImportSuccess">
  22. <el-button v-if="isRoleEdit" class="import" icon="el-icon-download" style="float: right;">导入</el-button>
  23. </el-upload>
  24. <el-dropdown style="float: right;margin-right: 10px;">
  25. <el-button class="export" icon="el-icon-upload2">导出</el-button>
  26. <el-dropdown-menu slot="dropdown">
  27. <el-dropdown-item @click.native="handleExport(1)">导出模板</el-dropdown-item>
  28. <el-dropdown-item @click.native="handleExport(2)">导出数据</el-dropdown-item>
  29. </el-dropdown-menu>
  30. </el-dropdown>
  31. <el-button class="export" style="float: right;margin-right: 10px;" @click="handleHistoryRecords">历史记录</el-button>
  32. </div>
  33. </div>
  34. <div class="search" />
  35. <div class="table">
  36. <el-table
  37. :key="table.tableKey"
  38. ref="table"
  39. v-loading="table.listLoading"
  40. element-loading-text="给我一点时间"
  41. :data="table.list"
  42. border
  43. fit
  44. highlight-current-row
  45. style="width: 100%;"
  46. :row-style="rowStyle"
  47. :cell-style="cellStyle"
  48. class="elTable table-fixed"
  49. :max-height="myHeight"
  50. @header-click="headerClick"
  51. @selection-change="handleSelect"
  52. @cell-dblclick="celldblclick"
  53. >
  54. <el-table-column type="selection" width="40" />
  55. <el-table-column :key="1" label="序号" align="center" type="index" width="50px" class-name="small-padding fixed-width" fixed="left" />
  56. <el-table-column label="栏舍名称" min-width="60px" align="center" class-name="small-padding fixed-width" fixed="left">
  57. <template slot-scope="scope">
  58. <span>{{ scope.row.barname }}</span>
  59. </template>
  60. </el-table-column>
  61. <el-table-column :key="2" label="软件牛头数" min-width="60px" align="center">
  62. <template slot-scope="scope">
  63. <span>{{ scope.row.softccount }}</span>
  64. </template>
  65. </el-table-column>
  66. <el-table-column :key="3" label="实际牛头数" min-width="80px" align="center">
  67. <template slot-scope="scope">
  68. <span v-if="scope.row.NoEdit && !isproportion">{{ scope.row.ccount }}</span>
  69. <el-input v-if="scope.row.Edit || isproportion" v-model="scope.row.ccount" step="0.01" type="number" style="width:100%;padding:10px 0;" @blur="blurCcount(scope.row)" :placeholder="scope.row.placeholder_ccount" />
  70. </template>
  71. </el-table-column>
  72. <el-table-column :key="4" label="系数(%)" min-width="85px" align="center">
  73. <template slot-scope="scope">
  74. <span v-if="scope.row.NoEdit">{{ scope.row.ratio }}</span>
  75. <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)" :placeholder="scope.row.placeholder_ratio" />
  76. </template>
  77. </el-table-column>
  78. <el-table-column :key="5" label="系数头数" min-width="85px" align="center">
  79. <template slot-scope="scope">
  80. <span v-if="scope.row.NoEdit">{{ scope.row.ccountratio }}</span>
  81. <el-input v-if="scope.row.Edit" v-model="scope.row.ccountratio" type="number" style="width:100%;padding:10px 0;" @blur="blurCcountratio(scope.row)" :placeholder="scope.row.placeholder_ccountratio" />
  82. </template>
  83. </el-table-column>
  84. <el-table-column :key="6" label="配方模板" min-width="100px" align="center">
  85. <template slot-scope="scope">
  86. <span v-if="scope.row.NoEdit">{{ scope.row.ftname }}</span>
  87. <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)}">
  88. <el-option v-for="item in recipeTemplateList" :key="item.id" :label="item.tname" :value="item.id" />
  89. </el-select>
  90. </template>
  91. </el-table-column>
  92. <el-table-column v-if="table.isPtsfname" :key="7" label="补料配方" min-width="100px" align="center">
  93. <template slot-scope="scope">
  94. <span v-if="scope.row.NoEdit">{{ scope.row.ptsfname }}</span>
  95. <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)}">
  96. <el-option v-for="item in feedingFormulaList" :key="item.id" :label="item.tname" :value="item.id" />
  97. </el-select>
  98. </template>
  99. </el-table-column>
  100. <el-table-column v-if="table.isRW1" :key="8" label="第一班比例(%)" min-width="85px" align="center">
  101. <template slot-scope="scope">
  102. <span v-if="scope.row.NoEdit && !isproportion">{{ scope.row.r1 }}</span>
  103. <el-input v-if="scope.row.Edit || isproportion" v-model="scope.row.r1" :disabled="scope.row.isOneWeight" step="0.01" type="number" style="width:100%;padding:10px 0;" @blur="blurR(scope.row,1)" :placeholder="scope.row.placeholder_r1" />
  104. </template>
  105. </el-table-column>
  106. <el-table-column v-if="table.isRW1" :key="9" label="第一班重量" min-width="100px" align="center" :render-header="renderHeader">
  107. <template slot-scope="scope">
  108. <span v-if="scope.row.NoEdit">{{ scope.row.w1 }}</span>
  109. <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)" :placeholder="scope.row.placeholder_w1" />
  110. </template>
  111. </el-table-column>
  112. <el-table-column v-if="table.isRW1 && table.isPtsfname" :key="10" label="第一班补料重量" min-width="100px" align="center">
  113. <template slot-scope="scope">
  114. <span v-if="scope.row.NoEdit && !isproportion">{{ scope.row.bw1 }}</span>
  115. <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)" :placeholder="scope.row.placeholder_bw1" />
  116. </template>
  117. </el-table-column>
  118. <el-table-column v-if="table.isRW2" :key="11" label="第二班比例(%)" min-width="85px" align="center">
  119. <template slot-scope="scope">
  120. <span v-if="scope.row.NoEdit && !isproportion">{{ scope.row.r2 }}</span>
  121. <el-input v-if="scope.row.Edit || isproportion" v-model="scope.row.r2" step="0.01" type="number" :disabled="scope.row.isTwoWeight" style="width:100%;padding:10px 0;" @blur="blurR(scope.row,2)" :placeholder="scope.row.placeholder_r2" />
  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)" :placeholder="scope.row.placeholder_w2" />
  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)" :placeholder="scope.row.placeholder_bw2" />
  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 && !isproportion">{{ scope.row.r3 }}</span>
  139. <el-input v-if="scope.row.Edit || isproportion" v-model="scope.row.r3" step="0.01" type="number" :disabled="scope.row.isThreeWeight" style="width:100%;padding:10px 0;" @blur="blurR(scope.row,3)" :placeholder="scope.row.placeholder_r3"/>
  140. </template>
  141. </el-table-column>
  142. <el-table-column v-if="table.isRW3" :key="15" label="第三班重量" min-width="100px" align="center" :render-header="renderHeader">
  143. <template slot-scope="scope">
  144. <span v-if="scope.row.NoEdit">{{ scope.row.w3 }}</span>
  145. <el-input v-if="scope.row.Edit" v-model="scope.row.w3" :disabled="scope.row.isThreeWeight" step="0.01" type="number" style="width:100%;padding:10px 0;" @blur="blurWeight(scope.row,3)" :placeholder="scope.row.placeholder_w3" />
  146. </template>
  147. </el-table-column>
  148. <el-table-column v-if="table.isRW3 && table.isPtsfname" :key="16" label="第三班补料重量" min-width="100px" align="center">
  149. <template slot-scope="scope">
  150. <span v-if="scope.row.NoEdit">{{ scope.row.bw3 }}</span>
  151. <el-input v-if="scope.row.Edit" v-model="scope.row.bw3" :disabled="scope.row.ptsfid == '-1' || scope.row.ptsfid == ''" step="0.01" type="number" style="width:100%;padding:10px 0;" @blur="blurBw(scope.row)" :placeholder="scope.row.placeholder_bw3" />
  152. </template>
  153. </el-table-column>
  154. <el-table-column v-if="table.isRW4" :key="17" label="第四班比例(%)" min-width="85px" align="center">
  155. <template slot-scope="scope">
  156. <span v-if="scope.row.NoEdit && !isproportion">{{ scope.row.r4 }}</span>
  157. <el-input v-if="scope.row.Edit || isproportion" v-model="scope.row.r4" step="0.01" type="number" :disabled="scope.row.isFourWeight" style="width:100%;padding:10px 0;" @blur="blurR(scope.row,4)" :placeholder="scope.row.placeholder_r4" />
  158. </template>
  159. </el-table-column>
  160. <el-table-column v-if="table.isRW4" :key="18" label="第四班重量" min-width="100px" align="center" :render-header="renderHeader">
  161. <template slot-scope="scope">
  162. <span v-if="scope.row.NoEdit">{{ scope.row.w4 }}</span>
  163. <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)" :placeholder="scope.row.placeholder_w4" />
  164. </template>
  165. </el-table-column>
  166. <el-table-column v-if="table.isRW4 && table.isPtsfname" :key="19" label="第四班补料重量" min-width="90px" align="center">
  167. <template slot-scope="scope">
  168. <span v-if="scope.row.NoEdit">{{ scope.row.bw4 }}</span>
  169. <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)" :placeholder="scope.row.placeholder_bw4" />
  170. </template>
  171. </el-table-column>
  172. <el-table-column v-if="table.isRW5" :key="20" label="第五班比例(%)" min-width="85px" align="center">
  173. <template slot-scope="scope">
  174. <span v-if="scope.row.NoEdit && !isproportion">{{ scope.row.r5 }}</span>
  175. <el-input v-if="scope.row.Edit || isproportion" v-model="scope.row.r5" step="0.01" type="number" :disabled="scope.row.isFiveWeight" style="width:100%;padding:10px 0;" @blur="blurR(scope.row,5)" :placeholder="scope.row.placeholder_r5" />
  176. </template>
  177. </el-table-column>
  178. <el-table-column v-if="table.isRW5" :key="21" label="第五班重量" min-width="100px" align="center" :render-header="renderHeader">
  179. <template slot-scope="scope">
  180. <span v-if="scope.row.NoEdit">{{ scope.row.w5 }}</span>
  181. <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)" :placeholder="scope.row.placeholder_w5" />
  182. </template>
  183. </el-table-column>
  184. <el-table-column v-if="table.isRW5 && table.isPtsfname" :key="22" label="第五班补料重量" min-width="90px" align="center">
  185. <template slot-scope="scope">
  186. <span v-if="scope.row.NoEdit">{{ scope.row.bw5 }}</span>
  187. <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)" :placeholder="scope.row.placeholder_bw5" />
  188. </template>
  189. </el-table-column>
  190. <el-table-column v-if="table.isRW6" :key="23" label="第六班比例(%)" min-width="85px" align="center">
  191. <template slot-scope="scope">
  192. <span v-if="scope.row.NoEdit && !isproportion">{{ scope.row.r6 }}</span>
  193. <el-input v-if="scope.row.Edit || isproportion" v-model="scope.row.r6" step="0.01" type="number" :disabled="scope.row.isSixWeight" style="width:100%;padding:10px 0;" @blur="blurR(scope.row,6)" :placeholder="scope.row.placeholder_r6" />
  194. </template>
  195. </el-table-column>
  196. <el-table-column v-if="table.isRW6" :key="24" label="第六班重量" min-width="100px" align="center" :render-header="renderHeader">
  197. <template slot-scope="scope">
  198. <span v-if="scope.row.NoEdit">{{ scope.row.w6 }}</span>
  199. <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)" :placeholder="scope.row.placeholder_w6" />
  200. </template>
  201. </el-table-column>
  202. <el-table-column v-if="table.isRW6 && table.isPtsfname" :key="25" label="第六班补料重量" min-width="90px" align="center">
  203. <template slot-scope="scope">
  204. <span v-if="scope.row.NoEdit">{{ scope.row.bw6 }}</span>
  205. <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)" :placeholder="scope.row.placeholder_bw6" />
  206. </template>
  207. </el-table-column>
  208. <el-table-column :key="26" label="饲喂总比例(%)" min-width="60px" align="center">
  209. <template slot-scope="scope">
  210. <span>{{ scope.row.sumr }}</span>
  211. </template>
  212. </el-table-column>
  213. <el-table-column :key="27" label="饲喂投喂量" min-width="60px" align="center">
  214. <template slot-scope="scope">
  215. <span>{{ scope.row.todayweight }}</span>
  216. </template>
  217. </el-table-column>
  218. <el-table-column :key="28" label="饲喂配方重量" min-width="60px" align="center">
  219. <template slot-scope="scope">
  220. <span>{{ scope.row.ftweight }}</span>
  221. </template>
  222. </el-table-column>
  223. <el-table-column v-if="table.isPtsfname" :key="29" label="补料配方重量" min-width="60px" align="center">
  224. <template slot-scope="scope">
  225. <span>{{ scope.row.supplyweight }}</span>
  226. </template>
  227. </el-table-column>
  228. <!-- <el-table-column :key="22" label="投喂量" min-width="80px" align="center">
  229. <template slot-scope="scope">
  230. <span>{{ scope.row.feedweight }}</span>
  231. </template>
  232. </el-table-column> -->
  233. <el-table-column v-if="table.isPtsfname" :key="30" label="补料投喂量" min-width="60px" align="center">
  234. <template slot-scope="scope">
  235. <span>{{ scope.row.todaysupplement }}</span>
  236. </template>
  237. </el-table-column>
  238. <el-table-column :key="31" label="日投喂量" min-width="60px" align="center">
  239. <template slot-scope="scope">
  240. <span>{{ scope.row.todayfeed }}</span>
  241. </template>
  242. </el-table-column>
  243. <el-table-column :key="32" label="配方干物质" min-width="60px" align="center">
  244. <template slot-scope="scope">
  245. <span>{{ scope.row.dryweight }}</span>
  246. </template>
  247. </el-table-column>
  248. <el-table-column label="操作" align="center" width="80" class-name="small-padding fixed-width" fixed="right">
  249. <template slot-scope="{row}">
  250. <el-button v-if="row.isUpdate && isRoleEdit" class="miniSuccess" icon="el-icon-edit-outline" @click="handleUpdate(row)" />
  251. <el-button v-if="row.isUpdateSave && isRoleEdit" :disabled="isokDisable" icon="el-icon-folder-checked" class="miniSuccess" @click="updateData(row)" />
  252. <span v-if="row.isUpdateSave && isRoleEdit" class="centerSpan">|</span>
  253. <el-button v-if="row.isUpdateSave && isRoleEdit" class="minCancel" icon="el-icon-close" @click="updateCancel(row)" />
  254. </template>
  255. </el-table-column>
  256. </el-table>
  257. <!-- <pagination v-show="table.total>=0" :total="table.total" :page.sync="table.getdataListParm.offset" :limit.sync="table.getdataListParm.pagecount" @pagination="getList" /> -->
  258. </div>
  259. <!-- 历史记录 -->
  260. <el-dialog :fullscreen="dialogFull" :destroy-on-close="true" :visible.sync="history.dialogFormVisible" :close-on-click-modal="false" width="90%">
  261. <template slot="title">
  262. <div class="avue-crud__dialog__header">
  263. <span class="el-dialog__title">
  264. <span style="display:inline-block;width:3px;height:20px;margin-right:5px; float: left;margin-top:2px" />
  265. {{ textMap[history.dialogStatus] }}
  266. </span>
  267. <div class="avue-crud__dialog__menu" @click="dialogFull? dialogFull=false: dialogFull=true">
  268. <svg-icon v-if="dialogFull" icon-class="exit-fullscreen" />
  269. <svg-icon v-else icon-class="fullscreen" />
  270. </div>
  271. </div>
  272. </template>
  273. <div class="app-history">
  274. <div class="search">
  275. <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" />
  276. <!-- <el-select v-model="history.getdataListParm.parammaps.barid" clearable filterable placeholder="请选择栏舍" style="width: 180px;" class="filter-item">
  277. <el-option v-for="item in barList" :key="item.id" :label="item.bname" :value="item.id" />
  278. </el-select>
  279. <el-input v-model="history.getdataListParm.parammaps.tname" placeholder="请输入配方名称" style="width: 180px;" class="filter-item" />
  280. <el-button class="successBorder" @click="handleHistorySearch">查询</el-button> -->
  281. <!-- <el-button class="successBorder" @click="handleApplication">应用</el-button> -->
  282. </div>
  283. <div class="table">
  284. <u-table
  285. :key="history.tableKey"
  286. v-loading="history.listLoading"
  287. element-loading-text="给我一点时间"
  288. :data="history.list"
  289. border
  290. fit
  291. highlight-current-row
  292. style="width: 100%;"
  293. :row-style="rowStyle"
  294. :cell-style="cellStyle"
  295. class="elTable table-fixed"
  296. :span-method="objectSpanMethod"
  297. :max-height="500"
  298. >
  299. <u-table-column :key="1" label="序号" align="center" type="index" width="50px" class-name="small-padding fixed-width" fixed="left" />
  300. <!-- <u-table-column :key="1" label="序号" align="center" type="index" width="50px" class-name="small-padding fixed-width" fixed="left">
  301. <template slot-scope="scope">
  302. <span>{{ scope.$index + (history.pageNum-1) * history.pageSize + 1 }}</span>
  303. </template>
  304. </u-table-column> -->
  305. <u-table-column :key="2" label="栏舍名称" prop="barname" min-width="90px" align="center" class-name="small-padding fixed-width" fixed="left" />
  306. <u-table-column :key="3" label="班次" prop="times" min-width="90px" align="center" class-name="small-padding fixed-width" fixed="left" />
  307. <u-table-column :key="4" label="软件牛头数" prop="softccount" min-width="70px" align="center" />
  308. <u-table-column :key="5" label="实际牛头数" prop="ccount" min-width="70px" align="center" />
  309. <u-table-column :key="6" label="系数(%)" prop="ratio" min-width="70px" align="center" />
  310. <u-table-column :key="7" label="系数头数" prop="ccountratio" min-width="70px" align="center" />
  311. <u-table-column :key="8" label="配方模板" prop="ptname" min-width="70px" align="center" />
  312. <u-table-column v-if="table.isPtsfname" :key="9" label="补料配方" prop="ptsname" min-width="70px" align="center" />
  313. <u-table-column :key="10" label="班次比例" prop="tratio" min-width="70px" align="center" />
  314. <u-table-column :key="11" label="班次重量" prop="weight" min-width="70px" align="center" />
  315. <u-table-column :key="12" label="配方重量" prop="pweight" min-width="70px" align="center" />
  316. <u-table-column v-if="table.isPtsfname" :key="13" label="补料重量" prop="ptweight" min-width="70px" align="center" />
  317. <u-table-column :key="14" label="配方干物质量" prop="dryweight" min-width="70px" align="center" />
  318. <u-table-column :key="15" label="饲喂干物质量" prop="swdryw" min-width="70px" align="center" />
  319. <u-table-column :key="16" label="采样干物质量" prop="cydryw" min-width="70px" align="center" />
  320. <u-table-column :key="17" label="日投喂量" prop="sumweight" min-width="70px" align="center" />
  321. </u-table>
  322. <!-- <pagination2 v-show="history.total>0" :total="history.total" :page.sync="history.getdataListParm.offset" :limit.sync="history.getdataListParm.pagecount" @pagination="getHistoryList" /> -->
  323. </div>
  324. </div>
  325. <div slot="footer" class="dialog-footer" style="bottom: 10px;">
  326. <el-button class="cancelClose cancelClose1" @click="history.dialogFormVisible = false; ">关闭</el-button>
  327. </div>
  328. </el-dialog>
  329. <!-- 营养评估 -->
  330. <el-dialog :fullscreen="dialogFull" :visible.sync="nutritional.dialogFormVisible" :close-on-click-modal="false" width="90%">
  331. <template slot="title">
  332. <div class="avue-crud__dialog__header">
  333. <span class="el-dialog__title">
  334. <span style="display:inline-block;width:3px;height:20px;margin-right:5px; float: left;margin-top:2px" />
  335. {{ textMap[nutritional.dialogStatus] }}
  336. </span>
  337. <div class="avue-crud__dialog__menu" @click="dialogFull? dialogFull=false: dialogFull=true">
  338. <svg-icon v-if="dialogFull" icon-class="exit-fullscreen" />
  339. <svg-icon v-else icon-class="fullscreen" />
  340. </div>
  341. </div>
  342. </template>
  343. <div class="app-nutritional">
  344. <h4 style="position: absolute;top:-5px;left:140px;font:16px/30px '' ;color:#303133;">栏舍:{{ nutritional.tab1.temp.barname }}</h4>
  345. <el-tabs v-model="nutritional.activeName" @tab-click="handleNutritionalTab">
  346. <el-tab-pane label="营养评估" name="first">
  347. <el-form ref="temp" :rules="rules" :model="nutritional.tab1.temp" label-position="right" label-width="95px" style="width: 100%;margin-bottom:30px">
  348. <el-row>
  349. <el-col :span="4">
  350. <el-form-item label="类别" prop="cowclassid">
  351. <el-select v-model="nutritional.tab1.temp.cowclassid" :disabled="nutritional.tab1.disabledCowclass" filterable placeholder="" class="filter-item" style="width:100%;">
  352. <el-option v-for="item in livestockTypeList" :key="item.id" :label="item.mixname" :value="item.id" />
  353. </el-select>
  354. </el-form-item>
  355. </el-col>
  356. <el-col :span="4">
  357. <el-form-item label="月龄" prop="avgmonthage">
  358. <el-input ref="avgmonthage" v-model="nutritional.tab1.temp.avgmonthage" class="filter-item" placeholder="" style="width:100%;" />
  359. </el-form-item>
  360. </el-col>
  361. <el-col :span="4">
  362. <el-form-item label="体重(kg)" prop="bw">
  363. <el-input ref="bw" v-model="nutritional.tab1.temp.bw" class="filter-item" placeholder="" style="width:100%;" />
  364. </el-form-item>
  365. </el-col>
  366. <el-col :span="4">
  367. <el-form-item label="日增重(kg)" prop="dayw">
  368. <el-input ref="dayw" v-model="nutritional.tab1.temp.dayw" class="filter-item" placeholder="" style="width:100%;" />
  369. </el-form-item>
  370. </el-col>
  371. <el-col :span="4">
  372. <el-form-item label="胎次(次)" prop="fetal">
  373. <el-input ref="fetal" v-model="nutritional.tab1.temp.fetal" class="filter-item" placeholder="" style="width:100%;" />
  374. </el-form-item>
  375. </el-col>
  376. <el-col :span="4">
  377. <el-form-item label="泌乳天数(天)" prop="avgdim">
  378. <el-input ref="avgdim" v-model="nutritional.tab1.temp.avgdim" class="filter-item" placeholder="" style="width:100%;" />
  379. </el-form-item>
  380. </el-col>
  381. </el-row>
  382. <el-row>
  383. <el-col :span="4">
  384. <el-form-item label="怀孕天数(天)" prop="dayspre">
  385. <el-input ref="dayspre" v-model="nutritional.tab1.temp.dayspre" class="filter-item" placeholder="" style="width:100%;" />
  386. </el-form-item>
  387. </el-col>
  388. <el-col :span="4">
  389. <el-form-item label="产奶量(kg)" prop="product">
  390. <el-input ref="product" v-model="nutritional.tab1.temp.product" class="filter-item" placeholder="" style="width:100%;" />
  391. </el-form-item>
  392. </el-col>
  393. <el-col :span="4">
  394. <el-form-item label="乳脂率(%)" prop="fat">
  395. <el-input ref="fat" v-model="nutritional.tab1.temp.fat" class="filter-item" placeholder="" style="width:100%;" />
  396. </el-form-item>
  397. </el-col>
  398. <el-col :span="4">
  399. <el-form-item label="乳蛋白率(%)" prop="pro">
  400. <el-input ref="pro" v-model="nutritional.tab1.temp.pro" class="filter-item" placeholder="" style="width:100%;" />
  401. </el-form-item>
  402. </el-col>
  403. <el-col :span="4">
  404. <el-form-item label="乳糖率(%)" prop="lactose">
  405. <el-input ref="lactose" v-model="nutritional.tab1.temp.lactose" class="filter-item" placeholder="" style="width:100%;" />
  406. </el-form-item>
  407. </el-col>
  408. <el-col :span="4">
  409. <el-form-item label="温度(℃)" prop="tem">
  410. <el-input ref="tem" v-model="nutritional.tab1.temp.tem" class="filter-item" placeholder="" style="width:100%;" />
  411. </el-form-item>
  412. </el-col>
  413. </el-row>
  414. </el-form>
  415. <div style="height: 50px;">
  416. <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;" />
  417. <el-button class="el-icon-arrow-left elIconArrowLeft" @click="handleBefore" />
  418. <el-button class="el-icon-arrow-right elIconArrowRight" @click="handleNext" />
  419. <el-button class="successBorder" :disabled="isokDisable" @click="assessmentData()">评估</el-button>
  420. </div>
  421. <div class="table">
  422. <el-table
  423. :key="nutritional.tab1.tableKey"
  424. v-loading="nutritional.tab1.listLoading"
  425. element-loading-text="给我一点时间"
  426. :data="nutritional.tab1.list"
  427. border
  428. fit
  429. highlight-current-row
  430. style="width: 100%;margin-bottom:60px;"
  431. :row-style="rowStyle"
  432. :cell-style="cellStyle"
  433. class="elTable table-fixed"
  434. :row-class-name="tableRowClassName"
  435. >
  436. <el-table-column label="序号" align="center" type="index" width="50px" />
  437. <el-table-column label="指标" min-width="130px" align="center">
  438. <template slot-scope="scope">
  439. <span>{{ scope.row.standard }}</span>
  440. </template>
  441. </el-table-column>
  442. <el-table-column label="奶牛需要" min-width="130px" align="center">
  443. <template slot-scope="scope">
  444. <span>{{ scope.row.cowneed }}</span>
  445. </template>
  446. </el-table-column>
  447. <el-table-column label="配方量" min-width="130px" align="center">
  448. <template slot-scope="scope">
  449. <span>{{ scope.row.ftpro }}</span>
  450. </template>
  451. </el-table-column>
  452. <el-table-column label="TMR料" min-width="130px" align="center">
  453. <template slot-scope="scope">
  454. <span>{{ scope.row.hprov }}</span>
  455. </template>
  456. </el-table-column>
  457. <el-table-column label="采食量" min-width="130px" align="center">
  458. <template slot-scope="scope">
  459. <span>{{ scope.row.sprov }}</span>
  460. </template>
  461. </el-table-column>
  462. </el-table>
  463. </div>
  464. </el-tab-pane>
  465. <el-tab-pane label="牛群评估" name="second">
  466. <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" />
  467. <el-button class="el-icon-arrow-left elIconArrowLeft" @click="handleBefore" />
  468. <el-button class="el-icon-arrow-right elIconArrowRight" @click="handleNext" />
  469. <el-row>
  470. <el-col :span="24">
  471. <h3 style="text-align: center;">宾州筛分析</h3>
  472. <div class="table">
  473. <el-table
  474. :key="nutritional.tab2.tableKey1"
  475. v-loading="nutritional.tab2.listLoading1"
  476. element-loading-text="给我一点时间"
  477. :data="nutritional.tab2.list1"
  478. border
  479. fit
  480. highlight-current-row
  481. style="width: 100%;margin-bottom:60px;"
  482. :row-style="rowStyle"
  483. :cell-style="cellStyle"
  484. class="elTable table-fixed"
  485. >
  486. <el-table-column label="日期" min-width="130px" align="center">
  487. <template slot-scope="scope">
  488. <span>{{ scope.row.operatetime }}</span>
  489. </template>
  490. </el-table-column>
  491. <el-table-column label="第一层重量(g)" min-width="130px" align="center">
  492. <template slot-scope="scope">
  493. <span>{{ scope.row.oneweight }}</span>
  494. </template>
  495. </el-table-column>
  496. <el-table-column label="第一层百分比" min-width="130px" align="center">
  497. <template slot-scope="scope">
  498. <span>{{ scope.row.onerate }}</span>
  499. </template>
  500. </el-table-column>
  501. <el-table-column label="第二层重量(g)" min-width="130px" align="center">
  502. <template slot-scope="scope">
  503. <span>{{ scope.row.twoweight }}</span>
  504. </template>
  505. </el-table-column>
  506. <el-table-column label="第二层百分比" min-width="130px" align="center">
  507. <template slot-scope="scope">
  508. <span>{{ scope.row.tworate }}</span>
  509. </template>
  510. </el-table-column>
  511. <el-table-column label="第三层重量(g)" min-width="130px" align="center">
  512. <template slot-scope="scope">
  513. <span>{{ scope.row.threeweight }}</span>
  514. </template>
  515. </el-table-column>
  516. <el-table-column label="第三层百分比" min-width="130px" align="center">
  517. <template slot-scope="scope">
  518. <span>{{ scope.row.threerate }}</span>
  519. </template>
  520. </el-table-column>
  521. <el-table-column label="第四层重量(g)" min-width="130px" align="center">
  522. <template slot-scope="scope">
  523. <span>{{ scope.row.fourweight }}</span>
  524. </template>
  525. </el-table-column>
  526. <el-table-column label="第四层百分比" min-width="130px" align="center">
  527. <template slot-scope="scope">
  528. <span>{{ scope.row.fourrate }}</span>
  529. </template>
  530. </el-table-column>
  531. <el-table-column label="参考标准" min-width="130px" align="center">
  532. <template slot-scope="scope">
  533. <span>{{ scope.row.standard }}</span>
  534. </template>
  535. </el-table-column>
  536. </el-table>
  537. </div>
  538. </el-col>
  539. </el-row>
  540. <el-row>
  541. <el-col :span="24">
  542. <h3 style="text-align: center;">粪便筛分析</h3>
  543. <div class="table">
  544. <el-table
  545. :key="nutritional.tab2.tableKey2"
  546. v-loading="nutritional.tab2.listLoading2"
  547. element-loading-text="给我一点时间"
  548. :data="nutritional.tab2.list2"
  549. border
  550. fit
  551. highlight-current-row
  552. style="width: 100%;margin-bottom:60px;"
  553. :row-style="rowStyle"
  554. :cell-style="cellStyle"
  555. class="elTable table-fixed"
  556. >
  557. <el-table-column label="日期" min-width="130px" align="center">
  558. <template slot-scope="scope">
  559. <span>{{ scope.row.operatetime }}</span>
  560. </template>
  561. </el-table-column>
  562. <el-table-column label="第一层重量(g)" min-width="130px" align="center">
  563. <template slot-scope="scope">
  564. <span>{{ scope.row.oneweight }}</span>
  565. </template>
  566. </el-table-column>
  567. <el-table-column label="第一层百分比" min-width="130px" align="center">
  568. <template slot-scope="scope">
  569. <span>{{ scope.row.onerate }}</span>
  570. </template>
  571. </el-table-column>
  572. <el-table-column label="第二层重量(g)" min-width="130px" align="center">
  573. <template slot-scope="scope">
  574. <span>{{ scope.row.twoweight }}</span>
  575. </template>
  576. </el-table-column>
  577. <el-table-column label="第二层百分比" min-width="130px" align="center">
  578. <template slot-scope="scope">
  579. <span>{{ scope.row.tworate }}</span>
  580. </template>
  581. </el-table-column>
  582. <el-table-column label="第三层重量(g)" min-width="130px" align="center">
  583. <template slot-scope="scope">
  584. <span>{{ scope.row.threeweight }}</span>
  585. </template>
  586. </el-table-column>
  587. <el-table-column label="第三层百分比" min-width="130px" align="center">
  588. <template slot-scope="scope">
  589. <span>{{ scope.row.threerate }}</span>
  590. </template>
  591. </el-table-column>
  592. <el-table-column label="参考标准" min-width="130px" align="center">
  593. <template slot-scope="scope">
  594. <span>{{ scope.row.standard }}</span>
  595. </template>
  596. </el-table-column>
  597. </el-table>
  598. </div>
  599. </el-col>
  600. </el-row>
  601. <el-row>
  602. <el-col :span="24">
  603. <h3 style="text-align: center;">BCS评分</h3>
  604. <div class="table">
  605. <el-table
  606. :key="nutritional.tab2.tableKey3"
  607. v-loading="nutritional.tab2.listLoading3"
  608. element-loading-text="给我一点时间"
  609. :data="nutritional.tab2.list3"
  610. border
  611. fit
  612. highlight-current-row
  613. style="width: 100%;margin-bottom:60px;"
  614. :row-style="rowStyle"
  615. :cell-style="cellStyle"
  616. class="elTable table-fixed"
  617. >
  618. <el-table-column label="日期" min-width="130px" align="center">
  619. <template slot-scope="scope">
  620. <span>{{ scope.row.operatetime }}</span>
  621. </template>
  622. </el-table-column>
  623. <el-table-column label="抽查样本数" min-width="130px" align="center">
  624. <template slot-scope="scope">
  625. <span>{{ scope.row.sumcowcount }}</span>
  626. </template>
  627. </el-table-column>
  628. <el-table-column label="单产(kg/头)" min-width="130px" align="center">
  629. <template slot-scope="scope">
  630. <span>{{ scope.row.product }}</span>
  631. </template>
  632. </el-table-column>
  633. <el-table-column label="干物质采食量(kg/头)" min-width="130px" align="center">
  634. <template slot-scope="scope">
  635. <span>{{ scope.row.cowneed }}</span>
  636. </template>
  637. </el-table-column>
  638. <el-table-column label="泌乳天数" min-width="130px" align="center">
  639. <template slot-scope="scope">
  640. <span>{{ scope.row.avgdim }}</span>
  641. </template>
  642. </el-table-column>
  643. <el-table-column label="标准分数" min-width="130px" align="center">
  644. <template slot-scope="scope">
  645. <span>{{ scope.row.standardscore }}</span>
  646. </template>
  647. </el-table-column>
  648. <el-table-column label="2.75-分(数量、百分比)" min-width="130px" align="center">
  649. <template slot-scope="scope">
  650. <span>{{ scope.row.score25 }}({{ scope.row.score25rate }}%)</span>
  651. </template>
  652. </el-table-column>
  653. <el-table-column label="2.75分(数量、百分比)" min-width="130px" align="center">
  654. <template slot-scope="scope">
  655. <span>{{ scope.row.score275 }}({{ scope.row.score275rate }}%)</span>
  656. </template>
  657. </el-table-column>
  658. <el-table-column label="3分(数量、百分比)" min-width="130px" align="center">
  659. <template slot-scope="scope">
  660. <span>{{ scope.row.score3 }}({{ scope.row.score3rate }}%)</span>
  661. </template>
  662. </el-table-column>
  663. <el-table-column label="3.25分(数量、百分比)" min-width="130px" align="center">
  664. <template slot-scope="scope">
  665. <span>{{ scope.row.score325 }}({{ scope.row.score325rate }}%)</span>
  666. </template>
  667. </el-table-column>
  668. <el-table-column label="3.5分(数量、百分比)" min-width="130px" align="center">
  669. <template slot-scope="scope">
  670. <span>{{ scope.row.score35 }}({{ scope.row.score35rate }}%)</span>
  671. </template>
  672. </el-table-column>
  673. <el-table-column label="3.75分(数量、百分比)" min-width="130px" align="center">
  674. <template slot-scope="scope">
  675. <span>{{ scope.row.score375 }}({{ scope.row.score375rate }}%)</span>
  676. </template>
  677. </el-table-column>
  678. <el-table-column label="4+分(数量、百分比)" min-width="130px" align="center">
  679. <template slot-scope="scope">
  680. <span>{{ scope.row.score4 }}({{ scope.row.score4rate }}%)</span>
  681. </template>
  682. </el-table-column>
  683. </el-table>
  684. </div>
  685. </el-col>
  686. </el-row>
  687. <el-row>
  688. <el-col :span="24">
  689. <h3 style="text-align: center;">粪便评分</h3>
  690. <div class="table">
  691. <el-table
  692. :key="nutritional.tab2.tableKey4"
  693. v-loading="nutritional.tab2.listLoading4"
  694. element-loading-text="给我一点时间"
  695. :data="nutritional.tab2.list4"
  696. border
  697. fit
  698. highlight-current-row
  699. style="width: 100%;margin-bottom:60px;"
  700. :row-style="rowStyle"
  701. :cell-style="cellStyle"
  702. class="elTable table-fixed"
  703. >
  704. <el-table-column label="日期" min-width="130px" align="center">
  705. <template slot-scope="scope">
  706. <span>{{ scope.row.operatetime }}</span>
  707. </template>
  708. </el-table-column>
  709. <el-table-column label="抽查样本数" min-width="130px" align="center">
  710. <template slot-scope="scope">
  711. <span>{{ scope.row.sumcowcount }}</span>
  712. </template>
  713. </el-table-column>
  714. <el-table-column label="单产(kg/头)" min-width="130px" align="center">
  715. <template slot-scope="scope">
  716. <span>{{ scope.row.product }}</span>
  717. </template>
  718. </el-table-column>
  719. <el-table-column label="干物质采食量(kg/头)" min-width="130px" align="center">
  720. <template slot-scope="scope">
  721. <span>{{ scope.row.cowneed }}</span>
  722. </template>
  723. </el-table-column>
  724. <el-table-column label="泌乳天数" min-width="130px" align="center">
  725. <template slot-scope="scope">
  726. <span>{{ scope.row.avgdim }}</span>
  727. </template>
  728. </el-table-column>
  729. <el-table-column label="标准分数" min-width="130px" align="center">
  730. <template slot-scope="scope">
  731. <span>{{ scope.row.cowneed }}</span>
  732. </template>
  733. </el-table-column>
  734. <el-table-column label="1分(数量、百分比)" min-width="130px" align="center">
  735. <template slot-scope="scope">
  736. <span>{{ scope.row.score1 }}({{ scope.row.score1rate }}%)</span>
  737. </template>
  738. </el-table-column>
  739. <el-table-column label="2分(数量、百分比)" min-width="130px" align="center">
  740. <template slot-scope="scope">
  741. <span>{{ scope.row.score2 }}({{ scope.row.score2rate }}%)</span>
  742. </template>
  743. </el-table-column>
  744. <el-table-column label="3分(数量、百分比)" min-width="130px" align="center">
  745. <template slot-scope="scope">
  746. <span>{{ scope.row.score3 }}({{ scope.row.score3rate }}%)</span>
  747. </template>
  748. </el-table-column>
  749. <el-table-column label="4分(数量、百分比)" min-width="130px" align="center">
  750. <template slot-scope="scope">
  751. <span>{{ scope.row.score4 }}({{ scope.row.score4rate }}%)</span>
  752. </template>
  753. </el-table-column>
  754. <el-table-column label="5分(数量、百分比)" min-width="130px" align="center">
  755. <template slot-scope="scope">
  756. <span>{{ scope.row.score5 }}({{ scope.row.score5rate }}%)</span>
  757. </template>
  758. </el-table-column>
  759. </el-table>
  760. </div>
  761. </el-col>
  762. </el-row>
  763. </el-tab-pane>
  764. </el-tabs>
  765. <div slot="footer" class="dialog-footer">
  766. <el-button class="cancelClose cancelClose1" @click="nutritional.dialogFormVisible = false; ">关闭</el-button>
  767. </div>
  768. </div>
  769. </el-dialog>
  770. <!-- 干物质调节 -->
  771. <DryMatterRegulation ref="mychild" :show.sync="isShowDialog" @getIsDisplay="getIsDisplay" />
  772. </div>
  773. </template>
  774. <script>
  775. import { GetDataByName, postJson, GetDataByNames, compareSort, ExecDataByConfig, failproccess, PostDataByName, formatNum, checkButtons } from '@/api/common'
  776. import Pagination from '@/components/Pagination'
  777. import Pagination2 from '@/components/Pagination2'
  778. import { parseTime, json2excel, handleTableSpan, handleObjectSpanMethod } from '@/utils/index.js'
  779. import { MessageBox } from 'element-ui'
  780. import Cookies from 'js-cookie'
  781. import axios from 'axios'
  782. import { getToken } from '@/utils/auth'
  783. import DryMatterRegulation from './dryMatterRegulation.vue'
  784. export default {
  785. inject: ['reload'],
  786. name: 'DhedFormula',
  787. components: { Pagination, Pagination2, DryMatterRegulation },
  788. data() {
  789. return {
  790. isproportion:false,
  791. dialogFull: false,
  792. isRoleEdit: [],
  793. isSynchronous:[],
  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. { name: 'getSysoptEnable', offset: 0, pagecount: 0, parammaps: { pastureid: Cookies.get('pastureid'),"inforname":"udFeedpSync" }}
  823. ],
  824. getFeedTempletNameListParm: {
  825. name: 'getFeedTempletName',
  826. page: 1,
  827. offset: 1,
  828. // pagecount: parseInt(Cookies.get('pageCount')),
  829. pagecount: '',
  830. returntype: 'Map',
  831. parammaps: {
  832. pastureid: Cookies.get('pastureid')
  833. }
  834. },
  835. tnameList: [], // 配方名 称
  836. recipeTemplateList: [], // 配方模板
  837. feedingFormulaList: [], // 补料配方
  838. livestockTypeList: [], // 类别
  839. barList: [],
  840. rules: {
  841. cowclassid: [{ type: 'string', required: true, message: '必填', trigger: 'blur' }]
  842. },
  843. table: {
  844. getdataListParm: {
  845. name: 'getFPList',
  846. page: 1,
  847. offset: 1,
  848. // pagecount: parseInt(Cookies.get('pageCount')),
  849. pagecount: '',
  850. returntype: 'Map',
  851. parammaps: {
  852. pastureid: Cookies.get('pastureid'),
  853. enable: '',
  854. barid: '',
  855. tname: ''
  856. }
  857. },
  858. tableKey: 0,
  859. list: [],
  860. total: 0,
  861. listLoading: true,
  862. temp: {},
  863. rwList: [],
  864. isPtsfname: false, // 补料配方/补料重量
  865. getdataListParm2: {
  866. name: 'getSysoptEnable',
  867. page: 1,
  868. offset: 1,
  869. pagecount: 1,
  870. returntype: 'Map',
  871. parammaps: {
  872. pastureid: Cookies.get('pastureid'),
  873. inforname: 'isEnableSupplyFeed'
  874. }
  875. },
  876. isRW1: false, // 第一班
  877. isRW2: false, // 第二班
  878. isRW3: false, // 第三班
  879. isRW4: false, // 第四班
  880. isRW5: false, // 第五班
  881. isRW6: false, // 第六班
  882. getdataListParm3: {
  883. name: 'getSysoptEnable1',
  884. page: 1,
  885. offset: 1,
  886. pagecount: 1,
  887. returntype: 'Map',
  888. parammaps: {
  889. pastureid: Cookies.get('pastureid'),
  890. inforname: 'times'
  891. }
  892. },
  893. RWLength: '' // 班次长度
  894. },
  895. selectList: [],
  896. // 营养评估
  897. nutritional: {
  898. dialogFormVisible: false,
  899. dialogStatus: '',
  900. activeName: 'first ',
  901. tab1: {
  902. // inputDatetime: [new Date().setTime(new Date().getTime() - 3600 * 1000 * 24 * 1), new Date().setTime(new Date().getTime() - 3600 * 1000 * 24 * 1)],
  903. inputDatetime: [new Date(), new Date()],
  904. listLoading1: true,
  905. getdataListParm1: {
  906. name: 'getnurj',
  907. page: 1,
  908. offset: 1,
  909. pagecount: 10,
  910. returntype: 'Map',
  911. parammaps: {
  912. pastureid: '',
  913. barid: ''
  914. }
  915. },
  916. disabledCowclass: false,
  917. temp: {},
  918. tableKey: 0,
  919. list: [],
  920. total: 0,
  921. listLoading2: true,
  922. getdataListParm2: {
  923. name: 'GETNurJudge',
  924. page: 1,
  925. offset: 1,
  926. pagecount: 10,
  927. returntype: 'Map',
  928. parammaps: {
  929. pastureid: '',
  930. cowclassid: ''
  931. }
  932. }
  933. },
  934. tab2: {
  935. // inputDatetime: [new Date().setTime(new Date().getTime() - 3600 * 1000 * 24 * 1), new Date().setTime(new Date().getTime() - 3600 * 1000 * 24 * 1)],
  936. inputDatetime: [new Date(), new Date()],
  937. listLoading1: true,
  938. tableKey1: 0,
  939. list1: [],
  940. total1: 0,
  941. getdataListParm1: {
  942. name: 'getPennsieveList',
  943. page: 1,
  944. offset: 1,
  945. pagecount: 10,
  946. returntype: 'Map',
  947. parammaps: {
  948. pastureid: '',
  949. barid: '',
  950. startTime: '',
  951. stopTime: '',
  952. inputDatetime: ''
  953. }
  954. },
  955. listLoading2: true,
  956. tableKey2: 0,
  957. list2: [],
  958. total2: 0,
  959. getdataListParm2: {
  960. name: 'getDungsieveList',
  961. page: 1,
  962. offset: 1,
  963. pagecount: 10,
  964. returntype: 'Map',
  965. parammaps: {
  966. pastureid: '',
  967. barid: '',
  968. startTime: '',
  969. stopTime: '',
  970. inputDatetime: ''
  971. }
  972. },
  973. listLoading3: true,
  974. tableKey3: 0,
  975. list3: [],
  976. total3: 0,
  977. getdataListParm3: {
  978. name: 'getBodyscoreList',
  979. page: 1,
  980. offset: 1,
  981. pagecount: 10,
  982. returntype: 'Map',
  983. parammaps: {
  984. pastureid: '',
  985. barid: '',
  986. startTime: '',
  987. stopTime: '',
  988. inputDatetime: ''
  989. }
  990. },
  991. listLoading4: true,
  992. tableKey4: 0,
  993. list4: [],
  994. total4: 0,
  995. getdataListParm4: {
  996. name: 'getDungscoreList',
  997. page: 1,
  998. offset: 1,
  999. pagecount: 10,
  1000. returntype: 'Map',
  1001. parammaps: {
  1002. pastureid: '',
  1003. barid: '',
  1004. startTime: '',
  1005. stopTime: '',
  1006. inputDatetime: ''
  1007. }
  1008. }
  1009. }
  1010. },
  1011. history: {
  1012. dialogFormVisible: false,
  1013. dialogStatus: '',
  1014. temp: {},
  1015. rules: {},
  1016. tableKey: 0,
  1017. list: [],
  1018. total: 0,
  1019. listLoading: true,
  1020. getdataListParm: {
  1021. name: 'getPlanModifyFPlist',
  1022. page: 1,
  1023. offset: 1,
  1024. // pagecount: 12,
  1025. pagecount: '',
  1026. returntype: 'Map',
  1027. parammaps: {
  1028. pastureid: Cookies.get('pastureid'),
  1029. date: '',
  1030. barid: '',
  1031. tname: ''
  1032. }
  1033. },
  1034. isPtsfname: false, // 补料配方/补料重量
  1035. getdataListParm2: {
  1036. name: 'getSysoptEnable',
  1037. page: 1,
  1038. offset: 1,
  1039. pagecount: 1,
  1040. returntype: 'Map',
  1041. parammaps: {
  1042. pastureid: Cookies.get('pastureid'),
  1043. inforname: 'isEnableSupplyFeed'
  1044. }
  1045. },
  1046. isRW1: false, // 第一班
  1047. isRW2: false, // 第二班
  1048. isRW3: false, // 第三班
  1049. isRW4: false, // 第四班
  1050. isRW5: false, // 第五班
  1051. isRW6: false, // 第六班
  1052. getdataListParm3: {
  1053. name: 'getSysoptEnable1',
  1054. page: 1,
  1055. offset: 1,
  1056. pagecount: 1,
  1057. returntype: 'Map',
  1058. parammaps: {
  1059. pastureid: Cookies.get('pastureid'),
  1060. inforname: 'times'
  1061. }
  1062. },
  1063. getdataDateParm: {
  1064. name: 'getFPMaxDate',
  1065. page: 1,
  1066. offset: 1,
  1067. pagecount: 10,
  1068. returntype: 'Map',
  1069. parammaps: {
  1070. pastureid: Cookies.get('pastureid')
  1071. }
  1072. }
  1073. },
  1074. textMap: {
  1075. Nutritional: '营养评估',
  1076. history: '历史记录'
  1077. },
  1078. requestParam: {},
  1079. download: {
  1080. getdataListParm: {
  1081. name: 'getFPList',
  1082. page: 1,
  1083. offset: 1,
  1084. pagecount: 0,
  1085. returntype: 'Map',
  1086. parammaps: {
  1087. pastureid: Cookies.get('pastureid'),
  1088. enable: ''
  1089. }
  1090. },
  1091. list: []
  1092. },
  1093. spanObj: {},
  1094. mergekeys: ['barname', 'sumweight'],
  1095. isShowDialog: false,
  1096. isokDisable: false,
  1097. rowStyle: { maxHeight: 30 + 'px', height: 30 + 'px' },
  1098. cellStyle: { padding: 0 + 'px' },
  1099. myHeight: document.documentElement.clientHeight - 85 - 140,
  1100. oldRowList:{},
  1101. oldList:[],
  1102. decimal: parseInt(Cookies.get('decimal')),
  1103. decimalr: parseInt(Cookies.get('decimalr'))
  1104. }
  1105. },
  1106. computed: {
  1107. // 设置请求头
  1108. headers() {
  1109. return {
  1110. token: getToken()
  1111. }
  1112. },
  1113. uploadData() {
  1114. return {
  1115. name: 'checkbarname,checkftsw,checkftbl',
  1116. importParams: '栏舍名称,实际牛头数,系数(%),配方模板,补料配方,第一班比例(%),第二班比例(%),第三班比例(%)',
  1117. sheetname: 'Sheet1',
  1118. // 登录牧场
  1119. pastureid: Cookies.get('pastureid'),
  1120. // 日期参数
  1121. dateParams: '',
  1122. // 必填参数
  1123. requiredParams: '栏舍名称,实际牛头数,系数(%),配方模板,',
  1124. // 为数值的参数
  1125. numParams: '实际牛头数,系数(%),第一班比例(%),第二班比例(%),第三班比例(%),,第四班比例(%)'
  1126. }
  1127. },
  1128. // 设置上传地址
  1129. uploadExcelUrl() {
  1130. return Cookies.get('url') + 'authdata/fpdimportexcel'
  1131. }
  1132. },
  1133. created() {
  1134. this.getButtons()
  1135. this.getDownList()
  1136. this.getFeedTempletNameList()
  1137. },
  1138. methods: {
  1139. getButtons() {
  1140. const Edit = 'DhedFormula'
  1141. const isRoleEdit = checkButtons(JSON.parse(sessionStorage.getItem('buttons')), Edit)
  1142. this.isRoleEdit = isRoleEdit
  1143. },
  1144. getDownList() {
  1145. GetDataByNames(this.requestParams).then(response => {
  1146. if(response.data.getSysoptEnable.list[0].inforvalue == 1){
  1147. this.isSynchronous = true
  1148. }else{
  1149. this.isSynchronous = false
  1150. }
  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 == undefined || isNaN(row.w1)) { row.w1 = 0 }
  1661. if (row.w2 == '' || row.w2 == undefined || isNaN(row.w2)) { row.w2 = 0 }
  1662. if (row.w3 == '' || row.w3 == undefined || isNaN(row.w3)) { row.w3 = 0 }
  1663. if (row.w4 == '' || row.w4 == undefined || isNaN(row.w4)) { row.w4 = 0 }
  1664. if (row.w5 == '' || row.w5 == undefined || isNaN(row.w5)) { row.w5 = 0 }
  1665. if (row.w6 == '' || row.w6 == undefined || isNaN(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. this.placeholder(row)
  1673. },
  1674. blurRatio(row) {
  1675. if (row.ftid !== '-1' && row.ftid !== '') {
  1676. row.Sfweight = this.recipeTemplateList.find(obj => obj.id == row.ftid).Sfweight
  1677. row.SfweightLock = this.recipeTemplateList.find(obj => obj.id == row.ftid).SfweightLock
  1678. }
  1679. if (row.w1 == '' || row.w1 == undefined || isNaN(row.w1)) { row.w1 = 0 }
  1680. if (row.w2 == '' || row.w2 == undefined || isNaN(row.w2)) { row.w2 = 0 }
  1681. if (row.w3 == '' || row.w3 == undefined || isNaN(row.w3)) { row.w3 = 0 }
  1682. if (row.w4 == '' || row.w4 == undefined || isNaN(row.w4)) { row.w4 = 0 }
  1683. if (row.w5 == '' || row.w5 == undefined || isNaN(row.w5)) { row.w5 = 0 }
  1684. if (row.w6 == '' || row.w6 == undefined || isNaN(row.w6)) { row.w6 = 0 }
  1685. // 配方重量=实际牛头数*系数*配方模板取Sfweight
  1686. row.ftweight = (row.ccount * row.ratio / 100 * row.Sfweight).toFixed(this.decimal)
  1687. // 实际牛头数不变
  1688. // 系数头数=实际牛头数*系数
  1689. row.ccountratio = (parseFloat(row.ccount)*(parseFloat(row.ratio) / 100)).toFixed(this.decimal)
  1690. this.public(row)
  1691. this.placeholder(row)
  1692. },
  1693. blurCcountratio(row) {
  1694. if (row.ftid !== '-1' && row.ftid !== '') {
  1695. row.Sfweight = this.recipeTemplateList.find(obj => obj.id == row.ftid).Sfweight
  1696. row.SfweightLock = this.recipeTemplateList.find(obj => obj.id == row.ftid).SfweightLock
  1697. }
  1698. if (row.w1 == '' || row.w1 == undefined || isNaN(row.w1)) { row.w1 = 0 }
  1699. if (row.w2 == '' || row.w2 == undefined || isNaN(row.w2)) { row.w2 = 0 }
  1700. if (row.w3 == '' || row.w3 == undefined || isNaN(row.w3)) { row.w3 = 0 }
  1701. if (row.w4 == '' || row.w4 == undefined || isNaN(row.w4)) { row.w4 = 0 }
  1702. if (row.w5 == '' || row.w5 == undefined || isNaN(row.w5)) { row.w5 = 0 }
  1703. if (row.w6 == '' || row.w6 == undefined || isNaN(row.w6)) { row.w6 = 0 }
  1704. // 配方重量=实际牛头数*系数*配方模板取Sfweight
  1705. row.ftweight = (row.ccount * row.ratio / 100 * row.Sfweight).toFixed(this.decimal)
  1706. // 实际牛头数不变
  1707. // 系数=系数头数/实际牛头数*100
  1708. row.ratio = (parseFloat(row.ccountratio) / parseFloat(row.ccount) * 100).toFixed(this.decimal)
  1709. this.public(row)
  1710. this.placeholder(row)
  1711. },
  1712. public(row){
  1713. console.log(row,'row')
  1714. // 未锁定时:各班次比例不变,各班次重量=配方重量*各班次比例
  1715. // 锁定时:未锁定班次比例不变,锁定班次比例=班次重量/配方重量x100%
  1716. if(row.isOneWeight == true){
  1717. if(row.w1 && row.ftweight && !isNaN(parseFloat(row.w1)) && !isNaN(parseFloat(row.ftweight))){
  1718. row.r1 = (parseFloat(row.w1) / parseFloat(row.ftweight) * 100).toFixed(this.decimalr)
  1719. }else{
  1720. row.r1 = 0
  1721. }
  1722. }else{
  1723. if(row.r1 && row.ftweight && !isNaN(parseFloat(row.r1)) && !isNaN(parseFloat(row.ftweight))){
  1724. row.w1 = (parseFloat(row.ftweight) * parseFloat(row.r1) / 100).toFixed(this.decimal)
  1725. }else{
  1726. row.w1 = 0
  1727. }
  1728. }
  1729. if(row.isTwoWeight == true){
  1730. if(row.w2 && row.ftweight && !isNaN(parseFloat(row.w2)) && !isNaN(parseFloat(row.ftweight))){
  1731. row.r2 = (parseFloat(row.w2) / parseFloat(row.ftweight) * 100).toFixed(this.decimalr)
  1732. }else{
  1733. row.r2 = 0
  1734. }
  1735. }else{
  1736. if(row.r2 && row.ftweight && !isNaN(parseFloat(row.r2)) && !isNaN(parseFloat(row.ftweight))){
  1737. row.w2 = (parseFloat(row.ftweight) * parseFloat(row.r2) / 100).toFixed(this.decimal)
  1738. }else{
  1739. row.w2 = 0
  1740. }
  1741. }
  1742. if(row.isThreeWeight == true){
  1743. if(row.w3 && row.ftweight && !isNaN(parseFloat(row.w3)) && !isNaN(parseFloat(row.ftweight))){
  1744. row.r3 = (parseFloat(row.w3) / parseFloat(row.ftweight) * 100).toFixed(this.decimalr)
  1745. }else{
  1746. row.r3 = 0
  1747. }
  1748. }else{
  1749. if(row.r3 && row.ftweight && !isNaN(parseFloat(row.r3)) && !isNaN(parseFloat(row.ftweight))){
  1750. row.w3 = (parseFloat(row.ftweight) * parseFloat(row.r3) / 100).toFixed(this.decimal)
  1751. }else{
  1752. row.w3 = 0
  1753. }
  1754. }
  1755. if(row.isFourWeight == true){
  1756. if(row.w4 && row.ftweight && !isNaN(parseFloat(row.w4)) && !isNaN(parseFloat(row.ftweight))){
  1757. row.r4 = (parseFloat(row.w4) / parseFloat(row.ftweight) * 100).toFixed(this.decimalr)
  1758. }else{
  1759. row.r4 = 0
  1760. }
  1761. }else{
  1762. if(row.r4 && row.ftweight && !isNaN(parseFloat(row.r4)) && !isNaN(parseFloat(row.ftweight))){
  1763. row.w4 = (parseFloat(row.ftweight) * parseFloat(row.r4) / 100).toFixed(this.decimal)
  1764. }else{
  1765. row.w4 = 0
  1766. }
  1767. }
  1768. if(row.isFiveWeight == true){
  1769. if(row.w5 && row.ftweight && !isNaN(parseFloat(row.w5)) && !isNaN(parseFloat(row.ftweight))){
  1770. row.r5 = (parseFloat(row.w5) / parseFloat(row.ftweight) * 100).toFixed(this.decimalr)
  1771. }else{
  1772. row.r5 = 0
  1773. }
  1774. }else{
  1775. if(row.r5 && row.ftweight && !isNaN(parseFloat(row.r5)) && !isNaN(parseFloat(row.ftweight))){
  1776. row.w5 = (parseFloat(row.ftweight) * parseFloat(row.r5) / 100).toFixed(this.decimal)
  1777. }else{
  1778. row.w5 = 0
  1779. }
  1780. }
  1781. if(row.isSixWeight == true){
  1782. if(row.w6 && row.ftweight && !isNaN(parseFloat(row.w6)) && !isNaN(parseFloat(row.ftweight))){
  1783. row.r6 = (parseFloat(row.w6) / parseFloat(row.ftweight) * 100).toFixed(this.decimalr)
  1784. }else{
  1785. row.r5 = 0
  1786. }
  1787. }else{
  1788. if(row.r6 && row.ftweight && !isNaN(parseFloat(row.r6)) && !isNaN(parseFloat(row.ftweight))){
  1789. row.w6 = (parseFloat(row.ftweight) * parseFloat(row.r6) / 100).toFixed(this.decimal)
  1790. }else{
  1791. row.w6 = 0
  1792. }
  1793. }
  1794. console.log(row,'row2')
  1795. if(row.isOneWeight || row.isTWoWeight || row.isThreeWeight || row.isFourWeight || row.isFiveWeight || row.isSixWeight){
  1796. var sumr = 0
  1797. if(row.r1 && !isNaN(row.r1)){ sumr += parseFloat(row.r1) }
  1798. if(row.r2 && !isNaN(row.r2)){ sumr += parseFloat(row.r2) }
  1799. if(row.r3 && !isNaN(row.r3)){ sumr += parseFloat(row.r3) }
  1800. if(row.r4 && !isNaN(row.r4)){ sumr += parseFloat(row.r4) }
  1801. if(row.r5 && !isNaN(row.r5)){ sumr += parseFloat(row.r5) }
  1802. if(row.r6 && !isNaN(row.r6)){ sumr += parseFloat(row.r6) }
  1803. this.$set(row, 'sumr', sumr.toFixed(this.decimalr))
  1804. }else{
  1805. // 总比例不变
  1806. var sumr = 0
  1807. if(row.r1 && !isNaN(row.r1)){ sumr += parseFloat(row.r1) }
  1808. if(row.r2 && !isNaN(row.r2)){ sumr += parseFloat(row.r2) }
  1809. if(row.r3 && !isNaN(row.r3)){ sumr += parseFloat(row.r3) }
  1810. if(row.r4 && !isNaN(row.r4)){ sumr += parseFloat(row.r4) }
  1811. if(row.r5 && !isNaN(row.r5)){ sumr += parseFloat(row.r5) }
  1812. if(row.r6 && !isNaN(row.r6)){ sumr += parseFloat(row.r6) }
  1813. this.$set(row, 'sumr', sumr.toFixed(this.decimalr))
  1814. }
  1815. // 饲喂投喂量 = 所有班次重量之和
  1816. var sumw = 0
  1817. if(row.w1 && !isNaN(row.w1)){ sumw += parseFloat(row.w1) }
  1818. if(row.w2 && !isNaN(row.w2)){ sumw += parseFloat(row.w2) }
  1819. if(row.w3 && !isNaN(row.w3)){ sumw += parseFloat(row.w3) }
  1820. if(row.w4 && !isNaN(row.w4)){ sumw += parseFloat(row.w4) }
  1821. if(row.w5 && !isNaN(row.w5)){ sumw += parseFloat(row.w5) }
  1822. if(row.w6 && !isNaN(row.w6)){ sumw += parseFloat(row.w6) }
  1823. this.$set(row, 'sumw', sumw.toFixed(this.decimal))
  1824. // 日投喂量 = 饲喂投喂量+补料
  1825. if (isNaN(row.bw1) || row.bw1 == '') { this.$set(row, 'bw1', 0) }
  1826. if (isNaN(row.bw2) || row.bw2 == '') { this.$set(row, 'bw2', 0) }
  1827. if (isNaN(row.bw3) || row.bw3 == '') { this.$set(row, 'bw3', 0) }
  1828. if (isNaN(row.bw4) || row.bw4 == '') { this.$set(row, 'bw4', 0) }
  1829. if (isNaN(row.bw5) || row.bw5 == '') { this.$set(row, 'bw5', 0) }
  1830. if (isNaN(row.bw6) || row.bw6 == '') { this.$set(row, 'bw6', 0) }
  1831. // var sumbw = (parseFloat(row.bw1) + parseFloat(row.bw2) + parseFloat(row.bw3) + parseFloat(row.bw4) + parseFloat(row.bw5) + parseFloat(row.bw6)).toFixed(this.decimal)
  1832. var sumbw = 0
  1833. if(row.bw1 && !isNaN(row.bw1)){ sumbw += parseFloat(row.bw1) }
  1834. if(row.bw2 && !isNaN(row.bw2)){ sumbw += parseFloat(row.bw2) }
  1835. if(row.bw3 && !isNaN(row.bw3)){ sumbw += parseFloat(row.bw3) }
  1836. if(row.bw4 && !isNaN(row.bw4)){ sumbw += parseFloat(row.bw4) }
  1837. if(row.bw5 && !isNaN(row.bw5)){ sumbw += parseFloat(row.bw5) }
  1838. if(row.bw6 && !isNaN(row.bw6)){ sumbw += parseFloat(row.bw6) }
  1839. this.$set(row, 'sumbw', sumbw.toFixed(this.decimal))
  1840. var todayfeed = parseFloat(sumw) + parseFloat(sumbw)
  1841. this.$set(row, 'todayfeed', todayfeed)
  1842. },
  1843. blurR(row,item) {
  1844. if (row.ftid !== '-1' && row.ftid !== '') {
  1845. row.Sfweight = this.recipeTemplateList.find(obj => obj.id == row.ftid).Sfweight
  1846. }
  1847. // 配方重量=实际牛头数*系数*配方模板取Sfweight
  1848. row.ftweight = (parseFloat(row.ccount) * parseFloat(row.ratio) / 100 * parseFloat(row.Sfweight)).toFixed(this.decimal)
  1849. console.log(parseFloat(row.ccount),'======ccount')
  1850. console.log(parseFloat(row.ftweight),'======ftweight')
  1851. if(item == 1){
  1852. // 一班比例
  1853. if(!isNaN(parseFloat(row.r1)) && !isNaN(parseFloat(row.ftweight)) && row.r1 && row.ftweight){
  1854. row.w1 = (parseFloat(row.r1)/100 * parseFloat(row.ftweight)).toFixed(this.decimal)
  1855. }else{
  1856. row.w1 = 0
  1857. }
  1858. }else if(item == 2){
  1859. // 二班比例
  1860. if(!isNaN(parseFloat(row.r2)) && !isNaN(parseFloat(row.ftweight)) && row.r2 && row.ftweight){
  1861. row.w2 = (parseFloat(row.r2)/100 * parseFloat(row.ftweight)).toFixed(this.decimal)
  1862. }else{
  1863. row.w2 = 0
  1864. }
  1865. }else if(item == 3){
  1866. // 三班比例
  1867. if(!isNaN(parseFloat(row.r3)) && !isNaN(parseFloat(row.ftweight)) && row.r3 && row.ftweight){
  1868. row.w3 = (parseFloat(row.r3)/100 * parseFloat(row.ftweight)).toFixed(this.decimal)
  1869. }else{
  1870. row.w3 = 0
  1871. }
  1872. }else if(item == 4){
  1873. // 四班比例
  1874. if(!isNaN(parseFloat(row.r4)) && !isNaN(parseFloat(row.ftweight)) && row.r4 && row.ftweight){
  1875. row.w4 = (parseFloat(row.r4)/100 * parseFloat(row.ftweight)).toFixed(this.decimal)
  1876. }else{
  1877. row.w4 = 0
  1878. }
  1879. }else if(item == 5){
  1880. // 五班比例
  1881. if(!isNaN(parseFloat(row.r5)) && !isNaN(parseFloat(row.ftweight)) && row.r5 && row.ftweight){
  1882. row.w5 = (parseFloat(row.r5)/100 * parseFloat(row.ftweight)).toFixed(this.decimal)
  1883. }else{
  1884. row.w5 = 0
  1885. }
  1886. }else if(item == 6){
  1887. // 六班比例
  1888. if(!isNaN(parseFloat(row.r6)) && !isNaN(parseFloat(row.ftweight)) && row.r6 && row.ftweight){
  1889. row.w6 = (parseFloat(row.r6)/100 * parseFloat(row.ftweight)).toFixed(this.decimal)
  1890. }else{
  1891. row.w6 = 0
  1892. }
  1893. }
  1894. // 总比例=所有比例之和
  1895. // 饲喂投喂量 = 所有班次重量之和
  1896. var sumr = 0
  1897. if(row.r1 && !isNaN(row.r1)){ sumr += parseFloat(row.r1) }
  1898. if(row.r2 && !isNaN(row.r2)){ sumr += parseFloat(row.r2) }
  1899. if(row.r3 && !isNaN(row.r3)){ sumr += parseFloat(row.r3) }
  1900. if(row.r4 && !isNaN(row.r4)){ sumr += parseFloat(row.r4) }
  1901. if(row.r5 && !isNaN(row.r5)){ sumr += parseFloat(row.r5) }
  1902. if(row.r6 && !isNaN(row.r6)){ sumr += parseFloat(row.r6) }
  1903. this.$set(row, 'sumr', sumr.toFixed(this.decimalr))
  1904. var sumw = 0
  1905. if(row.w1 && !isNaN(row.w1)){ sumw += parseFloat(row.w1) }
  1906. if(row.w2 && !isNaN(row.w2)){ sumw += parseFloat(row.w2) }
  1907. if(row.w3 && !isNaN(row.w3)){ sumw += parseFloat(row.w3) }
  1908. if(row.w4 && !isNaN(row.w4)){ sumw += parseFloat(row.w4) }
  1909. if(row.w5 && !isNaN(row.w5)){ sumw += parseFloat(row.w5) }
  1910. if(row.w6 && !isNaN(row.w6)){ sumw += parseFloat(row.w6) }
  1911. this.$set(row, 'sumw', sumw.toFixed(this.decimal))
  1912. // 日投喂量 = 饲喂投喂量+补料
  1913. if (isNaN(row.bw1) || row.bw1 == '' || row.bw1 == undefined) { this.$set(row, 'bw1', 0) }
  1914. if (isNaN(row.bw2) || row.bw2 == '' || row.bw1 == undefined) { this.$set(row, 'bw2', 0) }
  1915. if (isNaN(row.bw3) || row.bw3 == '' || row.bw1 == undefined) { this.$set(row, 'bw3', 0) }
  1916. if (isNaN(row.bw4) || row.bw4 == '' || row.bw1 == undefined) { this.$set(row, 'bw4', 0) }
  1917. if (isNaN(row.bw5) || row.bw5 == '' || row.bw1 == undefined) { this.$set(row, 'bw5', 0) }
  1918. if (isNaN(row.bw6) || row.bw6 == '' || row.bw1 == undefined) { this.$set(row, 'bw6', 0) }
  1919. var sumbw = 0
  1920. if(row.bw1 && !isNaN(row.bw1)){ sumbw += parseFloat(row.bw1) }
  1921. if(row.bw2 && !isNaN(row.bw2)){ sumbw += parseFloat(row.bw2) }
  1922. if(row.bw3 && !isNaN(row.bw3)){ sumbw += parseFloat(row.bw3) }
  1923. if(row.bw4 && !isNaN(row.bw4)){ sumbw += parseFloat(row.bw4) }
  1924. if(row.bw5 && !isNaN(row.bw5)){ sumbw += parseFloat(row.bw5) }
  1925. if(row.bw6 && !isNaN(row.bw6)){ sumbw += parseFloat(row.bw6) }
  1926. this.$set(row, 'sumbw', sumbw.toFixed(this.decimal))
  1927. // var sumbw = (parseFloat(row.bw1) + parseFloat(row.bw2) + parseFloat(row.bw3) + parseFloat(row.bw4) + parseFloat(row.bw5) + parseFloat(row.bw6)).toFixed(this.decimal)
  1928. var todayfeed = parseFloat(sumw) + parseFloat(sumbw)
  1929. console.log(todayfeed,'sumw==')
  1930. this.$set(row, 'todayfeed', todayfeed)
  1931. this.placeholder(row)
  1932. },
  1933. placeholder(row){
  1934. this.$set(row, 'placeholder_r1', this.oldRowList.r1)
  1935. this.$set(row, 'placeholder_r2', this.oldRowList.r2)
  1936. this.$set(row, 'placeholder_r3', this.oldRowList.r3)
  1937. this.$set(row, 'placeholder_r4', this.oldRowList.r4)
  1938. this.$set(row, 'placeholder_r5', this.oldRowList.r5)
  1939. this.$set(row, 'placeholder_r6', this.oldRowList.r6)
  1940. this.$set(row, 'placeholder_w1', this.oldRowList.w1)
  1941. this.$set(row, 'placeholder_w2', this.oldRowList.w2)
  1942. this.$set(row, 'placeholder_w3', this.oldRowList.w3)
  1943. this.$set(row, 'placeholder_w4', this.oldRowList.w4)
  1944. this.$set(row, 'placeholder_w5', this.oldRowList.w5)
  1945. this.$set(row, 'placeholder_w6', this.oldRowList.w6)
  1946. this.$set(row, 'placeholder_bw1', this.oldRowList.bw1)
  1947. this.$set(row, 'placeholder_bw2', this.oldRowList.bw2)
  1948. this.$set(row, 'placeholder_bw3', this.oldRowList.bw3)
  1949. this.$set(row, 'placeholder_bw4', this.oldRowList.bw4)
  1950. this.$set(row, 'placeholder_bw5', this.oldRowList.bw5)
  1951. this.$set(row, 'placeholder_bw6', this.oldRowList.bw6)
  1952. this.$set(row, 'placeholder_ccount', this.oldRowList.ccount)
  1953. this.$set(row, 'placeholder_ratio', this.oldRowList.ratio)
  1954. this.$set(row, 'placeholder_ccountratio', this.oldRowList.ccountratio)
  1955. },
  1956. blurWeight(row,item) {
  1957. // 配方重量=实际牛头数*系数*配方模板取Sfweight
  1958. if (row.ftid !== '-1' && row.ftid !== '') {
  1959. row.Sfweight = this.recipeTemplateList.find(obj => obj.id == row.ftid).Sfweight
  1960. }
  1961. if(item == 1){
  1962. // 一班重量
  1963. if(!isNaN(parseFloat(row.w1)) && !isNaN(parseFloat(row.ftweight)) && row.w1 && row.ftweight){
  1964. row.r1 = (parseFloat(row.w1) / parseFloat(row.ftweight) * 100).toFixed(this.decimalr)
  1965. }else{
  1966. row.r1 = 0
  1967. }
  1968. }else if(item == 2){
  1969. // 二班重量
  1970. if(!isNaN(parseFloat(row.w2)) && !isNaN(parseFloat(row.ftweight)) && row.w2 && row.ftweight){
  1971. row.r2 = (parseFloat(row.w2) / parseFloat(row.ftweight) * 100).toFixed(this.decimalr)
  1972. }else{
  1973. row.r2 = 0
  1974. }
  1975. }else if(item == 3){
  1976. // 三班重量
  1977. if(!isNaN(parseFloat(row.w3)) && !isNaN(parseFloat(row.ftweight)) && row.w3 && row.ftweight){
  1978. row.r3 = (parseFloat(row.w3) / parseFloat(row.ftweight) * 100).toFixed(this.decimalr)
  1979. }else{
  1980. row.r3 = 0
  1981. }
  1982. }else if(item == 4){
  1983. // 四班重量
  1984. if(!isNaN(parseFloat(row.w4)) && !isNaN(parseFloat(row.ftweight)) && row.w4 && row.ftweight){
  1985. row.r4 = (parseFloat(row.w4) / parseFloat(row.ftweight) * 100).toFixed(this.decimalr)
  1986. }else{
  1987. row.r4 = 0
  1988. }
  1989. }else if(item == 5){
  1990. // 五班重量
  1991. if(!isNaN(parseFloat(row.w5)) && !isNaN(parseFloat(row.ftweight)) && row.w5 && row.ftweight){
  1992. row.r5 = (parseFloat(row.w5) / parseFloat(row.ftweight) * 100).toFixed(this.decimalr)
  1993. }else{
  1994. row.r5 = 0
  1995. }
  1996. }else if(item == 6){
  1997. // 六班重量
  1998. if(!isNaN(parseFloat(row.w6)) && !isNaN(parseFloat(row.ftweight)) && row.w6 && row.ftweight){
  1999. row.r6 = (parseFloat(row.w6) / parseFloat(row.ftweight) * 100).toFixed(this.decimalr)
  2000. }else{
  2001. row.r6 = 0
  2002. }
  2003. }
  2004. // 总比例=所有比例之和
  2005. // 饲喂投喂量 = 所有班次重量之和
  2006. var sumr = 0
  2007. if(row.r1 && !isNaN(row.r1)){ sumr += parseFloat(row.r1) }
  2008. if(row.r2 && !isNaN(row.r2)){ sumr += parseFloat(row.r2) }
  2009. if(row.r3 && !isNaN(row.r3)){ sumr += parseFloat(row.r3) }
  2010. if(row.r4 && !isNaN(row.r4)){ sumr += parseFloat(row.r4) }
  2011. if(row.r5 && !isNaN(row.r5)){ sumr += parseFloat(row.r5) }
  2012. if(row.r6 && !isNaN(row.r6)){ sumr += parseFloat(row.r6) }
  2013. this.$set(row, 'sumr', sumr.toFixed(this.decimalr))
  2014. var sumw = 0
  2015. if(row.w1 && !isNaN(row.w1)){ sumw += parseFloat(row.w1) }
  2016. if(row.w2 && !isNaN(row.w2)){ sumw += parseFloat(row.w2) }
  2017. if(row.w3 && !isNaN(row.w3)){ sumw += parseFloat(row.w3) }
  2018. if(row.w4 && !isNaN(row.w4)){ sumw += parseFloat(row.w4) }
  2019. if(row.w5 && !isNaN(row.w5)){ sumw += parseFloat(row.w5) }
  2020. if(row.w6 && !isNaN(row.w6)){ sumw += parseFloat(row.w6) }
  2021. this.$set(row, 'sumw', sumw.toFixed(this.decimal))
  2022. // 日投喂量 = 饲喂投喂量+补料
  2023. if (isNaN(row.bw1) || row.bw1 == '' || row.bw1 == undefined) { this.$set(row, 'bw1', 0) }
  2024. if (isNaN(row.bw2) || row.bw2 == '' || row.bw2 == undefined) { this.$set(row, 'bw2', 0) }
  2025. if (isNaN(row.bw3) || row.bw3 == '' || row.bw3 == undefined) { this.$set(row, 'bw3', 0) }
  2026. if (isNaN(row.bw4) || row.bw4 == '' || row.bw4 == undefined) { this.$set(row, 'bw4', 0) }
  2027. if (isNaN(row.bw5) || row.bw5 == '' || row.bw5 == undefined) { this.$set(row, 'bw5', 0) }
  2028. if (isNaN(row.bw6) || row.bw6 == '' || row.bw6 == undefined) { this.$set(row, 'bw6', 0) }
  2029. var sumbw = 0
  2030. if(row.bw1 && !isNaN(row.bw1)){ sumbw += parseFloat(row.bw1) }
  2031. if(row.bw2 && !isNaN(row.bw2)){ sumbw += parseFloat(row.bw2) }
  2032. if(row.bw3 && !isNaN(row.bw3)){ sumbw += parseFloat(row.bw3) }
  2033. if(row.bw4 && !isNaN(row.bw4)){ sumbw += parseFloat(row.bw4) }
  2034. if(row.bw5 && !isNaN(row.bw5)){ sumbw += parseFloat(row.bw5) }
  2035. if(row.bw6 && !isNaN(row.bw6)){ sumbw += parseFloat(row.bw6) }
  2036. this.$set(row, 'sumbw', sumbw.toFixed(this.decimal))
  2037. // var sumbw = (parseFloat(row.bw1) + parseFloat(row.bw2) + parseFloat(row.bw3) + parseFloat(row.bw4) + parseFloat(row.bw5) + parseFloat(row.bw6)).toFixed(this.decimal)
  2038. var todayfeed = parseFloat(sumw) + parseFloat(sumbw)
  2039. this.$set(row, 'todayfeed', todayfeed)
  2040. this.placeholder(row)
  2041. },
  2042. blurBw(row){
  2043. this.placeholder(row)
  2044. },
  2045. celldblclick(row, column, cell, event) {
  2046. console.log(row, '=====')
  2047. if(!this.isproportion){
  2048. this.handleUpdate(row)
  2049. }
  2050. },
  2051. // 编辑
  2052. handleUpdate(row) {
  2053. console.log(row)
  2054. this.oldRowList = {...row}
  2055. for (let i = 0; i < this.table.list.length; i++) {
  2056. if (this.table.list[i].Edit == true) {
  2057. this.$message({ type: 'error', message: '当前内容未保存,请点击取消或保存继续进行操作', duration: 2000 })
  2058. return false
  2059. }
  2060. }
  2061. // 编辑true,不可编辑false
  2062. row.Edit = true
  2063. row.NoEdit = false
  2064. // 编辑false,编辑保存true
  2065. row.isUpdate = false
  2066. row.isUpdateSave = true
  2067. row.ftid = String(row.ftid)
  2068. if (row.ptsfid == '-1') {
  2069. row.ptsfid = ''
  2070. }
  2071. row.ptsfid = String(row.ptsfid)
  2072. // dryweight
  2073. this.table.temp.ftid = row.ftid
  2074. this.table.temp.ftname = row.ftname
  2075. this.table.temp.ptsfid = row.ptsfid
  2076. this.table.temp.ptsfname = row.ptsfname
  2077. },
  2078. updateData(row) {
  2079. if (isNaN(row.r1)) { this.$set(row, 'r1', 0) }
  2080. if (isNaN(row.r2)) { this.$set(row, 'r2', 0) }
  2081. if (isNaN(row.r3)) { this.$set(row, 'r3', 0) }
  2082. if (isNaN(row.r4)) { this.$set(row, 'r4', 0) }
  2083. if (isNaN(row.r5)) { this.$set(row, 'r5', 0) }
  2084. if (isNaN(row.r6)) { this.$set(row, 'r6', 0) }
  2085. if (isNaN(row.w1)) { this.$set(row, 'w1', 0) }
  2086. if (isNaN(row.w2)) { this.$set(row, 'w2', 0) }
  2087. if (isNaN(row.w3)) { this.$set(row, 'w3', 0) }
  2088. if (isNaN(row.w4)) { this.$set(row, 'w4', 0) }
  2089. if (isNaN(row.w5)) { this.$set(row, 'w5', 0) }
  2090. if (isNaN(row.w6)) { this.$set(row, 'w6', 0) }
  2091. if (isNaN(row.bw1)) { this.$set(row, 'bw1', 0) }
  2092. if (isNaN(row.bw2)) { this.$set(row, 'bw2', 0) }
  2093. if (isNaN(row.bw3)) { this.$set(row, 'bw3', 0) }
  2094. if (isNaN(row.bw4)) { this.$set(row, 'bw4', 0) }
  2095. if (isNaN(row.bw5)) { this.$set(row, 'bw5', 0) }
  2096. if (isNaN(row.bw6)) { this.$set(row, 'bw6', 0) }
  2097. var arr = []
  2098. for (let i = 1; i <= this.table.RWLength; i++) {
  2099. var obj = {}
  2100. obj['times'] = i
  2101. obj['pastureid'] = row.pastureid
  2102. obj['barid'] = row.barid
  2103. obj['cowcount'] = row.ccount
  2104. obj['ccountradio'] = row.ccountradio
  2105. obj['ptid'] = row.ftid
  2106. if (row.ptsfid !== '') {
  2107. obj['ptsid'] = row.ptsfid
  2108. } else {
  2109. obj['ptsid'] = '-1'
  2110. }
  2111. obj['weight'] = row['w' + i]
  2112. if(row['bw' + i] == ""){
  2113. obj['supplement'] = 0
  2114. }else{
  2115. obj['supplement'] = row['bw' + i]
  2116. }
  2117. obj['tratio'] = (parseFloat(row['r' + i])).toFixed(parseInt(Cookies.get('decimalr')))
  2118. obj['todaysupplement'] = row.todaysupplement
  2119. obj['todayweight'] = row.todayweight
  2120. arr.push(obj)
  2121. }
  2122. arr.forEach((item)=>{
  2123. if(isNaN(item.tratio)){
  2124. item.tratio = 0
  2125. }
  2126. })
  2127. if (this.table.isPtsfname == 0) {
  2128. row.ptsfid = '-1'
  2129. row.ptsfname = ''
  2130. } else {
  2131. if (row.ptsfid == '') {
  2132. row.ptsfid = '-1'
  2133. row.ptsfname = ''
  2134. }
  2135. }
  2136. if (row.supplyweight == '') {
  2137. row.supplyweight = '0'
  2138. }
  2139. if (this.table.isPtsfname == false) {
  2140. row.supplyweight = '0'
  2141. }
  2142. this.$set(row, 'ratio', Math.floor(parseFloat(row.ratio) * 100) / 100)
  2143. this.$set(row, 'ccountratio', Math.floor(parseFloat(row.ccountratio) * 100) / 100)
  2144. row.ccountratio = String(row.ccountratio)
  2145. row.sumr = Math.round(row.sumr)
  2146. // for(let i=0;i<arr.length;i++){
  2147. // if(arr[i].tratio == undefined ||arr[i].tratio =='' || arr[i].tratio == null){
  2148. // arr[i].tratio = 0
  2149. // }
  2150. // }
  2151. this.table.rwList = arr
  2152. console.log('点击了编辑保存', row)
  2153. if(row.feedweight == ''){
  2154. row.feedweight = row.todayweight
  2155. }
  2156. this.table.temp.pastureid = row.pastureid
  2157. this.table.temp.id = row.id
  2158. this.table.temp.barname = row.barname
  2159. this.table.temp.barid = row.barid
  2160. this.table.temp.ccount = row.ccount
  2161. this.table.temp.ratio = row.ratio
  2162. this.table.temp.ccountratio = row.ccountratio
  2163. this.table.temp.ftid = row.ftid
  2164. this.table.temp.ftname = row.ftname
  2165. this.table.temp.ptsfid = row.ptsfid
  2166. this.table.temp.ptsfname = row.ptsfname
  2167. this.table.temp.ftweight = row.ftweight
  2168. this.table.temp.supplyweight = row.supplyweight
  2169. this.table.temp.feedweight = row.feedweight
  2170. this.table.temp.owner = row.owner
  2171. this.table.temp.sumr = row.sumr
  2172. if (row.softccount == '') {
  2173. row.softccount = 0
  2174. }
  2175. if (row.r1 == '' || isNaN(row.r1)) {
  2176. row.r1 = 0
  2177. }
  2178. if (row.r2 == '' || isNaN(row.r2)) {
  2179. row.r2 = 0
  2180. }
  2181. if (row.r3 == '' || isNaN(row.r3)) {
  2182. row.r3 = 0
  2183. }
  2184. if (row.r4 == '' || isNaN(row.r4)) {
  2185. row.r4 = 0
  2186. }
  2187. if (row.r5 == '' || isNaN(row.r5)) {
  2188. row.r5 = 0
  2189. }
  2190. if (row.r6 == '' || isNaN(row.r6)) {
  2191. row.r6 = 0
  2192. }
  2193. if (row.w1 == '' || isNaN(row.w1)) {
  2194. row.w1 = 0
  2195. }
  2196. if (row.w2 == '' || isNaN(row.w2)) {
  2197. row.w2 = 0
  2198. }
  2199. if (row.w3 == '' || isNaN(row.w3)) {
  2200. row.w3 = 0
  2201. }
  2202. if (row.w4 == '' || isNaN(row.w4)) {
  2203. row.w4 = 0
  2204. }
  2205. if (row.w5 == '' || isNaN(row.w5)) {
  2206. row.w5 = 0
  2207. }
  2208. if (row.w6 == '' || isNaN(row.w6)) {
  2209. row.w6 = 0
  2210. }
  2211. console.log(row, '===========')
  2212. this.table.temp.softccount = row.softccount
  2213. this.table.temp.r1 = Math.round(row.r1)
  2214. this.table.temp.r2 = Math.round(row.r2)
  2215. this.table.temp.r3 = Math.round(row.r3)
  2216. this.table.temp.r4 = Math.round(row.r4)
  2217. this.table.temp.r5 = Math.round(row.r5)
  2218. this.table.temp.r6 = Math.round(row.r6)
  2219. this.table.temp.w1 = row.w1
  2220. this.table.temp.w2 = row.w2
  2221. this.table.temp.w3 = row.w3
  2222. this.table.temp.w4 = row.w4
  2223. this.table.temp.w5 = row.w5
  2224. this.table.temp.w6 = row.w6
  2225. var obj = {}
  2226. obj.userId = Cookies.get('employeid')
  2227. obj.pastureid = row.pastureid
  2228. obj.id = row.id
  2229. obj.data = []
  2230. if(this.oldRowList.w1 !== row.w1){
  2231. obj.data.push({'old':this.oldRowList.w1,'new':row.w1,times:1,'ptid':row.ftid,'ptsid':row.ptsfid})
  2232. }
  2233. if(this.oldRowList.w2 !== row.w2){
  2234. obj.data.push({'old':this.oldRowList.w2,'new':row.w2,times:2,'ptid':row.ftid,'ptsid':row.ptsfid})
  2235. }
  2236. if(this.oldRowList.w3 !== row.w3){
  2237. obj.data.push({'old':this.oldRowList.w3,'new':row.w3,times:3,'ptid':row.ftid,'ptsid':row.ptsfid})
  2238. }
  2239. if(this.oldRowList.w4 !== row.w4){
  2240. obj.data.push({'old':this.oldRowList.w4,'new':row.w4,times:4,'ptid':row.ftid,'ptsid':row.ptsfid})
  2241. }
  2242. if(this.oldRowList.w5 !== row.w5){
  2243. obj.data.push({'old':this.oldRowList.w5,'new':row.w5,times:5,'ptid':row.ftid,'ptsid':row.ptsfid})
  2244. }
  2245. if(this.oldRowList.w6 !== row.w6){
  2246. obj.data.push({'old':this.oldRowList.w6,'new':row.w6,times:6,'ptid':row.ftid,'ptsid':row.ptsfid})
  2247. }
  2248. if(this.oldRowList.bw1 !== row.bw1){
  2249. obj.data.push({'old':this.oldRowList.bw1,'new':row.bw1,times:1,'ptid':row.ftid,'ptsid':row.ptsfid})
  2250. }
  2251. if(this.oldRowList.bw2 !== row.bw2){
  2252. obj.data.push({'old':this.oldRowList.bw2,'new':row.bw2,times:2,'ptid':row.ftid,'ptsid':row.ptsfid})
  2253. }
  2254. if(this.oldRowList.bw3 !== row.bw3){
  2255. obj.data.push({'old':this.oldRowList.bw3,'new':row.bw3,times:3,'ptid':row.ftid,'ptsid':row.ptsfid})
  2256. }
  2257. if(this.oldRowList.bw4 !== row.bw4){
  2258. obj.data.push({'old':this.oldRowList.bw4,'new':row.bw4,times:4,'ptid':row.ftid,'ptsid':row.ptsfid})
  2259. }
  2260. if(this.oldRowList.bw5 !== row.bw5){
  2261. obj.data.push({'old':this.oldRowList.bw5,'new':row.bw5,times:5,'ptid':row.ftid,'ptsid':row.ptsfid})
  2262. }
  2263. if(this.oldRowList.bw6 !== row.bw6){
  2264. obj.data.push({'old':this.oldRowList.bw6,'new':row.bw6,times:6,'ptid':row.ftid,'ptsid':row.ptsfid})
  2265. }
  2266. if (this.table.temp.ccount == '' && this.table.temp.ratio == '' && this.table.temp.ccountratio == '' && this.table.temp.ftid == '') {
  2267. this.$message({ type: 'error', message: '实际牛头数/系数/系数头数/配方模版不能为空', duration: 2000 })
  2268. return false
  2269. }
  2270. if (this.table.temp.ratio == '' && this.table.temp.ccountratio == '' && this.table.temp.ftid == '') {
  2271. this.$message({ type: 'error', message: '系数/系数头数/配方模版不能为空', duration: 2000 })
  2272. return false
  2273. }
  2274. if (this.table.temp.ccountratio == '' && this.table.temp.ftid == '') {
  2275. this.$message({ type: 'error', message: '系数头数/配方模版不能为空', duration: 2000 })
  2276. return false
  2277. }
  2278. console.log(this.table.temp.ccount, '实际牛头数不能为空')
  2279. if (this.table.temp.ccount === '') {
  2280. this.$message({ type: 'error', message: '实际牛头数不能为空', duration: 2000 })
  2281. return false
  2282. }
  2283. if (this.table.temp.ratio === '') {
  2284. this.$message({ type: 'error', message: '系数不能为空', duration: 2000 })
  2285. return false
  2286. }
  2287. if (this.table.temp.ccountratio === '') {
  2288. this.$message({ type: 'error', message: '系数头数不能为空', duration: 2000 })
  2289. return false
  2290. }
  2291. if (this.table.temp.ftid == '') {
  2292. this.$message({ type: 'error', message: '配方模版不能为空', duration: 2000 })
  2293. return false
  2294. }
  2295. const positiveInteger = /^[0-9]\d*$/
  2296. if (!positiveInteger.test(parseFloat(this.table.temp.ccount))) {
  2297. this.$message({
  2298. type: 'error',
  2299. message: '实际牛头数请输入正整数',
  2300. duration: 2000
  2301. })
  2302. return false
  2303. }
  2304. this.isokDisable = true
  2305. setTimeout(() => {
  2306. this.isokDisable = false
  2307. }, 1000)
  2308. let createdate = parseTime(new Date(), '{y}-{m}-{d} {h}:{i}:{s}')
  2309. // this.requestParam.parammaps = this.table.temp
  2310. this.requestParam.common = {
  2311. 'returnmap': '0'
  2312. }
  2313. this.requestParam.data = []
  2314. this.requestParam.data[0] = { 'name': 'updateBigFP', 'type': 'e', 'parammaps': {
  2315. pastureid: row.pastureid,
  2316. id: row.id,
  2317. barname: row.barname,
  2318. barid: row.barid,
  2319. softccount: row.softccount,
  2320. ccount: row.ccount,
  2321. ratio: row.ratio,
  2322. ccountratio: row.ccountratio,
  2323. ftid: row.ftid,
  2324. ftname: row.ftname,
  2325. ptsfid: row.ptsfid,
  2326. ptsfname: row.ptsfname,
  2327. ftweight: row.ftweight,
  2328. supplyweight: row.supplyweight,
  2329. feedweight: row.feedweight,
  2330. owner: row.owner,
  2331. sumr: row.sumr
  2332. }}
  2333. this.requestParam.data[1] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.table.rwList }}
  2334. this.requestParam.data[1].children = []
  2335. this.requestParam.data[1].children[0] = { 'name': 'updateBigFPDetail', 'type': 'e', 'parammaps': {
  2336. pastureid: '@insertSpotList.pastureid',
  2337. barname: row.barname,
  2338. barid: '@insertSpotList.barid',
  2339. times: '@insertSpotList.times',
  2340. tratio: '@insertSpotList.tratio',
  2341. weight: '@insertSpotList.weight',
  2342. cowcount: '@insertSpotList.cowcount',
  2343. ccountradio: row.ccountratio,
  2344. ptid: '@insertSpotList.ptid',
  2345. ptsid: '@insertSpotList.ptsid',
  2346. supplement: '@insertSpotList.supplement',
  2347. feedweight: row.feedweight,
  2348. supplyweight: row.supplyweight,
  2349. ratio: row.ratio
  2350. }}
  2351. // this.requestParam.data[2] = { 'name': 'updateLPPbyFPChange', 'type': 'e', 'parammaps': {
  2352. // pastureid: row.pastureid,
  2353. // fpid: row.id
  2354. // }}
  2355. this.requestParam.data[2] = { 'name': 'insertFeedphistory', 'type': 'e', 'parammaps': {
  2356. createdate:createdate,
  2357. pastureid:row.pastureid,
  2358. barname:row.barname,
  2359. barid:row.barid,
  2360. softccount:row.softccount,
  2361. ccount:row.ccount,
  2362. ratio:row.ratio,
  2363. ccountratio:row.ccountratio,
  2364. ftid:row.ftid,
  2365. ftname:row.ftname,
  2366. ptsfid:row.ptsfid,
  2367. ptsfname:row.ptsfname,
  2368. feedweight:row.feedweight,
  2369. ftweight:row.ftweight,
  2370. supplyweight:row.supplyweight
  2371. }}
  2372. this.requestParam.data[3] = { 'name': 'insertSpotList2', 'resultmaps': { 'list': this.table.rwList }}
  2373. this.requestParam.data[3].children = []
  2374. this.requestParam.data[3].children[0] = { 'name': 'insertFpdetailhistory', 'type': 'e', 'parammaps': {
  2375. createdate:createdate,
  2376. pastureid: '@insertSpotList2.pastureid',
  2377. barname: row.barname,
  2378. barid: '@insertSpotList2.barid',
  2379. times: '@insertSpotList2.times',
  2380. tratio: '@insertSpotList2.tratio',
  2381. weight: '@insertSpotList2.weight',
  2382. cowcount: '@insertSpotList2.cowcount',
  2383. ccountradio: row.ccountratio,
  2384. ptid: '@insertSpotList2.ptid',
  2385. ptsid: '@insertSpotList2.ptsid',
  2386. supplement: '@insertSpotList2.supplement',
  2387. feedweight: row.feedweight,
  2388. supplyweight: row.supplyweight,
  2389. ratio: row.ratio,
  2390. userId: Cookies.get('employeid')
  2391. }}
  2392. ExecDataByConfig(this.requestParam).then(response => {
  2393. console.log('编辑保存发送参数', this.requestParam)
  2394. if (response.msg === 'fail') {
  2395. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  2396. } else {
  2397. if(obj.data.length>0){
  2398. const url = 'authdata/fpdetail/edit'
  2399. const data = obj
  2400. postJson(url, data).then(response => {
  2401. if(response.msg !== 'fail'){
  2402. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  2403. }
  2404. })
  2405. }else{
  2406. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  2407. }
  2408. this.getList()
  2409. for (let i = 0; i < this.headerList.length; i++) {
  2410. if (this.headerList[i].target.className == 'el-icon-lock') {
  2411. this.headerList[i].target.className = 'el-icon-unlock'
  2412. this.$set(this.headerList[i].target, 'className', 'el-icon-unlock')
  2413. }
  2414. }
  2415. }
  2416. })
  2417. },
  2418. updateCancel(row) {
  2419. console.log('点击了编辑取消')
  2420. // 编辑false,不可编辑true
  2421. row.Edit = false
  2422. row.NoEdit = true
  2423. // 编辑true,编辑保存false
  2424. row.isUpdate = true
  2425. row.isUpdateSave = false
  2426. // this.reload()
  2427. for (let i = 0; i < this.headerList.length; i++) {
  2428. if (this.headerList[i].target.className == 'el-icon-lock') {
  2429. this.headerList[i].target.className = 'el-icon-unlock'
  2430. this.$set(this.headerList[i].target, 'className', 'el-icon-unlock')
  2431. }
  2432. }
  2433. console.log(this.table.getdataListParm.offset)
  2434. this.table.getdataListParm.offset = this.table.getdataListParm.offset
  2435. this.getList()
  2436. // this.$router.push('/formulationPlan/dhedFormula')
  2437. },
  2438. handleSelect(val) {
  2439. console.log('勾选数据', val)
  2440. this.selectList = val
  2441. },
  2442. // 营养评估
  2443. handleNutritional() {
  2444. console.log('点击了营养评估')
  2445. this.dialogFull = false
  2446. if (this.selectList.length !== 1) {
  2447. this.$message({ type: 'error', message: '请选择一条栏舍信息进行营养评估', duration: 2000 })
  2448. return false
  2449. } else {
  2450. console.log(this.nutritional.temp)
  2451. this.nutritional.dialogStatus = 'Nutritional'
  2452. this.nutritional.activeName = 'first'
  2453. this.nutritional.dialogFormVisible = true
  2454. this.nutritional.tab1.getdataListParm1.parammaps.pastureid = this.selectList[0].pastureid
  2455. this.nutritional.tab1.getdataListParm1.parammaps.barid = this.selectList[0].barid
  2456. this.getNutritionalList()
  2457. this.nutritional.tab1.list = []
  2458. }
  2459. },
  2460. tableRowClassName({ row }) {
  2461. // console.log(row)
  2462. if (row.isColor == '0') {
  2463. return 'red-row'
  2464. } else {
  2465. return ''
  2466. }
  2467. },
  2468. handleNutritionalTab(item) {
  2469. if (item == 'first ') {
  2470. this.nutritional.tab1.getdataListParm1.parammaps.pastureid = this.selectList[0].pastureid
  2471. this.nutritional.tab1.getdataListParm1.parammaps.barid = this.selectList[0].barid
  2472. this.getNutritionalList()
  2473. this.nutritional.tab1.list = []
  2474. } else {
  2475. console.log('牛群评估')
  2476. this.nutritional.tab2.getdataListParm1.parammaps.pastureid = this.selectList[0].pastureid
  2477. this.nutritional.tab2.getdataListParm1.parammaps.barid = this.selectList[0].barid
  2478. this.nutritional.tab2.getdataListParm1.parammaps.startTime = parseTime(this.nutritional.tab2.inputDatetime[0], '{y}-{m}-{d}')
  2479. this.nutritional.tab2.getdataListParm1.parammaps.stopTime = parseTime(this.nutritional.tab2.inputDatetime[1], '{y}-{m}-{d}')
  2480. this.nutritional.tab2.getdataListParm2.parammaps.pastureid = this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  2481. this.nutritional.tab2.getdataListParm2.parammaps.barid = this.nutritional.tab2.getdataListParm1.parammaps.barid
  2482. this.nutritional.tab2.getdataListParm2.parammaps.startTime = this.nutritional.tab2.getdataListParm1.parammaps.startTime
  2483. this.nutritional.tab2.getdataListParm2.parammaps.stopTime = this.nutritional.tab2.getdataListParm1.parammaps.stopTime
  2484. this.nutritional.tab2.getdataListParm3.parammaps.pastureid = this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  2485. this.nutritional.tab2.getdataListParm3.parammaps.barid = this.nutritional.tab2.getdataListParm1.parammaps.barid
  2486. this.nutritional.tab2.getdataListParm3.parammaps.startTime = this.nutritional.tab2.getdataListParm1.parammaps.startTime
  2487. this.nutritional.tab2.getdataListParm3.parammaps.stopTime = this.nutritional.tab2.getdataListParm1.parammaps.stopTime
  2488. this.nutritional.tab2.getdataListParm4.parammaps.pastureid = this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  2489. this.nutritional.tab2.getdataListParm4.parammaps.barid = this.nutritional.tab2.getdataListParm1.parammaps.barid
  2490. this.nutritional.tab2.getdataListParm4.parammaps.startTime = this.nutritional.tab2.getdataListParm1.parammaps.startTime
  2491. this.nutritional.tab2.getdataListParm4.parammaps.stopTime = this.nutritional.tab2.getdataListParm1.parammaps.stopTime
  2492. this.getTab2NutritionalList1()
  2493. this.getTab2NutritionalList2()
  2494. this.getTab2NutritionalList3()
  2495. this.getTab2NutritionalList4()
  2496. }
  2497. },
  2498. changeTab2Date() {
  2499. this.nutritional.tab2.getdataListParm1.parammaps.pastureid = this.selectList[0].pastureid
  2500. this.nutritional.tab2.getdataListParm1.parammaps.barid = this.selectList[0].barid
  2501. this.nutritional.tab2.getdataListParm1.parammaps.startTime = parseTime(this.nutritional.tab2.inputDatetime[0], '{y}-{m}-{d}')
  2502. this.nutritional.tab2.getdataListParm1.parammaps.stopTime = parseTime(this.nutritional.tab2.inputDatetime[1], '{y}-{m}-{d}')
  2503. this.nutritional.tab2.getdataListParm2.parammaps.pastureid = this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  2504. this.nutritional.tab2.getdataListParm2.parammaps.barid = this.nutritional.tab2.getdataListParm1.parammaps.barid
  2505. this.nutritional.tab2.getdataListParm2.parammaps.startTime = this.nutritional.tab2.getdataListParm1.parammaps.startTime
  2506. this.nutritional.tab2.getdataListParm2.parammaps.stopTime = this.nutritional.tab2.getdataListParm1.parammaps.stopTime
  2507. this.nutritional.tab2.getdataListParm3.parammaps.pastureid = this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  2508. this.nutritional.tab2.getdataListParm3.parammaps.barid = this.nutritional.tab2.getdataListParm1.parammaps.barid
  2509. this.nutritional.tab2.getdataListParm3.parammaps.startTime = this.nutritional.tab2.getdataListParm1.parammaps.startTime
  2510. this.nutritional.tab2.getdataListParm3.parammaps.stopTime = this.nutritional.tab2.getdataListParm1.parammaps.stopTime
  2511. this.nutritional.tab2.getdataListParm4.parammaps.pastureid = this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  2512. this.nutritional.tab2.getdataListParm4.parammaps.barid = this.nutritional.tab2.getdataListParm1.parammaps.barid
  2513. this.nutritional.tab2.getdataListParm4.parammaps.startTime = this.nutritional.tab2.getdataListParm1.parammaps.startTime
  2514. this.nutritional.tab2.getdataListParm4.parammaps.stopTime = this.nutritional.tab2.getdataListParm1.parammaps.stopTime
  2515. this.getTab2NutritionalList1()
  2516. this.getTab2NutritionalList2()
  2517. this.getTab2NutritionalList3()
  2518. this.getTab2NutritionalList4()
  2519. },
  2520. handleBefore() {
  2521. if (this.nutritional.activeName == 'first') {
  2522. if (this.nutritional.tab1.inputDatetime !== '' && this.nutritional.tab1.inputDatetime !== null) {
  2523. var start = new Date(this.nutritional.tab1.inputDatetime[0].setDate(this.nutritional.tab1.inputDatetime[0].getDate() - 1))
  2524. var stop = new Date(this.nutritional.tab1.inputDatetime[1].setDate(this.nutritional.tab1.inputDatetime[1].getDate() - 1))
  2525. this.nutritional.tab1.inputDatetime.length = 0
  2526. this.nutritional.tab1.inputDatetime.push(start, stop)
  2527. this.$forceUpdate()
  2528. }
  2529. } else {
  2530. var start2 = new Date(this.nutritional.tab2.inputDatetime[0].setDate(this.nutritional.tab2.inputDatetime[0].getDate() - 1))
  2531. var stop2 = new Date(this.nutritional.tab2.inputDatetime[1].setDate(this.nutritional.tab2.inputDatetime[1].getDate() - 1))
  2532. this.nutritional.tab2.inputDatetime.length = 0
  2533. this.nutritional.tab2.inputDatetime.push(start2, stop2)
  2534. this.$forceUpdate()
  2535. this.nutritional.tab2.getdataListParm1.parammaps.pastureid = this.selectList[0].pastureid
  2536. this.nutritional.tab2.getdataListParm1.parammaps.barid = this.selectList[0].barid
  2537. this.nutritional.tab2.getdataListParm1.parammaps.startTime = parseTime(this.nutritional.tab2.inputDatetime[0], '{y}-{m}-{d}')
  2538. this.nutritional.tab2.getdataListParm1.parammaps.stopTime = parseTime(this.nutritional.tab2.inputDatetime[1], '{y}-{m}-{d}')
  2539. this.nutritional.tab2.getdataListParm2.parammaps.pastureid = this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  2540. this.nutritional.tab2.getdataListParm2.parammaps.barid = this.nutritional.tab2.getdataListParm1.parammaps.barid
  2541. this.nutritional.tab2.getdataListParm2.parammaps.startTime = parseTime(this.nutritional.tab2.inputDatetime[0], '{y}-{m}-{d}')
  2542. this.nutritional.tab2.getdataListParm2.parammaps.stopTime = parseTime(this.nutritional.tab2.inputDatetime[1], '{y}-{m}-{d}')
  2543. this.nutritional.tab2.getdataListParm3.parammaps.pastureid = this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  2544. this.nutritional.tab2.getdataListParm3.parammaps.barid = this.nutritional.tab2.getdataListParm1.parammaps.barid
  2545. this.nutritional.tab2.getdataListParm3.parammaps.startTime = parseTime(this.nutritional.tab2.inputDatetime[0], '{y}-{m}-{d}')
  2546. this.nutritional.tab2.getdataListParm3.parammaps.stopTime = parseTime(this.nutritional.tab2.inputDatetime[1], '{y}-{m}-{d}')
  2547. this.nutritional.tab2.getdataListParm4.parammaps.pastureid = this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  2548. this.nutritional.tab2.getdataListParm4.parammaps.barid = this.nutritional.tab2.getdataListParm1.parammaps.barid
  2549. this.nutritional.tab2.getdataListParm4.parammaps.startTime = parseTime(this.nutritional.tab2.inputDatetime[0], '{y}-{m}-{d}')
  2550. this.nutritional.tab2.getdataListParm4.parammaps.stopTime = parseTime(this.nutritional.tab2.inputDatetime[1], '{y}-{m}-{d}')
  2551. this.getTab2NutritionalList1()
  2552. this.getTab2NutritionalList2()
  2553. this.getTab2NutritionalList3()
  2554. this.getTab2NutritionalList4()
  2555. }
  2556. },
  2557. handleNext() {
  2558. if (this.nutritional.activeName == 'first') {
  2559. if (this.nutritional.tab1.inputDatetime !== '' && this.nutritional.tab1.inputDatetime !== null) {
  2560. console.log(this.nutritional.tab1.inputDatetime)
  2561. var start3 = new Date(this.nutritional.tab1.inputDatetime[0].setDate(this.nutritional.tab1.inputDatetime[0].getDate() + 1))
  2562. var stop3 = new Date(this.nutritional.tab1.inputDatetime[1].setDate(this.nutritional.tab1.inputDatetime[1].getDate() + 1))
  2563. this.nutritional.tab1.inputDatetime.length = 0
  2564. this.nutritional.tab1.inputDatetime.push(start3, stop3)
  2565. this.$forceUpdate()
  2566. }
  2567. } else {
  2568. var start4 = new Date(this.nutritional.tab2.inputDatetime[0].setDate(this.nutritional.tab2.inputDatetime[0].getDate() + 1))
  2569. var stop4 = new Date(this.nutritional.tab2.inputDatetime[1].setDate(this.nutritional.tab2.inputDatetime[1].getDate() + 1))
  2570. this.nutritional.tab2.inputDatetime.length = 0
  2571. this.nutritional.tab2.inputDatetime.push(start4, stop4)
  2572. this.$forceUpdate()
  2573. this.nutritional.tab2.getdataListParm1.parammaps.pastureid = this.selectList[0].pastureid
  2574. this.nutritional.tab2.getdataListParm1.parammaps.barid = this.selectList[0].barid
  2575. this.nutritional.tab2.getdataListParm1.parammaps.startTime = parseTime(this.nutritional.tab2.inputDatetime[0], '{y}-{m}-{d}')
  2576. this.nutritional.tab2.getdataListParm1.parammaps.stopTime = parseTime(this.nutritional.tab2.inputDatetime[1], '{y}-{m}-{d}')
  2577. this.nutritional.tab2.getdataListParm2.parammaps.pastureid = this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  2578. this.nutritional.tab2.getdataListParm2.parammaps.barid = this.nutritional.tab2.getdataListParm1.parammaps.barid
  2579. this.nutritional.tab2.getdataListParm2.parammaps.startTime = parseTime(this.nutritional.tab2.inputDatetime[0], '{y}-{m}-{d}')
  2580. this.nutritional.tab2.getdataListParm2.parammaps.stopTime = parseTime(this.nutritional.tab2.inputDatetime[1], '{y}-{m}-{d}')
  2581. this.nutritional.tab2.getdataListParm3.parammaps.pastureid = this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  2582. this.nutritional.tab2.getdataListParm3.parammaps.barid = this.nutritional.tab2.getdataListParm1.parammaps.barid
  2583. this.nutritional.tab2.getdataListParm3.parammaps.startTime = parseTime(this.nutritional.tab2.inputDatetime[0], '{y}-{m}-{d}')
  2584. this.nutritional.tab2.getdataListParm3.parammaps.stopTime = parseTime(this.nutritional.tab2.inputDatetime[1], '{y}-{m}-{d}')
  2585. this.nutritional.tab2.getdataListParm4.parammaps.pastureid = this.nutritional.tab2.getdataListParm1.parammaps.pastureid
  2586. this.nutritional.tab2.getdataListParm4.parammaps.barid = this.nutritional.tab2.getdataListParm1.parammaps.barid
  2587. this.nutritional.tab2.getdataListParm4.parammaps.startTime = parseTime(this.nutritional.tab2.inputDatetime[0], '{y}-{m}-{d}')
  2588. this.nutritional.tab2.getdataListParm4.parammaps.stopTime = parseTime(this.nutritional.tab2.inputDatetime[1], '{y}-{m}-{d}')
  2589. this.getTab2NutritionalList1()
  2590. this.getTab2NutritionalList2()
  2591. this.getTab2NutritionalList3()
  2592. this.getTab2NutritionalList4()
  2593. }
  2594. },
  2595. getNutritionalList() {
  2596. this.nutritional.tab1.listLoading1 = true
  2597. GetDataByName(this.nutritional.tab1.getdataListParm1).then(response => {
  2598. console.log('评估上方数据', response.data.list)
  2599. if (response.data.list !== null) {
  2600. response.data.list[0].cowclassid = String(response.data.list[0].cowclassid)
  2601. this.nutritional.tab1.temp = response.data.list[0]
  2602. this.nutritional.tab1.disabledCowclass = true
  2603. this.nutritional.tab1.getdataListParm2.parammaps.name = 'judgenurFT'
  2604. this.nutritional.tab1.getdataListParm2.parammaps.name1 = 'judgenurBarHSL'
  2605. this.nutritional.tab1.getdataListParm2.parammaps.startTime = parseTime(this.nutritional.tab1.inputDatetime[0], '{y}-{m}-{d}')
  2606. this.nutritional.tab1.getdataListParm2.parammaps.stopTime = parseTime(this.nutritional.tab1.inputDatetime[1], '{y}-{m}-{d}')
  2607. this.nutritional.tab1.getdataListParm2.parammaps.bw = parseFloat(this.nutritional.tab1.temp.bw)
  2608. this.nutritional.tab1.getdataListParm2.parammaps.dayw = parseFloat(this.nutritional.tab1.temp.dayw)
  2609. this.nutritional.tab1.getdataListParm2.parammaps.fetal = parseFloat(this.nutritional.tab1.temp.fetal)
  2610. this.nutritional.tab1.getdataListParm2.parammaps.avgdim = parseFloat(this.nutritional.tab1.temp.avgdim)
  2611. this.nutritional.tab1.getdataListParm2.parammaps.dayspre = parseFloat(this.nutritional.tab1.temp.dayspre)
  2612. this.nutritional.tab1.getdataListParm2.parammaps.product = parseFloat(this.nutritional.tab1.temp.product)
  2613. this.nutritional.tab1.getdataListParm2.parammaps.fat = parseFloat(this.nutritional.tab1.temp.fat)
  2614. this.nutritional.tab1.getdataListParm2.parammaps.pro = parseFloat(this.nutritional.tab1.temp.pro)
  2615. this.nutritional.tab1.getdataListParm2.parammaps.lactose = parseFloat(this.nutritional.tab1.temp.lactose)
  2616. this.nutritional.tab1.getdataListParm2.parammaps.source = parseFloat(this.nutritional.tab1.temp.source)
  2617. this.nutritional.tab1.getdataListParm2.parammaps.tem = parseFloat(this.nutritional.tab1.temp.tem)
  2618. this.nutritional.tab1.getdataListParm2.parammaps.cowsum = parseFloat(this.nutritional.tab1.temp.cowsum)
  2619. this.nutritional.tab1.getdataListParm2.parammaps.cowclass = this.nutritional.tab1.temp.cowclass
  2620. this.nutritional.tab1.getdataListParm2.parammaps.cowclassid = this.nutritional.tab1.temp.cowclassid
  2621. this.nutritional.tab1.getdataListParm2.parammaps.bigcowclass = this.nutritional.tab1.temp.bigcowclass
  2622. this.nutritional.tab1.getdataListParm2.parammaps.pastureid = this.selectList[0].pastureid
  2623. this.nutritional.tab1.getdataListParm2.parammaps.barid = this.nutritional.tab1.temp.barid
  2624. this.nutritional.tab1.getdataListParm2.parammaps.date = this.nutritional.tab1.temp.date
  2625. this.getNutritionalList2()
  2626. } else {
  2627. this.nutritional.tab1.temp = []
  2628. this.nutritional.tab1.disabledCowclass = false
  2629. }
  2630. setTimeout(() => {
  2631. this.nutritional.tab1.listLoading = false
  2632. }, 100)
  2633. })
  2634. },
  2635. assessmentData() {
  2636. console.log('评估保存')
  2637. this.$refs['temp'].validate(valid => {
  2638. if (valid) {
  2639. if (this.nutritional.tab1.inputDatetime == '' || this.nutritional.tab1.inputDatetime == null) {
  2640. this.$message({ type: 'error', message: '开始日期结束日期不能为空', duration: 2000 })
  2641. return false
  2642. } else {
  2643. // 牛头数
  2644. const positiveInteger = /^[1-9]\d*$/
  2645. if (this.nutritional.tab1.temp.cowsum !== '') {
  2646. if (!positiveInteger.test(parseFloat(this.nutritional.tab1.temp.cowsum))) {
  2647. this.$message({ type: 'error', message: '牛头数请输入正整数', duration: 2000 })
  2648. return false
  2649. }
  2650. }
  2651. const twoDecimalPlaces = /^\d+(\.\d{1,2})?$/
  2652. // 温度环境
  2653. if (this.nutritional.tab1.temp.tem !== '') {
  2654. if (!twoDecimalPlaces.test(parseFloat(this.nutritional.tab1.temp.tem))) {
  2655. this.$message({ type: 'error', message: '温度环境请保留两位小数', duration: 2000 })
  2656. return false
  2657. }
  2658. }
  2659. // 平均月龄
  2660. if (this.nutritional.tab1.temp.avgmonthage !== '') {
  2661. if (!twoDecimalPlaces.test(parseFloat(this.nutritional.tab1.temp.avgmonthage))) {
  2662. this.$message({ type: 'error', message: '平均月龄请保留两位小数', duration: 2000 })
  2663. return false
  2664. }
  2665. }
  2666. // 体重
  2667. if (this.nutritional.tab1.temp.bw !== '') {
  2668. if (!twoDecimalPlaces.test(parseFloat(this.nutritional.tab1.temp.bw))) {
  2669. this.$message({ type: 'error', message: '体重请保留两位小数', duration: 2000 })
  2670. return false
  2671. }
  2672. }
  2673. // 日增重
  2674. if (this.nutritional.tab1.temp.dayw !== '') {
  2675. if (!twoDecimalPlaces.test(parseFloat(this.nutritional.tab1.temp.dayw))) {
  2676. this.$message({ type: 'error', message: '日增重请保留两位小数', duration: 2000 })
  2677. return false
  2678. }
  2679. }
  2680. const dayspre = /^(([1-9]|([1-9]\d)|(1\d\d)|(2([0-7]\d|7[0-9]))))$/
  2681. // 怀孕天数
  2682. if (this.nutritional.tab1.temp.dayspre !== '') {
  2683. if (!dayspre.test(parseFloat(this.nutritional.tab1.temp.dayspre))) {
  2684. this.$message({ type: 'error', message: '怀孕天数请输入大于0小于280整数', duration: 2000 })
  2685. return false
  2686. }
  2687. }
  2688. const fetal = /^(?:[1-9]|1[0-9])$/
  2689. // 胎次
  2690. if (this.nutritional.tab1.temp.fetal !== '') {
  2691. if (!fetal.test(parseFloat(this.nutritional.tab1.temp.fetal))) {
  2692. this.$message({ type: 'error', message: '胎次请输入大于0小于20整数', duration: 2000 })
  2693. return false
  2694. }
  2695. }
  2696. // 平均泌乳
  2697. if (this.nutritional.tab1.temp.avgdim !== '') {
  2698. if (!positiveInteger.test(parseFloat(this.nutritional.tab1.temp.avgdim))) {
  2699. this.$message({ type: 'error', message: '平均泌乳天数请输入正整数', duration: 2000 })
  2700. return false
  2701. }
  2702. }
  2703. // 产奶量
  2704. if (this.nutritional.tab1.temp.product !== '') {
  2705. if (!twoDecimalPlaces.test(parseFloat(this.nutritional.tab1.temp.product))) {
  2706. this.$message({ type: 'error', message: '产奶量请保留两位小数', duration: 2000 })
  2707. return false
  2708. }
  2709. }
  2710. // 乳脂率
  2711. if (this.nutritional.tab1.temp.fat !== '') {
  2712. if (!twoDecimalPlaces.test(parseFloat(this.nutritional.tab1.temp.fat))) {
  2713. this.$message({ type: 'error', message: '乳脂率请保留两位小数', duration: 2000 })
  2714. return false
  2715. }
  2716. }
  2717. // 乳蛋白率
  2718. if (this.nutritional.tab1.temp.pro !== '') {
  2719. if (!twoDecimalPlaces.test(parseFloat(this.nutritional.tab1.temp.pro))) {
  2720. this.$message({ type: 'error', message: '乳蛋白率请保留两位小数', duration: 2000 })
  2721. return false
  2722. }
  2723. }
  2724. // 乳糖率
  2725. if (this.nutritional.tab1.temp.lactose !== '') {
  2726. if (!twoDecimalPlaces.test(parseFloat(this.nutritional.tab1.temp.lactose))) {
  2727. this.$message({ type: 'error', message: '乳糖率请保留两位小数', duration: 2000 })
  2728. return false
  2729. }
  2730. }
  2731. this.nutritional.tab1.getdataListParm2.parammaps.name = 'judgenurFT'
  2732. this.nutritional.tab1.getdataListParm2.parammaps.name1 = 'judgenurBarHSL'
  2733. this.nutritional.tab1.getdataListParm2.parammaps.startTime = parseTime(this.nutritional.tab1.inputDatetime[0], '{y}-{m}-{d}')
  2734. this.nutritional.tab1.getdataListParm2.parammaps.stopTime = parseTime(this.nutritional.tab1.inputDatetime[1], '{y}-{m}-{d}')
  2735. this.nutritional.tab1.getdataListParm2.parammaps.bw = parseFloat(this.nutritional.tab1.temp.bw)
  2736. this.nutritional.tab1.getdataListParm2.parammaps.dayw = parseFloat(this.nutritional.tab1.temp.dayw)
  2737. this.nutritional.tab1.getdataListParm2.parammaps.fetal = parseFloat(this.nutritional.tab1.temp.fetal)
  2738. this.nutritional.tab1.getdataListParm2.parammaps.avgdim = parseFloat(this.nutritional.tab1.temp.avgdim)
  2739. this.nutritional.tab1.getdataListParm2.parammaps.dayspre = parseFloat(this.nutritional.tab1.temp.dayspre)
  2740. this.nutritional.tab1.getdataListParm2.parammaps.product = parseFloat(this.nutritional.tab1.temp.product)
  2741. this.nutritional.tab1.getdataListParm2.parammaps.fat = parseFloat(this.nutritional.tab1.temp.fat)
  2742. this.nutritional.tab1.getdataListParm2.parammaps.pro = parseFloat(this.nutritional.tab1.temp.pro)
  2743. this.nutritional.tab1.getdataListParm2.parammaps.lactose = parseFloat(this.nutritional.tab1.temp.lactose)
  2744. this.nutritional.tab1.getdataListParm2.parammaps.source = parseFloat(this.nutritional.tab1.temp.source)
  2745. this.nutritional.tab1.getdataListParm2.parammaps.tem = parseFloat(this.nutritional.tab1.temp.tem)
  2746. this.nutritional.tab1.getdataListParm2.parammaps.cowsum = parseFloat(this.nutritional.tab1.temp.cowsum)
  2747. this.nutritional.tab1.getdataListParm2.parammaps.cowclass = this.nutritional.tab1.temp.cowclass
  2748. this.nutritional.tab1.getdataListParm2.parammaps.cowclassid = this.nutritional.tab1.temp.cowclassid
  2749. this.nutritional.tab1.getdataListParm2.parammaps.bigcowclass = this.nutritional.tab1.temp.bigcowclass
  2750. this.nutritional.tab1.getdataListParm2.parammaps.pastureid = this.selectList[0].pastureid
  2751. this.nutritional.tab1.getdataListParm2.parammaps.barid = this.nutritional.tab1.temp.barid
  2752. this.nutritional.tab1.getdataListParm2.parammaps.date = this.nutritional.tab1.temp.date
  2753. this.getNutritionalList2()
  2754. }
  2755. }
  2756. })
  2757. },
  2758. getNutritionalList2() {
  2759. this.nutritional.tab1.listLoading2 = true
  2760. const url = 'authdata/GETNurJudge'
  2761. const data = this.nutritional.tab1.getdataListParm2
  2762. postJson(url, data).then(response => {
  2763. if (response.msg !== 'fail') {
  2764. if (response.data.list !== null) {
  2765. for (let i = 0; i < response.data.length; i++) {
  2766. if (response.data[i].cowneed == null) {
  2767. response.data[i].cowneed = ''
  2768. }
  2769. var reg = RegExp(/>/)
  2770. var reg2 = RegExp(/</)
  2771. var reg3 = RegExp(/-/)
  2772. if (reg.test(response.data[i].cowneed) == true) {
  2773. const cowneed = response.data[i].cowneed.split('>')[1]
  2774. if ((parseFloat(response.data[i].ftpro) < parseFloat(cowneed)) || (parseFloat(response.data[i].hprov) < parseFloat(cowneed)) || parseFloat(response.data[i].sprov) < parseFloat(cowneed)) {
  2775. this.$set(response.data[i], 'isColor', '0')
  2776. } else {
  2777. this.$set(response.data[i], 'isColor', '')
  2778. }
  2779. } else if (reg2.test(response.data[i].cowneed) == true) {
  2780. const cowneed2 = response.data[i].cowneed.split('<')[1]
  2781. if ((parseFloat(response.data[i].ftpro) > parseFloat(cowneed2)) || (parseFloat(response.data[i].hprov) > parseFloat(cowneed2)) || parseFloat(response.data[i].sprov) > parseFloat(cowneed2)) {
  2782. this.$set(response.data[i], 'isColor', '0')
  2783. } else {
  2784. this.$set(response.data[i], 'isColor', '')
  2785. }
  2786. } else if (reg3.test(response.data[i].cowneed) == true) {
  2787. response.data[i].cowneed = String(response.data[i].cowneed)
  2788. if (response.data[i].cowneed.length == 1) {
  2789. const cowneed3 = response.data[i].cowneed.split('-')
  2790. console.log(cowneed3, 'cowneed3')
  2791. if (parseFloat(response.data[i].ftpro) > parseFloat(cowneed3[0]) && parseFloat(response.data[i].ftpro) < parseFloat(cowneed3[1])) {
  2792. this.$set(response.data[i], 'isColor', '')
  2793. } else if (parseFloat(response.data[i].hprov) > parseFloat(cowneed3[0]) && parseFloat(response.data[i].hprov) < parseFloat(cowneed3[1])) {
  2794. this.$set(response.data[i], 'isColor', '')
  2795. } else if (parseFloat(response.data[i].sprov) > parseFloat(cowneed3[0]) && parseFloat(response.data[i].sprov) < parseFloat(cowneed3[1])) {
  2796. this.$set(response.data[i], 'isColor', '')
  2797. } else if (cowneed3[0] == '' && cowneed3[0] == '') {
  2798. this.$set(response.data[i], 'isColor', '')
  2799. } else {
  2800. this.$set(response.data[i], 'isColor', '0')
  2801. }
  2802. } else {
  2803. 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)) {
  2804. this.$set(response.data[i], 'isColor', '0')
  2805. } else {
  2806. this.$set(response.data[i], 'isColor', '')
  2807. }
  2808. }
  2809. } else {
  2810. response.data[i].cowneed = String(response.data[i].cowneed)
  2811. if (response.data[i].cowneed[0] !== '-') {
  2812. 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)) {
  2813. this.$set(response.data[i], 'isColor', '0')
  2814. } else {
  2815. this.$set(response.data[i], 'isColor', '')
  2816. }
  2817. } else {
  2818. this.$set(response.data[i], 'isColor', '')
  2819. }
  2820. }
  2821. }
  2822. console.log(response.data)
  2823. console.log('评估下方数据', response.data)
  2824. this.nutritional.tab1.list = response.data
  2825. this.nutritional.tab1.total = response.data.total
  2826. } else {
  2827. this.nutritional.tab1.list = []
  2828. }
  2829. } else {
  2830. this.$notify({ title: '失败', message: response.data, type: 'warning', duration: 2000 })
  2831. }
  2832. setTimeout(() => {
  2833. this.nutritional.tab1.listLoading2 = false
  2834. }, 100)
  2835. })
  2836. },
  2837. // 牛群评估
  2838. getTab2NutritionalList1() {
  2839. this.nutritional.tab2.listLoading1 = true
  2840. GetDataByName(this.nutritional.tab2.getdataListParm1).then(response => {
  2841. console.log('宾州筛分析', response.data.list)
  2842. if (response.data.list !== null) {
  2843. this.nutritional.tab2.list1 = response.data.list
  2844. this.nutritional.tab2.pageNum1 = response.data.pageNum
  2845. this.nutritional.tab2.pageSize1 = response.data.pageSize
  2846. this.nutritional.tab2.total1 = response.data.total
  2847. } else {
  2848. this.nutritional.tab2.list1 = []
  2849. }
  2850. setTimeout(() => {
  2851. this.nutritional.tab2.listLoading1 = false
  2852. }, 100)
  2853. })
  2854. },
  2855. getTab2NutritionalList2() {
  2856. this.nutritional.tab2.listLoading2 = true
  2857. GetDataByName(this.nutritional.tab2.getdataListParm2).then(response => {
  2858. console.log('粪便筛分析', response.data.list)
  2859. if (response.data.list !== null) {
  2860. this.nutritional.tab2.list2 = response.data.list
  2861. this.nutritional.tab2.pageNum2 = response.data.pageNum
  2862. this.nutritional.tab2.pageSize2 = response.data.pageSize
  2863. this.nutritional.tab2.total2 = response.data.total
  2864. } else {
  2865. this.nutritional.tab2.list2 = []
  2866. }
  2867. setTimeout(() => {
  2868. this.nutritional.tab2.listLoading2 = false
  2869. }, 100)
  2870. })
  2871. },
  2872. getTab2NutritionalList3() {
  2873. this.nutritional.tab2.listLoading3 = true
  2874. GetDataByName(this.nutritional.tab2.getdataListParm3).then(response => {
  2875. console.log('BCS评分', response.data.list)
  2876. if (response.data.list !== null) {
  2877. for (let i = 0; i < response.data.list.length; i++) {
  2878. 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'))))
  2879. 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'))))
  2880. 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'))))
  2881. 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'))))
  2882. 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'))))
  2883. 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'))))
  2884. 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'))))
  2885. }
  2886. this.nutritional.tab2.list3 = response.data.list
  2887. this.nutritional.tab2.pageNum3 = response.data.pageNum
  2888. this.nutritional.tab2.pageSize3 = response.data.pageSize
  2889. this.nutritional.tab2.total3 = response.data.total
  2890. } else {
  2891. this.nutritional.tab2.list3 = []
  2892. }
  2893. setTimeout(() => {
  2894. this.nutritional.tab2.listLoading3 = false
  2895. }, 100)
  2896. })
  2897. },
  2898. getTab2NutritionalList4() {
  2899. this.nutritional.tab2.listLoading4 = true
  2900. GetDataByName(this.nutritional.tab2.getdataListParm4).then(response => {
  2901. console.log('粪便评分', response.data.list)
  2902. if (response.data.list !== null) {
  2903. for (let i = 0; i < response.data.list.length; i++) {
  2904. 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'))))
  2905. 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'))))
  2906. 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'))))
  2907. 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'))))
  2908. 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'))))
  2909. }
  2910. this.nutritional.tab2.list4 = response.data.list
  2911. this.nutritional.tab2.pageNum4 = response.data.pageNum
  2912. this.nutritional.tab2.pageSize4 = response.data.pageSize
  2913. this.nutritional.tab2.total4 = response.data.total
  2914. } else {
  2915. this.nutritional.tab2.list4 = []
  2916. }
  2917. setTimeout(() => {
  2918. this.nutritional.tab2.listLoading4 = false
  2919. }, 100)
  2920. })
  2921. },
  2922. // 历史记录
  2923. handleHistoryRecords() {
  2924. console.log('点击了历史记录')
  2925. this.dialogFull = false
  2926. this.history.dialogStatus = 'history'
  2927. this.history.dialogFormVisible = true
  2928. this.getDateList()
  2929. },
  2930. // 历史时间
  2931. getDateList() {
  2932. GetDataByName(this.history.getdataDateParm).then(response => {
  2933. console.log('table数据', response.data.list)
  2934. if (response.data.list !== null) {
  2935. this.history.getdataListParm.parammaps.date = response.data.list[0].maxdate
  2936. this.getHistoryIsDisplay()
  2937. } else {
  2938. this.history.getdataListParm.parammaps.date = ''
  2939. }
  2940. })
  2941. },
  2942. getHistoryIsDisplay() {
  2943. GetDataByName(this.table.getdataListParm2).then(response => {
  2944. console.log(response.data.list[0].inforvalue)
  2945. if (response.data.list !== null) {
  2946. if (response.data.list[0].inforvalue == 0) {
  2947. this.table.isPtsfname = false
  2948. } else {
  2949. this.table.isPtsfname = true
  2950. }
  2951. }
  2952. })
  2953. GetDataByName(this.table.getdataListParm3).then(response => {
  2954. if (response.data.list !== null) {
  2955. if (response.data.list[0].inforvalue == 1) {
  2956. this.history.isRW1 = true
  2957. this.history.isRW2 = false
  2958. this.history.isRW3 = false
  2959. this.history.isRW4 = false
  2960. this.history.isRW5 = false
  2961. this.history.isRW6 = false
  2962. } else if (response.data.list[0].inforvalue == 2) {
  2963. this.history.isRW1 = true
  2964. this.history.isRW2 = true
  2965. this.history.isRW3 = false
  2966. this.history.isRW4 = false
  2967. this.history.isRW5 = false
  2968. this.history.isRW6 = false
  2969. } else if (response.data.list[0].inforvalue == 3) {
  2970. this.history.isRW1 = true
  2971. this.history.isRW2 = true
  2972. this.history.isRW3 = true
  2973. this.history.isRW4 = false
  2974. this.history.isRW5 = false
  2975. this.history.isRW6 = false
  2976. } else if (response.data.list[0].inforvalue == 4) {
  2977. this.history.isRW1 = true
  2978. this.history.isRW2 = true
  2979. this.history.isRW3 = true
  2980. this.history.isRW4 = true
  2981. this.history.isRW5 = false
  2982. this.history.isRW6 = false
  2983. } else if (response.data.list[0].inforvalue == 5) {
  2984. this.history.isRW1 = true
  2985. this.history.isRW2 = true
  2986. this.history.isRW3 = true
  2987. this.history.isRW4 = true
  2988. this.history.isRW5 = true
  2989. this.history.isRW6 = false
  2990. } else if (response.data.list[0].inforvalue == 6) {
  2991. this.history.isRW1 = true
  2992. this.history.isRW2 = true
  2993. this.history.isRW3 = true
  2994. this.history.isRW4 = true
  2995. this.history.isRW5 = true
  2996. this.history.isRW6 = true
  2997. }
  2998. } else {
  2999. this.history.isRW1 = false
  3000. this.history.isRW2 = false
  3001. this.history.isRW3 = false
  3002. this.history.isRW4 = false
  3003. this.history.isRW5 = false
  3004. this.history.isRW6 = false
  3005. }
  3006. })
  3007. this.getHistoryList()
  3008. },
  3009. getHistoryList() {
  3010. this.history.listLoading = true
  3011. GetDataByName(this.history.getdataListParm).then(response => {
  3012. console.log('table数据', response.data.list)
  3013. if (response.data.list !== null) {
  3014. console.log('table数据', response.data.list)
  3015. for (let i = 0; i < response.data.list.length; i++) {
  3016. if (response.data.list[i].ptid == undefined || response.data.list[i].ptname == '') {
  3017. this.$set(response.data.list[i], 'ptid', '')
  3018. this.$set(response.data.list[i], 'ptname', '')
  3019. }
  3020. }
  3021. this.history.list = response.data.list
  3022. this.handleSpan()
  3023. this.history.pageNum = response.data.pageNum
  3024. this.history.pageSize = response.data.pageSize
  3025. this.history.total = response.data.total
  3026. } else {
  3027. this.history.list = []
  3028. }
  3029. setTimeout(() => {
  3030. this.history.listLoading = false
  3031. }, 100)
  3032. })
  3033. },
  3034. handleSpan() {
  3035. this.mergekeys.forEach(key => {
  3036. this.spanObj[key] = []
  3037. let position = 0
  3038. this.history.list.forEach((item, index) => {
  3039. if (index === 0) {
  3040. this.spanObj[key].push(1)
  3041. position = 0
  3042. } else {
  3043. if (key == 'sumweight') {
  3044. if (this.history.list[index][key] === this.history.list[index - 1][key] && this.history.list[index]['barname'] === this.history.list[index - 1]['barname']) {
  3045. this.spanObj[key][position] += 1
  3046. this.spanObj[key].push(0)
  3047. } else {
  3048. this.spanObj[key].push(1)
  3049. position = index
  3050. }
  3051. } else {
  3052. if (this.history.list[index][key] === this.history.list[index - 1][key]) {
  3053. this.spanObj[key][position] += 1
  3054. this.spanObj[key].push(0)
  3055. } else {
  3056. this.spanObj[key].push(1)
  3057. position = index
  3058. }
  3059. }
  3060. }
  3061. })
  3062. })
  3063. },
  3064. objectSpanMethod({ row, column, rowIndex, columnIndex }) {
  3065. for (let i = 0; i < this.mergekeys.length; i++) {
  3066. if (column.property === this.mergekeys[i]) {
  3067. const _row = this.spanObj[this.mergekeys[i]][rowIndex]
  3068. const _col = _row > 0 ? 1 : 0
  3069. return {
  3070. rowspan: _row,
  3071. colspan: _col
  3072. }
  3073. }
  3074. }
  3075. },
  3076. changeDate() {
  3077. this.getHistoryList()
  3078. },
  3079. // 应用
  3080. handleApplication() {
  3081. console.log('点击了应用')
  3082. MessageBox.confirm('是否确认将' + this.history.getdataListParm.parammaps.date + '的数据应用到当前?', {
  3083. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  3084. }).then(() => {
  3085. this.requestParam.name = 'applyFPdate'
  3086. this.requestParam.parammaps = {}
  3087. this.requestParam.parammaps.pastureid = Cookies.get('pastureid')
  3088. this.requestParam.parammaps.date = this.history.getdataListParm.parammaps.date
  3089. PostDataByName(this.requestParam).then(response => {
  3090. if (response.msg === 'fail') {
  3091. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  3092. } else {
  3093. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  3094. this.getHistoryIsDisplay()
  3095. this.getList()
  3096. }
  3097. })
  3098. }).catch(() => {
  3099. this.$message({ type: 'info', message: '已取消应用' })
  3100. })
  3101. },
  3102. // 导出
  3103. handleExport(item) {
  3104. if (item == 1) {
  3105. console.log('点击了导出模板')
  3106. this.download.getdataListParm.parammaps = this.table.getdataListParm.parammaps
  3107. GetDataByName(this.download.getdataListParm).then(response => {
  3108. if (response.data.list !== null) {
  3109. this.download.list = response.data.list
  3110. } else {
  3111. this.download.list = []
  3112. }
  3113. var downloadList = [
  3114. { 'obj1': '1、文件类型为xlsx类型,对应表格文件名格式为:文件名称.xlsx;' },
  3115. { 'obj1': '2、底部工作表名称不可更改,默认为:Sheet1;' },
  3116. { 'obj1': '3、栏舍名称,实际牛头数,系数(%),系数头数,配方模板,补料配方字体为必填;' },
  3117. { 'obj1': '4、第一列栏舍名称默认为系统中栏舍,不可修改;' },
  3118. { 'obj1': '5、实际牛头数为正整数,系数为正数,至多保留俩位小数;' },
  3119. { 'obj1': '6、配方模板名称必须与系统中配方计划—配方模板中的饲喂配方匹配;若补料配方开启,需与配方模板中的补料配方匹配;' },
  3120. { 'obj1': '7、数据最多可导入200条,超过200条请分多个文件导入。' }
  3121. ]
  3122. var excelDatas = [
  3123. {
  3124. tHeader: ['栏舍名称', '实际牛头数', '系数(%)', '配方模板', '补料配方', '第一班比例(%)', '第二班比例(%)', '第三班比例(%)', '第四班比例(%)','第五班比例(%)','第六班比例(%)'],
  3125. filterVal: ['barname', '', '', '', '', '', '', '', ''],
  3126. tableDatas: this.download.list,
  3127. sheetName: 'Sheet1'
  3128. }, {
  3129. tHeader: ['填写规范:'],
  3130. filterVal: ['obj1'],
  3131. tableDatas: downloadList,
  3132. sheetName: 'Sheet2'
  3133. }
  3134. ]
  3135. json2excel(excelDatas, '栏舍配方导入模板', true, 'xlsx')
  3136. })
  3137. } else {
  3138. console.log('点击了导出数据')
  3139. this.download.getdataListParm.parammaps = this.table.getdataListParm.parammaps
  3140. GetDataByName(this.download.getdataListParm).then(response => {
  3141. if (response.data.list !== null) {
  3142. for (let i = 0; i < response.data.list.length; i++) {
  3143. if (response.data.list[i].ftid !== undefined && response.data.list[i].ftid !== '') {
  3144. if (this.recipeTemplateList.find(obj => obj.id == response.data.list[i].ftid) !== undefined) {
  3145. this.$set(response.data.list[i], 'dryweight', this.recipeTemplateList.find(obj => obj.id == response.data.list[i].ftid).dryweight) // 编辑保存
  3146. } else {
  3147. this.$set(response.data.list[i], 'dryweight', '')
  3148. }
  3149. }
  3150. if (response.data.list[i].timesopt !== undefined) {
  3151. var timesoptArr = response.data.list[i].timesopt.split(',')
  3152. for (let j = 0; j < timesoptArr.length; j++) {
  3153. response.data.list[i]['r' + timesoptArr[j].split(':')[0]] = timesoptArr[j].split(':')[1]
  3154. response.data.list[i]['w' + timesoptArr[j].split(':')[0]] = timesoptArr[j].split(':')[2]
  3155. }
  3156. }
  3157. if (response.data.list[i].r1 == '' || response.data.list[i].r1 == undefined) {
  3158. response.data.list[i].r1 = 0
  3159. response.data.list[i].w1 = 0
  3160. }
  3161. if (response.data.list[i].r2 == '' || response.data.list[i].r2 == undefined) {
  3162. response.data.list[i].r2 = 0
  3163. response.data.list[i].w2 = 0
  3164. }
  3165. if (response.data.list[i].r3 == '' || response.data.list[i].r3 == undefined) {
  3166. response.data.list[i].r3 = 0
  3167. response.data.list[i].w3 = 0
  3168. }
  3169. if (response.data.list[i].r4 == '' || response.data.list[i].r4 == undefined) {
  3170. response.data.list[i].r4 = 0
  3171. response.data.list[i].w4 = 0
  3172. }
  3173. if (response.data.list[i].r5 == '' || response.data.list[i].r5 == undefined) {
  3174. response.data.list[i].r5 = 0
  3175. response.data.list[i].w5 = 0
  3176. }
  3177. if (response.data.list[i].r6 == '' || response.data.list[i].r6 == undefined) {
  3178. response.data.list[i].r6 = 0
  3179. response.data.list[i].w6 = 0
  3180. }
  3181. 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))
  3182. response.data.list[i].sumr = formatNum(response.data.list[i].sumr, parseInt(Cookies.get('decimalr')))
  3183. 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))
  3184. response.data.list[i].dailyWeight = formatNum(response.data.list[i].dailyWeight, parseInt(Cookies.get('decimal')))
  3185. }
  3186. this.download.list = response.data.list
  3187. } else {
  3188. this.download.list = []
  3189. }
  3190. 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) {
  3191. var excelDatas = [
  3192. {
  3193. tHeader: ['栏舍名称', '软件牛头数', '实际牛头数', '系数(%)', '系数头数', '配方模板', '补料配方', '第一班比例(%)', '第一班重量', '总比例', '日投喂量', '配方重量', '补料重量', '配方干物质'],
  3194. filterVal: ['barname', 'softccount', 'ccount', 'ratio', 'ccountratio', 'ftname', 'ptsfname', 'r1', 'w1', 'sumr', 'dailyWeight', 'ftweight', 'supplyweight', 'dryweight'],
  3195. tableDatas: this.download.list,
  3196. sheetName: 'Sheet1'
  3197. }
  3198. ]
  3199. } 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) {
  3200. var excelDatas = [
  3201. {
  3202. tHeader: ['栏舍名称', '软件牛头数', '实际牛头数', '系数(%)', '系数头数', '配方模板', '补料配方', '第一班比例(%)', '第一班重量', '第二班比例(%)', '第二班重量', '总比例', '日投喂量', '配方重量', '补料重量', '配方干物质'],
  3203. filterVal: ['barname', 'softccount', 'ccount', 'ratio', 'ccountratio', 'ftname', 'ptsfname', 'r1', 'w1', 'r2', 'w2', 'sumr', 'dailyWeight', 'ftweight', 'supplyweight', 'dryweight'],
  3204. tableDatas: this.download.list,
  3205. sheetName: 'Sheet1'
  3206. }
  3207. ]
  3208. } 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) {
  3209. var excelDatas = [
  3210. {
  3211. tHeader: ['栏舍名称', '软件牛头数', '实际牛头数', '系数(%)', '系数头数', '配方模板', '补料配方', '第一班比例(%)', '第一班重量', '第二班比例(%)', '第二班重量', '第三班比例(%)', '第三班重量', '总比例', '日投喂量', '配方重量', '补料重量', '配方干物质'],
  3212. filterVal: ['barname', 'softccount', 'ccount', 'ratio', 'ccountratio', 'ftname', 'ptsfname', 'r1', 'w1', 'r2', 'w2', 'r3', 'w3', 'sumr', 'dailyWeight', 'ftweight', 'supplyweight', 'dryweight'],
  3213. tableDatas: this.download.list,
  3214. sheetName: 'Sheet1'
  3215. }
  3216. ]
  3217. } 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) {
  3218. var excelDatas = [
  3219. {
  3220. tHeader: ['栏舍名称', '软件牛头数', '实际牛头数', '系数(%)', '系数头数', '配方模板', '补料配方', '第一班比例(%)', '第一班重量', '第二班比例(%)', '第二班重量', '第三班比例(%)', '第三班重量', '第四班比例(%)', '第四班重量', '总比例', '日投喂量', '配方重量', '补料重量', '配方干物质'],
  3221. filterVal: ['barname', 'softccount', 'ccount', 'ratio', 'ccountratio', 'ftname', 'ptsfname', 'r1', 'w1', 'r2', 'w2', 'r3', 'w3', 'r4', 'w4', 'sumr', 'dailyWeight', 'ftweight', 'supplyweight', 'dryweight'],
  3222. tableDatas: this.download.list,
  3223. sheetName: 'Sheet1'
  3224. }
  3225. ]
  3226. }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) {
  3227. var excelDatas = [
  3228. {
  3229. tHeader: ['栏舍名称', '软件牛头数', '实际牛头数', '系数(%)', '系数头数', '配方模板', '补料配方', '第一班比例(%)', '第一班重量', '第二班比例(%)', '第二班重量', '第三班比例(%)', '第三班重量', '第四班比例(%)', '第四班重量','第五班比例(%)', '第五班重量', '总比例', '日投喂量', '配方重量', '补料重量', '配方干物质'],
  3230. filterVal: ['barname', 'softccount', 'ccount', 'ratio', 'ccountratio', 'ftname', 'ptsfname', 'r1', 'w1', 'r2', 'w2', 'r3', 'w3', 'r4', 'w4','r5', 'w5', 'sumr', 'dailyWeight', 'ftweight', 'supplyweight', 'dryweight'],
  3231. tableDatas: this.download.list,
  3232. sheetName: 'Sheet1'
  3233. }
  3234. ]
  3235. }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) {
  3236. var excelDatas = [
  3237. {
  3238. tHeader: ['栏舍名称', '软件牛头数', '实际牛头数', '系数(%)', '系数头数', '配方模板', '补料配方', '第一班比例(%)', '第一班重量', '第二班比例(%)', '第二班重量', '第三班比例(%)', '第三班重量', '第四班比例(%)', '第四班重量','第五班比例(%)', '第五班重量','第六班比例(%)', '第六班重量', '总比例', '日投喂量', '配方重量', '补料重量', '配方干物质'],
  3239. 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'],
  3240. tableDatas: this.download.list,
  3241. sheetName: 'Sheet1'
  3242. }
  3243. ]
  3244. }
  3245. json2excel(excelDatas, '栏舍配方', true, 'xlsx')
  3246. })
  3247. }
  3248. },
  3249. beforeImport(file) {
  3250. const isLt2M = file.size / 1024 / 1024 < 2
  3251. if (!isLt2M) {
  3252. this.$message.error('上传文件大小不能超过 2MB!')
  3253. }
  3254. return isLt2M
  3255. },
  3256. handleImportSuccess(res, file) {
  3257. this.getList()
  3258. if (res.msg === 'ok') {
  3259. this.$message({ title: '成功', message: '导入成功:' + res.data.success + '条!', type: 'success', duration: 2000 })
  3260. if (res.data.err_count > 0) {
  3261. this.$notify({ title: '失败', message: '导入失败:' + res.data.err_count + '条!', type: 'danger', duration: 2000 })
  3262. import('@/vendor/Export2Excel').then(excel => {
  3263. const list1 = res.data.result
  3264. const tHeader = [
  3265. '栏舍名称', '实际牛头数', '系数(%)', '配方模板', '补料配方', '第一班比例(%)', '第二班比例(%)', '第三班比例(%)', '错误信息'
  3266. ]
  3267. const filterVal = [
  3268. '栏舍名称', '实际牛头数', '系数(%)', '配方模板', '补料配方', '第一班比例(%)', '第二班比例(%)', '第三班比例(%)', 'error_msg'
  3269. ]
  3270. const data1 = this.formatJson(filterVal, list1)
  3271. excel.export_json_to_excel({ header: tHeader, data: data1, filename: '栏舍配方导入报错信息', autoWidth: true, bookType: 'xlsx' })
  3272. })
  3273. }
  3274. } else {
  3275. this.$notify({ title: '失败', message: '上传失败', type: 'danger', duration: 2000 })
  3276. }
  3277. },
  3278. formatJson(filterVal, jsonData) {
  3279. return jsonData.map(v =>
  3280. filterVal.map(j => {
  3281. if (j === 'timestamp') {
  3282. return parseTime(v[j])
  3283. } else {
  3284. return v[j]
  3285. }
  3286. })
  3287. )
  3288. },
  3289. // 干物质调节
  3290. handleDryMatterRegulation() {
  3291. console.log('干物质调节')
  3292. this.isShowDialog = true
  3293. this.$refs.mychild.getBalconicFormula()
  3294. this.$refs.mychild.restTemp()
  3295. },
  3296. handleSynchronous(){
  3297. MessageBox.confirm('是否进行软件牛头数同步?', {
  3298. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  3299. }).then(() => {
  3300. const url = 'authdata/ud/feedp/sync'
  3301. const data = {}
  3302. postJson(url, data).then(response => {
  3303. if(response.msg !== 'fail'){
  3304. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  3305. }
  3306. })
  3307. }).catch(() => {
  3308. this.$message({ type: 'info', message: '已取消软件牛头数同步' })
  3309. })
  3310. },
  3311. handle_batchEdit(){
  3312. this.isproportion = true
  3313. console.log(this.isproportion)
  3314. this.oldList = JSON.parse(JSON.stringify(this.table.list));
  3315. // this.table.list.forEach((item,key)=>{
  3316. // item.Edit = true
  3317. // item.NoEdit = false
  3318. // })
  3319. // row.Edit
  3320. },
  3321. handle_batchEdit_save(){
  3322. const arr = this.table.list.filter(item2 => {
  3323. console.log(item2,'item2')
  3324. return !this.oldList.some(item1 => item1.r1 === item2.r1 && item1.r2 === item2.r2 && item1.r3 === item2.r3 && item1.r4 === item2.r4 && item1.r5 === item2.r5 && item1.r6 === item2.r6);
  3325. });
  3326. const barList = []
  3327. arr.forEach((item)=>{
  3328. let obj = {}
  3329. obj.barname = item.barname
  3330. obj.ccount = item.ccount
  3331. obj.ratio = item.ratio
  3332. obj.ftname = item.ftname
  3333. obj.ptsfname = item.ptsfname
  3334. obj.times1 = item.r1
  3335. obj.times2 = item.r2
  3336. obj.times3 = item.r3
  3337. obj.times4 = item.r4
  3338. obj.times5 = item.r5
  3339. obj.times6 = item.r6
  3340. barList.push(obj)
  3341. })
  3342. const url = 'authdata/fpdetail/batch/edit'
  3343. let data = {
  3344. pastureId:Cookies.get('pastureid'),
  3345. barList:barList
  3346. }
  3347. postJson(url, data).then(response => {
  3348. if(response.msg !== 'fail'){
  3349. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  3350. }else{
  3351. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  3352. }
  3353. this.isproportion = false
  3354. })
  3355. },
  3356. cancelChangeEdit() {
  3357. // 取消顺序
  3358. this.getList()
  3359. this.isproportion = false
  3360. },
  3361. }
  3362. }
  3363. </script>
  3364. <style lang="scss" scoped>
  3365. .search {
  3366. clear: both;
  3367. }
  3368. .table {
  3369. margin-top: 10px;
  3370. }
  3371. /deep/ .el-input__inner{
  3372. padding:0 5px;
  3373. }
  3374. /deep/ .el-table .cell{
  3375. padding-left: 5px;
  3376. padding-right: 5px;
  3377. }
  3378. </style>
  3379. <style lang="scss">
  3380. .red-row{
  3381. background: #fde2e2 !important;
  3382. }
  3383. </style>