54db4710914d2bb75e20b7b8a34e7ee184484689.svn-base 145 KB

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