1d95c762f8f942a1c691f2ea06773488f36ddd0c.svn-base 111 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481
  1. <template>
  2. <div class="app-container">
  3. <!-- 配方模板表 -->
  4. <div ref="template" class="template">
  5. <div class="recipeTemplate">
  6. <p>配方模板表</p>
  7. </div>
  8. <div class="operation">
  9. <el-button class="success" @click="handleCreate">新增</el-button>
  10. <el-button class="danger" @click="handleDelete">删除</el-button>
  11. <el-button class="warning" @click="handleCopy">复制</el-button>
  12. <el-button class="success" @click="handleRecipeRecord">配方记录</el-button>
  13. <!-- <el-button class="success" @click="handleHistory">生成历史</el-button> -->
  14. <el-upload style="float: right;margin-right: 75px;" :headers="headers" :data="uploadData" :action="uploadExcelUrl" :show-file-list="false" :before-upload="beforeImport" :on-success="handleImportSuccess">
  15. <el-button class="import" style="float: right;">导入</el-button>
  16. </el-upload>
  17. <el-dropdown style="float: right;margin-right: 10px;">
  18. <el-button class="export">导出</el-button>
  19. <el-dropdown-menu slot="dropdown">
  20. <el-dropdown-item @click.native="handleExport(1)">导出模板</el-dropdown-item>
  21. <el-dropdown-item @click.native="handleExport(2)">导出数据</el-dropdown-item>
  22. </el-dropdown-menu>
  23. </el-dropdown>
  24. </div>
  25. <div class="search">
  26. <el-select v-model="table.getdataListParm.parammaps.ccname" filterable placeholder="牲畜类别" class="filter-item" clearable>
  27. <el-option v-for="item in livestockTypeList" :key="item.value" :label="item.label" :value="item.label" />
  28. </el-select>
  29. <el-select v-model="table.getdataListParm.parammaps.fttype" filterable placeholder="配方类型" class="filter-item" style="width: 120px;" clearable>
  30. <el-option v-for="item in formulaTypeList" :key="item.value" :label="item.label" :value="item.label" />
  31. </el-select>
  32. <el-select v-model="table.getdataListParm.parammaps.enable" filterable placeholder="是否启用" class="filter-item" style="width: 120px;" clearable>
  33. <el-option v-for="item in enableList" :key="item.id" :label="item.name" :value="item.id" />
  34. </el-select>
  35. <div ref="selectInput" class="filter-item selectInput">
  36. <el-input type="text" placeholder="请点击选择搜索条件" class="Input" />
  37. <i v-if="arrowDown" icon="el-icon-arrow-down" class="el-icon-arrow-down" />
  38. <i v-if="arrowUp" icon="el-icon-arrow-up" class="el-icon-arrow-up" />
  39. <ul v-if="arrowUp" class="selectUl">
  40. <li><a>配方名称</a><el-input v-model="table.getdataListParm.parammaps.tname" style="width: 245px;" /></li>
  41. <li><a>备注</a><el-input v-model="table.getdataListParm.parammaps.remark" style="width: 245px;" /></li>
  42. <li><a>来源</a><el-input v-model="table.getdataListParm.parammaps.source" style="width: 245px;" /></li>
  43. <li>
  44. <div style="float: right;">
  45. <el-button class="minCancel" @click="arrowUp=false;arrowDown=true;">取消</el-button>
  46. <el-button class="miniPrimary" @click="handleSearch">搜索</el-button>
  47. </div>
  48. </li>
  49. </ul>
  50. </div>
  51. <el-button class="successBorder" @click="handleSearch">查询</el-button>
  52. <el-button class="successBorder" @click="handleRefresh">重置</el-button>
  53. </div>
  54. <div 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. @row-click="tableRowClick"
  68. @selection-change="handleSelectionChange"
  69. >
  70. <el-table-column type="selection" align="center" width="50" />
  71. <el-table-column label="序号" align="center" type="index" width="50px">
  72. <template slot-scope="scope">
  73. <span>{{ scope.$index + (table.pageNum-1) * table.pageSize + 1 }}</span>
  74. </template>
  75. </el-table-column>
  76. <el-table-column label="配方名称" min-width="110px" align="center">
  77. <template slot-scope="scope">
  78. <span v-if="scope.row.NoEdit">{{ scope.row.tname }}</span>
  79. <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:95%;padding:10px 0;" />
  80. </template>
  81. </el-table-column>
  82. <el-table-column label="配方颜色" min-width="85px" align="center">
  83. <template slot-scope="scope">
  84. <el-color-picker v-model="scope.row.tcolor" size="mini" :disabled="scope.row.NoEdit" style="margin:10px 0;" />
  85. </template>
  86. </el-table-column>
  87. <el-table-column label="牲畜类别" min-width="130px" align="center">
  88. <template slot-scope="scope">
  89. <span v-if="scope.row.NoEdit">{{ scope.row.ccname }}</span>
  90. <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">
  91. <el-option v-for="item in livestockTypeList" :key="item.value" :label="item.label" :value="item.value" />
  92. </el-select>
  93. </template>
  94. </el-table-column>
  95. <el-table-column label="配方类型" min-width="130px" align="center">
  96. <template slot-scope="scope">
  97. <span v-if="scope.row.NoEdit">{{ scope.row.fttype }}</span>
  98. <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">
  99. <el-option v-for="item in formulaTypeList" :key="item.value" :label="item.label" :value="item.value" />
  100. </el-select>
  101. <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">
  102. <el-option v-for="item in formulaTypeList" :key="item.value" :label="item.label" :value="item.value" />
  103. </el-select>
  104. </template>
  105. </el-table-column>
  106. <el-table-column label="来源" min-width="90px" align="center">
  107. <template slot-scope="scope">
  108. <span>{{ scope.row.source }}</span>
  109. </template>
  110. </el-table-column>
  111. <el-table-column label="备注" min-width="90px" align="center">
  112. <template slot-scope="scope">
  113. <span v-if="scope.row.NoEdit">{{ scope.row.remark }}</span>
  114. <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;" />
  115. </template>
  116. </el-table-column>
  117. <el-table-column label="版本号" min-width="90px" align="center">
  118. <template slot-scope="scope">
  119. <span>{{ scope.row.version }}</span>
  120. </template>
  121. </el-table-column>
  122. <el-table-column label="是否启用" min-width="90px" align="center">
  123. <template slot-scope="scope">
  124. <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)" />
  125. </template>
  126. </el-table-column>
  127. <el-table-column label="操作" align="center" width="250" class-name="small-padding fixed-width" fixed="right">
  128. <template slot-scope="{row}">
  129. <!-- 新增 -->
  130. <el-button v-if="row.isCreate" class="miniSuccess" @click="createData(row)">保存</el-button>
  131. <el-button v-if="row.isCreate" class="minCancel" @click="createCancel(row)">取消</el-button>
  132. <!-- 编辑 -->
  133. <el-button v-if="row.isUpdate" class="miniSuccess" @click="handleUpdate(row)">编辑</el-button>
  134. <el-button v-if="row.isUpdate" class="miniDanger" @click="handleRowDelete(row)">删除</el-button>
  135. <!-- 编辑保存 -->
  136. <el-button v-if="row.isUpdateSave" class="miniSuccess" @click="updateData(row)">保存</el-button>
  137. <el-button v-if="row.isUpdateSave" class="minCancel" @click="updateCancel(row)">取消</el-button>
  138. <el-button v-if="row.NoEdit" class="miniSuccess" @click="handleFormulationEvaluation(row)">配方评估</el-button>
  139. </template>
  140. </el-table-column>
  141. </el-table>
  142. </div>
  143. </div>
  144. <!-- 配方详情表 -->
  145. <div v-if="isDetail" ref="detail" class="detail" style="margin-top: 30px;">
  146. <div class="recipeTemplate">
  147. <p>配方详情表</p>
  148. </div>
  149. <div class="operation">
  150. <el-button style="float: left;" class="success" @click="handleCreate2">新增</el-button>
  151. <el-button style="float: left;" class="danger" @click="handleDelete2">删除</el-button>
  152. <el-button style="float: left;" class="success" @click="handleSyntheticPremix">合成预混料</el-button>
  153. <el-button v-if="isOrder" style="float: left;" class="success" @click="handleChangeOrder">更改顺序</el-button>
  154. <div v-else style="float: left;margin-left: 10px;">
  155. <el-button class="success" @click="saveChangeOrder">保存</el-button>
  156. <el-button class="success" @click="cancelChangeOrder">取消</el-button>
  157. </div>
  158. <div ref="selectInput2" class="filter-item selectInput" style="margin: 0 10px;">
  159. <el-input type="text" name="" value="" placeholder="请点击选择搜索条件" class="Input" />
  160. <i v-if="arrowDown2" icon="el-icon-arrow-down" class="el-icon-arrow-down" />
  161. <i v-if="arrowUp2" icon="el-icon-arrow-up" class="el-icon-arrow-up" />
  162. <ul v-if="arrowUp2" class="selectUl" style="width: 400px;">
  163. <li>
  164. <a style="width: 130px;">饲料名称</a>
  165. <el-select v-model="table2.getdataListParm.parammaps.fname" filterable placeholder="" style="width:245px;">
  166. <el-option v-for="item in feedNameList" :key="item.id" :label="item.fname" :value="item.fname" />
  167. </el-select>
  168. </li>
  169. <li><a style="width: 130px;">饲料组名称</a><el-input v-model="table2.getdataListParm.parammaps.feedgroup" style="width: 245px;" /></li>
  170. <li><a style="width: 130px;">重量</a><el-input v-model="table2.getdataListParm.parammaps.fweight" style="width: 245px;" /></li>
  171. <li>
  172. <a style="width: 130px;">搅拌延时</a>
  173. <el-select v-model="table2.getdataListParm.parammaps.autosecondname" filterable placeholder="" style="width:245px;" clearable>
  174. <el-option v-for="item in mixingDelayList" :key="item.id" :label="item.name" :value="item.name" />
  175. </el-select>
  176. </li>
  177. <li>
  178. <a style="width: 130px;">是否锁定牛头数比例</a>
  179. <el-select v-model="table2.getdataListParm.parammaps.islockcount" placeholder="" style="width:245px;" clearable>
  180. <el-option v-for="item in lockBullsList" :key="item.id" :label="item.name" :value="item.id" />
  181. </el-select>
  182. </li>
  183. <li><a style="width: 130px;">顺序</a><el-input v-model="table2.getdataListParm.parammaps.sort" style="width: 245px;" /></li>
  184. <li>
  185. <div style="float: right;">
  186. <el-button class="minCancel" @click="arrowUp2=false;arrowDown2=true;">取消</el-button>
  187. <el-button class="miniSuccess" @click="handleSearch2">搜索</el-button>
  188. </div>
  189. </li>
  190. </ul>
  191. </div>
  192. <el-button class="successBorder" @click="handleSearch2">查询</el-button>
  193. <el-button class="successBorder" @click="handleRefresh2">重置</el-button>
  194. </div>
  195. <div class="table2" style="min-height: 400px;">
  196. <el-table
  197. id="table2"
  198. ref="table2"
  199. :key="table2.tableKey"
  200. v-loading="table2.listLoading"
  201. element-loading-text="给我一点时间"
  202. :data="table2.list"
  203. border
  204. fit
  205. highlight-current-row
  206. style="width: 98%;"
  207. :row-style="rowStyle"
  208. :cell-style="cellStyle"
  209. class="elTable table-fixed"
  210. row-key="id"
  211. :summary-method="getSummaries"
  212. show-summary
  213. @selection-change="handleSelectionChange2"
  214. >
  215. <el-table-column type="selection" width="60" />
  216. <el-table-column label="序号" align="center" type="index" width="50px" />
  217. <el-table-column label="饲料组" min-width="110px" align="center">
  218. <template slot-scope="scope">
  219. <span v-if="scope.row.groupNoEdit">{{ scope.row.feedgroup }}</span>
  220. <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;" />
  221. </template>
  222. </el-table-column>
  223. <el-table-column label="饲料名称" min-width="130px" align="center">
  224. <template slot-scope="scope">
  225. <span v-if="scope.row.NoEdit">{{ scope.row.fname }}</span>
  226. <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)}">
  227. <el-option v-for="item in feedNameList" :key="item.id" :label="item.fname" :value="item.id" />
  228. </el-select>
  229. </template>
  230. </el-table-column>
  231. <el-table-column label="重量(KG)" prop="fweight" min-width="180px" align="center">
  232. <template slot-scope="scope">
  233. <span v-if="scope.row.NoEdit">{{ scope.row.fweight }}</span>
  234. <el-input v-if="scope.row.Edit" v-model="scope.row.fweight" placeholder="重量" step="0.01" type="number" style="width:95%;padding:10px 0;" />
  235. </template>
  236. </el-table-column>
  237. <el-table-column label="搅拌延时(min)" min-width="90px" align="center">
  238. <template slot-scope="scope">
  239. <span v-if="scope.row.NoEdit">{{ scope.row.autosecond }}</span>
  240. <el-select v-if="scope.row.Edit" v-model="scope.row.autosecond" filterable placeholder="搅拌延时" class="filter-item" style="width:95%;padding:10px 0;">
  241. <el-option v-for="item in mixingDelayList" :key="item.id" :label="item.name" :value="item.id" />
  242. </el-select>
  243. </template>
  244. </el-table-column>
  245. <el-table-column v-if="lockCount.isLockCount" label="是否锁定牛头数比例" min-width="110px" align="center">
  246. <template slot-scope="scope">
  247. <span v-if="scope.row.NoEdit && scope.row.islockcount == '0'">否</span>
  248. <span v-if="scope.row.NoEdit && scope.row.islockcount == '1'">是</span>
  249. <el-select v-if="scope.row.Edit" v-model="scope.row.islockcount" placeholder="" class="filter-item" style="width:95%;padding:10px 0;">
  250. <el-option v-for="item in lockBullsList" :key="item.id" :label="item.name" :value="item.id" />
  251. </el-select>
  252. </template>
  253. </el-table-column>
  254. <el-table-column label="顺序" min-width="90px" align="center">
  255. <template slot-scope="scope">
  256. <span v-if="scope.row.NoEdit">{{ scope.row.sort }}</span>
  257. <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)" />
  258. </template>
  259. </el-table-column>
  260. <el-table-column label="操作" align="center" width="320" class-name="small-padding fixed-width" fixed="right">
  261. <template slot-scope="{row}">
  262. <!-- 新增 -->
  263. <el-button v-if="row.isCreate" class="miniSuccess" @click="createData2(row)">保存</el-button>
  264. <el-button v-if="row.isCreate" class="minCancel" @click="createCancel2(row)">取消</el-button>
  265. <!-- 编辑 -->
  266. <el-button v-if="row.isUpdate" class="miniSuccess" @click="handleUpdate2(row)">编辑</el-button>
  267. <el-button v-if="row.isUpdate" class="miniDanger" @click="handleRowDelete2(row)">删除</el-button>
  268. <!-- 编辑保存 -->
  269. <el-button v-if="row.isUpdateSave" class="miniSuccess" @click="updateData2(row)">保存</el-button>
  270. <el-button v-if="row.isUpdateSave" class="minCancel" @click="updateCancel2(row)">取消</el-button>
  271. <!-- 拆分预混料 -->
  272. <el-button v-if="parseInt(row.preftid)>0 && row.isUpdateSave==false" class="miniSuccess" @click="handleSplitPremix(row)">拆分预混料</el-button>
  273. </template>
  274. </el-table-column>
  275. </el-table>
  276. </div>
  277. </div>
  278. <!-- 配方记录 -->
  279. <el-dialog :title="textMap[template.dialogStatus]" :destroy-on-close="true" :visible.sync="template.dialogFormVisible" :close-on-click-modal="false" width="90%">
  280. <div class="dialogMinHeight" style="overflow-y: auto;margin-bottom: 30px;overflow-x: hidden;">
  281. <div ref="templateDialog" class="templateDialog">
  282. <div class="recipeTemplate">
  283. <p>配方模板表</p>
  284. </div>
  285. <div class="operation">
  286. <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" />
  287. <!-- <el-button class="successBorder" @click="handleApplication">应用</el-button> -->
  288. </div>
  289. <div class="search">
  290. <el-select v-model="template.table.getdataListParm.parammaps.ccname" placeholder="牲畜类别" class="filter-item" clearable>
  291. <el-option v-for="item in livestockTypeList" :key="item.value" :label="item.label" :value="item.label" />
  292. </el-select>
  293. <el-select v-model="template.table.getdataListParm.parammaps.fttype" placeholder="配方类型" class="filter-item" style="width: 120px;" clearable>
  294. <el-option v-for="item in formulaTypeList" :key="item.value" :label="item.label" :value="item.label" />
  295. </el-select>
  296. <el-select v-model="template.table.getdataListParm.parammaps.enable" placeholder="是否启用" class="filter-item" style="width: 120px;" clearable>
  297. <el-option v-for="item in enableList" :key="item.id" :label="item.name" :value="item.id" />
  298. </el-select>
  299. <div ref="selectInput" class="filter-item selectInput">
  300. <el-input type="text" name="" value="" placeholder="请点击选择搜索条件" class="Input" />
  301. <i v-if="arrowDown" icon="el-icon-arrow-down" class="el-icon-arrow-down" />
  302. <i v-if="arrowUp" icon="el-icon-arrow-up" class="el-icon-arrow-up" />
  303. <ul v-if="arrowUp" class="selectUl">
  304. <li><a>配方名称</a><el-input v-model="template.table.getdataListParm.parammaps.tname" style="width: 245px;" /></li>
  305. <li><a>备注</a><el-input v-model="template.table.getdataListParm.parammaps.remark" style="width: 245px;" /></li>
  306. <li><a>来源</a><el-input v-model="template.table.getdataListParm.parammaps.source" style="width: 245px;" /></li>
  307. <li>
  308. <div style="float: right;">
  309. <el-button class="minCancel" @click="arrowUp=false;arrowDown=true;">取消</el-button>
  310. <el-button class="miniSuccess" @click="handleDialogSearch">搜索</el-button>
  311. </div>
  312. </li>
  313. </ul>
  314. </div>
  315. <el-button class="successBorder" @click="handleDialogSearch">查询</el-button>
  316. <el-button class="successBorder" @click="handleDialogRefresh">重置</el-button>
  317. </div>
  318. <div class="table">
  319. <el-table
  320. :key="template.table.tableKey"
  321. v-loading="template.table.listLoading"
  322. element-loading-text="给我一点时间"
  323. :data="template.table.list"
  324. border
  325. fit
  326. highlight-current-row
  327. style="width: 98%;"
  328. :row-style="rowStyle"
  329. :cell-style="cellStyle"
  330. class="elTable table-fixed"
  331. @row-click="tableRowClickDialog"
  332. >
  333. <el-table-column label="序号" align="center" type="index" width="50px">
  334. <template slot-scope="scope">
  335. <span>{{ scope.$index + (template.table.pageNum-1) * template.table.pageSize + 1 }}</span>
  336. </template>
  337. </el-table-column>
  338. <el-table-column label="配方名称" min-width="130px" align="center">
  339. <template slot-scope="scope">
  340. <span>{{ scope.row.tname }}</span>
  341. </template>
  342. </el-table-column>
  343. <el-table-column label="配方颜色" min-width="110px" align="center">
  344. <template slot-scope="scope">
  345. <el-color-picker v-model="scope.row.tcolor" size="mini" disabled style="margin:10px 0;" />
  346. </template>
  347. </el-table-column>
  348. <el-table-column label="牲畜类别" min-width="110px" align="center">
  349. <template slot-scope="scope">
  350. <span>{{ scope.row.ccname }}</span>
  351. </template>
  352. </el-table-column>
  353. <el-table-column label="配方类型" min-width="110px" align="center">
  354. <template slot-scope="scope">
  355. <span>{{ scope.row.fttype }}</span>
  356. </template>
  357. </el-table-column>
  358. <el-table-column label="来源" min-width="90px" align="center">
  359. <template slot-scope="scope">
  360. <span>{{ scope.row.source }}</span>
  361. </template>
  362. </el-table-column>
  363. <el-table-column label="备注" min-width="90px" align="center">
  364. <template slot-scope="scope">
  365. <span>{{ scope.row.remark }}</span>
  366. </template>
  367. </el-table-column>
  368. <el-table-column label="版本号" min-width="90px" align="center">
  369. <template slot-scope="scope">
  370. <span>{{ scope.row.version }}</span>
  371. </template>
  372. </el-table-column>
  373. <el-table-column label="版本时间" min-width="90px" align="center">
  374. <template slot-scope="scope">
  375. <span>{{ scope.row.versiontime }}</span>
  376. </template>
  377. </el-table-column>
  378. <el-table-column label="是否启用" min-width="90px" align="center">
  379. <template slot-scope="scope">
  380. <el-switch v-model="scope.row.enable" disabled active-color="#13ce66" inactive-color="#ff4949" :active-value="1" :inactive-value="0" />
  381. </template>
  382. </el-table-column>
  383. </el-table>
  384. </div>
  385. </div>
  386. <div v-if="isDetailDialog" id="detailDialog2" ref="detailDialog2" class="detailDialog" style="margin-top: 30px;">
  387. <div class="recipeTemplate">
  388. <p>配方详情表</p>
  389. </div>
  390. <div class="operation">
  391. <div ref="selectInput2" class="filter-item selectInput">
  392. <el-input type="text" name="" value="" placeholder="请点击选择搜索条件" class="Input" />
  393. <i v-if="arrowDown2" icon="el-icon-arrow-down" class="el-icon-arrow-down" />
  394. <i v-if="arrowUp2" icon="el-icon-arrow-up" class="el-icon-arrow-up" />
  395. <ul v-if="arrowUp2" class="selectUl" style="width: 400px;">
  396. <li>
  397. <a style="width: 130px;">饲料名称</a>
  398. <el-select v-model="template.table2.getdataListParm.parammaps.fname" filterable placeholder="" style="width:245px;">
  399. <el-option v-for="item in feedNameList" :key="item.id" :label="item.fname" :value="item.fname" />
  400. </el-select>
  401. </li>
  402. <li><a style="width: 130px;">饲料组名称</a><el-input v-model="template.table2.getdataListParm.parammaps.feedgroup" style="width: 245px;" /></li>
  403. <li><a style="width: 130px;">重量</a><el-input v-model="template.table2.getdataListParm.parammaps.fweight" style="width: 245px;" /></li>
  404. <li>
  405. <a style="width: 130px;">搅拌延时</a>
  406. <el-select v-model="template.table2.getdataListParm.parammaps.autosecondname" filterable placeholder="" style="width:245px;">
  407. <el-option v-for="item in mixingDelayList" :key="item.id" :label="item.name" :value="item.name" />
  408. </el-select>
  409. </li>
  410. <li>
  411. <a style="width: 130px;">是否锁定牛头数比例</a>
  412. <el-select v-model="template.table2.getdataListParm.parammaps.islockcount" placeholder="" style="width:245px;">
  413. <el-option v-for="item in lockBullsList" :key="item.id" :label="item.name" :value="item.id" />
  414. </el-select>
  415. </li>
  416. <li><a style="width: 130px;">顺序</a><el-input v-model="template.table2.getdataListParm.parammaps.sort" style="width: 245px;" /></li>
  417. <li>
  418. <div style="float: right;">
  419. <el-button class="minCancel" @click="arrowUp2=false;arrowDown2=true;">取消</el-button>
  420. <el-button class="miniSuccess" @click="handleDialogSearch2">搜索</el-button>
  421. </div>
  422. </li>
  423. </ul>
  424. </div>
  425. <el-button class="successBorder" @click="handleDialogSearch2">查询</el-button>
  426. <el-button class="successBorder" @click="handleDialogRefresh2">重置</el-button>
  427. </div>
  428. <div class="table2">
  429. <el-table
  430. id="templateTable2"
  431. :key="template.table2.tableKey"
  432. v-loading="template.table2.listLoading"
  433. element-loading-text="给我一点时间"
  434. :data="template.table2.list"
  435. border
  436. fit
  437. highlight-current-row
  438. style="width: 98%;"
  439. :summary-method="getTemplateTable2Summaries"
  440. show-summary
  441. :row-style="rowStyle"
  442. :cell-style="cellStyle"
  443. class="elTable table-fixed"
  444. row-key="id"
  445. >
  446. <el-table-column label="饲料组" min-width="130px" align="center">
  447. <template slot-scope="scope">
  448. <span>{{ scope.row.feedgroup }}</span>
  449. </template>
  450. </el-table-column>
  451. <el-table-column label="饲料名称" min-width="130px" align="center">
  452. <template slot-scope="scope">
  453. <span>{{ scope.row.fname }}</span>
  454. </template>
  455. </el-table-column>
  456. <el-table-column label="重量(KG)" prop="fweight" min-width="200px" align="center">
  457. <template slot-scope="scope">
  458. <span>{{ scope.row.fweight }}</span>
  459. </template>
  460. </el-table-column>
  461. <el-table-column label="搅拌延时(min)" min-width="130px" align="center">
  462. <template slot-scope="scope">
  463. <span>{{ scope.row.autosecondname }}</span>
  464. </template>
  465. </el-table-column>
  466. <el-table-column label="是否锁定牛头数比例" min-width="130px" align="center">
  467. <template slot-scope="scope">
  468. <span v-if="scope.row.islockcount == '0'">否</span>
  469. <span v-if="scope.row.islockcount == '1'">是</span>
  470. </template>
  471. </el-table-column>
  472. <el-table-column label="顺序" min-width="130px" align="center">
  473. <template slot-scope="scope">
  474. <span>{{ scope.row.sort }}</span>
  475. </template>
  476. </el-table-column>
  477. </el-table>
  478. </div>
  479. </div>
  480. <div slot="footer" class="dialog-footer" style="right:30px;position:absolute;bottom:5px">
  481. <el-button @click="template.dialogFormVisible = false; ">关闭</el-button>
  482. </div>
  483. </div>
  484. </el-dialog>
  485. <!-- 合成预混料 -->
  486. <el-dialog :title="textMap[detail.dialogStatus]" :destroy-on-close="true" :visible.sync="detail.dialogFormVisible" :close-on-click-modal="false" width="90%">
  487. <div class="detailDialog">
  488. <h2>饲料</h2>
  489. <div class="table1">
  490. <el-table
  491. :key="detail.tableKey"
  492. v-loading="detail.listLoading"
  493. element-loading-text="给我一点时间"
  494. :data="detail.list"
  495. fit
  496. highlight-current-row
  497. style="width: 100%;"
  498. :row-style="rowStyle"
  499. :cell-style="cellStyle"
  500. class="elTable table-fixed"
  501. show-summary
  502. >
  503. <el-table-column label="序号" align="center" type="index" width="50px" />
  504. <el-table-column label="饲料名称" min-width="130px" align="center">
  505. <template slot-scope="scope">
  506. <span>{{ scope.row.fname }}</span>
  507. </template>
  508. </el-table-column>
  509. <el-table-column prop="fweight" label="重量(KG)" />
  510. <el-table-column label="搅拌延时(min)" min-width="110px" align="center">
  511. <template slot-scope="scope">
  512. <span>{{ scope.row.autosecond }}</span>
  513. </template>
  514. </el-table-column>
  515. <el-table-column v-if="lockCount.isLockCount" label="是否锁定牛头数比例" min-width="130px" align="center">
  516. <template slot-scope="scope">
  517. <span v-if="scope.row.islockcount == '0'">否</span>
  518. <span v-if="scope.row.islockcount == '1'">是</span>
  519. </template>
  520. </el-table-column>
  521. <el-table-column label="顺序" min-width="110px" align="center">
  522. <template slot-scope="scope">
  523. <span>{{ scope.row.sort }}</span>
  524. </template>
  525. </el-table-column>
  526. </el-table>
  527. </div>
  528. <h2>合成预混料</h2>
  529. <div class="table2" style="margin-bottom: 50px;">
  530. <el-table
  531. :key="detail.tableKey2"
  532. v-loading="detail.listLoading2"
  533. element-loading-text="给我一点时间"
  534. :data="detail.list2"
  535. border
  536. fit
  537. highlight-current-row
  538. style="width: 100%;"
  539. :row-style="rowStyle"
  540. :cell-style="cellStyle"
  541. class="elTable table-fixed"
  542. >
  543. <el-table-column label="配方名称" min-width="130px" align="center">
  544. <template slot-scope="scope">
  545. <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" />
  546. </template>
  547. </el-table-column>
  548. <el-table-column label="配方颜色11" min-width="130px" align="center">
  549. <template slot-scope="scope">
  550. <el-color-picker v-model="scope.row.tcolor" size="mini" style="margin:10px 0;" :disabled="detail.disabled" />
  551. </template>
  552. </el-table-column>
  553. <el-table-column label="牲畜类别" min-width="130px" align="center">
  554. <template slot-scope="scope">
  555. <el-select v-model="scope.row.ccid" placeholder="选择牲畜父类" class="filter-item" style="width:95%;padding:10px 0;" :disabled="detail.disabled" @change="changeLivestockType2">
  556. <el-option v-for="item in livestockTypeList" :key="item.value" :label="item.label" :value="item.value" />
  557. </el-select>
  558. </template>
  559. </el-table-column>
  560. <el-table-column label="配方类型" min-width="110px" align="center">
  561. <template slot-scope="scope">
  562. <span>{{ scope.row.fttype }}</span>
  563. </template>
  564. </el-table-column>
  565. <el-table-column label="来源" min-width="110px" align="center">
  566. <template slot-scope="scope">
  567. <span>{{ scope.row.source }}</span>
  568. </template>
  569. </el-table-column>
  570. <el-table-column label="备注" min-width="130px" align="center">
  571. <template slot-scope="scope">
  572. <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" />
  573. </template>
  574. </el-table-column>
  575. <el-table-column label="是否启用" min-width="130px" align="center">
  576. <template slot-scope="scope">
  577. <el-switch v-model="scope.row.enable" active-color="#13ce66" inactive-color="#ff4949" :active-value="1" :inactive-value="0" :disabled="detail.disabled" />
  578. </template>
  579. </el-table-column>
  580. </el-table>
  581. </div>
  582. <div slot="footer" class="dialog-footer" style="bottom: -50px;">
  583. <el-button class="cancelClose" @click="detail.dialogFormVisible = false; ">关闭</el-button>
  584. <el-button class="success" :disabled="isokDisable" @click="syntheticPremixData()">确认</el-button>
  585. </div>
  586. </div>
  587. </el-dialog>
  588. <!-- 历史记录 -->
  589. <el-dialog :title="textMap[historyRecord.dialogStatus]" :destroy-on-close="true" :visible.sync="historyRecord.dialogFormVisible" :close-on-click-modal="false" width="90%">
  590. <div class="historyRecord">
  591. <keep-alive>
  592. <component :is="historyRecord.myComponent" ref="historyRecord" />
  593. </keep-alive>
  594. </div>
  595. <div slot="footer" class="dialog-footer" style="bottom: 10px;">
  596. <el-button class="cancelClose" @click="historyRecord.dialogFormVisible = false; ">关闭</el-button>
  597. </div>
  598. </el-dialog>
  599. </div>
  600. </template>
  601. <script>
  602. import { GetDataByName, GetDataByNames, PostDataByName, failproccess, ExecDataByConfig, formatNum } from '@/api/common'
  603. import Sortable from 'sortablejs'
  604. import { MessageBox } from 'element-ui'
  605. import Cookies from 'js-cookie'
  606. import { json2excel } from '@/utils/index.js'
  607. import { getToken } from '@/utils/auth'
  608. import { parseTime } from '@/utils/index.js'
  609. export default {
  610. name: 'RecipeTemplate',
  611. data() {
  612. return {
  613. requestParams: [
  614. { name: 'getDictByName', offset: 0, pagecount: 0, params: ['牲畜父类'] },
  615. { name: 'getDictByName2', offset: 0, pagecount: 0, params: ['配方类型'] },
  616. { name: 'getFeedAndPre', offset: 0, pagecount: 0, parammaps: { pastureid: Cookies.get('pastureid') }}
  617. ],
  618. enableList: [{ id: '0', name: '否' }, { id: '1', name: '是' }], // 是否启用
  619. lockBullsList: [{ id: '0', name: '否' }, { id: '1', name: '是' }], // 是否锁定牛头数比例
  620. livestockTypeList: [], // 牲畜类别
  621. formulaTypeList: [], // 配方类型
  622. feedNameList: [], // 饲料名称
  623. 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' }], // 搅拌延时
  624. 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' }], // 请选择历史记录时间
  625. sourceList: [{ id: 0, name: '自定义' }, { id: 1, name: '集团下发' }, { id: 2, name: '导入' }], // 导入
  626. arrowDown: true,
  627. arrowUp: false,
  628. table: {
  629. getdataListParm: {
  630. name: 'getFTList',
  631. page: 1,
  632. offset: 1,
  633. pagecount: 30,
  634. returntype: 'Map',
  635. parammaps: {
  636. pastureid: Cookies.get('pastureid'),
  637. tname: '',
  638. ccid: '',
  639. ccname: '',
  640. fttypeid: '',
  641. fttype: '',
  642. remark: '',
  643. enable: ''
  644. }
  645. },
  646. tableKey: 0,
  647. list: [],
  648. total: 0,
  649. listLoading: true,
  650. temp: {}
  651. },
  652. lockCount: {
  653. getdataListParm: {
  654. name: 'getSysoptEnable',
  655. page: 1,
  656. offset: 1,
  657. pagecount: 30,
  658. returntype: 'Map',
  659. parammaps: {
  660. pastureid: Cookies.get('pastureid'),
  661. inforname: 'isLockCount'
  662. }
  663. },
  664. isLockCount: false // 是否显示是否锁定牛头数比例
  665. },
  666. isDetail: false,
  667. arrowDown2: true,
  668. arrowUp2: false,
  669. table2: {
  670. getdataListParm: {
  671. name: 'getFTdetailList',
  672. page: 1,
  673. offset: 1,
  674. pagecount: 10,
  675. returntype: 'Map',
  676. parammaps: {
  677. pastureid: Cookies.get('pastureid'),
  678. fname: '',
  679. feedgroup: '',
  680. fweight: '',
  681. autosecondname: '',
  682. islockcount: '',
  683. sort: ''
  684. }
  685. },
  686. tableKey: 0,
  687. list: [],
  688. total: 0,
  689. listLoading: true,
  690. temp: {}
  691. },
  692. isDetailDialog: false,
  693. template: {
  694. dialogFormVisible: false,
  695. dialogStatus: '',
  696. table: {
  697. getdataListParm: {
  698. name: 'getFTListDate',
  699. page: 1,
  700. offset: 1,
  701. pagecount: 10,
  702. returntype: 'Map',
  703. parammaps: {
  704. pastureid: Cookies.get('pastureid'),
  705. tname: '',
  706. ccid: '',
  707. ccname: '',
  708. fttype: '',
  709. remark: '',
  710. enable: '',
  711. date: '',
  712. source: ''
  713. }
  714. },
  715. tableKey: 0,
  716. total: 0,
  717. listLoading: true,
  718. list: []
  719. },
  720. table2: {
  721. getdataListParm: {
  722. name: 'getFTdetailListDate',
  723. page: 1,
  724. offset: 1,
  725. pagecount: 10,
  726. returntype: 'Map',
  727. parammaps: {
  728. pastureid: Cookies.get('pastureid'),
  729. fname: '',
  730. fweight: '',
  731. islockcount: '',
  732. sort: '',
  733. feedgroup: '',
  734. autosecondname: ''
  735. }
  736. },
  737. tableKey: 0,
  738. total: 0,
  739. listLoading: true,
  740. list: []
  741. },
  742. // 历史日期
  743. getdataDateParm: {
  744. name: 'getFTMaxDate',
  745. page: 1,
  746. offset: 1,
  747. pagecount: 10,
  748. returntype: 'Map',
  749. parammaps: {
  750. pastureid: Cookies.get('pastureid')
  751. }
  752. }
  753. },
  754. isOrder: true,
  755. detail: {
  756. dialogFormVisible: false,
  757. dialogStatus: '',
  758. tableKey: 0,
  759. total: 0,
  760. listLoading: true,
  761. list: [],
  762. tableKey2: 0,
  763. total2: 0,
  764. listLoading2: false,
  765. list2: [{ tname: '', tcolor: '#ccc', ccid: '', fttype: '预混配方', fttypeid: '2', source: '自定义', remark: '', 'enable': 1 }],
  766. getdataListParm: {
  767. name: 'getFTDetailCompare',
  768. page: 1,
  769. offset: 1,
  770. pagecount: 10,
  771. returntype: 'Map',
  772. parammaps: {}
  773. },
  774. list3: [],
  775. disabled: false,
  776. getdataListParm2: {
  777. name: 'getFTCompare',
  778. page: 1,
  779. offset: 1,
  780. pagecount: 10,
  781. returntype: 'Map',
  782. parammaps: {}
  783. }
  784. },
  785. selectList: [],
  786. selectList2: [],
  787. textMap: {
  788. RecipeRecord: '配方记录',
  789. SyntheticPremix: '合成预混料',
  790. historyRecord: '历史记录'
  791. },
  792. requestParam: {},
  793. download: {
  794. getdataListParm: {
  795. name: 'getFTList',
  796. page: 1,
  797. offset: 1,
  798. pagecount: 0,
  799. returntype: 'Map',
  800. parammaps: {
  801. pastureid: Cookies.get('pastureid'),
  802. tname: '',
  803. ccid: '',
  804. ccname: '',
  805. fttypeid: '',
  806. fttype: '',
  807. remark: '',
  808. enable: ''
  809. }
  810. },
  811. list: []
  812. },
  813. historyRecord: {
  814. dialogStatus: '',
  815. dialogFormVisible: false
  816. },
  817. isokDisable: false,
  818. rowStyle: { maxHeight: 50 + 'px', height: 45 + 'px' },
  819. cellStyle: { padding: 0 + 'px' },
  820. dropState: false
  821. }
  822. },
  823. computed: {
  824. // 设置请求头
  825. headers() {
  826. return {
  827. token: getToken()
  828. }
  829. },
  830. uploadData() {
  831. return {
  832. name: '颛孙洋洋-配方模板',
  833. importParams: '配方名称, 牲畜类别, 配方类型, 备注, 是否启用, 饲料组, 饲料名称, 重量(kg), 搅拌延时(min), 是否锁定牛头数比例',
  834. sheetname: 'SheetJS'
  835. }
  836. },
  837. // 设置上传地址
  838. uploadExcelUrl() {
  839. return process.env.VUE_APP_BASE_API + 'authdata/ImportExcel'
  840. }
  841. },
  842. mounted() {
  843. document.addEventListener('click', (e) => {
  844. if (this.$refs.selectInput !== undefined) {
  845. if (!this.$refs.selectInput.contains(e.target)) {
  846. this.arrowDown = true
  847. this.arrowUp = false
  848. } else {
  849. this.arrowDown = false
  850. this.arrowUp = true
  851. }
  852. }
  853. if (this.$refs.selectInput2 !== undefined) {
  854. if (!this.$refs.selectInput2.contains(e.target)) {
  855. this.arrowDown2 = true
  856. this.arrowUp2 = false
  857. } else {
  858. this.arrowDown2 = false
  859. this.arrowUp2 = true
  860. }
  861. }
  862. })
  863. },
  864. created() {
  865. this.getList()
  866. this.getDownList()
  867. this.getIsLockCount()
  868. },
  869. methods: {
  870. getSummaries(param) {
  871. console.log(param, '====')
  872. const { columns, data } = param
  873. const sums = []
  874. columns.forEach((column, index) => {
  875. if (index === 0) {
  876. sums[index] = '合计'
  877. return
  878. }
  879. const values = data.map(item => Number(item[column.property]))
  880. if (!values.every(value => isNaN(value))) {
  881. sums[index] = values.reduce((prev, curr) => {
  882. const value = Number(curr)
  883. if (!isNaN(value)) {
  884. return prev + curr
  885. } else {
  886. return prev
  887. }
  888. }, 0)
  889. // 后台待发
  890. sums[index] += '(干物质量:' + this.table2.getdataListParm.parammaps.dryweight + ')'
  891. } else {
  892. sums[index] = ''
  893. }
  894. })
  895. return sums
  896. },
  897. getTemplateTable2Summaries(param) {
  898. console.log(param, '====')
  899. const { columns, data } = param
  900. const sums = []
  901. columns.forEach((column, index) => {
  902. if (index === 0) {
  903. sums[index] = '合计'
  904. return
  905. }
  906. const values = data.map(item => Number(item[column.property]))
  907. if (!values.every(value => isNaN(value))) {
  908. sums[index] = values.reduce((prev, curr) => {
  909. const value = Number(curr)
  910. if (!isNaN(value)) {
  911. return prev + curr
  912. } else {
  913. return prev
  914. }
  915. }, 0)
  916. // 后台待发
  917. sums[index] += '(干物质量:' + this.template.table2.getdataListParm.parammaps.dryweight + ')'
  918. } else {
  919. sums[index] = ''
  920. }
  921. })
  922. return sums
  923. },
  924. // handleHistory() {
  925. // MessageBox.confirm('是否确认生成历史?', {
  926. // confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  927. // }).then(() => {
  928. // this.requestParam.name = 'creatFTdate'
  929. // this.requestParam.parammaps = {}
  930. // this.requestParam.parammaps.pastureid = Cookies.get('pastureid')
  931. // PostDataByName(this.requestParam).then(response => {
  932. // console.log('生成历史保存发送参数', this.requestParam)
  933. // if (response.msg !== 'fail') {
  934. // this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  935. // } else {
  936. // this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  937. // }
  938. // })
  939. // })
  940. // },
  941. getDownList() {
  942. GetDataByNames(this.requestParams).then(response => {
  943. this.livestockTypeList = response.data.getDictByName.list
  944. this.formulaTypeList = response.data.getDictByName2.list
  945. this.feedNameList = response.data.getFeedAndPre.list
  946. })
  947. },
  948. // -------------------模板-----------------------------
  949. getList() {
  950. this.table.listLoading = true
  951. GetDataByName(this.table.getdataListParm).then(response => {
  952. console.log('table数据', response.data.list)
  953. if (response.data.list !== null) {
  954. for (let i = 0; i < response.data.list.length; i++) {
  955. this.$set(response.data.list[i], 'Edit', false) // 编辑
  956. this.$set(response.data.list[i], 'NoEdit', true) // 不可编辑/输入
  957. this.$set(response.data.list[i], 'isCreate', false) // 新增操作
  958. this.$set(response.data.list[i], 'isUpdate', true) // 编辑操作
  959. this.$set(response.data.list[i], 'isUpdateSave', false) // 编辑保存
  960. }
  961. this.table.list = response.data.list
  962. this.table.pageNum = response.data.pageNum
  963. this.table.pageSize = response.data.pageSize
  964. this.table.total = response.data.total
  965. } else {
  966. this.table.list = []
  967. }
  968. setTimeout(() => {
  969. this.table.listLoading = false
  970. }, 100)
  971. })
  972. },
  973. handleSearch() {
  974. console.log('点击了查询')
  975. this.table.getdataListParm.offset = 1
  976. this.getList()
  977. this.arrowDown = true
  978. this.arrowUp = false
  979. },
  980. handleRefresh() {
  981. console.log('点击了重置')
  982. this.table.getdataListParm.offset = 1
  983. this.table.getdataListParm.parammaps.ccid = ''
  984. this.table.getdataListParm.parammaps.ccname = ''
  985. this.table.getdataListParm.parammaps.fttype = ''
  986. this.table.getdataListParm.parammaps.tname = ''
  987. this.table.getdataListParm.parammaps.remark = ''
  988. this.table.getdataListParm.parammaps.enable = ''
  989. this.table.getdataListParm.parammaps.source = ''
  990. this.getList()
  991. },
  992. // 模板新增
  993. handleCreate() {
  994. console.log('点击了新增')
  995. // 编辑true/不可编辑false
  996. // 新增操true,编辑false,编辑保存false
  997. for (let i = 0; i < this.table.list.length; i++) {
  998. if (this.table.list[i].Edit === true) {
  999. console.log(123)
  1000. this.$message({ type: 'error', message: '当前内容未保存,请点击取消或保存继续进行操作', duration: 2000 })
  1001. return false
  1002. }
  1003. }
  1004. this.table.list.unshift({ 'myId': (new Date()).valueOf(), 'Edit': true, 'NoEdit': false, 'isCreate': true, 'isUpdate': false, 'isUpdateSave': false, 'enable': 1, 'tname': '', 'tcolor': '#ccc', 'ccid': '', 'ccname': '', 'fttype': '', 'fttypeid': '', 'source': '自定义', 'remark': '' })
  1005. console.log(this.table.list)
  1006. },
  1007. // 畜生类别
  1008. changeLivestockType(item) {
  1009. this.table.temp.ccname = this.livestockTypeList.find(obj => obj.value === item).label
  1010. },
  1011. // 配方类型
  1012. changeFormulaType(item) {
  1013. this.table.temp.fttype = this.formulaTypeList.find(obj => obj.value === item).label
  1014. },
  1015. createData(row) {
  1016. console.log('点击了新增保存', row)
  1017. this.table.temp.tname = row.tname
  1018. this.table.temp.tcolor = row.tcolor
  1019. this.table.temp.ccid = row.ccid
  1020. this.table.temp.ccname = this.table.temp.ccname
  1021. this.table.temp.fttype = this.table.temp.fttype
  1022. this.table.temp.fttypeid = row.fttypeid
  1023. this.table.temp.source = row.source
  1024. this.table.temp.remark = row.remark
  1025. this.table.temp.enable = row.enable
  1026. this.table.temp.pastureid = Cookies.get('pastureid')
  1027. if (this.table.temp.tname == '' && this.table.temp.ccid == '' && this.table.temp.fttypeid == '') {
  1028. this.$message({ type: 'error', message: '配方名称/牲畜类别/配方类型不能为空', duration: 2000 })
  1029. return false
  1030. } else if (this.table.temp.ccid == '' && this.table.temp.fttypeid == '') {
  1031. this.$message({ type: 'error', message: '牲畜类别/配方类型不能为空', duration: 2000 })
  1032. return false
  1033. } else if (this.table.temp.tname == '') {
  1034. this.$message({ type: 'error', message: '配方名称不能为空', duration: 2000 })
  1035. return false
  1036. } else if (this.table.temp.ccid == '') {
  1037. this.$message({ type: 'error', message: '牲畜类别不能为空', duration: 2000 })
  1038. return false
  1039. } else if (this.table.temp.fttypeid == '') {
  1040. this.$message({ type: 'error', message: '配方类型不能为空', duration: 2000 })
  1041. return false
  1042. }
  1043. const pattern = new RegExp("[`~!@#$^&*()=|{}':;',\\[\\].<>/?~!@#¥……&*()——|{}【】‘;:”“'。,、?]")
  1044. if (pattern.test(this.table.temp.tname)) {
  1045. this.$message({ type: 'error', message: '配方名称不可输入特殊字符', duration: 2000 })
  1046. return false
  1047. }
  1048. console.log(this.table.temp)
  1049. this.isokDisable = true
  1050. setTimeout(() => {
  1051. this.isokDisable = false
  1052. }, 1000)
  1053. this.requestParam.name = 'insertFT'
  1054. this.requestParam.parammaps = this.table.temp
  1055. PostDataByName(this.requestParam).then(response => {
  1056. console.log('新增保存发送参数', this.requestParam)
  1057. if (response.msg !== 'fail') {
  1058. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  1059. this.getList()
  1060. } else {
  1061. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  1062. }
  1063. })
  1064. },
  1065. createCancel(row) {
  1066. console.log('点击了新增取消')
  1067. for (let i = 0; i < this.table.list.length; i++) {
  1068. if (row.myId === this.table.list[i].myId) {
  1069. var listIndex = this.table.list.indexOf(this.table.list[i])
  1070. }
  1071. if (listIndex > -1) {
  1072. this.table.list.splice(listIndex, 1)
  1073. return
  1074. }
  1075. }
  1076. },
  1077. // 模板编辑
  1078. handleUpdate(row) {
  1079. for (let i = 0; i < this.table.list.length; i++) {
  1080. if (this.table.list[i].Edit == true) {
  1081. this.$message({ type: 'error', message: '当前内容未保存,请点击取消或保存继续进行操作', duration: 2000 })
  1082. return false
  1083. }
  1084. }
  1085. // 编辑true,不可编辑false
  1086. row.Edit = true
  1087. row.NoEdit = false
  1088. // 新增false,编辑false,编辑保存true
  1089. row.isCreate = false
  1090. row.isUpdate = false
  1091. row.isUpdateSave = true
  1092. row.ccid = String(row.ccid)
  1093. row.fttypeid = String(row.fttypeid)
  1094. this.table.temp.ccname = row.ccname
  1095. this.table.temp.fttype = row.fttype
  1096. },
  1097. updateData(row) {
  1098. console.log('点击了编辑保存', row)
  1099. this.table.temp.tname = row.tname
  1100. this.table.temp.tcolor = row.tcolor
  1101. this.table.temp.ccid = row.ccid
  1102. this.table.temp.fttypeid = row.fttypeid
  1103. this.table.temp.source = row.source
  1104. this.table.temp.remark = row.remark
  1105. this.table.temp.enable = row.enable
  1106. this.table.temp.ccname = this.table.temp.ccname
  1107. this.table.temp.fttype = this.table.temp.fttype
  1108. this.table.temp.pastureid = row.pastureid
  1109. this.table.temp.id = row.id
  1110. if (this.table.temp.tname == '' && this.table.temp.ccid == '' && this.table.temp.fttypeid == '') {
  1111. this.$message({ type: 'error', message: '配方名称/牲畜类别/配方类型不能为空', duration: 2000 })
  1112. return false
  1113. } else if (this.table.temp.ccid == '' && this.table.temp.fttypeid == '') {
  1114. this.$message({ type: 'error', message: '牲畜类别/配方类型不能为空', duration: 2000 })
  1115. return false
  1116. } else if (this.table.temp.tname == '') {
  1117. this.$message({ type: 'error', message: '配方名称不能为空', duration: 2000 })
  1118. return false
  1119. } else if (this.table.temp.ccid == '') {
  1120. this.$message({ type: 'error', message: '牲畜类别不能为空', duration: 2000 })
  1121. return false
  1122. } else if (this.table.temp.fttypeid == '') {
  1123. this.$message({ type: 'error', message: '配方类型不能为空', duration: 2000 })
  1124. return false
  1125. }
  1126. const pattern = new RegExp("[`~!@#$^&*()=|{}':;',\\[\\].<>/?~!@#¥……&*()——|{}【】‘;:”“'。,、?]")
  1127. if (pattern.test(this.table.temp.tname)) {
  1128. this.$message({ type: 'error', message: '配方名称不可输入特殊字符', duration: 2000 })
  1129. return false
  1130. }
  1131. console.log(this.table.temp)
  1132. this.isokDisable = true
  1133. setTimeout(() => {
  1134. this.isokDisable = false
  1135. }, 1000)
  1136. this.requestParam.name = 'updateFT'
  1137. this.requestParam.parammaps = this.table.temp
  1138. PostDataByName(this.requestParam).then(response => {
  1139. console.log('新增保存发送参数', this.requestParam)
  1140. if (response.msg !== 'fail') {
  1141. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  1142. this.getList()
  1143. } else {
  1144. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  1145. }
  1146. })
  1147. },
  1148. updateCancel(row) {
  1149. console.log('点击了编辑取消')
  1150. // 编辑false,不可编辑true
  1151. row.Edit = false
  1152. row.NoEdit = true
  1153. // 新增false,编辑true,编辑保存false
  1154. row.isCreate = false
  1155. row.isUpdate = true
  1156. row.isUpdateSave = false
  1157. this.getList()
  1158. },
  1159. // 删除
  1160. handleRowDelete(row) {
  1161. console.log('点击了行内删除')
  1162. MessageBox.confirm('是否确认删除此信息?', {
  1163. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  1164. }).then(() => {
  1165. this.requestParam.common = { 'returnmap': '0' }
  1166. this.requestParam.data = []
  1167. this.requestParam.data[0] = { 'name': 'checkdeleteFT', 'type': 'v', 'parammaps': {
  1168. pastureid: row.pastureid,
  1169. id: row.id
  1170. }}
  1171. this.requestParam.data[1] = { 'name': 'deleteFT', 'type': 'e', 'parammaps': {
  1172. pastureid: row.pastureid,
  1173. id: row.id
  1174. }}
  1175. ExecDataByConfig(this.requestParam).then(response => {
  1176. console.log('新增保存发送参数', this.requestParam)
  1177. if (response.msg === 'fail') {
  1178. this.$notify({ title: '删除失败', message: response.data, type: 'warning', duration: 2000 })
  1179. } else {
  1180. this.$notify({ title: '成功', message: '删除成功', type: 'success', duration: 2000 })
  1181. this.getList()
  1182. this.isDetail = false
  1183. }
  1184. })
  1185. }).catch(() => {
  1186. this.$message({ type: 'info', message: '已取消删除' })
  1187. })
  1188. },
  1189. handleSelectionChange(val) {
  1190. console.log('勾选数据', val)
  1191. this.selectList = val
  1192. },
  1193. handleDelete() {
  1194. console.log('点击了删除')
  1195. if (this.selectList.length == 0) {
  1196. this.$message({ type: 'error', message: '请选择配方', duration: 2000 })
  1197. } else {
  1198. MessageBox.confirm('是否确认删除此信息?', {
  1199. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  1200. }).then(() => {
  1201. console.log(this.selectList)
  1202. this.requestParam.common = { 'returnmap': '0' }
  1203. this.requestParam.data = []
  1204. this.requestParam.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.selectList }}
  1205. this.requestParam.data[0].children = []
  1206. this.requestParam.data[0].children[0] = { 'name': 'checkdeleteFT', 'type': 'v', 'parammaps': {
  1207. id: '@insertSpotList.id',
  1208. pastureid: '@insertSpotList.pastureid'
  1209. }}
  1210. this.requestParam.data[0].children[1] = { 'name': 'deleteFT', 'type': 'e', 'parammaps': {
  1211. id: '@insertSpotList.id',
  1212. pastureid: '@insertSpotList.pastureid'
  1213. }}
  1214. ExecDataByConfig(this.requestParam).then(response => {
  1215. console.log('删除保存发送参数', this.requestParam)
  1216. if (response.msg === 'fail') {
  1217. this.$notify({ title: '删除失败', message: response.data, type: 'warning', duration: 2000 })
  1218. } else {
  1219. this.$notify({ title: '', message: '删除成功', type: 'success', duration: 2000 })
  1220. this.getList()
  1221. }
  1222. })
  1223. })
  1224. }
  1225. },
  1226. // 复制
  1227. handleCopy() {
  1228. if (this.selectList.length == 0) {
  1229. this.$message({ type: 'error', message: '请选择配方', duration: 2000 })
  1230. } else {
  1231. MessageBox.confirm('是否确认复制此信息?', {
  1232. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  1233. }).then(() => {
  1234. console.log(this.selectList)
  1235. this.requestParam.common = { 'returnmap': '0' }
  1236. this.requestParam.data = []
  1237. this.requestParam.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.selectList }}
  1238. this.requestParam.data[0].children = []
  1239. this.requestParam.data[0].children[0] = { 'name': 'copyFT', 'type': 'e', 'parammaps': {
  1240. ftid: '@insertSpotList.id',
  1241. pastureid: '@insertSpotList.pastureid'
  1242. }}
  1243. ExecDataByConfig(this.requestParam).then(response => {
  1244. console.log('复制保存发送参数', this.requestParam)
  1245. if (response.msg === 'fail') {
  1246. this.$notify({ title: '复制失败', message: response.data, type: 'warning', duration: 2000 })
  1247. } else {
  1248. this.$notify({ title: '', message: '复制成功', type: 'success', duration: 2000 })
  1249. this.getList()
  1250. }
  1251. })
  1252. })
  1253. }
  1254. },
  1255. // 配方记录
  1256. handleRecipeRecord() {
  1257. console.log('点击了配方记录')
  1258. this.template.dialogStatus = 'RecipeRecord'
  1259. this.template.dialogFormVisible = true
  1260. this.template.table.getdataListParm.parammaps.ccname = ''
  1261. this.template.table.getdataListParm.parammaps.fttype = ''
  1262. this.template.table.getdataListParm.parammaps.enable = ''
  1263. this.template.table.getdataListParm.parammaps.tname = ''
  1264. this.template.table.getdataListParm.parammaps.remark = ''
  1265. this.template.table.getdataListParm.parammaps.source = ''
  1266. this.template.table.getdataListParm.offset = 1
  1267. this.getDateList()
  1268. this.isDetailDialog = false
  1269. },
  1270. // 历史时间
  1271. getDateList() {
  1272. GetDataByName(this.template.getdataDateParm).then(response => {
  1273. console.log('table数据', response.data.list)
  1274. if (response.data.list !== null) {
  1275. this.template.table.getdataListParm.parammaps.date = response.data.list[0].maxdate
  1276. this.getTemplateDialogList()
  1277. } else {
  1278. this.template.table.getdataListParm.parammaps.date = ''
  1279. }
  1280. })
  1281. },
  1282. // 配方记录-模板
  1283. getTemplateDialogList() {
  1284. this.template.table.listLoading = true
  1285. GetDataByName(this.template.table.getdataListParm).then(response => {
  1286. console.log('table数据', response.data.list)
  1287. if (response.data.list !== null) {
  1288. this.template.table.list = response.data.list
  1289. this.template.table.pageNum = response.data.pageNum
  1290. this.template.table.pageSize = response.data.pageSize
  1291. this.template.table.total = response.data.total
  1292. } else {
  1293. this.template.table.list = []
  1294. }
  1295. setTimeout(() => {
  1296. this.template.table.listLoading = false
  1297. }, 100)
  1298. })
  1299. },
  1300. handleDialogSearch() {
  1301. this.template.table.getdataListParm.offset = 1
  1302. this.getTemplateDialogList()
  1303. this.arrowDown = true
  1304. this.arrowUp = false
  1305. },
  1306. handleDialogRefresh() {
  1307. this.template.table.getdataListParm.parammaps.ccname = ''
  1308. this.template.table.getdataListParm.parammaps.fttype = ''
  1309. this.template.table.getdataListParm.parammaps.enable = ''
  1310. this.template.table.getdataListParm.parammaps.tname = ''
  1311. this.template.table.getdataListParm.parammaps.remark = ''
  1312. this.template.table.getdataListParm.parammaps.source = ''
  1313. this.template.table.getdataListParm.offset = 1
  1314. this.getTemplateDialogList()
  1315. },
  1316. // 配方记录-模板行点击
  1317. tableRowClickDialog(row, column, event) {
  1318. console.log('配方记录-模板行点击')
  1319. this.isDetailDialog = true
  1320. this.template.table2.getdataListParm.parammaps.date = this.template.table.getdataListParm.parammaps.date
  1321. this.template.table2.getdataListParm.parammaps.version = row.version
  1322. this.template.table2.getdataListParm.parammaps.ftid = row.id
  1323. this.template.table2.getdataListParm.parammaps.dryweight = row.dryweight
  1324. this.getDialogList()
  1325. this.getDownList()
  1326. },
  1327. getDialogList() {
  1328. this.template.table2.listLoading = true
  1329. GetDataByName(this.template.table2.getdataListParm).then(response => {
  1330. console.log('table数据', response.data.list)
  1331. if (response.data.list !== null) {
  1332. this.template.table2.list = response.data.list
  1333. this.template.table2.pageNum = response.data.pageNum
  1334. this.template.table2.pageSize = response.data.pageSize
  1335. this.template.table2.total = response.data.total
  1336. } else {
  1337. this.template.table2.list = []
  1338. }
  1339. this.$nextTick(function() {
  1340. document.querySelector('#detailDialog2').scrollIntoView()
  1341. // window.scrollTo({
  1342. // 'top': this.$refs.detailDialog2.clientHeight
  1343. // })
  1344. })
  1345. setTimeout(() => {
  1346. this.template.table2.listLoading = false
  1347. }, 100)
  1348. })
  1349. },
  1350. handleDialogSearch2() {
  1351. console.log('点击了查询')
  1352. this.arrowDown2 = true
  1353. this.arrowUp2 = false
  1354. this.template.table2.getdataListParm.offset = 1
  1355. this.getDialogList2()
  1356. },
  1357. handleDialogRefresh2() {
  1358. console.log('点击了重置')
  1359. this.template.table2.getdataListParm.parammaps.fname = ''
  1360. this.template.table2.getdataListParm.parammaps.feedgroup = ''
  1361. this.template.table2.getdataListParm.parammaps.fweight = ''
  1362. this.template.table2.getdataListParm.parammaps.autosecondname = ''
  1363. this.template.table2.getdataListParm.parammaps.islockcount = '0'
  1364. this.template.table2.getdataListParm.parammaps.sort = ''
  1365. this.template.table2.getdataListParm.offset = 1
  1366. this.getDialogList2()
  1367. },
  1368. getDialogList2() {
  1369. this.template.table2.listLoading = true
  1370. GetDataByName(this.template.table2.getdataListParm).then(response => {
  1371. console.log('table数据', response.data.list)
  1372. if (response.data.list !== null) {
  1373. this.template.table2.list = response.data.list
  1374. this.template.table2.pageNum = response.data.pageNum
  1375. this.template.table2.pageSize = response.data.pageSize
  1376. this.template.table2.total = response.data.total
  1377. } else {
  1378. this.template.table2.list = []
  1379. }
  1380. this.$nextTick(function() {
  1381. window.scrollTo({
  1382. 'top': this.$refs.templateDialog.clientHeight
  1383. })
  1384. })
  1385. setTimeout(() => {
  1386. this.template.table2.listLoading = false
  1387. }, 100)
  1388. })
  1389. },
  1390. // 导出
  1391. handleExport(item) {
  1392. if (item == 1) {
  1393. console.log('点击了导出模板')
  1394. } else {
  1395. console.log('点击了导出数据')
  1396. this.download.getdataListParm.parammaps = this.table.getdataListParm.parammaps
  1397. GetDataByName(this.download.getdataListParm).then(response => {
  1398. if (response.data.list !== null) {
  1399. for (let i = 0; i < response.data.list.length; i++) {
  1400. if (response.data.list[i].islockcount == 0) {
  1401. this.$set(response.data.list[i], 'islockcount', '否')
  1402. } else {
  1403. this.$set(response.data.list[i], 'islockcount', '是')
  1404. }
  1405. if (response.data.list[i].enable == 0) {
  1406. this.$set(response.data.list[i], 'enable', '否')
  1407. } else {
  1408. this.$set(response.data.list[i], 'enable', '是')
  1409. }
  1410. }
  1411. this.download.list = response.data.list
  1412. } else {
  1413. this.download.list = []
  1414. }
  1415. var excelDatas = [
  1416. {
  1417. tHeader: ['配方名称', '牲畜类别', '配方类型', '来源', '备注', '是否启用', '饲料组', '饲料名称', '重量(kg)', '搅拌延时(min)', '是否锁定牛头数比例', '顺序'],
  1418. filterVal: ['tname', 'ccname', 'fttype', 'source', 'remark', 'enable', 'feedgroup', 'fname', 'fweight', 'autosecond', 'islockcount', 'sort'],
  1419. tableDatas: this.download.list,
  1420. sheetName: 'Sheet1'
  1421. }
  1422. ]
  1423. json2excel(excelDatas, '配方模板', true, 'xlsx')
  1424. })
  1425. }
  1426. },
  1427. beforeImport(file) {
  1428. const isLt2M = file.size / 1024 / 1024 < 2
  1429. if (!isLt2M) {
  1430. this.$message.error('上传文件大小不能超过 2MB!')
  1431. }
  1432. return isLt2M
  1433. },
  1434. handleImportSuccess(res, file) {
  1435. this.getList()
  1436. if (res.msg === 'ok') {
  1437. this.$message({ title: '成功', message: '导入成功:' + res.data.success + '条!', type: 'success', duration: 2000 })
  1438. if (res.data.err_count > 0) {
  1439. this.$notify({ title: '失败', message: '导入失败:' + res.data.err_count + '条!', type: 'danger', duration: 2000 })
  1440. import('@/vendor/Export2Excel').then(excel => {
  1441. const list1 = res.data.result
  1442. const tHeader = [
  1443. '配方名称', '牲畜类别', '配方类型', '备注', '是否启用', '饲料组', '饲料名称', '重量(kg)', '搅拌延时(min)', '是否锁定牛头数比例', '错误信息'
  1444. ]
  1445. const filterVal = [
  1446. '配方名称', '牲畜类别', '配方类型', '备注', '是否启用', '饲料组', '饲料名称', '重量(kg)', '搅拌延时(min)', '是否锁定牛头数比例', 'error_msg'
  1447. ]
  1448. const data1 = this.formatJson(filterVal, list1)
  1449. excel.export_json_to_excel({ header: tHeader, data: data1, filename: '配方模板导入报错信息', autoWidth: true, bookType: 'xlsx' })
  1450. })
  1451. }
  1452. } else {
  1453. this.$notify({ title: '失败', message: '上传失败', type: 'danger', duration: 2000 })
  1454. }
  1455. },
  1456. formatJson(filterVal, jsonData) {
  1457. return jsonData.map(v =>
  1458. filterVal.map(j => {
  1459. if (j === 'timestamp') {
  1460. return parseTime(v[j])
  1461. } else {
  1462. return v[j]
  1463. }
  1464. })
  1465. )
  1466. },
  1467. changeDate() {
  1468. this.getTemplateDialogList()
  1469. },
  1470. // 应用
  1471. handleApplication() {
  1472. console.log('点击了应用')
  1473. MessageBox.confirm('是否确认将' + this.template.table.getdataListParm.parammaps.date + '的数据应用到当前?', {
  1474. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  1475. }).then(() => {
  1476. this.requestParam.name = 'applyFTdate'
  1477. this.requestParam.parammaps = {}
  1478. this.requestParam.parammaps.pastureid = Cookies.get('pastureid')
  1479. this.requestParam.parammaps.date = this.template.table.getdataListParm.parammaps.date
  1480. PostDataByName(this.requestParam).then(response => {
  1481. if (response.msg === 'fail') {
  1482. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  1483. } else {
  1484. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  1485. this.getTemplateDialogList()
  1486. this.getList()
  1487. }
  1488. })
  1489. }).catch(() => {
  1490. this.$message({ type: 'info', message: '已取消应用' })
  1491. })
  1492. },
  1493. // 模板行点击
  1494. tableRowClick(row, column, event) {
  1495. console.log(row, column, event)
  1496. for (let i = 0; i < this.table.list.length; i++) {
  1497. if (this.table.list[i].Edit == true) {
  1498. return false
  1499. }
  1500. }
  1501. if (column.label !== '操作') {
  1502. this.isDetail = true // 点击行显示详情
  1503. this.table2.getdataListParm.parammaps.ftid = row.id
  1504. this.table2.getdataListParm.parammaps.fttypeid = row.fttypeid
  1505. this.table2.getdataListParm.parammaps.dryweight = row.dryweight
  1506. this.getList2()
  1507. this.getDownList()
  1508. }
  1509. },
  1510. // -------------------详情-----------------------------
  1511. // 获取是否显示是否锁定牛头数
  1512. getIsLockCount() {
  1513. GetDataByName(this.lockCount.getdataListParm).then(response => {
  1514. console.log(response.data.list)
  1515. if (response.data.list[0].inforvalue == 0) {
  1516. this.lockCount.isLockCount = false
  1517. } else {
  1518. this.lockCount.isLockCount = true
  1519. }
  1520. })
  1521. },
  1522. // 详情
  1523. getList2() {
  1524. this.table2.listLoading = true
  1525. GetDataByName(this.table2.getdataListParm).then(response => {
  1526. console.log('table数据', response.data.list)
  1527. if (response.data.list !== null) {
  1528. for (let i = 0; i < response.data.list.length; i++) {
  1529. this.$set(response.data.list[i], 'Edit', false) // 编辑
  1530. this.$set(response.data.list[i], 'NoEdit', true) // 不可编辑/输入
  1531. this.$set(response.data.list[i], 'groupEdit', false) // 饲料组编辑
  1532. this.$set(response.data.list[i], 'isGroupDisabled', false) // 饲料组编辑禁止编辑
  1533. this.$set(response.data.list[i], 'groupNoEdit', true) // 饲料组不可编辑
  1534. this.$set(response.data.list[i], 'isCreate', false) // 新增操作
  1535. this.$set(response.data.list[i], 'isUpdate', true) // 编辑操作
  1536. this.$set(response.data.list[i], 'isUpdateSave', false) // 编辑保存
  1537. }
  1538. this.table2.list = response.data.list
  1539. this.table2.pageNum = response.data.pageNum
  1540. this.table2.pageSize = response.data.pageSize
  1541. this.table2.total = response.data.total
  1542. } else {
  1543. this.table2.list = []
  1544. }
  1545. this.$nextTick(function() {
  1546. console.log(this.$refs)
  1547. console.log(this.$refs.template.clientHeight)
  1548. window.scrollTo({
  1549. 'top': this.$refs.template.clientHeight
  1550. })
  1551. })
  1552. setTimeout(() => {
  1553. this.table2.listLoading = false
  1554. }, 100)
  1555. })
  1556. },
  1557. // 行拖拽
  1558. rowDrop() {
  1559. console.log(1111)
  1560. console.log(document.querySelector('#table2 .el-table__body-wrapper tbody'))
  1561. const tbody = document.querySelector('#table2 .el-table__body-wrapper tbody')
  1562. // this.sorTable()
  1563. const that = this
  1564. // Sortable.create(tbody, {
  1565. var sortable = Sortable.create(tbody, {
  1566. disabled: that.dropState,
  1567. onChoose({ newIndex, oldIndex }) {
  1568. console.log(that.isOrder, 'that.isOrder == false')
  1569. console.log(that.dropState, 'that.dropState')
  1570. if (that.dropState == true || that.isOrder == true) {
  1571. sortable.destroy()
  1572. }
  1573. },
  1574. onEnd({ newIndex, oldIndex }) {
  1575. const currRow = that.table2.list.splice(oldIndex, 1)[0]
  1576. that.table2.list.splice(newIndex, 0, currRow)
  1577. console.log('索引', newIndex)
  1578. console.log('拖动数据', currRow)
  1579. console.log('上', that.table2.list[newIndex - 1])
  1580. console.log('下', that.table2.list[newIndex + 1])
  1581. if (that.table2.list[newIndex - 1] === undefined) { // 拖动至最上方无值 // 顺序等于0,其他+1 // 饲料组等于饲料名称
  1582. for (let i = 0; i < that.table2.list.length; i++) {
  1583. that.table2.list[i].sort = parseInt(that.table2.list[i].sort) + 1 // 其他的顺序+1
  1584. }
  1585. currRow.sort = 0
  1586. currRow.feedgroup = currRow.fname
  1587. console.log('拖动至最上方无值')
  1588. } else if (currRow.sort == that.table2.list[newIndex - 1].sort) { // 拖动值顺序等于上值顺序
  1589. currRow.sort = that.table2.list[newIndex - 1].sort
  1590. console.log('拖动值顺序等于上值顺序')
  1591. } else if (that.table2.list[newIndex + 1] == undefined) { // 拖动至最下方无值 // 顺序等于上方顺序+1 // 饲料组等于饲料名称
  1592. currRow.sort = parseInt(that.table2.list[newIndex - 1].sort) + 1
  1593. currRow.feedgroup = currRow.fname
  1594. console.log('拖动至最下方无值')
  1595. } else if (currRow.sort == that.table2.list[newIndex + 1].sort) { // 拖动值顺序等于下值顺序
  1596. currRow.sort == that.table2.list[newIndex + 1].sort
  1597. console.log('拖动值顺序等于下值顺序')
  1598. } else if (that.table2.list[newIndex - 1].sort == that.table2.list[newIndex + 1].sort) { // 拖动至上下顺序一致,顺序/饲料组与上下保持一致
  1599. currRow.sort = that.table2.list[newIndex - 1].sort
  1600. currRow.feedgroup = that.table2.list[newIndex - 1].feedgroup
  1601. console.log('拖动至上下顺序一致')
  1602. } else if (that.table2.list[newIndex - 1].sort !== undefined && that.table2.list[newIndex + 1].sort !== undefined) { // 拖动至上下都有值
  1603. console.log('上下')
  1604. if (parseInt(that.table2.list[newIndex - 1].sort) + 1 == that.table2.list[newIndex + 1].sort) {
  1605. console.log(newIndex)
  1606. for (let i = newIndex; i < that.table2.list.length; i++) {
  1607. that.table2.list[i].sort = parseInt(that.table2.list[i].sort) + 1
  1608. }
  1609. }
  1610. currRow.sort = parseInt(that.table2.list[newIndex - 1].sort) + 1
  1611. currRow.feedgroup = currRow.fname
  1612. console.log(that.table2.list[newIndex + 1].sort)
  1613. }
  1614. }
  1615. })
  1616. console.log(sortable.option('disabled'))
  1617. },
  1618. handleChangeOrder() {
  1619. this.isOrder = false
  1620. this.rowDrop()
  1621. },
  1622. saveChangeOrder() {
  1623. // 保存顺序
  1624. console.log(this.table2.list)
  1625. this.requestParam = {}
  1626. this.requestParam.common = { 'returnmap': '0' }
  1627. this.requestParam.data = []
  1628. this.requestParam.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.table2.list }}
  1629. this.requestParam.data[0].children = []
  1630. this.requestParam.data[0].children[0] = { 'name': 'updateFTdetailSort', 'type': 'e', 'parammaps': {
  1631. id: '@insertSpotList.id',
  1632. pastureid: '@insertSpotList.pastureid',
  1633. sort: '@insertSpotList.sort',
  1634. feedgroup: '@insertSpotList.feedgroup'
  1635. }}
  1636. ExecDataByConfig(this.requestParam).then(response => {
  1637. console.log('顺序切换保存发送参数', this.requestParam)
  1638. if (response.msg === 'fail') {
  1639. this.$notify({ title: '顺序切换失败', message: response.data, type: 'warning', duration: 2000 })
  1640. } else {
  1641. this.$notify({ title: '', message: '顺序切换成功', type: 'success', duration: 2000 })
  1642. this.getList2()
  1643. this.isOrder = true
  1644. }
  1645. })
  1646. },
  1647. cancelChangeOrder() {
  1648. // 取消顺序
  1649. this.getList2()
  1650. this.isOrder = true
  1651. },
  1652. handleSearch2() {
  1653. console.log('点击了查询')
  1654. this.arrowDown2 = true
  1655. this.arrowUp2 = false
  1656. this.table2.getdataListParm.offset = 1
  1657. this.getList2()
  1658. },
  1659. handleRefresh2() {
  1660. console.log('点击了重置')
  1661. this.table2.getdataListParm.parammaps.fname = ''
  1662. this.table2.getdataListParm.parammaps.feedgroup = ''
  1663. this.table2.getdataListParm.parammaps.fweight = ''
  1664. this.table2.getdataListParm.parammaps.autosecondname = ''
  1665. this.table2.getdataListParm.parammaps.islockcount = '0'
  1666. this.table2.getdataListParm.parammaps.sort = ''
  1667. this.table2.getdataListParm.offset = 1
  1668. this.getList2()
  1669. },
  1670. // 详情新增
  1671. handleCreate2() {
  1672. console.log('点击了详情新增', this.table2.list)
  1673. // 编辑true/不可编辑false
  1674. // 新增操true,编辑false,编辑保存false
  1675. console.log(11)
  1676. for (let i = 0; i < this.table2.list.length; i++) {
  1677. if (this.table2.list[i].Edit === true) {
  1678. console.log(123)
  1679. this.$message({ type: 'error', message: '当前内容未保存,请点击取消或保存继续进行操作', duration: 2000 })
  1680. return false
  1681. }
  1682. }
  1683. console.log(this.table2.list)
  1684. if (this.table2.list.length == 0) {
  1685. var mysort = 0
  1686. } else {
  1687. var mysort = parseInt(this.table2.list[this.table2.list.length - 1].sort) + 1
  1688. }
  1689. 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 })
  1690. console.log(this.table2.list)
  1691. },
  1692. changeFname(item, row) {
  1693. console.log(item, row)
  1694. this.table2.temp.fname = this.feedNameList.find(obj => obj.id == item).fname
  1695. row.fname = this.feedNameList.find(obj => obj.id == item).fname
  1696. if (this.feedNameList.find(obj => obj.id == item).ispreft == '0') {
  1697. this.table2.temp.preftid = '0'
  1698. } else {
  1699. this.table2.temp.preftid = item
  1700. }
  1701. if (row.sort == '') {
  1702. row.feedgroup = this.table2.temp.fname
  1703. } else {
  1704. if (row.isCreate == true) { // 新增状态下
  1705. for (let i = 1; i < this.table2.list.length; i++) {
  1706. if (this.table2.list[i].sort == row.sort) {
  1707. console.log(this.table2.list[i])
  1708. row.feedgroup = this.table2.list[i].feedgroup
  1709. break
  1710. } else {
  1711. row.feedgroup = this.table2.temp.fname
  1712. }
  1713. }
  1714. } else if (row.isUpdateSave == true) { // 编辑状态下
  1715. var Arr = []
  1716. for (let i = 0; i < this.table2.list.length; i++) {
  1717. Arr.push(this.table2.list[i].sort)
  1718. }
  1719. var Count = 0
  1720. for (let i = 0; i < Arr.length; i++) {
  1721. if (Arr[i] == row.sort) {
  1722. Count++
  1723. }
  1724. }
  1725. for (let i = 0; i < this.table2.list.length; i++) {
  1726. if (Count > 1) {
  1727. row.feedgroup = this.table2.list[i].feedgroup
  1728. console.log(111, this.table2.list[i].feedgroup)
  1729. break
  1730. } else if (Count == 1) {
  1731. row.feedgroup = this.table2.temp.fname
  1732. console.log(222, this.table2.temp.fname)
  1733. }
  1734. }
  1735. }
  1736. }
  1737. },
  1738. bort(row) {
  1739. if (row.isCreate == true) {
  1740. if (row.sort !== '') {
  1741. for (let i = 1; i < this.table2.list.length; i++) {
  1742. if (this.table2.list[i].sort == parseInt(row.sort)) {
  1743. row.feedgroup = this.table2.list[i].feedgroup
  1744. return false
  1745. } else {
  1746. row.feedgroup = row.fname
  1747. }
  1748. }
  1749. } else {
  1750. row.feedgroup = row.fname
  1751. }
  1752. } else if (row.isUpdateSave == true) {
  1753. if (row.sort !== '') {
  1754. for (let i = 0; i < this.table2.list.length; i++) {
  1755. if (this.table2.list[i].sort == row.sort) {
  1756. console.log('失去焦点,行内顺序与表格某顺序相同时', this.table2.list[i])
  1757. if (this.table2.list[i].id !== row.id) {
  1758. row.isGroupDisabled = true
  1759. row.feedgroup = this.table2.list[i].feedgroup
  1760. break
  1761. }
  1762. } else {
  1763. console.log('失去焦点,行内顺序与表格某顺序不相同时')
  1764. row.isGroupDisabled = true
  1765. row.feedgroup = row.fname
  1766. }
  1767. }
  1768. } else {
  1769. row.feedgroup = row.fname
  1770. }
  1771. }
  1772. },
  1773. createData2(row) {
  1774. console.log('点击了详情新增保存', row)
  1775. this.table2.temp.pastureid = Cookies.get('pastureid')
  1776. this.table2.temp.ftid = this.table2.getdataListParm.parammaps.ftid
  1777. this.table2.temp.fid = row.fid
  1778. this.table2.temp.fname = this.table2.temp.fname
  1779. this.table2.temp.fweight = row.fweight
  1780. this.table2.temp.islockcount = row.islockcount
  1781. this.table2.temp.sort = row.sort
  1782. this.table2.temp.feedgroup = row.feedgroup
  1783. this.table2.temp.preftid = this.table2.temp.preftid
  1784. this.table2.temp.autosecond = row.autosecond
  1785. if (this.table2.temp.fid == '' && this.table2.temp.fweight == '' && this.table2.temp.autosecond == '') {
  1786. this.$message({ type: 'error', message: '饲料名称/重量/搅拌延时不能为空', duration: 2000 })
  1787. return false
  1788. } else if (this.table2.temp.fweight == '' && this.table2.temp.autosecond == '') {
  1789. this.$message({ type: 'error', message: '重量/搅拌延时不能为空', duration: 2000 })
  1790. return false
  1791. } else if (this.table2.temp.fid == '') {
  1792. this.$message({ type: 'error', message: '饲料名称不能为空', duration: 2000 })
  1793. return false
  1794. } else if (this.table2.temp.fweight == '') {
  1795. this.$message({ type: 'error', message: '重量不能为空', duration: 2000 })
  1796. return false
  1797. } else if (this.table2.temp.autosecond == '') {
  1798. this.$message({ type: 'error', message: '搅拌延时不能为空', duration: 2000 })
  1799. return false
  1800. }
  1801. if (this.table2.temp.sort !== '') {
  1802. this.table2.temp.sort = this.table2.temp.sort
  1803. } else {
  1804. console.log(this.table2.list.length)
  1805. if (this.table2.list.length == 1) {
  1806. this.table2.temp.sort = 0
  1807. } else {
  1808. this.table2.temp.sort = parseInt(this.table2.list[this.table2.list.length - 1].sort) + 1
  1809. row.sort = parseInt(this.table2.list[this.table2.list.length - 1].sort) + 1
  1810. }
  1811. }
  1812. if (this.table2.getdataListParm.parammaps.fttypeid == 2) {
  1813. if (parseInt(this.table2.temp.preftid) > 0) {
  1814. this.$message({ type: 'error', message: '饲料名称不能选择预混配方', duration: 2000 })
  1815. return false
  1816. }
  1817. }
  1818. // 校验顺序是否>=0
  1819. var ruleSort = /^\d+$/
  1820. if (!ruleSort.test(this.table2.temp.sort)) {
  1821. this.$message({ type: 'error', message: '饲料顺序不可为负数或小数', duration: 2000 })
  1822. return false
  1823. }
  1824. // 检验重量>0
  1825. // this.table2.temp.fweight = formatNum(this.table2.temp.fweight, 2) //根据默认参数设置小数位数
  1826. var ruleWeight = /(^[1-9](\d+)?(\.\d{1,2})?$)|(^\d\.\d{1,2}$)/
  1827. if (!ruleWeight.test(this.table2.temp.fweight)) {
  1828. this.$message({ type: 'error', message: '重量请输入正数,最多保留俩位小数', duration: 2000 })
  1829. return false
  1830. }
  1831. this.isokDisable = true
  1832. setTimeout(() => {
  1833. this.isokDisable = false
  1834. }, 1000)
  1835. this.requestParam.common = { 'returnmap': '0' }
  1836. this.requestParam.data = []
  1837. this.requestParam.data[0] = { 'name': 'insertFTdetail', 'type': 'e', 'parammaps': {
  1838. pastureid: this.table2.temp.pastureid,
  1839. ftid: this.table2.getdataListParm.parammaps.ftid,
  1840. fid: row.fid,
  1841. fname: this.table2.temp.fname,
  1842. fweight: row.fweight,
  1843. islockcount: row.islockcount,
  1844. sort: row.sort,
  1845. feedgroup: row.feedgroup,
  1846. preftid: this.table2.temp.preftid,
  1847. autosecond: row.autosecond
  1848. }}
  1849. this.requestParam.data[1] = { 'name': 'updateFPbyFTChange', 'type': 'e', 'parammaps': {
  1850. pastureid: this.table2.temp.pastureid,
  1851. ftid: this.table2.getdataListParm.parammaps.ftid,
  1852. type: this.table2.getdataListParm.parammaps.fttypeid
  1853. }}
  1854. ExecDataByConfig(this.requestParam).then(response => {
  1855. console.log('新增保存发送参数', this.requestParam)
  1856. if (response.msg !== 'fail') {
  1857. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  1858. this.getList2()
  1859. } else {
  1860. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  1861. }
  1862. })
  1863. },
  1864. createCancel2(row) {
  1865. console.log('点击了详情新增取消')
  1866. for (let i = 0; i < this.table2.list.length; i++) {
  1867. if (row.myId === this.table2.list[i].myId) {
  1868. var listIndex = this.table2.list.indexOf(this.table2.list[i])
  1869. }
  1870. if (listIndex > -1) {
  1871. this.table2.list.splice(listIndex, 1)
  1872. return
  1873. }
  1874. }
  1875. this.getDialogList()
  1876. },
  1877. // 详情编辑
  1878. handleUpdate2(row) {
  1879. console.log('详情编辑', row)
  1880. this.dropState = true
  1881. row.isGroupDisabled = false
  1882. row.islockcount = String(row.islockcount)
  1883. row.fid = String(row.fid)
  1884. row.autosecond = String(row.autosecond)
  1885. this.table2.temp.fname = row.fname
  1886. this.table2.temp.preftid = row.preftid
  1887. const rowArr = []
  1888. for (let i = 0; i < this.table2.list.length; i++) {
  1889. if (this.table2.list[i].Edit == true) {
  1890. this.$message({ type: 'error', message: '当前内容未保存,请点击取消或保存继续进行操作', duration: 2000 })
  1891. return false
  1892. }
  1893. rowArr.push(this.table2.list[i].sort)
  1894. }
  1895. var count = 0
  1896. for (let i = 0; i < rowArr.length; i++) {
  1897. if (rowArr[i] == row.sort) {
  1898. count++
  1899. }
  1900. }
  1901. // 判断是否有相同顺序,如果没有饲料组不可编辑,若有饲料组可编辑
  1902. if (count == 1) {
  1903. // 饲料组编辑false,不可编辑true
  1904. row.groupEdit = false
  1905. row.groupNoEdit = true
  1906. // 编辑true,不可编辑false
  1907. row.Edit = true
  1908. row.NoEdit = false
  1909. // 新增false,编辑false,编辑保存true
  1910. row.isCreate = false
  1911. row.isUpdate = false
  1912. row.isUpdateSave = true
  1913. } else if (count > 1) {
  1914. // 饲料组编辑true,不可编辑false
  1915. row.groupEdit = true
  1916. row.groupNoEdit = false
  1917. console.log(222)
  1918. // 编辑true,不可编辑false
  1919. row.Edit = true
  1920. row.NoEdit = false
  1921. // 新增false,编辑false,编辑保存true
  1922. row.isCreate = false
  1923. row.isUpdate = false
  1924. row.isUpdateSave = true
  1925. return false
  1926. }
  1927. },
  1928. updateData2(row) {
  1929. console.log('点击了详情编辑保存111', row)
  1930. this.isokDisable = true
  1931. setTimeout(() => {
  1932. this.isokDisable = false
  1933. }, 1000)
  1934. this.table2.temp.pastureid = row.pastureid
  1935. this.table2.temp.ftid = this.table2.getdataListParm.parammaps.ftid
  1936. this.table2.temp.fid = row.fid
  1937. this.table2.temp.fname = this.table2.temp.fname
  1938. this.table2.temp.fweight = row.fweight
  1939. this.table2.temp.islockcount = row.islockcount
  1940. this.table2.temp.sort = row.sort
  1941. this.table2.temp.feedgroup = row.feedgroup
  1942. this.table2.temp.preftid = this.table2.temp.preftid
  1943. this.table2.temp.autosecond = row.autosecond
  1944. this.table2.temp.id = row.id
  1945. if (this.table2.temp.fid == '' && this.table2.temp.fweight == '' && this.table2.temp.autosecond == '') {
  1946. this.$message({ type: 'error', message: '饲料名称/重量/搅拌延时不能为空', duration: 2000 })
  1947. return false
  1948. } else if (this.table2.temp.fweight == '' && this.table2.temp.autosecond == '') {
  1949. this.$message({ type: 'error', message: '重量/搅拌延时不能为空', duration: 2000 })
  1950. return false
  1951. } else if (this.table2.temp.fid == '') {
  1952. this.$message({ type: 'error', message: '饲料名称不能为空', duration: 2000 })
  1953. return false
  1954. } else if (this.table2.temp.fweight == '') {
  1955. this.$message({ type: 'error', message: '重量不能为空', duration: 2000 })
  1956. return false
  1957. } else if (this.table2.temp.autosecond == '') {
  1958. this.$message({ type: 'error', message: '搅拌延时不能为空', duration: 2000 })
  1959. return false
  1960. }
  1961. if (this.table2.temp.sort !== '') {
  1962. this.table2.temp.sort = this.table2.temp.sort
  1963. } else {
  1964. this.table2.temp.sort = parseInt(this.table2.list[this.table2.list.length - 1].sort) + 1
  1965. }
  1966. if (this.table2.getdataListParm.parammaps.fttypeid == 2) {
  1967. if (parseInt(this.table2.temp.preftid) > 0) {
  1968. this.$message({ type: 'error', message: '饲料名称不能选择预混配方', duration: 2000 })
  1969. return false
  1970. }
  1971. }
  1972. // 校验顺序是否>=0
  1973. var ruleSort = /^\d+$/
  1974. if (!ruleSort.test(this.table2.temp.sort)) {
  1975. this.$message({ type: 'error', message: '饲料顺序不可为负数或小数', duration: 2000 })
  1976. return false
  1977. }
  1978. // this.table2.temp.fweight = formatNum(this.table2.temp.fweight, 2) //根据默认参数设置小数位数
  1979. // 检验重量>0
  1980. var ruleWeight = /(^[1-9](\d+)?(\.\d{1,2})?$)|(^\d\.\d{1,2}$)/
  1981. if (!ruleWeight.test(this.table2.temp.fweight)) {
  1982. this.$message({ type: 'error', message: '重量请输入正数,最多保留俩位小数', duration: 2000 })
  1983. return false
  1984. }
  1985. this.requestParam.common = { 'returnmap': '0' }
  1986. this.requestParam.data = []
  1987. this.requestParam.data[0] = { 'name': 'updateFTdetail', 'type': 'e', 'parammaps': {
  1988. pastureid: row.pastureid,
  1989. ftid: this.table2.getdataListParm.parammaps.ftid,
  1990. fid: row.fid,
  1991. fname: this.table2.temp.fname,
  1992. fweight: row.fweight,
  1993. islockcount: row.islockcount,
  1994. sort: row.sort,
  1995. feedgroup: row.feedgroup,
  1996. preftid: this.table2.temp.preftid,
  1997. autosecond: row.autosecond,
  1998. id: row.id
  1999. }}
  2000. this.requestParam.data[1] = { 'name': 'updateFPbyFTChange', 'type': 'e', 'parammaps': {
  2001. pastureid: row.pastureid,
  2002. ftid: this.table2.getdataListParm.parammaps.ftid,
  2003. type: this.table2.getdataListParm.parammaps.fttypeid
  2004. }}
  2005. this.requestParam.data[2] = { 'name': 'updateFTdetailbySort', 'type': 'e', 'parammaps': {
  2006. pastureid: row.pastureid,
  2007. ftid: this.table2.getdataListParm.parammaps.ftid,
  2008. sort: row.sort,
  2009. feedgroup: row.feedgroup
  2010. }}
  2011. ExecDataByConfig(this.requestParam).then(response => {
  2012. console.log('新增保存发送参数', this.requestParam)
  2013. if (response.msg !== 'fail') {
  2014. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  2015. this.getList2()
  2016. this.dropState = false
  2017. } else {
  2018. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  2019. }
  2020. })
  2021. },
  2022. updateCancel2(row) {
  2023. console.log('点击了详情编辑取消')
  2024. // 饲料组编辑false,不可编辑true
  2025. row.groupEdit = false
  2026. row.groupNoEdit = true
  2027. // 编辑false,不可编辑true
  2028. row.Edit = false
  2029. row.NoEdit = true
  2030. // 新增false,编辑true,编辑保存false
  2031. row.isCreate = false
  2032. row.isUpdate = true
  2033. row.isUpdateSave = false
  2034. this.getList2()
  2035. this.dropState = false
  2036. },
  2037. // 详情删除
  2038. handleRowDelete2(row) {
  2039. console.log('点击了行内删除')
  2040. MessageBox.confirm('是否确认删除此信息?', {
  2041. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  2042. }).then(() => {
  2043. this.requestParam.common = { 'returnmap': '0' }
  2044. this.requestParam.data = []
  2045. this.requestParam.data[0] = { 'name': 'deleteFTdetail', 'type': 'e', 'parammaps': {
  2046. pastureid: row.pastureid,
  2047. id: row.id
  2048. }}
  2049. this.requestParam.data[1] = { 'name': 'updateFPbyFTChange', 'type': 'e', 'parammaps': {
  2050. pastureid: row.pastureid,
  2051. ftid: this.table2.getdataListParm.parammaps.ftid,
  2052. type: this.table2.getdataListParm.parammaps.fttypeid
  2053. }}
  2054. ExecDataByConfig(this.requestParam).then(response => {
  2055. console.log('新增保存发送参数', this.requestParam)
  2056. if (response.msg === 'fail') {
  2057. this.$notify({ title: '删除失败', message: response.data, type: 'warning', duration: 2000 })
  2058. } else {
  2059. this.$notify({ title: '成功', message: '删除成功', type: 'success', duration: 2000 })
  2060. this.getList2()
  2061. }
  2062. })
  2063. }).catch(() => {
  2064. this.$message({ type: 'info', message: '已取消删除' })
  2065. })
  2066. },
  2067. handleSelectionChange2(val) {
  2068. console.log('勾选数据', val)
  2069. this.selectList2 = val
  2070. },
  2071. handleDelete2() {
  2072. console.log('点击了删除')
  2073. if (this.selectList2.length == 0) {
  2074. this.$message({ type: 'error', message: '请选择配方详情', duration: 2000 })
  2075. } else {
  2076. MessageBox.confirm('是否确认删除此信息?', {
  2077. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  2078. }).then(() => {
  2079. console.log(this.selectList)
  2080. this.requestParam.common = { 'returnmap': '0' }
  2081. this.requestParam.data = []
  2082. this.requestParam.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.selectList2 }}
  2083. this.requestParam.data[0].children = []
  2084. this.requestParam.data[0].children[0] = { 'name': 'deleteFTdetail', 'type': 'e', 'parammaps': {
  2085. id: '@insertSpotList.id',
  2086. pastureid: '@insertSpotList.pastureid'
  2087. }}
  2088. ExecDataByConfig(this.requestParam).then(response => {
  2089. console.log('删除保存发送参数', this.requestParam)
  2090. if (response.msg === 'fail') {
  2091. this.$notify({ title: '删除失败', message: response.data, type: 'warning', duration: 2000 })
  2092. } else {
  2093. this.$notify({ title: '', message: '删除成功', type: 'success', duration: 2000 })
  2094. this.getList2()
  2095. }
  2096. })
  2097. })
  2098. }
  2099. },
  2100. // 拆分预混料
  2101. handleSplitPremix(row) {
  2102. console.log('点击了拆分预混料')
  2103. MessageBox.confirm('是否确认拆分当前预混料?', {
  2104. confirmButtonText: '确认',
  2105. cancelButtonText: '取消',
  2106. type: 'warning'
  2107. }).then(() => {
  2108. this.requestParam.name = 'splitFTpre'
  2109. this.requestParam.parammaps = {}
  2110. this.requestParam.parammaps.ftid = this.table2.getdataListParm.parammaps.ftid
  2111. this.requestParam.parammaps.preftid = row.preftid
  2112. this.requestParam.parammaps.ftdid = row.id
  2113. this.requestParam.parammaps.pastureid = row.pastureid
  2114. this.requestParam.parammaps.feedgroup = row.feedgroup
  2115. this.requestParam.parammaps.sort = row.sort
  2116. this.requestParam.parammaps.fweight = row.fweight
  2117. PostDataByName(this.requestParam).then(response => {
  2118. if (response.msg === 'fail') {
  2119. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  2120. } else {
  2121. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  2122. this.getList2()
  2123. }
  2124. })
  2125. }).catch(() => {
  2126. this.$message({
  2127. type: 'info',
  2128. message: '已取消删除'
  2129. })
  2130. })
  2131. },
  2132. // 合成预混料
  2133. handleSyntheticPremix() {
  2134. console.log('点击了合成预混料', this.selectList2)
  2135. if (this.table2.getdataListParm.parammaps.fttypeid == 2) {
  2136. this.$message({ type: 'error', message: '预混配方不可合成预混料', duration: 2000 })
  2137. return false
  2138. } else {
  2139. if (this.selectList2.length > 1) {
  2140. for (let i = 0; i < this.selectList2.length; i++) {
  2141. if (parseInt(this.selectList2[i].preftid) > 0) {
  2142. this.$message({ type: 'error', message: '不可选择预混料', duration: 2000 })
  2143. return false
  2144. }
  2145. }
  2146. if (this.selectList2[0].splitftpreid !== undefined) {
  2147. this.detail.getdataListParm.parammaps.ftid = this.selectList2[0].splitftpreid
  2148. this.detail.getdataListParm.parammaps.pastureid = this.selectList2[0].pastureid
  2149. GetDataByName(this.detail.getdataListParm).then(response => {
  2150. if (response.data.list !== null) { // 不为空时得到比对数据
  2151. this.detail.list3 = response.data.list
  2152. const sortList = [] // 声明排序数组
  2153. var fweightSum = 0 // 总重量
  2154. for (let i = 0; i < this.selectList2.length; i++) {
  2155. const obj = {}
  2156. obj.fid = this.selectList2[i].fid
  2157. obj.fweight = this.selectList2[i].fweight
  2158. fweightSum = fweightSum + parseFloat(this.selectList2[i].fweight)
  2159. sortList.push(obj)
  2160. }
  2161. // 排序
  2162. sortList.sort(function(a, b) {
  2163. return a.fid.localeCompare(b.fid)
  2164. })
  2165. var a = 0
  2166. if (this.detail.list3.length == sortList.length) {
  2167. for (let i = 0; i < this.detail.list3.length; i++) {
  2168. if (this.detail.list3[i].fid == sortList[i].fid && (this.detail.list3[i].fweight / this.detail.list3[i].sumWeight).toFixed(2) == (sortList[i].fweight / fweightSum).toFixed(2)) {
  2169. a++
  2170. }
  2171. }
  2172. if (a == this.detail.list3.length) { // 如果相等,则该配方为原预混配方
  2173. this.detail.getdataListParm2.parammaps.ftid = this.selectList2[0].splitftpreid
  2174. this.detail.getdataListParm2.parammaps.pastureid = this.selectList2[0].pastureid
  2175. GetDataByName(this.detail.getdataListParm2).then(response => {
  2176. if (response.data.list !== null) {
  2177. this.detail.dialogStatus = 'SyntheticPremix'
  2178. this.detail.dialogFormVisible = true
  2179. this.detail.list = this.selectList2
  2180. this.detail.list2 = response.data.list
  2181. this.detail.disabled = true
  2182. setTimeout(() => {
  2183. this.detail.listLoading = false
  2184. }, 100)
  2185. } else {
  2186. this.detail.list2 = []
  2187. }
  2188. })
  2189. } else {
  2190. this.detail.dialogStatus = 'SyntheticPremix'
  2191. this.detail.dialogFormVisible = true
  2192. this.detail.list = this.selectList2
  2193. this.detail.disabled = false
  2194. this.detail.list2 = [{ tname: '', tcolor: '#ccc', ccid: '', fttype: '预混配方', fttypeid: '2', source: '自定义', remark: '', 'enable': 1 }]
  2195. setTimeout(() => {
  2196. this.detail.listLoading = false
  2197. }, 100)
  2198. }
  2199. } else {
  2200. this.detail.dialogStatus = 'SyntheticPremix'
  2201. this.detail.dialogFormVisible = true
  2202. this.detail.list = this.selectList2
  2203. this.detail.disabled = false
  2204. this.detail.list2 = [{ tname: '', tcolor: '#ccc', ccid: '', fttype: '预混配方', fttypeid: '2', source: '自定义', remark: '', 'enable': 1 }]
  2205. setTimeout(() => {
  2206. this.detail.listLoading = false
  2207. }, 100)
  2208. }
  2209. } else {
  2210. this.detail.list3 = []
  2211. this.detail.dialogStatus = 'SyntheticPremix'
  2212. this.detail.dialogFormVisible = true
  2213. this.detail.list = this.selectList2
  2214. this.detail.disabled = false
  2215. this.detail.list2 = [{ tname: '', tcolor: '#ccc', ccid: '', fttype: '预混配方', fttypeid: '2', source: '自定义', remark: '', 'enable': 1 }]
  2216. setTimeout(() => {
  2217. this.detail.listLoading = false
  2218. }, 100)
  2219. }
  2220. })
  2221. } else {
  2222. this.detail.dialogStatus = 'SyntheticPremix'
  2223. this.detail.dialogFormVisible = true
  2224. this.detail.list = this.selectList2
  2225. this.detail.disabled = false
  2226. this.detail.list2 = [{ tname: '', tcolor: '#ccc', ccid: '', fttype: '预混配方', fttypeid: '2', source: '自定义', remark: '', 'enable': 1 }]
  2227. setTimeout(() => {
  2228. this.detail.listLoading = false
  2229. }, 100)
  2230. }
  2231. } else {
  2232. this.$message({ type: 'error', message: '请选择俩条及以上饲料进行合成', duration: 2000 })
  2233. return false
  2234. }
  2235. }
  2236. },
  2237. // 畜生类别
  2238. changeLivestockType2(item) {
  2239. this.detail.list2[0].ccname = this.livestockTypeList.find(obj => obj.value === item).label
  2240. },
  2241. syntheticPremixData() {
  2242. console.log('点击了合成预混料确认')
  2243. if (this.detail.disabled == true) { // 原预混料
  2244. let sumFweight = 0
  2245. for (let i = 0; i < this.detail.list.length; i++) {
  2246. sumFweight += parseFloat(this.detail.list[i].fweight)
  2247. }
  2248. sumFweight = sumFweight.toFixed(2)
  2249. this.isokDisable = true
  2250. setTimeout(() => {
  2251. this.isokDisable = false
  2252. }, 1000)
  2253. this.requestParam.common = { 'returnmap': '0' }
  2254. this.requestParam.data = []
  2255. this.requestParam.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.detail.list }}
  2256. this.requestParam.data[0].children = []
  2257. this.requestParam.data[0].children[0] = { 'name': 'deleteFTdetail', 'type': 'e', 'parammaps': {
  2258. pastureid: '@insertSpotList.pastureid',
  2259. id: '@insertSpotList.id'
  2260. }}
  2261. this.requestParam.data[1] = { 'name': 'insertSpotList2', 'resultmaps': { 'list': this.detail.list2 }}
  2262. this.requestParam.data[1].children = []
  2263. this.requestParam.data[1].children[0] = { 'name': 'insertFTdetail', 'type': 'e', 'parammaps': {
  2264. pastureid: Cookies.get('pastureid'),
  2265. ftid: this.table2.getdataListParm.parammaps.ftid,
  2266. fid: this.detail.list2[0].id,
  2267. fname: '@insertSpotList2.tname',
  2268. fweight: sumFweight,
  2269. islockcount: '0',
  2270. sort: parseInt(this.table2.list[this.table2.list.length - 1].sort) + 1,
  2271. feedgroup: '@insertSpotList2.tname',
  2272. preftid: this.detail.list2[0].id,
  2273. autosecond: this.detail.list[0].autosecond
  2274. }}
  2275. ExecDataByConfig(this.requestParam).then(response => {
  2276. console.log('合成预混料保存发送参数', this.requestParam)
  2277. if (response.msg === 'fail') {
  2278. const tname = new RegExp("key 'tname'")
  2279. if (tname.test(response.data)) {
  2280. this.$message({ type: 'error', message: '预混配方已存在,不可重复生成', duration: 2000 })
  2281. } else {
  2282. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  2283. }
  2284. } else {
  2285. this.$notify({ title: '', message: '保存成功', type: 'success', duration: 2000 })
  2286. this.detail.dialogFormVisible = false
  2287. this.getList()
  2288. this.getList2()
  2289. this.getDownList()
  2290. }
  2291. })
  2292. } else { // 现生成预混料
  2293. if (this.detail.list2[0].tname == '' && this.detail.list2[0].ccid == '') {
  2294. this.$message({ type: 'error', message: '配方名称/牲畜类别/不能为空', duration: 2000 })
  2295. return false
  2296. } else if (this.detail.list2[0].tname == '') {
  2297. this.$message({ type: 'error', message: '配方名称不能为空', duration: 2000 })
  2298. return false
  2299. } else if (this.detail.list2[0].ccid == '') {
  2300. this.$message({ type: 'error', message: '牲畜类别不能为空', duration: 2000 })
  2301. return false
  2302. }
  2303. const pattern = new RegExp("[`~!@#$^&*()=|{}':;',\\[\\].<>/?~!@#¥……&*()——|{}【】‘;:”“'。,、?]")
  2304. if (pattern.test(this.detail.list2[0].tname)) {
  2305. this.$message({ type: 'error', message: '配方名称不可输入特殊字符', duration: 2000 })
  2306. return false
  2307. }
  2308. let sumFweight = 0
  2309. for (let i = 0; i < this.detail.list.length; i++) {
  2310. sumFweight += parseFloat(this.detail.list[i].fweight)
  2311. }
  2312. sumFweight = sumFweight.toFixed(2)
  2313. console.log(sumFweight)
  2314. this.isokDisable = true
  2315. setTimeout(() => {
  2316. this.isokDisable = false
  2317. }, 1000)
  2318. if (this.detail.list2[0].tcolor == null) {
  2319. this.detail.list2[0].tcolor = '#CCCCCC'
  2320. }
  2321. this.requestParam.common = { 'returnmap': '0' }
  2322. this.requestParam.data = []
  2323. this.requestParam.data[0] = { 'name': 'insertFT', 'type': 'e', 'parammaps': {
  2324. pastureid: Cookies.get('pastureid'),
  2325. tcode: this.detail.list2[0].tcode,
  2326. tname: this.detail.list2[0].tname,
  2327. tcolor: this.detail.list2[0].tcolor,
  2328. ccid: this.detail.list2[0].ccid,
  2329. ccname: this.detail.list2[0].ccname,
  2330. fttype: this.detail.list2[0].fttype,
  2331. fttypeid: this.detail.list2[0].fttypeid,
  2332. source: this.detail.list2[0].source,
  2333. remark: this.detail.list2[0].remark,
  2334. enable: this.detail.list2[0].enable
  2335. }}
  2336. this.requestParam.data[1] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.detail.list }}
  2337. this.requestParam.data[1].children = []
  2338. this.requestParam.data[1].children[0] = { 'name': 'insertFTdetail', 'type': 'e', 'parammaps': {
  2339. pastureid: '@insertSpotList.pastureid',
  2340. ftid: '@insertFT.LastInsertId',
  2341. fid: '@insertSpotList.fid',
  2342. fname: '@insertSpotList.fname',
  2343. fweight: '@insertSpotList.fweight',
  2344. islockcount: '@insertSpotList.islockcount',
  2345. sort: '@insertSpotList.sort',
  2346. feedgroup: '@insertSpotList.feedgroup',
  2347. preftid: '@insertSpotList.preftid',
  2348. autosecond: '@insertSpotList.autosecond'
  2349. }}
  2350. this.requestParam.data[1].children[1] = { 'name': 'deleteFTdetail', 'type': 'e', 'parammaps': {
  2351. pastureid: '@insertSpotList.pastureid',
  2352. id: '@insertSpotList.id'
  2353. }}
  2354. this.requestParam.data[2] = { 'name': 'insertSpotList2', 'resultmaps': { 'list': this.detail.list2 }}
  2355. this.requestParam.data[2].children = []
  2356. this.requestParam.data[2].children[0] = { 'name': 'insertFTdetail', 'type': 'e', 'parammaps': {
  2357. pastureid: Cookies.get('pastureid'),
  2358. ftid: this.table2.getdataListParm.parammaps.ftid,
  2359. fid: '@insertFT.LastInsertId',
  2360. fname: '@insertSpotList2.tname',
  2361. fweight: sumFweight,
  2362. islockcount: '0',
  2363. sort: parseInt(this.table2.list[this.table2.list.length - 1].sort) + 1,
  2364. feedgroup: '@insertSpotList2.tname',
  2365. preftid: '@insertFT.LastInsertId',
  2366. autosecond: this.detail.list[0].autosecond
  2367. }}
  2368. ExecDataByConfig(this.requestParam).then(response => {
  2369. console.log('合成预混料保存发送参数', this.requestParam)
  2370. if (response.msg === 'fail') {
  2371. const tname = new RegExp("key 'tname'")
  2372. if (tname.test(response.data)) {
  2373. this.$message({ type: 'error', message: '预混配方已存在,不可重复生成', duration: 2000 })
  2374. } else {
  2375. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  2376. }
  2377. } else {
  2378. this.$notify({ title: '', message: '保存成功', type: 'success', duration: 2000 })
  2379. this.detail.dialogFormVisible = false
  2380. this.getList()
  2381. this.getList2()
  2382. this.getDownList()
  2383. }
  2384. })
  2385. }
  2386. },
  2387. handleFormulationEvaluation(row) {
  2388. console.log(row)
  2389. this.$router.push({ path: '/statisticalAnalysis/FormulationEvaluation', query: { tname: row.tname }})
  2390. this.$router.push({
  2391. name: 'FormulationEvaluation',
  2392. params: {
  2393. tname: row.tname,
  2394. ftid: row.id,
  2395. pastureid: row.pastureid,
  2396. startTime: parseTime(new Date(), '{y}-{m}-{d}'),
  2397. inputDatetime: [new Date('startTime'), new Date('startTime')], // 日期后台待传
  2398. stopTime: parseTime(new Date(), '{y}-{m}-{d}')
  2399. }
  2400. })
  2401. }
  2402. }
  2403. }
  2404. </script>
  2405. <style lang="scss" scoped>
  2406. .search{margin-top:10px;}
  2407. .table{margin-top:10px;}
  2408. .table2{margin-top:10px;}
  2409. $width:350px;
  2410. $left:325px;
  2411. .selectInput{
  2412. position: relative;
  2413. display: inline-block;
  2414. .Input{width: $width;position: relative;}
  2415. .el-icon-arrow-down{width: 30px;height: 30px;position: absolute;left: $left;top:10px;color:#C0C4CC;}
  2416. .el-icon-arrow-up{width: 30px;height: 30px;position: absolute;left: $left;top:10px;color:#C0C4CC;}
  2417. .selectUl{
  2418. 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;
  2419. li{
  2420. 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;
  2421. a{float:left;width: 80px;}
  2422. a:hover{color: rgba(0, 204, 102, 0.71); font-weight: 700;}
  2423. }
  2424. }
  2425. }
  2426. .template{
  2427. background: #fff;
  2428. position: relative;
  2429. }
  2430. .detail{
  2431. background: #fff;
  2432. position: relative;
  2433. }
  2434. .templateDialog{
  2435. background: #fff;
  2436. position: relative;
  2437. }
  2438. .detailDialog{
  2439. background: #fff;
  2440. position: relative;
  2441. }
  2442. </style>