index.vue 152 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403
  1. <template>
  2. <div class="app-container">
  3. <!-- 配方模板表 -->
  4. <div ref="template" class="template">
  5. <div class="recipeTemplate">
  6. <p>日执行计划</p>
  7. </div>
  8. <div class="search">
  9. <el-date-picker v-model="table.getdataListParm.parammaps.mydate" type="date" placeholder="选择日期" style="width: 150px;" format="yyyy-MM-dd" value-format="yyyy-MM-dd" :clearable="false" @change="changeDate" />
  10. <el-button class="el-icon-arrow-left elIconArrowLeft" @click="handleBefore" />
  11. <el-button class="el-icon-arrow-right elIconArrowRight" @click="handleNext" />
  12. <el-select v-model="table.getdataListParm.parammaps.lpplantype" filterable placeholder="计划类型" class="filter-item" clearable style="width: 120px;" @change="changePlanType">
  13. <el-option v-for="item in planTypeList" :key="item.value" :label="item.lable" :value="item.value" />
  14. </el-select>
  15. <el-select v-model="table.getdataListParm.parammaps.times" filterable placeholder="班次" class="filter-item" style="width: 120px;" clearable @change="changeFrequency">
  16. <el-option v-for="item in frequencyList" :key="item.id" :label="item.name" :value="item.id" />
  17. </el-select>
  18. <el-select v-model="table.getdataListParm.parammaps.printType" filterable placeholder="打印类型" class="filter-item" :clearable="false" style="width: 120px;">
  19. <el-option v-for="item in printingTypeList" :key="item.value" :label="item.lable" :value="item.value" />
  20. </el-select>
  21. <el-select v-model="table.getdataListParm.parammaps.plandimen" filterable placeholder="计划维度" class="filter-item" style="width: 120px;" :clearable="false">
  22. <el-option v-for="item in planningDimensionList" :key="item.value" :label="item.lable" :value="item.value" />
  23. </el-select>
  24. <el-select v-model="table.getdataListParm.parammaps.enable3" filterable placeholder="导出类型" class="filter-item" style="width: 120px;" :clearable="false">
  25. <el-option v-for="item in exportTypeList" :key="item.value" :label="item.lable" :value="item.value" />
  26. </el-select>
  27. <el-select v-model="table.getdataListParm.parammaps.tmrname" filterable placeholder="TMR名称" class="filter-item" style="width: 120px;" :clearable="false">
  28. <el-option v-for="item in tmrDownList" :key="item.tmrname" :label="item.tmrname" :value="item.tmrtname" />
  29. </el-select>
  30. <el-select v-model="table.getdataListParm.parammaps.iscompleted" filterable placeholder="执行状态" class="filter-item" style="width: 120px;" :clearable="false">
  31. <el-option v-for="item in iscompletedList" :key="item.value" :label="item.lable" :value="item.value" />
  32. </el-select>
  33. <el-button class="successBorder" @click="form_search">查询</el-button>
  34. <el-button class="export" icon="el-icon-upload2" @click="handleExport">导出</el-button>
  35. <el-button class="export" icon="el-icon-upload2" @click="handlePrint">打印</el-button>
  36. <el-button class="export" style="margin-left: -5px;" @click="form_deleteRecord">删除记录</el-button>
  37. </div>
  38. <div class="operation" style="margin-bottom: 10px;">
  39. <el-button v-if="isRoleEdit" class="success" icon="el-icon-plus" @click="handleCreate">新生成</el-button>
  40. <el-button v-if="isRoleEdit" class="success" icon="el-icon-edit-outline" @click="handleRevisePlan">修改计划</el-button>
  41. <el-button v-if="isRoleEdit" class="copy" icon="el-icon-copy-document" @click="handleCopy">复制计划</el-button>
  42. <el-button v-if="isOrder && isRoleEdit" icon="el-icon-sort" class="success" @click="handleChangeOrder">更改顺序</el-button>
  43. <div v-else style="margin-left: 10px;display: inline-block;">
  44. <el-button v-if="isRoleEdit" icon="el-icon-folder-checked" class="success" @click="saveChangeOrder">保存</el-button>
  45. <el-button v-if="isRoleEdit" icon="el-icon-close" class="sortCancel" @click="cancelChangeOrder">取消</el-button>
  46. </div>
  47. <el-button v-if="isRoleEdit" class="success" icon="el-icon-open" @click="handleTakeEffect">生效</el-button>
  48. <el-button v-if="isRoleEdit" class="danger" icon="el-icon-turn-off" @click="handleDisable">禁用</el-button>
  49. <el-button v-if="dataSynchronization2.isDataSynchronization" class="success" icon="el-icon-plus" @click="form_updata">上传计划</el-button>
  50. <el-button v-if="dataSynchronization.isDataSynchronization && isRoleEdit" class="success" @click="handleDataSynchronization">数据同步</el-button>
  51. <el-button v-if="dataSynchronization3.isDataSynchronization&&isRoleEdit" class="success" @click="handleDataUpload">数据上传</el-button>
  52. <el-button v-if="isRoleEdit" class="danger" icon="el-icon-delete" @click="handleDelete">删除</el-button>
  53. <el-button v-if="isRoleEdit && sapUpload.isSap" class="success" icon="el-icon-upload2" @click="handleSAPUpload">SAP上传</el-button>
  54. <el-button v-if="isRoleEdit && ispalyUd" class="success" icon="el-icon-plus" @click="handleGetUd1">搅拌数据上传</el-button>
  55. <el-button v-if="isRoleEdit && ispalyUd" class="success" icon="el-icon-plus" @click="handleGetUd2">剩料上传</el-button>
  56. <el-button v-if="isRoleEdit && ispalyUd" class="success" icon="el-icon-plus" @click="handleGetUd3">撒料上传</el-button>
  57. <!-- <el-button v-if="isRoleEdit" class="success" icon="el-icon-circle-check" @click="handleQuickcompletion">快速完成</el-button> -->
  58. </div>
  59. <!-- 日执行计划 -->
  60. <div class="table">
  61. <el-table
  62. id="table1"
  63. ref="parent"
  64. :key="table.tableKey"
  65. v-loading="table.listLoading"
  66. element-loading-text="给我一点时间"
  67. :data="table.list"
  68. border
  69. fit
  70. highlight-current-row
  71. style="width: 98%;"
  72. row-key="sort"
  73. :row-style="rowStyle"
  74. :cell-style="cellStyle"
  75. class="elTable table-fixed"
  76. :row-class-name="tableRowClassName"
  77. :height="myheight"
  78. @row-click="tableRowClick"
  79. @selection-change="handleSelect"
  80. >
  81. <el-table-column type="selection" min-width="50" />
  82. <el-table-column label="序号" align="center" prop="sort" width="50px" />
  83. <el-table-column label="计划名称" min-width="90px" align="center">
  84. <template slot-scope="scope">
  85. <span>{{ scope.row.projname }}</span>
  86. </template>
  87. </el-table-column>
  88. <el-table-column label="计划类型" prop="weight" min-width="90px" align="center" :formatter="lpplantype" />
  89. <el-table-column label="TMR编号" min-width="90px" align="center">
  90. <template slot-scope="scope">
  91. <span>{{ scope.row.tmrtname }}</span>
  92. </template>
  93. </el-table-column>
  94. <el-table-column label="驾驶员" min-width="150px" align="center">
  95. <template slot-scope="scope">
  96. <!-- <span>{{ scope.row.driver }}</span> -->
  97. <el-select v-model="scope.row.driverId" :disabled="scope.row.havebutton == 1" filterable placeholder="驾驶员" class="filter-item" style="width:95%;padding:10px 0;" :clearable="false" @change="(value)=> {changeDriver(value, scope.row)}">
  98. <el-option v-for="item in driverList" :key="item.id" :label="item.drivername" :value="item.id" />
  99. </el-select>
  100. </template>
  101. </el-table-column>
  102. <el-table-column label="已执行" min-width="70px" align="center">
  103. <template slot-scope="scope">
  104. <div v-if="scope.row.havebutton == 0" style="background: #009A69;color:#fff;line-height:30px;">否</div>
  105. <div v-else style="background: #FC2323;color:#000 ;line-height:30px;">是</div>
  106. </template>
  107. </el-table-column>
  108. <el-table-column label="班次" min-width="80px" align="center">
  109. <template slot-scope="scope">
  110. <span>{{ scope.row.times }}</span>
  111. </template>
  112. </el-table-column>
  113. <el-table-column label="理论量" min-width="80px" align="center">
  114. <template slot-scope="scope">
  115. <span>{{ scope.row.lweight }}</span>
  116. </template>
  117. </el-table-column>
  118. <el-table-column label="启用" min-width="70px" align="center">
  119. <template slot-scope="scope">
  120. <el-switch v-if="dataDisabled == false" v-model="scope.row.enable" :disabled="scope.row.havebutton == 1" active-color="#13ce66" inactive-color="#ff4949" :active-value="1" :inactive-value="0" @change="handleEnableChange(scope.row)" />
  121. <el-switch v-else v-model="scope.row.enable" disabled active-color="#13ce66" inactive-color="#ff4949" :active-value="1" :inactive-value="0" @change="handleEnableChange(scope.row)" />
  122. </template>
  123. </el-table-column>
  124. <el-table-column label="时间" min-width="80px" align="center">
  125. <template slot-scope="scope">
  126. <span>{{ scope.row.plantime }}</span>
  127. </template>
  128. </el-table-column>
  129. <el-table-column label="配方名称" min-width="100px" align="center">
  130. <template slot-scope="scope">
  131. <b style="font-size: 26px;line-height: 30px;">{{ scope.row.ftname }}</b>
  132. </template>
  133. </el-table-column>
  134. <el-table-column label="头数" min-width="80px" align="center">
  135. <template slot-scope="scope">
  136. <span>{{ scope.row.cowcount }}</span>
  137. </template>
  138. </el-table-column>
  139. <el-table-column label="描述" min-width="80px" align="center">
  140. <template slot-scope="scope">
  141. <span>{{ scope.row.display }}</span>
  142. </template>
  143. </el-table-column>
  144. <el-table-column label="发料位" min-width="80px" align="left">
  145. <template slot-scope="scope">
  146. <span>{{ scope.row.barnames }}</span>
  147. </template>
  148. </el-table-column>
  149. <el-table-column align="center" width="100" label="操作" class-name="small-padding fixed-width" fixed="right">
  150. <template slot-scope="{row}">
  151. <el-button class="miniDanger" icon="el-icon-delete" @click="handleRowDelete(row)" />
  152. <el-button class="miniDanger" icon="el-icon-sort" @click="handleRowSort(row)" />
  153. </template>
  154. </el-table-column>
  155. </el-table>
  156. <span v-if="table.listLoading == false" style="margin-right: 30px;margin-top: 10px;font-size: 14px;">共{{ table.total }}条</span>
  157. </div>
  158. </div>
  159. <!-- maxHeight="enlargeHeight -->
  160. <div v-if="isDetail" style="position: relative;">
  161. <el-button class="hide" @click="handleCloseTable2" style="position: absolute;right: 0;top: -20px;">隐藏</el-button>
  162. <!-- 预混料 -->
  163. <div v-if="table3.getdataListParm.parammaps.lpplantype == 4" class="content">
  164. <el-row :gutter="20">
  165. <el-col :span="12">
  166. <div class="table2">
  167. <div class="contentOperation">
  168. <p>计划详情</p>
  169. </div>
  170. <div class="content-table">
  171. <el-table
  172. :key="table2.tableKey"
  173. v-loading="table2.listLoading"
  174. element-loading-text="给我一点时间"
  175. :data="table2.list"
  176. fit
  177. border
  178. highlight-current-row
  179. style="width: 100%;"
  180. height="450"
  181. :row-style="rowStyle"
  182. :cell-style="cellStyle"
  183. class="elTable table-fixed"
  184. :span-method="objectSpanMethod"
  185. >
  186. <el-table-column label="操作序号" width="90px" align="center">
  187. <template slot-scope="scope">
  188. <span>{{ scope.row.sort }}</span>
  189. </template>
  190. </el-table-column>
  191. <el-table-column label="饲料名称" prop="fname" min-width="90px" align="center">
  192. <template slot-scope="scope">
  193. <span>{{ scope.row.fname }}</span>
  194. </template>
  195. </el-table-column>
  196. <el-table-column label="设计重量(KG)" prop="weight" min-width="130px" align="center">
  197. <template slot-scope="scope">
  198. <span v-if="scope.row.NoEdit">{{ scope.row.weight }}</span>
  199. <el-input v-if="scope.row.Edit" v-model="scope.row.weight" type="number" maxlength="32" style="width:95%;padding:10px 0;" />
  200. </template>
  201. </el-table-column>
  202. <el-table-column label="小计" prop="description" min-width="90px" align="center">
  203. <template slot-scope="scope">
  204. <span>{{ scope.row.subtotal }}</span>
  205. </template>
  206. </el-table-column>
  207. <el-table-column label="操作" align="left" min-width="200" class-name="small-padding">
  208. <template slot-scope="{row}">
  209. <el-button v-if="row.isUpdate && isRoleEdit" :disabled="table2.getdataListParm.parammaps.havebutton == 1" class="miniSuccess" icon="el-icon-edit-outline" @click="handleUpdate2(row)" />
  210. <span v-if="row.isUpdate && isRoleEdit" class="centerSpan">|</span>
  211. <el-button v-if="row.isUpdateSave" :disabled="isokDisable" icon="el-icon-folder-checked" class="miniSuccess" @click="updateData2(row,'0')" />
  212. <span v-if="row.isUpdateSave" class="centerSpan">|</span>
  213. <el-button v-if="row.isUpdateSave" class="minCancel" icon="el-icon-close" @click="updateCancel2(row)" />
  214. <!-- <span v-if="row.isUpdate && isRoleEdit" class="centerSpan">|</span>
  215. <el-button v-if="row.isUpdate && isRoleEdit" class="miniSuccess" @click="handleRowEmpty(row,0)">
  216. <svg-icon icon-class="clear" />
  217. </el-button> -->
  218. </template>
  219. </el-table-column>
  220. </el-table>
  221. </div>
  222. </div>
  223. </el-col>
  224. </el-row>
  225. </div>
  226. <!-- 撒料 -->
  227. <div v-if="table3.getdataListParm.parammaps.lpplantype == 0" class="content">
  228. <el-row :gutter="20">
  229. <el-col :span="12">
  230. <div class="table2">
  231. <div class="contentOperation">
  232. <p>计划详情</p>
  233. </div>
  234. <div class="content-table">
  235. <el-table
  236. :key="table2.tableKey"
  237. v-loading="table2.listLoading"
  238. element-loading-text="给我一点时间"
  239. :data="table2.list"
  240. fit
  241. border
  242. highlight-current-row
  243. style="width: 100%;"
  244. height="450"
  245. :row-style="rowStyle"
  246. :cell-style="cellStyle"
  247. class="elTable table-fixed"
  248. :span-method="objectSpanMethod"
  249. >
  250. <el-table-column label="操作序号" min-width="90px" align="center">
  251. <template slot-scope="scope">
  252. <span>{{ scope.row.sort }}</span>
  253. </template>
  254. </el-table-column>
  255. <el-table-column label="饲料名称" prop="fname" min-width="90px" align="center">
  256. <template slot-scope="scope">
  257. <span>{{ scope.row.fname }}</span>
  258. </template>
  259. </el-table-column>
  260. <el-table-column label="设计重量(KG)" prop="weight" min-width="130px" align="center">
  261. <template slot-scope="scope">
  262. <span v-if="scope.row.NoEdit">{{ scope.row.weight }}</span>
  263. <el-input v-if="scope.row.Edit" v-model="scope.row.weight" type="number" maxlength="32" style="width:95%;padding:10px 0;" />
  264. </template>
  265. </el-table-column>
  266. <el-table-column label="小计" prop="description" min-width="90px" align="center">
  267. <template slot-scope="scope">
  268. <span>{{ scope.row.subtotal }}</span>
  269. </template>
  270. </el-table-column>
  271. <el-table-column label="操作" align="left" min-width="200" class-name="small-padding">
  272. <template slot-scope="{row}">
  273. <el-button v-if="row.isUpdate && isRoleEdit" :disabled="table2.getdataListParm.parammaps.havebutton == 1" class="miniSuccess" icon="el-icon-edit-outline" @click="handleUpdate2(row)" />
  274. <el-button v-if="row.isUpdateSave" :disabled="isokDisable" icon="el-icon-folder-checked" class="miniSuccess" @click="updateData2(row,'0')" />
  275. <span v-if="row.isUpdateSave" class="centerSpan">|</span>
  276. <el-button v-if="row.isUpdateSave" class="minCancel" icon="el-icon-close" @click="updateCancel2(row)" />
  277. <!-- <span v-if="row.isUpdate && isRoleEdit" class="centerSpan">|</span>
  278. <el-button v-if="row.isUpdate && isRoleEdit" class="miniSuccess" @click="handleRowEmpty(row,0)">
  279. <svg-icon icon-class="clear" />
  280. </el-button> -->
  281. </template>
  282. </el-table-column>
  283. </el-table>
  284. </div>
  285. </div>
  286. </el-col>
  287. <el-col :span="12">
  288. <div class="table3">
  289. <div class="contentOperation">
  290. <p>栏舍详情</p>
  291. </div>
  292. <div class="content-table">
  293. <el-table
  294. :key="table3.tableKey"
  295. v-loading="table3.listLoading"
  296. element-loading-text="给我一点时间"
  297. :data="table3.list"
  298. height="450"
  299. fit
  300. border
  301. highlight-current-row
  302. style="width: 100%;"
  303. :row-style="rowStyle"
  304. :cell-style="cellStyle"
  305. class="elTable table-fixed"
  306. >
  307. <el-table-column label=" 操作序号" min-width="90px" align="center">
  308. <template slot-scope="scope">
  309. <span>{{ scope.row.sort }}</span>
  310. </template>
  311. </el-table-column>
  312. <!-- <el-table-column label="栏舍编码" min-width="60px" align="center" prop="bcode" /> -->
  313. <el-table-column label="栏舍名称" min-width="90px" align="center">
  314. <template slot-scope="scope">
  315. <span>{{ scope.row.fname }}</span>
  316. </template>
  317. </el-table-column>
  318. <el-table-column label="栏舍长度" min-width="60px" align="center" prop="length" />
  319. <el-table-column label="设计重量(KG)" prop="weight" min-width="130px" align="center">
  320. <template slot-scope="scope">
  321. <span v-if="scope.row.NoEdit">{{ scope.row.weight }}</span>
  322. <el-input v-if="scope.row.Edit" v-model="scope.row.weight" type="number" maxlength="32" style="width:95%;padding:10px 0;" />
  323. </template>
  324. </el-table-column>
  325. <!-- <el-table-column label="数量" min-width="60px" align="center" prop="ccount" /> -->
  326. <el-table-column label="使用档位" min-width="60px" align="center" prop="gear" />
  327. <el-table-column label="车行速度" min-width="60px" align="center" prop="speed" />
  328. <el-table-column label="操作" align="left" min-width="200" class-name="small-padding">
  329. <template slot-scope="{row}">
  330. <el-button v-if="row.isUpdate && isRoleEdit" :disabled="table3.getdataListParm.parammaps.havebutton == 1" class="miniSuccess" icon="el-icon-edit-outline" @click="handleUpdate3(row)" />
  331. <el-button v-if="row.isUpdateSave" :disabled="isokDisable" icon="el-icon-folder-checked" class="miniSuccess" @click="updateData3(row,'1')" />
  332. <span v-if="row.isUpdateSave" class="centerSpan">|</span>
  333. <el-button v-if="row.isUpdateSave" class="minCancel" icon="el-icon-close" @click="updateCancel3(row)" />
  334. <!-- <span v-if="row.isUpdate && isRoleEdit" class="centerSpan">|</span>
  335. <e<el-button v-if="row.isUpdate && isRoleEdit" class="miniSuccess" @click="handleRowEmpty(row,1)">
  336. <svg-icon icon-class="clear" />
  337. </el-button> -->
  338. </template>
  339. </el-table-column>
  340. </el-table>
  341. </div>
  342. </div>
  343. </el-col>
  344. </el-row>
  345. </div>
  346. <!-- 剩料 -->
  347. <div v-if="table3.getdataListParm.parammaps.lpplantype == 3" class="content">
  348. <el-row :gutter="20">
  349. <el-col :span="12"><div class="table2">
  350. <div class="contentOperation">
  351. <p>计划详情</p>
  352. </div>
  353. <div class="content-table">
  354. <el-table
  355. :key="table2.tableKey"
  356. v-loading="table2.listLoading"
  357. element-loading-text="给我一点时间"
  358. :data="table2.list"
  359. fit
  360. border
  361. highlight-current-row
  362. style="width: 100%;"
  363. height="450"
  364. :row-style="rowStyle"
  365. :cell-style="cellStyle"
  366. class="elTable table-fixed"
  367. :span-method="objectSpanMethod"
  368. >
  369. <el-table-column label="操作序号" min-width="130px" align="center">
  370. <template slot-scope="scope">
  371. <span>{{ scope.row.sort }}</span>
  372. </template>
  373. </el-table-column>
  374. <el-table-column label="取料栏舍" prop="fname" min-width="130px" align="center">
  375. <template slot-scope="scope">
  376. <span>{{ scope.row.fname }}</span>
  377. </template>
  378. </el-table-column>
  379. <el-table-column label="处理方式" prop="useinbar" min-width="130px" align="center">
  380. <template slot-scope="scope">
  381. <span>{{ scope.row.useinbar }}</span>
  382. </template>
  383. </el-table-column>
  384. <el-table-column label="小计" prop="description" min-width="130px" align="center">
  385. <template slot-scope="scope">
  386. <span>{{ scope.row.subtotal }}</span>
  387. </template>
  388. </el-table-column>
  389. </el-table>
  390. </div>
  391. </div>
  392. </el-col>
  393. <el-col :span="12">
  394. <div class="table3">
  395. <div class="contentOperation">
  396. <p>栏舍详情</p>
  397. </div>
  398. <div class="content-table">
  399. <el-table
  400. :key="table3.tableKey"
  401. v-loading="table3.listLoading"
  402. element-loading-text="给我一点时间"
  403. :data="table3.list"
  404. height="450"
  405. fit
  406. border
  407. highlight-current-row
  408. style="width: 100%;"
  409. :row-style="rowStyle"
  410. :cell-style="cellStyle"
  411. class="elTable table-fixed"
  412. >
  413. <el-table-column label="操作序号" min-width="130px" align="center">
  414. <template slot-scope="scope">
  415. <span>{{ scope.row.sort }}</span>
  416. </template>
  417. </el-table-column>
  418. <el-table-column label="转投栏舍" min-width="130px" align="center">
  419. <template slot-scope="scope">
  420. <span>{{ scope.row.fname }}</span>
  421. </template>
  422. </el-table-column>
  423. </el-table>
  424. </div>
  425. </div>
  426. </el-col>
  427. </el-row>
  428. </div>
  429. <!-- 撒料计划-混料 -->
  430. <div v-if="table3.getdataListParm.parammaps.lpplantype == 1 || table3.getdataListParm.parammaps.lpplantype == 5" class="content">
  431. <el-row :gutter="20">
  432. <el-col :span="12">
  433. <div class="table2">
  434. <div class="contentOperation">
  435. <p>计划详情</p>
  436. </div>
  437. <div class="content-table">
  438. <el-table
  439. :key="table2.tableKey"
  440. v-loading="table2.listLoading"
  441. element-loading-text="给我一点时间"
  442. :data="table2.list"
  443. fit
  444. border
  445. highlight-current-row
  446. style="width: 100%;"
  447. height="450"
  448. :row-style="rowStyle"
  449. :cell-style="cellStyle"
  450. class="elTable table-fixed"
  451. :span-method="objectSpanMethod"
  452. >
  453. <el-table-column label="操作序号" min-width="90px" align="center">
  454. <template slot-scope="scope">
  455. <span>{{ scope.row.sort }}</span>
  456. </template>
  457. </el-table-column>
  458. <el-table-column label="饲料名称" prop="fname" min-width="90px" align="center">
  459. <template slot-scope="scope">
  460. <span>{{ scope.row.fname }}</span>
  461. </template>
  462. </el-table-column>
  463. <el-table-column label="设计重量(KG)" prop="weight" min-width="130px" align="center">
  464. <template slot-scope="scope">
  465. <span v-if="scope.row.NoEdit">{{ scope.row.weight }}</span>
  466. <el-input v-if="scope.row.Edit" v-model="scope.row.weight" type="number" maxlength="32" style="width:95%;padding:10px 0;" />
  467. </template>
  468. </el-table-column>
  469. <el-table-column label="小计" prop="description" min-width="90px" align="center">
  470. <template slot-scope="scope">
  471. <span>{{ scope.row.subtotal }}</span>
  472. </template>
  473. </el-table-column>
  474. <el-table-column label="操作" align="left" min-width="200" class-name="small-padding">
  475. <template slot-scope="{row}">
  476. <el-button v-if="row.isUpdate && isRoleEdit" :disabled="table2.getdataListParm.parammaps.havebutton == 1" class="miniSuccess" icon="el-icon-edit-outline" @click="handleUpdate2(row)" />
  477. <el-button v-if="row.isUpdateSave" :disabled="isokDisable" icon="el-icon-folder-checked" class="miniSuccess" @click="updateData2(row,'0')" />
  478. <span v-if="row.isUpdateSave" class="centerSpan">|</span>
  479. <el-button v-if="row.isUpdateSave" class="minCancel" icon="el-icon-close" @click="updateCancel2(row)" />
  480. <!-- <span v-if="row.isUpdate && isRoleEdit" class="centerSpan">|</span>
  481. <el-button v-if="row.isUpdate && isRoleEdit" class="miniSuccess" @click="handleRowEmpty(row,0)">
  482. <svg-icon icon-class="clear" />
  483. </el-button> -->
  484. </template>
  485. </el-table-column>
  486. </el-table>
  487. </div>
  488. </div>
  489. </el-col>
  490. <el-col :span="12">
  491. <div class="table3">
  492. <div class="contentOperation">
  493. <p>栏舍详情</p>
  494. </div>
  495. <div class="content-table">
  496. <el-table
  497. :key="table3.tableKey"
  498. v-loading="table3.listLoading"
  499. element-loading-text="给我一点时间"
  500. :data="table3.list"
  501. height="450"
  502. fit
  503. border
  504. highlight-current-row
  505. style="width: 100%;"
  506. :row-style="rowStyle"
  507. :cell-style="cellStyle"
  508. class="elTable table-fixed"
  509. >
  510. <el-table-column label=" 操作序号" min-width="90px" align="center">
  511. <template slot-scope="scope">
  512. <span>{{ scope.row.sort }}</span>
  513. </template>
  514. </el-table-column>
  515. <el-table-column label="撒料车辆" min-width="90px" align="center">
  516. <template slot-scope="scope">
  517. <span>{{ scope.row.fname }}</span>
  518. </template>
  519. </el-table-column>
  520. <el-table-column label="设计重量(KG)" min-width="130px" align="center">
  521. <template slot-scope="scope">
  522. <span v-if="scope.row.NoEdit">{{ scope.row.weight }}</span>
  523. <el-input v-if="scope.row.Edit" v-model="scope.row.weight" type="number" maxlength="32" style="width:95%;padding:10px 0;" />
  524. </template>
  525. </el-table-column>
  526. <el-table-column label="操作" align="left" min-width="200" class-name="small-padding">
  527. <template slot-scope="{row}">
  528. <el-button v-if="row.isUpdate && isRoleEdit" :disabled="table3.getdataListParm.parammaps.havebutton == 1" class="miniSuccess" icon="el-icon-edit-outline" @click="handleUpdate3(row)" />
  529. <el-button v-if="row.isUpdateSave" :disabled="isokDisable" icon="el-icon-folder-checked" class="miniSuccess" @click="updateData3(row,'1')" />
  530. <span v-if="row.isUpdateSave" class="centerSpan">|</span>
  531. <el-button v-if="row.isUpdateSave" class="minCancel" icon="el-icon-close" @click="updateCancel3(row)" />
  532. <!-- <span v-if="row.isUpdate && isRoleEdit" class="centerSpan">|</span>
  533. <el-button v-if="row.isUpdate && isRoleEdit" class="miniSuccess" @click="handleRowEmpty(row,1)">
  534. <svg-icon icon-class="clear" />
  535. </el-button> -->
  536. </template>
  537. </el-table-column>
  538. </el-table>
  539. </div>
  540. </div>
  541. </el-col>
  542. </el-row>
  543. </div>
  544. <!-- 撒料计划-撒料 -->
  545. <div v-if="table3.getdataListParm.parammaps.lpplantype == 2" class="content">
  546. <el-row :gutter="20">
  547. <el-col :span="12">
  548. <div class="table3">
  549. <div class="contentOperation">
  550. <p>栏舍详情</p>
  551. </div>
  552. <div class="content-table">
  553. <el-table
  554. :key="table3.tableKey"
  555. v-loading="table3.listLoading"
  556. element-loading-text="给我一点时间"
  557. :data="table3.list"
  558. height="450"
  559. fit
  560. border
  561. highlight-current-row
  562. style="width: 100%;"
  563. :row-style="rowStyle"
  564. :cell-style="cellStyle"
  565. class="elTable table-fixed"
  566. >
  567. <el-table-column label="操作序号" min-width="90px" align="center">
  568. <template slot-scope="scope">
  569. <span>{{ scope.row.sort }}</span>
  570. </template>
  571. </el-table-column>
  572. <el-table-column label="撒料车辆" min-width="90px" align="center">
  573. <template slot-scope="scope">
  574. <span>{{ scope.row.fname }}</span>
  575. </template>
  576. </el-table-column>
  577. <el-table-column label="设计重量(KG)" min-width="130px" align="center">
  578. <template slot-scope="scope">
  579. <span v-if="scope.row.NoEdit">{{ scope.row.weight }}</span>
  580. <el-input v-if="scope.row.Edit" v-model="scope.row.weight" type="number" maxlength="32" style="width:95%;padding:10px 0;" />
  581. </template>
  582. </el-table-column>
  583. <el-table-column label="小计" prop="description" min-width="90px" align="center">
  584. <template slot-scope="scope">
  585. <span>{{ scope.row.subtotal }}</span>
  586. </template>
  587. </el-table-column>
  588. <el-table-column label="操作" align="left" min-width="200" class-name="small-padding">
  589. <template slot-scope="{row}">
  590. <el-button v-if="row.isUpdate && isRoleEdit" :disabled="table3.getdataListParm.parammaps.havebutton == 1" class="miniSuccess" icon="el-icon-edit-outline" @click="handleUpdate3(row)" />
  591. <el-button v-if="row.isUpdateSave" :disabled="isokDisable" icon="el-icon-folder-checked" class="miniSuccess" @click="updateData3(row,'0')" />
  592. <span v-if="row.isUpdateSave" class="centerSpan">|</span>
  593. <el-button v-if="row.isUpdateSave" class="minCancel" icon="el-icon-close" @click="updateCancel3(row)" />
  594. <!-- <span v-if="row.isUpdate && isRoleEdit" class="centerSpan">|</span>
  595. <el-button v-if="row.isUpdate && isRoleEdit" class="miniSuccess" @click="handleRowEmpty(row,0)">
  596. <svg-icon icon-class="clear" />
  597. </el-button> -->
  598. </template>
  599. </el-table-column>
  600. </el-table>
  601. </div>
  602. </div>
  603. </el-col>
  604. <el-col :span="12">
  605. <div class="table2">
  606. <div class="contentOperation">
  607. <p>计划详情</p>
  608. </div>
  609. <div class="content-table">
  610. <el-table
  611. :key="table2.tableKey"
  612. v-loading="table2.listLoading"
  613. element-loading-text="给我一点时间"
  614. :data="table2.list"
  615. fit
  616. border
  617. highlight-current-row
  618. style="width: 100%;"
  619. height="450"
  620. :row-style="rowStyle"
  621. :cell-style="cellStyle"
  622. class="elTable table-fixed"
  623. >
  624. <el-table-column label="操作序号" min-width="90px" align="center">
  625. <template slot-scope="scope">
  626. <span>{{ scope.row.sort }}</span>
  627. </template>
  628. </el-table-column>
  629. <!-- <el-table-column label="栏舍编码" min-width="60px" align="center" prop="bcode" /> -->
  630. <el-table-column label="栏舍名称" prop="fname" min-width="90px" align="center">
  631. <template slot-scope="scope">
  632. <span>{{ scope.row.fname }}</span>
  633. </template>
  634. </el-table-column>
  635. <el-table-column label="栏舍长度" min-width="60px" align="center" prop="length" />
  636. <el-table-column label="设计重量(KG)" prop="weight" width="130px" align="center">
  637. <template slot-scope="scope">
  638. <span v-if="scope.row.NoEdit">{{ scope.row.weight }}</span>
  639. <el-input v-if="scope.row.Edit" v-model="scope.row.weight" type="number" maxlength="32" style="width:95%;padding:10px 0;" />
  640. </template>
  641. </el-table-column>
  642. <!-- <el-table-column label="数量" min-width="60px" align="center" prop="ccount" /> -->
  643. <el-table-column label="使用档位" min-width="60px" align="center" prop="gear" />
  644. <el-table-column label="车行速度" min-width="60px" align="center" prop="speed" />
  645. <el-table-column label="操作" align="left" min-width="200" class-name="small-padding">
  646. <template slot-scope="{row}">
  647. <el-button v-if="row.isUpdate && isRoleEdit" :disabled="table2.getdataListParm.parammaps.havebutton == 1" class="miniSuccess" icon="el-icon-edit-outline" @click="handleUpdate2(row)" />
  648. <el-button v-if="row.isUpdateSave" :disabled="isokDisable" icon="el-icon-folder-checked" class="miniSuccess" @click="updateData2(row,'1')" />
  649. <span v-if="row.isUpdateSave" class="centerSpan">|</span>
  650. <el-button v-if="row.isUpdateSave" class="minCancel" icon="el-icon-close" @click="updateCancel2(row)" />
  651. <!-- <span v-if="row.isUpdate && isRoleEdit" class="centerSpan">|</span>
  652. <el-button v-if="row.isUpdate && isRoleEdit" class="miniSuccess" @click="handleRowEmpty(row,1)">
  653. <svg-icon icon-class="clear" />
  654. </el-button> -->
  655. </template>
  656. </el-table-column>
  657. </el-table>
  658. </div>
  659. </div>
  660. </el-col>
  661. </el-row>
  662. </div>
  663. </div>
  664. <!-- 新生成 -->
  665. <el-dialog :title="textMap[newGeneration.dialogStatus]" :destroy-on-close="true" :visible.sync="newGeneration.dialogFormVisible" :close-on-click-modal="false" width="30%">
  666. <div class="newGeneration" v-loading="newGenerationLoading" >
  667. <el-form ref="temp" :rules="newGeneration.rules" :model="newGeneration.temp" label-position="right" label-width="100px" style="width: 100%;margin:0 auto 50px">
  668. <el-row v-if="newGeneration.dialogStatus== 'newGeneration'">
  669. <el-col :span="24">
  670. <el-form-item label="时间范围:" prop="inputDatetime">
  671. <el-date-picker v-model="newGeneration.temp.inputDatetime" class="inputDatetime filter-item" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" style="width: 100%;" :clearable="false" :picker-options="pickerOptions2" />
  672. </el-form-item>
  673. </el-col>
  674. </el-row>
  675. <el-row v-else>
  676. <el-col :span="24">
  677. <el-form-item label="时间范围:" prop="copyInputDatetime">
  678. <el-date-picker v-model="newGeneration.temp.copyInputDatetime" :picker-options="pickerOptions" class="inputDatetime filter-item" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" style="width: 100%;" :clearable="false" />
  679. </el-form-item>
  680. </el-col>
  681. </el-row>
  682. <p v-if="newGeneration.temp.tips == true || newGeneration.dialogStatus == 'copy'" style="font-weight: 700;color: red;text-align: center;">注:撒料计划中存在未分配完栏舍,如下所示;建议及时进行分配</p>
  683. <div style="height: 200px;overflow: auto;">
  684. <div v-if="myMaxTimes == 1">
  685. <div>第一班:</div>
  686. <div v-for="(item,index) in tipsList.one" :key="index+'A'" >
  687. <b v-if="item.arrList !== null && item.arrList !== undefined && item.arrList.length>0">{{item.ftname}}:</b>
  688. <span v-if="item.arrList !== null && item.arrList !== undefined && item.arrList.length>0">
  689. <span v-for="(item2,index2) in item.arrList" :key="index2+'a'">
  690. {{item2.barname}}
  691. </span>
  692. </span>
  693. </div>
  694. </div>
  695. <div v-else-if="myMaxTimes == 2">
  696. <div>第一班:</div>
  697. <div v-for="(item,index) in tipsList.one" :key="index+'B'" >
  698. <b v-if="item.arrList !== null && item.arrList !== undefined && item.arrList.length>0">{{item.ftname}}:</b>
  699. <span v-if="item.arrList !== null && item.arrList !== undefined && item.arrList.length>0">
  700. <span v-for="(item2,index2) in item.arrList" :key="index2+'b'">
  701. {{item2.barname}}
  702. </span>
  703. </span>
  704. </div>
  705. <div>第二班:</div>
  706. <div v-for="(item,index) in tipsList.two" :key="index+'C'" >
  707. <b v-if="item.arrList !== null && item.arrList !== undefined && item.arrList.length>0">{{item.ftname}}:</b>
  708. <span v-if="item.arrList !== null && item.arrList !== undefined && item.arrList.length>0">
  709. <span v-for="(item2,index2) in item.arrList" :key="index2+'c'">
  710. {{item2.barname}}
  711. </span>
  712. </span>
  713. </div>
  714. </div>
  715. <div v-else-if="myMaxTimes == 3">
  716. <div>第一班:</div>
  717. <div v-for="(item,index) in tipsList.one" :key="index+'D'" >
  718. <b v-if="item.arrList !== null && item.arrList !== undefined && item.arrList.length>0">{{item.ftname}}:</b>
  719. <span v-if="item.arrList !== null && item.arrList !== undefined && item.arrList.length>0">
  720. <span v-for="(item2,index2) in item.arrList" :key="index2+'d'">
  721. {{item2.barname}}
  722. </span>
  723. </span>
  724. </div>
  725. <div>第二班:</div>
  726. <div v-for="(item,index) in tipsList.two" :key="index+'E'" >
  727. <b v-if="item.arrList !== null && item.arrList !== undefined && item.arrList.length>0">{{item.ftname}}:</b>
  728. <span v-if="item.arrList !== null && item.arrList !== undefined && item.arrList.length>0">
  729. <span v-for="(item2,index2) in item.arrList" :key="index2+'e'">
  730. {{item2.barname}}
  731. </span>
  732. </span>
  733. </div>
  734. <div>第三班:</div>
  735. <div v-for="(item,index) in tipsList.three" :key="index+'F'" >
  736. <b v-if="item.arrList !== null && item.arrList !== undefined && item.arrList.length>0">{{item.ftname}}:</b>
  737. <span v-if="item.arrList !== null && item.arrList !== undefined && item.arrList.length>0">
  738. <span v-for="(item2,index2) in item.arrList" :key="index2+'f'">
  739. {{item2.barname}}
  740. </span>
  741. </span>
  742. </div>
  743. </div>
  744. <div v-else>
  745. <div>第一班:</div>
  746. <div v-for="(item,index) in tipsList.one" :key="index+'G'" >
  747. <b v-if="item.arrList !== null && item.arrList !== undefined && item.arrList.length>0">{{item.ftname}}:</b>
  748. <span v-if="item.arrList !== null && item.arrList !== undefined && item.arrList.length>0">
  749. <span v-for="(item2,index2) in item.arrList" :key="index2+'g'">
  750. {{item2.barname}}
  751. </span>
  752. </span>
  753. </div>
  754. <div>第二班:</div>
  755. <div v-for="(item,index) in tipsList.two" :key="index+'H'" >
  756. <b v-if="item.arrList !== null && item.arrList !== undefined && item.arrList.length>0">{{item.ftname}}:</b>
  757. <span v-if="item.arrList !== null && item.arrList !== undefined && item.arrList.length>0">
  758. <span v-for="(item2,index2) in item.arrList" :key="index2+'h'">
  759. {{item2.barname}}
  760. </span>
  761. </span>
  762. </div>
  763. <div>第三班:</div>
  764. <div v-for="(item,index) in tipsList.three" :key="index+'I'" >
  765. <b v-if="item.arrList !== null && item.arrList !== undefined && item.arrList.length>0">{{item.ftname}}:</b>
  766. <span v-if="item.arrList !== null && item.arrList !== undefined && item.arrList.length>0">
  767. <span v-for="(item2,index2) in item.arrList" :key="index2+'i'">
  768. {{item2.barname}}
  769. </span>
  770. </span>
  771. </div>
  772. <div>第四班:</div>
  773. <div v-for="(item,index) in tipsList.four" :key="index+'J'" >
  774. <b v-if="item.arrList !== null && item.arrList !== undefined && item.arrList.length>0">{{item.ftname}}:</b>
  775. <span v-if="item.arrList !== null && item.arrList !== undefined && item.arrList.length>0">
  776. <span v-for="(item2,index2) in item.arrList" :key="index2+'j'">
  777. {{item2.barname}}
  778. </span>
  779. </span>
  780. </div>
  781. </div>
  782. </div>
  783. </el-form>
  784. <div slot="footer" class="dialog-footer" style="bottom:20px">
  785. <el-button class="cancelClose" @click="newGeneration.dialogFormVisible = false;getList()">取消</el-button>
  786. <el-button v-if="newGeneration.dialogStatus== 'newGeneration'" class="save" :disabled="isokDisable" @click="newGenerationData()">确认</el-button>
  787. <el-button v-else class="save" :disabled="isokDisable" @click="copyData()">确认</el-button>
  788. </div>
  789. </div>
  790. </el-dialog>
  791. <!-- 历史记录 -->
  792. <el-dialog :fullscreen="dialogFull" :destroy-on-close="true" :visible.sync="historyRecord.dialogFormVisible" :close-on-click-modal="false" width="90%">
  793. <template slot="title">
  794. <div class="avue-crud__dialog__header">
  795. <span class="el-dialog__title">
  796. <span style="display:inline-block;width:3px;height:20px;margin-right:5px; float: left;margin-top:2px" />
  797. {{ textMap[historyRecord.dialogStatus] }}
  798. </span>
  799. <div class="avue-crud__dialog__menu" @click="dialogFull? dialogFull=false: dialogFull=true">
  800. <svg-icon v-if="dialogFull" icon-class="exit-fullscreen" />
  801. <svg-icon v-else icon-class="fullscreen" />
  802. </div>
  803. </div>
  804. </template>
  805. <div class="historyRecord">
  806. <keep-alive>
  807. <component :is="historyRecord.myComponent" ref="historyRecord" />
  808. </keep-alive>
  809. </div>
  810. <div slot="footer" class="dialog-footer">
  811. <el-button class="cancelClose cancelClose1" @click="historyRecord.dialogFormVisible = false; ">关闭</el-button>
  812. </div>
  813. </el-dialog>
  814. <!-- 正在同步中 -->
  815. <el-dialog :destroy-on-close="true" :visible.sync="dataSynchronization.dialogFormVisible" :close-on-click-modal="false" width="30%">
  816. <div class="dataSynchronization" style="text-align: center;font-size: 18px;">
  817. <i class="el-icon-loading" />
  818. <span>正在同步</span>
  819. <div slot="footer" class="dialog-footer" style="bottom:10px">
  820. <el-button class="miniPrimary" @click="dataSynchronization.dialogFormVisible = false;">确认</el-button>
  821. </div>
  822. </div>
  823. </el-dialog>
  824. <!-- 修改计划 -->
  825. <RevisePlan :show.sync="isShowDialog" :parent-active-name="activeName" :parent-date="parentDate" />
  826. <!-- 删除记录 -->
  827. <el-dialog :title="textMap[deleteRecord.dialogStatus]" :destroy-on-close="true" :visible.sync="deleteRecord.dialogFormVisible" :close-on-click-modal="false" width="90%">
  828. <div class="deleteRecord">
  829. <div class="search">
  830. <el-date-picker v-model="deleteRecord.mydate" type="date" placeholder="选择日期" style="width: 150px;" format="yyyy-MM-dd" value-format="yyyy-MM-dd" :clearable="false" @change="changeDeleteRecordDate" />
  831. </div>
  832. <div class="table">
  833. <el-table
  834. :key="deleteRecord.tableKey"
  835. v-loading="deleteRecord.listLoading"
  836. element-loading-text="给我一点时间"
  837. :data="deleteRecord.list"
  838. border
  839. fit
  840. highlight-current-row
  841. style="width: 98%;"
  842. row-key="sort"
  843. :row-style="rowStyle"
  844. :cell-style="cellStyle"
  845. class="elTable table-fixed"
  846. :height="370"
  847. >
  848. <el-table-column label="序号" align="center" prop="sort" width="50px" />
  849. <el-table-column label="计划名称" min-width="90px" align="center" prop="projname" />
  850. <el-table-column label="计划类型" prop="weight" min-width="90px" align="center" :formatter="lpplantype" />
  851. <el-table-column label="TMR编号" min-width="90px" align="center" prop="tmrtname" />
  852. <el-table-column label="驾驶员" min-width="90px" align="center" prop="driver" />
  853. <el-table-column label="已执行" min-width="70px" align="center">
  854. <template slot-scope="scope">
  855. <span v-if="scope.row.havebutton == 0">否</span>
  856. <span v-else>是</span>
  857. </template>
  858. </el-table-column>
  859. <el-table-column label="班次" min-width="80px" align="center" prop="times" />
  860. <el-table-column label="理论量" min-width="80px" align="center" prop="lweight" />
  861. <el-table-column label="启用" min-width="70px" align="center">
  862. <template slot-scope="scope">
  863. <el-switch v-if="dataDisabled == false" disabled v-model="scope.row.enable" active-color="#13ce66" inactive-color="#ff4949" :active-value="1" :inactive-value="0" @change="handleEnableChange(scope.row)" />
  864. <el-switch v-else v-model="scope.row.enable" disabled active-color="#13ce66" inactive-color="#ff4949" :active-value="1" :inactive-value="0" @change="handleEnableChange(scope.row)" />
  865. </template>
  866. </el-table-column>
  867. <el-table-column label="时间" min-width="80px" align="center" prop="plantime" />
  868. <el-table-column label="配方名称" min-width="100px" align="center" prop="ftname" />
  869. <el-table-column label="头数" min-width="80px" align="center" prop="cowcount" />
  870. <el-table-column label="描述" min-width="80px" align="center" prop="display" />
  871. <el-table-column label="发料位" min-width="80px" align="left" prop="barnames" />
  872. </el-table>
  873. <span v-if="deleteRecord.listLoading == false" style="margin-right: 30px;margin-top: 10px;font-size: 14px;">共{{ deleteRecord.total }}条</span>
  874. </div>
  875. <div slot="footer" class="dialog-footer" style="bottom:20px">
  876. <el-button class="cancelClose1" @click="deleteRecord.dialogFormVisible = false;getList()">取消</el-button>
  877. </div>
  878. </div>
  879. </el-dialog>
  880. <el-dialog :title="textMap[sapUpload.dialogStatus]" :destroy-on-close="true" :visible.sync="sapUpload.dialogFormVisible" :close-on-click-modal="false" width="30%">
  881. <div class="sapUpload">
  882. <el-form ref="sapUpload" :rules="sapUpload.rules" :model="sapUpload.temp" label-position="right" label-width="100px" style="width: 100%;margin:0 auto 50px">
  883. <el-row>
  884. <el-col :span="24">
  885. <el-form-item label="时间:" prop="date">
  886. <el-date-picker v-model="sapUpload.temp.date" :clearable="false" class="filter-item" type="date" />
  887. </el-form-item>
  888. </el-col>
  889. </el-row>
  890. </el-form>
  891. <div slot="footer" class="dialog-footer" style="bottom:20px">
  892. <el-button class="cancelClose" @click="sapUpload.dialogFormVisible = false;getList()">取消</el-button>
  893. <el-button class="save" v-if="sapUpload.dialogStatus == 'sapUpload'" :disabled="isokDisable" @click="sapUploadData()">确认</el-button>
  894. <el-button class="save" v-else-if="sapUpload.dialogStatus == 'udload1'" :disabled="isokDisable" @click="udData1()">确认</el-button>
  895. <el-button class="save" v-else-if="sapUpload.dialogStatus == 'udload2'" :disabled="isokDisable" @click="udData2()">确认</el-button>
  896. <el-button class="save" v-else-if="sapUpload.dialogStatus == 'udload3'" :disabled="isokDisable" @click="udData3()">确认</el-button>
  897. </div>
  898. </div>
  899. </el-dialog>
  900. </div>
  901. </template>
  902. <script>
  903. import { GetDataByName, GetDataByNames, ExecDataByConfig, PostDataByName, getDorm, GetReportform, checkButtons,postJson,postJson2,SyncSCJH } from '@/api/common'
  904. import RevisePlan from './revisePlan.vue'
  905. import printJS from 'print-js'
  906. import { parseTime, json2excel,handleTableSpan, handleObjectSpanMethod } from '@/utils/index.js'
  907. import Cookies from 'js-cookie'
  908. import Sortable from 'sortablejs'
  909. import { MessageBox } from 'element-ui'
  910. export default {
  911. name: 'DailyExecutionPlan',
  912. components: {
  913. RevisePlan
  914. },
  915. data() {
  916. return {
  917. myheight: document.documentElement.clientHeight - 280,
  918. // myheight: 500,
  919. enlargeHeight: document.documentElement.clientHeight - 85 - 165 + 50,
  920. isDetail:false,
  921. newGenerationLoading:false,
  922. dialogFull: false,
  923. isRoleEdit: [],
  924. dataDisabled: false,
  925. requestParams: [
  926. // { name: 'getDictByName', offset: 0, pagecount: 0, params: ['牲畜父类'] }
  927. ],
  928. planTypeList: [{ lable: '预混计划', value: '4' }, { lable: '撒料计划', value: '0' },
  929. // { lable: '剩料计划', value: '3' },
  930. { lable: '撒料计划-混料', value: '1' }, { lable: '撒料计划-撒料', value: '2' }, { lable: '预称重计划', value: '5' }], // 计划类型
  931. printingTypeList: [{ lable: '精料', value: '1' }, { lable: '铲车', value: '2' }], // 打印类型
  932. frequencyList: [], // 班次
  933. planningDimensionList: [{ lable: '发料顺序', value: '0' }, { lable: 'TMR', value: '1' }], // 发料顺序
  934. exportTypeList: [{ lable: '投料简打', value: '0' }, { lable: '累加投料', value: '1' }, { lable: '撒料简打', value: '2' }, { lable: '投撒料简打', value: '3' }, { lable: '投撒料累加', value: '4' }, { lable: '包装简打', value: '5' }, { lable: '实发简打', value: '6' }], // 导出类型
  935. iscompletedList: [{ lable: '是', value: '1' },{ lable: '否', value: '0' } ],
  936. // 班次
  937. maxTime: {
  938. getMaxTimesParm: {
  939. name: 'getSysoptEnable',
  940. page: 1,
  941. offset: 1,
  942. pagecount: 1,
  943. returntype: 'Map',
  944. parammaps: {
  945. pastureid: Cookies.get('pastureid'),
  946. inforname: 'times'
  947. }
  948. }
  949. },
  950. isOrder: true,
  951. table: {
  952. getdataListParm: {
  953. name: 'getDownloadedplanList',
  954. page: 1,
  955. offset: 1,
  956. pagecount: '',
  957. returntype: 'Map',
  958. parammaps: {
  959. pastureid: Cookies.get('pastureid'),
  960. barid: '',
  961. mydate: parseTime(new Date(), '{y}-{m}-{d}'),
  962. times: '',
  963. lpplantype: '',
  964. printType: '',
  965. plandimen: '0',
  966. enable3: '0',
  967. iscompleted:"",
  968. tmrname:"",
  969. }
  970. },
  971. tableKey: 0,
  972. list: [],
  973. total: 0,
  974. listLoading: false
  975. },
  976. // 计划内容操作详情
  977. table2: {
  978. getdataListParm: {
  979. name: 'getDownloadplandtl1ListV2',
  980. page: 1,
  981. offset: 1,
  982. returntype: 'Map',
  983. parammaps: {
  984. pastureid: Cookies.get('pastureid'),
  985. date: '',
  986. id: ''
  987. }
  988. },
  989. tableKey: 0,
  990. list: [],
  991. total: 0,
  992. listLoading: false
  993. },
  994. // 计划内容 舍栏详情
  995. table3: {
  996. getdataListParm: {
  997. name: 'getDownloadplandt2ListV2',
  998. page: 1,
  999. offset: 1,
  1000. returntype: 'Map',
  1001. parammaps: {
  1002. pastureid: Cookies.get('pastureid'),
  1003. date: '',
  1004. id: ''
  1005. }
  1006. },
  1007. tableKey: 0,
  1008. list: [],
  1009. total: 0,
  1010. listLoading: false
  1011. },
  1012. // 新生成
  1013. newGeneration: {
  1014. dialogFormVisible: false,
  1015. dialogStatus: '',
  1016. getdataListParm: {
  1017. name: 'checkLLPIsDistribution',
  1018. page: 1,
  1019. offset: 1,
  1020. pagecount: 1,
  1021. returntype: 'Map',
  1022. parammaps: {
  1023. pastureid: Cookies.get('pastureid')
  1024. }
  1025. },
  1026. temp: {
  1027. inputDatetime: [parseTime(new Date(), '{y}-{m}-{d}'), parseTime(new Date(), '{y}-{m}-{d}')],
  1028. tips:''
  1029. },
  1030. rules: {
  1031. inputDatetime: [{ type: 'array', required: true, message: '必填', trigger: 'blur' }],
  1032. copyInputDatetime: [{ type: 'array', required: true, message: '必填', trigger: 'blur' }]
  1033. }
  1034. },
  1035. pickerMinDate: '',
  1036. pickerOptions: {
  1037. onPick: ({ maxDate, minDate }) => {
  1038. this.pickerMinDate = minDate.getTime()
  1039. if (maxDate) {
  1040. this.pickerMinDate = ''
  1041. }
  1042. },
  1043. disabledDate: (time) => {
  1044. if (this.pickerMinDate !== '') {
  1045. const one = 31 * 24 * 3600 * 1000
  1046. const minTime = this.pickerMinDate
  1047. const maxTime = this.pickerMinDate + one
  1048. return time.getTime() < minTime || time.getTime() > maxTime - 8.64e7
  1049. }
  1050. return time.getTime() < Date.now() - 8.64e7
  1051. }
  1052. },
  1053. pickerOptions2: {
  1054. onPick: ({ maxDate, minDate }) => {
  1055. this.pickerMinDate = minDate.getTime()
  1056. if (maxDate) {
  1057. this.pickerMinDate = ''
  1058. }
  1059. },
  1060. disabledDate: (time) => {
  1061. if (this.pickerMinDate !== '') {
  1062. const one = 14 * 24 * 3600 * 1000
  1063. const minTime = this.pickerMinDate
  1064. const maxTime = this.pickerMinDate + one
  1065. return time.getTime() < minTime || time.getTime() > maxTime - 8.64e7
  1066. }
  1067. return time.getTime() < Date.now() - 8.64e7
  1068. }
  1069. },
  1070. historyRecord: {
  1071. dialogFormVisible: false,
  1072. dialogStatus: '',
  1073. myComponent: null
  1074. },
  1075. dataSynchronization: {
  1076. dialogFormVisible: false,
  1077. dialogStatus: '',
  1078. getdataListParm: {
  1079. name: 'getSysoptEnable',
  1080. page: 1,
  1081. offset: 1,
  1082. pagecount: 1,
  1083. returntype: 'Map',
  1084. parammaps: {
  1085. pastureid: Cookies.get('pastureid'),
  1086. inforname: 'isDataSync'
  1087. }
  1088. },
  1089. isDataSynchronization: false
  1090. },
  1091. dataSynchronization2: {
  1092. dialogFormVisible: false,
  1093. dialogStatus: '',
  1094. getdataListParm: {
  1095. name: 'getSysoptEnable',
  1096. page: 1,
  1097. offset: 1,
  1098. pagecount: 1,
  1099. returntype: 'Map',
  1100. parammaps: {
  1101. pastureid: Cookies.get('pastureid'),
  1102. inforname: 'zcSync'
  1103. }
  1104. },
  1105. isDataSynchronization: false
  1106. },
  1107. dataSynchronization3: {
  1108. dialogFormVisible: false,
  1109. dialogStatus: '',
  1110. getdataListParm: {
  1111. name: 'getSysoptEnable',
  1112. page: 1,
  1113. offset: 1,
  1114. pagecount: 1,
  1115. returntype: 'Map',
  1116. parammaps: {
  1117. pastureid: Cookies.get('pastureid'),
  1118. inforname: 'wgSap'
  1119. }
  1120. },
  1121. isDataSynchronization: false
  1122. },
  1123. textMap: {
  1124. newGeneration: '新生成',
  1125. historyRecord: '历史记录',
  1126. revisePlan: '修改计划',
  1127. copy: '复制计划',
  1128. deleteRecord:'删除记录',
  1129. sapUpload:'SAP上传',
  1130. udload1:'搅拌数据上传',
  1131. udload2:'剩料上传',
  1132. udload3:'撒料上传',
  1133. },
  1134. isokDisable: false,
  1135. requestParam: {},
  1136. rowStyle: { maxHeight: 30 + 'px', height: 30 + 'px' },
  1137. cellStyle: { padding: 0 + 'px' },
  1138. isShowDialog: false,
  1139. activeName: '栏舍配方',
  1140. parentDate: '',
  1141. downLoad: {
  1142. getdataListParm: {
  1143. name: '',
  1144. page: 1,
  1145. offset: 1,
  1146. pagecount: '',
  1147. returntype: 'Map',
  1148. parammaps: {
  1149. pastureid: Cookies.get('pastureid'),
  1150. date: ''
  1151. }
  1152. },
  1153. list: [],
  1154. labelList: []
  1155. },
  1156. tmrDownList:[],
  1157. getTmrListParam: {
  1158. name: 'getDownloadedplanTmrNameUnfinished',
  1159. page: 1,
  1160. offset: 1,
  1161. pagecount: 10,
  1162. returntype: 'Map',
  1163. parammaps: {
  1164. pastureid: Cookies.get('pastureid'),
  1165. mydate: parseTime(new Date(), '{y}-{m}-{d}')
  1166. }
  1167. },
  1168. myMaxTimes:'',
  1169. tipsList:[],
  1170. spanObj: {},
  1171. mergekeys: ['sort', 'description'],
  1172. deleteRecord:{
  1173. dialogFormVisible: false,
  1174. dialogStatus: '',
  1175. total:0,
  1176. tableKey:0,
  1177. listLoading:false,
  1178. list:[],
  1179. mydate: parseTime(new Date(), '{y}-{m}-{d}')
  1180. },
  1181. selectList: [],
  1182. driverList:[],
  1183. sapUpload:{
  1184. dialogFormVisible: false,
  1185. dialogStatus: '',
  1186. temp:{
  1187. date: parseTime(new Date(), '{y}-{m}-{d}')
  1188. },
  1189. rules: {
  1190. date: [{ required: true, message: '必填', trigger: 'blur' }],
  1191. },
  1192. getdataListParm: {
  1193. name: 'getSysoptEnable',
  1194. page: 1,
  1195. offset: 1,
  1196. pagecount: 1,
  1197. returntype: 'Map',
  1198. parammaps: {
  1199. pastureid: Cookies.get('pastureid'),
  1200. inforname: 'xdmysapupload'
  1201. }
  1202. },
  1203. isSap: false,
  1204. },
  1205. ispalyUd: false
  1206. }
  1207. },
  1208. created() {
  1209. this.getIspalyUd()
  1210. this.parentDate = this.table.getdataListParm.parammaps.mydate
  1211. console.log(this.parentDate, 'this.parentDate')
  1212. this.getDataSynchronization()
  1213. this.getDataSynchronization2()
  1214. this.getDataSynchronization3()
  1215. this.getButtons()
  1216. this.getList()
  1217. this.getDownList()
  1218. this.getIsDisplay()
  1219. this.getIsSap()
  1220. this.getTMRList()
  1221. this.getDriverList()
  1222. },
  1223. mounted() {
  1224. this.getTmrListParam.parammaps.mydate = parseTime(new Date(), '{y}-{m}-{d}')
  1225. },
  1226. methods: {
  1227. getDriverList(){
  1228. const url = 'authdata/GetDataByName'
  1229. const data = {
  1230. "name":"getDriverList",
  1231. "page":1,"offset":1,"pagecount":50,
  1232. "returntype":"Map",
  1233. "parammaps":{"pastureid":Cookies.get('pastureid')}
  1234. }
  1235. postJson(url, data).then(response => {
  1236. if(response.data !== null){
  1237. this.driverList = response.data.list
  1238. }else{
  1239. this.driverList = []
  1240. }
  1241. })
  1242. },
  1243. getTMRList(){
  1244. this.getTmrListParam.parammaps.mydate = this.table.getdataListParm.parammaps.mydate
  1245. GetDataByName(this.getTmrListParam).then(response => {
  1246. if (response.data.list !== null) {
  1247. this.tmrDownList = response.data.list
  1248. }
  1249. })
  1250. },
  1251. getButtons() {
  1252. const Edit = 'DailyExecutionPlan'
  1253. const isRoleEdit = checkButtons(JSON.parse(sessionStorage.getItem('buttons')), Edit)
  1254. this.isRoleEdit = isRoleEdit
  1255. },
  1256. getDataSynchronization() {
  1257. GetDataByName(this.dataSynchronization.getdataListParm).then(response => {
  1258. // console.log(response.data.list[0])
  1259. if(response.data.list !== null){
  1260. if (response.data.list[0].inforvalue == 0) {
  1261. this.dataSynchronization.isDataSynchronization = false
  1262. } else {
  1263. this.dataSynchronization.isDataSynchronization = true
  1264. }
  1265. }
  1266. })
  1267. },
  1268. getDataSynchronization2() {
  1269. GetDataByName(this.dataSynchronization2.getdataListParm).then(response => {
  1270. if(response.data.list !== null){
  1271. if (response.data.list[0].inforvalue == 0) {
  1272. this.dataSynchronization2.isDataSynchronization = false
  1273. } else {
  1274. this.dataSynchronization2.isDataSynchronization = true
  1275. }
  1276. }
  1277. })
  1278. },
  1279. getDataSynchronization3() {
  1280. GetDataByName(this.dataSynchronization3.getdataListParm).then(response => {
  1281. // console.log(response.data.list[0])
  1282. if (response.data.list[0].inforvalue == 0) {
  1283. this.dataSynchronization3.isDataSynchronization = false
  1284. } else {
  1285. this.dataSynchronization3.isDataSynchronization = true
  1286. }
  1287. })
  1288. },
  1289. form_updata() {
  1290. var send_data = {
  1291. name: 'syncSCJH',
  1292. page: 1,
  1293. offset: 1,
  1294. pagecount: 1,
  1295. returntype: 'Map',
  1296. parammaps: {
  1297. // pastureid: Cookies.get('pastureid'),
  1298. // inforname: 'isDataSync'
  1299. }
  1300. }
  1301. SyncSCJH(send_data).then(response => {
  1302. if (response.msg === 'fail') {
  1303. this.$notify({ title: '上传失败', message: response.data, type: 'warning', duration: 2000 })
  1304. } else {
  1305. this.$notify({ title: '成功', message: '上传成功', type: 'success', duration: 2000 })
  1306. }
  1307. })
  1308. },
  1309. getIsDisplay() {
  1310. GetDataByName(this.maxTime.getMaxTimesParm).then(response => {
  1311. console.log(response.data.list[0].inforvalue)
  1312. this.myMaxTimes = response.data.list[0].inforvalue
  1313. if (response.data.list[0].inforvalue == 1) {
  1314. this.frequencyList = [{ id: '1', name: '第一班' }]
  1315. } else if (response.data.list[0].inforvalue == 2) {
  1316. this.frequencyList = [{ id: '1', name: '第一班' }, { id: '2', name: '第二班' }]
  1317. } else if (response.data.list[0].inforvalue == 3) {
  1318. this.frequencyList = [{ id: '1', name: '第一班' }, { id: '2', name: '第二班' }, { id: '3', name: '第三班' }]
  1319. } else if (response.data.list[0].inforvalue == 4) {
  1320. this.frequencyList = [{ id: '1', name: '第一班' }, { id: '2', name: '第二班' }, { id: '3', name: '第三班' }, { id: '4', name: '第四班' }]
  1321. } else if (response.data.list[0].inforvalue == 5) {
  1322. this.frequencyList = [{ id: '1', name: '第一班' }, { id: '2', name: '第二班' }, { id: '3', name: '第三班' }, { id: '4', name: '第四班' }, { id: '5', name: '第五班' }]
  1323. } else if (response.data.list[0].inforvalue == 6) {
  1324. this.frequencyList = [{ id: '1', name: '第一班' }, { id: '2', name: '第二班' }, { id: '3', name: '第三班' }, { id: '4', name: '第四班' }, { id: '5', name: '第五班' }, { id: '6', name: '第六班' }]
  1325. }
  1326. })
  1327. },
  1328. getDownList() {
  1329. GetDataByNames(this.requestParams).then(response => {
  1330. // this.livestockTypeList = response.data.getDictByName.list
  1331. })
  1332. },
  1333. // -------------------日执行计划-----------------------------
  1334. handleBefore() {
  1335. if (this.table.getdataListParm.parammaps.mydate !== '' && this.table.getdataListParm.parammaps.mydate !== null) {
  1336. this.table.getdataListParm.parammaps.mydate = new Date(this.table.getdataListParm.parammaps.mydate)
  1337. var start = new Date(this.table.getdataListParm.parammaps.mydate.setDate(this.table.getdataListParm.parammaps.mydate.getDate() - 1))
  1338. // var start = this.table.getdataListParm.parammaps.mydate - 1
  1339. this.table.getdataListParm.parammaps.mydate = parseTime(start, '{y}-{m}-{d}')
  1340. // this.$forceUpdate()
  1341. this.parentDate = this.table.getdataListParm.parammaps.mydate
  1342. this.getTMRList()
  1343. this.getList()
  1344. }
  1345. var d = this.table.getdataListParm.parammaps.mydate
  1346. var curDate = parseTime(new Date(), '{y}-{m}-{d}')
  1347. if (d < curDate) {
  1348. this.dataDisabled = true
  1349. } else {
  1350. this.dataDisabled = false
  1351. }
  1352. console.log(this.dataDisabled)
  1353. },
  1354. handleNext() {
  1355. if (this.table.getdataListParm.parammaps.mydate !== '' && this.table.getdataListParm.parammaps.mydate !== null) {
  1356. this.table.getdataListParm.parammaps.mydate = new Date(this.table.getdataListParm.parammaps.mydate)
  1357. var stop = new Date(this.table.getdataListParm.parammaps.mydate.setDate(this.table.getdataListParm.parammaps.mydate.getDate() + 1))
  1358. this.table.getdataListParm.parammaps.mydate = parseTime(stop, '{y}-{m}-{d}')
  1359. this.parentDate = this.table.getdataListParm.parammaps.mydate
  1360. this.getTMRList()
  1361. this.getList()
  1362. }
  1363. var d = this.table.getdataListParm.parammaps.mydate
  1364. var curDate = parseTime(new Date(), '{y}-{m}-{d}')
  1365. if (d < curDate) {
  1366. this.dataDisabled = true
  1367. } else {
  1368. this.dataDisabled = false
  1369. }
  1370. console.log(this.dataDisabled)
  1371. },
  1372. getList() {
  1373. this.table.listLoading = true
  1374. GetDataByName(this.table.getdataListParm).then(response => {
  1375. console.log('table数据', response.data.list)
  1376. if (response.data.list !== null) {
  1377. // var obj = { 'id': '580999', 'havebutton': '0', 'lpplantype': 2, 'pid': '3283220207862547456', 'times': '第二班', 'projname': '2.666' }
  1378. // response.data.list[6] = obj
  1379. this.getIsColor(response.data.list)
  1380. this.table.list = response.data.list
  1381. this.table.pageNum = response.data.pageNum
  1382. this.table.pageSize = response.data.pageSize
  1383. this.table.total = response.data.total
  1384. console.log('计划类型', response.data.list[0].lpplantype)
  1385. this.table2.getdataListParm.parammaps.havebutton = response.data.list[0].havebutton
  1386. this.table3.getdataListParm.parammaps.havebutton = response.data.list[0].havebutton
  1387. if (response.data.list[0].lpplantype == 0) {
  1388. // 撒料
  1389. this.table2.getdataListParm.name = 'getDownloadplandtl1ListV2'
  1390. this.table3.getdataListParm.name = 'getDownloadplandt2ListV2'
  1391. this.table2.getdataListParm.parammaps.useinbartype = ''
  1392. this.table3.getdataListParm.parammaps.useinbartype = ''
  1393. this.table2.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1394. this.table3.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1395. this.table2.getdataListParm.parammaps.id = response.data.list[0].id
  1396. this.table3.getdataListParm.parammaps.id = response.data.list[0].id
  1397. this.table2.getdataListParm.parammaps.tmrId = response.data.list[0].tmrid
  1398. this.table3.getdataListParm.parammaps.tmrId = response.data.list[0].tmrid
  1399. this.table3.getdataListParm.parammaps.lpplantype = response.data.list[0].lpplantype
  1400. this.table2.getdataListParm.parammaps.lpplantype = response.data.list[0].lpplantype
  1401. this.getList2()
  1402. this.getList3()
  1403. } else if (response.data.list[0].lpplantype == 1) {
  1404. // 撒料计划-混料
  1405. this.table2.getdataListParm.name = 'getDownloadplandtl1ListV2'
  1406. this.table3.getdataListParm.name = 'getDownloadplandt2ListV2'
  1407. this.table2.getdataListParm.parammaps.useinbartype = ''
  1408. this.table3.getdataListParm.parammaps.useinbartype = ''
  1409. this.table2.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1410. this.table3.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1411. this.table2.getdataListParm.parammaps.id = response.data.list[0].id
  1412. this.table3.getdataListParm.parammaps.id = response.data.list[0].id
  1413. this.table3.getdataListParm.parammaps.lpplantype = response.data.list[0].lpplantype
  1414. this.getList2()
  1415. this.getList3()
  1416. } else if (response.data.list[0].lpplantype == 2) {
  1417. // 撒料计划-撒料
  1418. this.table2.getdataListParm.name = 'getDownloadplandt2ListV2'
  1419. this.table3.getdataListParm.name = 'getDownloadplandtl1ListV2'
  1420. this.table2.getdataListParm.parammaps.useinbartype = ''
  1421. this.table3.getdataListParm.parammaps.useinbartype = ''
  1422. this.table2.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1423. this.table3.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1424. this.table2.getdataListParm.parammaps.id = response.data.list[0].id
  1425. this.table3.getdataListParm.parammaps.id = response.data.list[0].id
  1426. this.table3.getdataListParm.parammaps.lpplantype = response.data.list[0].lpplantype
  1427. this.table2.getdataListParm.parammaps.lpplantype = response.data.list[0].lpplantype
  1428. this.getList2()
  1429. this.getList3()
  1430. } else if (response.data.list[0].lpplantype == 3) {
  1431. // 剩料
  1432. this.table2.getdataListParm.name = 'getDownloadplandt2ListV2'
  1433. this.table3.getdataListParm.name = 'getDownloadplandt2ListV2'
  1434. this.table2.getdataListParm.parammaps.useinbartype = 0
  1435. this.table3.getdataListParm.parammaps.useinbartype = 1
  1436. this.table2.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1437. this.table3.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1438. this.table2.getdataListParm.parammaps.id = response.data.list[0].id
  1439. this.table3.getdataListParm.parammaps.id = response.data.list[0].id
  1440. this.table3.getdataListParm.parammaps.lpplantype = response.data.list[0].lpplantype
  1441. this.getList2()
  1442. this.getList3()
  1443. } else if (response.data.list[0].lpplantype == 4) {
  1444. // 预混
  1445. this.table2.getdataListParm.name = 'getDownloadplandtl1ListV2'
  1446. this.table2.getdataListParm.parammaps.useinbartype = ''
  1447. this.table3.getdataListParm.parammaps.useinbartype = ''
  1448. this.table2.getdataListParm.parammaps.id = response.data.list[0].id
  1449. this.table3.getdataListParm.parammaps.lpplantype = response.data.list[0].lpplantype
  1450. this.getList2()
  1451. } else if (response.data.list[0].lpplantype == 5) {
  1452. // 预称重计划
  1453. this.table2.getdataListParm.name = 'getDownloadplandtl1ListV2'
  1454. this.table3.getdataListParm.name = 'getDownloadplandt2ListV2'
  1455. this.table2.getdataListParm.parammaps.useinbartype = ''
  1456. this.table3.getdataListParm.parammaps.useinbartype = ''
  1457. this.table2.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1458. this.table3.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1459. this.table2.getdataListParm.parammaps.id = response.data.list[0].id
  1460. this.table3.getdataListParm.parammaps.id = response.data.list[0].id
  1461. this.table3.getdataListParm.parammaps.lpplantype = response.data.list[0].lpplantype
  1462. this.getList2()
  1463. this.getList3()
  1464. }
  1465. } else {
  1466. this.table.list = []
  1467. this.table3.getdataListParm.parammaps.lpplantype = ''
  1468. this.table2.getdataListParm.parammaps.id = ''
  1469. this.table3.getdataListParm.parammaps.id = ''
  1470. // this.getList2()
  1471. // this.getList3()
  1472. this.table2.list = []
  1473. this.table3.list = []
  1474. }
  1475. setTimeout(() => {
  1476. this.table.listLoading = false
  1477. }, 100)
  1478. })
  1479. },
  1480. form_search() {
  1481. this.getTMRList()
  1482. this.table.getdataListParm.offset = 1
  1483. this.getList()
  1484. },
  1485. handleEnableChange(row) {
  1486. this.requestParam.name = 'updatedownloadenable'
  1487. this.requestParam.parammaps = {}
  1488. this.requestParam.parammaps.pastureid = row.pastureid
  1489. this.requestParam.parammaps.id = row.id
  1490. this.requestParam.parammaps.enable = row.enable
  1491. PostDataByName(this.requestParam).then(response => {
  1492. if (response.msg === 'fail') {
  1493. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  1494. } else {
  1495. this.$notify({ title: '', message: '保存成功', type: 'success', duration: 2000 })
  1496. this.getList()
  1497. }
  1498. })
  1499. },
  1500. getIsColor(arr) {
  1501. var map = {}
  1502. var dest = []
  1503. for (var i = 0; i < arr.length; i++) {
  1504. var ai = arr[i]
  1505. if (!map[ai.pid]) {
  1506. dest.push({
  1507. pid: ai.pid,
  1508. data: [ai]
  1509. })
  1510. map[ai.pid] = ai
  1511. } else {
  1512. for (var j = 0; j < dest.length; j++) {
  1513. var dj = dest[j]
  1514. if (dj.pid == ai.pid) {
  1515. dj.data.push(ai)
  1516. break
  1517. }
  1518. }
  1519. }
  1520. }
  1521. console.log(dest)
  1522. var newArr1 = []
  1523. for (var i = 0; i < dest.length; i++) {
  1524. var newArr = dest[i].data
  1525. for (var j = 0; j < dest[i].data.length; j++) {
  1526. dest[i].data[j].isColor = i
  1527. newArr1.push(dest[i].data[j])
  1528. }
  1529. }
  1530. console.log(newArr1)
  1531. this.table.list = newArr1
  1532. },
  1533. tableRowClassName({ row }) {
  1534. if (row.isColor % 2 == 0) {
  1535. return 'warning-row'
  1536. } else {
  1537. return 'success-row'
  1538. }
  1539. },
  1540. lpplantype: function(cellValue) {
  1541. if (cellValue.lpplantype == 0) {
  1542. return '撒料计划'
  1543. } else if (cellValue.lpplantype == 1) {
  1544. return '撒料计划-混料'
  1545. } else if (cellValue.lpplantype == 2) {
  1546. return '撒料计划-撒料'
  1547. } else if (cellValue.lpplantype == 3) {
  1548. return '剩料计划'
  1549. } else if (cellValue.lpplantype == 4) {
  1550. return '预混计划'
  1551. } else if (cellValue.lpplantype == 5) {
  1552. return '预称重计划'
  1553. }
  1554. },
  1555. changeDate(val) {
  1556. console.log('选择了日期', val)
  1557. this.getList()
  1558. // this.getList2()
  1559. // this.getList3()
  1560. var d = this.table.getdataListParm.parammaps.mydate
  1561. var curDate = parseTime(new Date(), '{y}-{m}-{d}')
  1562. if (d < curDate) {
  1563. this.dataDisabled = true
  1564. } else {
  1565. this.dataDisabled = false
  1566. }
  1567. console.log(this.dataDisabled)
  1568. this.parentDate = this.table.getdataListParm.parammaps.mydate
  1569. console.log(this.parentDate, 'this.parentDate')
  1570. },
  1571. changePlanType(val) {
  1572. console.log('选择了计划类型', val)
  1573. this.getList()
  1574. this.getList2()
  1575. this.getList3()
  1576. },
  1577. changeFrequency(val) {
  1578. console.log('选择了班次', val)
  1579. this.getList()
  1580. this.getList2()
  1581. this.getList3()
  1582. },
  1583. // 日执行计划行点击
  1584. tableRowClick(row, column, event) {
  1585. console.log(row, column, event)
  1586. console.log('点击计划类型', row.lpplantype)
  1587. if (this.isOrder == false) {
  1588. this.$message({ type: 'error', message: '请保存或取消当前更改顺序操作', duration: 2000 })
  1589. } else {
  1590. if (column.label !== '操作') {
  1591. this.isDetail = true // 点击行显示详情
  1592. this.myheight = document.documentElement.clientHeight - 85 - 265 - 230
  1593. }
  1594. }
  1595. this.table2.getdataListParm.parammaps.havebutton = row.havebutton
  1596. this.table3.getdataListParm.parammaps.havebutton = row.havebutton
  1597. // 撒料计划0/撒料计划-混料1/撒料计划-撒料2/剩料计划3/预混计划4/预称重计划5
  1598. if (row.lpplantype == 0) {
  1599. // 撒料
  1600. this.table2.getdataListParm.name = 'getDownloadplandtl1ListV2'
  1601. this.table3.getdataListParm.name = 'getDownloadplandt2ListV2'
  1602. this.table2.getdataListParm.parammaps.useinbartype = ''
  1603. this.table3.getdataListParm.parammaps.useinbartype = ''
  1604. this.table2.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1605. this.table3.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1606. this.table2.getdataListParm.parammaps.id = row.id
  1607. this.table3.getdataListParm.parammaps.id = row.id
  1608. this.table2.getdataListParm.parammaps.tmrId = row.tmrid
  1609. this.table3.getdataListParm.parammaps.tmrId = row.tmrid
  1610. this.table3.getdataListParm.parammaps.lpplantype = row.lpplantype
  1611. this.table2.getdataListParm.parammaps.lpplantype = row.lpplantype
  1612. this.getList2()
  1613. this.getList3()
  1614. } else if (row.lpplantype == 1) {
  1615. // 撒料计划-混料
  1616. this.table2.getdataListParm.name = 'getDownloadplandtl1ListV2'
  1617. this.table3.getdataListParm.name = 'getDownloadplandt2ListV2'
  1618. this.table2.getdataListParm.parammaps.useinbartype = ''
  1619. this.table3.getdataListParm.parammaps.useinbartype = ''
  1620. this.table2.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1621. this.table3.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1622. this.table2.getdataListParm.parammaps.id = row.id
  1623. this.table3.getdataListParm.parammaps.id = row.id
  1624. this.table3.getdataListParm.parammaps.lpplantype = row.lpplantype
  1625. this.getList2()
  1626. this.getList3()
  1627. } else if (row.lpplantype == 2) {
  1628. // 撒料计划-撒料
  1629. this.table2.getdataListParm.name = 'getDownloadplandt2ListV2'
  1630. this.table3.getdataListParm.name = 'getDownloadplandtl1ListV2'
  1631. this.table2.getdataListParm.parammaps.useinbartype = ''
  1632. this.table3.getdataListParm.parammaps.useinbartype = ''
  1633. this.table2.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1634. this.table3.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1635. this.table2.getdataListParm.parammaps.id = row.id
  1636. this.table3.getdataListParm.parammaps.id = row.id
  1637. this.table2.getdataListParm.parammaps.tmrId = row.tmrid
  1638. this.table3.getdataListParm.parammaps.tmrId = row.tmrid
  1639. this.table3.getdataListParm.parammaps.lpplantype = row.lpplantype
  1640. this.table2.getdataListParm.parammaps.lpplantype = row.lpplantype
  1641. this.getList2()
  1642. this.getList3()
  1643. console.log(this.table3.getdataListParm.parammaps.lpplantype)
  1644. } else if (row.lpplantype == 3) {
  1645. // 剩料
  1646. this.table2.getdataListParm.name = 'getDownloadplandt2ListV2'
  1647. this.table3.getdataListParm.name = 'getDownloadplandt2ListV2'
  1648. this.table2.getdataListParm.parammaps.useinbartype = 0
  1649. this.table3.getdataListParm.parammaps.useinbartype = 1
  1650. this.table2.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1651. this.table3.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1652. this.table2.getdataListParm.parammaps.id = row.id
  1653. this.table3.getdataListParm.parammaps.id = row.id
  1654. this.table3.getdataListParm.parammaps.lpplantype = row.lpplantype
  1655. this.getList2()
  1656. this.getList3()
  1657. } else if (row.lpplantype == 4) {
  1658. // 预混
  1659. this.table2.getdataListParm.name = 'getDownloadplandtl1ListV2'
  1660. this.table3.getdataListParm.name = 'getDownloadplandt2ListV2'
  1661. this.table2.getdataListParm.parammaps.useinbartype = ''
  1662. this.table3.getdataListParm.parammaps.useinbartype = ''
  1663. this.table2.getdataListParm.parammaps.id = row.id
  1664. this.table3.getdataListParm.parammaps.lpplantype = row.lpplantype
  1665. this.getList2()
  1666. } else if (row.lpplantype == 5) {
  1667. // 预称重计划
  1668. this.table2.getdataListParm.name = 'getDownloadplandtl1ListV2'
  1669. this.table3.getdataListParm.name = 'getDownloadplandt2ListV2'
  1670. this.table2.getdataListParm.parammaps.useinbartype = ''
  1671. this.table3.getdataListParm.parammaps.useinbartype = ''
  1672. this.table2.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1673. this.table3.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1674. this.table2.getdataListParm.parammaps.id = row.id
  1675. this.table3.getdataListParm.parammaps.id = row.id
  1676. this.table3.getdataListParm.parammaps.lpplantype = row.lpplantype
  1677. this.getList2()
  1678. this.getList3()
  1679. }
  1680. this.$forceUpdate()
  1681. },
  1682. handleCloseTable2() {
  1683. this.isDetail = false
  1684. this.myheight = document.documentElement.clientHeight - 280
  1685. },
  1686. // 计划内容操作详情
  1687. getList2() {
  1688. console.log(this.table2.getdataListParm.parammaps.lpplantype,'lpplantype===')
  1689. if(this.table2.getdataListParm.parammaps.lpplantype == 2){
  1690. const url = 'new_api/user/gear'
  1691. const data = {
  1692. pasture_id:this.table2.getdataListParm.parammaps.pastureid,
  1693. id:this.table2.getdataListParm.parammaps.id,
  1694. tmr_id:this.table2.getdataListParm.parammaps.tmrId,
  1695. use_in_bar_type:this.table2.getdataListParm.parammaps.useinbartype
  1696. }
  1697. postJson(url, data).then(response => {
  1698. for (let i = 0; i < response.data.list.length; i++) {
  1699. this.$set(response.data.list[i], 'Edit', false) // 编辑
  1700. this.$set(response.data.list[i], 'NoEdit', true) // 不可编辑/输入
  1701. this.$set(response.data.list[i], 'isCreate', false) // 新增操作
  1702. this.$set(response.data.list[i], 'isUpdate', true) // 编辑操作
  1703. this.$set(response.data.list[i], 'isUpdateSave', false) // 编辑保存
  1704. }
  1705. this.table2.list = response.data.list
  1706. // 撒料计划0/撒料计划-混料1/撒料计划-撒料2/剩料计划3/预混计划4
  1707. if (this.table2.getdataListParm.parammaps.lpplantype == 0 || this.table2.getdataListParm.parammaps.lpplantype == 1 || this.table2.getdataListParm.parammaps.lpplantype == 4) {
  1708. const arr = []
  1709. var a = 0
  1710. let b = this.table2.list[0].sort
  1711. let c = 0
  1712. for (let i = 0; i < this.table2.list.length; i++) {
  1713. if (b !== parseInt(this.table2.list[i].sort)) {
  1714. b = this.table2.list[i].sort
  1715. // arr.push({ 'sort': '小计', 'weight': a.toFixed(parseInt(Cookies.get('decimal'))) })
  1716. a = 0
  1717. }
  1718. a = a + parseFloat(this.table2.list[i].weight)
  1719. c = c + parseFloat(this.table2.list[i].weight)
  1720. arr.push(this.table2.list[i])
  1721. }
  1722. // arr.push({ 'sort': '小计', 'weight': a.toFixed(parseInt(Cookies.get('decimal'))) })
  1723. arr.push({ 'sort': '总计', 'weight': c.toFixed(parseInt(Cookies.get('decimal'))) })
  1724. this.table2.list = arr
  1725. }
  1726. if (this.table2.getdataListParm.parammaps.lpplantype == 2) {
  1727. const arr = []
  1728. var aa = 0
  1729. let bb = this.table2.list[0].sort
  1730. let cc = 0
  1731. for (let i = 0; i < this.table2.list.length; i++) {
  1732. if (bb !== parseInt(this.table2.list[i].sort)) {
  1733. bb = this.table2.list[i].sort
  1734. aa = 0
  1735. }
  1736. aa = aa + parseFloat(this.table2.list[i].weight)
  1737. cc = cc + parseFloat(this.table2.list[i].weight)
  1738. arr.push(this.table2.list[i])
  1739. }
  1740. arr.push({ 'sort': '总计', 'weight': cc.toFixed(parseInt(Cookies.get('decimal'))) })
  1741. this.table2.list = arr
  1742. console.log('this.table2.list', this.table2.list)
  1743. console.log(this.table2.getdataListParm.parammaps.lpplantype)
  1744. }
  1745. console.log(this.table2.list)
  1746. this.table2.pageNum = response.data.pageNum
  1747. this.table2.pageSize = response.data.pageSize
  1748. this.table2.total = response.data.total
  1749. this.handleSpan()
  1750. setTimeout(() => {
  1751. this.table2.listLoading = false
  1752. }, 100)
  1753. })
  1754. }else{
  1755. this.table2.listLoading = true
  1756. this.table2.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1757. GetDataByName(this.table2.getdataListParm).then(response => {
  1758. console.log('table数据', response.data.list)
  1759. if (response.data.list !== null) {
  1760. for (let i = 0; i < response.data.list.length; i++) {
  1761. this.$set(response.data.list[i], 'Edit', false) // 编辑
  1762. this.$set(response.data.list[i], 'NoEdit', true) // 不可编辑/输入
  1763. this.$set(response.data.list[i], 'isCreate', false) // 新增操作
  1764. this.$set(response.data.list[i], 'isUpdate', true) // 编辑操作
  1765. this.$set(response.data.list[i], 'isUpdateSave', false) // 编辑保存
  1766. }
  1767. this.table2.list = response.data.list
  1768. // 撒料计划0/撒料计划-混料1/撒料计划-撒料2/剩料计划3/预混计划4
  1769. if (this.table3.getdataListParm.parammaps.lpplantype == 0 || this.table3.getdataListParm.parammaps.lpplantype == 1 || this.table3.getdataListParm.parammaps.lpplantype == 4) {
  1770. const arr = []
  1771. var a = 0
  1772. let b = this.table2.list[0].sort
  1773. let c = 0
  1774. for (let i = 0; i < this.table2.list.length; i++) {
  1775. if (b !== parseInt(this.table2.list[i].sort)) {
  1776. b = this.table2.list[i].sort
  1777. // arr.push({ 'sort': '小计', 'weight': a.toFixed(parseInt(Cookies.get('decimal'))) })
  1778. a = 0
  1779. }
  1780. a = a + parseFloat(this.table2.list[i].weight)
  1781. c = c + parseFloat(this.table2.list[i].weight)
  1782. arr.push(this.table2.list[i])
  1783. }
  1784. // arr.push({ 'sort': '小计', 'weight': a.toFixed(parseInt(Cookies.get('decimal'))) })
  1785. arr.push({ 'sort': '总计', 'weight': c.toFixed(parseInt(Cookies.get('decimal'))) })
  1786. this.table2.list = arr
  1787. }
  1788. if (this.table3.getdataListParm.parammaps.lpplantype == 2) {
  1789. const arr = []
  1790. var aa = 0
  1791. let bb = this.table2.list[0].sort
  1792. let cc = 0
  1793. for (let i = 0; i < this.table2.list.length; i++) {
  1794. if (bb !== parseInt(this.table2.list[i].sort)) {
  1795. bb = this.table2.list[i].sort
  1796. aa = 0
  1797. }
  1798. aa = aa + parseFloat(this.table2.list[i].weight)
  1799. cc = cc + parseFloat(this.table2.list[i].weight)
  1800. arr.push(this.table2.list[i])
  1801. }
  1802. arr.push({ 'sort': '总计', 'weight': cc.toFixed(parseInt(Cookies.get('decimal'))) })
  1803. this.table2.list = arr
  1804. console.log('this.table2.list', this.table2.list)
  1805. console.log(this.table3.getdataListParm.parammaps.lpplantype)
  1806. }
  1807. console.log(this.table2.list)
  1808. this.table2.pageNum = response.data.pageNum
  1809. this.table2.pageSize = response.data.pageSize
  1810. this.table2.total = response.data.total
  1811. } else {
  1812. this.table2.list = []
  1813. }
  1814. this.handleSpan()
  1815. setTimeout(() => {
  1816. this.table2.listLoading = false
  1817. }, 100)
  1818. })
  1819. }
  1820. },
  1821. // 计划内容栏舍详 情
  1822. getList3() {
  1823. if(this.table3.getdataListParm.parammaps.lpplantype == 0){
  1824. const url = 'new_api/user/gear'
  1825. const data = {
  1826. pasture_id:this.table3.getdataListParm.parammaps.pastureid,
  1827. id:this.table3.getdataListParm.parammaps.id,
  1828. tmr_id:this.table3.getdataListParm.parammaps.tmrId,
  1829. use_in_bar_type:this.table3.getdataListParm.parammaps.useinbartype
  1830. }
  1831. postJson(url, data).then(response => {
  1832. if (response.data.list !== null) {
  1833. for (let i = 0; i < response.data.list.length; i++) {
  1834. this.$set(response.data.list[i], 'Edit', false) // 编辑
  1835. this.$set(response.data.list[i], 'NoEdit', true) // 不可编辑/输入
  1836. this.$set(response.data.list[i], 'isCreate', false) // 新增操作
  1837. this.$set(response.data.list[i], 'isUpdate', true) // 编辑操作
  1838. this.$set(response.data.list[i], 'isUpdateSave', false) // 编辑保存
  1839. }
  1840. this.table3.list = response.data.list
  1841. if (this.table3.getdataListParm.parammaps.lpplantype == 0) {
  1842. const arr = []
  1843. var a = 0
  1844. let b = this.table3.list[0].sort
  1845. let c = 0
  1846. for (let i = 0; i < this.table3.list.length; i++) {
  1847. if (b !== parseInt(this.table3.list[i].sort)) {
  1848. b = this.table3.list[i].sort
  1849. a = 0
  1850. }
  1851. a = a + parseFloat(this.table3.list[i].weight)
  1852. c = c + parseFloat(this.table3.list[i].weight)
  1853. arr.push(this.table3.list[i])
  1854. }
  1855. arr.push({ 'sort': '总计', 'weight': c.toFixed(parseInt(Cookies.get('decimal'))) })
  1856. this.table3.list = arr
  1857. }
  1858. console.log(this.table3.getdataListParm.parammaps.lpplantype,'lpplantype===')
  1859. // if(this.table3.getdataListParm.parammaps.lpplantype == 0){
  1860. // this.getGearList()
  1861. // }
  1862. this.table3.pageNum = response.data.pageNum
  1863. this.table3.pageSize = response.data.pageSize
  1864. this.table3.total = response.data.total
  1865. } else {
  1866. this.table3.list = []
  1867. }
  1868. setTimeout(() => {
  1869. this.table3.listLoading = false
  1870. }, 100)
  1871. })
  1872. }else{
  1873. this.table3.listLoading = true
  1874. this.table3.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  1875. GetDataByName(this.table3.getdataListParm).then(response => {
  1876. console.log('table数据', response.data.list)
  1877. if (response.data.list !== null) {
  1878. for (let i = 0; i < response.data.list.length; i++) {
  1879. this.$set(response.data.list[i], 'Edit', false) // 编辑
  1880. this.$set(response.data.list[i], 'NoEdit', true) // 不可编辑/输入
  1881. this.$set(response.data.list[i], 'isCreate', false) // 新增操作
  1882. this.$set(response.data.list[i], 'isUpdate', true) // 编辑操作
  1883. this.$set(response.data.list[i], 'isUpdateSave', false) // 编辑保存
  1884. }
  1885. this.table3.list = response.data.list
  1886. if (this.table3.getdataListParm.parammaps.lpplantype == 0) {
  1887. const arr = []
  1888. var a = 0
  1889. let b = this.table3.list[0].sort
  1890. let c = 0
  1891. for (let i = 0; i < this.table3.list.length; i++) {
  1892. if (b !== parseInt(this.table3.list[i].sort)) {
  1893. b = this.table3.list[i].sort
  1894. a = 0
  1895. }
  1896. a = a + parseFloat(this.table3.list[i].weight)
  1897. c = c + parseFloat(this.table3.list[i].weight)
  1898. arr.push(this.table3.list[i])
  1899. }
  1900. arr.push({ 'sort': '总计', 'weight': c.toFixed(parseInt(Cookies.get('decimal'))) })
  1901. this.table3.list = arr
  1902. }
  1903. console.log(this.table3.getdataListParm.parammaps.lpplantype,'lpplantype===')
  1904. // if(this.table3.getdataListParm.parammaps.lpplantype == 0){
  1905. // this.getGearList()
  1906. // }
  1907. this.table3.pageNum = response.data.pageNum
  1908. this.table3.pageSize = response.data.pageSize
  1909. this.table3.total = response.data.total
  1910. } else {
  1911. this.table3.list = []
  1912. }
  1913. setTimeout(() => {
  1914. this.table3.listLoading = false
  1915. }, 100)
  1916. })
  1917. }
  1918. },
  1919. getGearList(){
  1920. let data = {
  1921. name: 'getTmrGearList',
  1922. page: 1,
  1923. offset: 1,
  1924. pagecount: parseInt(Cookies.get('pageCount')),
  1925. returntype: 'Map',
  1926. parammaps: {
  1927. tmrId: this.table3.getdataListParm.parammaps.tmrId
  1928. }
  1929. }
  1930. var list = []
  1931. console.log('=====')
  1932. GetDataByName(data).then(response => {
  1933. console.log('table数据', response.data.list)
  1934. if (response.data.list !== null) {
  1935. list = response.data.list
  1936. } else {
  1937. list = []
  1938. }
  1939. console.log(this.table3.list,'table3')
  1940. this.table3.list = [{gear:4},{gear:9.99},{gear:15}]
  1941. this.table3.list.forEach((item1,key1) => {
  1942. let mygear = 0
  1943. if(item1.gear < list[0].rev || item1.gear > list[list.length-1].rev){
  1944. mygear = 0
  1945. }else{
  1946. list.forEach((item2,key2) => {
  1947. if(list[key2].rev <= item1.gear && list[key2+1].rev > item1.gear){
  1948. mygear = list[key2+1].gear
  1949. }
  1950. });
  1951. }
  1952. console.log(mygear,'mygear')
  1953. if(key1 == this.table3.list.length-1){
  1954. this.$set(item1,'gear','')
  1955. }else{
  1956. this.$set(item1,'gear',mygear)
  1957. }
  1958. })
  1959. console.log( this.table3.list,' this.table3.list')
  1960. })
  1961. },
  1962. // 新生成
  1963. handleCreate() {
  1964. console.log('点击了新生成')
  1965. this.newGeneration.temp.inputDatetime = [parseTime(new Date(), '{y}-{m}-{d}'), parseTime(new Date(), '{y}-{m}-{d}')]
  1966. GetDataByName(this.newGeneration.getdataListParm).then(response => {
  1967. console.log('table数据', response.data.list)
  1968. if (response.data.list !== null) {
  1969. if (response.data.list[0].vmsg == '存在未分配') {
  1970. this.newGeneration.temp.tips = true
  1971. this.$message({ type: 'warning', message: '撒料计划中存在未分配完栏舍,建议及时进行分配', duration: 2000 })
  1972. this.getTips()
  1973. }else{
  1974. this.newGeneration.temp.tips = false
  1975. this.newGeneration.dialogStatus = 'newGeneration'
  1976. this.newGeneration.dialogFormVisible = true
  1977. }
  1978. }
  1979. })
  1980. },
  1981. getTips(){
  1982. const url = 'authdata/feedp/undistribute'
  1983. const data = {}
  1984. // data.times = 1
  1985. data.times = this.myMaxTimes
  1986. data.pastureid = Cookies.get('pastureid')
  1987. this.tipsList = []
  1988. postJson(url, data).then(response => {
  1989. if(response.data !== null){
  1990. this.tipsList = response.data
  1991. // if(this.myMaxTimes == 1){
  1992. // this.tipsList = response.data.one
  1993. // }else if(this.myMaxTimes == 2){
  1994. // this.tipsList.push(response.data.one,response.data.two)
  1995. // }else if(this.myMaxTimes == 3){
  1996. // this.tipsList.push(response.data.one,response.data.two,response.data.three)
  1997. // }else if(this.myMaxTimes == 4){
  1998. // this.tipsList.push(response.data.one,response.data.two,response.data.three,response.data.four)
  1999. // }
  2000. }else{
  2001. this.tipsList = []
  2002. }
  2003. console.log('this.tipsList==>',this.tipsList)
  2004. this.newGeneration.dialogStatus = 'newGeneration'
  2005. this.newGeneration.dialogFormVisible = true
  2006. })
  2007. },
  2008. DateDiff(sDate1, sDate2) {
  2009. console.log(sDate1, sDate2)
  2010. var aDate, oDate1, oDate2, iDays
  2011. aDate = sDate1.split('-')
  2012. oDate1 = new Date(aDate[0], aDate[1], aDate[2]) // 转换为12-18-2006格式
  2013. aDate = sDate2.split('-')
  2014. oDate2 = new Date(aDate[0], aDate[1], aDate[2])
  2015. iDays = parseInt(Math.abs(oDate1 - oDate2) / 1000 / 60 / 60 / 24) // 把相差的毫秒数转换为天数
  2016. this.newGeneration.temp.days = parseInt(iDays) + 1
  2017. return iDays
  2018. },
  2019. newGenerationData() {
  2020. console.log('点击了新生成保存', this.newGeneration.temp)
  2021. this.newGenerationLoading = true
  2022. this.isokDisable = true
  2023. this.$refs['temp'].validate(valid => {
  2024. if (valid) {
  2025. this.newGeneration.temp.startTime = parseTime(this.newGeneration.temp.inputDatetime[0], '{y}-{m}-{d}')
  2026. this.newGeneration.temp.stopTime = parseTime(this.newGeneration.temp.inputDatetime[1], '{y}-{m}-{d}')
  2027. this.DateDiff(this.newGeneration.temp.stopTime, this.newGeneration.temp.startTime)
  2028. this.requestParam = {}
  2029. this.requestParam.common = { 'returnmap': '0' }
  2030. this.requestParam.data = []
  2031. this.requestParam.data[0] = { 'name': 'checkDLPIsStart', 'type': 'v', 'parammaps': {
  2032. pastureid: Cookies.get('pastureid'),
  2033. startTime: this.newGeneration.temp.startTime
  2034. }}
  2035. this.requestParam.data[1] = { 'name': 'checkPreMixStorage', 'type': 'e', 'parammaps': {
  2036. pastureid: Cookies.get('pastureid'),
  2037. days: this.newGeneration.temp.days
  2038. }}
  2039. this.requestParam.data[2] = { 'name': 'createdownloadedplan', 'type': 'e', 'parammaps': {
  2040. pastureid: Cookies.get('pastureid'),
  2041. startTime: this.newGeneration.temp.startTime,
  2042. stopTime: this.newGeneration.temp.stopTime
  2043. }}
  2044. ExecDataByConfig(this.requestParam).then(response => {
  2045. console.log('新生成保存发送参数', this.requestParam)
  2046. if (response.msg === 'fail') {
  2047. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  2048. this.isokDisable = false
  2049. this.newGenerationLoading = false
  2050. } else {
  2051. this.$notify({ title: '', message: '保存成功', type: 'success', duration: 2000 })
  2052. this.newGeneration.dialogFormVisible = false
  2053. this.getList()
  2054. this.isokDisable = false
  2055. this.newGenerationLoading = false
  2056. }
  2057. })
  2058. }
  2059. })
  2060. },
  2061. // 修改计划
  2062. handleRevisePlan(data) {
  2063. this.dialogFull = false
  2064. var arr = []
  2065. if (this.table.list.length > 0) {
  2066. for (let i = 0; i < this.table.list.length; i++) {
  2067. if (this.table.list[i].havebutton == 1) {
  2068. arr.push(this.table.list[i])
  2069. }
  2070. }
  2071. }
  2072. if (arr.length !== this.table.list.length) {
  2073. console.log('点击了修改计划1', this.activeName)
  2074. this.isShowDialog = true
  2075. this.activeName = '栏舍配方'
  2076. console.log('点击了修改计划2', this.activeName)
  2077. } else {
  2078. this.$message({ type: 'error', message: '当前日期不可修改计划,请重新选择日期' })
  2079. }
  2080. },
  2081. handleExport() {
  2082. this.downLoad.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  2083. this.downLoad.getdataListParm.parammaps.lpplantype = this.table.getdataListParm.parammaps.lpplantype
  2084. this.downLoad.getdataListParm.parammaps.times = this.table.getdataListParm.parammaps.times
  2085. this.downLoad.getdataListParm.parammaps.enable = this.table.getdataListParm.parammaps.enable
  2086. this.downLoad.getdataListParm.parammaps.enable2 = this.table.getdataListParm.parammaps.enable2
  2087. var exportTitle = ''
  2088. if (this.table.getdataListParm.parammaps.plandimen == '1') {
  2089. if (this.table.getdataListParm.parammaps.enable3 == '0') {
  2090. this.downLoad.getdataListParm.name = 'downloadPlanTLJDTMR'
  2091. exportTitle = this.table.getdataListParm.parammaps.mydate + '投料简打'
  2092. } else if (this.table.getdataListParm.parammaps.enable3 == '1') {
  2093. this.downLoad.getdataListParm.name = 'downloadPlanTLLDTMR'
  2094. exportTitle = this.table.getdataListParm.parammaps.mydate + '累加投料'
  2095. } else if (this.table.getdataListParm.parammaps.enable3 == '2') {
  2096. this.downLoad.getdataListParm.name = 'downloadPlanSLJDTMR'
  2097. exportTitle = this.table.getdataListParm.parammaps.mydate + '撒料简打'
  2098. } else if (this.table.getdataListParm.parammaps.enable3 == '3') {
  2099. this.downLoad.getdataListParm.name = 'downloadPlanTSLJDTMR'
  2100. exportTitle = this.table.getdataListParm.parammaps.mydate + '投撒料简打'
  2101. } else if (this.table.getdataListParm.parammaps.enable3 == '4') {
  2102. this.downLoad.getdataListParm.name = 'downloadPlanTSLLDTMR'
  2103. exportTitle = this.table.getdataListParm.parammaps.mydate + '投撒料累加'
  2104. } else if (this.table.getdataListParm.parammaps.enable3 == '5') {
  2105. this.downLoad.getdataListParm.name = 'downloadPlanBZJDTMR'
  2106. exportTitle = this.table.getdataListParm.parammaps.mydate + '包装简打'
  2107. } else {
  2108. this.downLoad.getdataListParm.name = 'downloadPlanSFJDTMR'
  2109. exportTitle = this.table.getdataListParm.parammaps.mydate + '实发简打'
  2110. }
  2111. } else {
  2112. if (this.table.getdataListParm.parammaps.enable3 == '0') {
  2113. this.downLoad.getdataListParm.name = 'downloadPlanTLJD'
  2114. exportTitle = this.table.getdataListParm.parammaps.mydate + '投料简打'
  2115. } else if (this.table.getdataListParm.parammaps.enable3 == '1') {
  2116. this.downLoad.getdataListParm.name = 'downloadPlanTLLD'
  2117. exportTitle = this.table.getdataListParm.parammaps.mydate + '累加投料'
  2118. } else if (this.table.getdataListParm.parammaps.enable3 == '2') {
  2119. this.downLoad.getdataListParm.name = 'downloadPlanSLJD'
  2120. exportTitle = this.table.getdataListParm.parammaps.mydate + '撒料简打'
  2121. } else if (this.table.getdataListParm.parammaps.enable3 == '3') {
  2122. this.downLoad.getdataListParm.name = 'downloadPlanTSLJD'
  2123. exportTitle = this.table.getdataListParm.parammaps.mydate + '投撒料简打'
  2124. } else if (this.table.getdataListParm.parammaps.enable3 == '4') {
  2125. this.downLoad.getdataListParm.name = 'downloadPlanTSLLD'
  2126. exportTitle = this.table.getdataListParm.parammaps.mydate + '投撒料累加'
  2127. } else if (this.table.getdataListParm.parammaps.enable3 == '5') {
  2128. this.downLoad.getdataListParm.name = 'downloadPlanBZJD'
  2129. exportTitle = this.table.getdataListParm.parammaps.mydate + '包装简打'
  2130. } else {
  2131. this.downLoad.getdataListParm.name = 'downloadPlanSFJD'
  2132. exportTitle = this.table.getdataListParm.parammaps.mydate + '实发简打'
  2133. }
  2134. }
  2135. GetReportform(this.downLoad.getdataListParm).then(response => {
  2136. if (response.data.list !== null) {
  2137. this.downLoad.labelList = []
  2138. var filterValArr = []
  2139. for (let i = 0; i < response.data.list.data1.length; i++) {
  2140. this.downLoad.labelList.push(response.data.list.data1[i].label)
  2141. filterValArr.push(response.data.list.data1[i].prop)
  2142. }
  2143. this.downLoad.list = response.data.list.data2
  2144. } else {
  2145. this.downLoad.list = []
  2146. }
  2147. var multiHeaderArr = []
  2148. for (let i = 0; i < this.downLoad.labelList.length; i++) {
  2149. if (i == 0) {
  2150. multiHeaderArr.push(exportTitle)
  2151. } else {
  2152. multiHeaderArr.push('')
  2153. }
  2154. }
  2155. import('@/vendor/Export5Excel').then(excel => {
  2156. const multiHeader = [
  2157. multiHeaderArr
  2158. ]
  2159. const multiHeader2 = [
  2160. this.downLoad.labelList
  2161. ]
  2162. const filterVal = filterValArr
  2163. const data = this.downLoad.list.map((v) => filterVal.map((j) => v[j]))
  2164. const merges = []
  2165. excel.export_json_to_excel({ multiHeader, multiHeader2, data, filename: exportTitle, merges })
  2166. })
  2167. })
  2168. },
  2169. rowDrop() {
  2170. console.log(document.querySelector('#table1 .el-table__body-wrapper tbody'))
  2171. const tbody = document.querySelector('#table1 .el-table__body-wrapper tbody')
  2172. // this.sorTable()
  2173. const that = this
  2174. var sortable = Sortable.create(tbody, {
  2175. disabled: that.dropState,
  2176. onChoose({ newIndex, oldIndex }) {
  2177. console.log(that.isOrder, 'that.isOrder == false')
  2178. console.log(that.dropState, 'that.dropState')
  2179. if (that.dropState == true || that.isOrder == true) {
  2180. sortable.destroy()
  2181. }
  2182. },
  2183. onEnd(evt) {
  2184. var tableList = [...that.table.list] // 保留拖动前数据
  2185. const targetRow = that.table.list.splice(evt.oldIndex, 1)[0] // 拖动数据
  2186. const targetRow2 = that.table.list[evt.newIndex] // 拖动后下方数据
  2187. const targetRow3 = that.table.list[evt.newIndex - 1] // 拖动后上方数据
  2188. console.log(targetRow, 'targetRow')
  2189. console.log(targetRow2, 'targetRow2')
  2190. console.log(targetRow3, 'targetRow3')
  2191. that.table.list.splice(evt.newIndex, 0, targetRow)
  2192. // ==========
  2193. // 已执行的计划不可拖动
  2194. if (targetRow.havebutton == 1) {
  2195. that.$nextTick(() => {
  2196. that.$set(that.table, 'list', tableList)
  2197. })
  2198. that.$message({ type: 'error', message: '因已执行的计划不可调整顺序', duration: 2000 })
  2199. return false
  2200. }
  2201. // 相同班次之间可以拖动
  2202. // if (targetRow2 !== undefined && targetRow3 !== undefined) {
  2203. // if (targetRow.times !== targetRow2.times && targetRow.times !== targetRow3.times) {
  2204. // that.$nextTick(() => {
  2205. // that.$set(that.table, 'list', tableList)
  2206. // })
  2207. // that.$message({ type: 'error', message: '因班次不同不可调整顺序', duration: 2000 })
  2208. // return false
  2209. // }
  2210. // } else if (targetRow2 !== undefined && targetRow3 == undefined) {
  2211. // if (targetRow.times !== targetRow2.times) {
  2212. // that.$nextTick(() => {
  2213. // that.$set(that.table, 'list', tableList)
  2214. // })
  2215. // that.$message({ type: 'error', message: '因班次不同不可调整顺序', duration: 2000 })
  2216. // return false
  2217. // }
  2218. // } else if (targetRow2 == undefined && targetRow3 !== undefined) {
  2219. // if (targetRow.times !== targetRow3.times) {
  2220. // that.$nextTick(() => {
  2221. // that.$set(that.table, 'list', tableList)
  2222. // })
  2223. // that.$message({ type: 'error', message: '因班次不同不可调整顺序', duration: 2000 })
  2224. // return false
  2225. // }
  2226. // }
  2227. // 撒料计划0,
  2228. // 撒料计划-混料1
  2229. // 撒料计划-撒料2
  2230. // 剩料计划3
  2231. // 预混计划4
  2232. // 预称重计划5
  2233. if (targetRow.lpplantype == 1) { // 拖动数据为撒料计划-混料
  2234. if (targetRow2 == undefined) {
  2235. that.$nextTick(() => {
  2236. that.$set(that.table, 'list', tableList)
  2237. })
  2238. } else if (targetRow2 !== undefined && targetRow2.pid == targetRow.pid) {
  2239. that.$nextTick(() => {
  2240. that.$set(that.table, 'list', tableList)
  2241. })
  2242. } else {
  2243. var pidArr = [] // pid相同的值
  2244. var pidArr1 = [] //
  2245. var index // 索引
  2246. for (let i = 0; i < tableList.length; i++) {
  2247. if (tableList[i].pid == targetRow.pid) {
  2248. pidArr.push(tableList[i])
  2249. } else {
  2250. pidArr1.push(tableList[i])
  2251. }
  2252. }
  2253. // 找到对应上方pid 的ID
  2254. // 比如说id 580243 找到对应的索引
  2255. if (targetRow3 !== undefined) {
  2256. for (let i = 0; i < pidArr1.length; i++) {
  2257. if (pidArr1[i].id == targetRow3.id) {
  2258. index = i
  2259. }
  2260. }
  2261. } else {
  2262. for (let i = 0; i < pidArr1.length; i++) {
  2263. if (pidArr1[i].id == targetRow2.id) {
  2264. index = i - 1
  2265. }
  2266. }
  2267. }
  2268. pidArr1.splice(index + 1, 0, ...pidArr)
  2269. console.log(pidArr1)
  2270. that.$nextTick(() => {
  2271. that.table.list = pidArr1
  2272. })
  2273. }
  2274. if (targetRow2 !== undefined && targetRow3 !== undefined) {
  2275. if (targetRow2.pid == targetRow3.pid) {
  2276. that.$nextTick(() => {
  2277. that.$set(that.table, 'list', tableList)
  2278. })
  2279. that.$message({ type: 'error', message: '不可将其他计划拖动至预称重计划之间', duration: 2000 })
  2280. return false
  2281. }
  2282. }
  2283. } else if (targetRow.lpplantype == 5) { // 拖动数据为预称重计划
  2284. if (targetRow2 !== undefined) {
  2285. console.log(targetRow3, targetRow2, 'zhidao')
  2286. if (targetRow3 !== undefined) {
  2287. if (targetRow3.pid !== targetRow.pid && targetRow2.pid !== targetRow.pid) {
  2288. that.$nextTick(() => {
  2289. that.$set(that.table, 'list', tableList)
  2290. })
  2291. that.$message({ type: 'error', message: '预称重计划不可拖动至其他位置', duration: 2000 })
  2292. return false
  2293. } else {
  2294. console.log('wojinlaile', targetRow2, targetRow)
  2295. if (targetRow3.lpplantype == 0 && targetRow2.pid !== targetRow.pid) {
  2296. that.$nextTick(() => {
  2297. that.$set(that.table, 'list', tableList)
  2298. })
  2299. that.$message({ type: 'error', message: '预称重计划不可拖动至撒料计划下方', duration: 2000 })
  2300. return false
  2301. }
  2302. if (targetRow2.lpplantype !== 5 && targetRow3.lpplantype !== 5) {
  2303. that.$nextTick(() => {
  2304. that.$set(that.table, 'list', tableList)
  2305. })
  2306. that.$message({ type: 'error', message: '预称重计划不可拖动至其他位置', duration: 2000 })
  2307. return false
  2308. }
  2309. }
  2310. } else {
  2311. if (targetRow2.pid !== targetRow.pid) {
  2312. that.$nextTick(() => {
  2313. that.$set(that.table, 'list', tableList)
  2314. })
  2315. that.$message({ type: 'error', message: '预称重计划不可拖动至其他位置', duration: 2000 })
  2316. return false
  2317. } else {
  2318. if (targetRow2.pid !== targetRow.pid) {
  2319. that.$nextTick(() => {
  2320. that.$set(that.table, 'list', tableList)
  2321. })
  2322. that.$message({ type: 'error', message: '预称重计划不可拖动至撒料计划下方', duration: 2000 })
  2323. return false
  2324. }
  2325. }
  2326. }
  2327. } else {
  2328. if (targetRow2 == undefined) {
  2329. that.$nextTick(() => {
  2330. that.$set(that.table, 'list', tableList)
  2331. })
  2332. that.$message({ type: 'error', message: '预称重计划不可拖动至其他位置', duration: 2000 })
  2333. return false
  2334. } else if (targetRow3.pid !== targetRow.pid) {
  2335. that.$nextTick(() => {
  2336. that.$set(that.table, 'list', tableList)
  2337. })
  2338. that.$message({ type: 'error', message: '预称重计划不可拖动至其他位置', duration: 2000 })
  2339. return false
  2340. } else {
  2341. if (targetRow3.lpplantype == 0) {
  2342. that.$nextTick(() => {
  2343. that.$set(that.table, 'list', tableList)
  2344. })
  2345. that.$message({ type: 'error', message: '预称重计划不可拖动至撒料计划下方', duration: 2000 })
  2346. return false
  2347. }
  2348. }
  2349. }
  2350. if (targetRow2 !== undefined && targetRow3 !== undefined) {
  2351. if (targetRow2.pid !== targetRow.pid && targetRow3.pid !== targetRow.pid) {
  2352. that.$nextTick(() => {
  2353. that.$set(that.table, 'list', tableList)
  2354. })
  2355. that.$message({ type: 'error', message: '不可将其他计划拖动至预称重计划之间', duration: 2000 })
  2356. return false
  2357. } else if (targetRow3.pid == targetRow.pid && (targetRow3.lpplantype == 1 || targetRow3.lpplantype == 2)) {
  2358. that.$nextTick(() => {
  2359. that.$set(that.table, 'list', tableList)
  2360. })
  2361. that.$message({ type: 'error', message: '预称重计划不可拖动至其他位置', duration: 2000 })
  2362. return false
  2363. }
  2364. }
  2365. } else if (targetRow.lpplantype == 2) { // 拖动数据为撒料计划-撒料
  2366. if (targetRow2 == undefined) {
  2367. if (targetRow3.pid !== targetRow.pid) {
  2368. that.$nextTick(() => {
  2369. that.$set(that.table, 'list', tableList)
  2370. })
  2371. that.$message({ type: 'error', message: '撒料计划-撒料不可拖动至其他位置', duration: 2000 })
  2372. return false
  2373. }
  2374. } else {
  2375. if (targetRow2.lpplantype == 1 && (targetRow2.pid == targetRow.pid || targetRow2 == undefined)) {
  2376. // 拖动数据下方为撒料计划-混料时且pid相同,不可拖动,提示
  2377. that.$nextTick(() => {
  2378. that.$set(that.table, 'list', tableList)
  2379. })
  2380. that.$message({ type: 'error', message: '撒料计划-撒料不可拖动至撒料计划-混料上方', duration: 2000 })
  2381. return false
  2382. } else if (targetRow.lpplantype == 2 && (targetRow2.pid == targetRow.pid || targetRow3.pid == targetRow.pid || targetRow2 == undefined || targetRow3 == undefined)) {
  2383. console.log('正常拖动')
  2384. } else {
  2385. that.$nextTick(() => {
  2386. that.$set(that.table, 'list', tableList)
  2387. })
  2388. that.$message({ type: 'error', message: '撒料计划-撒料不可拖动至其他位置', duration: 2000 })
  2389. return false
  2390. }
  2391. }
  2392. if (targetRow2 !== undefined && targetRow3 !== undefined) {
  2393. if (targetRow2.pid == targetRow3.pid) {
  2394. that.$nextTick(() => {
  2395. that.$set(that.table, 'list', tableList)
  2396. })
  2397. that.$message({ type: 'error', message: '不可将其他计划拖动至预称重计划之间', duration: 2000 })
  2398. return false
  2399. }
  2400. }
  2401. } else if (targetRow.lpplantype == 0) { // 拖动数据为撒料计划
  2402. console.log('遍历有相同的pid,一起跟着拖动3')
  2403. var pidArr = [] // pid相同的值
  2404. var pidArr1 = [] //
  2405. var index // 索引
  2406. for (let i = 0; i < tableList.length; i++) {
  2407. if (tableList[i].pid == targetRow.pid) {
  2408. pidArr.push(tableList[i])
  2409. } else {
  2410. pidArr1.push(tableList[i])
  2411. }
  2412. }
  2413. if (pidArr.length > 0) {
  2414. // 找到对应上方pid 的ID
  2415. // 比如说id 580243 找到对应的索引
  2416. if (targetRow3 !== undefined) {
  2417. for (let i = 0; i < pidArr1.length; i++) {
  2418. if (pidArr1[i].id == targetRow3.id) {
  2419. index = i
  2420. }
  2421. }
  2422. } else {
  2423. for (let i = 0; i < pidArr1.length; i++) {
  2424. if (pidArr1[i].id == targetRow2.id) {
  2425. index = i - 1
  2426. }
  2427. }
  2428. }
  2429. pidArr1.splice(index + 1, 0, ...pidArr)
  2430. console.log(pidArr1)
  2431. that.$nextTick(() => {
  2432. that.table.list = pidArr1
  2433. })
  2434. }
  2435. if (targetRow2 !== undefined && targetRow3 !== undefined) {
  2436. if (targetRow2.pid == targetRow3.pid) {
  2437. that.$nextTick(() => {
  2438. that.$set(that.table, 'list', tableList)
  2439. })
  2440. that.$message({ type: 'error', message: '不可拖动至其他计划中间;', duration: 2000 })
  2441. return false
  2442. }
  2443. }
  2444. } else if (targetRow.lpplantype == 3 || targetRow.lpplantype == 4) {
  2445. if (targetRow2 !== undefined && targetRow3 !== undefined) {
  2446. if (targetRow2.pid == targetRow3.pid) {
  2447. if (targetRow2.lpplantype == 5 && targetRow3.lpplantype == 5) {
  2448. that.$nextTick(() => {
  2449. that.$set(that.table, 'list', tableList)
  2450. })
  2451. that.$message({ type: 'error', message: '不可拖动至预称重计划跟预称重计划之间', duration: 2000 })
  2452. return false
  2453. } else if (targetRow.pid == targetRow2.pid && targetRow.lpplantype == 3 && targetRow2.lpplantype == 3 || targetRow.pid == targetRow3.pid && targetRow.lpplantype == 3 && targetRow3.lpplantype == 3) {
  2454. console.log('剩料之间可以互相拖动')
  2455. console.log(tableList)
  2456. } else {
  2457. that.$nextTick(() => {
  2458. that.$set(that.table, 'list', tableList)
  2459. })
  2460. // 撒料计划0,
  2461. // 撒料计划-混料1
  2462. // 撒料计划-撒料2
  2463. // 剩料计划3
  2464. // 预混计划4
  2465. // 预称重计划5
  2466. if (targetRow3.lpplantype == 0) {
  2467. that.$set(targetRow3, 'mylpplantype', '撒料计划')
  2468. } else if (targetRow3.lpplantype == 1) {
  2469. that.$set(targetRow3, 'mylpplantype', '撒料计划-混料')
  2470. } else if (targetRow3.lpplantype == 2) {
  2471. that.$set(targetRow3, 'mylpplantype', '撒料计划-撒料')
  2472. } else if (targetRow3.lpplantype == 3) {
  2473. that.$set(targetRow3, 'mylpplantype', '剩料计划')
  2474. } else if (targetRow3.lpplantype == 4) {
  2475. that.$set(targetRow3, 'mylpplantype', '预混计划')
  2476. } else if (targetRow3.lpplantype == 5) {
  2477. that.$set(targetRow3, 'mylpplantype', '预称重计划')
  2478. }
  2479. if (targetRow2.lpplantype == 0) {
  2480. that.$set(targetRow2, 'mylpplantype', '撒料计划')
  2481. } else if (targetRow2.lpplantype == 1) {
  2482. that.$set(targetRow2, 'mylpplantype', '撒料计划-混料')
  2483. } else if (targetRow2.lpplantype == 2) {
  2484. that.$set(targetRow2, 'mylpplantype', '撒料计划-撒料')
  2485. } else if (targetRow2.lpplantype == 3) {
  2486. that.$set(targetRow2, 'mylpplantype', '剩料计划')
  2487. } else if (targetRow2.lpplantype == 4) {
  2488. that.$set(targetRow2, 'mylpplantype', '预混计划')
  2489. } else if (targetRow2.lpplantype == 5) {
  2490. that.$set(targetRow2, 'mylpplantype', '预称重计划')
  2491. }
  2492. var message = '不可拖动至' + targetRow3.mylpplantype + '跟' + targetRow2.mylpplantype + '之间'
  2493. that.$message({ type: 'error', message: message, duration: 2000 })
  2494. return false
  2495. }
  2496. }
  2497. }
  2498. // ========
  2499. // var pidArr = [] // pid相同的值
  2500. // var pidArr1 = [] //
  2501. // var index // 索引
  2502. // for (let i = 0; i < tableList.length; i++) {
  2503. // if (tableList[i].pid == targetRow.pid) {
  2504. // pidArr.push(tableList[i])
  2505. // } else {
  2506. // pidArr1.push(tableList[i])
  2507. // }
  2508. // }
  2509. // if (pidArr.length > 0) {
  2510. // // 找到对应上方pid 的ID
  2511. // // 比如说id 580243 找到对应的索引
  2512. // if (targetRow3 !== undefined) {
  2513. // for (let i = 0; i < pidArr1.length; i++) {
  2514. // if (pidArr1[i].id == targetRow3.id) {
  2515. // index = i
  2516. // }
  2517. // }
  2518. // } else {
  2519. // for (let i = 0; i < pidArr1.length; i++) {
  2520. // if (pidArr1[i].id == targetRow2.id) {
  2521. // index = i - 1
  2522. // }
  2523. // }
  2524. // }
  2525. // pidArr1.splice(index + 1, 0, ...pidArr)
  2526. // console.log(pidArr1)
  2527. // that.$nextTick(() => {
  2528. // that.table.list = pidArr1
  2529. // })
  2530. // }
  2531. // if (targetRow2 !== undefined && targetRow3 !== undefined) {
  2532. // if (targetRow2.pid == targetRow3.pid) {
  2533. // that.$nextTick(() => {
  2534. // that.$set(that.table, 'list', tableList)
  2535. // })
  2536. // that.$message({ type: 'error', message: '不可将其他计划拖动至预称重计划之间9999', duration: 2000 })
  2537. // return false
  2538. // }
  2539. // }
  2540. }
  2541. // ===
  2542. }
  2543. })
  2544. },
  2545. // 复制
  2546. handleCopy() {
  2547. if (this.table.list.length > 0) {
  2548. this.newGeneration.temp = {}
  2549. this.newGeneration.dialogStatus = 'copy'
  2550. this.newGeneration.dialogFormVisible = true
  2551. } else {
  2552. this.$message({ type: 'error', message: '当前无计划可复制' })
  2553. }
  2554. },
  2555. copyData() {
  2556. console.log(this.newGeneration.temp.copyInputDatetime)
  2557. this.isokDisable = true
  2558. setTimeout(() => {
  2559. this.isokDisable = false
  2560. }, 5000)
  2561. this.$refs['temp'].validate(valid => {
  2562. if (valid) {
  2563. this.requestParam.name = 'copydownloadedplan'
  2564. this.requestParam.parammaps = {}
  2565. this.requestParam.parammaps.pastureid = Cookies.get('pastureid')
  2566. this.requestParam.parammaps.date = this.table.getdataListParm.parammaps.mydate
  2567. this.requestParam.parammaps.startTime = parseTime(this.newGeneration.temp.copyInputDatetime[0], '{y}-{m}-{d}')
  2568. this.requestParam.parammaps.stopTime = parseTime(this.newGeneration.temp.copyInputDatetime[1], '{y}-{m}-{d}')
  2569. PostDataByName(this.requestParam).then(response => {
  2570. if (response.msg === 'fail') {
  2571. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  2572. } else {
  2573. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  2574. this.newGeneration.dialogFormVisible = false
  2575. this.getList()
  2576. }
  2577. })
  2578. }
  2579. })
  2580. },
  2581. handleChangeOrder() {
  2582. // 拖动顺序
  2583. this.isOrder = false
  2584. this.rowDrop()
  2585. },
  2586. saveChangeOrder() {
  2587. // 保存顺序
  2588. var sortList = []
  2589. for (let i = 0; i < this.table.list.length; i++) {
  2590. var obj = {}
  2591. obj.sort = i
  2592. obj.pastureid = this.table.list[i].pastureid
  2593. obj.id = this.table.list[i].id
  2594. sortList.push(obj)
  2595. }
  2596. console.log(sortList)
  2597. this.requestParam = {}
  2598. this.requestParam.common = { 'returnmap': '0' }
  2599. this.requestParam.data = []
  2600. this.requestParam.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': sortList }}
  2601. this.requestParam.data[0].children = []
  2602. this.requestParam.data[0].children[0] = { 'name': 'updatedownloadesort', 'type': 'e', 'parammaps': {
  2603. id: '@insertSpotList.id',
  2604. pastureid: '@insertSpotList.pastureid',
  2605. sort: '@insertSpotList.sort'
  2606. }}
  2607. ExecDataByConfig(this.requestParam).then(response => {
  2608. console.log('顺序切换保存发送参数', this.requestParam)
  2609. if (response.msg === 'fail') {
  2610. this.$notify({ title: '顺序切换失败', message: response.data, type: 'warning', duration: 2000 })
  2611. } else {
  2612. this.$notify({ title: '', message: '顺序切换成功', type: 'success', duration: 2000 })
  2613. this.getList()
  2614. this.isOrder = true
  2615. }
  2616. })
  2617. },
  2618. cancelChangeOrder() {
  2619. // 取消顺序
  2620. this.getList()
  2621. this.isOrder = true
  2622. },
  2623. handleDataSynchronization() {
  2624. MessageBox.confirm('是否确认同步数据?', {
  2625. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  2626. }).then(() => {
  2627. this.requestParam = {}
  2628. this.requestParam.pastureid = Cookies.get('pastureid')
  2629. // this.$alert('正在同步', { confirmButtonText: '确定' })
  2630. this.dataSynchronization.dialogFormVisible = true
  2631. getDorm(this.requestParam).then(response => {
  2632. console.log(response)
  2633. if (response.msg == 'ok') {
  2634. this.dataSynchronization.dialogFormVisible = false
  2635. this.$notify({ title: '同步成功', message: '同步成功', type: 'success', duration: 2000 })
  2636. } else {
  2637. this.$notify({ title: '同步失败', message: response.data, type: 'warning', duration: 2000 })
  2638. this.dataSynchronization.dialogFormVisible = false
  2639. }
  2640. })
  2641. }).catch(() => {
  2642. this.$message({ type: 'info', message: '已取消数据同步' })
  2643. })
  2644. },
  2645. handleRowDelete(row) {
  2646. console.log('删除')
  2647. MessageBox.confirm('是否确认删除此信息?', {
  2648. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  2649. }).then(() => {
  2650. this.selectList = []
  2651. this.requestParam = {}
  2652. this.requestParam.name = 'delDownloadedplan'
  2653. this.requestParam.parammaps = {}
  2654. this.requestParam.parammaps.pastureid = row.pastureid
  2655. this.requestParam.parammaps.id = row.id
  2656. PostDataByName(this.requestParam).then(response => {
  2657. if (response.msg === 'fail') {
  2658. this.$notify({ title: '删除失败', message: response.data, type: 'warning', duration: 2000 })
  2659. } else {
  2660. this.$notify({ title: '成功', message: '删除成功', type: 'success', duration: 2000 })
  2661. this.getList()
  2662. }
  2663. })
  2664. }).catch(() => {
  2665. this.$message({ type: 'info', message: '已取消删除' })
  2666. })
  2667. },
  2668. handleRowSort(row){
  2669. this.$prompt('由于混料车和撒料车是一体的,插入顺序不能隔开', '排序', {
  2670. inputPlaceholder:'请输入您要插入的位置',
  2671. confirmButtonText: '确定',
  2672. cancelButtonText: '取消',
  2673. inputPattern: /^\d+$/ ,
  2674. inputErrorMessage: '请检查插入位置序号是否正确'
  2675. }).then(({ value }) => {
  2676. const url = 'authdata/plan/sort/edit'
  2677. const data = {
  2678. planId:row.id,
  2679. mydate:row.mydate,
  2680. sort:value
  2681. }
  2682. postJson(url, data).then(response => {
  2683. if (response.msg === 'fail') {
  2684. this.$notify({ title: '失败', message: response.data, type: 'error', duration: 2000 })
  2685. } else {
  2686. this.$notify({ title: '成功', message: '成功', type: 'success', duration: 2000 })
  2687. this.getList()
  2688. }
  2689. })
  2690. }).catch(() => {
  2691. this.$message({
  2692. type: 'info',
  2693. message: '取消排序'
  2694. });
  2695. });
  2696. },
  2697. handleSpan() {
  2698. this.mergekeys.forEach(key => {
  2699. this.spanObj[key] = []
  2700. let position = 0
  2701. this.table2.list.forEach((item, index) => {
  2702. if (index === 0) {
  2703. this.spanObj[key].push(1)
  2704. position = 0
  2705. } else {
  2706. if (key == 'description') {
  2707. if (this.table2.list[index][key] === this.table2.list[index - 1][key] && this.table2.list[index]['sort'] === this.table2.list[index - 1]['sort']) {
  2708. this.spanObj[key][position] += 1
  2709. this.spanObj[key].push(0)
  2710. } else {
  2711. this.spanObj[key].push(1)
  2712. position = index
  2713. }
  2714. } else {
  2715. if (this.table2.list[index][key] === this.table2.list[index - 1][key]) {
  2716. this.spanObj[key][position] += 1
  2717. this.spanObj[key].push(0)
  2718. } else {
  2719. this.spanObj[key].push(1)
  2720. position = index
  2721. }
  2722. }
  2723. }
  2724. })
  2725. })
  2726. },
  2727. objectSpanMethod({ row, column, rowIndex, columnIndex }) {
  2728. for (let i = 0; i < this.mergekeys.length; i++) {
  2729. if (column.property === this.mergekeys[i]) {
  2730. const _row = this.spanObj[this.mergekeys[i]][rowIndex]
  2731. const _col = _row > 0 ? 1 : 0
  2732. return {
  2733. rowspan: _row,
  2734. colspan: _col
  2735. }
  2736. }
  2737. }
  2738. },
  2739. form_deleteRecord(){
  2740. this.deleteRecord.dialogStatus = 'deleteRecord'
  2741. this.deleteRecord.dialogFormVisible = true
  2742. this.deleteRecord.mydate = this.table.getdataListParm.parammaps.mydate
  2743. this.getDeleteRecordList()
  2744. },
  2745. changeDeleteRecordDate(){
  2746. this.getDeleteRecordList()
  2747. },
  2748. getDeleteRecordList(){
  2749. const url = 'authdata/GetDataByName'
  2750. const data = {}
  2751. data.name = 'getDownloadedplanDeleteList'
  2752. data.page = 1
  2753. data.offset = 1
  2754. data.pagecount = ""
  2755. data.returntype = "Map"
  2756. data.parammaps = {}
  2757. data.parammaps.pastureid = Cookies.get('pastureid')
  2758. data.parammaps.mydate = this.deleteRecord.mydate
  2759. postJson(url, data).then(response => {
  2760. if(response.data !== null){
  2761. this.deleteRecord.list = response.data.list
  2762. }else{
  2763. this.deleteRecord.list = []
  2764. }
  2765. this.deleteRecord.total = response.data.total
  2766. })
  2767. },
  2768. handleSelect(val) {
  2769. console.log('勾选数据', val)
  2770. this.selectList = val
  2771. },
  2772. handleTakeEffect() {
  2773. if (this.selectList.length == 0) {
  2774. this.$message({ type: 'error', message: '请选择车次信息', duration: 2000 })
  2775. } else {
  2776. MessageBox.confirm('当前选中' + this.selectList.length + '条信息,是否生效?', {
  2777. confirmButtonText: '确认',
  2778. cancelButtonText: '取消',
  2779. type: 'warning'
  2780. }).then(() => {
  2781. for (let i = 0; i < this.selectList.length; i++) {
  2782. // this.$set(this.selectList[i], 'enable', '1')
  2783. this.selectList[i].enable = 1
  2784. }
  2785. console.log('生效', this.selectList)
  2786. this.requestParam.common = {
  2787. 'returnmap': '0'
  2788. }
  2789. this.requestParam.data = []
  2790. this.requestParam.data[0] = {
  2791. 'name': 'insertSpotList',
  2792. 'resultmaps': {
  2793. 'list': this.selectList
  2794. }
  2795. }
  2796. this.requestParam.data[0].children = []
  2797. this.requestParam.data[0].children[0] = {
  2798. 'name': 'updateDownloadedplanEnable',
  2799. 'type': 'e',
  2800. 'parammaps': {
  2801. enable: '@insertSpotList.enable',
  2802. id: '@insertSpotList.id',
  2803. pastureid: '@insertSpotList.pastureid'
  2804. }
  2805. }
  2806. ExecDataByConfig(this.requestParam).then(response => {
  2807. console.log('生效保存发送参数', this.requestParam)
  2808. if (response.msg === 'fail') {
  2809. this.$notify({ title: '生效失败', message: response.data, type: 'warning', duration: 2000 })
  2810. } else {
  2811. this.$notify({ title: '成功', message: '生效成功', type: 'success', duration: 2000 })
  2812. this.getList()
  2813. }
  2814. })
  2815. })
  2816. }
  2817. },
  2818. handleDisable() {
  2819. if (this.selectList.length == 0) {
  2820. this.$message({type: 'error', message: '请选择车次信息', duration: 2000 })
  2821. } else {
  2822. MessageBox.confirm('当前选中' + this.selectList.length + '条信息,是否禁用?', {
  2823. confirmButtonText: '确认',
  2824. cancelButtonText: '取消',
  2825. type: 'warning'
  2826. }).then(() => {
  2827. for (let i = 0; i < this.selectList.length; i++) {
  2828. // this.$set(this.selectList[i], 'enable', '1')
  2829. this.selectList[i].enable = 0
  2830. }
  2831. console.log('禁用', this.selectList)
  2832. this.requestParam.common = {
  2833. 'returnmap': '0'
  2834. }
  2835. this.requestParam.data = []
  2836. this.requestParam.data[0] = {
  2837. 'name': 'insertSpotList',
  2838. 'resultmaps': {
  2839. 'list': this.selectList
  2840. }
  2841. }
  2842. this.requestParam.data[0].children = []
  2843. this.requestParam.data[0].children[0] = {
  2844. 'name': 'updateDownloadedplanEnable',
  2845. 'type': 'e',
  2846. 'parammaps': {
  2847. enable: '@insertSpotList.enable',
  2848. id: '@insertSpotList.id',
  2849. pastureid: '@insertSpotList.pastureid'
  2850. }
  2851. }
  2852. ExecDataByConfig(this.requestParam).then(response => {
  2853. console.log('禁用保存发送参数', this.requestParam)
  2854. if (response.msg === 'fail') {
  2855. this.$notify({ title: '禁用失败', message: response.data, type: 'warning', duration: 2000 })
  2856. } else {
  2857. this.$notify({ title: '成功', message: '禁用成功', type: 'success', duration: 2000 })
  2858. this.getList()
  2859. }
  2860. })
  2861. })
  2862. }
  2863. },
  2864. handlePrint() {
  2865. this.downLoad.getdataListParm.parammaps.date = this.table.getdataListParm.parammaps.mydate
  2866. this.downLoad.getdataListParm.parammaps.lpplantype = this.table.getdataListParm.parammaps.lpplantype
  2867. this.downLoad.getdataListParm.parammaps.times = this.table.getdataListParm.parammaps.times
  2868. this.downLoad.getdataListParm.parammaps.enable = this.table.getdataListParm.parammaps.enable
  2869. this.downLoad.getdataListParm.parammaps.enable2 = this.table.getdataListParm.parammaps.enable2
  2870. var exportTitle = ''
  2871. if (this.table.getdataListParm.parammaps.plandimen == '1') {
  2872. if (this.table.getdataListParm.parammaps.enable3 == '0') {
  2873. this.downLoad.getdataListParm.name = 'downloadPlanTLJDTMR'
  2874. exportTitle = this.table.getdataListParm.parammaps.mydate + '投料简打'
  2875. } else if (this.table.getdataListParm.parammaps.enable3 == '1') {
  2876. this.downLoad.getdataListParm.name = 'downloadPlanTLLDTMR'
  2877. exportTitle = this.table.getdataListParm.parammaps.mydate + '累加投料'
  2878. } else if (this.table.getdataListParm.parammaps.enable3 == '2') {
  2879. this.downLoad.getdataListParm.name = 'downloadPlanSLJDTMR'
  2880. exportTitle = this.table.getdataListParm.parammaps.mydate + '撒料简打'
  2881. } else if (this.table.getdataListParm.parammaps.enable3 == '3') {
  2882. this.downLoad.getdataListParm.name = 'downloadPlanTSLJDTMR'
  2883. exportTitle = this.table.getdataListParm.parammaps.mydate + '投撒料简打'
  2884. } else if (this.table.getdataListParm.parammaps.enable3 == '4') {
  2885. this.downLoad.getdataListParm.name = 'downloadPlanTSLLDTMR'
  2886. exportTitle = this.table.getdataListParm.parammaps.mydate + '投撒料累加'
  2887. } else if (this.table.getdataListParm.parammaps.enable3 == '5') {
  2888. this.downLoad.getdataListParm.name = 'downloadPlanBZJDTMR'
  2889. exportTitle = this.table.getdataListParm.parammaps.mydate + '包装简打'
  2890. } else {
  2891. this.downLoad.getdataListParm.name = 'downloadPlanSFJDTMR'
  2892. exportTitle = this.table.getdataListParm.parammaps.mydate + '实发简打'
  2893. }
  2894. } else {
  2895. if (this.table.getdataListParm.parammaps.enable3 == '0') {
  2896. this.downLoad.getdataListParm.name = 'downloadPlanTLJD'
  2897. exportTitle = this.table.getdataListParm.parammaps.mydate + '投料简打'
  2898. } else if (this.table.getdataListParm.parammaps.enable3 == '1') {
  2899. this.downLoad.getdataListParm.name = 'downloadPlanTLLD'
  2900. exportTitle = this.table.getdataListParm.parammaps.mydate + '累加投料'
  2901. } else if (this.table.getdataListParm.parammaps.enable3 == '2') {
  2902. this.downLoad.getdataListParm.name = 'downloadPlanSLJD'
  2903. exportTitle = this.table.getdataListParm.parammaps.mydate + '撒料简打'
  2904. } else if (this.table.getdataListParm.parammaps.enable3 == '3') {
  2905. this.downLoad.getdataListParm.name = 'downloadPlanTSLJD'
  2906. exportTitle = this.table.getdataListParm.parammaps.mydate + '投撒料简打'
  2907. } else if (this.table.getdataListParm.parammaps.enable3 == '4') {
  2908. this.downLoad.getdataListParm.name = 'downloadPlanTSLLD'
  2909. exportTitle = this.table.getdataListParm.parammaps.mydate + '投撒料累加'
  2910. } else if (this.table.getdataListParm.parammaps.enable3 == '5') {
  2911. this.downLoad.getdataListParm.name = 'downloadPlanBZJD'
  2912. exportTitle = this.table.getdataListParm.parammaps.mydate + '包装简打'
  2913. } else {
  2914. this.downLoad.getdataListParm.name = 'downloadPlanSFJD'
  2915. exportTitle = this.table.getdataListParm.parammaps.mydate + '实发简打'
  2916. }
  2917. }
  2918. GetReportform(this.downLoad.getdataListParm).then(response => {
  2919. if (response.data.list !== null) {
  2920. this.downLoad.labelList = []
  2921. var filterValArr = []
  2922. for (let i = 0; i < response.data.list.data1.length; i++) {
  2923. this.downLoad.labelList.push(response.data.list.data1[i].label)
  2924. filterValArr.push(response.data.list.data1[i].prop)
  2925. }
  2926. this.downLoad.list = response.data.list.data2
  2927. } else {
  2928. this.downLoad.list = []
  2929. }
  2930. let data = []
  2931. for(let i=0;i<filterValArr.length;i++){
  2932. let obj = {}
  2933. obj.field = filterValArr[i]
  2934. obj.columnSize = i
  2935. for(let j=i;j<this.downLoad.labelList.length;j++){
  2936. obj.displayName = this.downLoad.labelList[i]
  2937. }
  2938. if(obj.field !== undefined && obj.displayName !== undefined){
  2939. data.push(obj)
  2940. }
  2941. for(let i=0;i<this.downLoad.list.length;i++){
  2942. if(this.downLoad.list[i][obj.displayName] == null || this.downLoad.list[i][obj.displayName] == undefined){
  2943. this.downLoad.list[i][obj.displayName] = ''
  2944. }
  2945. }
  2946. }
  2947. console.log(this.downLoad.list)
  2948. printJS({
  2949. printable:this.downLoad.list,
  2950. properties:data,
  2951. type:'json',
  2952. header:exportTitle,
  2953. //样式设置
  2954. gridStyle:'border:1px solid #ccc;',
  2955. gridHeaderStyle:'border:1px solid #ccc;text-align:center'
  2956. })
  2957. })
  2958. },
  2959. handleDelete(){
  2960. if (this.selectList.length == 0) {
  2961. this.$message({ type: 'error', message: '请选择计划', duration: 2000 })
  2962. } else {
  2963. MessageBox.confirm('当前选中' + this.selectList.length + '条信息,是否删除?', {
  2964. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  2965. }).then(() => {
  2966. console.log(this.selectList)
  2967. this.requestParam.common = { 'returnmap': '0' }
  2968. this.requestParam.data = []
  2969. this.requestParam.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.selectList }}
  2970. this.requestParam.data[0].children = []
  2971. this.requestParam.data[0].children[0] = { 'name': 'delDownloadedplan', 'type': 'e', 'parammaps': {
  2972. id: '@insertSpotList.id',
  2973. pastureid: '@insertSpotList.pastureid'
  2974. }}
  2975. ExecDataByConfig(this.requestParam).then(response => {
  2976. console.log('删除保存发送参数', this.requestParam)
  2977. if (response.msg === 'fail') {
  2978. this.$notify({ title: '删除失败', message: response.data, type: 'warning', duration: 2000 })
  2979. } else {
  2980. this.$notify({ title: '', message: '删除成功', type: 'success', duration: 2000 })
  2981. this.getList()
  2982. }
  2983. })
  2984. })
  2985. }
  2986. },
  2987. handleDataUpload(){
  2988. let a = Cookies.get('url')
  2989. let b = a.search(8081)
  2990. let c = a.substring(0,a.search(8081)) + '8082'
  2991. let d = a.substring(0,a.lastIndexOf('/'))
  2992. console.log(d)
  2993. let url = ''
  2994. if(b == -1){
  2995. url = d + ':8082'
  2996. }else{
  2997. url = c
  2998. }
  2999. let _url = url + '/authdata/feeding/push'
  3000. let data = {
  3001. date:parseTime(new Date(), '{y}-{m}-{d}'),
  3002. pastureId:Cookies.get('pastureid')
  3003. }
  3004. console.log(_url,'_url')
  3005. postJson2(_url, data).then(response => {
  3006. if(response.msg == 'ok'){
  3007. this.$notify({ title: '', message: response.data, type: 'success', duration: 2000 })
  3008. }else{
  3009. this.$notify({ title: '上传失败', message: response.data, type: 'warning', duration: 2000 })
  3010. }
  3011. })
  3012. },
  3013. handleUpdate2(row){
  3014. for (let i = 0; i < this.table2.list.length; i++) {
  3015. if (this.table2.list[i].Edit == true) {
  3016. this.$message({ type: 'error', message: '当前内容未保存,请点击取消或保存继续进行操作', duration: 2000 })
  3017. return false
  3018. }
  3019. }
  3020. // 编辑true,不可编辑false
  3021. row.Edit = true
  3022. row.NoEdit = false
  3023. // 新增false,编辑false,编辑保存true
  3024. row.isUpdate = false
  3025. row.isUpdateSave = true
  3026. },
  3027. updateData2(row,type){
  3028. const url = 'authdata/dailydata/edit'
  3029. const data = {}
  3030. data.pid = row.pid
  3031. data.weight = row.weight
  3032. data.sort = row.sort
  3033. // 饲料
  3034. if(type == '0'){
  3035. data.location = 0
  3036. data.fid = row.fid
  3037. }else{
  3038. // 车辆||栏舍
  3039. data.location = 1
  3040. data.fbarid = row.fbarid
  3041. }
  3042. data.date = this.table.getdataListParm.parammaps.mydate
  3043. data.sort = row.sort
  3044. postJson(url, data).then(response => {
  3045. if(response.msg == 'ok'){
  3046. this.$notify({ title: '', message: '修改成功', type: 'success', duration: 2000 })
  3047. this.getList2()
  3048. this.getList3()
  3049. }else{
  3050. this.$notify({ title: '失败', message: response.data, type: 'warning', duration: 2000 })
  3051. }
  3052. })
  3053. },
  3054. updateCancel2(row){
  3055. row.Edit = false
  3056. row.NoEdit = true
  3057. // 新增false,编辑true,编辑保存false
  3058. row.isCreate = false
  3059. row.isUpdate = true
  3060. row.isUpdateSave = false
  3061. this.getList2()
  3062. },
  3063. handleUpdate3(row){
  3064. for (let i = 0; i < this.table3.list.length; i++) {
  3065. if (this.table3.list[i].Edit == true) {
  3066. this.$message({ type: 'error', message: '当前内容未保存,请点击取消或保存继续进行操作', duration: 2000 })
  3067. return false
  3068. }
  3069. }
  3070. // 编辑true,不可编辑false
  3071. row.Edit = true
  3072. row.NoEdit = false
  3073. // 新增false,编辑false,编辑保存true
  3074. row.isUpdate = false
  3075. row.isUpdateSave = true
  3076. },
  3077. updateData3(row,type){
  3078. const url = 'authdata/dailydata/edit'
  3079. const data = {}
  3080. data.pid = row.pid
  3081. data.weight = row.weight
  3082. data.sort = row.sort
  3083. // 饲料
  3084. if(type == '0'){
  3085. data.location = 0
  3086. data.fid = row.fid
  3087. }else{
  3088. // 车辆||栏舍
  3089. data.location = 1
  3090. data.fbarid = row.fbarid
  3091. }
  3092. data.date = this.table.getdataListParm.parammaps.mydate
  3093. data.sort = row.sort
  3094. postJson(url, data).then(response => {
  3095. if(response.msg == 'ok'){
  3096. this.$notify({ title: '', message: '修改成功', type: 'success', duration: 2000 })
  3097. this.getList2()
  3098. this.getList3()
  3099. }else{
  3100. this.$notify({ title: '失败', message: response.data, type: 'warning', duration: 2000 })
  3101. }
  3102. })
  3103. },
  3104. updateCancel3(row){
  3105. row.Edit = false
  3106. row.NoEdit = true
  3107. // 新增false,编辑true,编辑保存false
  3108. row.isCreate = false
  3109. row.isUpdate = true
  3110. row.isUpdateSave = false
  3111. this.getList3()
  3112. },
  3113. changeDriver(value,row){
  3114. const url = 'authdata/PostDataByName'
  3115. const data = {
  3116. name:'updateDownloadedplanDriver',
  3117. parammaps:{
  3118. driverId:value,
  3119. id:row.id
  3120. }
  3121. }
  3122. postJson(url, data).then(response => {
  3123. if(response.msg == 'ok'){
  3124. this.$notify({ title: '', message: '修改成功', type: 'success', duration: 2000 })
  3125. this.getList()
  3126. }else{
  3127. this.$notify({ title: '失败', message: response.data, type: 'warning', duration: 2000 })
  3128. }
  3129. })
  3130. },
  3131. getIsSap() {
  3132. GetDataByName(this.sapUpload.getdataListParm).then(response => {
  3133. // console.log()
  3134. if(response.data.list !== null){
  3135. if(response.data.list[0].inforvalue == 1){
  3136. this.sapUpload.isSap = true
  3137. }else{
  3138. this.sapUpload.isSap = false
  3139. }
  3140. console.log(this.sapUpload.isSap)
  3141. }
  3142. })
  3143. },
  3144. handleSAPUpload(){
  3145. this.sapUpload.dialogStatus = 'sapUpload'
  3146. this.sapUpload.dialogFormVisible = true
  3147. },
  3148. sapUploadData(){
  3149. this.$refs['sapUpload'].validate(valid => {
  3150. if (valid) {
  3151. const url = 'authdata/sap/material'
  3152. const data = {
  3153. // "name":"xdmysapupload",
  3154. "pastureid":Cookies.get('pastureid'),date:parseTime(this.sapUpload.temp.date, '{y}-{m}-{d}')
  3155. }
  3156. postJson(url, data).then(response => {
  3157. if(response.msg == 'ok'){
  3158. this.$notify({ title: '', message: '成功', type: 'success', duration: 2000 })
  3159. this.sapUpload.dialogFormVisible = false
  3160. this.getList()
  3161. }else{
  3162. this.$notify({ title: '失败', message: response.data, type: 'warning', duration: 2000 })
  3163. }
  3164. })
  3165. }
  3166. })
  3167. },
  3168. getIspalyUd(){
  3169. let url = 'authdata/GetDataByName'
  3170. let data = {
  3171. "name":"getSysoptEnable","page":1,"offset":1,"pagecount":1,"returntype":"Map",
  3172. "parammaps":{"pastureid":Cookies.get('pastureid'),"inforname":"gmUdSync"}
  3173. }
  3174. postJson(url,data).then(response => {
  3175. if (response.msg !== 'fail') {
  3176. if(response.data.list[0].inforvalue == 0){
  3177. this.ispalyUd = false
  3178. }else{
  3179. this.ispalyUd = true
  3180. }
  3181. } else {
  3182. this.$notify({ title: '请求失败', message: response.data, type: 'warning', duration: 2000 })
  3183. }
  3184. })
  3185. },
  3186. handleGetUd1(){
  3187. this.sapUpload.dialogStatus = 'udload1'
  3188. this.sapUpload.dialogFormVisible = true
  3189. },
  3190. udData1(){
  3191. this.$refs['sapUpload'].validate(valid => {
  3192. if (valid) {
  3193. let url = 'authdata/gm/udutir/push'
  3194. let data = {
  3195. pastureId:Cookies.get('pastureid'),
  3196. date:parseTime(this.sapUpload.temp.date, '{y}-{m}-{d}')
  3197. }
  3198. postJson(url,data).then(response => {
  3199. if (response.msg !== 'fail') {
  3200. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  3201. this.sapUpload.dialogFormVisible = false
  3202. this.getList()
  3203. } else {
  3204. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  3205. }
  3206. })
  3207. }
  3208. })
  3209. },
  3210. handleGetUd2(){
  3211. this.sapUpload.dialogStatus = 'udload2'
  3212. this.sapUpload.dialogFormVisible = true
  3213. },
  3214. udData2(){
  3215. this.$refs['sapUpload'].validate(valid => {
  3216. if (valid) {
  3217. let url = 'authdata/gm/udbarfeedremain/push'
  3218. let data = {
  3219. pastureId:Cookies.get('pastureid'),
  3220. date:parseTime(this.sapUpload.temp.date, '{y}-{m}-{d}')
  3221. }
  3222. postJson(url,data).then(response => {
  3223. if (response.msg !== 'fail') {
  3224. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  3225. this.sapUpload.dialogFormVisible = false
  3226. this.getList()
  3227. } else {
  3228. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  3229. }
  3230. })
  3231. }
  3232. })
  3233. },
  3234. handleGetUd3(){
  3235. this.sapUpload.dialogStatus = 'udload3'
  3236. this.sapUpload.dialogFormVisible = true
  3237. },
  3238. udData3(){
  3239. this.$refs['sapUpload'].validate(valid => {
  3240. if (valid) {
  3241. let url = 'authdata/gm/udmaterialIssue/push'
  3242. let data = {
  3243. pastureId:Cookies.get('pastureid'),
  3244. date:parseTime(this.sapUpload.temp.date, '{y}-{m}-{d}')
  3245. }
  3246. postJson(url,data).then(response => {
  3247. if (response.msg !== 'fail') {
  3248. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  3249. this.sapUpload.dialogFormVisible = false
  3250. this.getList()
  3251. } else {
  3252. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  3253. }
  3254. })
  3255. }
  3256. })
  3257. },
  3258. handleRowEmpty(row,plan){
  3259. console.log(row,'row')
  3260. MessageBox.confirm('您确定清空该操作序号以下的所有数据,如果您清空的是搅拌车数据,将会同步清空撒料车数据?', {
  3261. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  3262. }).then(() => {
  3263. console.log(this.selectList)
  3264. this.requestParam.common = { 'returnmap': '0' }
  3265. this.requestParam.data = []
  3266. this.requestParam.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.selectList }}
  3267. this.requestParam.data[0].children = []
  3268. this.requestParam.data[0].children[0] = { 'name': 'delDownloadedplan', 'type': 'e', 'parammaps': {
  3269. id: '@insertSpotList.id',
  3270. pastureid: '@insertSpotList.pastureid'
  3271. }}
  3272. const url = 'authdata/PostDataByName'
  3273. const data = {
  3274. name:'clearDeleteDownloadedplan',
  3275. parammaps:{
  3276. pid:row.pid,
  3277. lpplantype:this.table3.getdataListParm.parammaps.lpplantype,
  3278. plan:plan,
  3279. sort:row.sort
  3280. }
  3281. }
  3282. postJson(url,data).then(response => {
  3283. console.log('清空保存发送参数', this.requestParam)
  3284. if (response.msg === 'fail') {
  3285. this.$notify({ title: '清除失败', message: response.data, type: 'warning', duration: 2000 })
  3286. } else {
  3287. this.$notify({ title: '', message: '清除成功', type: 'success', duration: 2000 })
  3288. // this.getList()
  3289. this.getList2()
  3290. this.getList3()
  3291. }
  3292. })
  3293. })
  3294. },
  3295. handleQuickcompletion(){
  3296. if (this.selectList.length == 0) {
  3297. this.$message({ type: 'error', message: '请先选择计划', duration: 2000 })
  3298. } else {
  3299. MessageBox.confirm('您是否确定勾选的状态改为已执行的计划?', {
  3300. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  3301. }).then(() => {
  3302. console.log(this.selectList)
  3303. let arr = []
  3304. for(let i=0;i<this.selectList.length;i++){
  3305. arr.push(this.selectList[i].id)
  3306. }
  3307. const url = '/authdata/plan/artificial/edit'
  3308. const data = {
  3309. planId:arr.join()
  3310. }
  3311. postJson(url,data).then(response => {
  3312. console.log('快速完成保存发送参数', this.requestParam)
  3313. if (response.msg === 'fail') {
  3314. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  3315. } else {
  3316. this.$notify({ title: '', message: '保存成功', type: 'success', duration: 2000 })
  3317. this.getList()
  3318. }
  3319. })
  3320. })
  3321. }
  3322. }
  3323. }
  3324. }
  3325. </script>
  3326. <style>
  3327. .el-table .warning-row {
  3328. background: oldlace;
  3329. }
  3330. .el-table .success-row {
  3331. background: #f0f9eb;
  3332. }
  3333. @page{
  3334. size: auto A4 landscape;
  3335. margin: 3mm;
  3336. }
  3337. .agreeCon {
  3338. background: #fff;
  3339. box-sizing: border-box;
  3340. padding: 2rem 3rem 4rem;
  3341. }
  3342. </style>
  3343. <style lang="scss" scoped>
  3344. .app-container{background: #fff;}
  3345. .operation{}
  3346. .search{margin-top:10px;}
  3347. .table{margin-bottom:20px;}
  3348. .template{
  3349. background: #fff;
  3350. position: relative;
  3351. }
  3352. .table2{
  3353. // float: left;width: 50%;
  3354. background: #fff;
  3355. position: relative;
  3356. .content-table{margin-top: 20px;}
  3357. .contentOperation{right: -50px;z-index: 1;}
  3358. }
  3359. .table3{
  3360. // float: left;width: 50%;
  3361. background: #fff;
  3362. position: relative;
  3363. .content-table{margin-top: 20px;}
  3364. .contentOperation{right: -50px;z-index: 1;}
  3365. }
  3366. /deep/.el-input.is-disabled .el-input__inner{
  3367. color:#000
  3368. }
  3369. </style>