index.vue 96 KB

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