index.vue 95 KB

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