index.vue 167 KB

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