index.vue 164 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491
  1. <template>
  2. <div ref="appContainer" class="app-container">
  3. <div ref="myContainer" class="myContainer">
  4. <!-- 配方模板表 -->
  5. <div ref="template" class="template">
  6. <div class="recipeTemplate">
  7. <p>配方模板表</p>
  8. </div>
  9. <div class="search">
  10. <el-select v-model="table.getdataListParm.parammaps.ccname" filterable :placeholder="$t('feedingEfficiency.cxlb')" class="filter-item" clearable>
  11. <el-option v-for="item in livestockTypeList" :key="item.value" :label="item.label" :value="item.label" />
  12. </el-select>
  13. <el-select v-model="table.getdataListParm.parammaps.fttype" filterable placeholder="配方类型" class="filter-item" style="width: 120px;" clearable>
  14. <el-option v-for="item in formulaTypeList" :key="item.value" :label="item.label" :value="item.label" />
  15. </el-select>
  16. <el-select v-model="table.getdataListParm.parammaps.source" filterable placeholder="来源" class="filter-item" style="width: 120px;" clearable>
  17. <el-option v-for="item in sourceList" :key="item.id" :label="item.name" :value="item.id" />
  18. </el-select>
  19. <el-select v-model="table.getdataListParm.parammaps.enable" filterable placeholder="是否启用" class="filter-item" style="width: 120px;" clearable>
  20. <el-option v-for="item in enableList" :key="item.id" :label="item.name" :value="item.id" />
  21. </el-select>
  22. <div ref="selectInput" class="filter-item selectInput">
  23. <el-input v-model="table.getdataListParm.parammaps.all" type="text" placeholder="请点击选择搜索条件" class="Input" />
  24. <i v-if="arrowDown" icon="el-icon-arrow-down" class="el-icon-arrow-down" />
  25. <i v-if="arrowUp" icon="el-icon-arrow-up" class="el-icon-arrow-up" />
  26. <ul v-if="arrowUp" class="selectUl">
  27. <li><a>配方名称</a><el-input v-model="table.getdataListParm.parammaps.tname" clearable style="width: 245px;" /></li>
  28. <li><a>备注</a><el-input v-model="table.getdataListParm.parammaps.remark" clearable style="width: 245px;" /></li>
  29. <li />
  30. <!-- <li><a>来源</a><el-input v-model="table.getdataListParm.parammaps.source" clearable style="width: 245px;" /></li> -->
  31. <li>
  32. <div style="float: right;">
  33. <el-button class="downminCancel" @click="arrowUp=false;arrowDown=true;">取消</el-button>
  34. <el-button class="miniPrimary" @click="form_search">搜索</el-button>
  35. </div>
  36. </li>
  37. </ul>
  38. </div>
  39. <el-button class="successBorder" @click="form_search">{{$t('common.query')}}</el-button>
  40. <el-button class="successBorder" @click="handleRefresh">{{$t('common.reset')}}</el-button>
  41. </div>
  42. <div class="operation">
  43. <el-button v-if="isRoleEdit" class="success" icon="el-icon-plus" @click="handleCreate">新增</el-button>
  44. <el-button v-if="isRoleEdit && ispalyUd" class="success" icon="el-icon-plus" @click="handleGetUd">配方上传</el-button>
  45. <el-upload style="float: right;margin-right: 15px;" :headers="headers" :data="uploadData" :action="uploadExcelUrl" :show-file-list="false" :before-upload="beforeImport" :on-success="handleImportSuccess">
  46. <el-button v-if="isRoleEdit" class="export" icon="el-icon-download" style="float: right;">导入</el-button>
  47. </el-upload>
  48. <el-dropdown style="float: right;">
  49. <el-button class="export" icon="el-icon-upload2">导出</el-button>
  50. <el-dropdown-menu slot="dropdown">
  51. <el-dropdown-item @click.native="handleExport(1)">导出模板</el-dropdown-item>
  52. <el-dropdown-item @click.native="handleExport(2)">导出数据</el-dropdown-item>
  53. </el-dropdown-menu>
  54. </el-dropdown>
  55. <el-button class="export" style="float: right;" @click="handleRecipeRecord">配方记录</el-button>
  56. </div>
  57. <div ref="table" class="table">
  58. <el-table
  59. :key="table.tableKey"
  60. v-loading="table.listLoading"
  61. element-loading-text="给我一点时间"
  62. :data="table.list"
  63. border
  64. fit
  65. highlight-current-row
  66. style="width: 98%;"
  67. :row-style="rowStyle"
  68. :cell-style="cellStyle"
  69. class="elTable table-fixed"
  70. :height="myheight"
  71. @row-click="tableRowClick"
  72. @selection-change="handleSelectionChange"
  73. >
  74. <el-table-column type="selection" align="center" width="50" />
  75. <el-table-column label="序号" align="center" type="index" width="50px" />
  76. <el-table-column :label="$t('errorAnalysis.feedName')" min-width="90px" align="center">
  77. <template slot-scope="scope">
  78. <span v-if="scope.row.NoEdit">{{ scope.row.tname }}</span>
  79. <el-input v-if="scope.row.Edit" v-model.trim="scope.row.tname" type="textarea" :autosize="{ minRows: 1.3, maxRows: 4}" maxlength="32" style="width:98%;padding:10px 0;" />
  80. </template>
  81. </el-table-column>
  82. <el-table-column label="配方编码" min-width="110px" align="center">
  83. <template slot-scope="scope">
  84. <span v-if="scope.row.NoEdit">{{ scope.row.tcode }}</span>
  85. <!-- <el-input v-if="scope.row.Edit" v-model.trim="scope.row.tcode" type="textarea" :autosize="{ minRows: 1.3, maxRows: 4}" maxlength="32" style="width:98%;padding:10px 0;" /> -->
  86. <el-input v-if="scope.row.Edit" v-model.trim="scope.row.tcode" type="textarea" :autosize="{ minRows: 1.3, maxRows: 4}" disabled maxlength="32" style="width:98%;padding:10px 0;" />
  87. </template>
  88. </el-table-column>
  89. <el-table-column label="容重(kg/m³)" min-width="110px" align="center">
  90. <template slot-scope="scope">
  91. <span v-if="scope.row.NoEdit">{{ scope.row.volume }}</span>
  92. <el-input v-if="scope.row.Edit" v-model.trim="scope.row.volume" type="number" style="width:98%;padding:10px 0;" />
  93. </template>
  94. </el-table-column>
  95. <el-table-column label="配方颜色" min-width="70px" align="center">
  96. <template slot-scope="scope">
  97. <el-color-picker v-model="scope.row.tcolor" size="mini" :predefine="predefineColors" style="vertical-align: middle;" :disabled="scope.row.NoEdit" />
  98. </template>
  99. </el-table-column>
  100. <el-table-column :label="$t('errorAnalysis.sxlb')" min-width="130px" align="center">
  101. <template slot-scope="scope">
  102. <span v-if="scope.row.NoEdit">{{ scope.row.ccname }}</span>
  103. <el-select v-if="scope.row.Edit" v-model="scope.row.ccid" filterable :placeholder="$t('feedingEfficiency.cxlb')" class="filter-item" style="width:95%;padding:10px 0;" @change="changeLivestockType">
  104. <el-option v-for="item in livestockTypeList" :key="item.value" :label="item.label" :value="item.value" />
  105. </el-select>
  106. </template>
  107. </el-table-column>
  108. <el-table-column label="配方类型" min-width="130px" align="center">
  109. <template slot-scope="scope">
  110. <span v-if="scope.row.NoEdit">{{ scope.row.fttype }}</span>
  111. <el-select v-if="scope.row.Edit && scope.row.isCreate == true" v-model="scope.row.fttypeid" filterable placeholder="配方类型" class="filter-item" style="width:95%;padding:10px 0;" @change="changeFormulaType">
  112. <el-option v-for="item in formulaTypeList" :key="item.value" :label="item.label" :value="item.value" />
  113. </el-select>
  114. <el-select v-if="scope.row.Edit && scope.row.isUpdateSave == true" v-model="scope.row.fttypeid" disabled filterable placeholder="配方类型" class="filter-item" style="width:95%;padding:10px 0;" @change="changeFormulaType">
  115. <el-option v-for="item in formulaTypeList" :key="item.value" :label="item.label" :value="item.value" />
  116. </el-select>
  117. </template>
  118. </el-table-column>
  119. <el-table-column label="来源" min-width="90px" align="center">
  120. <template slot-scope="scope">
  121. <span>{{ scope.row.source }}</span>
  122. </template>
  123. </el-table-column>
  124. <el-table-column label="备注" min-width="90px" align="center">
  125. <template slot-scope="scope">
  126. <span v-if="scope.row.NoEdit">{{ scope.row.remark }}</span>
  127. <el-input v-if="scope.row.Edit" v-model="scope.row.remark" type="textarea" :autosize="{ minRows: 1.3, maxRows: 4}" maxlength="255" style="width:95%;padding:10px 0;" />
  128. </template>
  129. </el-table-column>
  130. <el-table-column label="版本号" min-width="90px" align="center">
  131. <template slot-scope="scope">
  132. <span>{{ scope.row.version }}</span>
  133. </template>
  134. </el-table-column>
  135. <el-table-column label="牛群类别" min-width="130px" align="center">
  136. <template slot-scope="scope">
  137. <span v-if="scope.row.NoEdit">{{ scope.row.cattleName }}</span>
  138. <el-select v-if="scope.row.Edit" v-model="scope.row.cattle" filterable placeholder="牛群类别" class="filter-item" style="width:95%;padding:10px 0;">
  139. <el-option v-for="item in distCattle" :key="item.value" :label="item.distName" :value="item.distCode" />
  140. </el-select>
  141. </template>
  142. </el-table-column>
  143. <el-table-column label="是否启用" min-width="90px" align="center">
  144. <template slot-scope="scope">
  145. <el-switch v-model="scope.row.enable" :disabled="scope.row.NoEdit==true" active-color="#13ce66" inactive-color="#ff4949" :active-value="1" :inactive-value="0" @change="handleEnableChange(scope.$index, scope.row)" />
  146. </template>
  147. </el-table-column>
  148. <el-table-column label="跳转重量域(kg)" min-width="85px" align="center">
  149. <template slot-scope="scope">
  150. <span v-if="scope.row.NoEdit">{{ scope.row.autozone }}</span>
  151. <el-input v-if="scope.row.Edit" v-model="scope.row.autozone" type="textarea" :disabled="scope.row.fttype !=='预混配方'" :autosize="{ minRows: 1.3, maxRows: 4}" style="width:95%;padding:10px 0;" />
  152. </template>
  153. </el-table-column>
  154. <el-table-column :label="$t('errorAnalysis.cz')" align="center" width="150" class-name="small-padding fixed-width" fixed="right">
  155. <template slot-scope="{row}">
  156. <el-button v-if="row.NoEdit && isRoleEdit && ispastureuse==0" icon="el-icon-tickets" class="miniSuccess" @click="handleRowRecipeRecord(row)" />
  157. <span v-if="row.NoEdit && isRoleEdit && ispastureuse ==0" icon="el-icon-data-line" class="centerSpan">|</span>
  158. <el-button v-if="row.isCreate && isRoleEdit" :disabled="isokDisable" icon="el-icon-folder-checked" class="miniSuccess" @click="createData(row)" />
  159. <span v-if="row.isCreate && isRoleEdit" class="centerSpan">|</span>
  160. <el-button v-if="row.isCreate && isRoleEdit" class="minCancel" icon="el-icon-close" @click="createCancel(row)" />
  161. <el-button v-if="row.isUpdate && isRoleEdit" :disabled="row.is_modify !== 1" class="miniSuccess" icon="el-icon-edit-outline" @click="handleUpdate(row)" />
  162. <span v-if="row.isUpdate && isRoleEdit" class="centerSpan">|</span>
  163. <el-button v-if="row.isUpdate && isRoleEdit" class="miniDanger" icon="el-icon-delete" @click="handleRowDelete(row)" />
  164. <el-button v-if="row.isUpdateSave && isRoleEdit" :disabled="isokDisable" icon="el-icon-folder-checked" class="miniSuccess" @click="updateData(row)" />
  165. <span v-if="row.isUpdateSave && isRoleEdit" class="centerSpan">|</span>
  166. <el-button v-if="row.isUpdateSave && isRoleEdit" class="minCancel" icon="el-icon-close" @click="updateCancel(row)" />
  167. <span v-if="row.NoEdit && isRoleEdit && ispastureuse ==0" icon="el-icon-data-line" class="centerSpan">|</span>
  168. <el-button v-if="row.NoEdit && isRoleEdit && ispastureuse==0" icon="el-icon-data-line" class="miniSuccess" @click="handleFormulationEvaluation(row)" />
  169. </template>
  170. </el-table-column>
  171. </el-table>
  172. </div>
  173. <span v-if="table.listLoading == false" style="margin-right: 30px;margin-top: 10px;margin-bottom: 10px;font-size: 14px;">{{$t('processAnalysis.total')}}{{ table.total }}{{$t('processAnalysis.tiao')}}</span>
  174. </div>
  175. <!-- 配方详情表 -->
  176. <div v-if="isDetail" ref="detail" class="detail">
  177. <div class="recipeTemplate">
  178. <p>配方详情表</p>
  179. </div>
  180. <div style="line-height: 25px;border-bottom: 1px solid #000;margin-bottom: 10px;font-size:16px; font-weight: 600;">
  181. <span :style="{color: table2.getdataListParm.parammaps.tcolor}">配方名称:{{table2.getdataListParm.parammaps.tname }}</span><span style="margin: 0 60px;">牲畜类别:{{table2.getdataListParm.parammaps.ccname}}</span><span>配方类型:{{table2.getdataListParm.parammaps.fttype}}</span>
  182. </div>
  183. <div class="operation">
  184. <el-button v-if="isRoleEdit" style="float: left;" icon="el-icon-plus" class="success" @click="handleCreate2">新增</el-button>
  185. <el-button v-if="isRoleEdit" style="float: left;" icon="el-icon-delete" class="danger" @click="form_delete2">删除</el-button>
  186. <el-button v-if="isRoleEdit" style="float: left;" class="success" icon="el-icon-takeaway-box" @click="handleSyntheticPremix">合成预混料</el-button>
  187. <el-button v-if="isOrder && isRoleEdit" icon="el-icon-sort" style="float: left;" class="success" @click="handleChangeOrder">更改顺序</el-button>
  188. <div v-else style="float: left;margin-left: 10px;">
  189. <el-button v-if="isRoleEdit" icon="el-icon-folder-checked" class="success" @click="saveChangeOrder">保存</el-button>
  190. <el-button v-if="isRoleEdit" icon="el-icon-close" class="sortCancel" @click="cancelChangeOrder">取消</el-button>
  191. </div>
  192. <div ref="selectInput2" class="filter-item selectInput" style="margin: 0 10px;">
  193. <el-input v-model="table2.getdataListParm.parammaps.all" type="text" name="" value="" placeholder="请点击选择搜索条件" class="Input" />
  194. <i v-if="arrowDown2" icon="el-icon-arrow-down" class="el-icon-arrow-down" />
  195. <i v-if="arrowUp2" icon="el-icon-arrow-up" class="el-icon-arrow-up" />
  196. <ul v-if="arrowUp2" class="selectUl">
  197. <li>
  198. <a style="width: 130px;">饲料名称</a>
  199. <el-select v-model="table2.getdataListParm.parammaps.fname" filterable placeholder="" style="width:190px;">
  200. <el-option v-for="item in feedNameList" :key="item.id" :label="item.fname" :value="item.fname" />
  201. </el-select>
  202. </li>
  203. <li><a style="width: 130px;">饲料组名称</a><el-input v-model="table2.getdataListParm.parammaps.feedgroup" style="width: 190px;" /></li>
  204. <li><a style="width: 130px;">重量</a><el-input v-model="table2.getdataListParm.parammaps.fweight" style="width: 190px;" /></li>
  205. <li>
  206. <a style="width: 130px;">搅拌延时</a>
  207. <el-select v-model="table2.getdataListParm.parammaps.autosecondname" filterable placeholder="" style="width:190px;" clearable>
  208. <el-option v-for="item in mixingDelayList" :key="item.id" :label="item.name" :value="item.name" />
  209. </el-select>
  210. </li>
  211. <li>
  212. <a style="width: 130px;">是否锁定牛头数比例</a>
  213. <el-select v-model="table2.getdataListParm.parammaps.islockcount" placeholder="" style="width:190px;" clearable>
  214. <el-option v-for="item in lockBullsList" :key="item.id" :label="item.name" :value="item.id" />
  215. </el-select>
  216. </li>
  217. <li><a style="width: 130px;">顺序</a><el-input v-model="table2.getdataListParm.parammaps.sort" style="width: 190px;" /></li>
  218. <li>
  219. <div style="float: right;">
  220. <el-button class="downminCancel" @click="arrowUp2=false;arrowDown2=true;">取消</el-button>
  221. <el-button class="miniPrimary" @click="form_search2">搜索</el-button>
  222. </div>
  223. </li>
  224. </ul>
  225. </div>
  226. <el-button class="successBorder" @click="form_search2">{{$t('common.query')}}</el-button>
  227. <el-button class="successBorder" @click="handleRefresh2">{{$t('common.reset')}}</el-button>
  228. <el-button class="hide" @click="handleCloseTable2">隐藏</el-button>
  229. <el-button v-if="isEnlarge" class="hide2" @click="handleEnlarge">放大</el-button>
  230. <el-button v-else class="hide2" @click="handleNarrow">缩小</el-button>
  231. </div>
  232. <div v-if="isEnlarge" class="table2">
  233. <el-table
  234. id="table2"
  235. ref="table2"
  236. :key="table2.tableKey"
  237. v-loading="table2.listLoading"
  238. element-loading-text="给我一点时间"
  239. :data="table2.list"
  240. border
  241. fit
  242. highlight-current-row
  243. style="width: 98%;"
  244. :row-style="rowStyle"
  245. :cell-style="cellStyle"
  246. class="elTable"
  247. row-key="id"
  248. show-summary
  249. :max-height="220"
  250. :summary-method="getSummaries"
  251. @selection-change="handleSelectionChange2"
  252. @cell-dblclick="celldblclick"
  253. >
  254. <el-table-column type="selection" width="50" />
  255. <el-table-column label="序号" align="center" type="index" width="50px" />
  256. <el-table-column label="饲料组" min-width="120px" align="center">
  257. <template slot-scope="scope">
  258. <span v-if="scope.row.groupNoEdit">{{ scope.row.feedgroup }}</span>
  259. <el-input v-if="scope.row.groupEdit" v-model="scope.row.feedgroup" :disabled="scope.row.isGroupDisabled" type="textarea" :autosize="{ minRows: 1.3, maxRows: 4}" maxlength="32" style="width:95%;padding:10px 0;" />
  260. </template>
  261. </el-table-column>
  262. <el-table-column :label="$t('InventoryManagement.silc')" min-width="120px" align="center">
  263. <template slot-scope="scope">
  264. <span v-if="scope.row.NoEdit">{{ scope.row.fname }}</span>
  265. <el-select v-if="scope.row.Edit" v-model="scope.row.fid" filterable placeholder="" class="filter-item" style="width:95%;padding:10px 0;" @change="(value)=> {changeFname(value, scope.row)}">
  266. <el-option v-for="item in feedNameList" :key="item.id" :label="item.fname" :value="item.id" />
  267. </el-select>
  268. </template>
  269. </el-table-column>
  270. <el-table-column label="重量(KG)" prop="fweight" width="120px" align="center">
  271. <template slot-scope="scope">
  272. <span v-if="scope.row.NoEdit">{{ scope.row.fweight }}</span>
  273. <el-input v-if="scope.row.Edit" v-model="scope.row.fweight" placeholder="重量" step="0.0001" type="number" style="width:95%;padding:10px 0;" />
  274. </template>
  275. </el-table-column>
  276. <el-table-column label="搅拌延时(min)" min-width="80px" align="center">
  277. <template slot-scope="scope">
  278. <span v-if="scope.row.NoEdit">{{ scope.row.autosecond }}</span>
  279. <!-- <el-select v-if="scope.row.Edit" v-model="scope.row.autosecond" filterable placeholder="搅拌延时" class="filter-item" style="width:95%;padding:10px 0;">
  280. <el-option v-for="item in mixingDelayList" :key="item.id" :label="item.name" :value="item.id" />
  281. </el-select> -->
  282. <el-input v-if="scope.row.Edit" v-model="scope.row.autosecond" step="0.01" type="number" style="width:95%;padding:10px 0;" min-number="0" />
  283. </template>
  284. </el-table-column>
  285. <el-table-column label="允许延时偏差(min)" min-width="80px" align="center">
  286. <template slot-scope="scope">
  287. <span v-if="scope.row.NoEdit">{{ scope.row.deviation }}</span>
  288. <el-input v-if="scope.row.Edit" v-model="scope.row.deviation" step="0.01" type="number" style="width:95%;padding:10px 0;" min-number="0" />
  289. </template>
  290. </el-table-column>
  291. <el-table-column v-if="lockCount.isLockCount" label="是否锁定牛头数比例" min-width="80px" align="center">
  292. <template slot-scope="scope">
  293. <span v-if="scope.row.NoEdit && scope.row.islockcount == '0'">否</span>
  294. <span v-if="scope.row.NoEdit && scope.row.islockcount == '1'">是</span>
  295. <el-select v-if="scope.row.Edit" v-model="scope.row.islockcount" placeholder="" class="filter-item" style="width:95%;padding:10px 0;">
  296. <el-option v-for="item in lockBullsList" :key="item.id" :label="item.name" :value="item.id" />
  297. </el-select>
  298. </template>
  299. </el-table-column>
  300. <el-table-column label="加料前停机" min-width="70px" align="center">
  301. <template slot-scope="scope">
  302. <el-switch v-model="scope.row.shutdown" :disabled="scope.row.NoEdit==true" active-color="#13ce66" inactive-color="#ff4949" :active-value="1" :inactive-value="0" />
  303. </template>
  304. </el-table-column>
  305. <el-table-column label="顺序" min-width="70px" align="center">
  306. <template slot-scope="scope">
  307. <span v-if="scope.row.NoEdit">{{ scope.row.sort }}</span>
  308. <el-input v-if="scope.row.Edit" v-model="scope.row.sort" step="0.01" type="number" style="width:95%;padding:10px 0;" min-number="0" @blur="blurSort(scope.row)" />
  309. </template>
  310. </el-table-column>
  311. <el-table-column :label="$t('errorAnalysis.cz')" align="center" width="120" class-name="small-padding fixed-width" fixed="right">
  312. <template slot-scope="{row}">
  313. <el-button v-if="row.isCreate && isRoleEdit" :disabled="isokDisable" icon="el-icon-folder-checked" class="miniSuccess" @click="createData2(row)" />
  314. <span v-if="row.isCreate && isRoleEdit" class="centerSpan">|</span>
  315. <el-button v-if="row.isCreate && isRoleEdit" class="minCancel" icon="el-icon-close" @click="createCancel2(row)" />
  316. <el-button v-if="row.isUpdate && isRoleEdit" class="miniSuccess" icon="el-icon-edit-outline" @click="handleUpdate2(row)" />
  317. <span v-if="row.isUpdate && isRoleEdit" class="centerSpan">|</span>
  318. <el-button v-if="row.isUpdate && isRoleEdit" class="miniDanger" icon="el-icon-delete" @click="handleRowDelete2(row)" />
  319. <el-button v-if="row.isUpdateSave && isRoleEdit" :disabled="isokDisable" icon="el-icon-folder-checked" class="miniSuccess" @click="updateData2(row)" />
  320. <span v-if="row.isUpdateSave && isRoleEdit" class="centerSpan">|</span>
  321. <el-button v-if="row.isUpdateSave && isRoleEdit" class="minCancel" icon="el-icon-close" @click="updateCancel2(row)" />
  322. <span v-if="parseInt(row.preftid)>0 && row.isUpdateSave==false && isRoleEdit" class="centerSpan">|</span>
  323. <el-button v-if="parseInt(row.preftid)>0 && row.isUpdateSave==false && isRoleEdit" icon="el-icon-connection" class="miniSuccess" @click="handleSplitPremix(row)" />
  324. </template>
  325. </el-table-column>
  326. </el-table>
  327. </div>
  328. <div v-else class="table2">
  329. <el-table
  330. id="table2"
  331. ref="mytable2"
  332. :key="table2.tableKey"
  333. v-loading="table2.listLoading"
  334. element-loading-text="给我一点时间"
  335. :data="table2.list"
  336. border
  337. fit
  338. highlight-current-row
  339. style="width: 98%;"
  340. :row-style="rowStyle"
  341. :cell-style="cellStyle"
  342. class="elTable"
  343. row-key="id"
  344. show-summary
  345. :max-height="enlargeHeight"
  346. :summary-method="getSummaries"
  347. @selection-change="handleSelectionChange2"
  348. @cell-dblclick="celldblclick"
  349. >
  350. <el-table-column type="selection" width="50" />
  351. <el-table-column label="序号11" align="center" type="index" width="50px" />
  352. <el-table-column label="饲料组" min-width="120px" align="center">
  353. <template slot-scope="scope">
  354. <span v-if="scope.row.groupNoEdit">{{ scope.row.feedgroup }}</span>
  355. <el-input v-if="scope.row.groupEdit" v-model="scope.row.feedgroup" :disabled="scope.row.isGroupDisabled" type="textarea" :autosize="{ minRows: 1.3, maxRows: 4}" maxlength="32" style="width:95%;padding:10px 0;" />
  356. </template>
  357. </el-table-column>
  358. <el-table-column :label="$t('InventoryManagement.silc')" min-width="120px" align="center">
  359. <template slot-scope="scope">
  360. <span v-if="scope.row.NoEdit">{{ scope.row.fname }}</span>
  361. <el-select v-if="scope.row.Edit" v-model="scope.row.fid" filterable placeholder="" class="filter-item" style="width:95%;padding:10px 0;" @change="(value)=> {changeFname(value, scope.row)}">
  362. <el-option v-for="item in feedNameList" :key="item.id" :label="item.fname" :value="item.id" />
  363. </el-select>
  364. </template>
  365. </el-table-column>
  366. <el-table-column label="重量123(KG)" prop="fweight" width="120px" align="center">
  367. <template slot-scope="scope">
  368. <span v-if="scope.row.NoEdit">{{ scope.row.fweight }}</span>
  369. <el-input v-if="scope.row.Edit" v-model="scope.row.fweight" placeholder="重量" step="0.0001" type="number" style="width:95%;padding:10px 0;" />
  370. </template>
  371. </el-table-column>
  372. <el-table-column label="搅拌延时(min)" min-width="80px" align="center">
  373. <template slot-scope="scope">
  374. <span v-if="scope.row.NoEdit">{{ scope.row.autosecond }}</span>
  375. <el-select v-if="scope.row.Edit" v-model="scope.row.autosecond" filterable placeholder="搅拌延时" class="filter-item" style="width:95%;padding:10px 0;">
  376. <el-option v-for="item in mixingDelayList" :key="item.id" :label="item.name" :value="item.id" />
  377. </el-select>
  378. </template>
  379. </el-table-column>
  380. <!-- TODO: -->
  381. <el-table-column label="允许延时偏差(min)" min-width="80px" align="center">
  382. <template slot-scope="scope">
  383. <span v-if="scope.row.NoEdit">{{ scope.row.deviation }}</span>
  384. <el-input v-if="scope.row.Edit" v-model="scope.row.deviation" step="0.01" type="number" style="width:95%;padding:10px 0;" min-number="0" />
  385. </template>
  386. </el-table-column>
  387. <el-table-column label="加料前停机" min-width="70px" align="center">
  388. <template slot-scope="scope">
  389. <el-switch v-model="scope.row.shutdown" :disabled="scope.row.NoEdit==true" active-color="#13ce66" inactive-color="#ff4949" :active-value="1" :inactive-value="0" />
  390. </template>
  391. </el-table-column>
  392. <!-- -->
  393. <el-table-column v-if="lockCount.isLockCount" label="是否锁定牛头数比例" min-width="80px" align="center">
  394. <template slot-scope="scope">
  395. <span v-if="scope.row.NoEdit && scope.row.islockcount == '0'">否</span>
  396. <span v-if="scope.row.NoEdit && scope.row.islockcount == '1'">是</span>
  397. <el-select v-if="scope.row.Edit" v-model="scope.row.islockcount" placeholder="" class="filter-item" style="width:95%;padding:10px 0;">
  398. <el-option v-for="item in lockBullsList" :key="item.id" :label="item.name" :value="item.id" />
  399. </el-select>
  400. </template>
  401. </el-table-column>
  402. <el-table-column label="顺序" min-width="70px" align="center">
  403. <template slot-scope="scope">
  404. <span v-if="scope.row.NoEdit">{{ scope.row.sort }}</span>
  405. <el-input v-if="scope.row.Edit" v-model="scope.row.sort" step="0.01" type="number" style="width:95%;padding:10px 0;" min-number="0" @blur="blurSort(scope.row)" />
  406. </template>
  407. </el-table-column>
  408. <el-table-column :label="$t('errorAnalysis.cz')" align="center" width="120" class-name="small-padding fixed-width" fixed="right">
  409. <template slot-scope="{row}">
  410. <el-button v-if="row.isCreate && isRoleEdit" :disabled="isokDisable" icon="el-icon-folder-checked" class="miniSuccess" @click="createData2(row)" />
  411. <span v-if="row.isCreate && isRoleEdit" class="centerSpan">|</span>
  412. <el-button v-if="row.isCreate && isRoleEdit" class="minCancel" icon="el-icon-close" @click="createCancel2(row)" />
  413. <el-button v-if="row.isUpdate && isRoleEdit" class="miniSuccess" icon="el-icon-edit-outline" @click="handleUpdate2(row)" />
  414. <span v-if="row.isUpdate && isRoleEdit" class="centerSpan">|</span>
  415. <el-button v-if="row.isUpdate && isRoleEdit" class="miniDanger" icon="el-icon-delete" @click="handleRowDelete2(row)" />
  416. <el-button v-if="row.isUpdateSave && isRoleEdit" :disabled="isokDisable" icon="el-icon-folder-checked" class="miniSuccess" @click="updateData2(row)" />
  417. <span v-if="row.isUpdateSave && isRoleEdit" class="centerSpan">|</span>
  418. <el-button v-if="row.isUpdateSave && isRoleEdit" class="minCancel" icon="el-icon-close" @click="updateCancel2(row)" />
  419. <span v-if="parseInt(row.preftid)>0 && row.isUpdateSave==false && isRoleEdit" class="centerSpan">|</span>
  420. <el-button v-if="parseInt(row.preftid)>0 && row.isUpdateSave==false && isRoleEdit" icon="el-icon-connection" class="miniSuccess" @click="handleSplitPremix(row)" />
  421. </template>
  422. </el-table-column>
  423. </el-table>
  424. </div>
  425. </div>
  426. </div>
  427. <!-- 配方模板表 -->
  428. <el-dialog :fullscreen="dialogFull" :destroy-on-close="true" :visible.sync="template.dialogFormVisible" :close-on-click-modal="false" width="90%">
  429. <template slot="title">
  430. <div class="avue-crud__dialog__header">
  431. <span class="el-dialog__title">
  432. <span style="display:inline-block;width:3px;height:20px;margin-right:5px; float: left;margin-top:2px" />
  433. {{ textMap[template.dialogStatus] }}
  434. </span>
  435. <div class="avue-crud__dialog__menu" @click="dialogFull? dialogFull=false: dialogFull=true">
  436. <svg-icon v-if="dialogFull" icon-class="exit-fullscreen" />
  437. <svg-icon v-else icon-class="fullscreen" />
  438. </div>
  439. </div>
  440. </template>
  441. <div class="dialogMinHeight" style="overflow-y: auto;margin-bottom: 0px;overflow-x: hidden;">
  442. <div ref="templateDialog" class="templateDialog">
  443. <div class="recipeTemplate">
  444. <p>配方模板表</p>
  445. </div>
  446. <div class="operation1">
  447. <el-date-picker v-model="template.table.getdataListParm.parammaps.date" type="date" placeholder="请选择历史记录时间" :clearable="false" style="width: 180px;" format="yyyy-MM-dd" value-format="yyyy-MM-dd" @change="changeDate" />
  448. <!-- <el-button class="successBorder" @click="handleApplication">应用</el-button> -->
  449. </div>
  450. <div class="search">
  451. <el-select v-model="template.table.getdataListParm.parammaps.ccname" :placeholder="$t('feedingEfficiency.cxlb')" class="filter-item" clearable>
  452. <el-option v-for="item in livestockTypeList" :key="item.value" :label="item.label" :value="item.label" />
  453. </el-select>
  454. <el-select v-model="template.table.getdataListParm.parammaps.fttype" placeholder="配方类型" class="filter-item" style="width: 120px;" clearable>
  455. <el-option v-for="item in formulaTypeList" :key="item.value" :label="item.label" :value="item.label" />
  456. </el-select>
  457. <el-select v-model="template.table.getdataListParm.parammaps.enable" placeholder="是否启用" class="filter-item" style="margin-left:10px;width: 120px;" clearable>
  458. <el-option v-for="item in enableList" :key="item.id" :label="item.name" :value="item.id" />
  459. </el-select>
  460. <div ref="selectInput" class="filter-item selectInput">
  461. <el-input type="text" name="" value="" placeholder="请点击选择搜索条件" class="Input" />
  462. <i v-if="arrowDown" icon="el-icon-arrow-down" class="el-icon-arrow-down" />
  463. <i v-if="arrowUp" icon="el-icon-arrow-up" class="el-icon-arrow-up" />
  464. <ul v-if="arrowUp" class="selectUl">
  465. <li><a>配方名称</a><el-input v-model="template.table.getdataListParm.parammaps.tname" style="width: 245px;" /></li>
  466. <li><a>备注</a><el-input v-model="template.table.getdataListParm.parammaps.remark" style="width: 245px;" /></li>
  467. <li><a>来源</a><el-input v-model="template.table.getdataListParm.parammaps.source" style="width: 245px;" /></li>
  468. <li>
  469. <div style="float: right;">
  470. <el-button class="downminCancel" @click="arrowUp=false;arrowDown=true;">取消</el-button>
  471. <el-button class="miniPrimary" @click="handleDialogSearch">搜索</el-button>
  472. </div>
  473. </li>
  474. </ul>
  475. </div>
  476. <el-button class="successBorder" @click="handleDialogSearch" style="margin-left:10px;">{{$t('common.query')}}</el-button>
  477. <el-button class="successBorder" @click="handleDialogRefresh" style="margin-left:10px;">{{$t('common.reset')}}</el-button>
  478. </div>
  479. <div class="table">
  480. <el-table
  481. :key="template.table.tableKey"
  482. v-loading="template.table.listLoading"
  483. element-loading-text="给我一点时间"
  484. :data="template.table.list"
  485. border
  486. fit
  487. highlight-current-row
  488. style="width: 98%;"
  489. :row-style="rowStyle"
  490. :height="myheight2"
  491. :cell-style="cellStyle"
  492. class="elTable table-fixed"
  493. @row-click="tableRowClickDialog"
  494. >
  495. <el-table-column v-if="template.dialogStatus == 'RecipeRecord'" label="序号" align="center" type="index" width="50px" />
  496. <el-table-column v-else label="序号" align="center" type="index" width="50px">
  497. <template slot-scope="scope">
  498. <span>{{ scope.$index + (template.table.pageNum-1) * template.table.pageSize + 1 }}</span>
  499. </template>
  500. </el-table-column>
  501. <el-table-column :label="$t('errorAnalysis.feedName')" min-width="130px" align="center">
  502. <template slot-scope="scope">
  503. <span>{{ scope.row.tname }}</span>
  504. </template>
  505. </el-table-column>
  506. <el-table-column label="配方编码" min-width="90px" align="center">
  507. <template slot-scope="scope">
  508. <span>{{ scope.row.tcode }}</span>
  509. </template>
  510. </el-table-column>
  511. <el-table-column label="配方颜色" min-width="110px" align="center">
  512. <template slot-scope="scope">
  513. <el-color-picker v-model="scope.row.tcolor" size="mini" :predefine="predefineColors" style="vertical-align: middle;" />
  514. </template>
  515. </el-table-column>
  516. <el-table-column :label="$t('errorAnalysis.sxlb')" min-width="110px" align="center">
  517. <template slot-scope="scope">
  518. <span>{{ scope.row.ccname }}</span>
  519. </template>
  520. </el-table-column>
  521. <el-table-column label="配方类型" min-width="110px" align="center">
  522. <template slot-scope="scope">
  523. <span>{{ scope.row.fttype }}</span>
  524. </template>
  525. </el-table-column>
  526. <el-table-column label="来源" min-width="90px" align="center">
  527. <template slot-scope="scope">
  528. <span>{{ scope.row.source }}</span>
  529. </template>
  530. </el-table-column>
  531. <el-table-column label="备注" min-width="90px" align="center">
  532. <template slot-scope="scope">
  533. <span>{{ scope.row.remark }}</span>
  534. </template>
  535. </el-table-column>
  536. <el-table-column label="版本号" min-width="90px" align="center">
  537. <template slot-scope="scope">
  538. <span>{{ scope.row.version }}</span>
  539. </template>
  540. </el-table-column>
  541. <el-table-column label="版本时间" min-width="90px" align="center">
  542. <template slot-scope="scope">
  543. <span>{{ scope.row.versiontime }}</span>
  544. </template>
  545. </el-table-column>
  546. <el-table-column label="是否启用" min-width="90px" align="center">
  547. <template slot-scope="scope">
  548. <el-switch v-model="scope.row.enable" disabled active-color="#13ce66" inactive-color="#ff4949" :active-value="1" :inactive-value="0" />
  549. </template>
  550. </el-table-column>
  551. </el-table>
  552. </div>
  553. </div>
  554. <div v-if="isDetailDialog" id="detailDialog2" ref="detailDialog2" class="detailDialog" style="margin-top: 30px;height: 200px;overflow-y: auto;overflow-x: hidden;">
  555. <div class="recipeTemplate">
  556. <p>配方详情表</p>
  557. </div>
  558. <div class="operation">
  559. <div ref="selectInput2" class="filter-item selectInput">
  560. <el-input type="text" name="" value="" placeholder="请点击选择搜索条件" class="Input" />
  561. <i v-if="arrowDown2" icon="el-icon-arrow-down" class="el-icon-arrow-down" />
  562. <i v-if="arrowUp2" icon="el-icon-arrow-up" class="el-icon-arrow-up" />
  563. <ul v-if="arrowUp2" class="selectUl">
  564. <li>
  565. <a style="width: 130px;">饲料名称</a>
  566. <el-select v-model="template.table2.getdataListParm.parammaps.fname" filterable placeholder="" style="width:245px;">
  567. <el-option v-for="item in feedNameList" :key="item.id" :label="item.fname" :value="item.fname" />
  568. </el-select>
  569. </li>
  570. <li><a style="width: 130px;">饲料组名称</a><el-input v-model="template.table2.getdataListParm.parammaps.feedgroup" style="width: 245px;" /></li>
  571. <li><a style="width: 130px;">重量</a><el-input v-model="template.table2.getdataListParm.parammaps.fweight" style="width: 245px;" /></li>
  572. <li>
  573. <a style="width: 130px;">搅拌延时</a>
  574. <el-select v-model="template.table2.getdataListParm.parammaps.autosecondname" filterable placeholder="" style="width:245px;">
  575. <el-option v-for="item in mixingDelayList" :key="item.id" :label="item.name" :value="item.name" />
  576. </el-select>
  577. </li>
  578. <li>
  579. <a style="width: 130px;">是否锁定牛头数比例</a>
  580. <el-select v-model="template.table2.getdataListParm.parammaps.islockcount" placeholder="" style="width:245px;">
  581. <el-option v-for="item in lockBullsList" :key="item.id" :label="item.name" :value="item.id" />
  582. </el-select>
  583. </li>
  584. <li><a style="width: 130px;">顺序</a><el-input v-model="template.table2.getdataListParm.parammaps.sort" style="width: 245px;" /></li>
  585. <li>
  586. <div style="float: right;">
  587. <el-button class="downminCancel" @click="arrowUp2=false;arrowDown2=true;">取消</el-button>
  588. <el-button class="miniPrimary" @click="handleDialogSearch2">搜索</el-button>
  589. </div>
  590. </li>
  591. </ul>
  592. </div>
  593. <el-button class="successBorder" @click="handleDialogSearch2">{{$t('common.query')}}</el-button>
  594. <el-button class="successBorder" @click="handleDialogRefresh2">{{$t('common.reset')}}</el-button>
  595. <el-button class="hide" @click="handleDialogCloseTable2">隐藏</el-button>
  596. </div>
  597. <div class="table2">
  598. <el-table
  599. id="templateTable2"
  600. :key="template.table2.tableKey"
  601. v-loading="template.table2.listLoading"
  602. element-loading-text="给我一点时间"
  603. :data="template.table2.list"
  604. border
  605. fit
  606. highlight-current-row
  607. style="width: 98%;"
  608. :summary-method="getTemplateTable2Summaries"
  609. show-summary
  610. :row-style="rowStyle"
  611. :cell-style="cellStyle"
  612. class="elTable table-fixed"
  613. row-key="id"
  614. >
  615. <el-table-column label="饲料组" min-width="130px" align="center">
  616. <template slot-scope="scope">
  617. <span>{{ scope.row.feedgroup }}</span>
  618. </template>
  619. </el-table-column>
  620. <el-table-column :label="$t('InventoryManagement.silc')" min-width="130px" align="center">
  621. <template slot-scope="scope">
  622. <span>{{ scope.row.fname }}</span>
  623. </template>
  624. </el-table-column>
  625. <el-table-column label="重量(KG)" prop="fweight" min-width="200px" align="center">
  626. <template slot-scope="scope">
  627. <span>{{ scope.row.fweight }}</span>
  628. </template>
  629. </el-table-column>
  630. <el-table-column label="搅拌延时(min)" min-width="130px" align="center">
  631. <template slot-scope="scope">
  632. <span>{{ scope.row.autosecondname }}</span>
  633. </template>
  634. </el-table-column>
  635. <el-table-column label="是否锁定牛头数比例" min-width="130px" align="center">
  636. <template slot-scope="scope">
  637. <span v-if="scope.row.islockcount == '0'">否</span>
  638. <span v-if="scope.row.islockcount == '1'">是</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.sort }}</span>
  644. </template>
  645. </el-table-column>
  646. </el-table>
  647. </div>
  648. </div>
  649. </div>
  650. <div slot="footer" class="dialog-footer">
  651. <el-button class="cancelClose cancelClose1" @click="template.dialogFormVisible = false; ">{{$t('common.closed')}}</el-button>
  652. </div>
  653. </el-dialog>
  654. <!-- 合成预混料 -->
  655. <el-dialog :fullscreen="dialogFull" :destroy-on-close="true" :visible.sync="detail.dialogFormVisible" :close-on-click-modal="false" width="90%">
  656. <template slot="title">
  657. <div class="avue-crud__dialog__header">
  658. <span class="el-dialog__title">
  659. <span style="display:inline-block;width:3px;height:20px;margin-right:5px; float: left;margin-top:2px" />
  660. {{ textMap[detail.dialogStatus] }}
  661. </span>
  662. <div class="avue-crud__dialog__menu" @click="dialogFull? dialogFull=false: dialogFull=true">
  663. <svg-icon v-if="dialogFull" icon-class="exit-fullscreen" />
  664. <svg-icon v-else icon-class="fullscreen" />
  665. </div>
  666. </div>
  667. </template>
  668. <div class="detailDialog">
  669. <h2>饲料</h2>
  670. <div class="table1">
  671. <el-table
  672. :key="detail.tableKey"
  673. v-loading="detail.listLoading"
  674. element-loading-text="给我一点时间"
  675. :data="detail.list"
  676. fit
  677. highlight-current-row
  678. style="width: 100%;"
  679. :row-style="rowStyle"
  680. :cell-style="cellStyle"
  681. class="elTable table-fixed"
  682. show-summary
  683. >
  684. <el-table-column label="序号" align="center" type="index" width="50px" />
  685. <el-table-column :label="$t('InventoryManagement.silc')" min-width="130px" align="center">
  686. <template slot-scope="scope">
  687. <span>{{ scope.row.fname }}</span>
  688. </template>
  689. </el-table-column>
  690. <el-table-column prop="fweight" label="重量(KG)" />
  691. <el-table-column label="搅拌延时(min)" min-width="110px" align="center">
  692. <template slot-scope="scope">
  693. <span>{{ scope.row.autosecond }}</span>
  694. </template>
  695. </el-table-column>
  696. <el-table-column v-if="lockCount.isLockCount" label="是否锁定牛头数比例" min-width="130px" align="center">
  697. <template slot-scope="scope">
  698. <span v-if="scope.row.islockcount == '0'">否</span>
  699. <span v-if="scope.row.islockcount == '1'">是</span>
  700. </template>
  701. </el-table-column>
  702. <el-table-column label="顺序" min-width="110px" align="center">
  703. <template slot-scope="scope">
  704. <span>{{ scope.row.sort }}</span>
  705. </template>
  706. </el-table-column>
  707. </el-table>
  708. </div>
  709. <h2>合成预混料</h2>
  710. <div class="table2" style="margin-bottom: 50px;">
  711. <el-table
  712. :key="detail.tableKey2"
  713. v-loading="detail.listLoading2"
  714. element-loading-text="给我一点时间"
  715. :data="detail.list2"
  716. border
  717. fit
  718. highlight-current-row
  719. style="width: 100%;"
  720. :row-style="rowStyle"
  721. :cell-style="cellStyle"
  722. class="elTable table-fixed"
  723. >
  724. <el-table-column :label="$t('errorAnalysis.feedName')" min-width="130px" align="center">
  725. <template slot-scope="scope">
  726. <el-input v-model="scope.row.tname" type="textarea" :autosize="{ minRows: 1.3, maxRows: 4}" maxlength="32" style="width:95%;padding:10px 0;" :disabled="detail.disabled" />
  727. </template>
  728. </el-table-column>
  729. <el-table-column label="配方颜色" min-width="130px" align="center">
  730. <template slot-scope="scope">
  731. <el-color-picker v-model="scope.row.tcolor" size="mini" :predefine="predefineColors" style="vertical-align: middle;" :disabled="detail.disabled" />
  732. </template>
  733. </el-table-column>
  734. <el-table-column :label="$t('errorAnalysis.sxlb')" min-width="130px" align="center">
  735. <template slot-scope="scope">
  736. <el-select v-model="scope.row.ccid" placeholder="选择牲畜父类" class="filter-item" style="width:95%;padding:10px 0;" :disabled="detail.disabled" @change="changeLivestockType2">
  737. <el-option v-for="item in livestockTypeList" :key="item.value" :label="item.label" :value="item.value" />
  738. </el-select>
  739. </template>
  740. </el-table-column>
  741. <el-table-column label="配方类型" min-width="110px" align="center">
  742. <template slot-scope="scope">
  743. <span>{{ scope.row.fttype }}</span>
  744. </template>
  745. </el-table-column>
  746. <el-table-column label="来源" min-width="110px" align="center">
  747. <template slot-scope="scope">
  748. <span>{{ scope.row.source }}</span>
  749. </template>
  750. </el-table-column>
  751. <el-table-column label="容重(kg/m³)" min-width="130px" align="center">
  752. <template slot-scope="scope">
  753. <el-input v-model="scope.row.volume" style="width:95%;padding:10px 0;" :disabled="detail.disabled" />
  754. </template>
  755. </el-table-column>
  756. <el-table-column label="备注" min-width="130px" align="center">
  757. <template slot-scope="scope">
  758. <el-input v-model="scope.row.remark" type="textarea" :autosize="{ minRows: 1.3, maxRows: 4}" maxlength="32" style="width:95%;padding:10px 0;" :disabled="detail.disabled" />
  759. </template>
  760. </el-table-column>
  761. <el-table-column label="是否启用" min-width="130px" align="center">
  762. <template slot-scope="scope">
  763. <el-switch v-model="scope.row.enable" active-color="#13ce66" inactive-color="#ff4949" :active-value="1" :inactive-value="0" :disabled="detail.disabled" />
  764. </template>
  765. </el-table-column>
  766. </el-table>
  767. </div>
  768. <div slot="footer" class="dialog-footer">
  769. <el-button class="cancelClose" @click="detail.dialogFormVisible = false; ">{{$t('common.closed')}}</el-button>
  770. <el-button class="save" :disabled="isokDisable" @click="syntheticPremixData()">{{$t('errorAnalysis.confirm')}}</el-button>
  771. </div>
  772. </div>
  773. </el-dialog>
  774. <!-- 历史记录 -->
  775. <el-dialog :title="textMap[historyRecord.dialogStatus]" :destroy-on-close="true" :visible.sync="historyRecord.dialogFormVisible" :close-on-click-modal="false" width="90%">
  776. <div class="historyRecord">
  777. <keep-alive>
  778. <component :is="historyRecord.myComponent" ref="historyRecord" />
  779. </keep-alive>
  780. </div>
  781. <div slot="footer" class="dialog-footer" style="bottom: 10px;">
  782. <el-button class="cancelClose1" @click="historyRecord.dialogFormVisible = false; ">{{$t('common.closed')}}</el-button>
  783. </div>
  784. </el-dialog>
  785. <!-- 行内配方记录 -->
  786. <el-dialog :title="textMap[rowRecipeRecord.dialogStatus]" :destroy-on-close="true" :visible.sync="rowRecipeRecord.dialogFormVisible" :close-on-click-modal="false" width="90%">
  787. <div class="rowRecipeRecord">
  788. <div class="search">
  789. <el-date-picker ref="inputDatetime" v-model="rowRecipeRecord.getdataListParm.parammaps.inputDatetime" class="filter-item inputDatetime" type="daterange" style="width: 250px;top:-3px;" format="yyyy-MM-dd" value-format="yyyy-MM-dd" :range-separator="$t('common.to')" :start-placeholder="$t('common.startTime')" :end-placeholder="$t('common.endTime')" />
  790. <el-button class="successBorder" @click="handleRowRecipeRecordSearch">{{$t('common.query')}}</el-button>
  791. </div>
  792. <div class="table">
  793. <el-table
  794. :key="rowRecipeRecord.tableKey"
  795. v-loading="rowRecipeRecord.listLoading"
  796. element-loading-text="给我一点时间"
  797. :data="rowRecipeRecord.list"
  798. border
  799. highlight-current-row
  800. style="width: 100%;"
  801. :row-style="rowStyle"
  802. :cell-style="cellStyle"
  803. class="elTable table-fixed"
  804. >
  805. <el-table-column label="序号" align="center" type="index" width="50px">
  806. <template slot-scope="scope">
  807. <span>{{ scope.$index + (rowRecipeRecord.pageNum-1) * rowRecipeRecord.pageSize + 1 }}</span>
  808. </template>
  809. </el-table-column>
  810. <!-- <el-table-column label="序号" width="60px" align="center" prop="sort" /> -->
  811. <el-table-column label="修改时间" width="100px" align="center" prop="datetime1" />
  812. <el-table-column label="修改用户" width="130px" align="center" prop="empname" />
  813. <el-table-column label="饲料名称(单位:kg)" min-width="800px" align="center">
  814. <template slot-scope="scope">
  815. <div v-for="element in scope.row.arrList" :key="element.name" class="list-group-item2 item" style="width:150px;float: left;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;margin: 5px 5px;padding: 0;height: 30px;">
  816. <el-tooltip v-if="element.change== 'red'" placement="top" :open-delay="1000">
  817. <div slot="content">{{ element.name }}( {{ element.weight }} / {{ element.Eweight }} )</div>
  818. <span :style="{'color':element.change}" style="display: block;height:30px;line-height: 30px;">
  819. {{ element.name }}( {{ element.weight }} / {{ element.Eweight }} )
  820. </span>
  821. </el-tooltip>
  822. <el-tooltip v-else placement="top" :open-delay="1000">
  823. <div slot="content">{{ element.name }}( {{ element.weight }})</div>
  824. <span :style="{'color':element.change}" style="display: block;height:30px;line-height: 30px;">
  825. {{ element.name }}( {{ element.weight }})
  826. </span>
  827. </el-tooltip>
  828. </div>
  829. </template>
  830. </el-table-column>
  831. </el-table>
  832. <pagination v-show="rowRecipeRecord.total>=0" :total="rowRecipeRecord.total" :page.sync="rowRecipeRecord.getdataListParm.offset" :limit.sync="rowRecipeRecord.getdataListParm.pagecount" @pagination="getRowRecipeRecordList()" />
  833. </div>
  834. </div>
  835. <div slot="footer" class="dialog-footer" style="bottom: 10px;">
  836. <el-button class="cancelClose1" @click="rowRecipeRecord.dialogFormVisible = false; ">{{$t('common.closed')}}</el-button>
  837. </div>
  838. </el-dialog>
  839. </div>
  840. </template>
  841. <script>
  842. import { GetDataByName, GetDataByNames, PostDataByName, failproccess, checkButtons, postJson, ExecDataByConfig, formatNum } from '@/api/common'
  843. import Sortable from 'sortablejs'
  844. import { MessageBox } from 'element-ui'
  845. import Cookies from 'js-cookie'
  846. import { json2excel } from '@/utils/index.js'
  847. import axios from 'axios'
  848. import { getToken } from '@/utils/auth'
  849. import { parseTime } from '@/utils/index.js'
  850. import Pagination from '@/components/Pagination'
  851. export default {
  852. name: 'RecipeTemplate',
  853. components: { Pagination },
  854. data() {
  855. return {
  856. dialogFull: false,
  857. predefineColors: [
  858. '#E57373', '#F06292', '#BA68C8', '#9575CD', '#7986CB', '#64B5F6', '#4FC3F7', '#4DD0E1', '#4DB6AC', '#81C784', '#AED581', '#DCE775', '#FFF176', '#FFD54F', '#FFB74D', '#FF8A65', '#A1887F', '#E0E0E0', '#90A4AE'
  859. ],
  860. isRoleEdit: [],
  861. myheight: document.documentElement.clientHeight - 265,
  862. requestParams: [
  863. {"name":"getCowclassList","page":1,"offset":1,"pagecount":50,"returntype":"Map","parammaps":{"pastureid":Cookies.get('pastureid'),"classname":"","parentname":"","enable":1}},
  864. // { name: 'getDictByName', offset: 0, pagecount: 0, params: ['牲畜父类'] },
  865. { name: 'getDictByName2', offset: 0, pagecount: 0, params: ['配方类型'] },
  866. { name: 'getFeedAndPre', offset: 0, pagecount: 0, parammaps: { pastureid: Cookies.get('pastureid') }},
  867. { name: 'getDistCattle', offset: 0, pagecount: 0, parammaps: {}}
  868. ],
  869. distCattle:[],//牛群类别
  870. enableList: [{ id: '0', name: '否' }, { id: '1', name: '是' }], // 是否启用
  871. lockBullsList: [{ id: '0', name: '否' }, { id: '1', name: '是' }], // 是否锁定牛头数比例
  872. livestockTypeList: [], // 牲畜类别
  873. formulaTypeList: [], // 配方类型
  874. feedNameList: [], // 饲料名称
  875. mixingDelayList: [{ id: '0', name: '0' }, { id: '1', name: '1' }, { id: '2', name: '2' }, { id: '3', name: '3' }, { id: '4', name: '4' }, { id: '5', name: '5' }, { id: '6', name: '6' }, { id: '7', name: '7' }, { id: '8', name: '8' }, { id: '9', name: '9' }, { id: '10', name: '10' }, { id: '11', name: '11' }, { id: '12', name: '12' }, { id: '13', name: '13' }, { id: '14', name: '14' }, { id: '15', name: '15' }], // 搅拌延时
  876. selectHistoryTimeList: [{ id: 0, name: '2020-06-10' }, { id: 1, name: '2020-06-11' }, { id: 2, name: '2020-06-12' }, { id: 3, name: '2020-06-13' }], // 请选择历史记录时间
  877. arrowDown: true,
  878. arrowUp: false,
  879. ispastureuse: Cookies.get('ispastureuse'),
  880. table: {
  881. getdataListParm: {
  882. name: 'getFTList',
  883. page: 1,
  884. offset: 1,
  885. pagecount: '',
  886. returntype: 'Map',
  887. parammaps: {
  888. pastureid: Cookies.get('pastureid'),
  889. tname: '',
  890. ccid: '',
  891. ccname: '',
  892. fttypeid: '',
  893. fttype: '',
  894. remark: '',
  895. enable: '1',
  896. source: ''
  897. }
  898. },
  899. tableKey: 0,
  900. list: [],
  901. total: 0,
  902. listLoading: true,
  903. temp: {}
  904. },
  905. lockCount: {
  906. getdataListParm: {
  907. name: 'getSysoptEnable',
  908. page: 1,
  909. offset: 1,
  910. pagecount: 30,
  911. returntype: 'Map',
  912. parammaps: {
  913. pastureid: Cookies.get('pastureid'),
  914. inforname: 'isLockCount'
  915. }
  916. },
  917. isLockCount: false // 是否显示是否锁定牛头数比例
  918. },
  919. isDetail: false,
  920. arrowDown2: true,
  921. arrowUp2: false,
  922. table2: {
  923. getDryweightParm: {
  924. name: 'getFTdryweight',
  925. page: 1,
  926. offset: 1,
  927. pagecount: 10,
  928. returntype: 'Map',
  929. parammaps: {
  930. pastureid: '',
  931. ftid: ''
  932. }
  933. },
  934. dryweight: '',
  935. getdataListParm: {
  936. name: 'getFTdetailList',
  937. page: 1,
  938. offset: 1,
  939. pagecount: '',
  940. returntype: 'Map',
  941. parammaps: {
  942. pastureid: Cookies.get('pastureid'),
  943. fname: '',
  944. feedgroup: '',
  945. fweight: '',
  946. autosecondname: '',
  947. islockcount: '',
  948. sort: ''
  949. }
  950. },
  951. tableKey: 0,
  952. list: [],
  953. total: 0,
  954. listLoading: true,
  955. temp: {},
  956. updateList: {}
  957. },
  958. isDetailDialog: false,
  959. template: {
  960. dialogFormVisible: false,
  961. dialogStatus: '',
  962. table: {
  963. getdataListParm: {
  964. name: 'getFTListDate',
  965. page: 1,
  966. offset: 1,
  967. pagecount: '',
  968. returntype: 'Map',
  969. parammaps: {
  970. pastureid: Cookies.get('pastureid'),
  971. tname: '',
  972. ccid: '',
  973. ccname: '',
  974. fttype: '',
  975. remark: '',
  976. enable: '',
  977. date: '',
  978. source: ''
  979. }
  980. },
  981. tableKey: 0,
  982. total: 0,
  983. listLoading: true,
  984. list: []
  985. },
  986. table2: {
  987. getdataListParm: {
  988. name: 'getFTdetailListDate',
  989. page: 1,
  990. offset: 1,
  991. pagecount: 10,
  992. returntype: 'Map',
  993. parammaps: {
  994. pastureid: Cookies.get('pastureid'),
  995. fname: '',
  996. fweight: '',
  997. islockcount: '',
  998. sort: '',
  999. feedgroup: '',
  1000. autosecondname: ''
  1001. }
  1002. },
  1003. tableKey: 0,
  1004. total: 0,
  1005. listLoading: true,
  1006. list: []
  1007. },
  1008. // 历史日期
  1009. getdataDateParm: {
  1010. name: 'getFTMaxDate',
  1011. page: 1,
  1012. offset: 1,
  1013. pagecount: 10,
  1014. returntype: 'Map',
  1015. parammaps: {
  1016. pastureid: Cookies.get('pastureid')
  1017. }
  1018. }
  1019. },
  1020. isOrder: true,
  1021. detail: {
  1022. dialogFormVisible: false,
  1023. dialogStatus: '',
  1024. tableKey: 0,
  1025. total: 0,
  1026. listLoading: true,
  1027. list: [],
  1028. tableKey2: 0,
  1029. total2: 0,
  1030. listLoading2: false,
  1031. list2: [{ tname: '', tcolor: '#ccc', ccid: '', fttype: '预混配方', fttypeid: '2', source: '自定义', remark: '', 'enable': 1, }],
  1032. getdataListParm: {
  1033. name: 'getFTDetailCompare',
  1034. page: 1,
  1035. offset: 1,
  1036. pagecount: 10,
  1037. returntype: 'Map',
  1038. parammaps: {}
  1039. },
  1040. list3: [],
  1041. disabled: false,
  1042. getdataListParm2: {
  1043. name: 'getFTCompare',
  1044. page: 1,
  1045. offset: 1,
  1046. pagecount: 10,
  1047. returntype: 'Map',
  1048. parammaps: {}
  1049. }
  1050. },
  1051. selectList: [],
  1052. selectList2: [],
  1053. textMap: {
  1054. RecipeRecord: '配方记录',
  1055. SyntheticPremix: '合成预混料',
  1056. historyRecord: '历史记录',
  1057. detail: '饲料详情',
  1058. rowRecipeRecordTxt: '配方修改记录'
  1059. },
  1060. requestParam: {},
  1061. requestParam2: {},
  1062. requestParam3:{},
  1063. download: {
  1064. getdataListParm: {
  1065. name: 'getFTList',
  1066. page: 1,
  1067. offset: 1,
  1068. pagecount: 0,
  1069. returntype: 'Map',
  1070. parammaps: {
  1071. pastureid: Cookies.get('pastureid'),
  1072. tname: '',
  1073. ccid: '',
  1074. ccname: '',
  1075. fttypeid: '',
  1076. fttype: '',
  1077. remark: '',
  1078. enable: ''
  1079. }
  1080. },
  1081. list: []
  1082. },
  1083. historyRecord: {
  1084. dialogStatus: '',
  1085. dialogFormVisible: false
  1086. },
  1087. isokDisable: false,
  1088. rowStyle: { maxHeight: 30 + 'px', height: 30 + 'px' },
  1089. cellStyle: { padding: 0 + 'px' },
  1090. dropState: false,
  1091. myheight2: 0,
  1092. height: 0,
  1093. rowRecipeRecord: {
  1094. dialogStatus: '',
  1095. dialogFormVisible: false,
  1096. getdataListParm: {
  1097. name: 'getFitHistory1', 'name1': 'getFitHistory2', page: 1, offset: 1, pagecount: 10, returntype: 'Map',
  1098. parammaps: { inputDatetime: '', pastureid: '', fitid: '' }
  1099. },
  1100. tableKey: 0, total: 0, listLoading: true, list: []
  1101. },
  1102. isEnlarge: true,
  1103. ispalyUd: true,
  1104. // enlargeHeight: document.documentElement.clientHeight - 85 - 165 + 50,
  1105. enlargeHeight: document.documentElement.clientHeight - 85 - 165 + 50,
  1106. getTcodeParm: {
  1107. name: 'getTcode', page: 1, offset: 1, pagecount: 10, returntype: 'Map',
  1108. parammaps: { pastureid: '', fttypeid: '' }
  1109. },
  1110. sourceList: [{ id: '0', name: '自定义' }, { id: '1', name: '集团下发未调整' }, { id: '2', name: '集团下发有调整' }, { id: '3', name: '导入' }]
  1111. }
  1112. },
  1113. computed: {
  1114. // 设置请求头
  1115. headers() {
  1116. return {
  1117. token: getToken()
  1118. }
  1119. },
  1120. uploadData() {
  1121. return {
  1122. name: 'checkfttype,checkbigcowclass,checkFeed,insertFTUpload,insertFTdetailUpload',
  1123. importParams: '配方名称,牲畜类别,配方类型,备注,饲料组,饲料名称,重量(kg),搅拌延时(min),是否锁定牛头数比例',
  1124. sheetname: 'Sheet1',
  1125. // 登录牧场
  1126. pastureid: Cookies.get('pastureid'),
  1127. // 日期参数
  1128. dateParams: '',
  1129. // 必填参数
  1130. requiredParams: '配方名称,牲畜类别,配方类型,饲料名称,重量(kg),搅拌延时(min),是否锁定牛头数比例',
  1131. // 为数值的参数
  1132. numParams: '重量(kg),搅拌延时(min)'
  1133. }
  1134. },
  1135. // 设置上传地址
  1136. uploadExcelUrl() {
  1137. return Cookies.get('url') + 'authdata/ImportExcel'
  1138. }
  1139. },
  1140. mounted() {
  1141. document.addEventListener('click', (e) => {
  1142. if (this.$refs.selectInput !== undefined) {
  1143. if (!this.$refs.selectInput.contains(e.target)) {
  1144. this.arrowDown = true
  1145. this.arrowUp = false
  1146. } else {
  1147. this.arrowDown = false
  1148. this.arrowUp = true
  1149. }
  1150. }
  1151. if (this.$refs.selectInput2 !== undefined) {
  1152. if (!this.$refs.selectInput2.contains(e.target)) {
  1153. this.arrowDown2 = true
  1154. this.arrowUp2 = false
  1155. } else {
  1156. this.arrowDown2 = false
  1157. this.arrowUp2 = true
  1158. }
  1159. }
  1160. })
  1161. },
  1162. created() {
  1163. this.getIspalyUd()
  1164. this.getList()
  1165. this.getButtons()
  1166. this.getDownList()
  1167. this.getIsLockCount()
  1168. },
  1169. methods: {
  1170. getButtons() {
  1171. const Edit = 'RecipeTemplate'
  1172. const isRoleEdit = checkButtons(JSON.parse(sessionStorage.getItem('buttons')), Edit)
  1173. this.isRoleEdit = isRoleEdit
  1174. },
  1175. getSummaries(param) {
  1176. const { columns, data } = param
  1177. const sums = []
  1178. columns.forEach((column, index) => {
  1179. if (index === 0) {
  1180. sums[index] = '合计'
  1181. return
  1182. }
  1183. if (column.property !== undefined) {
  1184. // 加了prop属性的el-table-column 才能找到column.property
  1185. const values = data.map(item => Number(item[column.property]))
  1186. if (!values.every(value => isNaN(value))) {
  1187. sums[index] = values.reduce((prev, curr) => {
  1188. const value = Number(curr)
  1189. if (!isNaN(value)) {
  1190. return prev + curr // 多行相加
  1191. } else {
  1192. return prev
  1193. }
  1194. }, 0)
  1195. sums[index] = sums[index].toFixed(4) + '(干物质量:' + this.table2.dryweight + ')'
  1196. } else {
  1197. sums[index] = ''
  1198. }
  1199. }
  1200. })
  1201. // console.log(sums, 'sums[index]')
  1202. return sums
  1203. },
  1204. getDryWeight() {
  1205. GetDataByName(this.table2.getDryweightParm).then(response => {
  1206. console.log('干物质数据', response.data.list)
  1207. if (response.data.list[0].dryweight !== undefined) {
  1208. this.table2.dryweight = response.data.list[0].dryweight
  1209. } else {
  1210. this.table2.dryweight = ''
  1211. }
  1212. })
  1213. },
  1214. getTemplateTable2Summaries(param) {
  1215. const { columns, data } = param
  1216. const sums = []
  1217. columns.forEach((column, index) => {
  1218. if (index === 0) {
  1219. sums[index] = '合计'
  1220. return
  1221. }
  1222. const values = data.map(item => Number(item[column.property]))
  1223. if (!values.every(value => isNaN(value))) {
  1224. sums[index] = values.reduce((prev, curr) => {
  1225. const value = Number(curr)
  1226. if (!isNaN(value)) {
  1227. return prev + curr
  1228. } else {
  1229. return prev
  1230. }
  1231. }, 0)
  1232. // 后台待发
  1233. sums[index] += '(干物质量:' + this.template.table2.getdataListParm.parammaps.dryweight + ')'
  1234. } else {
  1235. sums[index] = ''
  1236. }
  1237. })
  1238. return sums
  1239. },
  1240. getDownList() {
  1241. GetDataByNames(this.requestParams).then(response => {
  1242. // this.livestockTypeList = response.data.getDictByName.list
  1243. this.livestockTypeList = response.data.getCowclassList.list
  1244. for(var i=0;i<this.livestockTypeList.length;i++){
  1245. this.livestockTypeList[i].label = this.livestockTypeList[i].classname;
  1246. this.livestockTypeList[i].value = this.livestockTypeList[i].id;
  1247. }
  1248. this.formulaTypeList = response.data.getDictByName2.list
  1249. this.feedNameList = response.data.getFeedAndPre.list
  1250. this.distCattle = response.data.getDistCattle.list
  1251. })
  1252. },
  1253. // -------------------模板-----------------------------
  1254. getList() {
  1255. this.table.listLoading = true
  1256. GetDataByName(this.table.getdataListParm).then(response => {
  1257. console.log('配方模板table数据', response.data.list)
  1258. if (response.data.list !== null) {
  1259. for (let i = 0; i < response.data.list.length; i++) {
  1260. this.$set(response.data.list[i], 'Edit', false) // 编辑
  1261. this.$set(response.data.list[i], 'NoEdit', true) // 不可编辑/输入
  1262. this.$set(response.data.list[i], 'isCreate', false) // 新增操作
  1263. this.$set(response.data.list[i], 'isUpdate', true) // 编辑操作
  1264. this.$set(response.data.list[i], 'isUpdateSave', false) // 编辑保存
  1265. }
  1266. this.table.list = response.data.list
  1267. this.table.pageNum = response.data.pageNum
  1268. this.table.pageSize = response.data.pageSize
  1269. this.table.total = response.data.total
  1270. } else {
  1271. this.table.list = []
  1272. this.isDetail = false
  1273. }
  1274. setTimeout(() => {
  1275. this.table.listLoading = false
  1276. }, 100)
  1277. })
  1278. },
  1279. getList3() {
  1280. this.table.listLoading = true
  1281. GetDataByName(this.table.getdataListParm).then(response => {
  1282. console.log('table数据', response.data.list)
  1283. if (response.data.list !== null) {
  1284. for (let i = 0; i < response.data.list.length; i++) {
  1285. this.$set(response.data.list[i], 'Edit', false) // 编辑
  1286. this.$set(response.data.list[i], 'NoEdit', true) // 不可编辑/输入
  1287. this.$set(response.data.list[i], 'isCreate', false) // 新增操作
  1288. this.$set(response.data.list[i], 'isUpdate', true) // 编辑操作
  1289. this.$set(response.data.list[i], 'isUpdateSave', false) // 编辑保存
  1290. }
  1291. this.table.list = response.data.list
  1292. this.table.pageNum = response.data.pageNum
  1293. this.table.pageSize = response.data.pageSize
  1294. this.table.total = response.data.total
  1295. } else {
  1296. this.table.list = []
  1297. this.isDetail = false
  1298. }
  1299. setTimeout(() => {
  1300. this.table.listLoading = false
  1301. }, 100)
  1302. })
  1303. },
  1304. form_search() {
  1305. console.log('点击了查询')
  1306. this.table.getdataListParm.offset = 1
  1307. this.getList()
  1308. this.table.getdataListParm.parammaps.all = ''
  1309. var obj = {}
  1310. obj.tname = this.table.getdataListParm.parammaps.tname
  1311. obj.remark = this.table.getdataListParm.parammaps.remark
  1312. // obj.source = this.table.getdataListParm.parammaps.source
  1313. Object.getOwnPropertyNames(obj).forEach((key) => {
  1314. console.log(key, obj[key])
  1315. if (obj[key] !== '') {
  1316. this.table.getdataListParm.parammaps.all += obj[key] + '/'
  1317. }
  1318. })
  1319. if (this.table.getdataListParm.parammaps.all.charAt(this.table.getdataListParm.parammaps.all.length - 1) == '/') {
  1320. this.table.getdataListParm.parammaps.all = this.table.getdataListParm.parammaps.all.slice(0, this.table.getdataListParm.parammaps.all.length - 1)
  1321. }
  1322. this.arrowDown = true
  1323. this.arrowUp = false
  1324. },
  1325. handleRefresh() {
  1326. console.log('点击了重置')
  1327. this.table.getdataListParm.offset = 1
  1328. this.table.getdataListParm.parammaps.ccid = ''
  1329. this.table.getdataListParm.parammaps.ccname = ''
  1330. this.table.getdataListParm.parammaps.fttype = ''
  1331. this.table.getdataListParm.parammaps.tname = ''
  1332. this.table.getdataListParm.parammaps.remark = ''
  1333. this.table.getdataListParm.parammaps.enable = '1'
  1334. this.table.getdataListParm.parammaps.source = ''
  1335. this.table.getdataListParm.parammaps.all = ''
  1336. this.getList()
  1337. },
  1338. // 模板新增
  1339. handleCreate() {
  1340. // 编辑true/不可编辑false
  1341. // 新增操true,编辑false,编辑保存false
  1342. for (let i = 0; i < this.table.list.length; i++) {
  1343. if (this.table.list[i].Edit === true) {
  1344. this.$message({ type: 'error', message: '当前内容未保存,请点击取消或保存继续进行操作', duration: 2000 })
  1345. return false
  1346. }
  1347. }
  1348. this.table.list.unshift({ 'myId': (new Date()).valueOf(), 'Edit': true, 'NoEdit': false, 'isCreate': true, 'isUpdate': false, 'isUpdateSave': false, 'enable': 1,'autozone':0, 'tname': '', tcode: '', 'tcolor': '#ccc', 'ccid': '', 'ccname': '', 'fttype': '', 'fttypeid': '','volume':'', 'source': '自定义', 'remark': '','cattle':'' })
  1349. console.log('点击了新增this.table.list====>', this.table.list)
  1350. this.table.temp = this.table.list[0]
  1351. this.getTcodeList()
  1352. },
  1353. getTcodeList() {
  1354. this.getTcodeParm.parammaps.pastureid = Cookies.get('pastureid')
  1355. console.log(this.table.temp, 'this.table.temp')
  1356. GetDataByName(this.getTcodeParm).then(response => {
  1357. if (response.data.list !== null) {
  1358. this.table.temp.tcode = response.data.list[0].tcode
  1359. } else {
  1360. this.table.temp.tcode = ''
  1361. }
  1362. })
  1363. },
  1364. // 畜生类别
  1365. changeLivestockType(item) {
  1366. this.table.temp.ccname = this.livestockTypeList.find(obj => obj.value === item).label
  1367. },
  1368. // 配方类型
  1369. changeFormulaType(item) {
  1370. this.table.temp.fttype = this.formulaTypeList.find(obj => obj.value === item).label
  1371. },
  1372. createData(row) {
  1373. console.log('点击了新增保存', row)
  1374. this.table.temp.tname = row.tname
  1375. this.table.temp.tcode = row.tcode
  1376. this.table.temp.tcolor = row.tcolor
  1377. this.table.temp.ccid = row.ccid
  1378. this.table.temp.ccname = this.table.temp.ccname
  1379. this.table.temp.fttype = this.table.temp.fttype
  1380. this.table.temp.fttypeid = row.fttypeid
  1381. this.table.temp.source = row.source
  1382. this.table.temp.remark = row.remark
  1383. this.table.temp.enable = row.enable
  1384. if(this.table.temp.volume == '' || this.table.temp.volume == null){
  1385. this.table.temp.volume = 0
  1386. }
  1387. if( isNaN(this.table.temp.autozone) || this.table.temp.autozone == '' || this.table.temp.autozone == undefined){
  1388. this.table.temp.autozone = 0
  1389. }
  1390. this.table.temp.volume = parseFloat(row.volume)
  1391. this.table.temp.pastureid = Cookies.get('pastureid')
  1392. if (this.table.temp.tname == '' && this.table.temp.ccid == '' && this.table.temp.fttypeid == '') {
  1393. this.$message({ type: 'error', message: '配方名称/牲畜类别/配方类型不能为空', duration: 2000 })
  1394. return false
  1395. } else if (this.table.temp.ccid == '' && this.table.temp.fttypeid == '') {
  1396. this.$message({ type: 'error', message: '牲畜类别/配方类型不能为空', duration: 2000 })
  1397. return false
  1398. } else if (this.table.temp.tname == '') {
  1399. this.$message({ type: 'error', message: '配方名称不能为空', duration: 2000 })
  1400. return false
  1401. } else if (this.table.temp.ccid == '') {
  1402. this.$message({ type: 'error', message: '牲畜类别不能为空', duration: 2000 })
  1403. return false
  1404. } else if (this.table.temp.fttypeid == '') {
  1405. this.$message({ type: 'error', message: '配方类型不能为空', duration: 2000 })
  1406. return false
  1407. }
  1408. const pattern = new RegExp("[`~!@#$^&*()=|{}':;',\\[\\].<>/?~!@#¥……&*()——|{}【】‘;:”“'。,、?]")
  1409. // if (pattern.test(this.table.temp.tname)) {
  1410. // this.$message({ type: 'error', message: '配方名称不可输入特殊字符', duration: 2000 })
  1411. // return false
  1412. // }
  1413. if (pattern.test(this.table.temp.tcode)) {
  1414. this.$message({ type: 'error', message: '配方编码不可输入特殊字符', duration: 2000 })
  1415. return false
  1416. }
  1417. console.log(this.table.temp)
  1418. this.isokDisable = true
  1419. setTimeout(() => {
  1420. this.isokDisable = false
  1421. }, 1000)
  1422. this.requestParam2.name = 'checkNumber'
  1423. this.requestParam2.parammaps = {}
  1424. this.requestParam2.parammaps.number = this.table.temp.tcode
  1425. GetDataByName(this.requestParam2).then(response => {
  1426. console.log('table数据', response.data.list)
  1427. if (response.data.list[0].vmsg !== '输入非法字符') {
  1428. this.saveCreateData()
  1429. } else {
  1430. this.$notify({ type: 'error', message: '配方编码不可输入特殊字符', duration: 2000 })
  1431. }
  1432. })
  1433. },
  1434. saveCreateData() {
  1435. this.requestParam.name = 'insertFT'
  1436. this.requestParam.parammaps = this.table.temp
  1437. PostDataByName(this.requestParam).then(response => {
  1438. console.log('新增保存发送参数', this.requestParam)
  1439. if (response.msg !== 'fail') {
  1440. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  1441. this.getList()
  1442. let data = {}
  1443. data.name = 'insertFeedtemplethistory'
  1444. data.parammaps = this.table.temp
  1445. PostDataByName(data).then(response => {
  1446. if (response.msg !== 'fail') {
  1447. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  1448. this.getList()
  1449. } else {
  1450. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  1451. }
  1452. })
  1453. } else {
  1454. const isRepeat = new RegExp('Duplicate entry :feedtemplet.tCode')
  1455. if (isRepeat.test(response.data)) {
  1456. this.$notify({ type: 'error', message: '配方编码不可重复,请重新录入', duration: 2000 })
  1457. } else {
  1458. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  1459. }
  1460. }
  1461. })
  1462. },
  1463. createCancel(row) {
  1464. console.log('点击了新增取消')
  1465. for (let i = 0; i < this.table.list.length; i++) {
  1466. if (row.myId === this.table.list[i].myId) {
  1467. var listIndex = this.table.list.indexOf(this.table.list[i])
  1468. }
  1469. if (listIndex > -1) {
  1470. this.table.list.splice(listIndex, 1)
  1471. return
  1472. }
  1473. }
  1474. },
  1475. // 模板编辑
  1476. handleUpdate(row) {
  1477. for (let i = 0; i < this.table.list.length; i++) {
  1478. if (this.table.list[i].Edit == true) {
  1479. this.$message({ type: 'error', message: '当前内容未保存,请点击取消或保存继续进行操作', duration: 2000 })
  1480. return false
  1481. }
  1482. }
  1483. // 编辑true,不可编辑false
  1484. row.Edit = true
  1485. row.NoEdit = false
  1486. // 新增false,编辑false,编辑保存true
  1487. row.isCreate = false
  1488. row.isUpdate = false
  1489. row.isUpdateSave = true
  1490. if (row.ccname !== undefined) {
  1491. row.ccid = String(row.ccid)
  1492. }
  1493. this.table.temp.ccname = row.ccname
  1494. row.fttypeid = String(row.fttypeid)
  1495. this.table.temp.fttype = row.fttype
  1496. },
  1497. updateData(row) {
  1498. console.log('点击了编辑保存', row)
  1499. this.table.temp.tname = row.tname
  1500. this.table.temp.tcode = row.tcode
  1501. this.table.temp.tcolor = row.tcolor
  1502. this.table.temp.ccid = row.ccid
  1503. this.table.temp.fttypeid = row.fttypeid
  1504. this.table.temp.source = row.source
  1505. this.table.temp.remark = row.remark
  1506. this.table.temp.enable = row.enable
  1507. this.table.temp.ccname = this.table.temp.ccname
  1508. this.table.temp.fttype = this.table.temp.fttype
  1509. this.table.temp.pastureid = row.pastureid
  1510. this.table.temp.id = row.id
  1511. this.table.temp.cattle = row.cattle
  1512. this.table.temp.autozone = row.autozone
  1513. if(this.table.temp.volume == '' || this.table.temp.volume == null || this.table.temp.volume == undefined){
  1514. this.table.temp.volume = 0
  1515. }
  1516. if( isNaN(this.table.temp.autozone) || this.table.temp.autozone == '' || this.table.temp.autozone == undefined){
  1517. this.table.temp.autozone = 0
  1518. }
  1519. this.table.temp.volume = parseFloat(row.volume)
  1520. if (this.table.temp.tname == '' && this.table.temp.ccid == '' && this.table.temp.fttypeid == '') {
  1521. this.$message({ type: 'error', message: '配方名称/牲畜类别/配方类型不能为空', duration: 2000 })
  1522. return false
  1523. } else if (this.table.temp.ccid == '' && this.table.temp.fttypeid == '') {
  1524. this.$message({ type: 'error', message: '牲畜类别/配方类型不能为空', duration: 2000 })
  1525. return false
  1526. } else if (this.table.temp.tname == '') {
  1527. this.$message({ type: 'error', message: '配方名称不能为空', duration: 2000 })
  1528. return false
  1529. } else if (this.table.temp.ccid == '') {
  1530. this.$message({ type: 'error', message: '牲畜类别不能为空', duration: 2000 })
  1531. return false
  1532. } else if (this.table.temp.fttypeid == '') {
  1533. this.$message({ type: 'error', message: '配方类型不能为空', duration: 2000 })
  1534. return false
  1535. }
  1536. const pattern = new RegExp("[`~!@#$^&*()=|{}':;',\\[\\].<>/?~!@#¥……&*()——|{}【】‘;:”“'。,、?]")
  1537. // if (pattern.test(this.table.temp.tname)) {
  1538. // this.$message({ type: 'error', message: '配方名称不可输入特殊字符', duration: 2000 })
  1539. // return false
  1540. // }
  1541. if (pattern.test(this.table.temp.tcode)) {
  1542. this.$message({ type: 'error', message: '配方编码不可输入特殊字符', duration: 2000 })
  1543. return false
  1544. }
  1545. console.log(this.table.temp)
  1546. this.isokDisable = true
  1547. setTimeout(() => {
  1548. this.isokDisable = false
  1549. }, 1000)
  1550. this.requestParam2 = {}
  1551. this.requestParam2.name = 'checkNumber'
  1552. this.requestParam2.parammaps = {}
  1553. this.requestParam2.parammaps.number = this.table.temp.tcode
  1554. GetDataByName(this.requestParam2).then(response => {
  1555. console.log('table数据', response.data.list)
  1556. if (response.data.list[0].vmsg !== '输入非法字符') {
  1557. this.saveUpdateData()
  1558. } else {
  1559. this.$notify({ type: 'error', message: '配方编码不可输入特殊字符', duration: 2000 })
  1560. }
  1561. })
  1562. },
  1563. saveUpdateData() {
  1564. this.requestParam = {}
  1565. this.requestParam.name = 'updateFT'
  1566. if(this.table.temp.volume == '' || this.table.temp.volume == null || this.table.temp.volume == undefined || isNaN(this.table.temp.volume)){
  1567. this.table.temp.volume = 0
  1568. }
  1569. console.log( this.table.temp.volume,'----')
  1570. if( isNaN(this.table.temp.autozone) || this.table.temp.autozone == '' || this.table.temp.autozone == undefined){
  1571. this.table.temp.autozone = 0
  1572. }
  1573. this.requestParam.parammaps = this.table.temp
  1574. PostDataByName(this.requestParam).then(response => {
  1575. console.log('新增保存发送参数', this.requestParam)
  1576. if (response.msg !== 'fail') {
  1577. this.requestParam3 = {}
  1578. this.requestParam3.name = 'insertFTHistory'
  1579. this.requestParam3.type = 'e'
  1580. this.requestParam3.parammaps = {}
  1581. this.requestParam3.parammaps.id = this.table.temp.id
  1582. this.requestParam3.parammaps.createdate = parseTime(new Date(), '{y}-{m}-{d} {h}:{i}:{s}')
  1583. this.requestParam3.parammaps.userId = Cookies.get('employeid')
  1584. PostDataByName(this.requestParam3).then(response => {
  1585. console.log('新增保存发送参数', this.requestParam)
  1586. if (response.msg !== 'fail') {
  1587. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  1588. this.getList()
  1589. } else {
  1590. const isRepeat = new RegExp('Duplicate entry :feedtemplet.tCode')
  1591. if (isRepeat.test(response.data)) {
  1592. this.$notify({ type: 'error', message: '配方编码不可重复,请重新录入', duration: 2000 })
  1593. } else {
  1594. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  1595. }
  1596. }
  1597. })
  1598. } else {
  1599. const isRepeat = new RegExp('Duplicate entry :feedtemplet.tCode')
  1600. if (isRepeat.test(response.data)) {
  1601. this.$notify({ type: 'error', message: '配方编码不可重复,请重新录入', duration: 2000 })
  1602. } else {
  1603. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  1604. }
  1605. }
  1606. })
  1607. },
  1608. updateCancel(row) {
  1609. console.log('点击了编辑取消')
  1610. // 编辑false,不可编辑true
  1611. row.Edit = false
  1612. row.NoEdit = true
  1613. // 新增false,编辑true,编辑保存false
  1614. row.isCreate = false
  1615. row.isUpdate = true
  1616. row.isUpdateSave = false
  1617. this.getList()
  1618. },
  1619. // 删除
  1620. handleRowDelete(row) {
  1621. console.log('点击了行内删除')
  1622. MessageBox.confirm('是否确认删除此信息?', {
  1623. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  1624. }).then(() => {
  1625. const url = 'authdata/feedtemplet/del'
  1626. const data = {
  1627. ftId:row.id,
  1628. userId:Cookies.get('employeid')
  1629. }
  1630. postJson(url, data).then(response => {
  1631. if (response.msg === 'fail') {
  1632. this.$notify({ title: '删除失败', message: response.data, type: 'warning', duration: 2000 })
  1633. } else {
  1634. this.$notify({ title: '成功', message: '删除成功', type: 'success', duration: 2000 })
  1635. this.getList()
  1636. this.isDetail = false
  1637. }
  1638. })
  1639. }).catch(() => {
  1640. this.$message({ type: 'info', message: '已取消删除' })
  1641. })
  1642. },
  1643. handleSelectionChange(val) {
  1644. console.log('勾选数据', val)
  1645. this.selectList = val
  1646. },
  1647. form_delete() {
  1648. console.log('点击了删除')
  1649. if (this.selectList.length == 0) {
  1650. this.$message({ type: 'error', message: '请选择配方', duration: 2000 })
  1651. } else {
  1652. MessageBox.confirm('是否确认删除此信息?', {
  1653. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  1654. }).then(() => {
  1655. console.log(this.selectList)
  1656. this.requestParam.common = { 'returnmap': '0' }
  1657. this.requestParam.data = []
  1658. this.requestParam.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.selectList }}
  1659. this.requestParam.data[0].children = []
  1660. this.requestParam.data[0].children[0] = { 'name': 'checkdeleteFT', 'type': 'v', 'parammaps': {
  1661. id: '@insertSpotList.id',
  1662. pastureid: '@insertSpotList.pastureid'
  1663. }}
  1664. this.requestParam.data[0].children[1] = { 'name': 'deleteFT', 'type': 'e', 'parammaps': {
  1665. id: '@insertSpotList.id',
  1666. pastureid: '@insertSpotList.pastureid'
  1667. }}
  1668. ExecDataByConfig(this.requestParam).then(response => {
  1669. console.log('删除保存发送参数', this.requestParam)
  1670. if (response.msg === 'fail') {
  1671. this.$notify({ title: '删除失败', message: response.data, type: 'warning', duration: 2000 })
  1672. } else {
  1673. this.$notify({ title: '', message: '删除成功', type: 'success', duration: 2000 })
  1674. this.getList()
  1675. }
  1676. })
  1677. })
  1678. }
  1679. },
  1680. // 复制
  1681. handleCopy() {
  1682. if (this.selectList.length == 0) {
  1683. this.$message({ type: 'error', message: '请选择配方', duration: 2000 })
  1684. } else {
  1685. MessageBox.confirm('是否确认复制此信息?', {
  1686. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  1687. }).then(() => {
  1688. console.log(this.selectList)
  1689. this.requestParam.common = { 'returnmap': '0' }
  1690. this.requestParam.data = []
  1691. this.requestParam.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.selectList }}
  1692. this.requestParam.data[0].children = []
  1693. this.requestParam.data[0].children[0] = { 'name': 'copyFT', 'type': 'e', 'parammaps': {
  1694. ftid: '@insertSpotList.id',
  1695. pastureid: '@insertSpotList.pastureid'
  1696. }}
  1697. ExecDataByConfig(this.requestParam).then(response => {
  1698. console.log('复制保存发送参数', this.requestParam)
  1699. if (response.msg === 'fail') {
  1700. this.$notify({ title: '复制失败', message: response.data, type: 'warning', duration: 2000 })
  1701. } else {
  1702. this.$notify({ title: '', message: '复制成功', type: 'success', duration: 2000 })
  1703. this.getList()
  1704. }
  1705. })
  1706. })
  1707. }
  1708. },
  1709. // 配方记录
  1710. handleRecipeRecord() {
  1711. console.log('点击了配方记录')
  1712. this.template.dialogStatus = 'RecipeRecord'
  1713. this.dialogFull = false
  1714. this.template.dialogFormVisible = true
  1715. this.template.table.getdataListParm.parammaps.ccname = ''
  1716. this.template.table.getdataListParm.parammaps.fttype = ''
  1717. this.template.table.getdataListParm.parammaps.enable = ''
  1718. this.template.table.getdataListParm.parammaps.tname = ''
  1719. this.template.table.getdataListParm.parammaps.remark = ''
  1720. this.template.table.getdataListParm.parammaps.source = ''
  1721. this.template.table.getdataListParm.offset = 1
  1722. this.getDateList()
  1723. this.isDetailDialog = false
  1724. this.myheight2 = document.documentElement.clientHeight - 85 - 265
  1725. },
  1726. // 历史时间
  1727. getDateList() {
  1728. GetDataByName(this.template.getdataDateParm).then(response => {
  1729. console.log('table数据', response.data.list)
  1730. if (response.data.list !== null) {
  1731. this.template.table.getdataListParm.parammaps.date = response.data.list[0].maxdate
  1732. this.getTemplateDialogList()
  1733. } else {
  1734. this.template.table.getdataListParm.parammaps.date = ''
  1735. }
  1736. })
  1737. },
  1738. // 配方记录-模板
  1739. getTemplateDialogList() {
  1740. this.template.table.listLoading = true
  1741. GetDataByName(this.template.table.getdataListParm).then(response => {
  1742. console.log('table数据', response.data.list)
  1743. if (response.data.list !== null) {
  1744. this.template.table.list = response.data.list
  1745. this.template.table.pageNum = response.data.pageNum
  1746. this.template.table.pageSize = response.data.pageSize
  1747. this.template.table.total = response.data.total
  1748. } else {
  1749. this.template.table.list = []
  1750. this.template.table2.list = []
  1751. }
  1752. setTimeout(() => {
  1753. this.template.table.listLoading = false
  1754. }, 100)
  1755. })
  1756. },
  1757. handleDialogSearch() {
  1758. this.template.table.getdataListParm.offset = 1
  1759. this.getTemplateDialogList()
  1760. this.arrowDown = true
  1761. this.arrowUp = false
  1762. },
  1763. handleDialogRefresh() {
  1764. this.template.table.getdataListParm.parammaps.ccname = ''
  1765. this.template.table.getdataListParm.parammaps.fttype = ''
  1766. this.template.table.getdataListParm.parammaps.enable = ''
  1767. this.template.table.getdataListParm.parammaps.tname = ''
  1768. this.template.table.getdataListParm.parammaps.remark = ''
  1769. this.template.table.getdataListParm.parammaps.source = ''
  1770. this.template.table.getdataListParm.offset = 1
  1771. this.getTemplateDialogList()
  1772. },
  1773. // 配方记录-模板行点击
  1774. tableRowClickDialog(row, column, event) {
  1775. console.log('配方记录-模板行点击')
  1776. this.isDetailDialog = true
  1777. this.template.table2.getdataListParm.parammaps.date = this.template.table.getdataListParm.parammaps.date
  1778. this.template.table2.getdataListParm.parammaps.version = row.version
  1779. this.template.table2.getdataListParm.parammaps.ftid = row.id
  1780. this.template.table2.getdataListParm.parammaps.dryweight = row.dryweight
  1781. this.myheight2 = document.documentElement.clientHeight - 85 - 265 - 185
  1782. this.getDialogList()
  1783. this.getDownList()
  1784. // aiaiaiai
  1785. },
  1786. getDialogList() {
  1787. this.template.table2.listLoading = true
  1788. GetDataByName(this.template.table2.getdataListParm).then(response => {
  1789. console.log('table数据', response.data.list)
  1790. if (response.data.list !== null) {
  1791. this.template.table2.list = response.data.list
  1792. this.template.table2.pageNum = response.data.pageNum
  1793. this.template.table2.pageSize = response.data.pageSize
  1794. this.template.table2.total = response.data.total
  1795. } else {
  1796. this.template.table2.list = []
  1797. }
  1798. this.$nextTick(function() {
  1799. document.querySelector('#detailDialog2').scrollIntoView()
  1800. // window.scrollTo({
  1801. // 'top': this.$refs.detailDialog2.clientHeight
  1802. // })
  1803. })
  1804. setTimeout(() => {
  1805. this.template.table2.listLoading = false
  1806. }, 100)
  1807. })
  1808. },
  1809. handleDialogSearch2() {
  1810. console.log('点击了查询')
  1811. this.arrowDown2 = true
  1812. this.arrowUp2 = false
  1813. this.template.table2.getdataListParm.offset = 1
  1814. this.getDialogList2()
  1815. },
  1816. handleDialogRefresh2() {
  1817. console.log('点击了重置')
  1818. this.template.table2.getdataListParm.parammaps.fname = ''
  1819. this.template.table2.getdataListParm.parammaps.feedgroup = ''
  1820. this.template.table2.getdataListParm.parammaps.fweight = ''
  1821. this.template.table2.getdataListParm.parammaps.autosecondname = ''
  1822. this.template.table2.getdataListParm.parammaps.islockcount = '0'
  1823. this.template.table2.getdataListParm.parammaps.sort = ''
  1824. this.template.table2.getdataListParm.offset = 1
  1825. this.getDialogList2()
  1826. },
  1827. getDialogList2() {
  1828. this.template.table2.listLoading = true
  1829. GetDataByName(this.template.table2.getdataListParm).then(response => {
  1830. console.log('table数据', response.data.list)
  1831. if (response.data.list !== null) {
  1832. this.template.table2.list = response.data.list
  1833. this.template.table2.pageNum = response.data.pageNum
  1834. this.template.table2.pageSize = response.data.pageSize
  1835. this.template.table2.total = response.data.total
  1836. } else {
  1837. this.template.table2.list = []
  1838. }
  1839. this.$nextTick(function() {
  1840. window.scrollTo({
  1841. 'top': this.$refs.templateDialog.clientHeight
  1842. })
  1843. })
  1844. setTimeout(() => {
  1845. this.template.table2.listLoading = false
  1846. }, 100)
  1847. })
  1848. },
  1849. // 导出
  1850. handleExport(item) {
  1851. if (item == 1) {
  1852. console.log('点击了导出模板')
  1853. const requestParam = this.requestParam
  1854. const url = Cookies.get('url') + 'file/导入导出模板/配方计划/配方模板导入模板.xlsx' // 请求下载文件的地址
  1855. console.log(url)
  1856. axios({
  1857. method: 'GET',
  1858. url: url,
  1859. data: requestParam,
  1860. headers: { token: getToken(), optname: 'insertcustomdoc' },
  1861. responseType: 'blob'
  1862. }).then(res => {
  1863. if (!res) return
  1864. this.percentage = 99
  1865. setTimeout(() => {
  1866. this.isPercentage = false
  1867. }, 2000)
  1868. const blob = new Blob([res.data], {
  1869. type: 'application/octet-stream;charset=utf-8'
  1870. })
  1871. const url = window.URL.createObjectURL(blob)
  1872. const aLink = document.createElement('a')
  1873. aLink.style.display = 'none'
  1874. aLink.href = url
  1875. const docname = '配方模板导入模板.xlsx'
  1876. aLink.setAttribute('download', docname) // 下载的文件
  1877. document.body.appendChild(aLink)
  1878. aLink.click()
  1879. document.body.removeChild(aLink)
  1880. window.URL.revokeObjectURL(url)
  1881. })
  1882. } else {
  1883. console.log('点击了导出数据')
  1884. this.download.getdataListParm.name = 'downloadFTList'
  1885. this.download.getdataListParm.parammaps = this.table.getdataListParm.parammaps
  1886. GetDataByName(this.download.getdataListParm).then(response => {
  1887. if (response.data.list !== null) {
  1888. for (let i = 0; i < response.data.list.length; i++) {
  1889. if (response.data.list[i].islockcount == 0) {
  1890. this.$set(response.data.list[i], 'islockcount', '否')
  1891. } else {
  1892. this.$set(response.data.list[i], 'islockcount', '是')
  1893. }
  1894. if (response.data.list[i].enable == 0) {
  1895. this.$set(response.data.list[i], 'enable', '否')
  1896. } else {
  1897. this.$set(response.data.list[i], 'enable', '是')
  1898. }
  1899. }
  1900. this.download.list = response.data.list
  1901. } else {
  1902. this.download.list = []
  1903. }
  1904. var excelDatas = [
  1905. {
  1906. tHeader: ['配方名称', '配方编码', '牲畜类别', '配方类型', '来源', '备注', '是否启用', '饲料组', '饲料名称', '重量(kg)', '搅拌延时(min)', '是否锁定牛头数比例', '顺序'],
  1907. filterVal: ['tname', 'tcode', 'ccname', 'fttype', 'source', 'remark', 'enable', 'feedgroup', 'fname', 'fweight', 'autosecond', 'islockcount', 'sort'],
  1908. tableDatas: this.download.list,
  1909. sheetName: 'Sheet1'
  1910. }
  1911. ]
  1912. json2excel(excelDatas, '配方模板', true, 'xlsx')
  1913. })
  1914. }
  1915. },
  1916. beforeImport(file) {
  1917. const isLt2M = file.size / 1024 / 1024 < 2
  1918. if (!isLt2M) {
  1919. this.$message.error('上传文件大小不能超过 2MB!')
  1920. }
  1921. return isLt2M
  1922. },
  1923. handleImportSuccess(res, file) {
  1924. this.getList()
  1925. if (res.msg === 'ok') {
  1926. this.$message({ title: '成功', message: '导入成功:' + res.data.success + '条!', type: 'success', duration: 2000 })
  1927. if (res.data.err_count > 0) {
  1928. this.$notify({ title: '失败', message: '导入失败:' + res.data.err_count + '条!', type: 'danger', duration: 2000 })
  1929. import('@/vendor/Export2Excel').then(excel => {
  1930. const list1 = res.data.result
  1931. const tHeader = [
  1932. '配方名称', '牲畜类别', '配方类型', '备注', '饲料组', '饲料名称', '重量(kg)', '搅拌延时(min)', '是否锁定牛头数比例', '错误信息'
  1933. ]
  1934. const filterVal = [
  1935. '配方名称', '牲畜类别', '配方类型', '备注', '饲料组', '饲料名称', '重量(kg)', '搅拌延时(min)', '是否锁定牛头数比例', 'error_msg'
  1936. ]
  1937. const data1 = this.formatJson(filterVal, list1)
  1938. excel.export_json_to_excel({ header: tHeader, data: data1, filename: '配方模板导入报错信息', autoWidth: true, bookType: 'xlsx' })
  1939. })
  1940. }
  1941. } else {
  1942. const isRepeat = new RegExp('Duplicate entry :feedtemplet_tname')
  1943. if (isRepeat.test(res.data)) {
  1944. this.$notify({ type: 'error', message: '配方名称不可重复,请重新录入', duration: 2000 })
  1945. return false
  1946. }
  1947. this.$notify({ title: '失败', message: '上传失败', type: 'danger', duration: 2000 })
  1948. }
  1949. },
  1950. formatJson(filterVal, jsonData) {
  1951. return jsonData.map(v =>
  1952. filterVal.map(j => {
  1953. if (j === 'timestamp') {
  1954. return parseTime(v[j])
  1955. } else {
  1956. return v[j]
  1957. }
  1958. })
  1959. )
  1960. },
  1961. changeDate() {
  1962. this.getTemplateDialogList()
  1963. },
  1964. // 应用
  1965. handleApplication() {
  1966. console.log('点击了应用')
  1967. MessageBox.confirm('是否确认将' + this.template.table.getdataListParm.parammaps.date + '的数据应用到当前?', {
  1968. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  1969. }).then(() => {
  1970. this.requestParam.name = 'applyFTdate'
  1971. this.requestParam.parammaps = {}
  1972. this.requestParam.parammaps.pastureid = Cookies.get('pastureid')
  1973. this.requestParam.parammaps.date = this.template.table.getdataListParm.parammaps.date
  1974. PostDataByName(this.requestParam).then(response => {
  1975. if (response.msg === 'fail') {
  1976. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  1977. } else {
  1978. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  1979. this.getTemplateDialogList()
  1980. this.getList()
  1981. }
  1982. })
  1983. }).catch(() => {
  1984. this.$message({ type: 'info', message: '已取消应用' })
  1985. })
  1986. },
  1987. // 模板行点击
  1988. tableRowClick(row, column, event) {
  1989. for (let i = 0; i < this.table.list.length; i++) {
  1990. if (this.table.list[i].Edit == true) {
  1991. return false
  1992. }
  1993. }
  1994. if (this.isOrder == false) {
  1995. this.$message({ type: 'error', message: '请保存或取消当前更改顺序操作', duration: 2000 })
  1996. } else {
  1997. if (column.label !== '操作') {
  1998. this.isDetail = true // 点击行显示详情
  1999. this.table2.getdataListParm.parammaps.tcolor = row.tcolor
  2000. this.table2.getdataListParm.parammaps.tname = row.tname
  2001. this.table2.getdataListParm.parammaps.ccname = row.ccname
  2002. this.table2.getdataListParm.parammaps.fttype = row.fttype
  2003. this.table2.getdataListParm.parammaps.ftid = row.id
  2004. this.table2.getdataListParm.parammaps.fttypeid = row.fttypeid
  2005. this.table2.getdataListParm.parammaps.dryweight = row.dryweight
  2006. if (row.fttype == '预混配方') {
  2007. this.requestParams[2].parammaps.type = '1'
  2008. } else {
  2009. this.requestParams[2].parammaps.type = ''
  2010. }
  2011. this.myheight = document.documentElement.clientHeight - 85 - 265 - 230
  2012. this.getList2()
  2013. this.getDownList()
  2014. }
  2015. }
  2016. },
  2017. handleCloseTable2() {
  2018. this.isDetail = false
  2019. this.myheight = ''
  2020. this.isEnlarge = true
  2021. },
  2022. handleDialogCloseTable2() {
  2023. this.isDetailDialog = false
  2024. this.myheight2 = document.documentElement.clientHeight - 85 - 265
  2025. },
  2026. // -------------------详情-----------------------------
  2027. // 获取是否显示是否锁定牛头数
  2028. getIsLockCount() {
  2029. GetDataByName(this.lockCount.getdataListParm).then(response => {
  2030. console.log(response.data.list)
  2031. if (response.data.list[0].inforvalue == 0) {
  2032. this.lockCount.isLockCount = false
  2033. } else {
  2034. this.lockCount.isLockCount = true
  2035. }
  2036. })
  2037. },
  2038. // 详情
  2039. getList2() {
  2040. this.table2.listLoading = true
  2041. GetDataByName(this.table2.getdataListParm).then(response => {
  2042. console.log('table数据', response.data.list)
  2043. if (response.data.list !== null) {
  2044. for (let i = 0; i < response.data.list.length; i++) {
  2045. this.$set(response.data.list[i], 'Edit', false) // 编辑
  2046. this.$set(response.data.list[i], 'NoEdit', true) // 不可编辑/输入
  2047. this.$set(response.data.list[i], 'groupEdit', false) // 饲料组编辑
  2048. this.$set(response.data.list[i], 'isGroupDisabled', false) // 饲料组编辑禁止编辑
  2049. this.$set(response.data.list[i], 'groupNoEdit', true) // 饲料组不可编辑
  2050. this.$set(response.data.list[i], 'isCreate', false) // 新增操作
  2051. this.$set(response.data.list[i], 'isUpdate', true) // 编辑操作
  2052. this.$set(response.data.list[i], 'isUpdateSave', false) // 编辑保存
  2053. }
  2054. this.table2.getDryweightParm.parammaps = this.table2.getdataListParm.parammaps
  2055. this.getDryWeight()
  2056. // for (let i = 0; i < response.data.list.length; i++) {
  2057. // console.log(response.data.list[i].fweight, '===12333')
  2058. // }
  2059. this.table2.list = response.data.list
  2060. this.table2.pageNum = response.data.pageNum
  2061. this.table2.pageSize = response.data.pageSize
  2062. this.table2.total = response.data.total
  2063. } else {
  2064. this.table2.list = []
  2065. }
  2066. setTimeout(() => {
  2067. this.table2.listLoading = false
  2068. }, 100)
  2069. })
  2070. },
  2071. // 行拖拽
  2072. rowDrop() {
  2073. console.log(document.querySelector('#table2 .el-table__body-wrapper tbody'))
  2074. const tbody = document.querySelector('#table2 .el-table__body-wrapper tbody')
  2075. // this.sorTable()
  2076. const that = this
  2077. // Sortable.create(tbody, {
  2078. var sortable = Sortable.create(tbody, {
  2079. disabled: that.dropState,
  2080. onChoose({ newIndex, oldIndex }) {
  2081. console.log(that.isOrder, 'that.isOrder == false')
  2082. console.log(that.dropState, 'that.dropState')
  2083. if (that.dropState == true || that.isOrder == true) {
  2084. sortable.destroy()
  2085. }
  2086. },
  2087. onEnd({ newIndex, oldIndex }) {
  2088. const currRow = that.table2.list.splice(oldIndex, 1)[0]
  2089. that.table2.list.splice(newIndex, 0, currRow)
  2090. console.log('索引', newIndex)
  2091. console.log('拖动数据', currRow)
  2092. console.log('上', that.table2.list[newIndex - 1])
  2093. console.log('下', that.table2.list[newIndex + 1])
  2094. if (that.table2.list[newIndex - 1] === undefined) { // 拖动至最上方无值 // 顺序等于0,其他+1 // 饲料组等于饲料名称
  2095. for (let i = 0; i < that.table2.list.length; i++) {
  2096. that.table2.list[i].sort = parseInt(that.table2.list[i].sort) + 1 // 其他的顺序+1
  2097. }
  2098. currRow.sort = 0
  2099. currRow.feedgroup = currRow.fname
  2100. console.log('拖动至最上方无值')
  2101. } else if (currRow.sort == that.table2.list[newIndex - 1].sort) { // 拖动值顺序等于上值顺序
  2102. currRow.sort = that.table2.list[newIndex - 1].sort
  2103. console.log('拖动值顺序等于上值顺序')
  2104. } else if (that.table2.list[newIndex + 1] == undefined) { // 拖动至最下方无值 // 顺序等于上方顺序+1 // 饲料组等于饲料名称
  2105. currRow.sort = parseInt(that.table2.list[newIndex - 1].sort) + 1
  2106. currRow.feedgroup = currRow.fname
  2107. console.log('拖动至最下方无值')
  2108. } else if (currRow.sort == that.table2.list[newIndex + 1].sort) { // 拖动值顺序等于下值顺序
  2109. currRow.sort == that.table2.list[newIndex + 1].sort
  2110. console.log('拖动值顺序等于下值顺序')
  2111. } else if (that.table2.list[newIndex - 1].sort == that.table2.list[newIndex + 1].sort) { // 拖动至上下顺序一致,顺序/饲料组与上下保持一致
  2112. currRow.sort = that.table2.list[newIndex - 1].sort
  2113. currRow.feedgroup = that.table2.list[newIndex - 1].feedgroup
  2114. console.log('拖动至上下顺序一致')
  2115. } else if (that.table2.list[newIndex - 1].sort !== undefined && that.table2.list[newIndex + 1].sort !== undefined) { // 拖动至上下都有值
  2116. console.log('上下')
  2117. if (parseInt(that.table2.list[newIndex - 1].sort) + 1 == that.table2.list[newIndex + 1].sort) {
  2118. console.log(newIndex)
  2119. for (let i = newIndex; i < that.table2.list.length; i++) {
  2120. that.table2.list[i].sort = parseInt(that.table2.list[i].sort) + 1
  2121. }
  2122. }
  2123. currRow.sort = parseInt(that.table2.list[newIndex - 1].sort) + 1
  2124. currRow.feedgroup = currRow.fname
  2125. console.log(that.table2.list[newIndex + 1].sort)
  2126. }
  2127. }
  2128. })
  2129. console.log(sortable.option('disabled'))
  2130. },
  2131. handleChangeOrder() {
  2132. this.isOrder = false
  2133. this.rowDrop()
  2134. },
  2135. saveChangeOrder() {
  2136. // 保存顺序
  2137. console.log(this.table2.list)
  2138. this.requestParam = {}
  2139. this.requestParam.common = { 'returnmap': '0' }
  2140. this.requestParam.data = []
  2141. this.requestParam.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.table2.list }}
  2142. this.requestParam.data[0].children = []
  2143. this.requestParam.data[0].children[0] = { 'name': 'updateFTdetailSort', 'type': 'e', 'parammaps': {
  2144. id: '@insertSpotList.id',
  2145. pastureid: '@insertSpotList.pastureid',
  2146. sort: '@insertSpotList.sort',
  2147. feedgroup: '@insertSpotList.feedgroup'
  2148. }}
  2149. ExecDataByConfig(this.requestParam).then(response => {
  2150. console.log('顺序切换保存发送参数', this.requestParam)
  2151. if (response.msg === 'fail') {
  2152. this.$notify({ title: '顺序切换失败', message: response.data, type: 'warning', duration: 2000 })
  2153. } else {
  2154. this.$notify({ title: '', message: '顺序切换成功', type: 'success', duration: 2000 })
  2155. this.getList2()
  2156. this.getList3()
  2157. this.isOrder = true
  2158. }
  2159. })
  2160. },
  2161. cancelChangeOrder() {
  2162. // 取消顺序
  2163. this.getList2()
  2164. this.isOrder = true
  2165. },
  2166. form_search2() {
  2167. console.log('点击了查询')
  2168. this.arrowDown2 = true
  2169. this.arrowUp2 = false
  2170. this.table2.getdataListParm.offset = 1
  2171. // fname, feedgroup, fweight, autosecondname, islockcount, sort
  2172. // this.table2.getdataListParm.parammaps.all = this.table2.getdataListParm.parammaps.fname + ' ' + this.table2.getdataListParm.parammaps.feedgroup + ' ' + this.table2.getdataListParm.parammaps.fweight + ' ' + this.table2.getdataListParm.parammaps.autosecondname + ' ' + this.table2.getdataListParm.parammaps.islockcount + ' ' + this.table2.getdataListParm.parammaps.sort
  2173. this.table2.getdataListParm.parammaps.all = ''
  2174. var obj = {}
  2175. obj.fname = this.table2.getdataListParm.parammaps.fname
  2176. obj.feedgroup = this.table2.getdataListParm.parammaps.feedgroup
  2177. obj.fweight = this.table2.getdataListParm.parammaps.fweight
  2178. obj.autosecondname = this.table2.getdataListParm.parammaps.autosecondname
  2179. if (this.table2.getdataListParm.parammaps.islockcount !== '') {
  2180. if (this.table2.getdataListParm.parammaps.islockcount == 0) {
  2181. this.table2.getdataListParm.parammaps.islockcount = '否'
  2182. } else {
  2183. this.table2.getdataListParm.parammaps.islockcount = '是'
  2184. }
  2185. }
  2186. obj.islockcount = this.table2.getdataListParm.parammaps.islockcount
  2187. obj.sort = this.table2.getdataListParm.parammaps.sort
  2188. Object.getOwnPropertyNames(obj).forEach((key) => {
  2189. console.log(key, obj[key])
  2190. if (obj[key] !== '') {
  2191. this.table2.getdataListParm.parammaps.all += obj[key] + '/'
  2192. }
  2193. })
  2194. if (this.table2.getdataListParm.parammaps.all.charAt(this.table2.getdataListParm.parammaps.all.length - 1) == '/') {
  2195. this.table2.getdataListParm.parammaps.all = this.table2.getdataListParm.parammaps.all.slice(0, this.table2.getdataListParm.parammaps.all.length - 1)
  2196. }
  2197. this.getList2()
  2198. },
  2199. handleRefresh2() {
  2200. console.log('点击了重置')
  2201. this.table2.getdataListParm.parammaps.fname = ''
  2202. this.table2.getdataListParm.parammaps.feedgroup = ''
  2203. this.table2.getdataListParm.parammaps.fweight = ''
  2204. this.table2.getdataListParm.parammaps.autosecondname = ''
  2205. this.table2.getdataListParm.parammaps.islockcount = '0'
  2206. this.table2.getdataListParm.parammaps.sort = ''
  2207. this.table2.getdataListParm.parammaps.all = ''
  2208. this.table2.getdataListParm.offset = 1
  2209. this.getList2()
  2210. },
  2211. // 详情新增
  2212. handleCreate2() {
  2213. console.log('点击了详情新增', this.table2.list)
  2214. // 编辑true/不可编辑false
  2215. // 新增操true,编辑false,编辑保存false
  2216. console.log(11)
  2217. for (let i = 0; i < this.table2.list.length; i++) {
  2218. if (this.table2.list[i].Edit === true) {
  2219. console.log(123)
  2220. this.$message({ type: 'error', message: '当前内容未保存,请点击取消或保存继续进行操作', duration: 2000 })
  2221. return false
  2222. }
  2223. }
  2224. console.log(this.table2.list)
  2225. if (this.table2.list.length == 0) {
  2226. var mysort = 0
  2227. } else {
  2228. var mysort = parseInt(this.table2.list[this.table2.list.length - 1].sort) + 1
  2229. }
  2230. this.table2.list.unshift({ 'myId': (new Date()).valueOf(), 'Edit': true, 'NoEdit': false, 'isCreate': true, 'isUpdate': false, 'isUpdateSave': false, 'groupEdit': false, 'groupNoEdit': true, 'enable': 1, 'feedgroup': '', 'fid': '', 'fname': '', 'fweight': '', 'autosecond': '0','deviation':'0','islockcount': '0', 'sort': mysort,'shutdown':'0' })
  2231. console.log(this.table2.list)
  2232. },
  2233. changeFname(item, row) {
  2234. console.log(item, row)
  2235. this.table2.temp.fname = this.feedNameList.find(obj => obj.id == item).fname
  2236. row.fname = this.feedNameList.find(obj => obj.id == item).fname
  2237. if (this.feedNameList.find(obj => obj.id == item).ispreft == '0') {
  2238. this.table2.temp.preftid = '0'
  2239. } else {
  2240. this.table2.temp.preftid = item
  2241. }
  2242. if (row.sort == '') {
  2243. row.feedgroup = this.table2.temp.fname
  2244. } else {
  2245. if (row.isCreate == true) { // 新增状态下
  2246. for (let i = 1; i < this.table2.list.length; i++) {
  2247. if (this.table2.list[i].sort == row.sort) {
  2248. console.log(this.table2.list[i])
  2249. row.feedgroup = this.table2.list[i].feedgroup
  2250. break
  2251. } else {
  2252. row.feedgroup = this.table2.temp.fname
  2253. }
  2254. }
  2255. } else if (row.isUpdateSave == true) { // 编辑状态下
  2256. var Arr = []
  2257. for (let i = 0; i < this.table2.list.length; i++) {
  2258. Arr.push(this.table2.list[i].sort)
  2259. }
  2260. var Count = 0
  2261. for (let i = 0; i < Arr.length; i++) {
  2262. if (Arr[i] == row.sort) {
  2263. Count++
  2264. }
  2265. }
  2266. for (let i = 0; i < this.table2.list.length; i++) {
  2267. if (Count > 1) {
  2268. row.feedgroup = this.table2.list[i].feedgroup
  2269. console.log(this.table2.list[i].feedgroup)
  2270. break
  2271. } else if (Count == 1) {
  2272. row.feedgroup = this.table2.temp.fname
  2273. console.log(222, this.table2.temp.fname)
  2274. }
  2275. }
  2276. }
  2277. }
  2278. },
  2279. bort(row) {
  2280. if (row.isCreate == true) {
  2281. if (row.sort !== '') {
  2282. for (let i = 1; i < this.table2.list.length; i++) {
  2283. if (this.table2.list[i].sort == parseInt(row.sort)) {
  2284. row.feedgroup = this.table2.list[i].feedgroup
  2285. return false
  2286. } else {
  2287. row.feedgroup = row.fname
  2288. }
  2289. }
  2290. } else {
  2291. row.feedgroup = row.fname
  2292. }
  2293. } else if (row.isUpdateSave == true) {
  2294. if (row.sort !== '') {
  2295. for (let i = 0; i < this.table2.list.length; i++) {
  2296. if (this.table2.list[i].sort == row.sort) {
  2297. console.log('失去焦点,行内顺序与表格某顺序相同时', this.table2.list[i])
  2298. if (this.table2.list[i].id !== row.id) {
  2299. row.isGroupDisabled = true
  2300. row.feedgroup = this.table2.list[i].feedgroup
  2301. break
  2302. }
  2303. } else {
  2304. console.log('失去焦点,行内顺序与表格某顺序不相同时')
  2305. row.isGroupDisabled = true
  2306. row.feedgroup = row.fname
  2307. }
  2308. }
  2309. } else {
  2310. row.feedgroup = row.fname
  2311. }
  2312. }
  2313. },
  2314. createData2(row) {
  2315. console.log('点击了详情新增保存1', row)
  2316. this.table2.temp.pastureid = Cookies.get('pastureid')
  2317. this.table2.temp.ftid = this.table2.getdataListParm.parammaps.ftid
  2318. this.table2.temp.fid = row.fid
  2319. this.table2.temp.fname = this.table2.temp.fname
  2320. this.table2.temp.fweight = row.fweight
  2321. this.table2.temp.islockcount = row.islockcount
  2322. this.table2.temp.sort = row.sort
  2323. this.table2.temp.feedgroup = row.feedgroup
  2324. this.table2.temp.preftid = this.table2.temp.preftid
  2325. this.table2.temp.autosecond = row.autosecond
  2326. this.table2.temp.deviation = row.deviation
  2327. this.table2.temp.shutdown = row.shutdown
  2328. if (this.table2.temp.fid === '' && this.table2.temp.fweight === '' && this.table2.temp.autosecond === '' && this.table2.temp.deviation === '') {
  2329. this.$message({ type: 'error', message: '饲料名称/重量/搅拌延时/允许延时偏差不能为空', duration: 2000 })
  2330. return false
  2331. } else if (this.table2.temp.fweight === '' && this.table2.temp.autosecond === '' && this.table2.temp.deviation === '') {
  2332. this.$message({ type: 'error', message: '重量/搅拌延时/允许延时偏差不能为空', duration: 2000 })
  2333. return false
  2334. } else if (this.table2.temp.autosecond === '' && this.table2.temp.deviation === '') {
  2335. this.$message({ type: 'error', message: '搅拌延时/允许延时偏差不能为空', duration: 2000 })
  2336. return false
  2337. }else if (this.table2.temp.fid === '') {
  2338. this.$message({ type: 'error', message: '饲料名称不能为空', duration: 2000 })
  2339. return false
  2340. }
  2341. // TODO: 临时去掉限制重量
  2342. // else if (this.table2.temp.fweight === '') {
  2343. // this.$message({ type: 'error', message: '重量不能为空', duration: 2000 })
  2344. // return false
  2345. // }
  2346. else if (this.table2.temp.autosecond === '') {
  2347. this.$message({ type: 'error', message: '搅拌延时不能为空', duration: 2000 })
  2348. return false
  2349. } else if (this.table2.temp.deviation === '') {
  2350. this.$message({ type: 'error', message: '允许延时偏差不能为空', duration: 2000 })
  2351. return false
  2352. }
  2353. if(parseFloat(this.table2.temp.deviation) > parseFloat(this.table2.temp.autosecond)){
  2354. this.$message({ type: 'error', message: '允许延时偏差不可超出搅拌延时', duration: 2000 })
  2355. return false
  2356. }
  2357. if (this.table2.temp.sort !== '') {
  2358. this.table2.temp.sort = this.table2.temp.sort
  2359. } else {
  2360. console.log(this.table2.list.length)
  2361. if (this.table2.list.length == 1) {
  2362. this.table2.temp.sort = 0
  2363. } else {
  2364. this.table2.temp.sort = parseInt(this.table2.list[this.table2.list.length - 1].sort) + 1
  2365. row.sort = parseInt(this.table2.list[this.table2.list.length - 1].sort) + 1
  2366. }
  2367. }
  2368. if (this.table2.temp.shutdown == '') {
  2369. this.table2.temp.shutdown = 0
  2370. }
  2371. if (this.table2.getdataListParm.parammaps.fttypeid == 2) {
  2372. if (parseInt(this.table2.temp.preftid) > 0) {
  2373. this.$message({ type: 'error', message: '饲料名称不能选择预混配方', duration: 2000 })
  2374. return false
  2375. }
  2376. }
  2377. // 校验顺序是否>=0
  2378. var ruleSort = /^\d+$/
  2379. if (!ruleSort.test(this.table2.temp.sort)) {
  2380. this.$message({ type: 'error', message: '饲料顺序不可为负数或小数', duration: 2000 })
  2381. return false
  2382. }
  2383. // 检验重量>0
  2384. this.table2.temp.fweight = formatNum(this.table2.temp.fweight, 4) // 根据默认参数设置小数位数
  2385. row.fweight = formatNum(row.fweight, 4)
  2386. // return
  2387. // var ruleWeight = /(^[1-9](\d+)?(\.\d{1,2})?$)|(^\d\.\d{1,2}$)/
  2388. //TODO:
  2389. // if (this.table2.temp.fweight == 0) {
  2390. // this.$message({ type: 'error', message: '重量请输入正数,最多保留四位小数', duration: 2000 })
  2391. // return false
  2392. // }
  2393. this.isokDisable = true
  2394. setTimeout(() => {
  2395. this.isokDisable = false
  2396. }, 1000)
  2397. let dateTime = parseTime(new Date(), '{y}-{m}-{d} {h}:{i}:{s}')
  2398. this.requestParam.common = { 'returnmap': '0' }
  2399. this.requestParam.createdate = dateTime
  2400. this.requestParam.userId = Cookies.get('employeid')
  2401. this.requestParam.data = []
  2402. this.requestParam.data[0] = { 'name': 'insertFTdetail', 'type': 'e', 'parammaps': {
  2403. pastureid: this.table2.temp.pastureid,
  2404. ftid: this.table2.getdataListParm.parammaps.ftid,
  2405. fid: row.fid,
  2406. fname: this.table2.temp.fname,
  2407. fweight: String(row.fweight),
  2408. islockcount: row.islockcount,
  2409. sort: row.sort,
  2410. feedgroup: row.feedgroup,
  2411. preftid: this.table2.temp.preftid,
  2412. autosecond: row.autosecond,
  2413. deviation: row.deviation,
  2414. shutdown: this.table2.temp.shutdown,
  2415. }}
  2416. this.requestParam.data[1] = { 'name': 'updateFPbyFTChange', 'type': 'e', 'parammaps': {
  2417. pastureid: this.table2.temp.pastureid,
  2418. ftid: this.table2.getdataListParm.parammaps.ftid,
  2419. type: this.table2.getdataListParm.parammaps.fttypeid,
  2420. status: 0
  2421. }}
  2422. this.requestParam.data[2] = { 'name': 'updateftversion', 'type': 'e', 'parammaps': {
  2423. pastureid: this.table2.getdataListParm.parammaps.pastureid,
  2424. id: this.table2.getdataListParm.parammaps.ftid
  2425. }}
  2426. this.requestParam.data[3] = { 'name': 'insertFitHistory', 'type': 'e', 'parammaps': {
  2427. weight: row.fweight,
  2428. preftid: this.table2.temp.preftid,
  2429. pastureid: this.table2.getdataListParm.parammaps.pastureid,
  2430. ftid: this.table2.getdataListParm.parammaps.ftid,
  2431. dateTime: dateTime,
  2432. slid: 0,
  2433. fid: row.fid,
  2434. autosecond: row.autosecond,
  2435. userId: Cookies.get('employeid')
  2436. }}
  2437. this.requestParam.data[4] = { 'name': 'insertFTHistory', 'type': 'e', 'parammaps': {
  2438. id:this.table2.getdataListParm.parammaps.ftid,
  2439. createdate:dateTime,
  2440. userId: Cookies.get('employeid')
  2441. }}
  2442. const url = 'authdata/ftdetail/edit'
  2443. const data = this.requestParam
  2444. postJson(url, data).then(response => {
  2445. if (response.msg !== 'fail') {
  2446. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  2447. this.getList2()
  2448. this.getList3()
  2449. } else {
  2450. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  2451. }
  2452. })
  2453. // ExecDataByConfig(this.requestParam).then(response => {
  2454. // console.log('新增保存发送参数', this.requestParam)
  2455. // if (response.msg !== 'fail') {
  2456. // this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  2457. // this.getList2()
  2458. // this.getList3()
  2459. // } else {
  2460. // this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  2461. // }
  2462. // })
  2463. },
  2464. createCancel2(row) {
  2465. console.log('点击了详情新增取消')
  2466. for (let i = 0; i < this.table2.list.length; i++) {
  2467. if (row.myId === this.table2.list[i].myId) {
  2468. var listIndex = this.table2.list.indexOf(this.table2.list[i])
  2469. }
  2470. if (listIndex > -1) {
  2471. this.table2.list.splice(listIndex, 1)
  2472. return
  2473. }
  2474. }
  2475. this.getDialogList()
  2476. },
  2477. // 详情编辑
  2478. handleUpdate2(row) {
  2479. console.log('详情编辑', row)
  2480. this.dropState = true
  2481. row.isGroupDisabled = false
  2482. row.islockcount = String(row.islockcount)
  2483. row.fid = String(row.fid)
  2484. // row.autosecond = String(row.autosecond)
  2485. row.autosecond = row.autosecond
  2486. row.deviation = row.deviation
  2487. this.table2.temp.fname = row.fname
  2488. this.table2.temp.preftid = row.preftid
  2489. const rowArr = []
  2490. for (let i = 0; i < this.table2.list.length; i++) {
  2491. if (this.table2.list[i].Edit == true) {
  2492. this.$message({ type: 'error', message: '当前内容未保存,请点击取消或保存继续进行操作', duration: 2000 })
  2493. return false
  2494. }
  2495. rowArr.push(this.table2.list[i].sort)
  2496. }
  2497. var count = 0
  2498. for (let i = 0; i < rowArr.length; i++) {
  2499. if (rowArr[i] == row.sort) {
  2500. count++
  2501. }
  2502. }
  2503. // 判断是否有相同顺序,如果没有饲料组不可编辑,若有饲料组可编辑
  2504. if (count == 1) {
  2505. // 饲料组编辑false,不可编辑true
  2506. row.groupEdit = false
  2507. row.groupNoEdit = true
  2508. // 编辑true,不可编辑false
  2509. row.Edit = true
  2510. row.NoEdit = false
  2511. // 新增false,编辑false,编辑保存true
  2512. row.isCreate = false
  2513. row.isUpdate = false
  2514. row.isUpdateSave = true
  2515. } else if (count > 1) {
  2516. // 饲料组编辑true,不可编辑false
  2517. row.groupEdit = true
  2518. row.groupNoEdit = false
  2519. console.log(222)
  2520. // 编辑true,不可编辑false
  2521. row.Edit = true
  2522. row.NoEdit = false
  2523. // 新增false,编辑false,编辑保存true
  2524. row.isCreate = false
  2525. row.isUpdate = false
  2526. row.isUpdateSave = true
  2527. return false
  2528. }
  2529. this.table2.updateList = Object.assign({}, row)
  2530. },
  2531. updateData2(row) {
  2532. console.log('点击了详情编辑保存', row)
  2533. this.isokDisable = true
  2534. setTimeout(() => {
  2535. this.isokDisable = false
  2536. }, 1000)
  2537. console.log(row.autosecond,'======')
  2538. if(row.autosecond == null || row.autosecond == undefined || isNaN(row.autosecond)){
  2539. row.autosecond = '0'
  2540. }
  2541. this.table2.temp.pastureid = row.pastureid
  2542. this.table2.temp.ftid = this.table2.getdataListParm.parammaps.ftid
  2543. this.table2.temp.fid = row.fid
  2544. this.table2.temp.fname = this.table2.temp.fname
  2545. this.table2.temp.fweight = row.fweight
  2546. this.table2.temp.islockcount = row.islockcount
  2547. this.table2.temp.sort = row.sort
  2548. this.table2.temp.feedgroup = row.feedgroup
  2549. this.table2.temp.preftid = this.table2.temp.preftid
  2550. this.table2.temp.autosecond = row.autosecond
  2551. this.table2.temp.deviation = row.deviation
  2552. this.table2.temp.shutdown = row.shutdown
  2553. this.table2.temp.id = row.id
  2554. console.log('this.table2.updateList', this.table2.updateList)
  2555. console.log('temp', this.table2.temp)
  2556. // var status = ''
  2557. // if (parseFloat(this.table2.temp.fweight) > parseFloat(this.table2.updateList.fweight)) {
  2558. // status = 0
  2559. // } else {
  2560. // status = 1
  2561. // }
  2562. if (this.table2.temp.fid === '' && this.table2.temp.fweight === '' && this.table2.temp.autosecond === '' && this.table2.temp.deviation === '') {
  2563. this.$message({ type: 'error', message: '饲料名称/重量/搅拌延时/允许延时偏差不能为空', duration: 2000 })
  2564. return false
  2565. } else if (this.table2.temp.fweight === '' && this.table2.temp.autosecond === '' && this.table2.temp.deviation === '') {
  2566. this.$message({ type: 'error', message: '重量/搅拌延时/允许延时偏差不能为空', duration: 2000 })
  2567. return false
  2568. } else if (this.table2.temp.autosecond === '' && this.table2.temp.deviation === '') {
  2569. this.$message({ type: 'error', message: '搅拌延时/允许延时偏差不能为空1=', duration: 2000 })
  2570. return false
  2571. }else if (this.table2.temp.fid === '') {
  2572. this.$message({ type: 'error', message: '饲料名称不能为空', duration: 2000 })
  2573. return false
  2574. }
  2575. //TODO:
  2576. // else if (this.table2.temp.fweight === '') {
  2577. // this.$message({ type: 'error', message: '重量不能为空', duration: 2000 })
  2578. // return false
  2579. // }
  2580. else if (this.table2.temp.autosecond === '') {
  2581. this.$message({ type: 'error', message: '搅拌延时不能为空', duration: 2000 })
  2582. return false
  2583. } else if (this.table2.temp.deviation === '') {
  2584. this.$message({ type: 'error', message: '允许延时偏差不能为空', duration: 2000 })
  2585. return false
  2586. }
  2587. if(parseFloat(this.table2.temp.deviation) > parseFloat(this.table2.temp.autosecond)){
  2588. this.$message({ type: 'error', message: '允许延时偏差不可超出搅拌延时', duration: 2000 })
  2589. return false
  2590. }
  2591. if (this.table2.temp.shutdown == '') {
  2592. this.table2.temp.shutdown = 0
  2593. }
  2594. if (this.table2.temp.sort !== '') {
  2595. this.table2.temp.sort = this.table2.temp.sort
  2596. } else {
  2597. this.table2.temp.sort = parseInt(this.table2.list[this.table2.list.length - 1].sort) + 1
  2598. }
  2599. if (this.table2.getdataListParm.parammaps.fttypeid == 2) {
  2600. if (parseInt(this.table2.temp.preftid) > 0) {
  2601. this.$message({ type: 'error', message: '饲料名称不能选择预混配方', duration: 2000 })
  2602. return false
  2603. }
  2604. }
  2605. // 校验顺序是否>=0
  2606. var ruleSort = /^\d+$/
  2607. if (!ruleSort.test(this.table2.temp.sort)) {
  2608. this.$message({ type: 'error', message: '饲料顺序不可为负数或小数', duration: 2000 })
  2609. return false
  2610. }
  2611. this.table2.temp.fweight = formatNum(this.table2.temp.fweight, 4) // 根据默认参数设置小数位数
  2612. row.fweight = formatNum(row.fweight, 4)
  2613. // 检验重量>0
  2614. // var ruleWeight = /(^[1-9](\d+)?(\.\d{1,2})?$)|(^\d\.\d{1,2}$)/
  2615. //TODO:
  2616. // if (this.table2.temp.fweight == 0) {
  2617. // this.$message({ type: 'error', message: '重量请输入正数,最多保留四位小数', duration: 2000 })
  2618. // return false
  2619. // }
  2620. console.log(row.fweight,'row.fweight')
  2621. let dateTime = parseTime(new Date(), '{y}-{m}-{d} {h}:{i}:{s}')
  2622. this.requestParam.common = { 'returnmap': '0' }
  2623. this.requestParam.createdate = dateTime
  2624. this.requestParam.userId = Cookies.get('employeid')
  2625. this.requestParam.data = []
  2626. this.requestParam.data[0] = { 'name': 'insertFitHistory', 'type': 'e', 'parammaps': {
  2627. pastureid: row.pastureid,
  2628. ftid: this.table2.getdataListParm.parammaps.ftid,
  2629. weight: String(row.fweight),
  2630. preftid: this.table2.temp.preftid,
  2631. dateTime: dateTime,
  2632. slid: this.table2.temp.id,
  2633. fid: row.fid,
  2634. autosecond: row.autosecond,
  2635. userId: Cookies.get('employeid')
  2636. }}
  2637. this.requestParam.data[1] = { 'name': 'updateFTdetail', 'type': 'e', 'parammaps': {
  2638. pastureid: row.pastureid,
  2639. ftid: this.table2.getdataListParm.parammaps.ftid,
  2640. fid: row.fid,
  2641. fname: this.table2.temp.fname,
  2642. fweight: String(row.fweight),
  2643. islockcount: row.islockcount,
  2644. sort: row.sort,
  2645. feedgroup: row.feedgroup,
  2646. preftid: this.table2.temp.preftid,
  2647. autosecond: row.autosecond,
  2648. id: row.id,
  2649. deviation:row.deviation,
  2650. shutdown: this.table2.temp.shutdown,
  2651. }}
  2652. this.requestParam.data[2] = { 'name': 'updateFPbyFTChange', 'type': 'e', 'parammaps': {
  2653. pastureid: row.pastureid,
  2654. ftid: this.table2.getdataListParm.parammaps.ftid,
  2655. type: this.table2.getdataListParm.parammaps.fttypeid,
  2656. // status: status
  2657. }}
  2658. this.requestParam.data[3] = { 'name': 'updateFTdetailbySort', 'type': 'e', 'parammaps': {
  2659. pastureid: row.pastureid,
  2660. ftid: this.table2.getdataListParm.parammaps.ftid,
  2661. sort: row.sort,
  2662. feedgroup: row.feedgroup
  2663. }}
  2664. this.requestParam.data[4] = { 'name': 'updateFTdetailGroup', 'type': 'e', 'parammaps': {
  2665. pastureid: this.table2.getdataListParm.parammaps.pastureid,
  2666. ftid: this.table2.getdataListParm.parammaps.ftid
  2667. }}
  2668. this.requestParam.data[5] = { 'name': 'insertFTHistory', 'type': 'e', 'parammaps': {
  2669. id:this.table2.getdataListParm.parammaps.ftid,
  2670. createdate:dateTime,
  2671. userId: Cookies.get('employeid')
  2672. }}
  2673. const url = 'authdata/ftdetail/edit'
  2674. const data = this.requestParam
  2675. postJson(url, data).then(response => {
  2676. if (response.msg !== 'fail') {
  2677. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  2678. this.getList2()
  2679. this.getList3()
  2680. this.dropState = false
  2681. } else {
  2682. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  2683. }
  2684. })
  2685. // ExecDataByConfig(this.requestParam).then(response => {
  2686. // console.log('新增保存发送参数', this.requestParam)
  2687. // if (response.msg !== 'fail') {
  2688. // this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  2689. // this.getList2()
  2690. // this.getList3()
  2691. // this.dropState = false
  2692. // } else {
  2693. // this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  2694. // }
  2695. // })
  2696. },
  2697. updateCancel2(row) {
  2698. console.log('点击了详情编辑取消')
  2699. // 饲料组编辑false,不可编辑true
  2700. row.groupEdit = false
  2701. row.groupNoEdit = true
  2702. // 编辑false,不可编辑true
  2703. row.Edit = false
  2704. row.NoEdit = true
  2705. // 新增false,编辑true,编辑保存false
  2706. row.isCreate = false
  2707. row.isUpdate = true
  2708. row.isUpdateSave = false
  2709. this.getList2()
  2710. this.dropState = false
  2711. },
  2712. // 详情删除
  2713. handleRowDelete2(row) {
  2714. console.log('点击了行内删除')
  2715. MessageBox.confirm('是否确认删除此信息?', {
  2716. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  2717. }).then(() => {
  2718. console.log(this.table2.list.length)
  2719. let dateTime = parseTime(new Date(), '{y}-{m}-{d} {h}:{i}:{s}')
  2720. if (this.table2.list.length > 1) {
  2721. this.requestParam.common = { 'returnmap': '0' }
  2722. this.requestParam.createdate = dateTime
  2723. this.requestParam.data = []
  2724. this.requestParam.data[0] = { 'name': 'insertFitHistory', 'type': 'e', 'parammaps': {
  2725. pastureid: row.pastureid,
  2726. ftid: this.table2.getdataListParm.parammaps.ftid,
  2727. weight: 0,
  2728. preftid: row.preftid,
  2729. dateTime: dateTime,
  2730. slid: row.id,
  2731. fid: row.fid,
  2732. autosecond: row.autosecond,
  2733. userId: Cookies.get('employeid')
  2734. }}
  2735. this.requestParam.data[1] = { 'name': 'deleteFTdetail', 'type': 'e', 'parammaps': {
  2736. pastureid: row.pastureid,
  2737. id: row.id
  2738. }}
  2739. this.requestParam.data[2] = { 'name': 'updateFPbyFTChange', 'type': 'e', 'parammaps': {
  2740. pastureid: row.pastureid,
  2741. ftid: this.table2.getdataListParm.parammaps.ftid,
  2742. type: this.table2.getdataListParm.parammaps.fttypeid,
  2743. status: 1
  2744. }}
  2745. this.requestParam.data[3] = { 'name': 'updateftversion', 'type': 'e', 'parammaps': {
  2746. pastureid: this.table2.getdataListParm.parammaps.pastureid,
  2747. id: this.table2.getdataListParm.parammaps.ftid
  2748. }}
  2749. this.requestParam.data[4] = { 'name': 'insertFTHistory', 'type': 'e', 'parammaps': {
  2750. id:this.table2.getdataListParm.parammaps.ftid,
  2751. createdate:dateTime,
  2752. userId: Cookies.get('employeid')
  2753. }}
  2754. } else {
  2755. this.requestParam.common = { 'returnmap': '0' }
  2756. this.requestParam.createdate = dateTime
  2757. this.requestParam.userId = Cookies.get('employeid')
  2758. this.requestParam.data = []
  2759. // this.requestParam.data[1] = { 'name': 'checkdeleteFT', 'type': 'v', 'parammaps': {
  2760. // pastureid: this.table2.getdataListParm.parammaps.pastureid,
  2761. // id: this.table2.getdataListParm.parammaps.ftid
  2762. // }}
  2763. this.requestParam.data[0] = { 'name': 'insertFitHistory', 'type': 'e', 'parammaps': {
  2764. pastureid: row.pastureid,
  2765. ftid: this.table2.getdataListParm.parammaps.ftid,
  2766. weight: 0,
  2767. preftid: row.preftid,
  2768. dateTime: dateTime,
  2769. slid: row.id,
  2770. fid: row.fid,
  2771. autosecond: row.autosecond,
  2772. userId: Cookies.get('employeid')
  2773. }}
  2774. this.requestParam.data[1] = { 'name': 'deleteFTdetail', 'type': 'e', 'parammaps': {
  2775. pastureid: row.pastureid,
  2776. id: row.id
  2777. }}
  2778. this.requestParam.data[2] = { 'name': 'updateFPbyFTChange', 'type': 'e', 'parammaps': {
  2779. pastureid: row.pastureid,
  2780. ftid: this.table2.getdataListParm.parammaps.ftid,
  2781. type: this.table2.getdataListParm.parammaps.fttypeid,
  2782. status: 1
  2783. }}
  2784. this.requestParam.data[3] = { 'name': 'updateftversion', 'type': 'e', 'parammaps': {
  2785. pastureid: this.table2.getdataListParm.parammaps.pastureid,
  2786. id: this.table2.getdataListParm.parammaps.ftid
  2787. }}
  2788. this.requestParam.data[4] = { 'name': 'insertFTHistory', 'type': 'e', 'parammaps': {
  2789. id:this.table2.getdataListParm.parammaps.ftid,
  2790. createdate:dateTime,
  2791. userId: Cookies.get('employeid')
  2792. }}
  2793. }
  2794. const url = 'authdata/ftdetail/edit'
  2795. const data = this.requestParam
  2796. postJson(url, data).then(response => {
  2797. if (response.msg !== 'fail') {
  2798. this.$notify({ title: '成功', message: '删除成功', type: 'success', duration: 2000 })
  2799. this.getList2()
  2800. this.getList3()
  2801. } else {
  2802. this.$notify({ title: '删除失败', message: response.data, type: 'warning', duration: 2000 })
  2803. }
  2804. })
  2805. // ExecDataByConfig(this.requestParam).then(response => {
  2806. // console.log('新增保存发送参数', this.requestParam)
  2807. // if (response.msg === 'fail') {
  2808. // this.$notify({ title: '删除失败', message: response.data, type: 'warning', duration: 2000 })
  2809. // } else {
  2810. // this.$notify({ title: '成功', message: '删除成功', type: 'success', duration: 2000 })
  2811. // this.getList2()
  2812. // this.getList3()
  2813. // }
  2814. // })
  2815. }).catch(() => {
  2816. this.$message({ type: 'info', message: '已取消删除' })
  2817. })
  2818. },
  2819. handleSelectionChange2(val) {
  2820. console.log('勾选数据', val)
  2821. this.selectList2 = val
  2822. },
  2823. celldblclick(row, column, cell, event) {
  2824. console.log(row, '=====')
  2825. this.handleUpdate2(row)
  2826. },
  2827. form_delete2() {
  2828. console.log('点击了删除')
  2829. if (this.selectList2.length == 0) {
  2830. this.$message({ type: 'error', message: '请选择配方详情', duration: 2000 })
  2831. } else {
  2832. MessageBox.confirm('是否确认删除此信息?', {
  2833. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  2834. }).then(() => {
  2835. console.log(this.table2.list.length - this.selectList2.length)
  2836. let dateTime = parseTime(new Date(), '{y}-{m}-{d} {h}:{i}:{s}')
  2837. if (this.table2.list.length - this.selectList2.length > 0) {
  2838. this.requestParam.common = { 'returnmap': '0' }
  2839. this.requestParam.createdate = dateTime
  2840. this.requestParam.userId = Cookies.get('employeid')
  2841. this.requestParam.data = []
  2842. this.requestParam.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.selectList2 }}
  2843. this.requestParam.data[0].children = []
  2844. this.requestParam.data[0].children[0] = { 'name': 'insertFitHistory', 'type': 'e', 'parammaps': {
  2845. pastureid: '@insertSpotList.pastureid',
  2846. ftid: '@insertSpotList.ftid',
  2847. weight: 0,
  2848. preftid: '@insertSpotList.preftid',
  2849. dateTime: dateTime,
  2850. slid: '@insertSpotList.id',
  2851. fid: '@insertSpotList.fid',
  2852. autosecond: '@insertSpotList.autosecond',
  2853. userId: Cookies.get('employeid')
  2854. }}
  2855. this.requestParam.data[0].children[1] = { 'name': 'deleteFTdetail', 'type': 'e', 'parammaps': {
  2856. id: '@insertSpotList.id',
  2857. pastureid: '@insertSpotList.pastureid'
  2858. }}
  2859. this.requestParam.data[1] = { 'name': 'updateftversion', 'type': 'e', 'parammaps': {
  2860. pastureid: this.table2.getdataListParm.parammaps.pastureid,
  2861. id: this.table2.getdataListParm.parammaps.ftid
  2862. }}
  2863. this.requestParam.data[2] = { 'name': 'updateFPbyFTChange', 'type': 'e', 'parammaps': {
  2864. pastureid: this.table2.getdataListParm.parammaps.pastureid,
  2865. ftid:this.table2.getdataListParm.parammaps.ftid,
  2866. type: this.table2.getdataListParm.parammaps.fttypeid,
  2867. status: 1
  2868. }}
  2869. this.requestParam.data[3] = { 'name': 'insertFTHistory', 'type': 'e', 'parammaps': {
  2870. id:this.table2.getdataListParm.parammaps.ftid,
  2871. createdate:dateTime,
  2872. userId: Cookies.get('employeid')
  2873. }}
  2874. const url = 'authdata/ftdetail/edit'
  2875. const data = this.requestParam
  2876. postJson(url, data).then(response => {
  2877. if (response.msg !== 'fail') {
  2878. this.$notify({ title: '成功', message: '删除成功', type: 'success', duration: 2000 })
  2879. this.getList2()
  2880. this.getList3()
  2881. } else {
  2882. this.$notify({ title: '删除失败', message: response.data, type: 'warning', duration: 2000 })
  2883. }
  2884. })
  2885. } else {
  2886. this.requestParam.common = { 'returnmap': '0' }
  2887. this.requestParam.data = []
  2888. // this.requestParam.data[0] = { 'name': 'checkdeleteFT', 'type': 'v', 'parammaps': {
  2889. // pastureid: this.table2.getdataListParm.parammaps.pastureid,
  2890. // id: this.table2.getdataListParm.parammaps.ftid
  2891. // }}
  2892. // this.requestParam.data[1] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.selectList2 }}
  2893. // this.requestParam.data[1].children = []
  2894. // this.requestParam.data[1].children[0] = { 'name': 'deleteFTdetail', 'type': 'e', 'parammaps': {
  2895. // id: '@insertSpotList.id',
  2896. // pastureid: '@insertSpotList.pastureid'
  2897. // }}
  2898. this.requestParam.data[0] = { 'name': 'updateftversion', 'type': 'e', 'parammaps': {
  2899. pastureid: this.table2.getdataListParm.parammaps.pastureid,
  2900. id: this.table2.getdataListParm.parammaps.ftid
  2901. }}
  2902. // this.requestParam.data[3] = { 'name': 'updateFPbyFTChange', 'type': 'e', 'parammaps': {
  2903. // pastureid: this.table2.getdataListParm.parammaps.pastureid,
  2904. // ftid:this.table2.getdataListParm.parammaps.ftid,
  2905. // type: this.table2.getdataListParm.parammaps.fttypeid,
  2906. // status: 1
  2907. // }}
  2908. ExecDataByConfig(this.requestParam).then(response => {
  2909. console.log('删除保存发送参数', this.requestParam)
  2910. if (response.msg === 'fail') {
  2911. this.$notify({ title: '删除失败', message: response.data, type: 'warning', duration: 2000 })
  2912. } else {
  2913. const url = 'authdata/ftdetai/del'
  2914. const data = {}
  2915. data.parammaps = {}
  2916. data.parammaps.pastureid = this.table2.getdataListParm.parammaps.pastureid
  2917. data.parammaps.ftid = this.table2.getdataListParm.parammaps.ftid
  2918. data.parammaps.type = this.table2.getdataListParm.parammaps.fttypeid
  2919. postJson(url, data).then(response => {
  2920. if (response.msg !== 'fail') {
  2921. this.$notify({ title: '成功', message: '删除成功', type: 'success', duration: 2000 })
  2922. this.getList2()
  2923. this.getList3()
  2924. } else {
  2925. this.$notify({ title: '删除失败', message: response.data, type: 'warning', duration: 2000 })
  2926. }
  2927. })
  2928. }
  2929. })
  2930. }
  2931. })
  2932. }
  2933. },
  2934. // 拆分预混料
  2935. handleSplitPremix(row) {
  2936. console.log('点击了拆分预混料')
  2937. MessageBox.confirm('是否确认拆分当前预混料?', {
  2938. confirmButtonText: '确认',
  2939. cancelButtonText: '取消',
  2940. type: 'warning'
  2941. }).then(() => {
  2942. this.requestParam.name = 'splitFTpre'
  2943. this.requestParam.parammaps = {}
  2944. this.requestParam.parammaps.ftid = this.table2.getdataListParm.parammaps.ftid
  2945. this.requestParam.parammaps.preftid = row.preftid
  2946. this.requestParam.parammaps.ftdid = row.id
  2947. this.requestParam.parammaps.pastureid = row.pastureid
  2948. this.requestParam.parammaps.feedgroup = row.feedgroup
  2949. this.requestParam.parammaps.sort = row.sort
  2950. this.requestParam.parammaps.fweight = row.fweight
  2951. PostDataByName(this.requestParam).then(response => {
  2952. if (response.msg === 'fail') {
  2953. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  2954. } else {
  2955. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  2956. this.getList2()
  2957. this.getList3()
  2958. }
  2959. })
  2960. }).catch(() => {
  2961. this.$message({
  2962. type: 'info',
  2963. message: '已取消删除'
  2964. })
  2965. })
  2966. },
  2967. // 合成预混料
  2968. handleSyntheticPremix() {
  2969. console.log('点击了合成预混料', this.selectList2)
  2970. this.dialogFull = false
  2971. if (this.table2.getdataListParm.parammaps.fttypeid == 2) {
  2972. this.$message({ type: 'error', message: '预混配方不可合成预混料', duration: 2000 })
  2973. return false
  2974. } else {
  2975. if (this.selectList2.length > 1) {
  2976. for (let i = 0; i < this.selectList2.length; i++) {
  2977. if (parseInt(this.selectList2[i].preftid) > 0) {
  2978. this.$message({ type: 'error', message: '不可选择预混料', duration: 2000 })
  2979. return false
  2980. }
  2981. }
  2982. if (this.selectList2[0].splitftpreid !== undefined) {
  2983. this.detail.getdataListParm.parammaps.ftid = this.selectList2[0].splitftpreid
  2984. this.detail.getdataListParm.parammaps.pastureid = this.selectList2[0].pastureid
  2985. GetDataByName(this.detail.getdataListParm).then(response => {
  2986. if (response.data.list !== null) { // 不为空时得到比对数据
  2987. this.detail.list3 = response.data.list
  2988. const sortList = [] // 声明排序数组
  2989. var fweightSum = 0 // 总重量
  2990. for (let i = 0; i < this.selectList2.length; i++) {
  2991. const obj = {}
  2992. obj.fid = this.selectList2[i].fid
  2993. obj.fweight = this.selectList2[i].fweight
  2994. fweightSum = fweightSum + parseFloat(this.selectList2[i].fweight)
  2995. sortList.push(obj)
  2996. }
  2997. // 排序
  2998. sortList.sort(function(a, b) {
  2999. return a.fid.localeCompare(b.fid)
  3000. })
  3001. var a = 0
  3002. if (this.detail.list3.length == sortList.length) {
  3003. for (let i = 0; i < this.detail.list3.length; i++) {
  3004. if (this.detail.list3[i].fid == sortList[i].fid && (this.detail.list3[i].fweight / this.detail.list3[i].sumWeight).toFixed(3) == (sortList[i].fweight / fweightSum).toFixed(3)) {
  3005. a++
  3006. }
  3007. }
  3008. if (a == this.detail.list3.length) { // 如果相等,则该配方为原预混配方
  3009. this.detail.getdataListParm2.parammaps.ftid = this.selectList2[0].splitftpreid
  3010. this.detail.getdataListParm2.parammaps.pastureid = this.selectList2[0].pastureid
  3011. GetDataByName(this.detail.getdataListParm2).then(response => {
  3012. if (response.data.list !== null) {
  3013. this.detail.dialogStatus = 'SyntheticPremix'
  3014. this.detail.dialogFormVisible = true
  3015. this.detail.list = this.selectList2
  3016. this.detail.list2 = response.data.list
  3017. this.detail.disabled = true
  3018. setTimeout(() => {
  3019. this.detail.listLoading = false
  3020. }, 100)
  3021. } else {
  3022. this.detail.list2 = []
  3023. }
  3024. })
  3025. } else {
  3026. this.detail.dialogStatus = 'SyntheticPremix'
  3027. this.detail.dialogFormVisible = true
  3028. this.detail.list = this.selectList2
  3029. this.detail.disabled = false
  3030. this.detail.list2 = [{ tname: '', tcolor: '#ccc', ccid: '', fttype: '预混配方', fttypeid: '2', source: '自定义', remark: '', 'enable': 1,volume:'' }]
  3031. setTimeout(() => {
  3032. this.detail.listLoading = false
  3033. }, 100)
  3034. }
  3035. } else {
  3036. this.detail.dialogStatus = 'SyntheticPremix'
  3037. this.detail.dialogFormVisible = true
  3038. this.detail.list = this.selectList2
  3039. this.detail.disabled = false
  3040. this.detail.list2 = [{ tname: '', tcolor: '#ccc', ccid: '', fttype: '预混配方', fttypeid: '2', source: '自定义', remark: '', 'enable': 1,volume:'' }]
  3041. setTimeout(() => {
  3042. this.detail.listLoading = false
  3043. }, 100)
  3044. }
  3045. } else {
  3046. this.detail.list3 = []
  3047. this.detail.dialogStatus = 'SyntheticPremix'
  3048. this.detail.dialogFormVisible = true
  3049. this.detail.list = this.selectList2
  3050. this.detail.disabled = false
  3051. this.detail.list2 = [{ tname: '', tcolor: '#ccc', ccid: '', fttype: '预混配方', fttypeid: '2', source: '自定义', remark: '', 'enable': 1,volume:'' }]
  3052. setTimeout(() => {
  3053. this.detail.listLoading = false
  3054. }, 100)
  3055. }
  3056. })
  3057. } else {
  3058. this.detail.dialogStatus = 'SyntheticPremix'
  3059. this.detail.dialogFormVisible = true
  3060. this.detail.list = this.selectList2
  3061. this.detail.disabled = false
  3062. this.detail.list2 = [{ tname: '', tcolor: '#ccc', ccid: '', fttype: '预混配方', fttypeid: '2', source: '自定义', remark: '', 'enable': 1,volume:'' }]
  3063. setTimeout(() => {
  3064. this.detail.listLoading = false
  3065. }, 100)
  3066. }
  3067. } else {
  3068. this.$message({ type: 'error', message: '请选择俩条及以上饲料进行合成', duration: 2000 })
  3069. return false
  3070. }
  3071. }
  3072. },
  3073. // 畜生类别
  3074. changeLivestockType2(item) {
  3075. this.detail.list2[0].ccname = this.livestockTypeList.find(obj => obj.value === item).label
  3076. },
  3077. syntheticPremixData() {
  3078. console.log('点击了合成预混料确认')
  3079. if (this.detail.disabled == true) { // 原预混料
  3080. let sumFweight = 0
  3081. for (let i = 0; i < this.detail.list.length; i++) {
  3082. sumFweight += parseFloat(this.detail.list[i].fweight)
  3083. }
  3084. sumFweight = sumFweight.toFixed(3)
  3085. this.isokDisable = true
  3086. setTimeout(() => {
  3087. this.isokDisable = false
  3088. }, 1000)
  3089. this.requestParam.common = { 'returnmap': '0' }
  3090. this.requestParam.data = []
  3091. this.requestParam.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.detail.list }}
  3092. this.requestParam.data[0].children = []
  3093. this.requestParam.data[0].children[0] = { 'name': 'deleteFTdetail', 'type': 'e', 'parammaps': {
  3094. pastureid: '@insertSpotList.pastureid',
  3095. id: '@insertSpotList.id'
  3096. }}
  3097. this.requestParam.data[1] = { 'name': 'insertSpotList2', 'resultmaps': { 'list': this.detail.list2 }}
  3098. this.requestParam.data[1].children = []
  3099. this.requestParam.data[1].children[0] = { 'name': 'insertFTdetail', 'type': 'e', 'parammaps': {
  3100. pastureid: Cookies.get('pastureid'),
  3101. ftid: this.table2.getdataListParm.parammaps.ftid,
  3102. fid: this.detail.list2[0].id,
  3103. fname: '@insertSpotList2.tname',
  3104. shutdown: '0',
  3105. fweight: sumFweight,
  3106. islockcount: '0',
  3107. sort: parseInt(this.table2.list[this.table2.list.length - 1].sort) + 1,
  3108. feedgroup: '@insertSpotList2.tname',
  3109. preftid: this.detail.list2[0].id,
  3110. autosecond: this.detail.list[0].autosecond
  3111. }}
  3112. ExecDataByConfig(this.requestParam).then(response => {
  3113. console.log('合成预混料保存发送参数', this.requestParam)
  3114. if (response.msg === 'fail') {
  3115. const tname = new RegExp("key 'tname'")
  3116. if (tname.test(response.data)) {
  3117. this.$message({ type: 'error', message: '预混配方已存在,不可重复生成', duration: 2000 })
  3118. } else {
  3119. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  3120. }
  3121. } else {
  3122. this.$notify({ title: '', message: '保存成功', type: 'success', duration: 2000 })
  3123. this.detail.dialogFormVisible = false
  3124. this.getList3()
  3125. this.getList2()
  3126. this.getDownList()
  3127. }
  3128. })
  3129. } else { // 现生成预混料
  3130. if (this.detail.list2[0].tname == '' && this.detail.list2[0].ccid == '') {
  3131. this.$message({ type: 'error', message: '配方名称/牲畜类别/不能为空', duration: 2000 })
  3132. return false
  3133. } else if (this.detail.list2[0].tname == '') {
  3134. this.$message({ type: 'error', message: '配方名称不能为空', duration: 2000 })
  3135. return false
  3136. } else if (this.detail.list2[0].ccid == '') {
  3137. this.$message({ type: 'error', message: '牲畜类别不能为空', duration: 2000 })
  3138. return false
  3139. }
  3140. const pattern = new RegExp("[`~!@#$^&*()=|{}':;',\\[\\].<>/?~!@#¥……&*()——|{}【】‘;:”“'。,、?]")
  3141. if (pattern.test(this.detail.list2[0].tname)) {
  3142. this.$message({ type: 'error', message: '配方名称不可输入特殊字符', duration: 2000 })
  3143. return false
  3144. }
  3145. let sumFweight = 0
  3146. for (let i = 0; i < this.detail.list.length; i++) {
  3147. sumFweight += parseFloat(this.detail.list[i].fweight)
  3148. }
  3149. sumFweight = sumFweight.toFixed(3)
  3150. console.log(sumFweight)
  3151. this.isokDisable = true
  3152. setTimeout(() => {
  3153. this.isokDisable = false
  3154. }, 1000)
  3155. if (this.detail.list2[0].tcolor == null) {
  3156. this.detail.list2[0].tcolor = '#CCCCCC'
  3157. }
  3158. this.requestParam.common = { 'returnmap': '0' }
  3159. this.requestParam.data = []
  3160. this.requestParam.data[0] = { 'name': 'insertFT', 'type': 'e', 'parammaps': {
  3161. pastureid: Cookies.get('pastureid'),
  3162. tcode: this.detail.list2[0].tcode,
  3163. tname: this.detail.list2[0].tname,
  3164. tcolor: this.detail.list2[0].tcolor,
  3165. ccid: this.detail.list2[0].ccid,
  3166. ccname: this.detail.list2[0].ccname,
  3167. fttype: this.detail.list2[0].fttype,
  3168. fttypeid: this.detail.list2[0].fttypeid,
  3169. source: this.detail.list2[0].source,
  3170. remark: this.detail.list2[0].remark,
  3171. enable: this.detail.list2[0].enable,
  3172. volume:this.detail.list2[0].volume
  3173. }}
  3174. this.requestParam.data[1] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.detail.list }}
  3175. this.requestParam.data[1].children = []
  3176. this.requestParam.data[1].children[0] = { 'name': 'insertFTdetail', 'type': 'e', 'parammaps': {
  3177. pastureid: '@insertSpotList.pastureid',
  3178. ftid: '@insertFT.LastInsertId',
  3179. fid: '@insertSpotList.fid',
  3180. fname: '@insertSpotList.fname',
  3181. fweight: '@insertSpotList.fweight',
  3182. islockcount: '@insertSpotList.islockcount',
  3183. sort: '@insertSpotList.sort',
  3184. feedgroup: '@insertSpotList.feedgroup',
  3185. preftid: '@insertSpotList.preftid',
  3186. autosecond: '@insertSpotList.autosecond',
  3187. shutdown: '@insertSpotList.shutdown'
  3188. }}
  3189. this.requestParam.data[1].children[1] = { 'name': 'deleteFTdetail', 'type': 'e', 'parammaps': {
  3190. pastureid: '@insertSpotList.pastureid',
  3191. id: '@insertSpotList.id'
  3192. }}
  3193. this.requestParam.data[2] = { 'name': 'insertSpotList2', 'resultmaps': { 'list': this.detail.list2 }}
  3194. this.requestParam.data[2].children = []
  3195. this.requestParam.data[2].children[0] = { 'name': 'insertFTdetail', 'type': 'e', 'parammaps': {
  3196. pastureid: Cookies.get('pastureid'),
  3197. ftid: this.table2.getdataListParm.parammaps.ftid,
  3198. fid: '@insertFT.LastInsertId',
  3199. fname: '@insertSpotList2.tname',
  3200. shutdown: '0',
  3201. fweight: sumFweight,
  3202. islockcount: '0',
  3203. sort: parseInt(this.table2.list[this.table2.list.length - 1].sort) + 1,
  3204. feedgroup: '@insertSpotList2.tname',
  3205. preftid: '@insertFT.LastInsertId',
  3206. autosecond: this.detail.list[0].autosecond
  3207. }}
  3208. ExecDataByConfig(this.requestParam).then(response => {
  3209. console.log('合成预混料保存发送参数', this.requestParam)
  3210. if (response.msg === 'fail') {
  3211. const tname = new RegExp("key 'tname'")
  3212. if (tname.test(response.data)) {
  3213. this.$message({ type: 'error', message: '预混配方已存在,不可重复生成', duration: 2000 })
  3214. } else {
  3215. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  3216. }
  3217. } else {
  3218. this.$notify({ title: '', message: '保存成功', type: 'success', duration: 2000 })
  3219. this.detail.dialogFormVisible = false
  3220. this.getList3()
  3221. this.getList2()
  3222. this.getDownList()
  3223. }
  3224. })
  3225. }
  3226. },
  3227. handleFormulationEvaluation(row) {
  3228. console.log(row)
  3229. // this.$router.push({ path: '/statisticalAnalysis/FormulationEvaluation', query: { tname: row.tname }})
  3230. this.$router.push({
  3231. name: 'FormulationEvaluation',
  3232. params: {
  3233. tname: row.tname,
  3234. ftid: row.id,
  3235. pastureid: row.pastureid,
  3236. startTime: parseTime(new Date(), '{y}-{m}-{d}'),
  3237. inputDatetime: [new Date('startTime'), new Date('startTime')], // 日期后台待传
  3238. stopTime: parseTime(new Date(), '{y}-{m}-{d}')
  3239. }
  3240. })
  3241. },
  3242. // 配方记录
  3243. handleRowRecipeRecord(row) {
  3244. console.log(row)
  3245. this.rowRecipeRecord.temp = Object.assign({}, row)
  3246. this.rowRecipeRecord.dialogFormVisible = true
  3247. this.textMap.rowRecipeRecordTxt = '配方修改记录——配方:' + row.tname
  3248. this.rowRecipeRecord.dialogStatus = 'rowRecipeRecordTxt'
  3249. this.rowRecipeRecord.getdataListParm.parammaps.pastureid = row.pastureid
  3250. this.rowRecipeRecord.getdataListParm.parammaps.fitid = row.id
  3251. this.rowRecipeRecord.getdataListParm.parammaps.inputDatetime = []
  3252. this.getRowRecipeRecordList()
  3253. },
  3254. getRowRecipeRecordList() {
  3255. this.rowRecipeRecord.listLoading = true
  3256. this.rowRecipeRecord.getdataListParm.parammaps.fitid = this.rowRecipeRecord.temp.id
  3257. if (this.rowRecipeRecord.getdataListParm.parammaps.inputDatetime == null) {
  3258. this.rowRecipeRecord.getdataListParm.parammaps.inputDatetime = ''
  3259. this.rowRecipeRecord.getdataListParm.parammaps.startTime = ''
  3260. this.rowRecipeRecord.getdataListParm.parammaps.stopTime = ''
  3261. } else {
  3262. this.rowRecipeRecord.getdataListParm.parammaps.startTime = this.rowRecipeRecord.getdataListParm.parammaps.inputDatetime[0]
  3263. this.rowRecipeRecord.getdataListParm.parammaps.stopTime = this.rowRecipeRecord.getdataListParm.parammaps.inputDatetime[1]
  3264. }
  3265. const url = 'authdata/GetArrList'
  3266. const data = this.rowRecipeRecord.getdataListParm
  3267. postJson(url, data).then(response => {
  3268. if (response.data.list !== null) {
  3269. for (let i = 0; i < response.data.list.length; i++) {
  3270. if (response.data.list[i].arrList == null) {
  3271. this.$set(response.data.list[i], 'arrList', [])
  3272. }
  3273. }
  3274. this.rowRecipeRecord.list = response.data.list
  3275. this.rowRecipeRecord.pageNum = response.data.pageNum
  3276. this.rowRecipeRecord.pageSize = response.data.pageSize
  3277. this.rowRecipeRecord.total = response.data.total
  3278. } else {
  3279. this.rowRecipeRecord.list = []
  3280. this.rowRecipeRecord.total = 0
  3281. }
  3282. console.log(response.data, 'response.data')
  3283. setTimeout(() => {
  3284. this.rowRecipeRecord.listLoading = false
  3285. }, 100)
  3286. })
  3287. },
  3288. handleRowRecipeRecordSearch() {
  3289. this.getRowRecipeRecordList()
  3290. },
  3291. handleEnlarge() {
  3292. var height = (document.documentElement.clientHeight - 165 + 50).toString() + 'px'
  3293. // var height = (document.documentElement.clientHeight - 165 + 80).toString() + 'px'
  3294. // var height2 = '-' + (document.documentElement.clientHeight - 400).toString() + 'px'
  3295. var height2 = '-' + (this.$refs.template.offsetHeight).toString() + 'px'
  3296. // console.log(this.$refs.detail.offsetHeight)
  3297. // console.log(height2, 'height2')
  3298. this.isEnlarge = false
  3299. this.$refs.detail.style.top = height2
  3300. this.$refs.detail.style.height = height
  3301. this.$refs.appContainer.style.height = height
  3302. this.$refs.table2.style.height = 0
  3303. this.$refs.myContainer.style.posiiton = 'relative'
  3304. this.$refs.detail.style.posiiton = 'absolute'
  3305. },
  3306. handleNarrow() {
  3307. this.isEnlarge = true
  3308. this.$refs.detail.style.top = 0
  3309. this.$refs.detail.style.height = '300px'
  3310. this.$refs.myContainer.style.posiiton = ''
  3311. this.$refs.detail.style.posiiton = ''
  3312. this.$refs.detail.style.zIndex = ''
  3313. },
  3314. handleTakeEffect() {
  3315. if (this.selectList.length == 0) {
  3316. this.$message({ type: 'error', message: '请选择车次信息', duration: 2000 })
  3317. } else {
  3318. MessageBox.confirm('当前选中' + this.selectList.length + '条信息,是否生效?', {
  3319. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  3320. }).then(() => {
  3321. let ids = []
  3322. for (let i = 0; i < this.selectList.length; i++) {
  3323. ids.push(this.selectList[i].id)
  3324. }
  3325. var data = {}
  3326. data.parammaps = {}
  3327. data.parammaps.enable = 1
  3328. data.parammaps.id = ids.toString()
  3329. var url = 'authdata/feedtemplet/enable'
  3330. postJson(url,data).then(response => {
  3331. console.log('生效保存发送参数', data)
  3332. if (response.msg === 'fail') {
  3333. this.$notify({ title: '生效失败', message: response.data, type: 'warning', duration: 2000 })
  3334. } else {
  3335. this.$notify({ title: '', message: '生效成功', type: 'success', duration: 2000 })
  3336. this.getList()
  3337. }
  3338. })
  3339. })
  3340. }
  3341. },
  3342. handleDisable() {
  3343. if (this.selectList.length == 0) {
  3344. this.$message({ type: 'error', message: '请选择车次信息', duration: 2000 })
  3345. } else {
  3346. MessageBox.confirm('当前选中' + this.selectList.length + '条信息,是否禁用?', {
  3347. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  3348. }).then(() => {
  3349. let ids = []
  3350. for (let i = 0; i < this.selectList.length; i++) {
  3351. ids.push(this.selectList[i].id)
  3352. }
  3353. var data = {}
  3354. data.parammaps = {}
  3355. data.parammaps.enable = 0
  3356. data.parammaps.id = ids.toString()
  3357. console.log('禁用', data)
  3358. var url = 'authdata/feedtemplet/enable'
  3359. postJson(url,data).then(response => {
  3360. console.log('禁用保存发送参数', this.requestParam)
  3361. if (response.msg === 'fail') {
  3362. this.$notify({ title: '禁用失败', message: response.data, type: 'warning', duration: 2000 })
  3363. } else {
  3364. this.$notify({ title: '', message: '禁用成功', type: 'success', duration: 2000 })
  3365. this.getList()
  3366. }
  3367. })
  3368. })
  3369. }
  3370. },
  3371. getIspalyUd(){
  3372. let url = 'authdata/GetDataByName'
  3373. let data = {
  3374. "name":"getSysoptEnable","page":1,"offset":1,"pagecount":1,"returntype":"Map",
  3375. "parammaps":{"pastureid":Cookies.get('pastureid'),"inforname":"gmUdSync"}
  3376. }
  3377. postJson(url,data).then(response => {
  3378. if (response.msg !== 'fail') {
  3379. if(response.data.list[0].inforvalue == 0){
  3380. this.ispalyUd = false
  3381. }else{
  3382. this.ispalyUd = true
  3383. }
  3384. } else {
  3385. this.$notify({ title: '请求失败', message: response.data, type: 'warning', duration: 2000 })
  3386. }
  3387. })
  3388. },
  3389. handleGetUd(){
  3390. MessageBox.confirm('是否上传配方?', {
  3391. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  3392. }).then(() => {
  3393. let url = 'authdata/gm/udfeedtemplet/push'
  3394. let data = {
  3395. pastureId:Cookies.get('pastureid')
  3396. }
  3397. postJson(url,data).then(response => {
  3398. if (response.msg !== 'fail') {
  3399. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  3400. this.getList()
  3401. } else {
  3402. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  3403. }
  3404. })
  3405. })
  3406. }
  3407. }
  3408. }
  3409. </script>
  3410. <style lang="scss" scoped>
  3411. // .search{margin-top:10px;height: 40px;}
  3412. // .operation{height: 50px;}
  3413. .table{margin-top:5px;}
  3414. .table2{margin-top:10px;}
  3415. $width:350px;
  3416. $left:325px;
  3417. .selectInput{
  3418. position: relative;
  3419. display: inline-block;
  3420. .Input{width: $width;position: relative;}
  3421. .el-icon-arrow-down{width: 30px;height: 30px;position: absolute;left: $left;top:10px;color:#C0C4CC;}
  3422. .el-icon-arrow-up{width: 30px;height: 30px;position: absolute;left: $left;top:10px;color:#C0C4CC;}
  3423. .selectUl{
  3424. height:220px;overflow-y: auto;z-index: 111;width: $width;background: #fff;border: 1px solid #E4E7ED;box-shadow: 0 2px 12px 0 rgba(0,0,0,.1);margin: -1px 0 0 0;padding: 6px 0; margin: 0;box-sizing: border-box;position: absolute;
  3425. li{
  3426. list-style: none;font-size: 14px; padding: 0 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #606266; height: 50px; line-height: 50px; box-sizing: border-box; cursor: pointer;
  3427. a{float:left;width: 80px;}
  3428. a:hover{color: rgba(0, 204, 102, 0.71); font-weight: 700;}
  3429. }
  3430. }
  3431. }
  3432. .template{
  3433. background: #fff;
  3434. position: relative;
  3435. }
  3436. .app-container{background: #fff;}
  3437. .detail{
  3438. background: #fff;
  3439. overflow-y: hidden;
  3440. overflow-x: hidden;
  3441. // position: fixed;
  3442. // bottom: 0;
  3443. // right:0;
  3444. z-index: 3;
  3445. // width: calc(100% - 210px);
  3446. position: relative;
  3447. }
  3448. .hide2{float: right;right:0;}
  3449. .templateDialog{
  3450. background: #fff;
  3451. position: relative;
  3452. }
  3453. .detailDialog{
  3454. background: #fff;
  3455. position: relative;
  3456. }
  3457. .hide{float: right;margin-right: 60px;}
  3458. </style>
  3459. <style>
  3460. .el-color-dropdown__main-wrapper{display: none !important;}
  3461. .el-color-dropdown__value{display: none !important;}
  3462. .el-color-dropdown__btns .el-button--text{display: none !important;}
  3463. </style>