index.vue 159 KB

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