index.vue 142 KB

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