index.vue 95 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055
  1. <template>
  2. <div class="app-container">
  3. <div class="search" ref="search">
  4. <el-input v-model="table.getdataListParm.parammaps.fname":placeholder="$t('InventoryManagement.silc')" style="width: 130px;" class="filter-item" clearable />
  5. <el-select v-model="table.getdataListParm.parammaps.fclassid" filterable placeholder="饲料类别" class="filter-item" style="width: 150px;" clearable>
  6. <el-option v-for="item in feedTypeList" :key="item.id" :label="item.mixname" :value="item.id" />
  7. </el-select>
  8. <el-select v-model="table.getdataListParm.parammaps.source" filterable placeholder="饲料来源" class="filter-item" style="width: 120px;" clearable>
  9. <el-option v-for="item in feedSourcesList" :key="item.id" :label="item.name" :value="item.id" />
  10. </el-select>
  11. <el-select v-model="table.getdataListParm.parammaps.enable" filterable :placeholder="$t('formulationEvaluation.sfqy')" class="filter-item" style="width: 120px;" clearable>
  12. <el-option v-for="item in enableList" :key="item.id" :label="item.name" :value="item.id" />
  13. </el-select>
  14. <div ref="selectInput" class="filter-item selectInput">
  15. <el-input type="text" name="" value="" :placeholder="$t('driver.xzsstj')" class="Input" />
  16. <i v-if="arrowDown" icon="el-icon-arrow-down" class="el-icon-arrow-down" />
  17. <i v-if="arrowUp" icon="el-icon-arrow-up" class="el-icon-arrow-up" />
  18. <ul v-if="arrowUp" class="selectUl">
  19. <li><a>{{$t('driver.yxwcs')}}</a><el-input v-model="table.getdataListParm.parammaps.allowratio"type="text" style="width: 245px;" /></li>
  20. <li><a>{{$t('driver.tzzly')}}</a><el-input v-model="table.getdataListParm.parammaps.autozone" type="text" style="width: 245px;" /></li>
  21. <li>
  22. <a>{{$t('driver.tzys')}}</a>
  23. <el-select v-model="table.getdataListParm.parammaps.autosecond" filterable :placeholder="$t('driver.tzys1')" class="filter-item" style="width: 245px;" clearable>
  24. <el-option v-for="item in jumpDelayList" :key="item.value" :label="item.label" :value="item.value" />
  25. </el-select>
  26. </li>
  27. <li>
  28. <div style="float: right;">
  29. <el-button class="downminCancel" @click="arrowUp=false;arrowDown=true;">{{$t('formulationEvaluation.cancel')}}</el-button>
  30. <el-button class="miniPrimary" @click="form_search">{{$t('formulationEvaluation.search')}}</el-button>
  31. </div>
  32. </li>
  33. </ul>
  34. </div>
  35. <el-button class="successBorder" @click="form_search">{{$t('common.query')}}</el-button>
  36. <el-button class="successBorder" @click="handleRefresh">{{$t('common.reset')}}</el-button>
  37. </div>
  38. <div class="operation" ref="operation">
  39. <el-button v-if="isRoleEdit" class="success" icon="el-icon-plus" @click="handleCreate">{{$t('formulationEvaluation.add')}}</el-button>
  40. <el-button v-if="isRoleEdit" class="success" icon="el-icon-plus" @click="handleSet">设置</el-button>
  41. <el-button v-if="isRoleEdit" class="success" icon="el-icon-plus" @click="handleGetSapCode">{{$t('driver.hqspanccode')}}</el-button>
  42. <el-button v-if="isRoleEdit" class="danger" icon="el-icon-delete" @click="form_delete">{{$t('formulationEvaluation.del')}}</el-button>
  43. <el-button class="success" icon="el-icon-receiving" @click="handleFeedBank">{{$t('formulationEvaluation.feed')}}库</el-button>
  44. <el-button v-if="isOrder && isRoleEdit" icon="el-icon-sort" class="success" @click="handleChangeOrder">{{$t('formulationEvaluation.ggsx')}}</el-button>
  45. <div v-else style="display: inline-block;">
  46. <el-button v-if="isRoleEdit" icon="el-icon-folder-checked" class="success" @click="saveChangeOrder">{{$t('formulationEvaluation.save')}}</el-button>
  47. <el-button v-if="isRoleEdit" icon="el-icon-close" class="sortCancel" @click="cancelChangeOrder">{{$t('formulationEvaluation.cancel')}}</el-button>
  48. </div>
  49. <el-button v-if="isRoleEdit && ispalyUd" class="success" icon="el-icon-plus" @click="handleGetUd">获取UD饲料</el-button>
  50. <el-upload style="float: right;" :headers="headers" :data="uploadData" :action="uploadExcelUrl" :show-file-list="false" :before-upload="beforeImport" :on-success="handleImportSuccess">
  51. <el-button v-if="isRoleEdit" class="import" icon="el-icon-download" style="float: right;">{{$t('formulationEvaluation.enter')}}</el-button>
  52. </el-upload>
  53. <el-dropdown style="float: right;margin-right: 10px;">
  54. <el-button class="export" icon="el-icon-upload2">{{$t('formulationEvaluation.out')}}</el-button>
  55. <el-dropdown-menu slot="dropdown">
  56. <el-dropdown-item @click.native="handleExport(1)">{{$t('formulationEvaluation.outmb')}}</el-dropdown-item>
  57. <el-dropdown-item @click.native="handleExport(2)">{{$t('formulationEvaluation.outsj')}}</el-dropdown-item>
  58. </el-dropdown-menu>
  59. </el-dropdown>
  60. </div>
  61. <div class="table">
  62. <u-table
  63. id="table"
  64. ref="table"
  65. :key="table.tableKey"
  66. v-loading="table.listLoading"
  67. :element-loading-text="$t('common.tableMsg')"
  68. border
  69. fit
  70. highlight-current-row
  71. style="width: 100%;"
  72. :row-style="rowStyle"
  73. :cell-style="cellStyle"
  74. class="elTable table-fixed"
  75. row-key="id"
  76. @selection-change="handleSelectionChange"
  77. :max-height="myHeight"
  78. use-virtual
  79. @table-body-scroll="tableScroll"
  80. :row-height="rowHeight"
  81. >
  82. <u-table-column type="selection" align="center" width="50" fixed="left" />
  83. <u-table-column :label="$t('formulationEvaluation.xh')" type="index" align="center" width="50" fixed="left"/>
  84. <u-table-column :label="$t('InventoryManagement.silc')" min-width="80px" align="center" prop="fname" fixed="left"/>
  85. <u-table-column label="饲料分类" min-width="80px" align="center" prop="fclass" fixed="left"/>
  86. <u-table-column label="物料类型" min-width="90px" align="center" prop="sapMaterialtypeName" />
  87. <!-- <u-table-column label="SAP货位" min-width="90px" align="center" prop="goods" /> -->
  88. <u-table-column label="唯一编码" min-width="80px" align="center" prop="feedcode" />
  89. <u-table-column :label="$t('driver.udname')" min-width="80px" align="center" prop="udname" />
  90. <!-- <u-table-column label="SAP编码" min-width="90px" align="center" prop="sapCode" /> -->
  91. <u-table-column label="饲料来源" min-width="80px" align="center" prop="source" />
  92. <u-table-column :label="$t('dailyExecutionPlan.jhlx')" min-width="80px" align="center" prop="printgroup" />
  93. <u-table-column v-if="isInforvalue" label="小料秤" min-width="90px" align="center" prop="smtmrname" />
  94. <u-table-column label="允许误差数(kg)" min-width="80px" align="center" prop="allowratio" />
  95. <u-table-column label="包装单位重量(kg)" min-width="80px" align="center" prop="unitweight" />
  96. <u-table-column label="单价" min-width="80px" align="center" prop="uprice" />
  97. <u-table-column :label="$t('formulationEvaluation.tzzly')"" min-width="80px" align="center" prop="autozone" />
  98. <u-table-column :label="$t('driver.tzys1')" min-width="80px" align="center" prop="autosecondname" />
  99. <u-table-column :label="$t('driver.qrks')" min-width="80px" align="center" prop="confirmstartname" />
  100. <u-table-column label="继电器位置" min-width="80px" align="center" prop="trgaddress" />
  101. <u-table-column label="无上域" min-width="60px" align="center">
  102. <template slot-scope="scope">
  103. <span v-if="scope.row.jmp == 0">否</span>
  104. <span v-else>是</span>
  105. </template>
  106. </u-table-column>
  107. <u-table-column label="备用字段01" min-width="90px" align="center" prop="backup1" />
  108. <u-table-column label="备用字段02" min-width="90px" align="center" prop="backup2" />
  109. <u-table-column label="备用字段03" min-width="90px" align="center" prop="backup3" />
  110. <u-table-column :label="$t('formulationEvaluation.sfqy')" min-width="80px" align="center">
  111. <template slot-scope="scope">
  112. <el-switch v-model="scope.row.enable" disabled active-color="#13ce66" inactive-color="#ff4949" :active-value="1" :inactive-value="0" />
  113. </template>
  114. </u-table-column>
  115. <u-table-column :label="$t('errorAnalysis.cz')" align="center" width="180" class-name="small-padding fixed-width" fixed="right">
  116. <template slot-scope="{row}">
  117. <a class="correcting" @click="handleNutritive (row)">营养价值</a>
  118. <span class="centerSpan">|</span>
  119. <a v-if="isRoleEdit" class="correcting" @click="handleRelation(row)">关联</a>
  120. <span v-if="isRoleEdit" class="centerSpan">|</span>
  121. <el-button v-if="isRoleEdit" icon="el-icon-edit-outline" class="miniSuccess" @click="handleUpdate(row)" />
  122. <span v-if="isRoleEdit" class="centerSpan">|</span>
  123. <el-button v-if="isRoleEdit" icon="el-icon-delete" class="miniDanger" @click="handleRowDelete(row)" />
  124. </template>
  125. </u-table-column>
  126. </u-table>
  127. <!-- <pagination v-show="table.total>=0" :total="table.total" :page.sync="table.getdataListParm.offset" :limit.sync="table.getdataListParm.pagecount" @pagination="getList" /> -->
  128. <span v-if="table.listLoading == false" style="margin-right: 30px;margin-top: 10px;font-size: 14px;">{{$t('processAnalysis.total')}}{{ table.total }}{{$t('processAnalysis.tiao')}}</span>
  129. </div>
  130. <!-- 新增/编辑 -->
  131. <el-dialog :fullscreen="dialogFull" :visible.sync="create.dialogFormVisible" :close-on-click-modal="false" width="90%">
  132. <template slot="title">
  133. <div class="avue-crud__dialog__header">
  134. <span class="el-dialog__title">
  135. <span style="display:inline-block;width:3px;height:20px;margin-right:5px; float: left;margin-top:2px" />
  136. {{ textMap[create.dialogStatus] }}
  137. </span>
  138. <div class="avue-crud__dialog__menu" @click="dialogFull? dialogFull=false: dialogFull=true">
  139. <svg-icon v-if="dialogFull" icon-class="exit-fullscreen" />
  140. <svg-icon v-else icon-class="fullscreen" />
  141. </div>
  142. </div>
  143. </template>
  144. <div class="app-add">
  145. <el-form ref="temp" :rules="create.rules" :model="create.temp" label-position="right" label-width="155px" style="width: 100%;margin:0 auto 50px">
  146. <el-row>
  147. <el-col :span="24">
  148. <h3 style="width: 160px;text-align: right;">基础信息</h3>
  149. </el-col>
  150. </el-row>
  151. <el-row>
  152. <el-col :span="6">
  153. <el-form-item label="饲料名称:" prop="fname">
  154. <el-input ref="fname" v-model="create.temp.fname" class="filter-item" placeholder="请输入饲料名称" type="textarea" :autosize="{ minRows:1}" maxlength="32" />
  155. </el-form-item>
  156. </el-col>
  157. <el-col :span="6">
  158. <el-form-item label="饲料类别:" prop="fclassid">
  159. <el-select v-model="create.temp.fclassid" filterable placeholder="饲料类别" class="filter-item" style="width: 100%;" @change="changeFeedList">
  160. <el-option v-for="item in feedTypeList" :key="item.id" :label="item.mixname" :value="item.id" />
  161. </el-select>
  162. </el-form-item>
  163. </el-col>
  164. <el-col :span="6">
  165. <el-form-item label="唯一编码:" prop="feedcode">
  166. <el-input ref="feedcode" v-model="create.temp.feedcode" class="filter-item" placeholder="请输入唯一编码" type="text" />
  167. </el-form-item>
  168. </el-col>
  169. <el-col :span="6">
  170. <el-form-item label="饲料来源:" prop="source">
  171. <el-input ref="source" v-model="create.temp.source" class="filter-item" disabled placeholder="用户自定义" type="text" />
  172. </el-form-item>
  173. </el-col>
  174. </el-row>
  175. <el-row>
  176. <el-col :span="6">
  177. <el-form-item label="计划类型:" prop="printgroupid">
  178. <el-select v-model="create.temp.printgroupid" filterable
  179. :placeholder="$t('processAnalysis.planType')"class="filter-item" style="width: 100%;" @change="changePlanList">
  180. <el-option v-for="item in planTypeList" :key="item.value" :label="item.label" :value="item.value" />
  181. </el-select>
  182. </el-form-item>
  183. </el-col>
  184. <el-col :span="6">
  185. <el-form-item label="包装单位重量(kg):" prop="unitweight">
  186. <el-input ref="unitweight" v-model="create.temp.unitweight" class="filter-item" placeholder="正整数" type="number" style="width: 100%;" />
  187. </el-form-item>
  188. </el-col>
  189. <el-col :span="6">
  190. <el-form-item label="单价:" prop="uprice">
  191. <el-input ref="uprice" v-model="create.temp.uprice" class="filter-item" placeholder="最多俩位小数" type="number" step="0.01" style="width: 100%;" />
  192. </el-form-item>
  193. </el-col>
  194. </el-row>
  195. <el-row>
  196. <el-col :span="6">
  197. <el-form-item label="物料类型:" prop="sapMaterialtype">
  198. <el-select v-model="create.temp.sapMaterialtype" filterable placeholder="物料类型" class="filter-item" style="width: 100%;">
  199. <el-option v-for="item in materialtypeList" :key="item.id" :label="item.distName" :value="item.distCode" />
  200. </el-select>
  201. </el-form-item>
  202. </el-col>
  203. <el-col :span="6">
  204. <el-form-item label="SAP货位:" prop="sapGoods">
  205. <el-select v-model="create.temp.sapGoods" filterable placeholder="SAP货位" class="filter-item" style="width: 100%;">
  206. <el-option v-for="item in sapGoodsList" :key="item.id" :label="item.distName" :value="item.distCode" />
  207. </el-select>
  208. </el-form-item>
  209. </el-col>
  210. <el-col :span="6">
  211. <el-form-item label="SAP编码:" prop="sapCode">
  212. <el-input ref="sapCode" v-model="create.temp.sapCode" class="filter-item" disabled placeholder="SAP编码" type="text" />
  213. <!-- <el-select v-model="create.temp.sapcode" filterable placeholder="SAP编码" class="filter-item" style="width: 100%;">
  214. <el-option v-for="item in sapCodeList" :key="item.id" :label="item.mixname" :value="item.id" />
  215. </el-select> -->
  216. </el-form-item>
  217. </el-col>
  218. </el-row>
  219. <el-row>
  220. <el-col :span="24">
  221. <h3 style="width: 160px;text-align: right;">搅拌参数</h3>
  222. </el-col>
  223. </el-row>
  224. <el-row>
  225. <el-col :span="6">
  226. <el-form-item label="允许误差数(kg):" prop="allowratio">
  227. <el-input ref="allowratio" v-model="create.temp.allowratio" class="filter-item" placeholder="正整数" type="text" />
  228. </el-form-item>
  229. </el-col>
  230. <el-col :span="6">
  231. <el-form-item label="跳转重量域(kg):" prop="autozone">
  232. <el-input ref="autozone" v-model="create.temp.autozone" :disabled="create.temp.autosecond=='0'" class="filter-item" placeholder="0-50之间的整数" type="text" />
  233. </el-form-item>
  234. </el-col>
  235. <el-col :span="6">
  236. <el-form-item label="跳转延时:" prop="autosecond">
  237. <el-select v-model="create.temp.autosecond" filterable :placeholder="$t('driver.tzys1')" class="filter-item" style="width: 100%;" @change="changeAutosecond">
  238. <el-option v-for="item in jumpDelayList" :key="item.value" :label="item.label" :value="item.value" />
  239. </el-select>
  240. </el-form-item>
  241. </el-col>
  242. <el-col :span="6">
  243. <el-form-item label="确认开始:" prop="confirmstart">
  244. <el-select v-model="create.temp.confirmstart" filterabler placeholde="确认开始" class="filter-item" style="width: 100%;" @change="changeConfirmstart">
  245. <el-option v-for="item in confirmStartList" :key="item.id" :label="item.name" :value="item.id" />
  246. </el-select>
  247. </el-form-item>
  248. </el-col>
  249. </el-row>
  250. <el-row>
  251. <el-col :span="6">
  252. <el-form-item label="是否启用:" prop="enable">
  253. <el-select v-model="create.temp.enable" filterable :placeholder="$t('formulationEvaluation.sfqy')" class="filter-item" style="width: 100%;">
  254. <el-option v-for="item in enableList" :key="item.id" :label="item.name" :value="item.id" />
  255. </el-select>
  256. </el-form-item>
  257. </el-col>
  258. <el-col :span="6">
  259. <el-form-item label="继电器位置:" prop="trgaddress">
  260. <el-input ref="trgaddress" v-model="create.temp.trgaddress" class="filter-item" placeholder="继电器位置" type="number" />
  261. </el-form-item>
  262. </el-col>
  263. <el-col v-if="isInforvalue" :span="6">
  264. <el-form-item label="小料秤:" prop="smtmrid">
  265. <el-select v-model="create.temp.smtmrid" filterable placeholder="小料秤" clearable class="filter-item" style="width: 100%;" @change="changeSmallMaterial">
  266. <el-option v-for="item in smallMaterialList" :key="item.id" :label="item.tname" :value="item.id" />
  267. </el-select>
  268. </el-form-item>
  269. </el-col>
  270. <el-col :span="6">
  271. <el-form-item label="无上域:" prop="jmp">
  272. <el-select v-model="create.temp.jmp" placeholder="无上域" class="filter-item" style="width: 100%;" @change="changeSmallMaterial">
  273. <el-option v-for="item in jmpList" :key="item.id" :label="item.name" :value="item.id" />
  274. </el-select>
  275. </el-form-item>
  276. </el-col>
  277. </el-row>
  278. <el-row>
  279. <h3 style="width: 160px;text-align: right;">备用字段</h3>
  280. </el-row>
  281. <el-row>
  282. <el-col :span="6">
  283. <el-form-item label="备用字段01:" prop="backup1">
  284. <el-input ref="backup1" v-model="create.temp.backup1" class="filter-item" placeholder="备用字段01" type="text" onkeyup="value=value.replace(/[^\x00-\xff]/g, '')" />
  285. </el-form-item>
  286. </el-col>
  287. <el-col :span="6">
  288. <el-form-item label="备用字段02:" prop="backup2">
  289. <el-input ref="backup2" v-model="create.temp.backup2" class="filter-item" placeholder="备用字段02" type="text" />
  290. </el-form-item>
  291. </el-col>
  292. <el-col :span="6">
  293. <el-form-item label="备用字段03:" prop="backup3">
  294. <el-input ref="backup3" v-model="create.temp.backup3" class="filter-item" placeholder="备用字段03" type="text" />
  295. </el-form-item>
  296. </el-col>
  297. </el-row>
  298. </el-form>
  299. <div slot="footer" class="dialog-footer">
  300. <el-button class="cancelClose" @click="create.dialogFormVisible = false;getList()">{{$t('common.closed')}}</el-button>
  301. <el-button v-if="create.dialogStatus==='create' || create.dialogStatus==='update'" class="save" :disabled="isokDisable" @click="create.dialogStatus==='create'?createData():updateData()">{{$t('errorAnalysis.confirm')}}</el-button>
  302. </div>
  303. </div>
  304. </el-dialog>
  305. <!-- 饲料库 -->
  306. <el-dialog :fullscreen="dialogFull" :visible.sync="feedBank.dialogFormVisible" :close-on-click-modal="false" width="90%">
  307. <template slot="title">
  308. <div class="avue-crud__dialog__header">
  309. <span class="el-dialog__title">
  310. <span style="display:inline-block;width:3px;height:20px;margin-right:5px; float: left;margin-top:2px" />
  311. {{ textMap[feedBank.dialogStatus] }}
  312. </span>
  313. <div class="avue-crud__dialog__menu" @click="dialogFull? dialogFull=false: dialogFull=true">
  314. <svg-icon v-if="dialogFull" icon-class="exit-fullscreen" />
  315. <svg-icon v-else icon-class="fullscreen" />
  316. </div>
  317. </div>
  318. </template>
  319. <div class="app-add">
  320. <div class="search">
  321. <el-input v-model="feedBank.getdataListParm.parammaps.fname":placeholder="$t('InventoryManagement.silc')" style="width: 130px;" class="filter-item" clearable />
  322. <el-select v-model="feedBank.getdataListParm.parammaps.statue" filterabler placeholder="关联状态" class="filter-item" style="width: 120px;" clearable>
  323. <el-option v-for="item in associationStatusList" :key="item.id" :label="item.name" :value="item.id" />
  324. </el-select>
  325. <el-button class="successBorder" @click="handleFeedBankSearch">{{$t('common.query')}}</el-button>
  326. <el-button class="successBorder" @click="handleFeedBankRefresh">{{$t('common.reset')}}</el-button>
  327. </div>
  328. <div class="table">
  329. <el-table
  330. :key="feedBank.tableKey"
  331. v-loading="feedBank.listLoading"
  332. :element-loading-text="$t('common.tableMsg')"
  333. :data="feedBank.list"
  334. border
  335. fit
  336. highlight-current-row
  337. style="width: 100%;margin: 0 auto 50px;"
  338. :row-style="rowStyle"
  339. :cell-style="cellStyle"
  340. class="elTable table-fixed"
  341. >
  342. <el-table-column :label="$t('formulationEvaluation.xh')" align="center" type="index" width="50px" />
  343. <el-table-column :label="$t('formulationEvaluation.ly')" min-width="50" align="center">
  344. <template slot-scope="scope">
  345. <span>{{ scope.row.sources }}</span>
  346. </template>
  347. </el-table-column>
  348. <el-table-column label="中国饲料号" min-width="70px" align="center">
  349. <template slot-scope="scope">
  350. <span>{{ scope.row.feedcode }}</span>
  351. </template>
  352. </el-table-column>
  353. <el-table-column :label="$t('InventoryManagement.silc')" min-width="80px" align="center">
  354. <template slot-scope="scope">
  355. <span>{{ scope.row.fname }}</span>
  356. </template>
  357. </el-table-column>
  358. <el-table-column label="价格" min-width="50px" align="center">
  359. <template slot-scope="scope">
  360. <span>{{ scope.row.price }}</span>
  361. </template>
  362. </el-table-column>
  363. <el-table-column label="样品说明" min-width="50px" align="center">
  364. <template slot-scope="scope">
  365. <span>{{ scope.row.remark }}</span>
  366. </template>
  367. </el-table-column>
  368. <el-table-column label="干物质(DM%)" min-width="65px" align="center">
  369. <template slot-scope="scope">
  370. <span>{{ scope.row.dry }}</span>
  371. </template>
  372. </el-table-column>
  373. <el-table-column :label="$t('formulationEvaluation.df')" min-width="59px" align="center">
  374. <template slot-scope="scope">
  375. <span>{{ scope.row.starch }}</span>
  376. </template>
  377. </el-table-column>
  378. <el-table-column label="粗蛋白(CP%DM)" min-width="70px" align="center">
  379. <template slot-scope="scope">
  380. <span>{{ scope.row.cp }}</span>
  381. </template>
  382. </el-table-column>
  383. <el-table-column label="钙(Ca%DM)" min-width="85px" align="center">
  384. <template slot-scope="scope">
  385. <span>{{ scope.row.ca }}</span>
  386. </template>
  387. </el-table-column>
  388. <el-table-column label="磷(P%DM)" min-width="85px" align="center">
  389. <template slot-scope="scope">
  390. <span>{{ scope.row.p }}</span>
  391. </template>
  392. </el-table-column>
  393. <el-table-column label="产奶净能(%DM)" min-width="75px" align="center">
  394. <template slot-scope="scope">
  395. <span>{{ scope.row.n }}</span>
  396. </template>
  397. </el-table-column>
  398. <el-table-column :label="$t('formulationEvaluation.zf')" min-width="59px" align="center">
  399. <template slot-scope="scope">
  400. <span>{{ scope.row.fat }}</span>
  401. </template>
  402. </el-table-column>
  403. <el-table-column label="ADF(%DM)" min-width="60px" align="center">
  404. <template slot-scope="scope">
  405. <span>{{ scope.row.adf }}</span>
  406. </template>
  407. </el-table-column>
  408. <el-table-column label="NDF(%DM)" min-width="60px" align="center">
  409. <template slot-scope="scope">
  410. <span>{{ scope.row.ndf }}</span>
  411. </template>
  412. </el-table-column>
  413. <el-table-column label="NDIP%" min-width="70px" align="center">
  414. <template slot-scope="scope">
  415. <span>{{ scope.row.ndip }}</span>
  416. </template>
  417. </el-table-column>
  418. <el-table-column label="粗灰分(Ash%)" min-width="65px" align="center">
  419. <template slot-scope="scope">
  420. <span>{{ scope.row.ash }}</span>
  421. </template>
  422. </el-table-column>
  423. <el-table-column label="粗料" min-width="50px" align="center">
  424. <template slot-scope="scope">
  425. <span>{{ scope.row.iscu }}</span>
  426. </template>
  427. </el-table-column>
  428. <el-table-column label="关联状态" min-width="50px" align="center">
  429. <template slot-scope="scope">
  430. <span v-if="scope.row.statue==0">否</span>
  431. <span v-if="scope.row.statue==1">是</span>
  432. </template>
  433. </el-table-column>
  434. </el-table>
  435. </div>
  436. <div slot="footer" class="dialog-footer">
  437. <el-button class="cancelClose cancelClose1" @click="feedBank.dialogFormVisible = false; ">{{$t('common.closed')}}</el-button>
  438. </div>
  439. </div>
  440. </el-dialog>
  441. <!-- 关联 -->
  442. <el-dialog :fullscreen="dialogFull" :visible.sync="relation.dialogFormVisible" :close-on-click-modal="false" width="90%">
  443. <template slot="title">
  444. <div class="avue-crud__dialog__header">
  445. <span class="el-dialog__title">
  446. <span style="display:inline-block;width:3px;height:20px;margin-right:5px; float: left;margin-top:2px" />
  447. {{ textMap[relation.dialogStatus] }}
  448. </span>
  449. <div class="avue-crud__dialog__menu" @click="dialogFull? dialogFull=false: dialogFull=true">
  450. <svg-icon v-if="dialogFull" icon-class="exit-fullscreen" />
  451. <svg-icon v-else icon-class="fullscreen" />
  452. </div>
  453. </div>
  454. </template>
  455. <div class="app-add">
  456. <div class="search">
  457. <el-input v-model="relation.getdataListParm.parammaps.fname":placeholder="$t('InventoryManagement.silc')" style="width: 130px;" class="filter-item" clearable />
  458. <el-button class="successBorder" @click="handleRelationSearch">{{$t('common.query')}}</el-button>
  459. </div>
  460. <div class="table">
  461. <el-table
  462. :key="relation.tableKey"
  463. v-loading="relation.listLoading"
  464. :element-loading-text="$t('common.tableMsg')"
  465. :data="relation.list"
  466. border
  467. fit
  468. highlight-current-row
  469. style="width: 100%;margin: 0 auto 50px;"
  470. :row-style="rowStyle"
  471. :cell-style="cellStyle"
  472. class="elTable table-fixed"
  473. >
  474. <el-table-column :label="$t('formulationEvaluation.xh')" align="center" type="index" width="50px" />
  475. <el-table-column :label="$t('formulationEvaluation.ly')" min-width="50" align="center">
  476. <template slot-scope="scope">
  477. <span>{{ scope.row.sources }}</span>
  478. </template>
  479. </el-table-column>
  480. <el-table-column label="中国饲料号" min-width="80px" align="center">
  481. <template slot-scope="scope">
  482. <span>{{ scope.row.feedcode }}</span>
  483. </template>
  484. </el-table-column>
  485. <el-table-column :label="$t('InventoryManagement.silc')" min-width="80px" align="center">
  486. <template slot-scope="scope">
  487. <span>{{ scope.row.fname }}</span>
  488. </template>
  489. </el-table-column>
  490. <el-table-column label="价格" min-width="50px" align="center">
  491. <template slot-scope="scope">
  492. <span>{{ scope.row.price }}</span>
  493. </template>
  494. </el-table-column>
  495. <el-table-column label="样品说明" min-width="50px" align="center">
  496. <template slot-scope="scope">
  497. <span>{{ scope.row.remark }}</span>
  498. </template>
  499. </el-table-column>
  500. <el-table-column label="干物质(DM%)" min-width="65px" align="center">
  501. <template slot-scope="scope">
  502. <span>{{ scope.row.dry }}</span>
  503. </template>
  504. </el-table-column>
  505. <el-table-column :label="$t('formulationEvaluation.df')" min-width="59px" align="center">
  506. <template slot-scope="scope">
  507. <span>{{ scope.row.starch }}</span>
  508. </template>
  509. </el-table-column>
  510. <el-table-column label="粗蛋白(CP%DM)" min-width="75px" align="center">
  511. <template slot-scope="scope">
  512. <span>{{ scope.row.cp }}</span>
  513. </template>
  514. </el-table-column>
  515. <el-table-column label="钙(Ca%DM)" min-width="83px" align="center">
  516. <template slot-scope="scope">
  517. <span>{{ scope.row.ca }}</span>
  518. </template>
  519. </el-table-column>
  520. <el-table-column label="磷(P%DM)" min-width="80px" align="center">
  521. <template slot-scope="scope">
  522. <span>{{ scope.row.p }}</span>
  523. </template>
  524. </el-table-column>
  525. <el-table-column label="产奶净能(%DM)" min-width="75px" align="center">
  526. <template slot-scope="scope">
  527. <span>{{ scope.row.n }}</span>
  528. </template>
  529. </el-table-column>
  530. <el-table-column :label="$t('formulationEvaluation.zf')" min-width="59px" align="center">
  531. <template slot-scope="scope">
  532. <span>{{ scope.row.fat }}</span>
  533. </template>
  534. </el-table-column>
  535. <el-table-column label="ADF(%DM)" min-width="60px" align="center">
  536. <template slot-scope="scope">
  537. <span>{{ scope.row.adf }}</span>
  538. </template>
  539. </el-table-column>
  540. <el-table-column label="NDF(%DM)" min-width="60px" align="center">
  541. <template slot-scope="scope">
  542. <span>{{ scope.row.ndf }}</span>
  543. </template>
  544. </el-table-column>
  545. <el-table-column label="NDIP%" min-width="70px" align="center">
  546. <template slot-scope="scope">
  547. <span>{{ scope.row.ndip }}</span>
  548. </template>
  549. </el-table-column>
  550. <el-table-column label="粗灰分(Ash%)" min-width="65px" align="center">
  551. <template slot-scope="scope">
  552. <span>{{ scope.row.ash }}</span>
  553. </template>
  554. </el-table-column>
  555. <el-table-column label="粗料" min-width="50px" align="center">
  556. <template slot-scope="scope">
  557. <span>{{ scope.row.iscu }}</span>
  558. </template>
  559. </el-table-column>
  560. <el-table-column :label="$t('errorAnalysis.cz')" min-width="50px" align="center" class-name="small-padding fixed-width" fixed="right">
  561. <template slot-scope="{row}">
  562. <a v-if="row.statueRelation == '1'" class="correcting" :disabled="isokDisable" @click="disassociateData(row)">取消关联</a>
  563. <a v-if="row.statueRelation == '0'" class="correcting" :disabled="isokDisable" @click="relationData(row)">关联</a>
  564. </template>
  565. </el-table-column>
  566. </el-table>
  567. </div>
  568. <div slot="footer" class="dialog-footer">
  569. <el-button class="cancelClose cancelClose1" @click="relation.dialogFormVisible = false;getList() ">{{$t('common.closed')}}</el-button>
  570. </div>
  571. </div>
  572. </el-dialog>
  573. <!-- 营养价值 -->
  574. <el-dialog :fullscreen="dialogFull" :visible.sync="nutritive.dialogFormVisible" :close-on-click-modal="false" width="90%">
  575. <template slot="title">
  576. <div class="avue-crud__dialog__header">
  577. <span class="el-dialog__title">
  578. <span style="display:inline-block;width:3px;height:20px;margin-right:5px; float: left;margin-top:2px" />
  579. {{ textMap[nutritive.dialogStatus] }}
  580. </span>
  581. <div class="avue-crud__dialog__menu" @click="dialogFull? dialogFull=false: dialogFull=true">
  582. <svg-icon v-if="dialogFull" icon-class="exit-fullscreen" />
  583. <svg-icon v-else icon-class="fullscreen" />
  584. </div>
  585. </div>
  586. </template>
  587. <div class="app-add">
  588. <el-form ref="temp" :rules="nutritive.rules" :model="nutritive.temp" label-position="right" label-width="160px" style="width: 100%;margin:0 auto 50px">
  589. <el-row>
  590. <el-col :span="6">
  591. <el-form-item label="干物质(DM%):" prop="dry">
  592. <el-input ref="dry" v-model="nutritive.temp.dry" :disabled="isRoleEdit==false" class="filter-item" placeholder="请输入干物质" type="number" step="0.01" />
  593. </el-form-item>
  594. </el-col>
  595. <el-col :span="6">
  596. <el-form-item label="淀粉(%DM):" prop="starch">
  597. <el-input ref="starch" v-model="nutritive.temp.starch" v-limit :disabled="isRoleEdit==false" class="filter-item" placeholder="请输入淀粉" type="number" step="0.01" />
  598. </el-form-item>
  599. </el-col>
  600. <el-col :span="6">
  601. <el-form-item label="粗蛋白(CP%DM):" prop="cp">
  602. <el-input ref="cp" v-model="nutritive.temp.cp" v-limit :disabled="isRoleEdit==false" class="filter-item" placeholder="请输入粗蛋白" type="number" step="0.01" />
  603. </el-form-item>
  604. </el-col>
  605. <el-col :span="6">
  606. <el-form-item label="钙(Ca%DM):" prop="ca">
  607. <el-input ref="ca" v-model="nutritive.temp.ca" v-limit :disabled="isRoleEdit==false" class="filter-item" placeholder="请输入钙" type="number" step="0.01" />
  608. </el-form-item>
  609. </el-col>
  610. </el-row>
  611. <el-row>
  612. <el-col :span="6">
  613. <el-form-item label="磷(P%DM):" prop="p">
  614. <el-input ref="p" v-model="nutritive.temp.p" v-limit :disabled="isRoleEdit==false" class="filter-item" placeholder="请输入磷" type="number" step="0.01" />
  615. </el-form-item>
  616. </el-col>
  617. <el-col :span="6">
  618. <el-form-item label="产奶净能(%DM):" prop="n">
  619. <el-input ref="n" v-model="nutritive.temp.n" v-limit :disabled="isRoleEdit==false" class="filter-item" placeholder="请输入产奶净能" type="number" step="0.01" />
  620. </el-form-item>
  621. </el-col>
  622. <el-col :span="6">
  623. <el-form-item label="脂肪(%DM):" prop="fat">
  624. <el-input ref="fat" v-model="nutritive.temp.fat" v-limit :disabled="isRoleEdit==false" class="filter-item" placeholder="请输入脂肪" type="number" step="0.01" />
  625. </el-form-item>
  626. </el-col>
  627. <el-col :span="6">
  628. <el-form-item label="ADF(%DM):" prop="adf">
  629. <el-input ref="adf" v-model="nutritive.temp.adf" v-limit :disabled="isRoleEdit==false" class="filter-item" placeholder="请输入ADF" type="number" step="0.01" />
  630. </el-form-item>
  631. </el-col>
  632. </el-row>
  633. <el-row>
  634. <el-col :span="6">
  635. <el-form-item label="NDF(%DM):" prop="ndf">
  636. <el-input ref="ndf" v-model="nutritive.temp.ndf" v-limit :disabled="isRoleEdit==false" class="filter-item" placeholder="请输入NDF" type="number" step="0.01" />
  637. </el-form-item>
  638. </el-col>
  639. <el-col :span="6">
  640. <el-form-item label="NDIP(%):" prop="ndip">
  641. <el-input ref="ndip" v-model="nutritive.temp.ndip" v-limit :disabled="isRoleEdit==false" class="filter-item" placeholder="请输入NDIP" type="number" step="0.01" />
  642. </el-form-item>
  643. </el-col>
  644. <el-col :span="6">
  645. <el-form-item label="粗灰分(Ash%):" prop="ash">
  646. <el-input ref="ash" v-model="nutritive.temp.ash" v-limit :disabled="isRoleEdit==false" class="filter-item" placeholder="请输入粗灰分" type="number" min="0.00" step="0.01" />
  647. </el-form-item>
  648. </el-col>
  649. </el-row>
  650. </el-form>
  651. <div slot="footer" class="dialog-footer">
  652. <el-button class="cancelClose" @click="nutritive.dialogFormVisible = false;getList()">{{$t('common.closed')}}</el-button>
  653. <el-button v-if="nutritive.dialogStatus==='nutritive' && isRoleEdit" class="save" :disabled="isokDisable" @click="nutritiveData()">{{$t('errorAnalysis.confirm')}}</el-button>
  654. </div>
  655. </div>
  656. </el-dialog>
  657. <!-- 设置 -->
  658. <el-dialog :fullscreen="dialogFull" :visible.sync="sapCode.dialogFormVisible" :close-on-click-modal="false" width="90%">
  659. <template slot="title">
  660. <div class="avue-crud__dialog__header">
  661. <span class="el-dialog__title">
  662. <span style="display:inline-block;width:3px;height:20px;margin-right:5px; float: left;margin-top:2px" />
  663. {{ textMap[sapCode.dialogStatus] }}
  664. </span>
  665. <div class="avue-crud__dialog__menu" @click="dialogFull? dialogFull=false: dialogFull=true">
  666. <svg-icon v-if="dialogFull" icon-class="exit-fullscreen" />
  667. <svg-icon v-else icon-class="fullscreen" />
  668. </div>
  669. </div>
  670. </template>
  671. <div class="app-add">
  672. <div class="search" ref="search">
  673. <el-input v-model="sapCode.table.getdataListParm.parammaps.MAKTX" placeholder="原料名称" style="width: 130px;" class="filter-item" clearable />
  674. <el-button class="successBorder" @click="handleSapCodeSearch">{{$t('common.query')}}</el-button>
  675. </div>
  676. <div class="table">
  677. <u-table
  678. id="saptable"
  679. ref="saptable"
  680. :key="sapCode.table.tableKey"
  681. v-loading="sapCode.table.listLoading"
  682. :element-loading-text="$t('common.tableMsg')"
  683. border
  684. fit
  685. highlight-current-row
  686. style="width: 100%;"
  687. :row-style="rowStyle"
  688. :cell-style="cellStyle"
  689. class="elTable table-fixed"
  690. row-key="id"
  691. @selection-change="handleSapCodeSelectionChange"
  692. :max-height="myHeight"
  693. use-virtual
  694. @table-body-scroll="tableScroll"
  695. :row-height="rowHeight"
  696. >
  697. <u-table-column type="selection" align="center" width="50"/>
  698. <u-table-column label="物料号" min-width="80px" align="center" prop="MATNR"/>
  699. <u-table-column label="物料类型" min-width="90px" align="center" prop="MTART" />
  700. <u-table-column label="物料组" min-width="80px" align="center" prop="MATKL"/>
  701. <u-table-column label="物料描述" min-width="90px" align="center" prop="MAKTX" />
  702. <u-table-column label="最后修改日期" min-width="80px" align="center" prop="LAEDA" />
  703. </u-table>
  704. </div>
  705. <div slot="footer" class="dialog-footer">
  706. <el-button class="cancelClose" @click="sapCode.dialogFormVisible = false;getList()">{{$t('common.closed')}}</el-button>
  707. <el-button v-if="sapCode.dialogStatus==='sapCode' && isRoleEdit" class="save" :disabled="isokDisable" @click="sapCodeData()">{{$t('errorAnalysis.confirm')}}</el-button>
  708. </div>
  709. </div>
  710. </el-dialog>
  711. <!-- 获取SAP编码 -->
  712. <el-dialog :fullscreen="dialogFull" :visible.sync="sapCode2.dialogFormVisible" :close-on-click-modal="false" width="50%">
  713. <template slot="title">
  714. <div class="avue-crud__dialog__header">
  715. <span class="el-dialog__title">
  716. <span style="display:inline-block;width:3px;height:20px;margin-right:5px; float: left;margin-top:2px" />
  717. {{ textMap[sapCode2.dialogStatus] }}
  718. </span>
  719. <div class="avue-crud__dialog__menu" @click="dialogFull? dialogFull=false: dialogFull=true">
  720. <svg-icon v-if="dialogFull" icon-class="exit-fullscreen" />
  721. <svg-icon v-else icon-class="fullscreen" />
  722. </div>
  723. </div>
  724. </template>
  725. <div class="app-add">
  726. <el-form ref="sapCode2" :rules="sapCode2.rules" :model="sapCode2.temp" label-position="right" label-width="155px" style="width: 100%;margin:0 auto 50px">
  727. <el-row>
  728. <el-col :span="18">
  729. <el-form-item :label="$t('dailyExecutionPlan.sjfw')" prop="inputDatetime">
  730. <el-date-picker v-model="sapCode2.temp.inputDatetime" class="inputDatetime filter-item" type="daterange" :range-separator="$t('common.to')" :start-placeholder="$t('common.startTime')" :end-placeholder="$t('common.endTime')" style="width: 100%;" :clearable="false" />
  731. </el-form-item>
  732. </el-col>
  733. </el-row>
  734. <el-row>
  735. <el-col :span="18">
  736. <el-form-item label="物料类型:" prop="sapMaterialtype">
  737. <el-select v-model="sapCode2.temp.sapMaterialtype" filterable placeholder="物料类型" class="filter-item" style="width: 100%;">
  738. <el-option v-for="item in materialtypeList" :key="item.id" :label="item.distName" :value="item.distCode" />
  739. </el-select>
  740. </el-form-item>
  741. </el-col>
  742. </el-row>
  743. </el-form>
  744. <div slot="footer" class="dialog-footer">
  745. <el-button class="cancelClose" @click="sapCode2.dialogFormVisible = false;getList()">{{$t('common.closed')}}</el-button>
  746. <el-button v-if="sapCode2.dialogStatus==='sapCode2' && isRoleEdit" class="save" :disabled="isokDisable" @click="sapCodeData2()">{{$t('errorAnalysis.confirm')}}</el-button>
  747. </div>
  748. </div>
  749. </el-dialog>
  750. </div>
  751. </template>
  752. <script>
  753. import { GetDataByName, PostDataByName, failproccess, ExecDataByConfig, GetDataByNames, checkButtons,postJson } from '@/api/common'
  754. import Cookies from 'js-cookie'
  755. import Sortable from 'sortablejs'
  756. import Pagination from '@/components/Pagination'
  757. import axios from 'axios'
  758. import { getToken } from '@/utils/auth'
  759. import { parseTime, json2excel, handleTableSpan, handleObjectSpanMethod } from '@/utils/index.js'
  760. import { MessageBox } from 'element-ui'
  761. export default {
  762. name: 'FeedTable',
  763. components: { Pagination },
  764. directives: {
  765. limit: {
  766. // 指令的定义
  767. update: function(el) {
  768. el.onkeypress = function(e) {
  769. var code = e.charCode
  770. if (code != 0) {
  771. if (!String.fromCharCode(code).match(/[0-9\.]/)) {
  772. return false
  773. }
  774. }
  775. }
  776. el.addEventListener('textInput', function(e) {
  777. e.target.value = e.target.value.replace(/[^0-9\.]/g, '')
  778. })
  779. el.onkeyup = function(e) {
  780. e.target.value = e.target.value.replace(/[^0-9\.]/g, '')
  781. }
  782. }
  783. }
  784. },
  785. data() {
  786. return {
  787. rowHeight: 30,
  788. dialogFull: false,
  789. isInforvalue: false,
  790. isRoleEdit: [],
  791. download: {
  792. getdataListParm: {
  793. name: 'getFeedList',
  794. page: 1,
  795. offset: 1,
  796. pagecount: 0,
  797. returntype: 'Map',
  798. parammaps: {
  799. pastureid: Cookies.get('pastureid'),
  800. fname: '',
  801. fclassid: '',
  802. source: '',
  803. autozone: '',
  804. autosecond: '',
  805. allowratio: '',
  806. printgroup: '',
  807. enable: ''
  808. }
  809. },
  810. list: []
  811. },
  812. requestParams: [
  813. { name: 'getDictByName', offset: 0, pagecount: 0, params: ['跳转延时'] },
  814. { name: 'getFeedclassByBig', offset: 0, pagecount: 0, parammaps: { pastureid: Cookies.get('pastureid') }},
  815. { name: 'getDictByName2', offset: 0, pagecount: 0, params: ['计划类型'] },
  816. { name: 'getTMRListEnableTypeFeed', offset: 0, pagecount: 0, parammaps: { pastureid: Cookies.get('pastureid'), eqtype: '4' }},
  817. { name: 'getDistMateriel', offset: 0, pagecount: 0, params: [] },
  818. { name: 'getDistGoods', offset: 0, pagecount: 0, params: [] },
  819. ],
  820. requestParams2: {
  821. name: 'getSysoptEnable', offset: 0, parammaps: { pastureid: Cookies.get('pastureid'), inforname: 'isSmallMaterial' }
  822. },
  823. enableList: [{ id: '1', name: '是' }, { id: '0', name: '否' }], // 是否启用
  824. feedSourcesList: [{ id: '0', name: '系统内置' }, { id: '1', name: '用户自定义' }], // 饲料来源
  825. confirmStartList: [{ id: '0', name: '禁用' }, { id: '1', name: '启用' }], // 确认开始
  826. associationStatusList: [{ id: '1', name: '是' }, { id: '0', name: '否' }], // 关联状态
  827. jumpDelayList: [], // 跳转延时
  828. feedTypeList: [], // 饲料分类
  829. planTypeList: [], // 计划类型
  830. smallMaterialList: [], // 小料秤
  831. jmpList: [{ id: '0', name: '否' }, { id: '1', name: '是' }], // 无上域
  832. materialtypeList:[],//物料类型
  833. sapGoodsList:[],//sap货位
  834. sapCodeList:[],//sap编码
  835. table: {
  836. tableKey: 0,
  837. list: [],
  838. total: 0,
  839. listLoading: true,
  840. getdataListParm: {
  841. name: 'getFeedList',
  842. page: 1,
  843. offset: 1,
  844. pagecount: '',
  845. returntype: 'Map',
  846. parammaps: {
  847. pastureid: Cookies.get('pastureid'),
  848. fname: '',
  849. fclassid: '',
  850. source: '',
  851. autozone: '',
  852. autosecond: '',
  853. allowratio: '',
  854. printgroup: '',
  855. enable: ''
  856. }
  857. }
  858. },
  859. // 多项搜索显示隐藏
  860. arrowDown: true,
  861. arrowUp: false,
  862. // 新增/编辑
  863. create: {
  864. dialogFormVisible: false,
  865. dialogStatus: '',
  866. temp: { pastureid: Cookies.get('pastureid'), fname: '', fclassid: '', fclass: '', feedcode: '', source: '用户自定义', printgroupid: '1', printgroup: '无', unitweight: '', uprice: '', allowratio: '', autozone: '', autosecond: '0', autosecondname: '禁用', confirmstart: '0', confirmstartname: '禁用', enable: '1', trgaddress: '', backup1: '', backup2: '', backup3: '',feedgroupid:'',sapMaterialtype:'',sapGoods:'',sapCode:''},
  867. rules: {
  868. printgroupid :[{ type: 'string', required: true, message: '必填', trigger: 'blur' }],
  869. fname: [{ type: 'string', required: true, message: '必填', trigger: 'blur' }],
  870. fclassid: [{ type: 'string', required: true, message: '必填', trigger: 'blur' }],
  871. feedcode: [{ type: 'string', required: true, message: '必填', trigger: 'blur' }]
  872. }
  873. },
  874. // 饲料库
  875. feedBank: {
  876. dialogFormVisible: false,
  877. dialogStatus: '',
  878. temp: {},
  879. rules: {},
  880. tableKey: 0,
  881. list: [],
  882. total: 0,
  883. listLoading: true,
  884. getdataListParm: {
  885. name: 'getFeednurList',
  886. page: 1,
  887. offset: 1,
  888. returntype: 'Map',
  889. parammaps: {
  890. pastureid: Cookies.get('pastureid'),
  891. fname: '',
  892. statue: ''
  893. }
  894. }
  895. },
  896. // 关联
  897. relation: {
  898. dialogFormVisible: false,
  899. dialogStatus: '',
  900. temp: {},
  901. rules: {},
  902. tableKey: 0,
  903. list: [],
  904. total: 0,
  905. listLoading: true,
  906. getdataListParm: {
  907. name: 'getFeednurRelation',
  908. page: 1,
  909. offset: 1,
  910. returntype: 'Map',
  911. parammaps: {
  912. pastureid: Cookies.get('pastureid'),
  913. fname: ''
  914. }
  915. }
  916. },
  917. // 营养价值
  918. nutritive: {
  919. dialogFormVisible: false,
  920. dialogStatus: '',
  921. temp: {},
  922. rules: {}
  923. },
  924. sapCode:{
  925. dialogFormVisible: false,
  926. dialogStatus: '',
  927. selectList:[],
  928. table: {
  929. tableKey: 0,
  930. list: [],
  931. total: 0,
  932. listLoading: false,
  933. getdataListParm: {
  934. name: 'getFeedSap',
  935. page: 1,
  936. offset: 1,
  937. pagecount: '',
  938. returntype: 'Map',
  939. parammaps: {
  940. MAKTX:''
  941. }
  942. }
  943. }
  944. },
  945. sapCode2:{
  946. dialogFormVisible: false,
  947. dialogStatus: '',
  948. materialtypeList:[],
  949. temp:{
  950. inputDatetime: [parseTime(new Date(), '{y}-{m}-{d}'), parseTime(new Date(), '{y}-{m}-{d}')],
  951. sapMaterialtype:'',
  952. },
  953. rules: {
  954. inputDatetime :[{required: true, message: '必填', trigger: 'blur' }],
  955. sapMaterialtype: [{ required: true, message: '必填', trigger: 'blur' }],
  956. }
  957. },
  958. textMap: {
  959. create: '新增',
  960. update: '编辑',
  961. feedBank: '饲料库',
  962. relation: '关联',
  963. nutritive: '营养价值',
  964. sapCode: '设置',
  965. sapCode2: '获取SAP编码',
  966. },
  967. isokDisable: false,
  968. selectList: [],
  969. requestParam: {},
  970. rowStyle: { maxHeight: 30 + 'px', height: 30 + 'px' },
  971. cellStyle: { padding: 0 + 'px' },
  972. dropState: false,
  973. isOrder: true,
  974. ispalyUd: true,
  975. myHeight:document.documentElement.clientHeight - 85- 150
  976. }
  977. },
  978. computed: {
  979. // 设置请求头
  980. headers() {
  981. return {
  982. token: getToken()
  983. }
  984. },
  985. uploadData() {
  986. return {
  987. name: 'checkFeedName,checkProjectType, checkFeedCode, checkFeedType, importFeed,updateFeedSortByCode',
  988. importParams: '饲料名称,饲料类别,唯一编码,计划类型,包装单位重量,单价,允许误差数,跳转延时,确认开始,是否启用,继电器位置,无上域',
  989. sheetname: 'Sheet1',
  990. // 登录牧场
  991. pastureid: Cookies.get('pastureid'),
  992. // 日期参数
  993. dateParams: '',
  994. // 必填参数
  995. requiredParams: '饲料名称,饲料分类',
  996. // 为数值的参数
  997. numParams: ''
  998. }
  999. },
  1000. // 设置上传地址
  1001. uploadExcelUrl() {
  1002. return Cookies.get('url') + 'authdata/ImportExcel'
  1003. }
  1004. },
  1005. mounted() {
  1006. document.addEventListener('click', (e) => {
  1007. if (this.$refs.selectInput !== undefined) {
  1008. if (!this.$refs.selectInput.contains(e.target)) {
  1009. this.arrowDown = true
  1010. this.arrowUp = false
  1011. } else {
  1012. this.arrowDown = false
  1013. this.arrowUp = true
  1014. }
  1015. }
  1016. })
  1017. },
  1018. created() {
  1019. this.getIspalyUd()
  1020. this.getList()
  1021. this.getDownList()
  1022. this.getButtons()
  1023. this.getInforvalueList()
  1024. },
  1025. methods: {
  1026. beforeImport(file) {
  1027. const isLt2M = file.size / 1024 / 1024 < 2
  1028. if (!isLt2M) {
  1029. this.$message.error('上传文件大小不能超过 2MB!')
  1030. }
  1031. return isLt2M
  1032. },
  1033. handleImportSuccess(res, file) {
  1034. this.getList()
  1035. if (res.msg === 'ok') {
  1036. this.$message({ title: this.$t('common.succes'), message: '导入成功:' + res.data.success + '条!', type: 'success', duration: 2000 })
  1037. if (res.data.err_count > 0) {
  1038. this.$notify({ title: '失败', message: '导入失败:' + res.data.err_count + '条!', type: 'danger', duration: 2000 })
  1039. import('@/vendor/Export2Excel').then(excel => {
  1040. const list1 = res.data.result
  1041. const tHeader = [
  1042. '饲料名称', '饲料分类', '唯一编码', '计划类型', '允许误差数(kg)', '包装单位重量(kg)', '单价', '跳转重量域(kg)', '跳转延时', '确认开始', '继电器位置', '无上域', '备用字段01', '备用字段02', '备用字段03', '错误信息'
  1043. ]
  1044. const filterVal = [
  1045. '饲料名称', '饲料分类', '唯一编码', '计划类型', '允许误差数(kg)', '包装单位重量(kg)', '单价', '跳转重量域(kg)', '跳转延时', '确认开始', '继电器位置', '无上域', '备用字段01', '备用字段02', '备用字段03', 'error_msg'
  1046. ]
  1047. const data1 = this.formatJson(filterVal, list1)
  1048. excel.export_json_to_excel({ header: tHeader, data: data1, filename: '饲料表导入报错信息', autoWidth: true, bookType: 'xlsx' })
  1049. })
  1050. }
  1051. } else {
  1052. this.$notify({ title: '失败', message: '上传失败', type: 'danger', duration: 2000 })
  1053. }
  1054. },
  1055. formatJson(filterVal, jsonData) {
  1056. return jsonData.map(v =>
  1057. filterVal.map(j => {
  1058. if (j === 'timestamp') {
  1059. return parseTime(v[j])
  1060. } else {
  1061. return v[j]
  1062. }
  1063. })
  1064. )
  1065. },
  1066. handleExport(item) {
  1067. if (item == 1) {
  1068. console.log('点击了导出模板')
  1069. this.download.getdataListParm.parammaps = this.table.getdataListParm.parammaps
  1070. console.log('点击了导出模板',this.download.getdataListParm)
  1071. GetDataByName(this.download.getdataListParm).then(response => {
  1072. if (response.data.list !== null) {
  1073. this.download.list = response.data.list
  1074. } else {
  1075. this.download.list = []
  1076. }
  1077. console.log(this.download.list)
  1078. var downloadList = [
  1079. { 'obj1': '1、文件类型为xlsx类型,对应表格文件名格式为:文件名称.xlsx;' },
  1080. { 'obj1': '2、底部工作表名称不可更改,默认为:Sheet1;' },
  1081. // { 'obj1': '3、栏舍名称,实际牛头数,系数(%),系数头数,配方模板,补料配方字体为必填;' },
  1082. // { 'obj1': '4、第一列栏舍名称默认为系统中栏舍,不可修改;' },
  1083. // { 'obj1': '5、实际牛头数为正整数,系数为正数,至多保留俩位小数;' },
  1084. // { 'obj1': '6、配方模板名称必须与系统中配方计划—配方模板中的饲喂配方匹配;若补料配方开启,需与配方模板中的补料配方匹配;' },
  1085. // { 'obj1': '7、数据最多可导入200条,超过200条请分多个文件导入。' }
  1086. ]
  1087. var excelDatas = [
  1088. {
  1089. tHeader: [
  1090. '饲料名称', '饲料分类', '唯一编码', '饲料来源', '计划类型', '允许误差数(kg)', '包装单位重量(kg)', '单价', '跳转重量域(kg)', '跳转延时', '确认开始', '继电器位置', '无上域', '备用字段01', '备用字段02', '备用字段03'
  1091. ],
  1092. filterVal: ['', '', '', '', '','', '', '', '', '', '', '', '', '', '', ''],
  1093. tableDatas: this.download.list,
  1094. sheetName: 'Sheet1'
  1095. }, {
  1096. tHeader: ['填写规范:'],
  1097. filterVal: ['obj1'],
  1098. tableDatas: downloadList,
  1099. sheetName: 'Sheet2'
  1100. }
  1101. ]
  1102. json2excel(excelDatas, '饲料表导入模板', true, 'xlsx')
  1103. })
  1104. // console.log('点击了导出模板')
  1105. // const requestParam = this.requestParam
  1106. // const url = process.env.VUE_APP_BASE_API + 'file/导入导出模板/库存管理/饲料表导入模板.xlsx' // 请求下载文件的地址
  1107. // console.log(url)
  1108. // axios({
  1109. // method: 'GET',
  1110. // url: url,
  1111. // data: requestParam,
  1112. // headers: { token: getToken(), optname: 'insertcustomdoc' },
  1113. // responseType: 'blob'
  1114. // }).then(res => {
  1115. // if (!res) return
  1116. // this.percentage = 99
  1117. // setTimeout(() => {
  1118. // this.isPercentage = false
  1119. // }, 2000)
  1120. // const blob = new Blob([res.data], {
  1121. // type: 'application/octet-stream;charset=utf-8'
  1122. // })
  1123. // const url = window.URL.createObjectURL(blob)
  1124. // const aLink = document.createElement('a')
  1125. // aLink.style.display = 'none'
  1126. // aLink.href = url
  1127. // const docname = '饲料表导入模板.xlsx'
  1128. // aLink.setAttribute('download', docname) // 下载的文件
  1129. // document.body.appendChild(aLink)
  1130. // aLink.click()
  1131. // document.body.removeChild(aLink)
  1132. // window.URL.revokeObjectURL(url)
  1133. // })
  1134. } else {
  1135. console.log('点击了导出数据')
  1136. this.download.getdataListParm.parammaps = this.table.getdataListParm.parammaps
  1137. GetDataByName(this.download.getdataListParm).then(response => {
  1138. if (response.data.list !== null) {
  1139. this.download.list = response.data.list
  1140. } else {
  1141. this.download.list = []
  1142. }
  1143. var excelDatas = [
  1144. {
  1145. tHeader: [
  1146. '饲料名称', '饲料分类', '唯一编码', '饲料来源', '计划类型', '允许误差数(kg)', '包装单位重量(kg)', '单价', '跳转重量域(kg)', '跳转延时', '确认开始', '继电器位置', '无上域', '备用字段01', '备用字段02', '备用字段03'
  1147. ],
  1148. filterVal: ['fname', 'fclass', 'feedcode', 'source', 'printgroup', 'allowratio', 'unitweight', 'uprice', 'autozone', 'autosecondnam', 'onfirmstartname', 'trgaddress', 'jmp', 'backup1', 'backup2', 'backup3'],
  1149. tableDatas: this.download.list,
  1150. sheetName: 'Sheet1'
  1151. }
  1152. ]
  1153. json2excel(excelDatas, '饲料表', true, 'xlsx')
  1154. })
  1155. }
  1156. },
  1157. getButtons() {
  1158. const Edit = 'FeedTable'
  1159. const isRoleEdit = checkButtons(JSON.parse(sessionStorage.getItem('buttons')), Edit)
  1160. this.isRoleEdit = isRoleEdit
  1161. },
  1162. getInforvalueList() {
  1163. GetDataByName(this.requestParams2).then(response => {
  1164. if (response.data !== null) {
  1165. if (response.data.list[0].inforvalue == 0) {
  1166. this.isInforvalue = false
  1167. } else {
  1168. this.isInforvalue = true
  1169. }
  1170. } else {
  1171. this.isInforvalue = false
  1172. }
  1173. })
  1174. },
  1175. getDownList() {
  1176. GetDataByNames(this.requestParams).then(response => {
  1177. this.jumpDelayList = response.data.getDictByName.list
  1178. this.feedTypeList = response.data.getFeedclassByBig.list
  1179. this.planTypeList = response.data.getDictByName2.list
  1180. this.smallMaterialList = response.data.getTMRListEnableTypeFeed.list
  1181. this.materialtypeList = response.data.getDistMateriel .list
  1182. this.sapGoodsList = response.data.getDistGoods.list
  1183. })
  1184. },
  1185. getList() {
  1186. this.table.listLoading = true
  1187. GetDataByName(this.table.getdataListParm).then(response => {
  1188. console.log('table数据', response.data.list)
  1189. if (response.data.list !== null) {
  1190. this.table.list = response.data.list
  1191. this.table.pageNum = response.data.pageNum
  1192. this.table.pageSize = response.data.pageSize
  1193. } else {
  1194. this.table.list = []
  1195. }
  1196. this.$refs.table.reloadData( this.table.list)
  1197. this.table.total = response.data.total
  1198. setTimeout(() => {
  1199. this.table.listLoading = false
  1200. }, 100)
  1201. })
  1202. },
  1203. tableScroll ({scrollTop, scrollLeft, table, judgeFlse}) {
  1204. // {scrollTop, scrollLeft, table, judgeFlse: 这个参数返回一个boolean值,为true则代表表格滚动到了底部了,false没有滚动到底部,必须开起大数据渲染模式才能有值哦}, event
  1205. console.log(scrollTop, scrollLeft, table, judgeFlse)
  1206. },
  1207. form_search() {
  1208. console.log('点击了查询')
  1209. this.table.getdataListParm.offset = 1
  1210. this.getList()
  1211. this.arrowDown = true
  1212. this.arrowUp = false
  1213. },
  1214. handleRefresh() {
  1215. console.log('点击了重置')
  1216. this.table.getdataListParm.parammaps.fname = ''
  1217. this.table.getdataListParm.parammaps.fclassid = ''
  1218. this.table.getdataListParm.parammaps.source = ''
  1219. this.table.getdataListParm.parammaps.autozone = ''
  1220. this.table.getdataListParm.parammaps.autosecond = ''
  1221. this.table.getdataListParm.parammaps.allowratio = ''
  1222. this.table.getdataListParm.parammaps.printgroup = ''
  1223. this.table.getdataListParm.parammaps.enable = ''
  1224. this.table.getdataListParm.offset = 1
  1225. this.getList()
  1226. },
  1227. resetTemp() {
  1228. this.create.temp = { pastureid: Cookies.get('pastureid'), fname: '', fclassid: '', fclass: '', feedcode: '', source: '用户自定义', printgroupid: '1', printgroup: '无', unitweight: '', uprice: '', allowratio: '', autozone: '', autosecond: '0', autosecondname: '禁用', confirmstart: '0', confirmstartname: '禁用', enable: '1', trgaddress: '', backup1: '', backup2: '', backup3: '', jmp: '0',feedgroupid:'' }
  1229. },
  1230. // 计划类型
  1231. changePlanList(item) {
  1232. console.log(item, '======')
  1233. this.create.temp.printgroup = this.planTypeList.find(obj => obj.value === item).label
  1234. },
  1235. // 饲料类型
  1236. changeFeedList(item) {
  1237. this.create.temp.fclass = this.feedTypeList.find(obj => obj.id === item).mixname
  1238. },
  1239. // 跳转延时
  1240. changeAutosecond(item) {
  1241. this.create.temp.autosecondname = this.jumpDelayList.find(obj => obj.value === item).label
  1242. },
  1243. // 确认开始
  1244. changeConfirmstart(item) {
  1245. this.create.temp.confirmstartname = this.confirmStartList.find(obj => obj.id === item).name
  1246. },
  1247. changeSmallMaterial(item) {
  1248. if (item !== '') {
  1249. this.create.temp.smtmrname = this.smallMaterialList.find(obj => obj.id === item).tname
  1250. } else {
  1251. this.create.temp.smtmrname = ''
  1252. }
  1253. },
  1254. // 新增
  1255. handleCreate() {
  1256. console.log('点击了新增')
  1257. this.resetTemp()
  1258. this.dialogFull = false
  1259. this.create.dialogStatus = 'create'
  1260. this.create.dialogFormVisible = true
  1261. },
  1262. createData() {
  1263. console.log('点击了新增保存')
  1264. this.isokDisable = true
  1265. setTimeout(() => {
  1266. this.isokDisable = false
  1267. }, 1000)
  1268. this.$refs['temp'].validate(valid => {
  1269. if (valid) {
  1270. const unitweight = /^[1-9]\d*$/
  1271. if (this.create.temp.unitweight !== '') {
  1272. if (!unitweight.test(parseFloat(this.create.temp.unitweight))) {
  1273. this.$message({ type: 'error', message: '包装单位重量请输入正整数', duration: 2000 })
  1274. return false
  1275. }
  1276. }
  1277. // const uprice = /^\d+(\.\d{1,2})?$/
  1278. const uprice = /^(\d+|\d+\.\d{1,2})$/
  1279. if (this.create.temp.uprice !== '') {
  1280. if (!uprice.test(parseFloat(this.create.temp.uprice))) {
  1281. this.$message({ type: 'error', message: '单价请保留两位小数', duration: 2000 })
  1282. return false
  1283. }
  1284. }
  1285. if (this.create.temp.autozone !== '') {
  1286. const autozone = /^([0-9]|(1[0-9]|2[0-9]|3[0-9]|4[0-9]|(50)))$/
  1287. if (!autozone.test(parseFloat(this.create.temp.autozone))) {
  1288. this.$message({ type: 'error', message: '跳转重量域请输入大于等于0小于等于50的整数', duration: 2000 })
  1289. return false
  1290. }
  1291. } else {
  1292. this.create.temp.autozone = '0'
  1293. }
  1294. if (this.create.temp.trgaddress.length > 8) {
  1295. this.$message({ type: 'error', message: '继电器位置请输入1-8位数字', duration: 2000 })
  1296. return false
  1297. }
  1298. const allowratio = /^[0-9]\d*$/
  1299. if (this.create.temp.allowratio !== '') {
  1300. if (!allowratio.test(parseFloat(this.create.temp.allowratio))) {
  1301. this.$message({ type: 'error', message: '允许误差数请输入大于等于0的整数', duration: 2000 })
  1302. return false
  1303. }
  1304. }
  1305. this.isokDisable = true
  1306. setTimeout(() => {
  1307. this.isokDisable = false
  1308. }, 1000)
  1309. this.requestParam.name = 'insertFeed'
  1310. this.requestParam.parammaps = this.create.temp
  1311. if (this.create.temp.allowratio == '') { this.create.temp.allowratio = '0' }
  1312. if (this.create.temp.uprice == '') { this.create.temp.uprice = '0' }
  1313. if (this.create.temp.unitweight == '') { this.create.temp.unitweight = '0' }
  1314. if (this.create.temp.autozone == '') { this.create.temp.autozone = '0' }
  1315. if (this.create.temp.trgaddress == '') { this.create.temp.trgaddress = '0' }
  1316. let url = 'authdata/feedbackup/check'
  1317. let data = {
  1318. fclassid:this.create.temp.fclassid,
  1319. backup1:this.create.temp.backup1
  1320. }
  1321. postJson(url,data).then(response => {
  1322. if(response.msg == 'fail'){
  1323. this.$notify({ title: this.$t('driver.saveFail'), message: response.data, type: 'warning', duration: 2000 })
  1324. if (this.create.temp.allowratio == '0') { this.create.temp.allowratio = '' }
  1325. if (this.create.temp.uprice == '0') { this.create.temp.uprice = '' }
  1326. if (this.create.temp.unitweight == '0') { this.create.temp.unitweight = '' }
  1327. if (this.create.temp.autozone == '0') { this.create.temp.autozone = '' }
  1328. if (this.create.temp.trgaddress == '0') { this.create.temp.trgaddress = '' }
  1329. }else{
  1330. PostDataByName(this.requestParam).then(response => {
  1331. console.log('新增保存发送参数', this.requestParam)
  1332. if (response.msg !== 'fail') {
  1333. this.$notify({ title: this.$t('common.succes'), message: this.$t('driver.saveSuccess'), type: 'success', duration: 2000 })
  1334. this.create.dialogFormVisible = false
  1335. this.getList()
  1336. } else {
  1337. this.$notify({ title: this.$t('driver.saveFail'), message: response.data, type: 'warning', duration: 2000 })
  1338. if (this.create.temp.allowratio == '0') { this.create.temp.allowratio = '' }
  1339. if (this.create.temp.uprice == '0') { this.create.temp.uprice = '' }
  1340. if (this.create.temp.unitweight == '0') { this.create.temp.unitweight = '' }
  1341. if (this.create.temp.autozone == '0') { this.create.temp.autozone = '' }
  1342. if (this.create.temp.trgaddress == '0') { this.create.temp.trgaddress = '' }
  1343. }
  1344. })
  1345. }
  1346. })
  1347. }
  1348. })
  1349. },
  1350. // 编辑
  1351. handleUpdate(row) {
  1352. console.log('点击了编辑', row)
  1353. this.create.dialogStatus = 'update'
  1354. this.dialogFull = false
  1355. this.create.dialogFormVisible = true
  1356. row.fclassid = String(row.fclassid)
  1357. row.printgroupid = String(row.printgroupid)
  1358. row.autosecond = String(row.autosecond)
  1359. row.confirmstart = String(row.confirmstart)
  1360. row.enable = String(row.enable)
  1361. row.jmp = String(row.jmp)
  1362. if (row.printgroupid !== '') {
  1363. row.printgroup = this.planTypeList.find(obj => obj.value == row.printgroupid).label
  1364. }
  1365. this.create.temp = Object.assign({}, row)
  1366. if (this.create.temp.allowratio == '0') { this.create.temp.allowratio = '' }
  1367. if (this.create.temp.uprice == '0.00') { this.create.temp.uprice = '' }
  1368. if (this.create.temp.unitweight == '0') { this.create.temp.unitweight = '' }
  1369. if (this.create.temp.autozone == '0') { this.create.temp.autozone = '' }
  1370. if (this.create.temp.trgaddress == '0') { this.create.temp.trgaddress = '' }
  1371. if (this.create.temp.smtmrid == '-1') { this.create.temp.smtmrid = '' }
  1372. console.log(this.create.temp, '=====123')
  1373. },
  1374. updateData() {
  1375. console.log('点击了编辑保存')
  1376. this.isokDisable = true
  1377. setTimeout(() => {
  1378. this.isokDisable = false
  1379. }, 1000)
  1380. this.$refs['temp'].validate(valid => {
  1381. if (valid) {
  1382. const unitweight = /^[1-9]\d*$/
  1383. if (this.create.temp.unitweight !== '') {
  1384. if (!unitweight.test(parseFloat(this.create.temp.unitweight))) {
  1385. this.$message({ type: 'error', message: '包装单位重量请输入正整数', duration: 2000 })
  1386. return false
  1387. }
  1388. }
  1389. // const uprice = /^\d+(\.\d{1,2})?$/
  1390. const uprice = /^(\d+|\d+\.\d{1,2})$/
  1391. if (this.create.temp.uprice !== '') {
  1392. if (!uprice.test(parseFloat(this.create.temp.uprice))) {
  1393. this.$message({ type: 'error', message: '单价请保留两位小数', duration: 2000 })
  1394. return false
  1395. }
  1396. }
  1397. if (this.create.temp.autozone !== '') {
  1398. const autozone = /^([0-9]|(1[0-9]|2[0-9]|3[0-9]|4[0-9]|(50)))$/
  1399. if (!autozone.test(parseFloat(this.create.temp.autozone))) {
  1400. this.$message({ type: 'error', message: '跳转重量域请输入大于等于0小于等于50的整数', duration: 2000 })
  1401. return false
  1402. }
  1403. } else {
  1404. this.create.temp.autozone = '0'
  1405. }
  1406. if (this.create.temp.trgaddress.length > 8) {
  1407. this.$message({ type: 'error', message: '继电器位置请输入1-8位数字', duration: 2000 })
  1408. return false
  1409. }
  1410. const allowratio = /^[0-9]\d*$/
  1411. if (this.create.temp.allowratio !== '') {
  1412. if (!allowratio.test(parseFloat(this.create.temp.allowratio))) {
  1413. this.$message({ type: 'error', message: '允许误差数请输入大于等于0的整数', duration: 2000 })
  1414. return false
  1415. }
  1416. }
  1417. this.isokDisable = true
  1418. setTimeout(() => {
  1419. this.isokDisable = false
  1420. }, 1000)
  1421. this.requestParam.name = 'updateFeed'
  1422. this.requestParam.parammaps = this.create.temp
  1423. if (this.create.temp.allowratio == '') { this.create.temp.allowratio = '0' }
  1424. if (this.create.temp.uprice == '') { this.create.temp.uprice = '0' }
  1425. if (this.create.temp.unitweight == '') { this.create.temp.unitweight = '0' }
  1426. if (this.create.temp.autozone == '') { this.create.temp.autozone = '0' }
  1427. if (this.create.temp.trgaddress == '') { this.create.temp.trgaddress = '0' }
  1428. let url = 'authdata/feedbackup/check'
  1429. let data = {
  1430. fclassid:this.create.temp.fclassid,
  1431. feedId:this.create.temp.id,
  1432. backup1:this.create.temp.backup1
  1433. }
  1434. postJson(url,data).then(response => {
  1435. if(response.msg == 'fail'){
  1436. this.$notify({ title: this.$t('driver.saveFail'), message: response.data, type: 'warning', duration: 2000 })
  1437. if (this.create.temp.allowratio == '0') { this.create.temp.allowratio = '' }
  1438. if (this.create.temp.uprice == '0') { this.create.temp.uprice = '' }
  1439. if (this.create.temp.unitweight == '0') { this.create.temp.unitweight = '' }
  1440. if (this.create.temp.autozone == '0') { this.create.temp.autozone = '' }
  1441. if (this.create.temp.trgaddress == '0') { this.create.temp.trgaddress = '' }
  1442. }else{
  1443. PostDataByName(this.requestParam).then(response => {
  1444. console.log('新增保存发送参数', this.requestParam)
  1445. if (response.msg !== 'fail') {
  1446. this.$notify({ title: this.$t('common.succes'), message: this.$t('driver.saveSuccess'), type: 'success', duration: 2000 })
  1447. this.create.dialogFormVisible = false
  1448. this.getList()
  1449. } else {
  1450. this.$notify({ title: this.$t('driver.saveFail'), message: response.data, type: 'warning', duration: 2000 })
  1451. if (this.create.temp.allowratio == '0') { this.create.temp.allowratio = '' }
  1452. if (this.create.temp.uprice == '0') { this.create.temp.uprice = '' }
  1453. if (this.create.temp.unitweight == '0') { this.create.temp.unitweight = '' }
  1454. if (this.create.temp.autozone == '0') { this.create.temp.autozone = '' }
  1455. if (this.create.temp.trgaddress == '0') { this.create.temp.trgaddress = '' }
  1456. }
  1457. })
  1458. }
  1459. })
  1460. }
  1461. })
  1462. },
  1463. // 饲料库
  1464. handleFeedBank() {
  1465. console.log('点击了饲料库')
  1466. this.dialogFull = false
  1467. this.feedBank.dialogStatus = 'feedBank'
  1468. this.feedBank.dialogFormVisible = true
  1469. this.getFeedBankList()
  1470. },
  1471. getFeedBankList() {
  1472. this.feedBank.listLoading = true
  1473. GetDataByName(this.feedBank.getdataListParm).then(response => {
  1474. console.log('table数据', response.data.list)
  1475. if (response.data.list !== null) {
  1476. this.feedBank.list = response.data.list
  1477. this.feedBank.pageNum = response.data.pageNum
  1478. this.feedBank.pageSize = response.data.pageSize
  1479. this.feedBank.total = response.data.total
  1480. } else {
  1481. this.feedBank.list = []
  1482. }
  1483. setTimeout(() => {
  1484. this.feedBank.listLoading = false
  1485. }, 100)
  1486. })
  1487. },
  1488. handleFeedBankSearch() {
  1489. console.log('点击了饲料库搜索')
  1490. this.getFeedBankList()
  1491. this.feedBank.getdataListParm.offset = 1
  1492. },
  1493. handleFeedBankRefresh() {
  1494. console.log('点击了饲料库重置')
  1495. this.feedBank.getdataListParm.parammaps.fname = ''
  1496. this.feedBank.getdataListParm.parammaps.statue = ''
  1497. this.getFeedBankList()
  1498. },
  1499. // 关联
  1500. handleRelation(row) {
  1501. console.log('点击了关联')
  1502. this.dialogFull = false
  1503. this.relation.dialogStatus = 'relation'
  1504. this.relation.dialogFormVisible = true
  1505. this.relation.temp = Object.assign({}, row)
  1506. this.relation.getdataListParm.parammaps.fid = this.relation.temp.id
  1507. this.getRelationList()
  1508. },
  1509. getRelationList() {
  1510. this.relation.listLoading = true
  1511. GetDataByName(this.relation.getdataListParm).then(response => {
  1512. console.log('table数据', response.data.list)
  1513. if (response.data.list !== null) {
  1514. this.relation.list = response.data.list
  1515. this.relation.pageNum = response.data.pageNum
  1516. this.relation.pageSize = response.data.pageSize
  1517. this.relation.total = response.data.total
  1518. } else {
  1519. this.relation.list = []
  1520. }
  1521. setTimeout(() => {
  1522. this.relation.listLoading = false
  1523. }, 100)
  1524. })
  1525. },
  1526. handleRelationSearch() {
  1527. console.log('点击了关联搜索')
  1528. this.relation.getdataListParm.offset = 1
  1529. this.getRelationList()
  1530. },
  1531. disassociateData(row) {
  1532. console.log('点击了取消关联')
  1533. MessageBox.confirm('是否确认取消关联?', {
  1534. confirmButtonText: this.$t('common.confirm'), confirmButtonText: this.$t('common.cancel'), type: 'warning'
  1535. }).then(() => {
  1536. this.isokDisable = true
  1537. setTimeout(() => {
  1538. this.isokDisable = false
  1539. }, 1000)
  1540. this.requestParam.name = 'updateFeedrelation'
  1541. this.requestParam.parammaps = {}
  1542. this.requestParam.parammaps.pastureid = this.relation.temp.pastureid
  1543. this.requestParam.parammaps.fid = this.relation.temp.id
  1544. this.requestParam.parammaps.id = row.id
  1545. PostDataByName(this.requestParam).then(response => {
  1546. console.log('取消关联保存发送参数', this.requestParam)
  1547. if (response.msg !== 'fail') {
  1548. this.$notify({ title: this.$t('common.succes'), message: this.$t('driver.saveSuccess'), type: 'success', duration: 2000 })
  1549. this.getRelationList()
  1550. this.getList()
  1551. } else {
  1552. this.$notify({ title: this.$t('driver.saveFail'), message: response.data, type: 'warning', duration: 2000 })
  1553. }
  1554. })
  1555. }).catch(() => {
  1556. this.$message({ type: 'info', message: '已取消' })
  1557. })
  1558. },
  1559. relationData(row) {
  1560. console.log('点击了关联保存')
  1561. MessageBox.confirm('是否确认关联?', {
  1562. confirmButtonText: this.$t('common.confirm'), confirmButtonText: this.$t('common.cancel'), type: 'warning'
  1563. }).then(() => {
  1564. this.isokDisable = true
  1565. setTimeout(() => {
  1566. this.isokDisable = false
  1567. }, 1000)
  1568. this.requestParam.name = 'insertFeednur'
  1569. this.requestParam.parammaps = {}
  1570. this.requestParam.parammaps.pastureid = this.relation.temp.pastureid
  1571. this.requestParam.parammaps.fid = this.relation.temp.id
  1572. this.requestParam.parammaps.fname = this.relation.temp.fname
  1573. this.requestParam.parammaps.feedcode = this.relation.temp.feedcode
  1574. this.requestParam.parammaps.price = row.price
  1575. this.requestParam.parammaps.remark = row.remark
  1576. this.requestParam.parammaps.dry = row.dry
  1577. this.requestParam.parammaps.starch = row.starch
  1578. this.requestParam.parammaps.cp = row.cp
  1579. this.requestParam.parammaps.ca = row.ca
  1580. this.requestParam.parammaps.p = row.p
  1581. this.requestParam.parammaps.n = row.n
  1582. this.requestParam.parammaps.fat = row.fat
  1583. this.requestParam.parammaps.adf = row.adf
  1584. this.requestParam.parammaps.ndf = row.ndf
  1585. this.requestParam.parammaps.ndip = row.ndip
  1586. this.requestParam.parammaps.ash = row.ash
  1587. this.requestParam.parammaps.fpercent = row.fpercent
  1588. this.requestParam.parammaps.iscu = row.iscu
  1589. this.requestParam.parammaps.feednurid = row.id
  1590. PostDataByName(this.requestParam).then(response => {
  1591. console.log('关联保存发送参数', this.requestParam)
  1592. if (response.msg !== 'fail') {
  1593. this.$notify({ title: this.$t('common.succes'), message: this.$t('driver.saveSuccess'), type: 'success', duration: 2000 })
  1594. this.getRelationList()
  1595. this.getList()
  1596. } else {
  1597. this.$notify({ title: this.$t('driver.saveFail'), message: response.data, type: 'warning', duration: 2000 })
  1598. }
  1599. })
  1600. }).catch(() => {
  1601. this.$message({ type: 'info', message: '已取消' })
  1602. })
  1603. },
  1604. // 营养价值
  1605. handleNutritive(row) {
  1606. console.log('点击了营养价值', row)
  1607. this.dialogFull = false
  1608. this.nutritive.dialogStatus = 'nutritive'
  1609. this.nutritive.dialogFormVisible = true
  1610. this.nutritive.temp = Object.assign({}, row)
  1611. },
  1612. nutritiveData() {
  1613. console.log('点击了营养价值保存')
  1614. this.isokDisable = true
  1615. setTimeout(() => {
  1616. this.isokDisable = false
  1617. }, 1000)
  1618. if (this.nutritive.temp.dry == undefined) { this.$set(this.nutritive.temp, 'dry', '') }
  1619. if (this.nutritive.temp.starch == undefined) { this.$set(this.nutritive.temp, 'starch', '') }
  1620. if (this.nutritive.temp.cp == undefined) { this.$set(this.nutritive.temp, 'cp', '') }
  1621. if (this.nutritive.temp.ca == undefined) { this.$set(this.nutritive.temp, 'ca', '') }
  1622. if (this.nutritive.temp.p == undefined) { this.$set(this.nutritive.temp, 'p', '') }
  1623. if (this.nutritive.temp.n == undefined) { this.$set(this.nutritive.temp, 'n', '') }
  1624. if (this.nutritive.temp.fat == undefined) { this.$set(this.nutritive.temp, 'fat', '') }
  1625. if (this.nutritive.temp.adf == undefined) { this.$set(this.nutritive.temp, 'adf', '') }
  1626. if (this.nutritive.temp.ndf == undefined) { this.$set(this.nutritive.temp, 'ndf', '') }
  1627. if (this.nutritive.temp.ndip == undefined) { this.$set(this.nutritive.temp, 'ndip', '') }
  1628. if (this.nutritive.temp.ash == undefined) { this.$set(this.nutritive.temp, 'ash', '') }
  1629. var positiveNumber = /^\d+(\.\d{1,2})?$/
  1630. if (this.nutritive.temp.dry !== '') {
  1631. if (!positiveNumber.test(parseFloat(this.nutritive.temp.dry))) {
  1632. this.$message({ type: 'error', message: '请输入自然数,最多保留俩位小数', duration: 2000 })
  1633. return false
  1634. }
  1635. }
  1636. console.log(this.nutritive.temp.starch)
  1637. if (this.nutritive.temp.starch !== '') {
  1638. if (!positiveNumber.test(parseFloat(this.nutritive.temp.starch))) {
  1639. this.$message({ type: 'error', message: '请输入自然数,最多保留俩位小数', duration: 2000 })
  1640. return false
  1641. }
  1642. }
  1643. if (this.nutritive.temp.cp !== '') {
  1644. if (!positiveNumber.test(parseFloat(this.nutritive.temp.cp))) {
  1645. this.$message({ type: 'error', message: '请输入自然数,最多保留俩位小数', duration: 2000 })
  1646. return false
  1647. }
  1648. }
  1649. if (this.nutritive.temp.ca !== '') {
  1650. if (!positiveNumber.test(parseFloat(this.nutritive.temp.ca))) {
  1651. this.$message({ type: 'error', message: '请输入自然数,最多保留俩位小数', duration: 2000 })
  1652. return false
  1653. }
  1654. }
  1655. if (this.nutritive.temp.p !== '') {
  1656. if (!positiveNumber.test(parseFloat(this.nutritive.temp.p))) {
  1657. this.$message({ type: 'error', message: '请输入自然数,最多保留俩位小数', duration: 2000 })
  1658. return false
  1659. }
  1660. }
  1661. if (this.nutritive.temp.n !== '') {
  1662. if (!positiveNumber.test(parseFloat(this.nutritive.temp.n))) {
  1663. this.$message({ type: 'error', message: '请输入自然数,最多保留俩位小数', duration: 2000 })
  1664. return false
  1665. }
  1666. }
  1667. if (this.nutritive.temp.fat !== '') {
  1668. if (!positiveNumber.test(parseFloat(this.nutritive.temp.fat))) {
  1669. this.$message({ type: 'error', message: '请输入自然数,最多保留俩位小数', duration: 2000 })
  1670. return false
  1671. }
  1672. }
  1673. if (this.nutritive.temp.adf !== '') {
  1674. if (!positiveNumber.test(parseFloat(this.nutritive.temp.adf))) {
  1675. this.$message({ type: 'error', message: '请输入自然数,最多保留俩位小数', duration: 2000 })
  1676. return false
  1677. }
  1678. }
  1679. if (this.nutritive.temp.ndf !== '') {
  1680. if (!positiveNumber.test(parseFloat(this.nutritive.temp.ndf))) {
  1681. this.$message({ type: 'error', message: '请输入自然数,最多保留俩位小数', duration: 2000 })
  1682. return false
  1683. }
  1684. }
  1685. if (this.nutritive.temp.ndip !== '') {
  1686. if (!positiveNumber.test(parseFloat(this.nutritive.temp.ndip))) {
  1687. this.$message({ type: 'error', message: '请输入自然数,最多保留俩位小数', duration: 2000 })
  1688. return false
  1689. }
  1690. }
  1691. if (this.nutritive.temp.ash !== '') {
  1692. if (!positiveNumber.test(parseFloat(this.nutritive.temp.ash))) {
  1693. this.$message({ type: 'error', message: '请输入自然数,最多保留俩位小数', duration: 2000 })
  1694. return false
  1695. }
  1696. }
  1697. this.requestParam.name = 'insertFeednur'
  1698. this.requestParam.parammaps = {}
  1699. this.requestParam.parammaps.pastureid = this.nutritive.temp.pastureid
  1700. this.requestParam.parammaps.fid = this.nutritive.temp.id
  1701. this.requestParam.parammaps.fname = this.nutritive.temp.fname
  1702. this.requestParam.parammaps.feedcode = this.nutritive.temp.feedcode
  1703. this.requestParam.parammaps.price = this.nutritive.temp.uprice
  1704. this.requestParam.parammaps.remark = this.nutritive.temp.remark
  1705. this.requestParam.parammaps.dry = this.nutritive.temp.dry
  1706. this.requestParam.parammaps.starch = this.nutritive.temp.starch
  1707. this.requestParam.parammaps.cp = this.nutritive.temp.cp
  1708. this.requestParam.parammaps.ca = this.nutritive.temp.ca
  1709. this.requestParam.parammaps.p = this.nutritive.temp.p
  1710. this.requestParam.parammaps.n = this.nutritive.temp.n
  1711. this.requestParam.parammaps.fat = this.nutritive.temp.fat
  1712. this.requestParam.parammaps.adf = this.nutritive.temp.adf
  1713. this.requestParam.parammaps.ndf = this.nutritive.temp.ndf
  1714. this.requestParam.parammaps.ndip = this.nutritive.temp.ndip
  1715. this.requestParam.parammaps.ash = this.nutritive.temp.ash
  1716. this.requestParam.parammaps.fpercent = this.nutritive.temp.fpercent
  1717. this.requestParam.parammaps.iscu = this.nutritive.temp.iscu
  1718. this.requestParam.parammaps.feednurid = '-1'
  1719. PostDataByName(this.requestParam).then(response => {
  1720. console.log('关联保存发送参数', this.requestParam)
  1721. if (response.msg !== 'fail') {
  1722. this.$notify({ title: this.$t('common.succes'), message: this.$t('driver.saveSuccess'), type: 'success', duration: 2000 })
  1723. this.getList()
  1724. this.nutritive.dialogFormVisible = false
  1725. } else {
  1726. this.$notify({ title: this.$t('driver.saveFail'), message: response.data, type: 'warning', duration: 2000 })
  1727. }
  1728. })
  1729. },
  1730. // 行内删除
  1731. handleRowDelete(row) {
  1732. console.log('点击了行内删除')
  1733. MessageBox.confirm( this.$t('common.delMsg'), {
  1734. confirmButtonText: this.$t('common.confirm'), confirmButtonText: this.$t('common.cancel'), type: 'warning'
  1735. }).then(() => {
  1736. this.selectList = []
  1737. this.requestParam = {}
  1738. this.requestParam.common = { 'returnmap': '0' }
  1739. this.requestParam.data = []
  1740. this.requestParam.data[0] = { 'name': 'checkDeleteFeed', 'type': 'v', 'parammaps': {
  1741. 'pastureid': row.pastureid,
  1742. 'id': row.id
  1743. }}
  1744. this.requestParam.data[1] = { 'name': 'deleteFeed', 'type': 'e', 'parammaps': {
  1745. 'pastureid': row.pastureid,
  1746. 'id': row.id
  1747. }}
  1748. ExecDataByConfig(this.requestParam).then(response => {
  1749. console.log('删除保存发送参数', this.requestParam)
  1750. if (response.msg === 'fail') {
  1751. this.$notify({ title: this.$t('common.delfail'), message: response.data, type: 'warning', duration: 2000 })
  1752. } else {
  1753. this.$notify({ title: '',message: this.$t('common.delSuccess'), type: 'success', duration: 2000 })
  1754. this.getList()
  1755. }
  1756. })
  1757. }).catch(() => {
  1758. this.$message({ type: 'info', message: this.$t('common.cancelMsg') })
  1759. })
  1760. },
  1761. handleSelectionChange(val) {
  1762. console.log('勾选数据', val)
  1763. this.selectList = val
  1764. },
  1765. // 多项删除
  1766. form_delete() {
  1767. console.log('点击了删除')
  1768. if (this.selectList.length == 0) {
  1769. this.$message({ type: 'error', message: '请选择饲料表信息', duration: 2000 })
  1770. } else {
  1771. MessageBox.confirm('当前选中' + this.selectList.length + '条信息,是否删除?', {
  1772. confirmButtonText: this.$t('common.confirm'), confirmButtonText: this.$t('common.cancel'), type: 'warning'
  1773. }).then(() => {
  1774. this.requestParam = {}
  1775. this.requestParam.common = { 'returnmap': '0' }
  1776. this.requestParam.data = []
  1777. this.requestParam.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.selectList }}
  1778. this.requestParam.data[0].children = []
  1779. this.requestParam.data[0].children[0] = { 'name': 'checkDeleteFeed', 'type': 'v', 'parammaps': {
  1780. id: '@insertSpotList.id',
  1781. pastureid: '@insertSpotList.pastureid'
  1782. }}
  1783. this.requestParam.data[0].children[1] = { 'name': 'deleteFeed', 'type': 'e', 'parammaps': {
  1784. id: '@insertSpotList.id',
  1785. pastureid: '@insertSpotList.pastureid'
  1786. }}
  1787. ExecDataByConfig(this.requestParam).then(response => {
  1788. console.log('删除保存发送参数', this.requestParam)
  1789. if (response.msg === 'fail') {
  1790. this.$notify({ title: this.$t('common.delfail'), message: response.data, type: 'warning', duration: 2000 })
  1791. } else {
  1792. this.$notify({ title: '',message: this.$t('common.delSuccess'), type: 'success', duration: 2000 })
  1793. this.getList()
  1794. }
  1795. })
  1796. })
  1797. }
  1798. },
  1799. handleChangeOrder() {
  1800. this.isOrder = false
  1801. this.rowDrop()
  1802. },
  1803. saveChangeOrder() {
  1804. // 保存顺序
  1805. var sortArr = []
  1806. for (let i = 0; i < this.table.list.length; i++) {
  1807. var obj = {}
  1808. obj.sort = i + 1
  1809. obj.id = this.table.list[i].id
  1810. obj.pastureid = this.table.list[i].pastureid
  1811. sortArr.push(obj)
  1812. }
  1813. this.requestParam = {}
  1814. this.requestParam.common = { 'returnmap': '0' }
  1815. this.requestParam.data = []
  1816. this.requestParam.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': sortArr }}
  1817. this.requestParam.data[0].children = []
  1818. this.requestParam.data[0].children[0] = { 'name': 'updateFeedSort', 'type': 'e', 'parammaps': {
  1819. id: '@insertSpotList.id',
  1820. pastureid: '@insertSpotList.pastureid',
  1821. sort: '@insertSpotList.sort'
  1822. }}
  1823. ExecDataByConfig(this.requestParam).then(response => {
  1824. console.log('顺序切换保存发送参数', this.requestParam)
  1825. if (response.msg === 'fail') {
  1826. this.$notify({ title: '顺序切换失败', message: response.data, type: 'warning', duration: 2000 })
  1827. } else {
  1828. this.$notify({ title: '', message: '顺序切换成功', type: 'success', duration: 2000 })
  1829. this.getList()
  1830. this.isOrder = true
  1831. }
  1832. })
  1833. },
  1834. cancelChangeOrder() {
  1835. // 取消顺序
  1836. this.getList()
  1837. this.isOrder = true
  1838. },
  1839. // 行拖拽
  1840. rowDrop() {
  1841. console.log(document.querySelector('#table .el-table__body-wrapper tbody'))
  1842. const tbody = document.querySelector('#table .el-table__body-wrapper tbody')
  1843. const that = this
  1844. var sortable = Sortable.create(tbody, {
  1845. disabled: that.dropState,
  1846. onChoose({ newIndex, oldIndex }) {
  1847. if (that.dropState == true) {
  1848. sortable.destroy()
  1849. }
  1850. },
  1851. onEnd({ newIndex, oldIndex }) {
  1852. const currRow = that.table.list.splice(oldIndex, 1)[0]
  1853. that.table.list.splice(newIndex, 0, currRow)
  1854. console.log('索引', newIndex)
  1855. console.log('拖动数据', currRow)
  1856. console.log('上', that.table.list[newIndex - 1])
  1857. console.log('下', that.table.list[newIndex + 1])
  1858. }
  1859. })
  1860. },
  1861. handleSet(){
  1862. if (this.selectList.length == 0) {
  1863. this.$message({ type: 'error', message: '请选择一条信息', duration: 2000 })
  1864. } else {
  1865. this.dialogFull = false
  1866. this.sapCode.dialogStatus = 'sapCode'
  1867. this.sapCode.dialogFormVisible = true
  1868. this.sapCode.table.getdataListParm.parammaps.MAKTX = this.selectList[0].sapCode
  1869. this.getsapCodeList()
  1870. }
  1871. },
  1872. getsapCodeList(){
  1873. GetDataByName(this.sapCode.table.getdataListParm).then(response => {
  1874. if (response.data.list !== null) {
  1875. this.sapCode.table.list = response.data.list
  1876. } else {
  1877. this.sapCode.table.list = []
  1878. }
  1879. this.$refs.saptable.reloadData(this.sapCode.table.list)
  1880. })
  1881. },
  1882. handleSapCodeSearch(){
  1883. this.getsapCodeList()
  1884. },
  1885. sapCodeData(){
  1886. if(this.sapCode.selectList.length>1 || this.sapCode.selectList.length == 0){
  1887. this.$message({ type: 'error', message: '请选择一条信息', duration: 2000 })
  1888. }else{
  1889. this.requestParam.name = 'updateFeedSapCode'
  1890. let data = {
  1891. name:'updateFeedSapCode',
  1892. parammaps:{
  1893. sapCode:this.sapCode.selectList[0].MATNR,
  1894. id:this.selectList[0].id
  1895. }
  1896. }
  1897. PostDataByName(data).then(response => {
  1898. console.log('新增保存发送参数', data)
  1899. if (response.msg !== 'fail') {
  1900. this.$notify({ title: this.$t('common.succes'), message: this.$t('driver.saveSuccess'), type: 'success', duration: 2000 })
  1901. this.sapCode.dialogFormVisible = false
  1902. this.getList()
  1903. } else {
  1904. this.$notify({ title: this.$t('driver.saveFail'), message: response.data, type: 'warning', duration: 2000 })
  1905. if (this.create.temp.allowratio == '0') { this.create.temp.allowratio = '' }
  1906. if (this.create.temp.uprice == '0') { this.create.temp.uprice = '' }
  1907. if (this.create.temp.unitweight == '0') { this.create.temp.unitweight = '' }
  1908. if (this.create.temp.autozone == '0') { this.create.temp.autozone = '' }
  1909. if (this.create.temp.trgaddress == '0') { this.create.temp.trgaddress = '' }
  1910. }
  1911. })
  1912. }
  1913. },
  1914. handleSapCodeSelectionChange(val){
  1915. this.sapCode.selectList = val
  1916. console.log(this.sapCode.selectList,'this.sapCode.selectList')
  1917. },
  1918. handleGetSapCode(){
  1919. this.dialogFull = false
  1920. this.sapCode2.dialogStatus = 'sapCode2'
  1921. this.sapCode2.dialogFormVisible = true
  1922. },
  1923. sapCodeData2(){
  1924. this.$refs['sapCode2'].validate(valid => {
  1925. if (valid) {
  1926. let url = 'authdata/sap/feed'
  1927. let data = {
  1928. startTime:parseTime(this.sapCode2.temp.inputDatetime[0],'{y}-{m}-{d}'),
  1929. endTime:parseTime(this.sapCode2.temp.inputDatetime[1],'{y}-{m}-{d}'),
  1930. mtart:this.sapCode2.temp.sapMaterialtype,
  1931. pastureId:Cookies.get('pastureid')
  1932. }
  1933. postJson(url,data).then(response => {
  1934. if (response.msg !== 'fail') {
  1935. this.$notify({ title: this.$t('common.succes'), message: this.$t('driver.saveSuccess'), type: 'success', duration: 2000 })
  1936. this.sapCode2.dialogFormVisible = false
  1937. this.getList()
  1938. } else {
  1939. this.$notify({ title: this.$t('driver.saveFail'), message: response.data, type: 'warning', duration: 2000 })
  1940. }
  1941. })
  1942. }
  1943. })
  1944. },
  1945. getIspalyUd(){
  1946. let url = 'authdata/GetDataByName'
  1947. let data = {
  1948. "name":"getSysoptEnable","page":1,"offset":1,"pagecount":1,"returntype":"Map",
  1949. "parammaps":{"pastureid":Cookies.get('pastureid'),"inforname":"gmUdSync"}
  1950. }
  1951. postJson(url,data).then(response => {
  1952. if (response.msg !== 'fail') {
  1953. if(response.data.list[0].inforvalue == 0){
  1954. this.ispalyUd = false
  1955. }else{
  1956. this.ispalyUd = true
  1957. }
  1958. } else {
  1959. this.$notify({ title: '请求失败', message: response.data, type: 'warning', duration: 2000 })
  1960. }
  1961. })
  1962. },
  1963. handleGetUd(){
  1964. MessageBox.confirm('是否获取UD饲料?', {
  1965. confirmButtonText: this.$t('common.confirm'), confirmButtonText: this.$t('common.cancel'), type: 'warning'
  1966. }).then(() => {
  1967. let url = 'authdata/gm/udfeed'
  1968. let data = {
  1969. pastureId:Cookies.get('pastureid')
  1970. }
  1971. postJson(url,data).then(response => {
  1972. if (response.msg !== 'fail') {
  1973. this.$notify({ title: this.$t('common.succes'), message: this.$t('driver.saveSuccess'), type: 'success', duration: 2000 })
  1974. this.getList()
  1975. } else {
  1976. this.$notify({ title: this.$t('driver.saveFail'), message: response.data, type: 'warning', duration: 2000 })
  1977. }
  1978. })
  1979. })
  1980. }
  1981. }
  1982. }
  1983. </script>
  1984. <style lang="scss" scoped>
  1985. .search{margin-top:10px;}
  1986. $width:350px;
  1987. $left:325px;
  1988. .selectInput{
  1989. position: relative;
  1990. display: inline-block;
  1991. .Input{width: $width;position: relative;}
  1992. .el-icon-arrow-down{width: 30px;height: 30px;position: absolute;left: $left;top:10px;color:#C0C4CC;}
  1993. .el-icon-arrow-up{width: 30px;height: 30px;position: absolute;left: $left;top:10px;color:#C0C4CC;}
  1994. .selectUl{
  1995. 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;
  1996. li{
  1997. 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;
  1998. a{float:left;width: 80px;}
  1999. a:hover{color: rgba(0, 204, 102, 0.71); font-weight: 700;}
  2000. }
  2001. }
  2002. }
  2003. </style>