index.vue 157 KB

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