index.vue 162 KB

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