index.vue 93 KB

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