index.vue 143 KB

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