index.vue 156 KB

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