index.vue 157 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354
  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. this.table.temp.volume = parseFloat(row.volume)
  1343. this.table.temp.pastureid = Cookies.get('pastureid')
  1344. if (this.table.temp.tname == '' && this.table.temp.ccid == '' && this.table.temp.fttypeid == '') {
  1345. this.$message({ type: 'error', message: '配方名称/牲畜类别/配方类型不能为空', duration: 2000 })
  1346. return false
  1347. } else if (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.tname == '') {
  1351. this.$message({ type: 'error', message: '配方名称不能为空', duration: 2000 })
  1352. return false
  1353. } else if (this.table.temp.ccid == '') {
  1354. this.$message({ type: 'error', message: '牲畜类别不能为空', duration: 2000 })
  1355. return false
  1356. } else if (this.table.temp.fttypeid == '') {
  1357. this.$message({ type: 'error', message: '配方类型不能为空', duration: 2000 })
  1358. return false
  1359. }
  1360. const pattern = new RegExp("[`~!@#$^&*()=|{}':;',\\[\\].<>/?~!@#¥……&*()——|{}【】‘;:”“'。,、?]")
  1361. // if (pattern.test(this.table.temp.tname)) {
  1362. // this.$message({ type: 'error', message: '配方名称不可输入特殊字符', duration: 2000 })
  1363. // return false
  1364. // }
  1365. if (pattern.test(this.table.temp.tcode)) {
  1366. this.$message({ type: 'error', message: '配方编码不可输入特殊字符', duration: 2000 })
  1367. return false
  1368. }
  1369. console.log(this.table.temp)
  1370. this.isokDisable = true
  1371. setTimeout(() => {
  1372. this.isokDisable = false
  1373. }, 1000)
  1374. this.requestParam2.name = 'checkNumber'
  1375. this.requestParam2.parammaps = {}
  1376. this.requestParam2.parammaps.number = this.table.temp.tcode
  1377. GetDataByName(this.requestParam2).then(response => {
  1378. console.log('table数据', response.data.list)
  1379. if (response.data.list[0].vmsg !== '输入非法字符') {
  1380. this.saveCreateData()
  1381. } else {
  1382. this.$notify({ type: 'error', message: '配方编码不可输入特殊字符', duration: 2000 })
  1383. }
  1384. })
  1385. },
  1386. saveCreateData() {
  1387. this.requestParam.name = 'insertFT'
  1388. this.requestParam.parammaps = this.table.temp
  1389. PostDataByName(this.requestParam).then(response => {
  1390. console.log('新增保存发送参数', this.requestParam)
  1391. if (response.msg !== 'fail') {
  1392. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  1393. this.getList()
  1394. let data = {}
  1395. data.name = 'insertFeedtemplethistory'
  1396. data.parammaps = this.table.temp
  1397. PostDataByName(data).then(response => {
  1398. if (response.msg !== 'fail') {
  1399. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  1400. this.getList()
  1401. } else {
  1402. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  1403. }
  1404. })
  1405. } else {
  1406. const isRepeat = new RegExp('Duplicate entry :feedtemplet.tCode')
  1407. if (isRepeat.test(response.data)) {
  1408. this.$notify({ type: 'error', message: '配方编码不可重复,请重新录入', duration: 2000 })
  1409. } else {
  1410. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  1411. }
  1412. }
  1413. })
  1414. },
  1415. createCancel(row) {
  1416. console.log('点击了新增取消')
  1417. for (let i = 0; i < this.table.list.length; i++) {
  1418. if (row.myId === this.table.list[i].myId) {
  1419. var listIndex = this.table.list.indexOf(this.table.list[i])
  1420. }
  1421. if (listIndex > -1) {
  1422. this.table.list.splice(listIndex, 1)
  1423. return
  1424. }
  1425. }
  1426. },
  1427. // 模板编辑
  1428. handleUpdate(row) {
  1429. for (let i = 0; i < this.table.list.length; i++) {
  1430. if (this.table.list[i].Edit == true) {
  1431. this.$message({ type: 'error', message: '当前内容未保存,请点击取消或保存继续进行操作', duration: 2000 })
  1432. return false
  1433. }
  1434. }
  1435. // 编辑true,不可编辑false
  1436. row.Edit = true
  1437. row.NoEdit = false
  1438. // 新增false,编辑false,编辑保存true
  1439. row.isCreate = false
  1440. row.isUpdate = false
  1441. row.isUpdateSave = true
  1442. if (row.ccname !== undefined) {
  1443. row.ccid = String(row.ccid)
  1444. }
  1445. this.table.temp.ccname = row.ccname
  1446. row.fttypeid = String(row.fttypeid)
  1447. this.table.temp.fttype = row.fttype
  1448. },
  1449. updateData(row) {
  1450. console.log('点击了编辑保存', row)
  1451. this.table.temp.tname = row.tname
  1452. this.table.temp.tcode = row.tcode
  1453. this.table.temp.tcolor = row.tcolor
  1454. this.table.temp.ccid = row.ccid
  1455. this.table.temp.fttypeid = row.fttypeid
  1456. this.table.temp.source = row.source
  1457. this.table.temp.remark = row.remark
  1458. this.table.temp.enable = row.enable
  1459. this.table.temp.ccname = this.table.temp.ccname
  1460. this.table.temp.fttype = this.table.temp.fttype
  1461. this.table.temp.pastureid = row.pastureid
  1462. this.table.temp.id = row.id
  1463. this.table.temp.cattle = row.cattle
  1464. this.table.temp.volume = parseFloat(row.volume)
  1465. if (this.table.temp.tname == '' && this.table.temp.ccid == '' && this.table.temp.fttypeid == '') {
  1466. this.$message({ type: 'error', message: '配方名称/牲畜类别/配方类型不能为空', duration: 2000 })
  1467. return false
  1468. } else if (this.table.temp.ccid == '' && this.table.temp.fttypeid == '') {
  1469. this.$message({ type: 'error', message: '牲畜类别/配方类型不能为空', duration: 2000 })
  1470. return false
  1471. } else if (this.table.temp.tname == '') {
  1472. this.$message({ type: 'error', message: '配方名称不能为空', duration: 2000 })
  1473. return false
  1474. } else if (this.table.temp.ccid == '') {
  1475. this.$message({ type: 'error', message: '牲畜类别不能为空', duration: 2000 })
  1476. return false
  1477. } else if (this.table.temp.fttypeid == '') {
  1478. this.$message({ type: 'error', message: '配方类型不能为空', duration: 2000 })
  1479. return false
  1480. }
  1481. const pattern = new RegExp("[`~!@#$^&*()=|{}':;',\\[\\].<>/?~!@#¥……&*()——|{}【】‘;:”“'。,、?]")
  1482. // if (pattern.test(this.table.temp.tname)) {
  1483. // this.$message({ type: 'error', message: '配方名称不可输入特殊字符', duration: 2000 })
  1484. // return false
  1485. // }
  1486. if (pattern.test(this.table.temp.tcode)) {
  1487. this.$message({ type: 'error', message: '配方编码不可输入特殊字符', duration: 2000 })
  1488. return false
  1489. }
  1490. console.log(this.table.temp)
  1491. this.isokDisable = true
  1492. setTimeout(() => {
  1493. this.isokDisable = false
  1494. }, 1000)
  1495. this.requestParam2 = {}
  1496. this.requestParam2.name = 'checkNumber'
  1497. this.requestParam2.parammaps = {}
  1498. this.requestParam2.parammaps.number = this.table.temp.tcode
  1499. GetDataByName(this.requestParam2).then(response => {
  1500. console.log('table数据', response.data.list)
  1501. if (response.data.list[0].vmsg !== '输入非法字符') {
  1502. this.saveUpdateData()
  1503. } else {
  1504. this.$notify({ type: 'error', message: '配方编码不可输入特殊字符', duration: 2000 })
  1505. }
  1506. })
  1507. },
  1508. saveUpdateData() {
  1509. this.requestParam = {}
  1510. this.requestParam.name = 'updateFT'
  1511. this.requestParam.parammaps = this.table.temp
  1512. PostDataByName(this.requestParam).then(response => {
  1513. console.log('新增保存发送参数', this.requestParam)
  1514. if (response.msg !== 'fail') {
  1515. this.requestParam3 = {}
  1516. this.requestParam3.name = 'insertFTHistory'
  1517. this.requestParam3.type = 'e'
  1518. this.requestParam3.parammaps = {}
  1519. this.requestParam3.parammaps.id = this.table.temp.id
  1520. this.requestParam3.parammaps.createdate = parseTime(new Date(), '{y}-{m}-{d} {h}:{i}:{s}')
  1521. PostDataByName(this.requestParam3).then(response => {
  1522. console.log('新增保存发送参数', this.requestParam)
  1523. if (response.msg !== 'fail') {
  1524. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  1525. this.getList()
  1526. } else {
  1527. const isRepeat = new RegExp('Duplicate entry :feedtemplet.tCode')
  1528. if (isRepeat.test(response.data)) {
  1529. this.$notify({ type: 'error', message: '配方编码不可重复,请重新录入', duration: 2000 })
  1530. } else {
  1531. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  1532. }
  1533. }
  1534. })
  1535. } else {
  1536. const isRepeat = new RegExp('Duplicate entry :feedtemplet.tCode')
  1537. if (isRepeat.test(response.data)) {
  1538. this.$notify({ type: 'error', message: '配方编码不可重复,请重新录入', duration: 2000 })
  1539. } else {
  1540. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  1541. }
  1542. }
  1543. })
  1544. },
  1545. updateCancel(row) {
  1546. console.log('点击了编辑取消')
  1547. // 编辑false,不可编辑true
  1548. row.Edit = false
  1549. row.NoEdit = true
  1550. // 新增false,编辑true,编辑保存false
  1551. row.isCreate = false
  1552. row.isUpdate = true
  1553. row.isUpdateSave = false
  1554. this.getList()
  1555. },
  1556. // 删除
  1557. handleRowDelete(row) {
  1558. console.log('点击了行内删除')
  1559. MessageBox.confirm('是否确认删除此信息?', {
  1560. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  1561. }).then(() => {
  1562. this.requestParam.common = { 'returnmap': '0' }
  1563. this.requestParam.data = []
  1564. this.requestParam.data[0] = { 'name': 'checkdeleteFT', 'type': 'v', 'parammaps': {
  1565. pastureid: row.pastureid,
  1566. id: row.id
  1567. }}
  1568. this.requestParam.data[1] = { 'name': 'deleteFT', 'type': 'e', 'parammaps': {
  1569. pastureid: row.pastureid,
  1570. id: row.id
  1571. }}
  1572. ExecDataByConfig(this.requestParam).then(response => {
  1573. console.log('新增保存发送参数', this.requestParam)
  1574. if (response.msg === 'fail') {
  1575. this.$notify({ title: '删除失败', message: response.data, type: 'warning', duration: 2000 })
  1576. } else {
  1577. this.$notify({ title: '成功', message: '删除成功', type: 'success', duration: 2000 })
  1578. this.getList()
  1579. this.isDetail = false
  1580. }
  1581. })
  1582. }).catch(() => {
  1583. this.$message({ type: 'info', message: '已取消删除' })
  1584. })
  1585. },
  1586. handleSelectionChange(val) {
  1587. console.log('勾选数据', val)
  1588. this.selectList = val
  1589. },
  1590. form_delete() {
  1591. console.log('点击了删除')
  1592. if (this.selectList.length == 0) {
  1593. this.$message({ type: 'error', message: '请选择配方', duration: 2000 })
  1594. } else {
  1595. MessageBox.confirm('是否确认删除此信息?', {
  1596. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  1597. }).then(() => {
  1598. console.log(this.selectList)
  1599. this.requestParam.common = { 'returnmap': '0' }
  1600. this.requestParam.data = []
  1601. this.requestParam.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.selectList }}
  1602. this.requestParam.data[0].children = []
  1603. this.requestParam.data[0].children[0] = { 'name': 'checkdeleteFT', 'type': 'v', 'parammaps': {
  1604. id: '@insertSpotList.id',
  1605. pastureid: '@insertSpotList.pastureid'
  1606. }}
  1607. this.requestParam.data[0].children[1] = { 'name': 'deleteFT', 'type': 'e', 'parammaps': {
  1608. id: '@insertSpotList.id',
  1609. pastureid: '@insertSpotList.pastureid'
  1610. }}
  1611. ExecDataByConfig(this.requestParam).then(response => {
  1612. console.log('删除保存发送参数', this.requestParam)
  1613. if (response.msg === 'fail') {
  1614. this.$notify({ title: '删除失败', message: response.data, type: 'warning', duration: 2000 })
  1615. } else {
  1616. this.$notify({ title: '', message: '删除成功', type: 'success', duration: 2000 })
  1617. this.getList()
  1618. }
  1619. })
  1620. })
  1621. }
  1622. },
  1623. // 复制
  1624. handleCopy() {
  1625. if (this.selectList.length == 0) {
  1626. this.$message({ type: 'error', message: '请选择配方', duration: 2000 })
  1627. } else {
  1628. MessageBox.confirm('是否确认复制此信息?', {
  1629. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  1630. }).then(() => {
  1631. console.log(this.selectList)
  1632. this.requestParam.common = { 'returnmap': '0' }
  1633. this.requestParam.data = []
  1634. this.requestParam.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.selectList }}
  1635. this.requestParam.data[0].children = []
  1636. this.requestParam.data[0].children[0] = { 'name': 'copyFT', 'type': 'e', 'parammaps': {
  1637. ftid: '@insertSpotList.id',
  1638. pastureid: '@insertSpotList.pastureid'
  1639. }}
  1640. ExecDataByConfig(this.requestParam).then(response => {
  1641. console.log('复制保存发送参数', this.requestParam)
  1642. if (response.msg === 'fail') {
  1643. this.$notify({ title: '复制失败', message: response.data, type: 'warning', duration: 2000 })
  1644. } else {
  1645. this.$notify({ title: '', message: '复制成功', type: 'success', duration: 2000 })
  1646. this.getList()
  1647. }
  1648. })
  1649. })
  1650. }
  1651. },
  1652. // 配方记录
  1653. handleRecipeRecord() {
  1654. console.log('点击了配方记录')
  1655. this.template.dialogStatus = 'RecipeRecord'
  1656. this.dialogFull = false
  1657. this.template.dialogFormVisible = true
  1658. this.template.table.getdataListParm.parammaps.ccname = ''
  1659. this.template.table.getdataListParm.parammaps.fttype = ''
  1660. this.template.table.getdataListParm.parammaps.enable = ''
  1661. this.template.table.getdataListParm.parammaps.tname = ''
  1662. this.template.table.getdataListParm.parammaps.remark = ''
  1663. this.template.table.getdataListParm.parammaps.source = ''
  1664. this.template.table.getdataListParm.offset = 1
  1665. this.getDateList()
  1666. this.isDetailDialog = false
  1667. this.myheight2 = document.documentElement.clientHeight - 85 - 265
  1668. },
  1669. // 历史时间
  1670. getDateList() {
  1671. GetDataByName(this.template.getdataDateParm).then(response => {
  1672. console.log('table数据', response.data.list)
  1673. if (response.data.list !== null) {
  1674. this.template.table.getdataListParm.parammaps.date = response.data.list[0].maxdate
  1675. this.getTemplateDialogList()
  1676. } else {
  1677. this.template.table.getdataListParm.parammaps.date = ''
  1678. }
  1679. })
  1680. },
  1681. // 配方记录-模板
  1682. getTemplateDialogList() {
  1683. this.template.table.listLoading = true
  1684. GetDataByName(this.template.table.getdataListParm).then(response => {
  1685. console.log('table数据', response.data.list)
  1686. if (response.data.list !== null) {
  1687. this.template.table.list = response.data.list
  1688. this.template.table.pageNum = response.data.pageNum
  1689. this.template.table.pageSize = response.data.pageSize
  1690. this.template.table.total = response.data.total
  1691. } else {
  1692. this.template.table.list = []
  1693. this.template.table2.list = []
  1694. }
  1695. setTimeout(() => {
  1696. this.template.table.listLoading = false
  1697. }, 100)
  1698. })
  1699. },
  1700. handleDialogSearch() {
  1701. this.template.table.getdataListParm.offset = 1
  1702. this.getTemplateDialogList()
  1703. this.arrowDown = true
  1704. this.arrowUp = false
  1705. },
  1706. handleDialogRefresh() {
  1707. this.template.table.getdataListParm.parammaps.ccname = ''
  1708. this.template.table.getdataListParm.parammaps.fttype = ''
  1709. this.template.table.getdataListParm.parammaps.enable = ''
  1710. this.template.table.getdataListParm.parammaps.tname = ''
  1711. this.template.table.getdataListParm.parammaps.remark = ''
  1712. this.template.table.getdataListParm.parammaps.source = ''
  1713. this.template.table.getdataListParm.offset = 1
  1714. this.getTemplateDialogList()
  1715. },
  1716. // 配方记录-模板行点击
  1717. tableRowClickDialog(row, column, event) {
  1718. console.log('配方记录-模板行点击')
  1719. this.isDetailDialog = true
  1720. this.template.table2.getdataListParm.parammaps.date = this.template.table.getdataListParm.parammaps.date
  1721. this.template.table2.getdataListParm.parammaps.version = row.version
  1722. this.template.table2.getdataListParm.parammaps.ftid = row.id
  1723. this.template.table2.getdataListParm.parammaps.dryweight = row.dryweight
  1724. this.myheight2 = document.documentElement.clientHeight - 85 - 265 - 185
  1725. this.getDialogList()
  1726. this.getDownList()
  1727. // aiaiaiai
  1728. },
  1729. getDialogList() {
  1730. this.template.table2.listLoading = true
  1731. GetDataByName(this.template.table2.getdataListParm).then(response => {
  1732. console.log('table数据', response.data.list)
  1733. if (response.data.list !== null) {
  1734. this.template.table2.list = response.data.list
  1735. this.template.table2.pageNum = response.data.pageNum
  1736. this.template.table2.pageSize = response.data.pageSize
  1737. this.template.table2.total = response.data.total
  1738. } else {
  1739. this.template.table2.list = []
  1740. }
  1741. this.$nextTick(function() {
  1742. document.querySelector('#detailDialog2').scrollIntoView()
  1743. // window.scrollTo({
  1744. // 'top': this.$refs.detailDialog2.clientHeight
  1745. // })
  1746. })
  1747. setTimeout(() => {
  1748. this.template.table2.listLoading = false
  1749. }, 100)
  1750. })
  1751. },
  1752. handleDialogSearch2() {
  1753. console.log('点击了查询')
  1754. this.arrowDown2 = true
  1755. this.arrowUp2 = false
  1756. this.template.table2.getdataListParm.offset = 1
  1757. this.getDialogList2()
  1758. },
  1759. handleDialogRefresh2() {
  1760. console.log('点击了重置')
  1761. this.template.table2.getdataListParm.parammaps.fname = ''
  1762. this.template.table2.getdataListParm.parammaps.feedgroup = ''
  1763. this.template.table2.getdataListParm.parammaps.fweight = ''
  1764. this.template.table2.getdataListParm.parammaps.autosecondname = ''
  1765. this.template.table2.getdataListParm.parammaps.islockcount = '0'
  1766. this.template.table2.getdataListParm.parammaps.sort = ''
  1767. this.template.table2.getdataListParm.offset = 1
  1768. this.getDialogList2()
  1769. },
  1770. getDialogList2() {
  1771. this.template.table2.listLoading = true
  1772. GetDataByName(this.template.table2.getdataListParm).then(response => {
  1773. console.log('table数据', response.data.list)
  1774. if (response.data.list !== null) {
  1775. this.template.table2.list = response.data.list
  1776. this.template.table2.pageNum = response.data.pageNum
  1777. this.template.table2.pageSize = response.data.pageSize
  1778. this.template.table2.total = response.data.total
  1779. } else {
  1780. this.template.table2.list = []
  1781. }
  1782. this.$nextTick(function() {
  1783. window.scrollTo({
  1784. 'top': this.$refs.templateDialog.clientHeight
  1785. })
  1786. })
  1787. setTimeout(() => {
  1788. this.template.table2.listLoading = false
  1789. }, 100)
  1790. })
  1791. },
  1792. // 导出
  1793. handleExport(item) {
  1794. if (item == 1) {
  1795. console.log('点击了导出模板')
  1796. const requestParam = this.requestParam
  1797. const url = process.env.VUE_APP_BASE_API + 'file/导入导出模板/配方计划/配方模板导入模板.xlsx' // 请求下载文件的地址
  1798. console.log(url)
  1799. axios({
  1800. method: 'GET',
  1801. url: url,
  1802. data: requestParam,
  1803. headers: { token: getToken(), optname: 'insertcustomdoc' },
  1804. responseType: 'blob'
  1805. }).then(res => {
  1806. if (!res) return
  1807. this.percentage = 99
  1808. setTimeout(() => {
  1809. this.isPercentage = false
  1810. }, 2000)
  1811. const blob = new Blob([res.data], {
  1812. type: 'application/octet-stream;charset=utf-8'
  1813. })
  1814. const url = window.URL.createObjectURL(blob)
  1815. const aLink = document.createElement('a')
  1816. aLink.style.display = 'none'
  1817. aLink.href = url
  1818. const docname = '配方模板导入模板.xlsx'
  1819. aLink.setAttribute('download', docname) // 下载的文件
  1820. document.body.appendChild(aLink)
  1821. aLink.click()
  1822. document.body.removeChild(aLink)
  1823. window.URL.revokeObjectURL(url)
  1824. })
  1825. } else {
  1826. console.log('点击了导出数据')
  1827. this.download.getdataListParm.name = 'downloadFTList'
  1828. this.download.getdataListParm.parammaps = this.table.getdataListParm.parammaps
  1829. GetDataByName(this.download.getdataListParm).then(response => {
  1830. if (response.data.list !== null) {
  1831. for (let i = 0; i < response.data.list.length; i++) {
  1832. if (response.data.list[i].islockcount == 0) {
  1833. this.$set(response.data.list[i], 'islockcount', '否')
  1834. } else {
  1835. this.$set(response.data.list[i], 'islockcount', '是')
  1836. }
  1837. if (response.data.list[i].enable == 0) {
  1838. this.$set(response.data.list[i], 'enable', '否')
  1839. } else {
  1840. this.$set(response.data.list[i], 'enable', '是')
  1841. }
  1842. }
  1843. this.download.list = response.data.list
  1844. } else {
  1845. this.download.list = []
  1846. }
  1847. var excelDatas = [
  1848. {
  1849. tHeader: ['配方名称', '配方编码', '牲畜类别', '配方类型', '来源', '备注', '是否启用', '饲料组', '饲料名称', '重量(kg)', '搅拌延时(min)', '是否锁定牛头数比例', '顺序'],
  1850. filterVal: ['tname', 'tcode', 'ccname', 'fttype', 'source', 'remark', 'enable', 'feedgroup', 'fname', 'fweight', 'autosecond', 'islockcount', 'sort'],
  1851. tableDatas: this.download.list,
  1852. sheetName: 'Sheet1'
  1853. }
  1854. ]
  1855. json2excel(excelDatas, '配方模板', true, 'xlsx')
  1856. })
  1857. }
  1858. },
  1859. beforeImport(file) {
  1860. const isLt2M = file.size / 1024 / 1024 < 2
  1861. if (!isLt2M) {
  1862. this.$message.error('上传文件大小不能超过 2MB!')
  1863. }
  1864. return isLt2M
  1865. },
  1866. handleImportSuccess(res, file) {
  1867. this.getList()
  1868. if (res.msg === 'ok') {
  1869. this.$message({ title: '成功', message: '导入成功:' + res.data.success + '条!', type: 'success', duration: 2000 })
  1870. if (res.data.err_count > 0) {
  1871. this.$notify({ title: '失败', message: '导入失败:' + res.data.err_count + '条!', type: 'danger', duration: 2000 })
  1872. import('@/vendor/Export2Excel').then(excel => {
  1873. const list1 = res.data.result
  1874. const tHeader = [
  1875. '配方名称', '牲畜类别', '配方类型', '备注', '饲料组', '饲料名称', '重量(kg)', '搅拌延时(min)', '是否锁定牛头数比例', '错误信息'
  1876. ]
  1877. const filterVal = [
  1878. '配方名称', '牲畜类别', '配方类型', '备注', '饲料组', '饲料名称', '重量(kg)', '搅拌延时(min)', '是否锁定牛头数比例', 'error_msg'
  1879. ]
  1880. const data1 = this.formatJson(filterVal, list1)
  1881. excel.export_json_to_excel({ header: tHeader, data: data1, filename: '配方模板导入报错信息', autoWidth: true, bookType: 'xlsx' })
  1882. })
  1883. }
  1884. } else {
  1885. const isRepeat = new RegExp('Duplicate entry :feedtemplet_tname')
  1886. if (isRepeat.test(res.data)) {
  1887. this.$notify({ type: 'error', message: '配方名称不可重复,请重新录入', duration: 2000 })
  1888. return false
  1889. }
  1890. this.$notify({ title: '失败', message: '上传失败', type: 'danger', duration: 2000 })
  1891. }
  1892. },
  1893. formatJson(filterVal, jsonData) {
  1894. return jsonData.map(v =>
  1895. filterVal.map(j => {
  1896. if (j === 'timestamp') {
  1897. return parseTime(v[j])
  1898. } else {
  1899. return v[j]
  1900. }
  1901. })
  1902. )
  1903. },
  1904. changeDate() {
  1905. this.getTemplateDialogList()
  1906. },
  1907. // 应用
  1908. handleApplication() {
  1909. console.log('点击了应用')
  1910. MessageBox.confirm('是否确认将' + this.template.table.getdataListParm.parammaps.date + '的数据应用到当前?', {
  1911. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  1912. }).then(() => {
  1913. this.requestParam.name = 'applyFTdate'
  1914. this.requestParam.parammaps = {}
  1915. this.requestParam.parammaps.pastureid = Cookies.get('pastureid')
  1916. this.requestParam.parammaps.date = this.template.table.getdataListParm.parammaps.date
  1917. PostDataByName(this.requestParam).then(response => {
  1918. if (response.msg === 'fail') {
  1919. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  1920. } else {
  1921. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  1922. this.getTemplateDialogList()
  1923. this.getList()
  1924. }
  1925. })
  1926. }).catch(() => {
  1927. this.$message({ type: 'info', message: '已取消应用' })
  1928. })
  1929. },
  1930. // 模板行点击
  1931. tableRowClick(row, column, event) {
  1932. for (let i = 0; i < this.table.list.length; i++) {
  1933. if (this.table.list[i].Edit == true) {
  1934. return false
  1935. }
  1936. }
  1937. if (this.isOrder == false) {
  1938. this.$message({ type: 'error', message: '请保存或取消当前更改顺序操作', duration: 2000 })
  1939. } else {
  1940. if (column.label !== '操作') {
  1941. this.isDetail = true // 点击行显示详情
  1942. this.table2.getdataListParm.parammaps.ftid = row.id
  1943. this.table2.getdataListParm.parammaps.fttypeid = row.fttypeid
  1944. this.table2.getdataListParm.parammaps.dryweight = row.dryweight
  1945. if (row.fttype == '预混配方') {
  1946. this.requestParams[2].parammaps.type = '1'
  1947. } else {
  1948. this.requestParams[2].parammaps.type = ''
  1949. }
  1950. this.myheight = document.documentElement.clientHeight - 85 - 265 - 185
  1951. this.getList2()
  1952. this.getDownList()
  1953. }
  1954. }
  1955. },
  1956. handleCloseTable2() {
  1957. this.isDetail = false
  1958. this.myheight = ''
  1959. this.isEnlarge = true
  1960. },
  1961. handleDialogCloseTable2() {
  1962. this.isDetailDialog = false
  1963. this.myheight2 = document.documentElement.clientHeight - 85 - 265
  1964. },
  1965. // -------------------详情-----------------------------
  1966. // 获取是否显示是否锁定牛头数
  1967. getIsLockCount() {
  1968. GetDataByName(this.lockCount.getdataListParm).then(response => {
  1969. console.log(response.data.list)
  1970. if (response.data.list[0].inforvalue == 0) {
  1971. this.lockCount.isLockCount = false
  1972. } else {
  1973. this.lockCount.isLockCount = true
  1974. }
  1975. })
  1976. },
  1977. // 详情
  1978. getList2() {
  1979. this.table2.listLoading = true
  1980. GetDataByName(this.table2.getdataListParm).then(response => {
  1981. console.log('table数据', response.data.list)
  1982. if (response.data.list !== null) {
  1983. for (let i = 0; i < response.data.list.length; i++) {
  1984. this.$set(response.data.list[i], 'Edit', false) // 编辑
  1985. this.$set(response.data.list[i], 'NoEdit', true) // 不可编辑/输入
  1986. this.$set(response.data.list[i], 'groupEdit', false) // 饲料组编辑
  1987. this.$set(response.data.list[i], 'isGroupDisabled', false) // 饲料组编辑禁止编辑
  1988. this.$set(response.data.list[i], 'groupNoEdit', true) // 饲料组不可编辑
  1989. this.$set(response.data.list[i], 'isCreate', false) // 新增操作
  1990. this.$set(response.data.list[i], 'isUpdate', true) // 编辑操作
  1991. this.$set(response.data.list[i], 'isUpdateSave', false) // 编辑保存
  1992. }
  1993. this.table2.getDryweightParm.parammaps = this.table2.getdataListParm.parammaps
  1994. this.getDryWeight()
  1995. // for (let i = 0; i < response.data.list.length; i++) {
  1996. // console.log(response.data.list[i].fweight, '===12333')
  1997. // }
  1998. this.table2.list = response.data.list
  1999. this.table2.pageNum = response.data.pageNum
  2000. this.table2.pageSize = response.data.pageSize
  2001. this.table2.total = response.data.total
  2002. } else {
  2003. this.table2.list = []
  2004. }
  2005. setTimeout(() => {
  2006. this.table2.listLoading = false
  2007. }, 100)
  2008. })
  2009. },
  2010. // 行拖拽
  2011. rowDrop() {
  2012. console.log(document.querySelector('#table2 .el-table__body-wrapper tbody'))
  2013. const tbody = document.querySelector('#table2 .el-table__body-wrapper tbody')
  2014. // this.sorTable()
  2015. const that = this
  2016. // Sortable.create(tbody, {
  2017. var sortable = Sortable.create(tbody, {
  2018. disabled: that.dropState,
  2019. onChoose({ newIndex, oldIndex }) {
  2020. console.log(that.isOrder, 'that.isOrder == false')
  2021. console.log(that.dropState, 'that.dropState')
  2022. if (that.dropState == true || that.isOrder == true) {
  2023. sortable.destroy()
  2024. }
  2025. },
  2026. onEnd({ newIndex, oldIndex }) {
  2027. const currRow = that.table2.list.splice(oldIndex, 1)[0]
  2028. that.table2.list.splice(newIndex, 0, currRow)
  2029. console.log('索引', newIndex)
  2030. console.log('拖动数据', currRow)
  2031. console.log('上', that.table2.list[newIndex - 1])
  2032. console.log('下', that.table2.list[newIndex + 1])
  2033. if (that.table2.list[newIndex - 1] === undefined) { // 拖动至最上方无值 // 顺序等于0,其他+1 // 饲料组等于饲料名称
  2034. for (let i = 0; i < that.table2.list.length; i++) {
  2035. that.table2.list[i].sort = parseInt(that.table2.list[i].sort) + 1 // 其他的顺序+1
  2036. }
  2037. currRow.sort = 0
  2038. currRow.feedgroup = currRow.fname
  2039. console.log('拖动至最上方无值')
  2040. } else if (currRow.sort == that.table2.list[newIndex - 1].sort) { // 拖动值顺序等于上值顺序
  2041. currRow.sort = that.table2.list[newIndex - 1].sort
  2042. console.log('拖动值顺序等于上值顺序')
  2043. } else if (that.table2.list[newIndex + 1] == undefined) { // 拖动至最下方无值 // 顺序等于上方顺序+1 // 饲料组等于饲料名称
  2044. currRow.sort = parseInt(that.table2.list[newIndex - 1].sort) + 1
  2045. currRow.feedgroup = currRow.fname
  2046. console.log('拖动至最下方无值')
  2047. } else if (currRow.sort == that.table2.list[newIndex + 1].sort) { // 拖动值顺序等于下值顺序
  2048. currRow.sort == that.table2.list[newIndex + 1].sort
  2049. console.log('拖动值顺序等于下值顺序')
  2050. } else if (that.table2.list[newIndex - 1].sort == that.table2.list[newIndex + 1].sort) { // 拖动至上下顺序一致,顺序/饲料组与上下保持一致
  2051. currRow.sort = that.table2.list[newIndex - 1].sort
  2052. currRow.feedgroup = that.table2.list[newIndex - 1].feedgroup
  2053. console.log('拖动至上下顺序一致')
  2054. } else if (that.table2.list[newIndex - 1].sort !== undefined && that.table2.list[newIndex + 1].sort !== undefined) { // 拖动至上下都有值
  2055. console.log('上下')
  2056. if (parseInt(that.table2.list[newIndex - 1].sort) + 1 == that.table2.list[newIndex + 1].sort) {
  2057. console.log(newIndex)
  2058. for (let i = newIndex; i < that.table2.list.length; i++) {
  2059. that.table2.list[i].sort = parseInt(that.table2.list[i].sort) + 1
  2060. }
  2061. }
  2062. currRow.sort = parseInt(that.table2.list[newIndex - 1].sort) + 1
  2063. currRow.feedgroup = currRow.fname
  2064. console.log(that.table2.list[newIndex + 1].sort)
  2065. }
  2066. }
  2067. })
  2068. console.log(sortable.option('disabled'))
  2069. },
  2070. handleChangeOrder() {
  2071. this.isOrder = false
  2072. this.rowDrop()
  2073. },
  2074. saveChangeOrder() {
  2075. // 保存顺序
  2076. console.log(this.table2.list)
  2077. this.requestParam = {}
  2078. this.requestParam.common = { 'returnmap': '0' }
  2079. this.requestParam.data = []
  2080. this.requestParam.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.table2.list }}
  2081. this.requestParam.data[0].children = []
  2082. this.requestParam.data[0].children[0] = { 'name': 'updateFTdetailSort', 'type': 'e', 'parammaps': {
  2083. id: '@insertSpotList.id',
  2084. pastureid: '@insertSpotList.pastureid',
  2085. sort: '@insertSpotList.sort',
  2086. feedgroup: '@insertSpotList.feedgroup'
  2087. }}
  2088. ExecDataByConfig(this.requestParam).then(response => {
  2089. console.log('顺序切换保存发送参数', this.requestParam)
  2090. if (response.msg === 'fail') {
  2091. this.$notify({ title: '顺序切换失败', message: response.data, type: 'warning', duration: 2000 })
  2092. } else {
  2093. this.$notify({ title: '', message: '顺序切换成功', type: 'success', duration: 2000 })
  2094. this.getList2()
  2095. this.getList3()
  2096. this.isOrder = true
  2097. }
  2098. })
  2099. },
  2100. cancelChangeOrder() {
  2101. // 取消顺序
  2102. this.getList2()
  2103. this.isOrder = true
  2104. },
  2105. form_search2() {
  2106. console.log('点击了查询')
  2107. this.arrowDown2 = true
  2108. this.arrowUp2 = false
  2109. this.table2.getdataListParm.offset = 1
  2110. // fname, feedgroup, fweight, autosecondname, islockcount, sort
  2111. // 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
  2112. this.table2.getdataListParm.parammaps.all = ''
  2113. var obj = {}
  2114. obj.fname = this.table2.getdataListParm.parammaps.fname
  2115. obj.feedgroup = this.table2.getdataListParm.parammaps.feedgroup
  2116. obj.fweight = this.table2.getdataListParm.parammaps.fweight
  2117. obj.autosecondname = this.table2.getdataListParm.parammaps.autosecondname
  2118. if (this.table2.getdataListParm.parammaps.islockcount !== '') {
  2119. if (this.table2.getdataListParm.parammaps.islockcount == 0) {
  2120. this.table2.getdataListParm.parammaps.islockcount = '否'
  2121. } else {
  2122. this.table2.getdataListParm.parammaps.islockcount = '是'
  2123. }
  2124. }
  2125. obj.islockcount = this.table2.getdataListParm.parammaps.islockcount
  2126. obj.sort = this.table2.getdataListParm.parammaps.sort
  2127. Object.getOwnPropertyNames(obj).forEach((key) => {
  2128. console.log(key, obj[key])
  2129. if (obj[key] !== '') {
  2130. this.table2.getdataListParm.parammaps.all += obj[key] + '/'
  2131. }
  2132. })
  2133. if (this.table2.getdataListParm.parammaps.all.charAt(this.table2.getdataListParm.parammaps.all.length - 1) == '/') {
  2134. this.table2.getdataListParm.parammaps.all = this.table2.getdataListParm.parammaps.all.slice(0, this.table2.getdataListParm.parammaps.all.length - 1)
  2135. }
  2136. this.getList2()
  2137. },
  2138. handleRefresh2() {
  2139. console.log('点击了重置')
  2140. this.table2.getdataListParm.parammaps.fname = ''
  2141. this.table2.getdataListParm.parammaps.feedgroup = ''
  2142. this.table2.getdataListParm.parammaps.fweight = ''
  2143. this.table2.getdataListParm.parammaps.autosecondname = ''
  2144. this.table2.getdataListParm.parammaps.islockcount = '0'
  2145. this.table2.getdataListParm.parammaps.sort = ''
  2146. this.table2.getdataListParm.parammaps.all = ''
  2147. this.table2.getdataListParm.offset = 1
  2148. this.getList2()
  2149. },
  2150. // 详情新增
  2151. handleCreate2() {
  2152. console.log('点击了详情新增', this.table2.list)
  2153. // 编辑true/不可编辑false
  2154. // 新增操true,编辑false,编辑保存false
  2155. console.log(11)
  2156. for (let i = 0; i < this.table2.list.length; i++) {
  2157. if (this.table2.list[i].Edit === true) {
  2158. console.log(123)
  2159. this.$message({ type: 'error', message: '当前内容未保存,请点击取消或保存继续进行操作', duration: 2000 })
  2160. return false
  2161. }
  2162. }
  2163. console.log(this.table2.list)
  2164. if (this.table2.list.length == 0) {
  2165. var mysort = 0
  2166. } else {
  2167. var mysort = parseInt(this.table2.list[this.table2.list.length - 1].sort) + 1
  2168. }
  2169. 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 })
  2170. console.log(this.table2.list)
  2171. },
  2172. changeFname(item, row) {
  2173. console.log(item, row)
  2174. this.table2.temp.fname = this.feedNameList.find(obj => obj.id == item).fname
  2175. row.fname = this.feedNameList.find(obj => obj.id == item).fname
  2176. if (this.feedNameList.find(obj => obj.id == item).ispreft == '0') {
  2177. this.table2.temp.preftid = '0'
  2178. } else {
  2179. this.table2.temp.preftid = item
  2180. }
  2181. if (row.sort == '') {
  2182. row.feedgroup = this.table2.temp.fname
  2183. } else {
  2184. if (row.isCreate == true) { // 新增状态下
  2185. for (let i = 1; i < this.table2.list.length; i++) {
  2186. if (this.table2.list[i].sort == row.sort) {
  2187. console.log(this.table2.list[i])
  2188. row.feedgroup = this.table2.list[i].feedgroup
  2189. break
  2190. } else {
  2191. row.feedgroup = this.table2.temp.fname
  2192. }
  2193. }
  2194. } else if (row.isUpdateSave == true) { // 编辑状态下
  2195. var Arr = []
  2196. for (let i = 0; i < this.table2.list.length; i++) {
  2197. Arr.push(this.table2.list[i].sort)
  2198. }
  2199. var Count = 0
  2200. for (let i = 0; i < Arr.length; i++) {
  2201. if (Arr[i] == row.sort) {
  2202. Count++
  2203. }
  2204. }
  2205. for (let i = 0; i < this.table2.list.length; i++) {
  2206. if (Count > 1) {
  2207. row.feedgroup = this.table2.list[i].feedgroup
  2208. console.log(this.table2.list[i].feedgroup)
  2209. break
  2210. } else if (Count == 1) {
  2211. row.feedgroup = this.table2.temp.fname
  2212. console.log(222, this.table2.temp.fname)
  2213. }
  2214. }
  2215. }
  2216. }
  2217. },
  2218. bort(row) {
  2219. if (row.isCreate == true) {
  2220. if (row.sort !== '') {
  2221. for (let i = 1; i < this.table2.list.length; i++) {
  2222. if (this.table2.list[i].sort == parseInt(row.sort)) {
  2223. row.feedgroup = this.table2.list[i].feedgroup
  2224. return false
  2225. } else {
  2226. row.feedgroup = row.fname
  2227. }
  2228. }
  2229. } else {
  2230. row.feedgroup = row.fname
  2231. }
  2232. } else if (row.isUpdateSave == true) {
  2233. if (row.sort !== '') {
  2234. for (let i = 0; i < this.table2.list.length; i++) {
  2235. if (this.table2.list[i].sort == row.sort) {
  2236. console.log('失去焦点,行内顺序与表格某顺序相同时', this.table2.list[i])
  2237. if (this.table2.list[i].id !== row.id) {
  2238. row.isGroupDisabled = true
  2239. row.feedgroup = this.table2.list[i].feedgroup
  2240. break
  2241. }
  2242. } else {
  2243. console.log('失去焦点,行内顺序与表格某顺序不相同时')
  2244. row.isGroupDisabled = true
  2245. row.feedgroup = row.fname
  2246. }
  2247. }
  2248. } else {
  2249. row.feedgroup = row.fname
  2250. }
  2251. }
  2252. },
  2253. createData2(row) {
  2254. console.log('点击了详情新增保存1', row)
  2255. this.table2.temp.pastureid = Cookies.get('pastureid')
  2256. this.table2.temp.ftid = this.table2.getdataListParm.parammaps.ftid
  2257. this.table2.temp.fid = row.fid
  2258. this.table2.temp.fname = this.table2.temp.fname
  2259. this.table2.temp.fweight = row.fweight
  2260. this.table2.temp.islockcount = row.islockcount
  2261. this.table2.temp.sort = row.sort
  2262. this.table2.temp.feedgroup = row.feedgroup
  2263. this.table2.temp.preftid = this.table2.temp.preftid
  2264. this.table2.temp.autosecond = row.autosecond
  2265. this.table2.temp.deviation = row.deviation
  2266. if (this.table2.temp.fid === '' && this.table2.temp.fweight === '' && this.table2.temp.autosecond === '' && this.table2.temp.deviation === '') {
  2267. this.$message({ type: 'error', message: '饲料名称/重量/搅拌延时/允许延时偏差不能为空', duration: 2000 })
  2268. return false
  2269. } else if (this.table2.temp.fweight === '' && this.table2.temp.autosecond === '' && this.table2.temp.deviation === '') {
  2270. this.$message({ type: 'error', message: '重量/搅拌延时/允许延时偏差不能为空', duration: 2000 })
  2271. return false
  2272. } else if (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.fid === '') {
  2276. this.$message({ type: 'error', message: '饲料名称不能为空', duration: 2000 })
  2277. return false
  2278. } else if (this.table2.temp.fweight === '') {
  2279. this.$message({ type: 'error', message: '重量不能为空', duration: 2000 })
  2280. return false
  2281. } else if (this.table2.temp.autosecond === '') {
  2282. this.$message({ type: 'error', message: '搅拌延时不能为空', duration: 2000 })
  2283. return false
  2284. } else if (this.table2.temp.deviation === '') {
  2285. this.$message({ type: 'error', message: '允许延时偏差不能为空', duration: 2000 })
  2286. return false
  2287. }
  2288. if(parseFloat(this.table2.temp.deviation) > parseFloat(this.table2.temp.autosecond)){
  2289. this.$message({ type: 'error', message: '允许延时偏差不可超出搅拌延时', duration: 2000 })
  2290. return false
  2291. }
  2292. if (this.table2.temp.sort !== '') {
  2293. this.table2.temp.sort = this.table2.temp.sort
  2294. } else {
  2295. console.log(this.table2.list.length)
  2296. if (this.table2.list.length == 1) {
  2297. this.table2.temp.sort = 0
  2298. } else {
  2299. this.table2.temp.sort = parseInt(this.table2.list[this.table2.list.length - 1].sort) + 1
  2300. row.sort = parseInt(this.table2.list[this.table2.list.length - 1].sort) + 1
  2301. }
  2302. }
  2303. if (this.table2.getdataListParm.parammaps.fttypeid == 2) {
  2304. if (parseInt(this.table2.temp.preftid) > 0) {
  2305. this.$message({ type: 'error', message: '饲料名称不能选择预混配方', duration: 2000 })
  2306. return false
  2307. }
  2308. }
  2309. // 校验顺序是否>=0
  2310. var ruleSort = /^\d+$/
  2311. if (!ruleSort.test(this.table2.temp.sort)) {
  2312. this.$message({ type: 'error', message: '饲料顺序不可为负数或小数', duration: 2000 })
  2313. return false
  2314. }
  2315. // 检验重量>0
  2316. this.table2.temp.fweight = formatNum(this.table2.temp.fweight, 4) // 根据默认参数设置小数位数
  2317. row.fweight = formatNum(row.fweight, 4)
  2318. // return
  2319. // var ruleWeight = /(^[1-9](\d+)?(\.\d{1,2})?$)|(^\d\.\d{1,2}$)/
  2320. if (this.table2.temp.fweight == 0) {
  2321. this.$message({ type: 'error', message: '重量请输入正数,最多保留四位小数', duration: 2000 })
  2322. return false
  2323. }
  2324. this.isokDisable = true
  2325. setTimeout(() => {
  2326. this.isokDisable = false
  2327. }, 1000)
  2328. let dateTime = parseTime(new Date(), '{y}-{m}-{d} {h}:{i}:{s}')
  2329. this.requestParam.common = { 'returnmap': '0' }
  2330. this.requestParam.createdate = dateTime
  2331. this.requestParam.data = []
  2332. this.requestParam.data[0] = { 'name': 'insertFTdetail', 'type': 'e', 'parammaps': {
  2333. pastureid: this.table2.temp.pastureid,
  2334. ftid: this.table2.getdataListParm.parammaps.ftid,
  2335. fid: row.fid,
  2336. fname: this.table2.temp.fname,
  2337. fweight: String(row.fweight),
  2338. islockcount: row.islockcount,
  2339. sort: row.sort,
  2340. feedgroup: row.feedgroup,
  2341. preftid: this.table2.temp.preftid,
  2342. autosecond: row.autosecond,
  2343. deviation: row.deviation
  2344. }}
  2345. this.requestParam.data[1] = { 'name': 'updateFPbyFTChange', 'type': 'e', 'parammaps': {
  2346. pastureid: this.table2.temp.pastureid,
  2347. ftid: this.table2.getdataListParm.parammaps.ftid,
  2348. type: this.table2.getdataListParm.parammaps.fttypeid,
  2349. status: 0
  2350. }}
  2351. this.requestParam.data[2] = { 'name': 'updateftversion', 'type': 'e', 'parammaps': {
  2352. pastureid: this.table2.getdataListParm.parammaps.pastureid,
  2353. id: this.table2.getdataListParm.parammaps.ftid
  2354. }}
  2355. this.requestParam.data[3] = { 'name': 'insertFitHistory', 'type': 'e', 'parammaps': {
  2356. weight: row.fweight,
  2357. preftid: this.table2.temp.preftid,
  2358. pastureid: this.table2.getdataListParm.parammaps.pastureid,
  2359. ftid: this.table2.getdataListParm.parammaps.ftid,
  2360. dateTime: dateTime,
  2361. slid: 0,
  2362. fid: row.fid,
  2363. autosecond: row.autosecond
  2364. }}
  2365. this.requestParam.data[4] = { 'name': 'insertFTHistory', 'type': 'e', 'parammaps': {
  2366. id:this.table2.getdataListParm.parammaps.ftid,
  2367. createdate:dateTime
  2368. }}
  2369. const url = 'authdata/ftdetail/edit'
  2370. const data = this.requestParam
  2371. postJson(url, data).then(response => {
  2372. if (response.msg !== 'fail') {
  2373. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  2374. this.getList2()
  2375. this.getList3()
  2376. } else {
  2377. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  2378. }
  2379. })
  2380. // ExecDataByConfig(this.requestParam).then(response => {
  2381. // console.log('新增保存发送参数', this.requestParam)
  2382. // if (response.msg !== 'fail') {
  2383. // this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  2384. // this.getList2()
  2385. // this.getList3()
  2386. // } else {
  2387. // this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  2388. // }
  2389. // })
  2390. },
  2391. createCancel2(row) {
  2392. console.log('点击了详情新增取消')
  2393. for (let i = 0; i < this.table2.list.length; i++) {
  2394. if (row.myId === this.table2.list[i].myId) {
  2395. var listIndex = this.table2.list.indexOf(this.table2.list[i])
  2396. }
  2397. if (listIndex > -1) {
  2398. this.table2.list.splice(listIndex, 1)
  2399. return
  2400. }
  2401. }
  2402. this.getDialogList()
  2403. },
  2404. // 详情编辑
  2405. handleUpdate2(row) {
  2406. console.log('详情编辑', row)
  2407. this.dropState = true
  2408. row.isGroupDisabled = false
  2409. row.islockcount = String(row.islockcount)
  2410. row.fid = String(row.fid)
  2411. // row.autosecond = String(row.autosecond)
  2412. row.autosecond = row.autosecond
  2413. row.deviation = row.deviation
  2414. this.table2.temp.fname = row.fname
  2415. this.table2.temp.preftid = row.preftid
  2416. const rowArr = []
  2417. for (let i = 0; i < this.table2.list.length; i++) {
  2418. if (this.table2.list[i].Edit == true) {
  2419. this.$message({ type: 'error', message: '当前内容未保存,请点击取消或保存继续进行操作', duration: 2000 })
  2420. return false
  2421. }
  2422. rowArr.push(this.table2.list[i].sort)
  2423. }
  2424. var count = 0
  2425. for (let i = 0; i < rowArr.length; i++) {
  2426. if (rowArr[i] == row.sort) {
  2427. count++
  2428. }
  2429. }
  2430. // 判断是否有相同顺序,如果没有饲料组不可编辑,若有饲料组可编辑
  2431. if (count == 1) {
  2432. // 饲料组编辑false,不可编辑true
  2433. row.groupEdit = false
  2434. row.groupNoEdit = true
  2435. // 编辑true,不可编辑false
  2436. row.Edit = true
  2437. row.NoEdit = false
  2438. // 新增false,编辑false,编辑保存true
  2439. row.isCreate = false
  2440. row.isUpdate = false
  2441. row.isUpdateSave = true
  2442. } else if (count > 1) {
  2443. // 饲料组编辑true,不可编辑false
  2444. row.groupEdit = true
  2445. row.groupNoEdit = false
  2446. console.log(222)
  2447. // 编辑true,不可编辑false
  2448. row.Edit = true
  2449. row.NoEdit = false
  2450. // 新增false,编辑false,编辑保存true
  2451. row.isCreate = false
  2452. row.isUpdate = false
  2453. row.isUpdateSave = true
  2454. return false
  2455. }
  2456. this.table2.updateList = Object.assign({}, row)
  2457. },
  2458. updateData2(row) {
  2459. console.log('点击了详情编辑保存', row)
  2460. this.isokDisable = true
  2461. setTimeout(() => {
  2462. this.isokDisable = false
  2463. }, 1000)
  2464. this.table2.temp.pastureid = row.pastureid
  2465. this.table2.temp.ftid = this.table2.getdataListParm.parammaps.ftid
  2466. this.table2.temp.fid = row.fid
  2467. this.table2.temp.fname = this.table2.temp.fname
  2468. this.table2.temp.fweight = row.fweight
  2469. this.table2.temp.islockcount = row.islockcount
  2470. this.table2.temp.sort = row.sort
  2471. this.table2.temp.feedgroup = row.feedgroup
  2472. this.table2.temp.preftid = this.table2.temp.preftid
  2473. this.table2.temp.autosecond = row.autosecond
  2474. this.table2.temp.deviation = row.deviation
  2475. this.table2.temp.id = row.id
  2476. console.log('this.table2.updateList', this.table2.updateList)
  2477. console.log('temp', this.table2.temp)
  2478. // var status = ''
  2479. // if (parseFloat(this.table2.temp.fweight) > parseFloat(this.table2.updateList.fweight)) {
  2480. // status = 0
  2481. // } else {
  2482. // status = 1
  2483. // }
  2484. if (this.table2.temp.fid === '' && this.table2.temp.fweight === '' && this.table2.temp.autosecond === '' && this.table2.temp.deviation === '') {
  2485. this.$message({ type: 'error', message: '饲料名称/重量/搅拌延时/允许延时偏差不能为空', duration: 2000 })
  2486. return false
  2487. } else if (this.table2.temp.fweight === '' && this.table2.temp.autosecond === '' && this.table2.temp.deviation === '') {
  2488. this.$message({ type: 'error', message: '重量/搅拌延时/允许延时偏差不能为空', duration: 2000 })
  2489. return false
  2490. } else if (this.table2.temp.autosecond === '' && this.table2.temp.deviation === '') {
  2491. this.$message({ type: 'error', message: '搅拌延时/允许延时偏差不能为空1=', duration: 2000 })
  2492. return false
  2493. }else if (this.table2.temp.fid === '') {
  2494. this.$message({ type: 'error', message: '饲料名称不能为空', duration: 2000 })
  2495. return false
  2496. } else if (this.table2.temp.fweight === '') {
  2497. this.$message({ type: 'error', message: '重量不能为空', duration: 2000 })
  2498. return false
  2499. } else if (this.table2.temp.autosecond === '') {
  2500. this.$message({ type: 'error', message: '搅拌延时不能为空', duration: 2000 })
  2501. return false
  2502. } else if (this.table2.temp.deviation === '') {
  2503. this.$message({ type: 'error', message: '允许延时偏差不能为空', duration: 2000 })
  2504. return false
  2505. }
  2506. if(parseFloat(this.table2.temp.deviation) > parseFloat(this.table2.temp.autosecond)){
  2507. this.$message({ type: 'error', message: '允许延时偏差不可超出搅拌延时', duration: 2000 })
  2508. return false
  2509. }
  2510. if (this.table2.temp.sort !== '') {
  2511. this.table2.temp.sort = this.table2.temp.sort
  2512. } else {
  2513. this.table2.temp.sort = parseInt(this.table2.list[this.table2.list.length - 1].sort) + 1
  2514. }
  2515. if (this.table2.getdataListParm.parammaps.fttypeid == 2) {
  2516. if (parseInt(this.table2.temp.preftid) > 0) {
  2517. this.$message({ type: 'error', message: '饲料名称不能选择预混配方', duration: 2000 })
  2518. return false
  2519. }
  2520. }
  2521. // 校验顺序是否>=0
  2522. var ruleSort = /^\d+$/
  2523. if (!ruleSort.test(this.table2.temp.sort)) {
  2524. this.$message({ type: 'error', message: '饲料顺序不可为负数或小数', duration: 2000 })
  2525. return false
  2526. }
  2527. this.table2.temp.fweight = formatNum(this.table2.temp.fweight, 4) // 根据默认参数设置小数位数
  2528. row.fweight = formatNum(row.fweight, 4)
  2529. // 检验重量>0
  2530. // var ruleWeight = /(^[1-9](\d+)?(\.\d{1,2})?$)|(^\d\.\d{1,2}$)/
  2531. if (this.table2.temp.fweight == 0) {
  2532. this.$message({ type: 'error', message: '重量请输入正数,最多保留四位小数', duration: 2000 })
  2533. return false
  2534. }
  2535. console.log(row.fweight,'row.fweight')
  2536. let dateTime = parseTime(new Date(), '{y}-{m}-{d} {h}:{i}:{s}')
  2537. this.requestParam.common = { 'returnmap': '0' }
  2538. this.requestParam.createdate = dateTime
  2539. this.requestParam.data = []
  2540. this.requestParam.data[0] = { 'name': 'insertFitHistory', 'type': 'e', 'parammaps': {
  2541. pastureid: row.pastureid,
  2542. ftid: this.table2.getdataListParm.parammaps.ftid,
  2543. weight: String(row.fweight),
  2544. preftid: this.table2.temp.preftid,
  2545. dateTime: dateTime,
  2546. slid: this.table2.temp.id,
  2547. fid: row.fid,
  2548. autosecond: row.autosecond
  2549. }}
  2550. this.requestParam.data[1] = { 'name': 'updateFTdetail', 'type': 'e', 'parammaps': {
  2551. pastureid: row.pastureid,
  2552. ftid: this.table2.getdataListParm.parammaps.ftid,
  2553. fid: row.fid,
  2554. fname: this.table2.temp.fname,
  2555. fweight: String(row.fweight),
  2556. islockcount: row.islockcount,
  2557. sort: row.sort,
  2558. feedgroup: row.feedgroup,
  2559. preftid: this.table2.temp.preftid,
  2560. autosecond: row.autosecond,
  2561. id: row.id,
  2562. deviation:row.deviation
  2563. }}
  2564. this.requestParam.data[2] = { 'name': 'updateFPbyFTChange', 'type': 'e', 'parammaps': {
  2565. pastureid: row.pastureid,
  2566. ftid: this.table2.getdataListParm.parammaps.ftid,
  2567. type: this.table2.getdataListParm.parammaps.fttypeid,
  2568. // status: status
  2569. }}
  2570. this.requestParam.data[3] = { 'name': 'updateFTdetailbySort', 'type': 'e', 'parammaps': {
  2571. pastureid: row.pastureid,
  2572. ftid: this.table2.getdataListParm.parammaps.ftid,
  2573. sort: row.sort,
  2574. feedgroup: row.feedgroup
  2575. }}
  2576. this.requestParam.data[4] = { 'name': 'updateFTdetailGroup', 'type': 'e', 'parammaps': {
  2577. pastureid: this.table2.getdataListParm.parammaps.pastureid,
  2578. ftid: this.table2.getdataListParm.parammaps.ftid
  2579. }}
  2580. this.requestParam.data[5] = { 'name': 'insertFTHistory', 'type': 'e', 'parammaps': {
  2581. id:this.table2.getdataListParm.parammaps.ftid,
  2582. createdate:dateTime
  2583. }}
  2584. const url = 'authdata/ftdetail/edit'
  2585. const data = this.requestParam
  2586. postJson(url, data).then(response => {
  2587. if (response.msg !== 'fail') {
  2588. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  2589. this.getList2()
  2590. this.getList3()
  2591. this.dropState = false
  2592. } else {
  2593. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  2594. }
  2595. })
  2596. // ExecDataByConfig(this.requestParam).then(response => {
  2597. // console.log('新增保存发送参数', this.requestParam)
  2598. // if (response.msg !== 'fail') {
  2599. // this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  2600. // this.getList2()
  2601. // this.getList3()
  2602. // this.dropState = false
  2603. // } else {
  2604. // this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  2605. // }
  2606. // })
  2607. },
  2608. updateCancel2(row) {
  2609. console.log('点击了详情编辑取消')
  2610. // 饲料组编辑false,不可编辑true
  2611. row.groupEdit = false
  2612. row.groupNoEdit = true
  2613. // 编辑false,不可编辑true
  2614. row.Edit = false
  2615. row.NoEdit = true
  2616. // 新增false,编辑true,编辑保存false
  2617. row.isCreate = false
  2618. row.isUpdate = true
  2619. row.isUpdateSave = false
  2620. this.getList2()
  2621. this.dropState = false
  2622. },
  2623. // 详情删除
  2624. handleRowDelete2(row) {
  2625. console.log('点击了行内删除')
  2626. MessageBox.confirm('是否确认删除此信息?', {
  2627. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  2628. }).then(() => {
  2629. console.log(this.table2.list.length)
  2630. let dateTime = parseTime(new Date(), '{y}-{m}-{d} {h}:{i}:{s}')
  2631. if (this.table2.list.length > 1) {
  2632. this.requestParam.common = { 'returnmap': '0' }
  2633. this.requestParam.createdate = dateTime
  2634. this.requestParam.data = []
  2635. this.requestParam.data[0] = { 'name': 'insertFitHistory', 'type': 'e', 'parammaps': {
  2636. pastureid: row.pastureid,
  2637. ftid: this.table2.getdataListParm.parammaps.ftid,
  2638. weight: 0,
  2639. preftid: row.preftid,
  2640. dateTime: dateTime,
  2641. slid: row.id,
  2642. fid: row.fid,
  2643. autosecond: row.autosecond
  2644. }}
  2645. this.requestParam.data[1] = { 'name': 'deleteFTdetail', 'type': 'e', 'parammaps': {
  2646. pastureid: row.pastureid,
  2647. id: row.id
  2648. }}
  2649. this.requestParam.data[2] = { 'name': 'updateFPbyFTChange', 'type': 'e', 'parammaps': {
  2650. pastureid: row.pastureid,
  2651. ftid: this.table2.getdataListParm.parammaps.ftid,
  2652. type: this.table2.getdataListParm.parammaps.fttypeid,
  2653. status: 1
  2654. }}
  2655. this.requestParam.data[3] = { 'name': 'updateftversion', 'type': 'e', 'parammaps': {
  2656. pastureid: this.table2.getdataListParm.parammaps.pastureid,
  2657. id: this.table2.getdataListParm.parammaps.ftid
  2658. }}
  2659. this.requestParam.data[4] = { 'name': 'insertFTHistory', 'type': 'e', 'parammaps': {
  2660. id:this.table2.getdataListParm.parammaps.ftid,
  2661. createdate:dateTime
  2662. }}
  2663. } else {
  2664. this.requestParam.common = { 'returnmap': '0' }
  2665. this.requestParam.createdate = dateTime
  2666. this.requestParam.data = []
  2667. // this.requestParam.data[1] = { 'name': 'checkdeleteFT', 'type': 'v', 'parammaps': {
  2668. // pastureid: this.table2.getdataListParm.parammaps.pastureid,
  2669. // id: this.table2.getdataListParm.parammaps.ftid
  2670. // }}
  2671. this.requestParam.data[0] = { 'name': 'insertFitHistory', 'type': 'e', 'parammaps': {
  2672. pastureid: row.pastureid,
  2673. ftid: this.table2.getdataListParm.parammaps.ftid,
  2674. weight: 0,
  2675. preftid: row.preftid,
  2676. dateTime: dateTime,
  2677. slid: row.id,
  2678. fid: row.fid,
  2679. autosecond: row.autosecond
  2680. }}
  2681. this.requestParam.data[1] = { 'name': 'deleteFTdetail', 'type': 'e', 'parammaps': {
  2682. pastureid: row.pastureid,
  2683. id: row.id
  2684. }}
  2685. this.requestParam.data[2] = { 'name': 'updateFPbyFTChange', 'type': 'e', 'parammaps': {
  2686. pastureid: row.pastureid,
  2687. ftid: this.table2.getdataListParm.parammaps.ftid,
  2688. type: this.table2.getdataListParm.parammaps.fttypeid,
  2689. status: 1
  2690. }}
  2691. this.requestParam.data[3] = { 'name': 'updateftversion', 'type': 'e', 'parammaps': {
  2692. pastureid: this.table2.getdataListParm.parammaps.pastureid,
  2693. id: this.table2.getdataListParm.parammaps.ftid
  2694. }}
  2695. this.requestParam.data[4] = { 'name': 'insertFTHistory', 'type': 'e', 'parammaps': {
  2696. id:this.table2.getdataListParm.parammaps.ftid,
  2697. createdate:dateTime
  2698. }}
  2699. }
  2700. const url = 'authdata/ftdetail/edit'
  2701. const data = this.requestParam
  2702. postJson(url, data).then(response => {
  2703. if (response.msg !== 'fail') {
  2704. this.$notify({ title: '成功', message: '删除成功', type: 'success', duration: 2000 })
  2705. this.getList2()
  2706. this.getList3()
  2707. } else {
  2708. this.$notify({ title: '删除失败', message: response.data, type: 'warning', duration: 2000 })
  2709. }
  2710. })
  2711. // ExecDataByConfig(this.requestParam).then(response => {
  2712. // console.log('新增保存发送参数', this.requestParam)
  2713. // if (response.msg === 'fail') {
  2714. // this.$notify({ title: '删除失败', message: response.data, type: 'warning', duration: 2000 })
  2715. // } else {
  2716. // this.$notify({ title: '成功', message: '删除成功', type: 'success', duration: 2000 })
  2717. // this.getList2()
  2718. // this.getList3()
  2719. // }
  2720. // })
  2721. }).catch(() => {
  2722. this.$message({ type: 'info', message: '已取消删除' })
  2723. })
  2724. },
  2725. handleSelectionChange2(val) {
  2726. console.log('勾选数据', val)
  2727. this.selectList2 = val
  2728. },
  2729. celldblclick(row, column, cell, event) {
  2730. console.log(row, '=====')
  2731. this.handleUpdate2(row)
  2732. },
  2733. form_delete2() {
  2734. console.log('点击了删除')
  2735. if (this.selectList2.length == 0) {
  2736. this.$message({ type: 'error', message: '请选择配方详情', duration: 2000 })
  2737. } else {
  2738. MessageBox.confirm('是否确认删除此信息?', {
  2739. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  2740. }).then(() => {
  2741. console.log(this.table2.list.length - this.selectList2.length)
  2742. let dateTime = parseTime(new Date(), '{y}-{m}-{d} {h}:{i}:{s}')
  2743. if (this.table2.list.length - this.selectList2.length > 0) {
  2744. this.requestParam.common = { 'returnmap': '0' }
  2745. this.requestParam.createdate = dateTime
  2746. this.requestParam.data = []
  2747. this.requestParam.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.selectList2 }}
  2748. this.requestParam.data[0].children = []
  2749. this.requestParam.data[0].children[0] = { 'name': 'insertFitHistory', 'type': 'e', 'parammaps': {
  2750. pastureid: '@insertSpotList.pastureid',
  2751. ftid: '@insertSpotList.ftid',
  2752. weight: 0,
  2753. preftid: '@insertSpotList.preftid',
  2754. dateTime: dateTime,
  2755. slid: '@insertSpotList.id',
  2756. fid: '@insertSpotList.fid',
  2757. autosecond: '@insertSpotList.autosecond'
  2758. }}
  2759. this.requestParam.data[0].children[1] = { 'name': 'deleteFTdetail', 'type': 'e', 'parammaps': {
  2760. id: '@insertSpotList.id',
  2761. pastureid: '@insertSpotList.pastureid'
  2762. }}
  2763. this.requestParam.data[1] = { 'name': 'updateftversion', 'type': 'e', 'parammaps': {
  2764. pastureid: this.table2.getdataListParm.parammaps.pastureid,
  2765. id: this.table2.getdataListParm.parammaps.ftid
  2766. }}
  2767. this.requestParam.data[2] = { 'name': 'updateFPbyFTChange', 'type': 'e', 'parammaps': {
  2768. pastureid: this.table2.getdataListParm.parammaps.pastureid,
  2769. ftid:this.table2.getdataListParm.parammaps.ftid,
  2770. type: this.table2.getdataListParm.parammaps.fttypeid,
  2771. status: 1
  2772. }}
  2773. this.requestParam.data[3] = { 'name': 'insertFTHistory', 'type': 'e', 'parammaps': {
  2774. id:this.table2.getdataListParm.parammaps.ftid,
  2775. createdate:dateTime
  2776. }}
  2777. const url = 'authdata/ftdetail/edit'
  2778. const data = this.requestParam
  2779. postJson(url, data).then(response => {
  2780. if (response.msg !== 'fail') {
  2781. this.$notify({ title: '成功', message: '删除成功', type: 'success', duration: 2000 })
  2782. this.getList2()
  2783. this.getList3()
  2784. } else {
  2785. this.$notify({ title: '删除失败', message: response.data, type: 'warning', duration: 2000 })
  2786. }
  2787. })
  2788. } else {
  2789. this.requestParam.common = { 'returnmap': '0' }
  2790. this.requestParam.data = []
  2791. // this.requestParam.data[0] = { 'name': 'checkdeleteFT', 'type': 'v', 'parammaps': {
  2792. // pastureid: this.table2.getdataListParm.parammaps.pastureid,
  2793. // id: this.table2.getdataListParm.parammaps.ftid
  2794. // }}
  2795. // this.requestParam.data[1] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.selectList2 }}
  2796. // this.requestParam.data[1].children = []
  2797. // this.requestParam.data[1].children[0] = { 'name': 'deleteFTdetail', 'type': 'e', 'parammaps': {
  2798. // id: '@insertSpotList.id',
  2799. // pastureid: '@insertSpotList.pastureid'
  2800. // }}
  2801. this.requestParam.data[0] = { 'name': 'updateftversion', 'type': 'e', 'parammaps': {
  2802. pastureid: this.table2.getdataListParm.parammaps.pastureid,
  2803. id: this.table2.getdataListParm.parammaps.ftid
  2804. }}
  2805. // this.requestParam.data[3] = { 'name': 'updateFPbyFTChange', 'type': 'e', 'parammaps': {
  2806. // pastureid: this.table2.getdataListParm.parammaps.pastureid,
  2807. // ftid:this.table2.getdataListParm.parammaps.ftid,
  2808. // type: this.table2.getdataListParm.parammaps.fttypeid,
  2809. // status: 1
  2810. // }}
  2811. ExecDataByConfig(this.requestParam).then(response => {
  2812. console.log('删除保存发送参数', this.requestParam)
  2813. if (response.msg === 'fail') {
  2814. this.$notify({ title: '删除失败', message: response.data, type: 'warning', duration: 2000 })
  2815. } else {
  2816. const url = 'authdata/ftdetai/del'
  2817. const data = {}
  2818. data.parammaps = {}
  2819. data.parammaps.pastureid = this.table2.getdataListParm.parammaps.pastureid
  2820. data.parammaps.ftid = this.table2.getdataListParm.parammaps.ftid
  2821. data.parammaps.type = this.table2.getdataListParm.parammaps.fttypeid
  2822. postJson(url, data).then(response => {
  2823. if (response.msg !== 'fail') {
  2824. this.$notify({ title: '成功', message: '删除成功', type: 'success', duration: 2000 })
  2825. this.getList2()
  2826. this.getList3()
  2827. } else {
  2828. this.$notify({ title: '删除失败', message: response.data, type: 'warning', duration: 2000 })
  2829. }
  2830. })
  2831. }
  2832. })
  2833. }
  2834. })
  2835. }
  2836. },
  2837. // 拆分预混料
  2838. handleSplitPremix(row) {
  2839. console.log('点击了拆分预混料')
  2840. MessageBox.confirm('是否确认拆分当前预混料?', {
  2841. confirmButtonText: '确认',
  2842. cancelButtonText: '取消',
  2843. type: 'warning'
  2844. }).then(() => {
  2845. this.requestParam.name = 'splitFTpre'
  2846. this.requestParam.parammaps = {}
  2847. this.requestParam.parammaps.ftid = this.table2.getdataListParm.parammaps.ftid
  2848. this.requestParam.parammaps.preftid = row.preftid
  2849. this.requestParam.parammaps.ftdid = row.id
  2850. this.requestParam.parammaps.pastureid = row.pastureid
  2851. this.requestParam.parammaps.feedgroup = row.feedgroup
  2852. this.requestParam.parammaps.sort = row.sort
  2853. this.requestParam.parammaps.fweight = row.fweight
  2854. PostDataByName(this.requestParam).then(response => {
  2855. if (response.msg === 'fail') {
  2856. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  2857. } else {
  2858. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  2859. this.getList2()
  2860. this.getList3()
  2861. }
  2862. })
  2863. }).catch(() => {
  2864. this.$message({
  2865. type: 'info',
  2866. message: '已取消删除'
  2867. })
  2868. })
  2869. },
  2870. // 合成预混料
  2871. handleSyntheticPremix() {
  2872. console.log('点击了合成预混料', this.selectList2)
  2873. this.dialogFull = false
  2874. if (this.table2.getdataListParm.parammaps.fttypeid == 2) {
  2875. this.$message({ type: 'error', message: '预混配方不可合成预混料', duration: 2000 })
  2876. return false
  2877. } else {
  2878. if (this.selectList2.length > 1) {
  2879. for (let i = 0; i < this.selectList2.length; i++) {
  2880. if (parseInt(this.selectList2[i].preftid) > 0) {
  2881. this.$message({ type: 'error', message: '不可选择预混料', duration: 2000 })
  2882. return false
  2883. }
  2884. }
  2885. if (this.selectList2[0].splitftpreid !== undefined) {
  2886. this.detail.getdataListParm.parammaps.ftid = this.selectList2[0].splitftpreid
  2887. this.detail.getdataListParm.parammaps.pastureid = this.selectList2[0].pastureid
  2888. GetDataByName(this.detail.getdataListParm).then(response => {
  2889. if (response.data.list !== null) { // 不为空时得到比对数据
  2890. this.detail.list3 = response.data.list
  2891. const sortList = [] // 声明排序数组
  2892. var fweightSum = 0 // 总重量
  2893. for (let i = 0; i < this.selectList2.length; i++) {
  2894. const obj = {}
  2895. obj.fid = this.selectList2[i].fid
  2896. obj.fweight = this.selectList2[i].fweight
  2897. fweightSum = fweightSum + parseFloat(this.selectList2[i].fweight)
  2898. sortList.push(obj)
  2899. }
  2900. // 排序
  2901. sortList.sort(function(a, b) {
  2902. return a.fid.localeCompare(b.fid)
  2903. })
  2904. var a = 0
  2905. if (this.detail.list3.length == sortList.length) {
  2906. for (let i = 0; i < this.detail.list3.length; i++) {
  2907. 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)) {
  2908. a++
  2909. }
  2910. }
  2911. if (a == this.detail.list3.length) { // 如果相等,则该配方为原预混配方
  2912. this.detail.getdataListParm2.parammaps.ftid = this.selectList2[0].splitftpreid
  2913. this.detail.getdataListParm2.parammaps.pastureid = this.selectList2[0].pastureid
  2914. GetDataByName(this.detail.getdataListParm2).then(response => {
  2915. if (response.data.list !== null) {
  2916. this.detail.dialogStatus = 'SyntheticPremix'
  2917. this.detail.dialogFormVisible = true
  2918. this.detail.list = this.selectList2
  2919. this.detail.list2 = response.data.list
  2920. this.detail.disabled = true
  2921. setTimeout(() => {
  2922. this.detail.listLoading = false
  2923. }, 100)
  2924. } else {
  2925. this.detail.list2 = []
  2926. }
  2927. })
  2928. } else {
  2929. this.detail.dialogStatus = 'SyntheticPremix'
  2930. this.detail.dialogFormVisible = true
  2931. this.detail.list = this.selectList2
  2932. this.detail.disabled = false
  2933. this.detail.list2 = [{ tname: '', tcolor: '#ccc', ccid: '', fttype: '预混配方', fttypeid: '2', source: '自定义', remark: '', 'enable': 1 }]
  2934. setTimeout(() => {
  2935. this.detail.listLoading = false
  2936. }, 100)
  2937. }
  2938. } else {
  2939. this.detail.dialogStatus = 'SyntheticPremix'
  2940. this.detail.dialogFormVisible = true
  2941. this.detail.list = this.selectList2
  2942. this.detail.disabled = false
  2943. this.detail.list2 = [{ tname: '', tcolor: '#ccc', ccid: '', fttype: '预混配方', fttypeid: '2', source: '自定义', remark: '', 'enable': 1 }]
  2944. setTimeout(() => {
  2945. this.detail.listLoading = false
  2946. }, 100)
  2947. }
  2948. } else {
  2949. this.detail.list3 = []
  2950. this.detail.dialogStatus = 'SyntheticPremix'
  2951. this.detail.dialogFormVisible = true
  2952. this.detail.list = this.selectList2
  2953. this.detail.disabled = false
  2954. this.detail.list2 = [{ tname: '', tcolor: '#ccc', ccid: '', fttype: '预混配方', fttypeid: '2', source: '自定义', remark: '', 'enable': 1 }]
  2955. setTimeout(() => {
  2956. this.detail.listLoading = false
  2957. }, 100)
  2958. }
  2959. })
  2960. } else {
  2961. this.detail.dialogStatus = 'SyntheticPremix'
  2962. this.detail.dialogFormVisible = true
  2963. this.detail.list = this.selectList2
  2964. this.detail.disabled = false
  2965. this.detail.list2 = [{ tname: '', tcolor: '#ccc', ccid: '', fttype: '预混配方', fttypeid: '2', source: '自定义', remark: '', 'enable': 1 }]
  2966. setTimeout(() => {
  2967. this.detail.listLoading = false
  2968. }, 100)
  2969. }
  2970. } else {
  2971. this.$message({ type: 'error', message: '请选择俩条及以上饲料进行合成', duration: 2000 })
  2972. return false
  2973. }
  2974. }
  2975. },
  2976. // 畜生类别
  2977. changeLivestockType2(item) {
  2978. this.detail.list2[0].ccname = this.livestockTypeList.find(obj => obj.value === item).label
  2979. },
  2980. syntheticPremixData() {
  2981. console.log('点击了合成预混料确认')
  2982. if (this.detail.disabled == true) { // 原预混料
  2983. let sumFweight = 0
  2984. for (let i = 0; i < this.detail.list.length; i++) {
  2985. sumFweight += parseFloat(this.detail.list[i].fweight)
  2986. }
  2987. sumFweight = sumFweight.toFixed(3)
  2988. this.isokDisable = true
  2989. setTimeout(() => {
  2990. this.isokDisable = false
  2991. }, 1000)
  2992. this.requestParam.common = { 'returnmap': '0' }
  2993. this.requestParam.data = []
  2994. this.requestParam.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.detail.list }}
  2995. this.requestParam.data[0].children = []
  2996. this.requestParam.data[0].children[0] = { 'name': 'deleteFTdetail', 'type': 'e', 'parammaps': {
  2997. pastureid: '@insertSpotList.pastureid',
  2998. id: '@insertSpotList.id'
  2999. }}
  3000. this.requestParam.data[1] = { 'name': 'insertSpotList2', 'resultmaps': { 'list': this.detail.list2 }}
  3001. this.requestParam.data[1].children = []
  3002. this.requestParam.data[1].children[0] = { 'name': 'insertFTdetail', 'type': 'e', 'parammaps': {
  3003. pastureid: Cookies.get('pastureid'),
  3004. ftid: this.table2.getdataListParm.parammaps.ftid,
  3005. fid: this.detail.list2[0].id,
  3006. fname: '@insertSpotList2.tname',
  3007. fweight: sumFweight,
  3008. islockcount: '0',
  3009. sort: parseInt(this.table2.list[this.table2.list.length - 1].sort) + 1,
  3010. feedgroup: '@insertSpotList2.tname',
  3011. preftid: this.detail.list2[0].id,
  3012. autosecond: this.detail.list[0].autosecond
  3013. }}
  3014. ExecDataByConfig(this.requestParam).then(response => {
  3015. console.log('合成预混料保存发送参数', this.requestParam)
  3016. if (response.msg === 'fail') {
  3017. const tname = new RegExp("key 'tname'")
  3018. if (tname.test(response.data)) {
  3019. this.$message({ type: 'error', message: '预混配方已存在,不可重复生成', duration: 2000 })
  3020. } else {
  3021. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  3022. }
  3023. } else {
  3024. this.$notify({ title: '', message: '保存成功', type: 'success', duration: 2000 })
  3025. this.detail.dialogFormVisible = false
  3026. this.getList3()
  3027. this.getList2()
  3028. this.getDownList()
  3029. }
  3030. })
  3031. } else { // 现生成预混料
  3032. if (this.detail.list2[0].tname == '' && this.detail.list2[0].ccid == '') {
  3033. this.$message({ type: 'error', message: '配方名称/牲畜类别/不能为空', duration: 2000 })
  3034. return false
  3035. } else if (this.detail.list2[0].tname == '') {
  3036. this.$message({ type: 'error', message: '配方名称不能为空', duration: 2000 })
  3037. return false
  3038. } else if (this.detail.list2[0].ccid == '') {
  3039. this.$message({ type: 'error', message: '牲畜类别不能为空', duration: 2000 })
  3040. return false
  3041. }
  3042. const pattern = new RegExp("[`~!@#$^&*()=|{}':;',\\[\\].<>/?~!@#¥……&*()——|{}【】‘;:”“'。,、?]")
  3043. if (pattern.test(this.detail.list2[0].tname)) {
  3044. this.$message({ type: 'error', message: '配方名称不可输入特殊字符', duration: 2000 })
  3045. return false
  3046. }
  3047. let sumFweight = 0
  3048. for (let i = 0; i < this.detail.list.length; i++) {
  3049. sumFweight += parseFloat(this.detail.list[i].fweight)
  3050. }
  3051. sumFweight = sumFweight.toFixed(3)
  3052. console.log(sumFweight)
  3053. this.isokDisable = true
  3054. setTimeout(() => {
  3055. this.isokDisable = false
  3056. }, 1000)
  3057. if (this.detail.list2[0].tcolor == null) {
  3058. this.detail.list2[0].tcolor = '#CCCCCC'
  3059. }
  3060. this.requestParam.common = { 'returnmap': '0' }
  3061. this.requestParam.data = []
  3062. this.requestParam.data[0] = { 'name': 'insertFT', 'type': 'e', 'parammaps': {
  3063. pastureid: Cookies.get('pastureid'),
  3064. tcode: this.detail.list2[0].tcode,
  3065. tname: this.detail.list2[0].tname,
  3066. tcolor: this.detail.list2[0].tcolor,
  3067. ccid: this.detail.list2[0].ccid,
  3068. ccname: this.detail.list2[0].ccname,
  3069. fttype: this.detail.list2[0].fttype,
  3070. fttypeid: this.detail.list2[0].fttypeid,
  3071. source: this.detail.list2[0].source,
  3072. remark: this.detail.list2[0].remark,
  3073. enable: this.detail.list2[0].enable
  3074. }}
  3075. this.requestParam.data[1] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.detail.list }}
  3076. this.requestParam.data[1].children = []
  3077. this.requestParam.data[1].children[0] = { 'name': 'insertFTdetail', 'type': 'e', 'parammaps': {
  3078. pastureid: '@insertSpotList.pastureid',
  3079. ftid: '@insertFT.LastInsertId',
  3080. fid: '@insertSpotList.fid',
  3081. fname: '@insertSpotList.fname',
  3082. fweight: '@insertSpotList.fweight',
  3083. islockcount: '@insertSpotList.islockcount',
  3084. sort: '@insertSpotList.sort',
  3085. feedgroup: '@insertSpotList.feedgroup',
  3086. preftid: '@insertSpotList.preftid',
  3087. autosecond: '@insertSpotList.autosecond'
  3088. }}
  3089. this.requestParam.data[1].children[1] = { 'name': 'deleteFTdetail', 'type': 'e', 'parammaps': {
  3090. pastureid: '@insertSpotList.pastureid',
  3091. id: '@insertSpotList.id'
  3092. }}
  3093. this.requestParam.data[2] = { 'name': 'insertSpotList2', 'resultmaps': { 'list': this.detail.list2 }}
  3094. this.requestParam.data[2].children = []
  3095. this.requestParam.data[2].children[0] = { 'name': 'insertFTdetail', 'type': 'e', 'parammaps': {
  3096. pastureid: Cookies.get('pastureid'),
  3097. ftid: this.table2.getdataListParm.parammaps.ftid,
  3098. fid: '@insertFT.LastInsertId',
  3099. fname: '@insertSpotList2.tname',
  3100. fweight: sumFweight,
  3101. islockcount: '0',
  3102. sort: parseInt(this.table2.list[this.table2.list.length - 1].sort) + 1,
  3103. feedgroup: '@insertSpotList2.tname',
  3104. preftid: '@insertFT.LastInsertId',
  3105. autosecond: this.detail.list[0].autosecond
  3106. }}
  3107. ExecDataByConfig(this.requestParam).then(response => {
  3108. console.log('合成预混料保存发送参数', this.requestParam)
  3109. if (response.msg === 'fail') {
  3110. const tname = new RegExp("key 'tname'")
  3111. if (tname.test(response.data)) {
  3112. this.$message({ type: 'error', message: '预混配方已存在,不可重复生成', duration: 2000 })
  3113. } else {
  3114. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  3115. }
  3116. } else {
  3117. this.$notify({ title: '', message: '保存成功', type: 'success', duration: 2000 })
  3118. this.detail.dialogFormVisible = false
  3119. this.getList3()
  3120. this.getList2()
  3121. this.getDownList()
  3122. }
  3123. })
  3124. }
  3125. },
  3126. handleFormulationEvaluation(row) {
  3127. console.log(row)
  3128. // this.$router.push({ path: '/statisticalAnalysis/FormulationEvaluation', query: { tname: row.tname }})
  3129. this.$router.push({
  3130. name: 'FormulationEvaluation',
  3131. params: {
  3132. tname: row.tname,
  3133. ftid: row.id,
  3134. pastureid: row.pastureid,
  3135. startTime: parseTime(new Date(), '{y}-{m}-{d}'),
  3136. inputDatetime: [new Date('startTime'), new Date('startTime')], // 日期后台待传
  3137. stopTime: parseTime(new Date(), '{y}-{m}-{d}')
  3138. }
  3139. })
  3140. },
  3141. // 配方记录
  3142. handleRowRecipeRecord(row) {
  3143. console.log(row)
  3144. this.rowRecipeRecord.temp = Object.assign({}, row)
  3145. this.rowRecipeRecord.dialogFormVisible = true
  3146. this.textMap.rowRecipeRecordTxt = '配方修改记录——配方:' + row.tname
  3147. this.rowRecipeRecord.dialogStatus = 'rowRecipeRecordTxt'
  3148. this.rowRecipeRecord.getdataListParm.parammaps.pastureid = row.pastureid
  3149. this.rowRecipeRecord.getdataListParm.parammaps.fitid = row.id
  3150. this.rowRecipeRecord.getdataListParm.parammaps.inputDatetime = []
  3151. this.getRowRecipeRecordList()
  3152. },
  3153. getRowRecipeRecordList() {
  3154. this.rowRecipeRecord.listLoading = true
  3155. this.rowRecipeRecord.getdataListParm.parammaps.fitid = this.rowRecipeRecord.temp.id
  3156. if (this.rowRecipeRecord.getdataListParm.parammaps.inputDatetime == null) {
  3157. this.rowRecipeRecord.getdataListParm.parammaps.inputDatetime = ''
  3158. this.rowRecipeRecord.getdataListParm.parammaps.startTime = ''
  3159. this.rowRecipeRecord.getdataListParm.parammaps.stopTime = ''
  3160. } else {
  3161. this.rowRecipeRecord.getdataListParm.parammaps.startTime = this.rowRecipeRecord.getdataListParm.parammaps.inputDatetime[0]
  3162. this.rowRecipeRecord.getdataListParm.parammaps.stopTime = this.rowRecipeRecord.getdataListParm.parammaps.inputDatetime[1]
  3163. }
  3164. const url = 'authdata/GetArrList'
  3165. const data = this.rowRecipeRecord.getdataListParm
  3166. postJson(url, data).then(response => {
  3167. if (response.data.list !== null) {
  3168. for (let i = 0; i < response.data.list.length; i++) {
  3169. if (response.data.list[i].arrList == null) {
  3170. this.$set(response.data.list[i], 'arrList', [])
  3171. }
  3172. }
  3173. this.rowRecipeRecord.list = response.data.list
  3174. this.rowRecipeRecord.pageNum = response.data.pageNum
  3175. this.rowRecipeRecord.pageSize = response.data.pageSize
  3176. this.rowRecipeRecord.total = response.data.total
  3177. } else {
  3178. this.rowRecipeRecord.list = []
  3179. this.rowRecipeRecord.total = 0
  3180. }
  3181. console.log(response.data, 'response.data')
  3182. setTimeout(() => {
  3183. this.rowRecipeRecord.listLoading = false
  3184. }, 100)
  3185. })
  3186. },
  3187. handleRowRecipeRecordSearch() {
  3188. this.getRowRecipeRecordList()
  3189. },
  3190. handleEnlarge() {
  3191. var height = (document.documentElement.clientHeight - 165 + 50).toString() + 'px'
  3192. // var height = (document.documentElement.clientHeight - 165 + 80).toString() + 'px'
  3193. // var height2 = '-' + (document.documentElement.clientHeight - 400).toString() + 'px'
  3194. var height2 = '-' + (this.$refs.template.offsetHeight).toString() + 'px'
  3195. // console.log(this.$refs.detail.offsetHeight)
  3196. // console.log(height2, 'height2')
  3197. this.isEnlarge = false
  3198. this.$refs.detail.style.top = height2
  3199. this.$refs.detail.style.height = height
  3200. this.$refs.appContainer.style.height = height
  3201. this.$refs.table2.style.height = 0
  3202. this.$refs.myContainer.style.posiiton = 'relative'
  3203. this.$refs.detail.style.posiiton = 'absolute'
  3204. },
  3205. handleNarrow() {
  3206. this.isEnlarge = true
  3207. this.$refs.detail.style.top = 0
  3208. this.$refs.detail.style.height = '300px'
  3209. this.$refs.myContainer.style.posiiton = ''
  3210. this.$refs.detail.style.posiiton = ''
  3211. this.$refs.detail.style.zIndex = ''
  3212. },
  3213. handleTakeEffect() {
  3214. if (this.selectList.length == 0) {
  3215. this.$message({ type: 'error', message: '请选择车次信息', duration: 2000 })
  3216. } else {
  3217. MessageBox.confirm('当前选中' + this.selectList.length + '条信息,是否生效?', {
  3218. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  3219. }).then(() => {
  3220. let ids = []
  3221. for (let i = 0; i < this.selectList.length; i++) {
  3222. ids.push(this.selectList[i].id)
  3223. }
  3224. var data = {}
  3225. data.parammaps = {}
  3226. data.parammaps.enable = 1
  3227. data.parammaps.id = ids.toString()
  3228. var url = 'authdata/feedtemplet/enable'
  3229. postJson(url,data).then(response => {
  3230. console.log('生效保存发送参数', data)
  3231. if (response.msg === 'fail') {
  3232. this.$notify({ title: '生效失败', message: response.data, type: 'warning', duration: 2000 })
  3233. } else {
  3234. this.$notify({ title: '', message: '生效成功', type: 'success', duration: 2000 })
  3235. this.getList()
  3236. }
  3237. })
  3238. })
  3239. }
  3240. },
  3241. handleDisable() {
  3242. if (this.selectList.length == 0) {
  3243. this.$message({ type: 'error', message: '请选择车次信息', duration: 2000 })
  3244. } else {
  3245. MessageBox.confirm('当前选中' + this.selectList.length + '条信息,是否禁用?', {
  3246. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  3247. }).then(() => {
  3248. let ids = []
  3249. for (let i = 0; i < this.selectList.length; i++) {
  3250. ids.push(this.selectList[i].id)
  3251. }
  3252. var data = {}
  3253. data.parammaps = {}
  3254. data.parammaps.enable = 0
  3255. data.parammaps.id = ids.toString()
  3256. console.log('禁用', data)
  3257. var url = 'authdata/feedtemplet/enable'
  3258. postJson(url,data).then(response => {
  3259. console.log('禁用保存发送参数', this.requestParam)
  3260. if (response.msg === 'fail') {
  3261. this.$notify({ title: '禁用失败', message: response.data, type: 'warning', duration: 2000 })
  3262. } else {
  3263. this.$notify({ title: '', message: '禁用成功', type: 'success', duration: 2000 })
  3264. this.getList()
  3265. }
  3266. })
  3267. })
  3268. }
  3269. }
  3270. }
  3271. }
  3272. </script>
  3273. <style lang="scss" scoped>
  3274. // .search{margin-top:10px;height: 40px;}
  3275. // .operation{height: 50px;}
  3276. .table{margin-top:5px;}
  3277. .table2{margin-top:10px;}
  3278. $width:350px;
  3279. $left:325px;
  3280. .selectInput{
  3281. position: relative;
  3282. display: inline-block;
  3283. .Input{width: $width;position: relative;}
  3284. .el-icon-arrow-down{width: 30px;height: 30px;position: absolute;left: $left;top:10px;color:#C0C4CC;}
  3285. .el-icon-arrow-up{width: 30px;height: 30px;position: absolute;left: $left;top:10px;color:#C0C4CC;}
  3286. .selectUl{
  3287. 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;
  3288. li{
  3289. 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;
  3290. a{float:left;width: 80px;}
  3291. a:hover{color: rgba(0, 204, 102, 0.71); font-weight: 700;}
  3292. }
  3293. }
  3294. }
  3295. .template{
  3296. background: #fff;
  3297. position: relative;
  3298. }
  3299. .app-container{background: #fff;}
  3300. .detail{
  3301. background: #fff;
  3302. overflow-y: hidden;
  3303. overflow-x: hidden;
  3304. // position: fixed;
  3305. // bottom: 0;
  3306. // right:0;
  3307. z-index: 3;
  3308. // width: calc(100% - 210px);
  3309. position: relative;
  3310. }
  3311. .hide2{float: right;right:0;}
  3312. .templateDialog{
  3313. background: #fff;
  3314. position: relative;
  3315. }
  3316. .detailDialog{
  3317. background: #fff;
  3318. position: relative;
  3319. }
  3320. .hide{float: right;margin-right: 60px;}
  3321. </style>
  3322. <style>
  3323. .el-color-dropdown__main-wrapper{display: none !important;}
  3324. .el-color-dropdown__value{display: none !important;}
  3325. .el-color-dropdown__btns .el-button--text{display: none !important;}
  3326. </style>