index.vue 118 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810
  1. <template>
  2. <div class="app-container">
  3. <div class="search" ref="search">
  4. <el-input
  5. v-model="table.getdataListParm.parammaps.fname"
  6. placeholder="饲料名称"
  7. style="width: 130px"
  8. class="filter-item"
  9. clearable
  10. />
  11. <!-- <el-input v-model="table.getdataListParm.parammaps.feedcode" placeholder="饲料编码" style="width: 130px;" class="filter-item" clearable /> -->
  12. <el-select
  13. v-model="table.getdataListParm.parammaps.fclassid"
  14. filterable
  15. placeholder="饲料类别"
  16. class="filter-item"
  17. style="width: 150px"
  18. clearable
  19. >
  20. <el-option
  21. v-for="item in feedTypeList"
  22. :key="item.id"
  23. :label="item.mixname"
  24. :value="item.id"
  25. />
  26. </el-select>
  27. <el-select
  28. v-model="table.getdataListParm.parammaps.source"
  29. filterable
  30. placeholder="饲料来源"
  31. class="filter-item"
  32. style="width: 120px"
  33. clearable
  34. >
  35. <el-option
  36. v-for="item in feedSourcesList"
  37. :key="item.id"
  38. :label="item.name"
  39. :value="item.id"
  40. />
  41. </el-select>
  42. <el-select
  43. v-model="table.getdataListParm.parammaps.enable"
  44. filterable
  45. placeholder="是否启用"
  46. class="filter-item"
  47. style="width: 120px"
  48. clearable
  49. >
  50. <el-option
  51. v-for="item in enableList"
  52. :key="item.id"
  53. :label="item.name"
  54. :value="item.id"
  55. />
  56. </el-select>
  57. <div ref="selectInput" class="filter-item selectInput">
  58. <el-input
  59. type="text"
  60. name=""
  61. value=""
  62. placeholder="请点击选择搜索条件"
  63. class="Input"
  64. />
  65. <i
  66. v-if="arrowDown"
  67. icon="el-icon-arrow-down"
  68. class="el-icon-arrow-down"
  69. />
  70. <i v-if="arrowUp" icon="el-icon-arrow-up" class="el-icon-arrow-up" />
  71. <ul v-if="arrowUp" class="selectUl">
  72. <li>
  73. <a>允许误差数</a
  74. ><el-input
  75. v-model="table.getdataListParm.parammaps.allowratio"
  76. type="text"
  77. style="width: 245px"
  78. />
  79. </li>
  80. <li>
  81. <a>跳转重量域</a
  82. ><el-input
  83. v-model="table.getdataListParm.parammaps.autozone"
  84. type="text"
  85. style="width: 245px"
  86. />
  87. </li>
  88. <li>
  89. <a>跳转延时</a>
  90. <el-select
  91. v-model="table.getdataListParm.parammaps.autosecond"
  92. filterable
  93. placeholder="跳转延时"
  94. class="filter-item"
  95. style="width: 245px"
  96. clearable
  97. >
  98. <el-option
  99. v-for="item in jumpDelayList"
  100. :key="item.value"
  101. :label="item.label"
  102. :value="item.value"
  103. />
  104. </el-select>
  105. </li>
  106. <li>
  107. <div style="float: right">
  108. <el-button
  109. class="downminCancel"
  110. @click="
  111. arrowUp = false;
  112. arrowDown = true;
  113. "
  114. >取消</el-button
  115. >
  116. <el-button class="miniPrimary" @click="form_search"
  117. >搜索</el-button
  118. >
  119. </div>
  120. </li>
  121. </ul>
  122. </div>
  123. <el-button class="successBorder" @click="form_search">查询</el-button>
  124. <el-button class="successBorder" @click="handleRefresh">重置</el-button>
  125. </div>
  126. <div class="operation" ref="operation">
  127. <el-button
  128. v-if="isRoleEdit"
  129. class="success"
  130. icon="el-icon-plus"
  131. @click="handleCreate"
  132. >新增</el-button
  133. >
  134. <el-button
  135. v-if="isRoleEdit"
  136. class="success"
  137. icon="el-icon-plus"
  138. @click="handleSet"
  139. >设置</el-button
  140. >
  141. <el-button
  142. v-if="isRoleEdit && ispalyXdmy"
  143. class="success"
  144. icon="el-icon-plus"
  145. @click="handleGetSapCode"
  146. >获取SAP编码</el-button
  147. >
  148. <el-button
  149. v-if="isRoleEdit"
  150. class="danger"
  151. icon="el-icon-delete"
  152. @click="form_delete"
  153. >删除</el-button
  154. >
  155. <el-button
  156. class="success"
  157. icon="el-icon-receiving"
  158. @click="handleFeedBank"
  159. >饲料库</el-button
  160. >
  161. <el-button
  162. v-if="isOrder && isRoleEdit"
  163. icon="el-icon-sort"
  164. class="success"
  165. @click="handleChangeOrder"
  166. >更改顺序</el-button
  167. >
  168. <div v-else style="display: inline-block">
  169. <el-button
  170. v-if="isRoleEdit"
  171. icon="el-icon-folder-checked"
  172. class="success"
  173. @click="saveChangeOrder"
  174. >保存</el-button
  175. >
  176. <el-button
  177. v-if="isRoleEdit"
  178. icon="el-icon-close"
  179. class="sortCancel"
  180. @click="cancelChangeOrder"
  181. >取消</el-button
  182. >
  183. </div>
  184. <el-button
  185. v-if="isRoleEdit && ispalyUd"
  186. class="success"
  187. icon="el-icon-plus"
  188. @click="handleGetUd"
  189. >获取UD饲料</el-button
  190. >
  191. <el-button
  192. v-if="isRoleEdit && ispalyYmy"
  193. class="success"
  194. icon="el-icon-plus"
  195. @click="handleGetYmy"
  196. >获取饲料</el-button
  197. >
  198. <el-upload
  199. style="float: right"
  200. :headers="headers"
  201. :data="uploadData"
  202. :action="uploadExcelUrl"
  203. :show-file-list="false"
  204. :before-upload="beforeImport"
  205. :on-success="handleImportSuccess"
  206. >
  207. <el-button
  208. v-if="isRoleEdit"
  209. class="import"
  210. icon="el-icon-download"
  211. style="float: right"
  212. >导入</el-button
  213. >
  214. </el-upload>
  215. <el-dropdown style="float: right; margin-right: 10px">
  216. <el-button class="export" icon="el-icon-upload2">导出</el-button>
  217. <el-dropdown-menu slot="dropdown">
  218. <el-dropdown-item @click.native="handleExport(1)"
  219. >导出模板</el-dropdown-item
  220. >
  221. <el-dropdown-item @click.native="handleExport(2)"
  222. >导出数据</el-dropdown-item
  223. >
  224. </el-dropdown-menu>
  225. </el-dropdown>
  226. </div>
  227. <div class="table">
  228. <u-table
  229. id="table"
  230. ref="table"
  231. :key="table.tableKey"
  232. v-loading="table.listLoading"
  233. element-loading-text="给我一点时间"
  234. border
  235. fit
  236. highlight-current-row
  237. style="width: 100%"
  238. :row-style="rowStyle"
  239. :cell-style="cellStyle"
  240. class="elTable table-fixed"
  241. row-key="id"
  242. @selection-change="handleSelectionChange"
  243. :max-height="myHeight"
  244. use-virtual
  245. @table-body-scroll="tableScroll"
  246. :row-height="rowHeight"
  247. >
  248. <u-table-column
  249. type="selection"
  250. align="center"
  251. width="50"
  252. fixed="left"
  253. />
  254. <u-table-column
  255. label="序号"
  256. type="index"
  257. align="center"
  258. width="50"
  259. fixed="left"
  260. />
  261. <u-table-column
  262. label="饲料名称"
  263. min-width="80px"
  264. align="center"
  265. prop="fname"
  266. fixed="left"
  267. />
  268. <u-table-column
  269. label="饲料分类"
  270. min-width="80px"
  271. align="center"
  272. prop="fclass"
  273. fixed="left"
  274. />
  275. <u-table-column
  276. label="物料类型"
  277. min-width="90px"
  278. align="center"
  279. prop="sapMaterialtypeName"
  280. />
  281. <u-table-column
  282. label="SAP编码"
  283. min-width="90px"
  284. align="center"
  285. prop="sapCode"
  286. />
  287. <!-- <u-table-column label="SAP货位" min-width="90px" align="center" prop="goods" /> -->
  288. <u-table-column
  289. label="唯一编码"
  290. min-width="80px"
  291. align="center"
  292. prop="feedcode"
  293. />
  294. <u-table-column
  295. label="UD名称"
  296. min-width="80px"
  297. align="center"
  298. prop="udname"
  299. />
  300. <u-table-column
  301. label="饲料来源"
  302. min-width="80px"
  303. align="center"
  304. prop="source"
  305. />
  306. <u-table-column
  307. label="计划类型"
  308. min-width="80px"
  309. align="center"
  310. prop="printgroup"
  311. />
  312. <u-table-column
  313. v-if="isInforvalue"
  314. label="小料秤"
  315. min-width="90px"
  316. align="center"
  317. prop="smtmrname"
  318. />
  319. <u-table-column
  320. label="允许误差数(kg)"
  321. min-width="80px"
  322. align="center"
  323. prop="allowratio"
  324. />
  325. <u-table-column
  326. label="包装单位重量(kg)"
  327. min-width="80px"
  328. align="center"
  329. prop="unitweight"
  330. />
  331. <u-table-column
  332. label="单价"
  333. min-width="80px"
  334. align="center"
  335. prop="uprice"
  336. />
  337. <u-table-column
  338. label="跳转重量域(kg)"
  339. min-width="80px"
  340. align="center"
  341. prop="autozone"
  342. />
  343. <u-table-column
  344. label="跳转延时"
  345. min-width="80px"
  346. align="center"
  347. prop="autosecondname"
  348. />
  349. <u-table-column
  350. label="确认开始"
  351. min-width="80px"
  352. align="center"
  353. prop="confirmstartname"
  354. />
  355. <u-table-column
  356. label="继电器位置"
  357. min-width="80px"
  358. align="center"
  359. prop="trgaddress"
  360. />
  361. <u-table-column label="无上域" min-width="60px" align="center">
  362. <template slot-scope="scope">
  363. <span v-if="scope.row.jmp == 0">否</span>
  364. <span v-else>是</span>
  365. </template>
  366. </u-table-column>
  367. <u-table-column
  368. label="备用字段01"
  369. min-width="90px"
  370. align="center"
  371. prop="backup1"
  372. />
  373. <u-table-column
  374. label="备用字段02"
  375. min-width="90px"
  376. align="center"
  377. prop="backup2"
  378. />
  379. <u-table-column
  380. label="备用字段03"
  381. min-width="90px"
  382. align="center"
  383. prop="backup3"
  384. />
  385. <u-table-column label="是否启用" min-width="80px" align="center">
  386. <template slot-scope="scope">
  387. <el-switch
  388. v-model="scope.row.enable"
  389. disabled
  390. active-color="#13ce66"
  391. inactive-color="#ff4949"
  392. :active-value="1"
  393. :inactive-value="0"
  394. />
  395. </template>
  396. </u-table-column>
  397. <u-table-column
  398. label="操作"
  399. align="center"
  400. width="180"
  401. class-name="small-padding fixed-width"
  402. fixed="right"
  403. >
  404. <template slot-scope="{ row }">
  405. <a class="correcting" @click="handleNutritive(row)">营养价值</a>
  406. <span class="centerSpan">|</span>
  407. <a v-if="isRoleEdit" class="correcting" @click="handleRelation(row)"
  408. >关联</a
  409. >
  410. <span v-if="isRoleEdit" class="centerSpan">|</span>
  411. <el-button
  412. v-if="isRoleEdit"
  413. icon="el-icon-edit-outline"
  414. class="miniSuccess"
  415. @click="handleUpdate(row)"
  416. />
  417. <span v-if="isRoleEdit" class="centerSpan">|</span>
  418. <el-button
  419. v-if="isRoleEdit"
  420. icon="el-icon-delete"
  421. class="miniDanger"
  422. @click="handleRowDelete(row)"
  423. />
  424. </template>
  425. </u-table-column>
  426. </u-table>
  427. <!-- <pagination v-show="table.total>=0" :total="table.total" :page.sync="table.getdataListParm.offset" :limit.sync="table.getdataListParm.pagecount" @pagination="getList" /> -->
  428. <span
  429. v-if="table.listLoading == false"
  430. style="margin-right: 30px; margin-top: 10px; font-size: 14px"
  431. >共{{ table.total }}条</span
  432. >
  433. </div>
  434. <!-- 新增/编辑 -->
  435. <el-dialog
  436. :fullscreen="dialogFull"
  437. :visible.sync="create.dialogFormVisible"
  438. :close-on-click-modal="false"
  439. width="90%"
  440. >
  441. <template slot="title">
  442. <div class="avue-crud__dialog__header">
  443. <span class="el-dialog__title">
  444. <span
  445. style="
  446. display: inline-block;
  447. width: 3px;
  448. height: 20px;
  449. margin-right: 5px;
  450. float: left;
  451. margin-top: 2px;
  452. "
  453. />
  454. {{ textMap[create.dialogStatus] }}
  455. </span>
  456. <div
  457. class="avue-crud__dialog__menu"
  458. @click="dialogFull ? (dialogFull = false) : (dialogFull = true)"
  459. >
  460. <svg-icon v-if="dialogFull" icon-class="exit-fullscreen" />
  461. <svg-icon v-else icon-class="fullscreen" />
  462. </div>
  463. </div>
  464. </template>
  465. <div class="app-add">
  466. <el-form
  467. ref="temp"
  468. :rules="create.rules"
  469. :model="create.temp"
  470. label-position="right"
  471. label-width="155px"
  472. style="width: 100%; margin: 0 auto 50px"
  473. >
  474. <el-row>
  475. <el-col :span="24">
  476. <h3 style="width: 160px; text-align: right">基础信息</h3>
  477. </el-col>
  478. </el-row>
  479. <el-row>
  480. <el-col :span="6">
  481. <el-form-item label="饲料名称:" prop="fname">
  482. <el-input
  483. ref="fname"
  484. v-model="create.temp.fname"
  485. class="filter-item"
  486. placeholder="请输入饲料名称"
  487. type="textarea"
  488. :autosize="{ minRows: 1 }"
  489. maxlength="32"
  490. />
  491. </el-form-item>
  492. </el-col>
  493. <el-col :span="6">
  494. <el-form-item label="饲料类别:" prop="fclassid">
  495. <el-select
  496. v-model="create.temp.fclassid"
  497. filterable
  498. placeholder="饲料类别"
  499. class="filter-item"
  500. style="width: 100%"
  501. @change="changeFeedList"
  502. >
  503. <el-option
  504. v-for="item in feedTypeList"
  505. :key="item.id"
  506. :label="item.mixname"
  507. :value="item.id"
  508. />
  509. </el-select>
  510. </el-form-item>
  511. </el-col>
  512. <el-col :span="6">
  513. <el-form-item label="唯一编码:" prop="feedcode">
  514. <el-input
  515. ref="feedcode"
  516. v-model="create.temp.feedcode"
  517. class="filter-item"
  518. placeholder="请输入唯一编码"
  519. type="text"
  520. />
  521. </el-form-item>
  522. </el-col>
  523. <el-col :span="6">
  524. <el-form-item label="饲料来源:" prop="source">
  525. <el-input
  526. ref="source"
  527. v-model="create.temp.source"
  528. class="filter-item"
  529. disabled
  530. placeholder="用户自定义"
  531. type="text"
  532. />
  533. </el-form-item>
  534. </el-col>
  535. </el-row>
  536. <el-row>
  537. <el-col :span="6">
  538. <el-form-item label="计划类型:" prop="printgroupid">
  539. <el-select
  540. v-model="create.temp.printgroupid"
  541. filterable
  542. placeholder="计划类型"
  543. class="filter-item"
  544. style="width: 100%"
  545. @change="changePlanList"
  546. >
  547. <el-option
  548. v-for="item in planTypeList"
  549. :key="item.value"
  550. :label="item.label"
  551. :value="item.value"
  552. />
  553. </el-select>
  554. </el-form-item>
  555. </el-col>
  556. <el-col :span="6">
  557. <el-form-item label="包装单位重量(kg):" prop="unitweight">
  558. <el-input
  559. ref="unitweight"
  560. v-model="create.temp.unitweight"
  561. class="filter-item"
  562. placeholder="正整数"
  563. type="number"
  564. style="width: 100%"
  565. />
  566. </el-form-item>
  567. </el-col>
  568. <el-col :span="6">
  569. <el-form-item label="单价:" prop="uprice">
  570. <el-input
  571. ref="uprice"
  572. v-model="create.temp.uprice"
  573. class="filter-item"
  574. placeholder="最多俩位小数"
  575. type="number"
  576. step="0.01"
  577. style="width: 100%"
  578. />
  579. </el-form-item>
  580. </el-col>
  581. <!-- <el-form-item label="是否启用:" prop="enable">
  582. <el-select
  583. v-model="create.temp.enable"
  584. filterable
  585. placeholder="是否启用"
  586. class="filter-item"
  587. style="width: 100%"
  588. >
  589. <el-option
  590. v-for="item in enableList"
  591. :key="item.id"
  592. :label="item.name"
  593. :value="item.id"
  594. />
  595. </el-select>
  596. </el-form-item> -->
  597. <el-col :span="6">
  598. <el-form-item label="是否可被剩料替代" prop="is_replace">
  599. <el-select
  600. v-model="create.temp.is_replace"
  601. filterable
  602. placeholder="是否可被剩料替代"
  603. class="filter-item"
  604. style="width: 100%"
  605. >
  606. <el-option
  607. v-for="item in surplusList"
  608. :key="item.id"
  609. :label="item.name"
  610. :value="item.id"
  611. />
  612. </el-select>
  613. </el-form-item>
  614. </el-col>
  615. </el-row>
  616. <el-row>
  617. <el-col :span="6">
  618. <el-form-item label="物料类型:" prop="sapMaterialtype">
  619. <el-select
  620. v-model="create.temp.sapMaterialtype"
  621. filterable
  622. placeholder="物料类型"
  623. class="filter-item"
  624. style="width: 100%"
  625. >
  626. <el-option
  627. v-for="item in materialtypeList"
  628. :key="item.id"
  629. :label="item.distName"
  630. :value="item.distCode"
  631. />
  632. </el-select>
  633. </el-form-item>
  634. </el-col>
  635. <el-col :span="6">
  636. <el-form-item label="SAP货位:" prop="sapGoods">
  637. <el-select
  638. v-model="create.temp.sapGoods"
  639. filterable
  640. placeholder="SAP货位"
  641. class="filter-item"
  642. style="width: 100%"
  643. >
  644. <el-option
  645. v-for="item in sapGoodsList"
  646. :key="item.id"
  647. :label="item.distName"
  648. :value="item.distCode"
  649. />
  650. </el-select>
  651. </el-form-item>
  652. </el-col>
  653. <el-col :span="6">
  654. <el-form-item label="SAP编码:" prop="sapCode">
  655. <el-input
  656. ref="sapCode"
  657. v-model="create.temp.sapCode"
  658. class="filter-item"
  659. disabled
  660. placeholder="SAP编码"
  661. type="text"
  662. />
  663. <!-- <el-select v-model="create.temp.sapcode" filterable placeholder="SAP编码" class="filter-item" style="width: 100%;">
  664. <el-option v-for="item in sapCodeList" :key="item.id" :label="item.mixname" :value="item.id" />
  665. </el-select> -->
  666. </el-form-item>
  667. </el-col>
  668. </el-row>
  669. <el-row>
  670. <el-col :span="24">
  671. <h3 style="width: 160px; text-align: right">搅拌参数</h3>
  672. </el-col>
  673. </el-row>
  674. <el-row>
  675. <el-col :span="6">
  676. <el-form-item label="允许误差数(kg):" prop="allowratio">
  677. <el-input
  678. ref="allowratio"
  679. v-model="create.temp.allowratio"
  680. class="filter-item"
  681. placeholder="正整数"
  682. type="text"
  683. />
  684. </el-form-item>
  685. </el-col>
  686. <el-col :span="6">
  687. <el-form-item label="跳转重量域(kg):" prop="autozone">
  688. <el-input
  689. ref="autozone"
  690. v-model="create.temp.autozone"
  691. :disabled="create.temp.autosecond == '0'"
  692. class="filter-item"
  693. placeholder="0-50之间的整数"
  694. type="text"
  695. />
  696. </el-form-item>
  697. </el-col>
  698. <el-col :span="6">
  699. <el-form-item label="跳转延时:" prop="autosecond">
  700. <el-select
  701. v-model="create.temp.autosecond"
  702. filterable
  703. placeholder="跳转延时"
  704. class="filter-item"
  705. style="width: 100%"
  706. @change="changeAutosecond"
  707. >
  708. <el-option
  709. v-for="item in jumpDelayList"
  710. :key="item.value"
  711. :label="item.label"
  712. :value="item.value"
  713. />
  714. </el-select>
  715. </el-form-item>
  716. </el-col>
  717. <el-col :span="6">
  718. <el-form-item label="确认开始:" prop="confirmstart">
  719. <el-select
  720. v-model="create.temp.confirmstart"
  721. filterabler
  722. placeholde="确认开始"
  723. class="filter-item"
  724. style="width: 100%"
  725. @change="changeConfirmstart"
  726. >
  727. <el-option
  728. v-for="item in confirmStartList"
  729. :key="item.id"
  730. :label="item.name"
  731. :value="item.id"
  732. />
  733. </el-select>
  734. </el-form-item>
  735. </el-col>
  736. </el-row>
  737. <el-row>
  738. <el-col :span="6">
  739. <el-form-item label="是否启用:" prop="enable">
  740. <el-select
  741. v-model="create.temp.enable"
  742. filterable
  743. placeholder="是否启用"
  744. class="filter-item"
  745. style="width: 100%"
  746. >
  747. <el-option
  748. v-for="item in enableList"
  749. :key="item.id"
  750. :label="item.name"
  751. :value="item.id"
  752. />
  753. </el-select>
  754. </el-form-item>
  755. </el-col>
  756. <el-col :span="6">
  757. <el-form-item label="继电器位置:" prop="trgaddress">
  758. <el-input
  759. ref="trgaddress"
  760. v-model="create.temp.trgaddress"
  761. class="filter-item"
  762. placeholder="继电器位置"
  763. type="number"
  764. />
  765. </el-form-item>
  766. </el-col>
  767. <el-col v-if="isInforvalue" :span="6">
  768. <el-form-item label="小料秤:" prop="smtmrid">
  769. <el-select
  770. v-model="create.temp.smtmrid"
  771. filterable
  772. placeholder="小料秤"
  773. clearable
  774. class="filter-item"
  775. style="width: 100%"
  776. @change="changeSmallMaterial"
  777. >
  778. <el-option
  779. v-for="item in smallMaterialList"
  780. :key="item.id"
  781. :label="item.tname"
  782. :value="item.id"
  783. />
  784. </el-select>
  785. </el-form-item>
  786. </el-col>
  787. <el-col :span="6">
  788. <el-form-item label="无上域:" prop="jmp">
  789. <el-select
  790. v-model="create.temp.jmp"
  791. placeholder="无上域"
  792. class="filter-item"
  793. style="width: 100%"
  794. @change="changeSmallMaterial"
  795. >
  796. <el-option
  797. v-for="item in jmpList"
  798. :key="item.id"
  799. :label="item.name"
  800. :value="item.id"
  801. />
  802. </el-select>
  803. </el-form-item>
  804. </el-col>
  805. </el-row>
  806. <el-row>
  807. <h3 style="width: 160px; text-align: right">备用字段</h3>
  808. </el-row>
  809. <el-row>
  810. <!-- onkeyup="value=value.replace(/[^\x00-\xff]/g, '')" -->
  811. <el-col :span="6">
  812. <!-- onkeyup="value=value.replace(/[^\x00-\xff]/g, '')" -->
  813. <el-form-item label="备用字段01:" prop="backup1">
  814. <el-input
  815. ref="backup1"
  816. v-model="create.temp.backup1"
  817. class="filter-item"
  818. placeholder="备用字段01"
  819. type="text"
  820. />
  821. </el-form-item>
  822. </el-col>
  823. <el-col :span="6">
  824. <el-form-item label="备用字段02:" prop="backup2">
  825. <el-input
  826. ref="backup2"
  827. v-model="create.temp.backup2"
  828. class="filter-item"
  829. placeholder="备用字段02"
  830. type="text"
  831. />
  832. </el-form-item>
  833. </el-col>
  834. <el-col :span="6">
  835. <el-form-item label="备用字段03:" prop="backup3">
  836. <el-input
  837. ref="backup3"
  838. v-model="create.temp.backup3"
  839. class="filter-item"
  840. placeholder="备用字段03"
  841. type="text"
  842. />
  843. </el-form-item>
  844. </el-col>
  845. </el-row>
  846. </el-form>
  847. <div slot="footer" class="dialog-footer">
  848. <el-button
  849. class="cancelClose"
  850. @click="
  851. create.dialogFormVisible = false;
  852. getList();
  853. "
  854. >关闭</el-button
  855. >
  856. <el-button
  857. v-if="
  858. create.dialogStatus === 'create' ||
  859. create.dialogStatus === 'update'
  860. "
  861. class="save"
  862. :disabled="isokDisable"
  863. @click="
  864. create.dialogStatus === 'create' ? createData() : updateData()
  865. "
  866. >确认</el-button
  867. >
  868. </div>
  869. </div>
  870. </el-dialog>
  871. <!-- 饲料库 -->
  872. <el-dialog
  873. :fullscreen="dialogFull"
  874. :visible.sync="feedBank.dialogFormVisible"
  875. :close-on-click-modal="false"
  876. width="90%"
  877. >
  878. <template slot="title">
  879. <div class="avue-crud__dialog__header">
  880. <span class="el-dialog__title">
  881. <span
  882. style="
  883. display: inline-block;
  884. width: 3px;
  885. height: 20px;
  886. margin-right: 5px;
  887. float: left;
  888. margin-top: 2px;
  889. "
  890. />
  891. {{ textMap[feedBank.dialogStatus] }}
  892. </span>
  893. <div
  894. class="avue-crud__dialog__menu"
  895. @click="dialogFull ? (dialogFull = false) : (dialogFull = true)"
  896. >
  897. <svg-icon v-if="dialogFull" icon-class="exit-fullscreen" />
  898. <svg-icon v-else icon-class="fullscreen" />
  899. </div>
  900. </div>
  901. </template>
  902. <div class="app-add">
  903. <div class="search">
  904. <el-input
  905. v-model="feedBank.getdataListParm.parammaps.fname"
  906. placeholder="饲料名称"
  907. style="width: 130px"
  908. class="filter-item"
  909. clearable
  910. />
  911. <el-select
  912. v-model="feedBank.getdataListParm.parammaps.statue"
  913. filterabler
  914. placeholder="关联状态"
  915. class="filter-item"
  916. style="width: 120px"
  917. clearable
  918. >
  919. <el-option
  920. v-for="item in associationStatusList"
  921. :key="item.id"
  922. :label="item.name"
  923. :value="item.id"
  924. />
  925. </el-select>
  926. <el-button class="successBorder" @click="handleFeedBankSearch"
  927. >查询</el-button
  928. >
  929. <el-button class="successBorder" @click="handleFeedBankRefresh"
  930. >重置</el-button
  931. >
  932. </div>
  933. <div class="table">
  934. <el-table
  935. :key="feedBank.tableKey"
  936. v-loading="feedBank.listLoading"
  937. element-loading-text="给我一点时间"
  938. :data="feedBank.list"
  939. border
  940. fit
  941. highlight-current-row
  942. style="width: 100%; margin: 0 auto 50px"
  943. :row-style="rowStyle"
  944. :cell-style="cellStyle"
  945. class="elTable table-fixed"
  946. >
  947. <el-table-column
  948. label="序号"
  949. align="center"
  950. type="index"
  951. width="50px"
  952. />
  953. <el-table-column label="来源" min-width="50" align="center">
  954. <template slot-scope="scope">
  955. <span>{{ scope.row.sources }}</span>
  956. </template>
  957. </el-table-column>
  958. <el-table-column label="中国饲料号" min-width="70px" align="center">
  959. <template slot-scope="scope">
  960. <span>{{ scope.row.feedcode }}</span>
  961. </template>
  962. </el-table-column>
  963. <el-table-column label="饲料名称" min-width="80px" align="center">
  964. <template slot-scope="scope">
  965. <span>{{ scope.row.fname }}</span>
  966. </template>
  967. </el-table-column>
  968. <el-table-column label="价格" min-width="50px" align="center">
  969. <template slot-scope="scope">
  970. <span>{{ scope.row.price }}</span>
  971. </template>
  972. </el-table-column>
  973. <el-table-column label="样品说明" min-width="50px" align="center">
  974. <template slot-scope="scope">
  975. <span>{{ scope.row.remark }}</span>
  976. </template>
  977. </el-table-column>
  978. <el-table-column
  979. label="干物质(DM%)"
  980. min-width="65px"
  981. align="center"
  982. >
  983. <template slot-scope="scope">
  984. <span>{{ scope.row.dry }}</span>
  985. </template>
  986. </el-table-column>
  987. <el-table-column label="淀粉(%DM)" min-width="59px" align="center">
  988. <template slot-scope="scope">
  989. <span>{{ scope.row.starch }}</span>
  990. </template>
  991. </el-table-column>
  992. <el-table-column
  993. label="粗蛋白(CP%DM)"
  994. min-width="70px"
  995. align="center"
  996. >
  997. <template slot-scope="scope">
  998. <span>{{ scope.row.cp }}</span>
  999. </template>
  1000. </el-table-column>
  1001. <el-table-column label="钙(Ca%DM)" min-width="85px" align="center">
  1002. <template slot-scope="scope">
  1003. <span>{{ scope.row.ca }}</span>
  1004. </template>
  1005. </el-table-column>
  1006. <el-table-column label="磷(P%DM)" min-width="85px" align="center">
  1007. <template slot-scope="scope">
  1008. <span>{{ scope.row.p }}</span>
  1009. </template>
  1010. </el-table-column>
  1011. <el-table-column
  1012. label="产奶净能(%DM)"
  1013. min-width="75px"
  1014. align="center"
  1015. >
  1016. <template slot-scope="scope">
  1017. <span>{{ scope.row.n }}</span>
  1018. </template>
  1019. </el-table-column>
  1020. <el-table-column label="脂肪(%DM)" min-width="59px" align="center">
  1021. <template slot-scope="scope">
  1022. <span>{{ scope.row.fat }}</span>
  1023. </template>
  1024. </el-table-column>
  1025. <el-table-column label="ADF(%DM)" min-width="60px" align="center">
  1026. <template slot-scope="scope">
  1027. <span>{{ scope.row.adf }}</span>
  1028. </template>
  1029. </el-table-column>
  1030. <el-table-column label="NDF(%DM)" min-width="60px" align="center">
  1031. <template slot-scope="scope">
  1032. <span>{{ scope.row.ndf }}</span>
  1033. </template>
  1034. </el-table-column>
  1035. <el-table-column label="NDIP%" min-width="70px" align="center">
  1036. <template slot-scope="scope">
  1037. <span>{{ scope.row.ndip }}</span>
  1038. </template>
  1039. </el-table-column>
  1040. <el-table-column
  1041. label="粗灰分(Ash%)"
  1042. min-width="65px"
  1043. align="center"
  1044. >
  1045. <template slot-scope="scope">
  1046. <span>{{ scope.row.ash }}</span>
  1047. </template>
  1048. </el-table-column>
  1049. <el-table-column label="粗料" min-width="50px" align="center">
  1050. <template slot-scope="scope">
  1051. <span>{{ scope.row.iscu }}</span>
  1052. </template>
  1053. </el-table-column>
  1054. <el-table-column label="关联状态" min-width="50px" align="center">
  1055. <template slot-scope="scope">
  1056. <span v-if="scope.row.statue == 0">否</span>
  1057. <span v-if="scope.row.statue == 1">是</span>
  1058. </template>
  1059. </el-table-column>
  1060. </el-table>
  1061. </div>
  1062. <div slot="footer" class="dialog-footer">
  1063. <el-button
  1064. class="cancelClose cancelClose1"
  1065. @click="feedBank.dialogFormVisible = false"
  1066. >关闭</el-button
  1067. >
  1068. </div>
  1069. </div>
  1070. </el-dialog>
  1071. <!-- 关联 -->
  1072. <el-dialog
  1073. :fullscreen="dialogFull"
  1074. :visible.sync="relation.dialogFormVisible"
  1075. :close-on-click-modal="false"
  1076. width="90%"
  1077. >
  1078. <template slot="title">
  1079. <div class="avue-crud__dialog__header">
  1080. <span class="el-dialog__title">
  1081. <span
  1082. style="
  1083. display: inline-block;
  1084. width: 3px;
  1085. height: 20px;
  1086. margin-right: 5px;
  1087. float: left;
  1088. margin-top: 2px;
  1089. "
  1090. />
  1091. {{ textMap[relation.dialogStatus] }}
  1092. </span>
  1093. <div
  1094. class="avue-crud__dialog__menu"
  1095. @click="dialogFull ? (dialogFull = false) : (dialogFull = true)"
  1096. >
  1097. <svg-icon v-if="dialogFull" icon-class="exit-fullscreen" />
  1098. <svg-icon v-else icon-class="fullscreen" />
  1099. </div>
  1100. </div>
  1101. </template>
  1102. <div class="app-add">
  1103. <div class="search">
  1104. <el-input
  1105. v-model="relation.getdataListParm.parammaps.fname"
  1106. placeholder="饲料名称"
  1107. style="width: 130px"
  1108. class="filter-item"
  1109. clearable
  1110. />
  1111. <el-button class="successBorder" @click="handleRelationSearch"
  1112. >查询</el-button
  1113. >
  1114. </div>
  1115. <div class="table">
  1116. <el-table
  1117. :key="relation.tableKey"
  1118. v-loading="relation.listLoading"
  1119. element-loading-text="给我一点时间"
  1120. :data="relation.list"
  1121. border
  1122. fit
  1123. highlight-current-row
  1124. style="width: 100%; margin: 0 auto 50px"
  1125. :row-style="rowStyle"
  1126. :cell-style="cellStyle"
  1127. class="elTable table-fixed"
  1128. >
  1129. <el-table-column
  1130. label="序号"
  1131. align="center"
  1132. type="index"
  1133. width="50px"
  1134. />
  1135. <el-table-column label="来源" min-width="50" align="center">
  1136. <template slot-scope="scope">
  1137. <span>{{ scope.row.sources }}</span>
  1138. </template>
  1139. </el-table-column>
  1140. <el-table-column label="中国饲料号" min-width="80px" align="center">
  1141. <template slot-scope="scope">
  1142. <span>{{ scope.row.feedcode }}</span>
  1143. </template>
  1144. </el-table-column>
  1145. <el-table-column label="饲料名称" min-width="80px" align="center">
  1146. <template slot-scope="scope">
  1147. <span>{{ scope.row.fname }}</span>
  1148. </template>
  1149. </el-table-column>
  1150. <el-table-column label="价格" min-width="50px" align="center">
  1151. <template slot-scope="scope">
  1152. <span>{{ scope.row.price }}</span>
  1153. </template>
  1154. </el-table-column>
  1155. <el-table-column label="样品说明" min-width="50px" align="center">
  1156. <template slot-scope="scope">
  1157. <span>{{ scope.row.remark }}</span>
  1158. </template>
  1159. </el-table-column>
  1160. <el-table-column
  1161. label="干物质(DM%)"
  1162. min-width="65px"
  1163. align="center"
  1164. >
  1165. <template slot-scope="scope">
  1166. <span>{{ scope.row.dry }}</span>
  1167. </template>
  1168. </el-table-column>
  1169. <el-table-column label="淀粉(%DM)" min-width="59px" align="center">
  1170. <template slot-scope="scope">
  1171. <span>{{ scope.row.starch }}</span>
  1172. </template>
  1173. </el-table-column>
  1174. <el-table-column
  1175. label="粗蛋白(CP%DM)"
  1176. min-width="75px"
  1177. align="center"
  1178. >
  1179. <template slot-scope="scope">
  1180. <span>{{ scope.row.cp }}</span>
  1181. </template>
  1182. </el-table-column>
  1183. <el-table-column label="钙(Ca%DM)" min-width="83px" align="center">
  1184. <template slot-scope="scope">
  1185. <span>{{ scope.row.ca }}</span>
  1186. </template>
  1187. </el-table-column>
  1188. <el-table-column label="磷(P%DM)" min-width="80px" align="center">
  1189. <template slot-scope="scope">
  1190. <span>{{ scope.row.p }}</span>
  1191. </template>
  1192. </el-table-column>
  1193. <el-table-column
  1194. label="产奶净能(%DM)"
  1195. min-width="75px"
  1196. align="center"
  1197. >
  1198. <template slot-scope="scope">
  1199. <span>{{ scope.row.n }}</span>
  1200. </template>
  1201. </el-table-column>
  1202. <el-table-column label="脂肪(%DM)" min-width="59px" align="center">
  1203. <template slot-scope="scope">
  1204. <span>{{ scope.row.fat }}</span>
  1205. </template>
  1206. </el-table-column>
  1207. <el-table-column label="ADF(%DM)" min-width="60px" align="center">
  1208. <template slot-scope="scope">
  1209. <span>{{ scope.row.adf }}</span>
  1210. </template>
  1211. </el-table-column>
  1212. <el-table-column label="NDF(%DM)" min-width="60px" align="center">
  1213. <template slot-scope="scope">
  1214. <span>{{ scope.row.ndf }}</span>
  1215. </template>
  1216. </el-table-column>
  1217. <el-table-column label="NDIP%" min-width="70px" align="center">
  1218. <template slot-scope="scope">
  1219. <span>{{ scope.row.ndip }}</span>
  1220. </template>
  1221. </el-table-column>
  1222. <el-table-column
  1223. label="粗灰分(Ash%)"
  1224. min-width="65px"
  1225. align="center"
  1226. >
  1227. <template slot-scope="scope">
  1228. <span>{{ scope.row.ash }}</span>
  1229. </template>
  1230. </el-table-column>
  1231. <el-table-column label="粗料" min-width="50px" align="center">
  1232. <template slot-scope="scope">
  1233. <span>{{ scope.row.iscu }}</span>
  1234. </template>
  1235. </el-table-column>
  1236. <el-table-column
  1237. label="操作"
  1238. min-width="50px"
  1239. align="center"
  1240. class-name="small-padding fixed-width"
  1241. fixed="right"
  1242. >
  1243. <template slot-scope="{ row }">
  1244. <a
  1245. v-if="row.statueRelation == '1'"
  1246. class="correcting"
  1247. :disabled="isokDisable"
  1248. @click="disassociateData(row)"
  1249. >取消关联</a
  1250. >
  1251. <a
  1252. v-if="row.statueRelation == '0'"
  1253. class="correcting"
  1254. :disabled="isokDisable"
  1255. @click="relationData(row)"
  1256. >关联</a
  1257. >
  1258. </template>
  1259. </el-table-column>
  1260. </el-table>
  1261. </div>
  1262. <div slot="footer" class="dialog-footer">
  1263. <el-button
  1264. class="cancelClose cancelClose1"
  1265. @click="
  1266. relation.dialogFormVisible = false;
  1267. getList();
  1268. "
  1269. >关闭</el-button
  1270. >
  1271. </div>
  1272. </div>
  1273. </el-dialog>
  1274. <!-- 营养价值 -->
  1275. <el-dialog
  1276. :fullscreen="dialogFull"
  1277. :visible.sync="nutritive.dialogFormVisible"
  1278. :close-on-click-modal="false"
  1279. width="90%"
  1280. >
  1281. <template slot="title">
  1282. <div class="avue-crud__dialog__header">
  1283. <span class="el-dialog__title">
  1284. <span
  1285. style="
  1286. display: inline-block;
  1287. width: 3px;
  1288. height: 20px;
  1289. margin-right: 5px;
  1290. float: left;
  1291. margin-top: 2px;
  1292. "
  1293. />
  1294. {{ textMap[nutritive.dialogStatus] }}
  1295. </span>
  1296. <div
  1297. class="avue-crud__dialog__menu"
  1298. @click="dialogFull ? (dialogFull = false) : (dialogFull = true)"
  1299. >
  1300. <svg-icon v-if="dialogFull" icon-class="exit-fullscreen" />
  1301. <svg-icon v-else icon-class="fullscreen" />
  1302. </div>
  1303. </div>
  1304. </template>
  1305. <div class="app-add">
  1306. <el-form
  1307. ref="temp"
  1308. :rules="nutritive.rules"
  1309. :model="nutritive.temp"
  1310. label-position="right"
  1311. label-width="160px"
  1312. style="width: 100%; margin: 0 auto 50px"
  1313. >
  1314. <el-row>
  1315. <el-col :span="6">
  1316. <el-form-item label="干物质(DM%):" prop="dry">
  1317. <el-input
  1318. ref="dry"
  1319. v-model="nutritive.temp.dry"
  1320. :disabled="isRoleEdit == false"
  1321. class="filter-item"
  1322. placeholder="请输入干物质"
  1323. type="number"
  1324. step="0.01"
  1325. />
  1326. </el-form-item>
  1327. </el-col>
  1328. <el-col :span="6">
  1329. <el-form-item label="淀粉(%DM):" prop="starch">
  1330. <el-input
  1331. ref="starch"
  1332. v-model="nutritive.temp.starch"
  1333. :disabled="isRoleEdit == false"
  1334. class="filter-item"
  1335. placeholder="请输入淀粉"
  1336. type="number"
  1337. step="0.01"
  1338. />
  1339. </el-form-item>
  1340. </el-col>
  1341. <el-col :span="6">
  1342. <el-form-item label="粗蛋白(CP%DM):" prop="cp">
  1343. <el-input
  1344. ref="cp"
  1345. v-model="nutritive.temp.cp"
  1346. :disabled="isRoleEdit == false"
  1347. class="filter-item"
  1348. placeholder="请输入粗蛋白"
  1349. type="number"
  1350. step="0.01"
  1351. />
  1352. </el-form-item>
  1353. </el-col>
  1354. <el-col :span="6">
  1355. <el-form-item label="钙(Ca%DM):" prop="ca">
  1356. <el-input
  1357. ref="ca"
  1358. v-model="nutritive.temp.ca"
  1359. :disabled="isRoleEdit == false"
  1360. class="filter-item"
  1361. placeholder="请输入钙"
  1362. type="number"
  1363. step="0.01"
  1364. />
  1365. </el-form-item>
  1366. </el-col>
  1367. </el-row>
  1368. <el-row>
  1369. <el-col :span="6">
  1370. <el-form-item label="磷(P%DM):" prop="p">
  1371. <el-input
  1372. ref="p"
  1373. v-model="nutritive.temp.p"
  1374. :disabled="isRoleEdit == false"
  1375. class="filter-item"
  1376. placeholder="请输入磷"
  1377. type="number"
  1378. step="0.01"
  1379. />
  1380. </el-form-item>
  1381. </el-col>
  1382. <el-col :span="6">
  1383. <el-form-item label="产奶净能(%DM):" prop="n">
  1384. <el-input
  1385. ref="n"
  1386. v-model="nutritive.temp.n"
  1387. :disabled="isRoleEdit == false"
  1388. class="filter-item"
  1389. placeholder="请输入产奶净能"
  1390. type="number"
  1391. step="0.01"
  1392. />
  1393. </el-form-item>
  1394. </el-col>
  1395. <el-col :span="6">
  1396. <el-form-item label="脂肪(%DM):" prop="fat">
  1397. <el-input
  1398. ref="fat"
  1399. v-model="nutritive.temp.fat"
  1400. :disabled="isRoleEdit == false"
  1401. class="filter-item"
  1402. placeholder="请输入脂肪"
  1403. type="number"
  1404. step="0.01"
  1405. />
  1406. </el-form-item>
  1407. </el-col>
  1408. <el-col :span="6">
  1409. <el-form-item label="ADF(%DM):" prop="adf">
  1410. <el-input
  1411. ref="adf"
  1412. v-model="nutritive.temp.adf"
  1413. :disabled="isRoleEdit == false"
  1414. class="filter-item"
  1415. placeholder="请输入ADF"
  1416. type="number"
  1417. step="0.01"
  1418. />
  1419. </el-form-item>
  1420. </el-col>
  1421. </el-row>
  1422. <el-row>
  1423. <el-col :span="6">
  1424. <el-form-item label="NDF(%DM):" prop="ndf">
  1425. <el-input
  1426. ref="ndf"
  1427. v-model="nutritive.temp.ndf"
  1428. :disabled="isRoleEdit == false"
  1429. class="filter-item"
  1430. placeholder="请输入NDF"
  1431. type="number"
  1432. step="0.01"
  1433. />
  1434. </el-form-item>
  1435. </el-col>
  1436. <el-col :span="6">
  1437. <el-form-item label="NDIP(%):" prop="ndip">
  1438. <el-input
  1439. ref="ndip"
  1440. v-model="nutritive.temp.ndip"
  1441. :disabled="isRoleEdit == false"
  1442. class="filter-item"
  1443. placeholder="请输入NDIP"
  1444. type="number"
  1445. step="0.01"
  1446. />
  1447. </el-form-item>
  1448. </el-col>
  1449. <el-col :span="6">
  1450. <el-form-item label="粗灰分(Ash%):" prop="ash">
  1451. <el-input
  1452. ref="ash"
  1453. v-model="nutritive.temp.ash"
  1454. :disabled="isRoleEdit == false"
  1455. class="filter-item"
  1456. placeholder="请输入粗灰分"
  1457. type="number"
  1458. min="0.00"
  1459. step="0.01"
  1460. />
  1461. </el-form-item>
  1462. </el-col>
  1463. </el-row>
  1464. </el-form>
  1465. <div slot="footer" class="dialog-footer">
  1466. <el-button
  1467. class="cancelClose"
  1468. @click="
  1469. nutritive.dialogFormVisible = false;
  1470. getList();
  1471. "
  1472. >关闭</el-button
  1473. >
  1474. <el-button
  1475. v-if="nutritive.dialogStatus === 'nutritive' && isRoleEdit"
  1476. class="save"
  1477. :disabled="isokDisable"
  1478. @click="nutritiveData()"
  1479. >确认</el-button
  1480. >
  1481. </div>
  1482. </div>
  1483. </el-dialog>
  1484. <!-- 设置 -->
  1485. <el-dialog
  1486. :fullscreen="dialogFull"
  1487. :visible.sync="sapCode.dialogFormVisible"
  1488. :close-on-click-modal="false"
  1489. width="90%"
  1490. >
  1491. <template slot="title">
  1492. <div class="avue-crud__dialog__header">
  1493. <span class="el-dialog__title">
  1494. <span
  1495. style="
  1496. display: inline-block;
  1497. width: 3px;
  1498. height: 20px;
  1499. margin-right: 5px;
  1500. float: left;
  1501. margin-top: 2px;
  1502. "
  1503. />
  1504. {{ textMap[sapCode.dialogStatus] }}
  1505. </span>
  1506. <div
  1507. class="avue-crud__dialog__menu"
  1508. @click="dialogFull ? (dialogFull = false) : (dialogFull = true)"
  1509. >
  1510. <svg-icon v-if="dialogFull" icon-class="exit-fullscreen" />
  1511. <svg-icon v-else icon-class="fullscreen" />
  1512. </div>
  1513. </div>
  1514. </template>
  1515. <div class="app-add">
  1516. <div class="search" ref="search">
  1517. <el-input
  1518. v-model="sapCode.table.getdataListParm.parammaps.MAKTX"
  1519. placeholder="原料名称"
  1520. style="width: 130px"
  1521. class="filter-item"
  1522. clearable
  1523. />
  1524. <el-button class="successBorder" @click="handleSapCodeSearch"
  1525. >查询</el-button
  1526. >
  1527. </div>
  1528. <div class="table">
  1529. <u-table
  1530. id="saptable"
  1531. ref="saptable"
  1532. :key="sapCode.table.tableKey"
  1533. v-loading="sapCode.table.listLoading"
  1534. element-loading-text="给我一点时间"
  1535. border
  1536. fit
  1537. highlight-current-row
  1538. style="width: 100%"
  1539. :row-style="rowStyle"
  1540. :cell-style="cellStyle"
  1541. class="elTable table-fixed"
  1542. row-key="id"
  1543. @selection-change="handleSapCodeSelectionChange"
  1544. :max-height="myHeight"
  1545. use-virtual
  1546. @table-body-scroll="tableScroll"
  1547. :row-height="rowHeight"
  1548. >
  1549. <u-table-column type="selection" align="center" width="50" />
  1550. <u-table-column
  1551. label="物料号"
  1552. min-width="80px"
  1553. align="center"
  1554. prop="MATNR"
  1555. />
  1556. <u-table-column
  1557. label="物料类型"
  1558. min-width="90px"
  1559. align="center"
  1560. prop="MTART"
  1561. />
  1562. <u-table-column
  1563. label="物料组"
  1564. min-width="80px"
  1565. align="center"
  1566. prop="MATKL"
  1567. />
  1568. <u-table-column
  1569. label="物料描述"
  1570. min-width="90px"
  1571. align="center"
  1572. prop="MAKTX"
  1573. />
  1574. <u-table-column
  1575. label="最后修改日期"
  1576. min-width="80px"
  1577. align="center"
  1578. prop="LAEDA"
  1579. />
  1580. </u-table>
  1581. </div>
  1582. <div slot="footer" class="dialog-footer">
  1583. <el-button
  1584. class="cancelClose"
  1585. @click="
  1586. sapCode.dialogFormVisible = false;
  1587. getList();
  1588. "
  1589. >关闭</el-button
  1590. >
  1591. <el-button
  1592. v-if="sapCode.dialogStatus === 'sapCode' && isRoleEdit"
  1593. class="save"
  1594. :disabled="isokDisable"
  1595. @click="sapCodeData()"
  1596. >确认</el-button
  1597. >
  1598. </div>
  1599. </div>
  1600. </el-dialog>
  1601. <!-- 获取SAP编码 -->
  1602. <el-dialog
  1603. :fullscreen="dialogFull"
  1604. :visible.sync="sapCode2.dialogFormVisible"
  1605. :close-on-click-modal="false"
  1606. width="50%"
  1607. >
  1608. <template slot="title">
  1609. <div class="avue-crud__dialog__header">
  1610. <span class="el-dialog__title">
  1611. <span
  1612. style="
  1613. display: inline-block;
  1614. width: 3px;
  1615. height: 20px;
  1616. margin-right: 5px;
  1617. float: left;
  1618. margin-top: 2px;
  1619. "
  1620. />
  1621. {{ textMap[sapCode2.dialogStatus] }}
  1622. </span>
  1623. <div
  1624. class="avue-crud__dialog__menu"
  1625. @click="dialogFull ? (dialogFull = false) : (dialogFull = true)"
  1626. >
  1627. <svg-icon v-if="dialogFull" icon-class="exit-fullscreen" />
  1628. <svg-icon v-else icon-class="fullscreen" />
  1629. </div>
  1630. </div>
  1631. </template>
  1632. <div class="app-add">
  1633. <el-form
  1634. ref="sapCode2"
  1635. :rules="sapCode2.rules"
  1636. :model="sapCode2.temp"
  1637. label-position="right"
  1638. label-width="155px"
  1639. style="width: 100%; margin: 0 auto 50px"
  1640. >
  1641. <el-row>
  1642. <el-col :span="18">
  1643. <el-form-item label="时间范围:" prop="inputDatetime">
  1644. <el-date-picker
  1645. v-model="sapCode2.temp.inputDatetime"
  1646. class="inputDatetime filter-item"
  1647. type="daterange"
  1648. range-separator="至"
  1649. start-placeholder="开始日期"
  1650. end-placeholder="结束日期"
  1651. style="width: 100%"
  1652. :clearable="false"
  1653. />
  1654. </el-form-item>
  1655. </el-col>
  1656. </el-row>
  1657. <el-row>
  1658. <el-col :span="18">
  1659. <el-form-item label="物料类型:" prop="sapMaterialtype">
  1660. <el-select
  1661. v-model="sapCode2.temp.sapMaterialtype"
  1662. filterable
  1663. placeholder="物料类型"
  1664. class="filter-item"
  1665. style="width: 100%"
  1666. >
  1667. <el-option
  1668. v-for="item in materialtypeList"
  1669. :key="item.id"
  1670. :label="item.distName"
  1671. :value="item.distCode"
  1672. />
  1673. </el-select>
  1674. </el-form-item>
  1675. </el-col>
  1676. </el-row>
  1677. </el-form>
  1678. <div slot="footer" class="dialog-footer">
  1679. <el-button
  1680. class="cancelClose"
  1681. @click="
  1682. sapCode2.dialogFormVisible = false;
  1683. getList();
  1684. "
  1685. >关闭</el-button
  1686. >
  1687. <el-button
  1688. v-if="sapCode2.dialogStatus === 'sapCode2' && isRoleEdit"
  1689. class="save"
  1690. :disabled="isokDisable"
  1691. @click="sapCodeData2()"
  1692. >确认</el-button
  1693. >
  1694. </div>
  1695. </div>
  1696. </el-dialog>
  1697. </div>
  1698. </template>
  1699. <script>
  1700. import {
  1701. GetDataByName,
  1702. PostDataByName,
  1703. failproccess,
  1704. ExecDataByConfig,
  1705. GetDataByNames,
  1706. checkButtons,
  1707. postJson,
  1708. } from "@/api/common";
  1709. import Cookies from "js-cookie";
  1710. import Sortable from "sortablejs";
  1711. import Pagination from "@/components/Pagination";
  1712. import axios from "axios";
  1713. import { getToken } from "@/utils/auth";
  1714. import {
  1715. parseTime,
  1716. json2excel,
  1717. handleTableSpan,
  1718. handleObjectSpanMethod,
  1719. } from "@/utils/index.js";
  1720. import { MessageBox } from "element-ui";
  1721. export default {
  1722. name: "FeedTable",
  1723. components: { Pagination },
  1724. directives: {
  1725. limit: {
  1726. // 指令的定义
  1727. update: function (el) {
  1728. el.onkeypress = function (e) {
  1729. var code = e.charCode;
  1730. if (code != 0) {
  1731. if (!String.fromCharCode(code).match(/[0-9\.]/)) {
  1732. return false;
  1733. }
  1734. }
  1735. };
  1736. el.addEventListener("textInput", function (e) {
  1737. e.target.value = e.target.value.replace(/[^0-9\.]/g, "");
  1738. });
  1739. el.onkeyup = function (e) {
  1740. e.target.value = e.target.value.replace(/[^0-9\.]/g, "");
  1741. };
  1742. },
  1743. },
  1744. },
  1745. data() {
  1746. return {
  1747. rowHeight: 30,
  1748. dialogFull: false,
  1749. isInforvalue: false,
  1750. isRoleEdit: [],
  1751. download: {
  1752. getdataListParm: {
  1753. name: "getFeedList",
  1754. page: 1,
  1755. offset: 1,
  1756. pagecount: 0,
  1757. returntype: "Map",
  1758. parammaps: {
  1759. pastureid: Cookies.get("pastureid"),
  1760. fname: "",
  1761. fclassid: "",
  1762. source: "",
  1763. autozone: "",
  1764. autosecond: "",
  1765. allowratio: "",
  1766. printgroup: "",
  1767. enable: "",
  1768. },
  1769. },
  1770. list: [],
  1771. },
  1772. requestParams: [
  1773. {
  1774. name: "getDictByName",
  1775. offset: 0,
  1776. pagecount: 0,
  1777. params: ["跳转延时"],
  1778. },
  1779. {
  1780. name: "getFeedclassByBig",
  1781. offset: 0,
  1782. pagecount: 0,
  1783. parammaps: { pastureid: Cookies.get("pastureid") },
  1784. },
  1785. {
  1786. name: "getDictByName2",
  1787. offset: 0,
  1788. pagecount: 0,
  1789. params: ["计划类型"],
  1790. },
  1791. {
  1792. name: "getTMRListEnableTypeFeed",
  1793. offset: 0,
  1794. pagecount: 0,
  1795. parammaps: { pastureid: Cookies.get("pastureid"), eqtype: "4" },
  1796. },
  1797. { name: "getDistMateriel", offset: 0, pagecount: 0, params: [] },
  1798. { name: "getDistGoods", offset: 0, pagecount: 0, params: [] },
  1799. ],
  1800. requestParams2: {
  1801. name: "getSysoptEnable",
  1802. offset: 0,
  1803. parammaps: {
  1804. pastureid: Cookies.get("pastureid"),
  1805. inforname: "isSmallMaterial",
  1806. },
  1807. },
  1808. enableList: [
  1809. { id: "1", name: "是" },
  1810. { id: "0", name: "否" },
  1811. ], // 是否启用
  1812. surplusList: [
  1813. { id: 1, name: "是" },
  1814. { id: 0, name: "否" },
  1815. ],
  1816. feedSourcesList: [
  1817. { id: "0", name: "系统内置" },
  1818. { id: "1", name: "用户自定义" },
  1819. ], // 饲料来源
  1820. confirmStartList: [
  1821. { id: "0", name: "禁用" },
  1822. { id: "1", name: "启用" },
  1823. ], // 确认开始
  1824. associationStatusList: [
  1825. { id: "1", name: "是" },
  1826. { id: "0", name: "否" },
  1827. ], // 关联状态
  1828. jumpDelayList: [], // 跳转延时
  1829. feedTypeList: [], // 饲料分类
  1830. planTypeList: [], // 计划类型
  1831. smallMaterialList: [], // 小料秤
  1832. jmpList: [
  1833. { id: "0", name: "否" },
  1834. { id: "1", name: "是" },
  1835. ], // 无上域
  1836. materialtypeList: [], //物料类型
  1837. sapGoodsList: [], //sap货位
  1838. sapCodeList: [], //sap编码
  1839. table: {
  1840. tableKey: 0,
  1841. list: [],
  1842. total: 0,
  1843. listLoading: true,
  1844. getdataListParm: {
  1845. name: "getFeedList",
  1846. page: 1,
  1847. offset: 1,
  1848. pagecount: "",
  1849. returntype: "Map",
  1850. parammaps: {
  1851. pastureid: Cookies.get("pastureid"),
  1852. fname: "",
  1853. fclassid: "",
  1854. source: "",
  1855. autozone: "",
  1856. autosecond: "",
  1857. allowratio: "",
  1858. printgroup: "",
  1859. enable: "",
  1860. },
  1861. },
  1862. },
  1863. // 多项搜索显示隐藏
  1864. arrowDown: true,
  1865. arrowUp: false,
  1866. // 新增/编辑
  1867. create: {
  1868. dialogFormVisible: false,
  1869. dialogStatus: "",
  1870. temp: {
  1871. pastureid: Cookies.get("pastureid"),
  1872. fname: "",
  1873. fclassid: "",
  1874. fclass: "",
  1875. feedcode: "",
  1876. source: "用户自定义",
  1877. printgroupid: "1",
  1878. printgroup: "无",
  1879. unitweight: "",
  1880. uprice: "",
  1881. allowratio: "",
  1882. autozone: "",
  1883. autosecond: "0",
  1884. autosecondname: "禁用",
  1885. confirmstart: "0",
  1886. confirmstartname: "禁用",
  1887. enable: "1",
  1888. is_replace: 0,
  1889. trgaddress: "",
  1890. backup1: "",
  1891. backup2: "",
  1892. backup3: "",
  1893. feedgroupid: "",
  1894. sapMaterialtype: "",
  1895. sapGoods: "",
  1896. sapCode: "",
  1897. },
  1898. rules: {
  1899. printgroupid: [
  1900. {
  1901. type: "string",
  1902. required: true,
  1903. message: "必填",
  1904. trigger: "blur",
  1905. },
  1906. ],
  1907. fname: [
  1908. {
  1909. type: "string",
  1910. required: true,
  1911. message: "必填",
  1912. trigger: "blur",
  1913. },
  1914. ],
  1915. fclassid: [
  1916. {
  1917. type: "string",
  1918. required: true,
  1919. message: "必填",
  1920. trigger: "blur",
  1921. },
  1922. ],
  1923. feedcode: [
  1924. {
  1925. type: "string",
  1926. required: true,
  1927. message: "必填",
  1928. trigger: "blur",
  1929. },
  1930. ],
  1931. },
  1932. },
  1933. // 饲料库
  1934. feedBank: {
  1935. dialogFormVisible: false,
  1936. dialogStatus: "",
  1937. temp: {},
  1938. rules: {},
  1939. tableKey: 0,
  1940. list: [],
  1941. total: 0,
  1942. listLoading: true,
  1943. getdataListParm: {
  1944. name: "getFeednurList",
  1945. page: 1,
  1946. offset: 1,
  1947. returntype: "Map",
  1948. parammaps: {
  1949. pastureid: Cookies.get("pastureid"),
  1950. fname: "",
  1951. statue: "",
  1952. },
  1953. },
  1954. },
  1955. // 关联
  1956. relation: {
  1957. dialogFormVisible: false,
  1958. dialogStatus: "",
  1959. temp: {},
  1960. rules: {},
  1961. tableKey: 0,
  1962. list: [],
  1963. total: 0,
  1964. listLoading: true,
  1965. getdataListParm: {
  1966. name: "getFeednurRelation",
  1967. page: 1,
  1968. offset: 1,
  1969. returntype: "Map",
  1970. parammaps: {
  1971. pastureid: Cookies.get("pastureid"),
  1972. fname: "",
  1973. },
  1974. },
  1975. },
  1976. // 营养价值
  1977. nutritive: {
  1978. dialogFormVisible: false,
  1979. dialogStatus: "",
  1980. temp: {},
  1981. rules: {},
  1982. },
  1983. sapCode: {
  1984. dialogFormVisible: false,
  1985. dialogStatus: "",
  1986. selectList: [],
  1987. table: {
  1988. tableKey: 0,
  1989. list: [],
  1990. total: 0,
  1991. listLoading: false,
  1992. getdataListParm: {
  1993. name: "getFeedSap",
  1994. page: 1,
  1995. offset: 1,
  1996. pagecount: "",
  1997. returntype: "Map",
  1998. parammaps: {
  1999. MAKTX: "",
  2000. },
  2001. },
  2002. },
  2003. },
  2004. sapCode2: {
  2005. dialogFormVisible: false,
  2006. dialogStatus: "",
  2007. materialtypeList: [],
  2008. temp: {
  2009. inputDatetime: [
  2010. parseTime(new Date(), "{y}-{m}-{d}"),
  2011. parseTime(new Date(), "{y}-{m}-{d}"),
  2012. ],
  2013. sapMaterialtype: "",
  2014. },
  2015. rules: {
  2016. inputDatetime: [{ required: true, message: "必填", trigger: "blur" }],
  2017. sapMaterialtype: [
  2018. { required: true, message: "必填", trigger: "blur" },
  2019. ],
  2020. },
  2021. },
  2022. textMap: {
  2023. create: "新增",
  2024. update: "编辑",
  2025. feedBank: "饲料库",
  2026. relation: "关联",
  2027. nutritive: "营养价值",
  2028. sapCode: "设置",
  2029. sapCode2: "获取SAP编码",
  2030. },
  2031. isokDisable: false,
  2032. selectList: [],
  2033. requestParam: {},
  2034. rowStyle: { maxHeight: 30 + "px", height: 30 + "px" },
  2035. cellStyle: { padding: 0 + "px" },
  2036. dropState: false,
  2037. isOrder: true,
  2038. ispalyUd: true,
  2039. ispalyXdmy: true,
  2040. myHeight: document.documentElement.clientHeight - 85 - 150,
  2041. };
  2042. },
  2043. computed: {
  2044. // 设置请求头
  2045. headers() {
  2046. return {
  2047. token: getToken(),
  2048. };
  2049. },
  2050. uploadData() {
  2051. return {
  2052. name: "checkFeedName,checkProjectType, checkFeedCode, checkFeedType, importFeed,updateFeedSortByCode",
  2053. importParams:
  2054. "饲料名称,饲料类别,唯一编码,计划类型,包装单位重量,单价,允许误差数,跳转延时,确认开始,是否启用,继电器位置,无上域",
  2055. sheetname: "Sheet1",
  2056. // 登录牧场
  2057. pastureid: Cookies.get("pastureid"),
  2058. // 日期参数
  2059. dateParams: "",
  2060. // 必填参数
  2061. requiredParams: "饲料名称,饲料分类",
  2062. // 为数值的参数
  2063. numParams: "",
  2064. };
  2065. },
  2066. // 设置上传地址
  2067. uploadExcelUrl() {
  2068. return Cookies.get("url") + "authdata/ImportExcel";
  2069. },
  2070. },
  2071. mounted() {
  2072. document.addEventListener("click", (e) => {
  2073. if (this.$refs.selectInput !== undefined) {
  2074. if (!this.$refs.selectInput.contains(e.target)) {
  2075. this.arrowDown = true;
  2076. this.arrowUp = false;
  2077. } else {
  2078. this.arrowDown = false;
  2079. this.arrowUp = true;
  2080. }
  2081. }
  2082. });
  2083. },
  2084. created() {
  2085. this.getIspalyUd();
  2086. this.getIspalyXdmy();
  2087. this.getIspalyYmy();
  2088. this.getList();
  2089. this.getDownList();
  2090. this.getButtons();
  2091. this.getInforvalueList();
  2092. },
  2093. methods: {
  2094. beforeImport(file) {
  2095. const isLt2M = file.size / 1024 / 1024 < 2;
  2096. if (!isLt2M) {
  2097. this.$message.error("上传文件大小不能超过 2MB!");
  2098. }
  2099. return isLt2M;
  2100. },
  2101. handleImportSuccess(res, file) {
  2102. this.getList();
  2103. if (res.msg === "ok") {
  2104. this.$message({
  2105. title: "成功",
  2106. message: "导入成功:" + res.data.success + "条!",
  2107. type: "success",
  2108. duration: 2000,
  2109. });
  2110. if (res.data.err_count > 0) {
  2111. this.$notify({
  2112. title: "失败",
  2113. message: "导入失败:" + res.data.err_count + "条!",
  2114. type: "danger",
  2115. duration: 2000,
  2116. });
  2117. import("@/vendor/Export2Excel").then((excel) => {
  2118. const list1 = res.data.result;
  2119. const tHeader = [
  2120. "饲料名称",
  2121. "饲料分类",
  2122. "唯一编码",
  2123. "计划类型",
  2124. "允许误差数(kg)",
  2125. "包装单位重量(kg)",
  2126. "单价",
  2127. "跳转重量域(kg)",
  2128. "跳转延时",
  2129. "确认开始",
  2130. "继电器位置",
  2131. "无上域",
  2132. "备用字段01",
  2133. "备用字段02",
  2134. "备用字段03",
  2135. "错误信息",
  2136. ];
  2137. const filterVal = [
  2138. "饲料名称",
  2139. "饲料分类",
  2140. "唯一编码",
  2141. "计划类型",
  2142. "允许误差数(kg)",
  2143. "包装单位重量(kg)",
  2144. "单价",
  2145. "跳转重量域(kg)",
  2146. "跳转延时",
  2147. "确认开始",
  2148. "继电器位置",
  2149. "无上域",
  2150. "备用字段01",
  2151. "备用字段02",
  2152. "备用字段03",
  2153. "error_msg",
  2154. ];
  2155. const data1 = this.formatJson(filterVal, list1);
  2156. excel.export_json_to_excel({
  2157. header: tHeader,
  2158. data: data1,
  2159. filename: "饲料表导入报错信息",
  2160. autoWidth: true,
  2161. bookType: "xlsx",
  2162. });
  2163. });
  2164. }
  2165. } else {
  2166. this.$notify({
  2167. title: "失败",
  2168. message: "上传失败",
  2169. type: "danger",
  2170. duration: 2000,
  2171. });
  2172. }
  2173. },
  2174. formatJson(filterVal, jsonData) {
  2175. return jsonData.map((v) =>
  2176. filterVal.map((j) => {
  2177. if (j === "timestamp") {
  2178. return parseTime(v[j]);
  2179. } else {
  2180. return v[j];
  2181. }
  2182. })
  2183. );
  2184. },
  2185. handleExport(item) {
  2186. if (item == 1) {
  2187. console.log("点击了导出模板");
  2188. this.download.getdataListParm.parammaps =
  2189. this.table.getdataListParm.parammaps;
  2190. console.log("点击了导出模板", this.download.getdataListParm);
  2191. GetDataByName(this.download.getdataListParm).then((response) => {
  2192. if (response.data.list !== null) {
  2193. this.download.list = response.data.list;
  2194. } else {
  2195. this.download.list = [];
  2196. }
  2197. console.log(this.download.list);
  2198. var downloadList = [
  2199. {
  2200. obj1: "1、文件类型为xlsx类型,对应表格文件名格式为:文件名称.xlsx;",
  2201. },
  2202. { obj1: "2、底部工作表名称不可更改,默认为:Sheet1;" },
  2203. // { 'obj1': '3、栏舍名称,实际牛头数,系数(%),系数头数,配方模板,补料配方字体为必填;' },
  2204. // { 'obj1': '4、第一列栏舍名称默认为系统中栏舍,不可修改;' },
  2205. // { 'obj1': '5、实际牛头数为正整数,系数为正数,至多保留俩位小数;' },
  2206. // { 'obj1': '6、配方模板名称必须与系统中配方计划—配方模板中的饲喂配方匹配;若补料配方开启,需与配方模板中的补料配方匹配;' },
  2207. // { 'obj1': '7、数据最多可导入200条,超过200条请分多个文件导入。' }
  2208. ];
  2209. var excelDatas = [
  2210. {
  2211. tHeader: [
  2212. "饲料名称",
  2213. "饲料分类",
  2214. "唯一编码",
  2215. "饲料来源",
  2216. "计划类型",
  2217. "允许误差数",
  2218. "包装单位重量",
  2219. "单价",
  2220. "跳转重量域",
  2221. "跳转延时",
  2222. "确认开始",
  2223. "继电器位置",
  2224. "无上域",
  2225. "备用字段01",
  2226. "备用字段02",
  2227. "备用字段03",
  2228. ],
  2229. filterVal: [
  2230. "",
  2231. "",
  2232. "",
  2233. "",
  2234. "",
  2235. "",
  2236. "",
  2237. "",
  2238. "",
  2239. "",
  2240. "",
  2241. "",
  2242. "",
  2243. "",
  2244. "",
  2245. "",
  2246. ],
  2247. tableDatas: this.download.list,
  2248. sheetName: "Sheet1",
  2249. },
  2250. {
  2251. tHeader: ["填写规范:"],
  2252. filterVal: ["obj1"],
  2253. tableDatas: downloadList,
  2254. sheetName: "Sheet2",
  2255. },
  2256. ];
  2257. json2excel(excelDatas, "饲料表导出模板", true, "xlsx");
  2258. });
  2259. // console.log('点击了导出模板')
  2260. // const requestParam = this.requestParam
  2261. // const url = process.env.VUE_APP_BASE_API + 'file/导入导出模板/库存管理/饲料表导入模板.xlsx' // 请求下载文件的地址
  2262. // console.log(url)
  2263. // axios({
  2264. // method: 'GET',
  2265. // url: url,
  2266. // data: requestParam,
  2267. // headers: { token: getToken(), optname: 'insertcustomdoc' },
  2268. // responseType: 'blob'
  2269. // }).then(res => {
  2270. // if (!res) return
  2271. // this.percentage = 99
  2272. // setTimeout(() => {
  2273. // this.isPercentage = false
  2274. // }, 2000)
  2275. // const blob = new Blob([res.data], {
  2276. // type: 'application/octet-stream;charset=utf-8'
  2277. // })
  2278. // const url = window.URL.createObjectURL(blob)
  2279. // const aLink = document.createElement('a')
  2280. // aLink.style.display = 'none'
  2281. // aLink.href = url
  2282. // const docname = '饲料表导入模板.xlsx'
  2283. // aLink.setAttribute('download', docname) // 下载的文件
  2284. // document.body.appendChild(aLink)
  2285. // aLink.click()
  2286. // document.body.removeChild(aLink)
  2287. // window.URL.revokeObjectURL(url)
  2288. // })
  2289. } else {
  2290. console.log("点击了导出数据");
  2291. this.download.getdataListParm.parammaps =
  2292. this.table.getdataListParm.parammaps;
  2293. GetDataByName(this.download.getdataListParm).then((response) => {
  2294. if (response.data.list !== null) {
  2295. this.download.list = response.data.list;
  2296. } else {
  2297. this.download.list = [];
  2298. }
  2299. var excelDatas = [
  2300. {
  2301. tHeader: [
  2302. "饲料名称",
  2303. "饲料分类",
  2304. "唯一编码",
  2305. "饲料来源",
  2306. "计划类型",
  2307. "允许误差数",
  2308. "包装单位重量",
  2309. "单价",
  2310. "跳转重量域",
  2311. "跳转延时",
  2312. "确认开始",
  2313. "继电器位置",
  2314. "无上域",
  2315. "备用字段01",
  2316. "备用字段02",
  2317. "备用字段03",
  2318. ],
  2319. filterVal: [
  2320. "fname",
  2321. "fclass",
  2322. "feedcode",
  2323. "source",
  2324. "printgroup",
  2325. "allowratio",
  2326. "unitweight",
  2327. "uprice",
  2328. "autozone",
  2329. "autosecondnam",
  2330. "onfirmstartname",
  2331. "trgaddress",
  2332. "jmp",
  2333. "backup1",
  2334. "backup2",
  2335. "backup3",
  2336. ],
  2337. tableDatas: this.download.list,
  2338. sheetName: "Sheet1",
  2339. },
  2340. ];
  2341. json2excel(excelDatas, "饲料表", true, "xlsx");
  2342. });
  2343. }
  2344. },
  2345. getButtons() {
  2346. const Edit = "FeedTable";
  2347. const isRoleEdit = checkButtons(
  2348. JSON.parse(sessionStorage.getItem("buttons")),
  2349. Edit
  2350. );
  2351. this.isRoleEdit = isRoleEdit;
  2352. },
  2353. getInforvalueList() {
  2354. GetDataByName(this.requestParams2).then((response) => {
  2355. if (response.data !== null) {
  2356. if (response.data.list[0].inforvalue == 0) {
  2357. this.isInforvalue = false;
  2358. } else {
  2359. this.isInforvalue = true;
  2360. }
  2361. } else {
  2362. this.isInforvalue = false;
  2363. }
  2364. });
  2365. },
  2366. getDownList() {
  2367. GetDataByNames(this.requestParams).then((response) => {
  2368. this.jumpDelayList = response.data.getDictByName.list;
  2369. this.feedTypeList = response.data.getFeedclassByBig.list;
  2370. this.planTypeList = response.data.getDictByName2.list;
  2371. this.smallMaterialList = response.data.getTMRListEnableTypeFeed.list;
  2372. this.materialtypeList = response.data.getDistMateriel.list;
  2373. this.sapGoodsList = response.data.getDistGoods.list;
  2374. });
  2375. },
  2376. getList() {
  2377. this.table.listLoading = true;
  2378. GetDataByName(this.table.getdataListParm).then((response) => {
  2379. console.log("table数据", response.data.list);
  2380. if (response.data.list !== null) {
  2381. this.table.list = response.data.list;
  2382. this.table.pageNum = response.data.pageNum;
  2383. this.table.pageSize = response.data.pageSize;
  2384. } else {
  2385. this.table.list = [];
  2386. }
  2387. this.$refs.table.reloadData(this.table.list);
  2388. this.table.total = response.data.total;
  2389. setTimeout(() => {
  2390. this.table.listLoading = false;
  2391. }, 100);
  2392. });
  2393. },
  2394. tableScroll({ scrollTop, scrollLeft, table, judgeFlse }) {
  2395. // {scrollTop, scrollLeft, table, judgeFlse: 这个参数返回一个boolean值,为true则代表表格滚动到了底部了,false没有滚动到底部,必须开起大数据渲染模式才能有值哦}, event
  2396. console.log(scrollTop, scrollLeft, table, judgeFlse);
  2397. },
  2398. form_search() {
  2399. console.log("点击了查询");
  2400. this.table.getdataListParm.offset = 1;
  2401. this.getList();
  2402. this.arrowDown = true;
  2403. this.arrowUp = false;
  2404. },
  2405. handleRefresh() {
  2406. console.log("点击了重置");
  2407. this.table.getdataListParm.parammaps.fname = "";
  2408. this.table.getdataListParm.parammaps.fclassid = "";
  2409. this.table.getdataListParm.parammaps.source = "";
  2410. this.table.getdataListParm.parammaps.autozone = "";
  2411. this.table.getdataListParm.parammaps.autosecond = "";
  2412. this.table.getdataListParm.parammaps.allowratio = "";
  2413. this.table.getdataListParm.parammaps.printgroup = "";
  2414. this.table.getdataListParm.parammaps.enable = "";
  2415. this.table.getdataListParm.offset = 1;
  2416. this.getList();
  2417. },
  2418. resetTemp() {
  2419. this.create.temp = {
  2420. pastureid: Cookies.get("pastureid"),
  2421. fname: "",
  2422. fclassid: "",
  2423. fclass: "",
  2424. feedcode: "",
  2425. source: "用户自定义",
  2426. printgroupid: "1",
  2427. printgroup: "无",
  2428. unitweight: "",
  2429. uprice: "",
  2430. allowratio: "",
  2431. autozone: "",
  2432. autosecond: "0",
  2433. autosecondname: "禁用",
  2434. confirmstart: "0",
  2435. confirmstartname: "禁用",
  2436. enable: "1",
  2437. trgaddress: "",
  2438. backup1: "",
  2439. backup2: "",
  2440. backup3: "",
  2441. jmp: "0",
  2442. feedgroupid: "",
  2443. };
  2444. },
  2445. // 计划类型
  2446. changePlanList(item) {
  2447. console.log(item, "======");
  2448. this.create.temp.printgroup = this.planTypeList.find(
  2449. (obj) => obj.value === item
  2450. ).label;
  2451. },
  2452. // 饲料类型
  2453. changeFeedList(item) {
  2454. this.create.temp.fclass = this.feedTypeList.find(
  2455. (obj) => obj.id === item
  2456. ).mixname;
  2457. },
  2458. // 跳转延时
  2459. changeAutosecond(item) {
  2460. this.create.temp.autosecondname = this.jumpDelayList.find(
  2461. (obj) => obj.value === item
  2462. ).label;
  2463. },
  2464. // 确认开始
  2465. changeConfirmstart(item) {
  2466. this.create.temp.confirmstartname = this.confirmStartList.find(
  2467. (obj) => obj.id === item
  2468. ).name;
  2469. },
  2470. changeSmallMaterial(item) {
  2471. if (item !== "") {
  2472. this.create.temp.smtmrname = this.smallMaterialList.find(
  2473. (obj) => obj.id === item
  2474. ).tname;
  2475. } else {
  2476. this.create.temp.smtmrname = "";
  2477. }
  2478. },
  2479. // 新增
  2480. handleCreate() {
  2481. console.log("点击了新增");
  2482. this.resetTemp();
  2483. this.dialogFull = false;
  2484. this.create.dialogStatus = "create";
  2485. this.create.dialogFormVisible = true;
  2486. },
  2487. createData() {
  2488. console.log("点击了新增保存");
  2489. this.isokDisable = true;
  2490. setTimeout(() => {
  2491. this.isokDisable = false;
  2492. }, 1000);
  2493. this.$refs["temp"].validate((valid) => {
  2494. if (valid) {
  2495. const unitweight = /^[1-9]\d*$/;
  2496. if (this.create.temp.unitweight !== "") {
  2497. if (!unitweight.test(parseFloat(this.create.temp.unitweight))) {
  2498. this.$message({
  2499. type: "error",
  2500. message: "包装单位重量请输入正整数",
  2501. duration: 2000,
  2502. });
  2503. return false;
  2504. }
  2505. }
  2506. // const uprice = /^\d+(\.\d{1,2})?$/
  2507. const uprice = /^(\d+|\d+\.\d{1,2})$/;
  2508. if (this.create.temp.uprice !== "") {
  2509. if (!uprice.test(parseFloat(this.create.temp.uprice))) {
  2510. this.$message({
  2511. type: "error",
  2512. message: "单价请保留两位小数",
  2513. duration: 2000,
  2514. });
  2515. return false;
  2516. }
  2517. }
  2518. if (this.create.temp.autozone !== "") {
  2519. const autozone = /^([0-9]|(1[0-9]|2[0-9]|3[0-9]|4[0-9]|(50)))$/;
  2520. if (!autozone.test(parseFloat(this.create.temp.autozone))) {
  2521. this.$message({
  2522. type: "error",
  2523. message: "跳转重量域请输入大于等于0小于等于50的整数",
  2524. duration: 2000,
  2525. });
  2526. return false;
  2527. }
  2528. } else {
  2529. this.create.temp.autozone = "0";
  2530. }
  2531. if (this.create.temp.trgaddress.length > 8) {
  2532. this.$message({
  2533. type: "error",
  2534. message: "继电器位置请输入1-8位数字",
  2535. duration: 2000,
  2536. });
  2537. return false;
  2538. }
  2539. const allowratio = /^[0-9]\d*$/;
  2540. if (this.create.temp.allowratio !== "") {
  2541. if (!allowratio.test(parseFloat(this.create.temp.allowratio))) {
  2542. this.$message({
  2543. type: "error",
  2544. message: "允许误差数请输入大于等于0的整数",
  2545. duration: 2000,
  2546. });
  2547. return false;
  2548. }
  2549. }
  2550. this.isokDisable = true;
  2551. setTimeout(() => {
  2552. this.isokDisable = false;
  2553. }, 1000);
  2554. this.requestParam.name = "insertFeed";
  2555. this.requestParam.parammaps = this.create.temp;
  2556. if (this.create.temp.allowratio == "") {
  2557. this.create.temp.allowratio = "0";
  2558. }
  2559. if (this.create.temp.uprice == "") {
  2560. this.create.temp.uprice = "0";
  2561. }
  2562. if (this.create.temp.unitweight == "") {
  2563. this.create.temp.unitweight = "0";
  2564. }
  2565. if (this.create.temp.autozone == "") {
  2566. this.create.temp.autozone = "0";
  2567. }
  2568. if (this.create.temp.trgaddress == "") {
  2569. this.create.temp.trgaddress = "0";
  2570. }
  2571. let url = "authdata/feedbackup/check";
  2572. let data = {
  2573. fclassid: this.create.temp.fclassid,
  2574. backup1: this.create.temp.backup1,
  2575. };
  2576. postJson(url, data).then((response) => {
  2577. if (response.msg == "fail") {
  2578. this.$notify({
  2579. title: "保存失败",
  2580. message: response.data,
  2581. type: "warning",
  2582. duration: 2000,
  2583. });
  2584. if (this.create.temp.allowratio == "0") {
  2585. this.create.temp.allowratio = "";
  2586. }
  2587. if (this.create.temp.uprice == "0") {
  2588. this.create.temp.uprice = "";
  2589. }
  2590. if (this.create.temp.unitweight == "0") {
  2591. this.create.temp.unitweight = "";
  2592. }
  2593. if (this.create.temp.autozone == "0") {
  2594. this.create.temp.autozone = "";
  2595. }
  2596. if (this.create.temp.trgaddress == "0") {
  2597. this.create.temp.trgaddress = "";
  2598. }
  2599. } else {
  2600. PostDataByName(this.requestParam).then((response) => {
  2601. console.log("新增保存发送参数", this.requestParam);
  2602. if (response.msg !== "fail") {
  2603. this.$notify({
  2604. title: "成功",
  2605. message: "保存成功",
  2606. type: "success",
  2607. duration: 2000,
  2608. });
  2609. this.create.dialogFormVisible = false;
  2610. this.getList();
  2611. } else {
  2612. this.$notify({
  2613. title: "保存失败",
  2614. message: response.data,
  2615. type: "warning",
  2616. duration: 2000,
  2617. });
  2618. if (this.create.temp.allowratio == "0") {
  2619. this.create.temp.allowratio = "";
  2620. }
  2621. if (this.create.temp.uprice == "0") {
  2622. this.create.temp.uprice = "";
  2623. }
  2624. if (this.create.temp.unitweight == "0") {
  2625. this.create.temp.unitweight = "";
  2626. }
  2627. if (this.create.temp.autozone == "0") {
  2628. this.create.temp.autozone = "";
  2629. }
  2630. if (this.create.temp.trgaddress == "0") {
  2631. this.create.temp.trgaddress = "";
  2632. }
  2633. }
  2634. });
  2635. }
  2636. });
  2637. }
  2638. });
  2639. },
  2640. // 编辑
  2641. handleUpdate(row) {
  2642. console.log("点击了编辑", row);
  2643. this.create.dialogStatus = "update";
  2644. this.dialogFull = false;
  2645. this.create.dialogFormVisible = true;
  2646. row.fclassid = String(row.fclassid);
  2647. row.printgroupid = String(row.printgroupid);
  2648. row.autosecond = String(row.autosecond);
  2649. row.confirmstart = String(row.confirmstart);
  2650. row.enable = String(row.enable);
  2651. row.jmp = String(row.jmp);
  2652. if (row.printgroupid !== "") {
  2653. const foundItem = this.planTypeList.find(
  2654. (obj) => obj.value == row.printgroupid
  2655. );
  2656. row.printgroup = foundItem ? foundItem.label : "";
  2657. }
  2658. this.create.temp = Object.assign({}, row);
  2659. if (this.create.temp.allowratio == "0") {
  2660. this.create.temp.allowratio = "";
  2661. }
  2662. if (this.create.temp.uprice == "0.00") {
  2663. this.create.temp.uprice = "";
  2664. }
  2665. if (this.create.temp.unitweight == "0") {
  2666. this.create.temp.unitweight = "";
  2667. }
  2668. if (this.create.temp.autozone == "0") {
  2669. this.create.temp.autozone = "";
  2670. }
  2671. if (this.create.temp.trgaddress == "0") {
  2672. this.create.temp.trgaddress = "";
  2673. }
  2674. if (this.create.temp.smtmrid == "-1") {
  2675. this.create.temp.smtmrid = "";
  2676. }
  2677. console.log(this.create.temp, "=====123");
  2678. },
  2679. updateData() {
  2680. console.log("点击了编辑保存");
  2681. this.isokDisable = true;
  2682. setTimeout(() => {
  2683. this.isokDisable = false;
  2684. }, 1000);
  2685. this.$refs["temp"].validate((valid) => {
  2686. if (valid) {
  2687. const unitweight = /^[1-9]\d*$/;
  2688. if (this.create.temp.unitweight !== "") {
  2689. if (!unitweight.test(parseFloat(this.create.temp.unitweight))) {
  2690. this.$message({
  2691. type: "error",
  2692. message: "包装单位重量请输入正整数",
  2693. duration: 2000,
  2694. });
  2695. return false;
  2696. }
  2697. }
  2698. // const uprice = /^\d+(\.\d{1,2})?$/
  2699. const uprice = /^(\d+|\d+\.\d{1,2})$/;
  2700. if (this.create.temp.uprice !== "") {
  2701. if (!uprice.test(parseFloat(this.create.temp.uprice))) {
  2702. this.$message({
  2703. type: "error",
  2704. message: "单价请保留两位小数",
  2705. duration: 2000,
  2706. });
  2707. return false;
  2708. }
  2709. }
  2710. if (this.create.temp.autozone !== "") {
  2711. const autozone = /^([0-9]|(1[0-9]|2[0-9]|3[0-9]|4[0-9]|(50)))$/;
  2712. if (!autozone.test(parseFloat(this.create.temp.autozone))) {
  2713. this.$message({
  2714. type: "error",
  2715. message: "跳转重量域请输入大于等于0小于等于50的整数",
  2716. duration: 2000,
  2717. });
  2718. return false;
  2719. }
  2720. } else {
  2721. this.create.temp.autozone = "0";
  2722. }
  2723. if (this.create.temp.trgaddress.length > 8) {
  2724. this.$message({
  2725. type: "error",
  2726. message: "继电器位置请输入1-8位数字",
  2727. duration: 2000,
  2728. });
  2729. return false;
  2730. }
  2731. const allowratio = /^[0-9]\d*$/;
  2732. if (this.create.temp.allowratio !== "") {
  2733. if (!allowratio.test(parseFloat(this.create.temp.allowratio))) {
  2734. this.$message({
  2735. type: "error",
  2736. message: "允许误差数请输入大于等于0的整数",
  2737. duration: 2000,
  2738. });
  2739. return false;
  2740. }
  2741. }
  2742. this.isokDisable = true;
  2743. setTimeout(() => {
  2744. this.isokDisable = false;
  2745. }, 1000);
  2746. this.requestParam.name = "updateFeed";
  2747. this.requestParam.parammaps = this.create.temp;
  2748. if (this.create.temp.allowratio == "") {
  2749. this.create.temp.allowratio = "0";
  2750. }
  2751. if (this.create.temp.uprice == "") {
  2752. this.create.temp.uprice = "0";
  2753. }
  2754. if (this.create.temp.unitweight == "") {
  2755. this.create.temp.unitweight = "0";
  2756. }
  2757. if (this.create.temp.autozone == "") {
  2758. this.create.temp.autozone = "0";
  2759. }
  2760. if (this.create.temp.trgaddress == "") {
  2761. this.create.temp.trgaddress = "0";
  2762. }
  2763. let url = "authdata/feedbackup/check";
  2764. let data = {
  2765. fclassid: this.create.temp.fclassid,
  2766. feedId: this.create.temp.id,
  2767. backup1: this.create.temp.backup1,
  2768. };
  2769. postJson(url, data).then((response) => {
  2770. if (response.msg == "fail") {
  2771. this.$notify({
  2772. title: "保存失败",
  2773. message: response.data,
  2774. type: "warning",
  2775. duration: 2000,
  2776. });
  2777. if (this.create.temp.allowratio == "0") {
  2778. this.create.temp.allowratio = "";
  2779. }
  2780. if (this.create.temp.uprice == "0") {
  2781. this.create.temp.uprice = "";
  2782. }
  2783. if (this.create.temp.unitweight == "0") {
  2784. this.create.temp.unitweight = "";
  2785. }
  2786. if (this.create.temp.autozone == "0") {
  2787. this.create.temp.autozone = "";
  2788. }
  2789. if (this.create.temp.trgaddress == "0") {
  2790. this.create.temp.trgaddress = "";
  2791. }
  2792. } else {
  2793. PostDataByName(this.requestParam).then((response) => {
  2794. console.log("新增保存发送参数", this.requestParam);
  2795. if (response.msg !== "fail") {
  2796. this.$notify({
  2797. title: "成功",
  2798. message: "保存成功",
  2799. type: "success",
  2800. duration: 2000,
  2801. });
  2802. this.create.dialogFormVisible = false;
  2803. this.getList();
  2804. } else {
  2805. this.$notify({
  2806. title: "保存失败",
  2807. message: response.data,
  2808. type: "warning",
  2809. duration: 2000,
  2810. });
  2811. if (this.create.temp.allowratio == "0") {
  2812. this.create.temp.allowratio = "";
  2813. }
  2814. if (this.create.temp.uprice == "0") {
  2815. this.create.temp.uprice = "";
  2816. }
  2817. if (this.create.temp.unitweight == "0") {
  2818. this.create.temp.unitweight = "";
  2819. }
  2820. if (this.create.temp.autozone == "0") {
  2821. this.create.temp.autozone = "";
  2822. }
  2823. if (this.create.temp.trgaddress == "0") {
  2824. this.create.temp.trgaddress = "";
  2825. }
  2826. }
  2827. });
  2828. }
  2829. });
  2830. }
  2831. });
  2832. },
  2833. // 饲料库
  2834. handleFeedBank() {
  2835. console.log("点击了饲料库");
  2836. this.dialogFull = false;
  2837. this.feedBank.dialogStatus = "feedBank";
  2838. this.feedBank.dialogFormVisible = true;
  2839. this.getFeedBankList();
  2840. },
  2841. getFeedBankList() {
  2842. this.feedBank.listLoading = true;
  2843. GetDataByName(this.feedBank.getdataListParm).then((response) => {
  2844. console.log("table数据", response.data.list);
  2845. if (response.data.list !== null) {
  2846. this.feedBank.list = response.data.list;
  2847. this.feedBank.pageNum = response.data.pageNum;
  2848. this.feedBank.pageSize = response.data.pageSize;
  2849. this.feedBank.total = response.data.total;
  2850. } else {
  2851. this.feedBank.list = [];
  2852. }
  2853. setTimeout(() => {
  2854. this.feedBank.listLoading = false;
  2855. }, 100);
  2856. });
  2857. },
  2858. handleFeedBankSearch() {
  2859. console.log("点击了饲料库搜索");
  2860. this.getFeedBankList();
  2861. this.feedBank.getdataListParm.offset = 1;
  2862. },
  2863. handleFeedBankRefresh() {
  2864. console.log("点击了饲料库重置");
  2865. this.feedBank.getdataListParm.parammaps.fname = "";
  2866. this.feedBank.getdataListParm.parammaps.statue = "";
  2867. this.getFeedBankList();
  2868. },
  2869. // 关联
  2870. handleRelation(row) {
  2871. console.log("点击了关联");
  2872. this.dialogFull = false;
  2873. this.relation.dialogStatus = "relation";
  2874. this.relation.dialogFormVisible = true;
  2875. this.relation.temp = Object.assign({}, row);
  2876. this.relation.getdataListParm.parammaps.fid = this.relation.temp.id;
  2877. this.getRelationList();
  2878. },
  2879. getRelationList() {
  2880. this.relation.listLoading = true;
  2881. GetDataByName(this.relation.getdataListParm).then((response) => {
  2882. console.log("table数据", response.data.list);
  2883. if (response.data.list !== null) {
  2884. this.relation.list = response.data.list;
  2885. this.relation.pageNum = response.data.pageNum;
  2886. this.relation.pageSize = response.data.pageSize;
  2887. this.relation.total = response.data.total;
  2888. } else {
  2889. this.relation.list = [];
  2890. }
  2891. setTimeout(() => {
  2892. this.relation.listLoading = false;
  2893. }, 100);
  2894. });
  2895. },
  2896. handleRelationSearch() {
  2897. console.log("点击了关联搜索");
  2898. this.relation.getdataListParm.offset = 1;
  2899. this.getRelationList();
  2900. },
  2901. disassociateData(row) {
  2902. console.log("点击了取消关联");
  2903. MessageBox.confirm("是否确认取消关联?", {
  2904. confirmButtonText: "确认",
  2905. cancelButtonText: "取消",
  2906. type: "warning",
  2907. })
  2908. .then(() => {
  2909. this.isokDisable = true;
  2910. setTimeout(() => {
  2911. this.isokDisable = false;
  2912. }, 1000);
  2913. this.requestParam.name = "updateFeedrelation";
  2914. this.requestParam.parammaps = {};
  2915. this.requestParam.parammaps.pastureid = this.relation.temp.pastureid;
  2916. this.requestParam.parammaps.fid = this.relation.temp.id;
  2917. this.requestParam.parammaps.id = row.id;
  2918. PostDataByName(this.requestParam).then((response) => {
  2919. console.log("取消关联保存发送参数", this.requestParam);
  2920. if (response.msg !== "fail") {
  2921. this.$notify({
  2922. title: "成功",
  2923. message: "保存成功",
  2924. type: "success",
  2925. duration: 2000,
  2926. });
  2927. this.getRelationList();
  2928. this.getList();
  2929. } else {
  2930. this.$notify({
  2931. title: "保存失败",
  2932. message: response.data,
  2933. type: "warning",
  2934. duration: 2000,
  2935. });
  2936. }
  2937. });
  2938. })
  2939. .catch(() => {
  2940. this.$message({ type: "info", message: "已取消" });
  2941. });
  2942. },
  2943. relationData(row) {
  2944. console.log("点击了关联保存");
  2945. MessageBox.confirm("是否确认关联?", {
  2946. confirmButtonText: "确认",
  2947. cancelButtonText: "取消",
  2948. type: "warning",
  2949. })
  2950. .then(() => {
  2951. this.isokDisable = true;
  2952. setTimeout(() => {
  2953. this.isokDisable = false;
  2954. }, 1000);
  2955. this.requestParam.name = "insertFeednur";
  2956. this.requestParam.parammaps = {};
  2957. this.requestParam.parammaps.pastureid = this.relation.temp.pastureid;
  2958. this.requestParam.parammaps.fid = this.relation.temp.id;
  2959. this.requestParam.parammaps.fname = this.relation.temp.fname;
  2960. this.requestParam.parammaps.feedcode = this.relation.temp.feedcode;
  2961. this.requestParam.parammaps.price = row.price;
  2962. this.requestParam.parammaps.remark = row.remark;
  2963. this.requestParam.parammaps.dry = row.dry;
  2964. this.requestParam.parammaps.starch = row.starch;
  2965. this.requestParam.parammaps.cp = row.cp;
  2966. this.requestParam.parammaps.ca = row.ca;
  2967. this.requestParam.parammaps.p = row.p;
  2968. this.requestParam.parammaps.n = row.n;
  2969. this.requestParam.parammaps.fat = row.fat;
  2970. this.requestParam.parammaps.adf = row.adf;
  2971. this.requestParam.parammaps.ndf = row.ndf;
  2972. this.requestParam.parammaps.ndip = row.ndip;
  2973. this.requestParam.parammaps.ash = row.ash;
  2974. this.requestParam.parammaps.fpercent = row.fpercent;
  2975. this.requestParam.parammaps.iscu = row.iscu;
  2976. this.requestParam.parammaps.feednurid = row.id;
  2977. PostDataByName(this.requestParam).then((response) => {
  2978. console.log("关联保存发送参数", this.requestParam);
  2979. if (response.msg !== "fail") {
  2980. this.$notify({
  2981. title: "成功",
  2982. message: "保存成功",
  2983. type: "success",
  2984. duration: 2000,
  2985. });
  2986. this.getRelationList();
  2987. this.getList();
  2988. } else {
  2989. this.$notify({
  2990. title: "保存失败",
  2991. message: response.data,
  2992. type: "warning",
  2993. duration: 2000,
  2994. });
  2995. }
  2996. });
  2997. })
  2998. .catch(() => {
  2999. this.$message({ type: "info", message: "已取消" });
  3000. });
  3001. },
  3002. // 营养价值
  3003. handleNutritive(row) {
  3004. console.log("点击了营养价值", row);
  3005. this.dialogFull = false;
  3006. this.nutritive.dialogStatus = "nutritive";
  3007. this.nutritive.dialogFormVisible = true;
  3008. this.nutritive.temp = Object.assign({}, row);
  3009. },
  3010. nutritiveData() {
  3011. console.log("点击了营养价值保存");
  3012. this.isokDisable = true;
  3013. setTimeout(() => {
  3014. this.isokDisable = false;
  3015. }, 1000);
  3016. if (this.nutritive.temp.dry == undefined) {
  3017. this.$set(this.nutritive.temp, "dry", "");
  3018. }
  3019. if (this.nutritive.temp.starch == undefined) {
  3020. this.$set(this.nutritive.temp, "starch", "");
  3021. }
  3022. if (this.nutritive.temp.cp == undefined) {
  3023. this.$set(this.nutritive.temp, "cp", "");
  3024. }
  3025. if (this.nutritive.temp.ca == undefined) {
  3026. this.$set(this.nutritive.temp, "ca", "");
  3027. }
  3028. if (this.nutritive.temp.p == undefined) {
  3029. this.$set(this.nutritive.temp, "p", "");
  3030. }
  3031. if (this.nutritive.temp.n == undefined) {
  3032. this.$set(this.nutritive.temp, "n", "");
  3033. }
  3034. if (this.nutritive.temp.fat == undefined) {
  3035. this.$set(this.nutritive.temp, "fat", "");
  3036. }
  3037. if (this.nutritive.temp.adf == undefined) {
  3038. this.$set(this.nutritive.temp, "adf", "");
  3039. }
  3040. if (this.nutritive.temp.ndf == undefined) {
  3041. this.$set(this.nutritive.temp, "ndf", "");
  3042. }
  3043. if (this.nutritive.temp.ndip == undefined) {
  3044. this.$set(this.nutritive.temp, "ndip", "");
  3045. }
  3046. if (this.nutritive.temp.ash == undefined) {
  3047. this.$set(this.nutritive.temp, "ash", "");
  3048. }
  3049. var positiveNumber = /^\d+(\.\d{1,2})?$/;
  3050. if (this.nutritive.temp.dry !== "") {
  3051. if (!positiveNumber.test(parseFloat(this.nutritive.temp.dry))) {
  3052. this.$message({
  3053. type: "error",
  3054. message: "请输入自然数,最多保留俩位小数",
  3055. duration: 2000,
  3056. });
  3057. return false;
  3058. }
  3059. }
  3060. console.log(this.nutritive.temp.starch);
  3061. if (this.nutritive.temp.starch !== "") {
  3062. if (!positiveNumber.test(parseFloat(this.nutritive.temp.starch))) {
  3063. this.$message({
  3064. type: "error",
  3065. message: "请输入自然数,最多保留俩位小数",
  3066. duration: 2000,
  3067. });
  3068. return false;
  3069. }
  3070. }
  3071. if (this.nutritive.temp.cp !== "") {
  3072. if (!positiveNumber.test(parseFloat(this.nutritive.temp.cp))) {
  3073. this.$message({
  3074. type: "error",
  3075. message: "请输入自然数,最多保留俩位小数",
  3076. duration: 2000,
  3077. });
  3078. return false;
  3079. }
  3080. }
  3081. if (this.nutritive.temp.ca !== "") {
  3082. if (!positiveNumber.test(parseFloat(this.nutritive.temp.ca))) {
  3083. this.$message({
  3084. type: "error",
  3085. message: "请输入自然数,最多保留俩位小数",
  3086. duration: 2000,
  3087. });
  3088. return false;
  3089. }
  3090. }
  3091. if (this.nutritive.temp.p !== "") {
  3092. if (!positiveNumber.test(parseFloat(this.nutritive.temp.p))) {
  3093. this.$message({
  3094. type: "error",
  3095. message: "请输入自然数,最多保留俩位小数",
  3096. duration: 2000,
  3097. });
  3098. return false;
  3099. }
  3100. }
  3101. if (this.nutritive.temp.n !== "") {
  3102. if (!positiveNumber.test(parseFloat(this.nutritive.temp.n))) {
  3103. this.$message({
  3104. type: "error",
  3105. message: "请输入自然数,最多保留俩位小数",
  3106. duration: 2000,
  3107. });
  3108. return false;
  3109. }
  3110. }
  3111. if (this.nutritive.temp.fat !== "") {
  3112. if (!positiveNumber.test(parseFloat(this.nutritive.temp.fat))) {
  3113. this.$message({
  3114. type: "error",
  3115. message: "请输入自然数,最多保留俩位小数",
  3116. duration: 2000,
  3117. });
  3118. return false;
  3119. }
  3120. }
  3121. if (this.nutritive.temp.adf !== "") {
  3122. if (!positiveNumber.test(parseFloat(this.nutritive.temp.adf))) {
  3123. this.$message({
  3124. type: "error",
  3125. message: "请输入自然数,最多保留俩位小数",
  3126. duration: 2000,
  3127. });
  3128. return false;
  3129. }
  3130. }
  3131. if (this.nutritive.temp.ndf !== "") {
  3132. if (!positiveNumber.test(parseFloat(this.nutritive.temp.ndf))) {
  3133. this.$message({
  3134. type: "error",
  3135. message: "请输入自然数,最多保留俩位小数",
  3136. duration: 2000,
  3137. });
  3138. return false;
  3139. }
  3140. }
  3141. if (this.nutritive.temp.ndip !== "") {
  3142. if (!positiveNumber.test(parseFloat(this.nutritive.temp.ndip))) {
  3143. this.$message({
  3144. type: "error",
  3145. message: "请输入自然数,最多保留俩位小数",
  3146. duration: 2000,
  3147. });
  3148. return false;
  3149. }
  3150. }
  3151. if (this.nutritive.temp.ash !== "") {
  3152. if (!positiveNumber.test(parseFloat(this.nutritive.temp.ash))) {
  3153. this.$message({
  3154. type: "error",
  3155. message: "请输入自然数,最多保留俩位小数",
  3156. duration: 2000,
  3157. });
  3158. return false;
  3159. }
  3160. }
  3161. this.requestParam.name = "insertFeednur";
  3162. this.requestParam.parammaps = {};
  3163. this.requestParam.parammaps.pastureid = this.nutritive.temp.pastureid;
  3164. this.requestParam.parammaps.fid = this.nutritive.temp.id;
  3165. this.requestParam.parammaps.fname = this.nutritive.temp.fname;
  3166. this.requestParam.parammaps.feedcode = this.nutritive.temp.feedcode;
  3167. this.requestParam.parammaps.price = this.nutritive.temp.uprice;
  3168. this.requestParam.parammaps.remark = this.nutritive.temp.remark;
  3169. this.requestParam.parammaps.dry = this.nutritive.temp.dry;
  3170. this.requestParam.parammaps.starch = this.nutritive.temp.starch;
  3171. this.requestParam.parammaps.cp = this.nutritive.temp.cp;
  3172. this.requestParam.parammaps.ca = this.nutritive.temp.ca;
  3173. this.requestParam.parammaps.p = this.nutritive.temp.p;
  3174. this.requestParam.parammaps.n = this.nutritive.temp.n;
  3175. this.requestParam.parammaps.fat = this.nutritive.temp.fat;
  3176. this.requestParam.parammaps.adf = this.nutritive.temp.adf;
  3177. this.requestParam.parammaps.ndf = this.nutritive.temp.ndf;
  3178. this.requestParam.parammaps.ndip = this.nutritive.temp.ndip;
  3179. this.requestParam.parammaps.ash = this.nutritive.temp.ash;
  3180. this.requestParam.parammaps.fpercent = this.nutritive.temp.fpercent;
  3181. this.requestParam.parammaps.iscu = this.nutritive.temp.iscu;
  3182. this.requestParam.parammaps.feednurid = "-1";
  3183. PostDataByName(this.requestParam).then((response) => {
  3184. console.log("关联保存发送参数", this.requestParam);
  3185. if (response.msg !== "fail") {
  3186. this.$notify({
  3187. title: "成功",
  3188. message: "保存成功",
  3189. type: "success",
  3190. duration: 2000,
  3191. });
  3192. this.getList();
  3193. this.nutritive.dialogFormVisible = false;
  3194. } else {
  3195. this.$notify({
  3196. title: "保存失败",
  3197. message: response.data,
  3198. type: "warning",
  3199. duration: 2000,
  3200. });
  3201. }
  3202. });
  3203. },
  3204. // 行内删除
  3205. handleRowDelete(row) {
  3206. console.log("点击了行内删除");
  3207. MessageBox.confirm("是否确认删除此信息?", {
  3208. confirmButtonText: "确认",
  3209. cancelButtonText: "取消",
  3210. type: "warning",
  3211. })
  3212. .then(() => {
  3213. this.selectList = [];
  3214. this.requestParam = {};
  3215. this.requestParam.common = { returnmap: "0" };
  3216. this.requestParam.data = [];
  3217. this.requestParam.data[0] = {
  3218. name: "checkDeleteFeed",
  3219. type: "v",
  3220. parammaps: {
  3221. pastureid: row.pastureid,
  3222. id: row.id,
  3223. },
  3224. };
  3225. this.requestParam.data[1] = {
  3226. name: "deleteFeed",
  3227. type: "e",
  3228. parammaps: {
  3229. pastureid: row.pastureid,
  3230. id: row.id,
  3231. },
  3232. };
  3233. ExecDataByConfig(this.requestParam).then((response) => {
  3234. console.log("删除保存发送参数", this.requestParam);
  3235. if (response.msg === "fail") {
  3236. this.$notify({
  3237. title: "删除失败",
  3238. message: response.data,
  3239. type: "warning",
  3240. duration: 2000,
  3241. });
  3242. } else {
  3243. this.$notify({
  3244. title: "",
  3245. message: "删除成功",
  3246. type: "success",
  3247. duration: 2000,
  3248. });
  3249. this.getList();
  3250. }
  3251. });
  3252. })
  3253. .catch(() => {
  3254. this.$message({ type: "info", message: "已取消删除" });
  3255. });
  3256. },
  3257. handleSelectionChange(val) {
  3258. console.log("勾选数据", val);
  3259. this.selectList = val;
  3260. },
  3261. // 多项删除
  3262. form_delete() {
  3263. console.log("点击了删除");
  3264. if (this.selectList.length == 0) {
  3265. this.$message({
  3266. type: "error",
  3267. message: "请选择饲料表信息",
  3268. duration: 2000,
  3269. });
  3270. } else {
  3271. MessageBox.confirm(
  3272. "当前选中" + this.selectList.length + "条信息,是否删除?",
  3273. {
  3274. confirmButtonText: "确认",
  3275. cancelButtonText: "取消",
  3276. type: "warning",
  3277. }
  3278. ).then(() => {
  3279. this.requestParam = {};
  3280. this.requestParam.common = { returnmap: "0" };
  3281. this.requestParam.data = [];
  3282. this.requestParam.data[0] = {
  3283. name: "insertSpotList",
  3284. resultmaps: { list: this.selectList },
  3285. };
  3286. this.requestParam.data[0].children = [];
  3287. this.requestParam.data[0].children[0] = {
  3288. name: "checkDeleteFeed",
  3289. type: "v",
  3290. parammaps: {
  3291. id: "@insertSpotList.id",
  3292. pastureid: "@insertSpotList.pastureid",
  3293. },
  3294. };
  3295. this.requestParam.data[0].children[1] = {
  3296. name: "deleteFeed",
  3297. type: "e",
  3298. parammaps: {
  3299. id: "@insertSpotList.id",
  3300. pastureid: "@insertSpotList.pastureid",
  3301. },
  3302. };
  3303. ExecDataByConfig(this.requestParam).then((response) => {
  3304. console.log("删除保存发送参数", this.requestParam);
  3305. if (response.msg === "fail") {
  3306. this.$notify({
  3307. title: "删除失败",
  3308. message: response.data,
  3309. type: "warning",
  3310. duration: 2000,
  3311. });
  3312. } else {
  3313. this.$notify({
  3314. title: "",
  3315. message: "删除成功",
  3316. type: "success",
  3317. duration: 2000,
  3318. });
  3319. this.getList();
  3320. }
  3321. });
  3322. });
  3323. }
  3324. },
  3325. handleChangeOrder() {
  3326. this.isOrder = false;
  3327. this.rowDrop();
  3328. },
  3329. saveChangeOrder() {
  3330. // 保存顺序
  3331. var sortArr = [];
  3332. for (let i = 0; i < this.table.list.length; i++) {
  3333. var obj = {};
  3334. obj.sort = i + 1;
  3335. obj.id = this.table.list[i].id;
  3336. obj.pastureid = this.table.list[i].pastureid;
  3337. sortArr.push(obj);
  3338. }
  3339. this.requestParam = {};
  3340. this.requestParam.common = { returnmap: "0" };
  3341. this.requestParam.data = [];
  3342. this.requestParam.data[0] = {
  3343. name: "insertSpotList",
  3344. resultmaps: { list: sortArr },
  3345. };
  3346. this.requestParam.data[0].children = [];
  3347. this.requestParam.data[0].children[0] = {
  3348. name: "updateFeedSort",
  3349. type: "e",
  3350. parammaps: {
  3351. id: "@insertSpotList.id",
  3352. pastureid: "@insertSpotList.pastureid",
  3353. sort: "@insertSpotList.sort",
  3354. },
  3355. };
  3356. ExecDataByConfig(this.requestParam).then((response) => {
  3357. console.log("顺序切换保存发送参数", this.requestParam);
  3358. if (response.msg === "fail") {
  3359. this.$notify({
  3360. title: "顺序切换失败",
  3361. message: response.data,
  3362. type: "warning",
  3363. duration: 2000,
  3364. });
  3365. } else {
  3366. this.$notify({
  3367. title: "",
  3368. message: "顺序切换成功",
  3369. type: "success",
  3370. duration: 2000,
  3371. });
  3372. this.getList();
  3373. this.isOrder = true;
  3374. }
  3375. });
  3376. },
  3377. cancelChangeOrder() {
  3378. // 取消顺序
  3379. this.getList();
  3380. this.isOrder = true;
  3381. },
  3382. // 行拖拽
  3383. rowDrop() {
  3384. console.log(
  3385. document.querySelector("#table .el-table__body-wrapper tbody")
  3386. );
  3387. const tbody = document.querySelector(
  3388. "#table .el-table__body-wrapper tbody"
  3389. );
  3390. const that = this;
  3391. var sortable = Sortable.create(tbody, {
  3392. disabled: that.dropState,
  3393. onChoose({ newIndex, oldIndex }) {
  3394. if (that.dropState == true) {
  3395. sortable.destroy();
  3396. }
  3397. },
  3398. onEnd({ newIndex, oldIndex }) {
  3399. const currRow = that.table.list.splice(oldIndex, 1)[0];
  3400. that.table.list.splice(newIndex, 0, currRow);
  3401. console.log("索引", newIndex);
  3402. console.log("拖动数据", currRow);
  3403. console.log("上", that.table.list[newIndex - 1]);
  3404. console.log("下", that.table.list[newIndex + 1]);
  3405. },
  3406. });
  3407. },
  3408. handleSet() {
  3409. if (this.selectList.length == 0) {
  3410. this.$message({
  3411. type: "error",
  3412. message: "请选择一条信息",
  3413. duration: 2000,
  3414. });
  3415. } else {
  3416. this.dialogFull = false;
  3417. this.sapCode.dialogStatus = "sapCode";
  3418. this.sapCode.dialogFormVisible = true;
  3419. this.sapCode.table.getdataListParm.parammaps.MAKTX =
  3420. this.selectList[0].sapCode;
  3421. this.getsapCodeList();
  3422. }
  3423. },
  3424. getsapCodeList() {
  3425. GetDataByName(this.sapCode.table.getdataListParm).then((response) => {
  3426. if (response.data.list !== null) {
  3427. this.sapCode.table.list = response.data.list;
  3428. } else {
  3429. this.sapCode.table.list = [];
  3430. }
  3431. this.$refs.saptable.reloadData(this.sapCode.table.list);
  3432. });
  3433. },
  3434. handleSapCodeSearch() {
  3435. this.getsapCodeList();
  3436. },
  3437. sapCodeData() {
  3438. if (
  3439. this.sapCode.selectList.length > 1 ||
  3440. this.sapCode.selectList.length == 0
  3441. ) {
  3442. this.$message({
  3443. type: "error",
  3444. message: "请选择一条信息",
  3445. duration: 2000,
  3446. });
  3447. } else {
  3448. this.requestParam.name = "updateFeedSapCode";
  3449. let data = {
  3450. name: "updateFeedSapCode",
  3451. parammaps: {
  3452. sapCode: this.sapCode.selectList[0].MATNR,
  3453. id: this.selectList[0].id,
  3454. },
  3455. };
  3456. PostDataByName(data).then((response) => {
  3457. console.log("新增保存发送参数", data);
  3458. if (response.msg !== "fail") {
  3459. this.$notify({
  3460. title: "成功",
  3461. message: "保存成功",
  3462. type: "success",
  3463. duration: 2000,
  3464. });
  3465. this.sapCode.dialogFormVisible = false;
  3466. this.getList();
  3467. } else {
  3468. this.$notify({
  3469. title: "保存失败",
  3470. message: response.data,
  3471. type: "warning",
  3472. duration: 2000,
  3473. });
  3474. if (this.create.temp.allowratio == "0") {
  3475. this.create.temp.allowratio = "";
  3476. }
  3477. if (this.create.temp.uprice == "0") {
  3478. this.create.temp.uprice = "";
  3479. }
  3480. if (this.create.temp.unitweight == "0") {
  3481. this.create.temp.unitweight = "";
  3482. }
  3483. if (this.create.temp.autozone == "0") {
  3484. this.create.temp.autozone = "";
  3485. }
  3486. if (this.create.temp.trgaddress == "0") {
  3487. this.create.temp.trgaddress = "";
  3488. }
  3489. }
  3490. });
  3491. }
  3492. },
  3493. handleSapCodeSelectionChange(val) {
  3494. this.sapCode.selectList = val;
  3495. console.log(this.sapCode.selectList, "this.sapCode.selectList");
  3496. },
  3497. handleGetSapCode() {
  3498. this.dialogFull = false;
  3499. this.sapCode2.dialogStatus = "sapCode2";
  3500. this.sapCode2.dialogFormVisible = true;
  3501. },
  3502. sapCodeData2() {
  3503. this.$refs["sapCode2"].validate((valid) => {
  3504. if (valid) {
  3505. let url = "authdata/sap/feed";
  3506. let data = {
  3507. startTime: parseTime(
  3508. this.sapCode2.temp.inputDatetime[0],
  3509. "{y}-{m}-{d}"
  3510. ),
  3511. endTime: parseTime(
  3512. this.sapCode2.temp.inputDatetime[1],
  3513. "{y}-{m}-{d}"
  3514. ),
  3515. mtart: this.sapCode2.temp.sapMaterialtype,
  3516. pastureId: Cookies.get("pastureid"),
  3517. };
  3518. postJson(url, data).then((response) => {
  3519. if (response.msg !== "fail") {
  3520. this.$notify({
  3521. title: "成功",
  3522. message: "保存成功",
  3523. type: "success",
  3524. duration: 2000,
  3525. });
  3526. this.sapCode2.dialogFormVisible = false;
  3527. this.getList();
  3528. } else {
  3529. this.$notify({
  3530. title: "保存失败",
  3531. message: response.data,
  3532. type: "warning",
  3533. duration: 2000,
  3534. });
  3535. }
  3536. });
  3537. }
  3538. });
  3539. },
  3540. getIspalyUd() {
  3541. let url = "authdata/GetDataByName";
  3542. let data = {
  3543. name: "getSysoptEnable",
  3544. page: 1,
  3545. offset: 1,
  3546. pagecount: 1,
  3547. returntype: "Map",
  3548. parammaps: {
  3549. pastureid: Cookies.get("pastureid"),
  3550. inforname: "gmUdSync",
  3551. },
  3552. };
  3553. postJson(url, data).then((response) => {
  3554. if (response.msg !== "fail") {
  3555. if (response.data.list[0].inforvalue == 0) {
  3556. this.ispalyUd = false;
  3557. } else {
  3558. this.ispalyUd = true;
  3559. }
  3560. } else {
  3561. this.$notify({
  3562. title: "请求失败",
  3563. message: response.data,
  3564. type: "warning",
  3565. duration: 2000,
  3566. });
  3567. }
  3568. });
  3569. },
  3570. getIspalyXdmy() {
  3571. let url = "authdata/GetDataByName";
  3572. let data = {
  3573. name: "getSysoptEnable",
  3574. page: 1,
  3575. offset: 1,
  3576. pagecount: 1,
  3577. returntype: "Map",
  3578. parammaps: {
  3579. pastureid: Cookies.get("pastureid"),
  3580. inforname: "xdmysapupload",
  3581. },
  3582. };
  3583. postJson(url, data).then((response) => {
  3584. if (response.msg !== "fail") {
  3585. if (response.data.list[0].inforvalue == 0) {
  3586. this.ispalyXdmy = false;
  3587. } else {
  3588. this.ispalyXdmy = true;
  3589. }
  3590. } else {
  3591. this.$notify({
  3592. title: "请求失败",
  3593. message: response.data,
  3594. type: "warning",
  3595. duration: 2000,
  3596. });
  3597. }
  3598. });
  3599. },
  3600. getIspalyYmy() {
  3601. let url = "authdata/GetDataByName";
  3602. let data = {
  3603. name: "getSysoptEnable",
  3604. page: 1,
  3605. offset: 1,
  3606. pagecount: 1,
  3607. returntype: "Map",
  3608. parammaps: {
  3609. pastureid: Cookies.get("pastureid"),
  3610. inforname: "ymySync",
  3611. },
  3612. };
  3613. postJson(url, data).then((response) => {
  3614. if (response.msg !== "fail") {
  3615. if (response.data.list[0].inforvalue == 0) {
  3616. this.ispalyYmy = false;
  3617. } else {
  3618. this.ispalyYmy = true;
  3619. }
  3620. } else {
  3621. this.$notify({
  3622. title: "请求失败",
  3623. message: response.data,
  3624. type: "warning",
  3625. duration: 2000,
  3626. });
  3627. }
  3628. });
  3629. },
  3630. handleGetUd() {
  3631. MessageBox.confirm("是否获取UD饲料?", {
  3632. confirmButtonText: "确认",
  3633. cancelButtonText: "取消",
  3634. type: "warning",
  3635. }).then(() => {
  3636. let url = "authdata/gm/udfeed";
  3637. let data = {
  3638. pastureId: Cookies.get("pastureid"),
  3639. };
  3640. postJson(url, data).then((response) => {
  3641. if (response.msg !== "fail") {
  3642. this.$notify({
  3643. title: "成功",
  3644. message: "保存成功",
  3645. type: "success",
  3646. duration: 2000,
  3647. });
  3648. this.getList();
  3649. } else {
  3650. this.$notify({
  3651. title: "保存失败",
  3652. message: response.data,
  3653. type: "warning",
  3654. duration: 2000,
  3655. });
  3656. }
  3657. });
  3658. });
  3659. },
  3660. handleGetYmy() {
  3661. MessageBox.confirm("是否获取饲料?", {
  3662. confirmButtonText: "确认",
  3663. cancelButtonText: "取消",
  3664. type: "warning",
  3665. }).then(() => {
  3666. let url = "authdata/ymy/syncfeed";
  3667. let data = {
  3668. pastureId: Cookies.get("pastureid"),
  3669. };
  3670. postJson(url, data).then((response) => {
  3671. if (response.msg !== "fail") {
  3672. this.$notify({
  3673. title: "成功",
  3674. message: "保存成功",
  3675. type: "success",
  3676. duration: 2000,
  3677. });
  3678. this.getList();
  3679. } else {
  3680. this.$notify({
  3681. title: "保存失败",
  3682. message: response.data,
  3683. type: "warning",
  3684. duration: 2000,
  3685. });
  3686. }
  3687. });
  3688. });
  3689. },
  3690. },
  3691. };
  3692. </script>
  3693. <style lang="scss" scoped>
  3694. .search {
  3695. margin-top: 10px;
  3696. }
  3697. $width: 350px;
  3698. $left: 325px;
  3699. .selectInput {
  3700. position: relative;
  3701. display: inline-block;
  3702. .Input {
  3703. width: $width;
  3704. position: relative;
  3705. }
  3706. .el-icon-arrow-down {
  3707. width: 30px;
  3708. height: 30px;
  3709. position: absolute;
  3710. left: $left;
  3711. top: 10px;
  3712. color: #c0c4cc;
  3713. }
  3714. .el-icon-arrow-up {
  3715. width: 30px;
  3716. height: 30px;
  3717. position: absolute;
  3718. left: $left;
  3719. top: 10px;
  3720. color: #c0c4cc;
  3721. }
  3722. .selectUl {
  3723. z-index: 111;
  3724. width: $width;
  3725. background: #fff;
  3726. border: 1px solid #e4e7ed;
  3727. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  3728. margin: -1px 0 0 0;
  3729. padding: 6px 0;
  3730. margin: 0;
  3731. box-sizing: border-box;
  3732. position: absolute;
  3733. li {
  3734. list-style: none;
  3735. font-size: 14px;
  3736. padding: 0 10px;
  3737. white-space: nowrap;
  3738. overflow: hidden;
  3739. text-overflow: ellipsis;
  3740. color: #606266;
  3741. height: 50px;
  3742. line-height: 50px;
  3743. box-sizing: border-box;
  3744. cursor: pointer;
  3745. a {
  3746. float: left;
  3747. width: 80px;
  3748. }
  3749. a:hover {
  3750. color: rgba(0, 204, 102, 0.71);
  3751. font-weight: 700;
  3752. }
  3753. }
  3754. }
  3755. }
  3756. </style>