index备.vue 144 KB

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