index.vue 75 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821
  1. <template>
  2. <div class="app-container">
  3. <div class="operation">
  4. <el-button v-if="isRoleEdit" class="success" icon="el-icon-plus" style="float: left;" @click="handleCreate">新增车次</el-button>
  5. <el-button v-if="isRoleEdit" class="danger" icon="el-icon-delete" style="float: left;" @click="handleDelete">减少车次</el-button>
  6. <el-button v-if="isRoleEdit" class="success" style="float: left;" @click="handleCheck">校验</el-button>
  7. <el-button v-if="isOrder && isRoleEdit" icon="el-icon-sort" style="float: left;" class="success" @click="handleChangeOrder">更改顺序</el-button>
  8. <div v-else style="float: left;margin-left: 10px;">
  9. <el-button v-if="isRoleEdit" icon="el-icon-folder-checked" class="success" @click="saveChangeOrder">保存</el-button>
  10. <el-button v-if="isRoleEdit" icon="el-icon-close" class="sortCancel" @click="cancelChangeOrder">取消</el-button>
  11. </div>
  12. <el-button v-if="isRoleEdit" class="success" icon="el-icon-open" style="float: left;" @click="handleTakeEffect">生效</el-button>
  13. <el-button v-if="isRoleEdit" class="danger" icon="el-icon-turn-off" style="float: left;" @click="handleDisable">禁用</el-button>
  14. <el-button class="import" style="float: right;" @click="handleHistoryRecords">历史记录</el-button>
  15. </div>
  16. <div class="search" />
  17. <!-- <div class="table">
  18. <el-table
  19. id="table"
  20. :key="table.tableKey"
  21. v-loading="table.listLoading"
  22. element-loading-text="给我一点时间"
  23. :data="table.list"
  24. border
  25. fit
  26. highlight-current-row
  27. style="width: 100%;"
  28. :row-style="rowStyle"
  29. :cell-style="cellStyle"
  30. class="elTable table-fixed"
  31. row-key="id"
  32. @selection-change="handleSelect"
  33. >
  34. <el-table-column type="selection" min-width="50" />
  35. <el-table-column label="车次" min-width="80px" align="center">
  36. <template slot-scope="scope">
  37. <span v-if="scope.row.NoEdit">{{ scope.row.sort }}</span>
  38. <el-input v-if="scope.row.Edit" v-model="scope.row.sort" type="number" style="width:95%;padding:10px 0;" />
  39. </template>
  40. </el-table-column>
  41. <el-table-column label="栏舍" min-width="110px" align="center">
  42. <template slot-scope="scope">
  43. <span v-if="scope.row.NoEdit">{{ scope.row.qstr }}</span>
  44. <el-select v-if="scope.row.Edit" v-model="scope.row.barid" multiple filterable placeholder="栏舍名称" class="filter-item" style="width:95%;padding:10px 0;" @change="changeBars">
  45. <el-option v-for="item in barsList" :key="item.id" :label="item.bname" :value="item.id" />
  46. </el-select>
  47. </template>
  48. </el-table-column>
  49. <el-table-column label="TMR编号" prop="weight" min-width="110px" align="center">
  50. <template slot-scope="scope">
  51. <span v-if="scope.row.NoEdit">{{ scope.row.tmrcode }}</span>
  52. <el-select v-if="scope.row.Edit" v-model="scope.row.tmrid" filterable placeholder="" class="filter-item" style="width:95%;padding:10px 0;" @change="(value)=> {changeTMRNumber(value, scope.row)}">
  53. <el-option v-for="item in TMRNumberList" :key="item.id" :label="item.eqcode" :value="item.id" />
  54. </el-select>
  55. </template>
  56. </el-table-column>
  57. <el-table-column label="生效" min-width="70px" align="center">
  58. <template slot-scope="scope">
  59. <el-switch v-model="scope.row.enable" :disabled="scope.row.NoEdit==true" active-color="#13ce66" inactive-color="#ff4949" :active-value="1" :inactive-value="0" @change="handleEnableChange(scope.$index, scope.row)" />
  60. </template>
  61. </el-table-column>
  62. <el-table-column label="班次" min-width="120px" align="center">
  63. <template slot-scope="scope">
  64. <span v-if="scope.row.NoEdit">{{ scope.row.times }}</span>
  65. <el-select v-if="scope.row.Edit" v-model="scope.row.times" filterable placeholder="" class="filter-item" style="width:95%;padding:10px 0;" @change="(value)=> {changeTimes(value, scope.row)}">
  66. <el-option v-for="item in frequencyList" :key="item.id" :label="item.name" :value="item.id" />
  67. </el-select>
  68. </template>
  69. </el-table-column>
  70. <el-table-column label="撒料计划车次跟随" min-width="90px" align="center">
  71. <template slot-scope="scope">
  72. <span v-if="scope.row.NoEdit">{{ scope.row.lppcode }}</span>
  73. <el-select v-if="scope.row.Edit" v-model="scope.row.lppid" filterable clearable placeholder="" class="filter-item" style="width:95%;padding:10px 0;" @change="(value)=> {changeCarFollow(value, scope.row)}">
  74. <el-option v-for="item in carFollowList" :key="item.id" :label="item.lppcode" :value="item.id" />
  75. </el-select>
  76. </template>
  77. </el-table-column>
  78. <el-table-column label="剩料处理方式" min-width="130px" align="center">
  79. <template slot-scope="scope">
  80. <span v-if="scope.row.NoEdit">{{ scope.row.treatmethod }}</span>
  81. <el-select v-if="scope.row.Edit" v-model="scope.row.treatmethod" filterable placeholder="" class="filter-item" style="width:95%;padding:10px 0;" @change="(value)=> {changeResidueDisposal(value, scope.row)}">
  82. <el-option v-for="item in residueDisposalList" :key="item.value" :label="item.label" :value="item.label" />
  83. </el-select>
  84. </template>
  85. </el-table-column>
  86. <el-table-column label="转投栏舍" min-width="130px" align="center">
  87. <template slot-scope="scope">
  88. <span v-if="scope.row.NoEdit">{{ scope.row.hstr }}</span>
  89. <el-select v-if="scope.row.Edit" v-model="scope.row.useinbarid" :disabled="scope.row.treatmethod == '继续饲喂'" multiple filterable placeholder="" class="filter-item" style="width:95%;padding:10px 0;" @change="changeTransferbars">
  90. <el-option v-for="item in transferbarsList" :key="item.id" :label="item.bname" :value="item.id" />
  91. </el-select>
  92. </template>
  93. </el-table-column>
  94. <el-table-column label="操作" align="center" width="80" class-name="small-padding fixed-width" fixed="right">
  95. <template slot-scope="{row}">
  96. <el-button v-if="row.isCreate && isRoleEdit" :disabled="isokDisable" icon="el-icon-folder-checked" class="miniSuccess" @click="createData(row)" />
  97. <span v-if="row.isCreate && isRoleEdit" class="centerSpan">|</span>
  98. <el-button v-if="row.isCreate && isRoleEdit" class="minCancel" icon="el-icon-close" @click="createCancel(row)" />
  99. <el-button v-if="row.isUpdate && isRoleEdit" class="miniSuccess" icon="el-icon-edit-outline" @click="handleUpdate(row)" />
  100. <span v-if="row.isUpdate && isRoleEdit" class="centerSpan">|</span>
  101. <el-button v-if="row.isUpdate && isRoleEdit" class="miniDanger" icon="el-icon-delete" @click="handleRowDelete(row)" />
  102. <el-button v-if="row.isUpdateSave && isRoleEdit" :disabled="isokDisable" icon="el-icon-folder-checked" class="miniSuccess" @click="updateData(row)" />
  103. <span v-if="row.isUpdateSave && isRoleEdit" class="centerSpan">|</span>
  104. <el-button v-if="row.isUpdateSave && isRoleEdit" class="minCancel" icon="el-icon-close" @click="updateCancel(row)" />
  105. </template>
  106. </el-table-column>
  107. </el-table>
  108. <span v-if="table.listLoading == false" style="margin-right: 30px;margin-top: 10px;font-size: 14px;">共{{ table.total }}条</span>
  109. </div> -->
  110. <div class="table">
  111. <el-table
  112. id="table"
  113. :key="table.tableKey"
  114. v-loading="table.listLoading"
  115. element-loading-text="给我一点时间"
  116. :data="table.list"
  117. border
  118. fit
  119. highlight-current-row
  120. style="width: 100%;"
  121. :row-style="rowStyle"
  122. :cell-style="cellStyle"
  123. class="elTable table-fixed"
  124. row-key="id"
  125. @selection-change="handleSelect"
  126. >
  127. <el-table-column type="selection" min-width="50" />
  128. <el-table-column label="车次" min-width="80px" align="center">
  129. <template slot-scope="scope">
  130. <span>{{ scope.row.sort }}</span>
  131. </template>
  132. </el-table-column>
  133. <el-table-column label="栏舍" min-width="110px" align="center">
  134. <template slot-scope="scope">
  135. <span>{{ scope.row.qstr }}</span>
  136. </template>
  137. </el-table-column>
  138. <el-table-column label="TMR编号" prop="weight" min-width="110px" align="center">
  139. <template slot-scope="scope">
  140. <span>{{ scope.row.tmrcode }}</span>
  141. </template>
  142. </el-table-column>
  143. <el-table-column label="生效" min-width="70px" align="center">
  144. <template slot-scope="scope">
  145. <el-switch v-model="scope.row.enable" :disabled="scope.row.NoEdit==true" active-color="#13ce66" inactive-color="#ff4949" :active-value="1" :inactive-value="0" />
  146. </template>
  147. </el-table-column>
  148. <el-table-column label="班次" min-width="120px" align="center">
  149. <template slot-scope="scope">
  150. <span>{{ scope.row.times }}</span>
  151. </template>
  152. </el-table-column>
  153. <el-table-column label="撒料计划车次跟随" min-width="90px" align="center">
  154. <template slot-scope="scope">
  155. <span>{{ scope.row.lppcode }}</span>
  156. </template>
  157. </el-table-column>
  158. <el-table-column label="剩料处理方式" min-width="130px" align="center">
  159. <template slot-scope="scope">
  160. <span >{{ scope.row.treatmethod }}</span>
  161. </template>
  162. </el-table-column>
  163. <el-table-column label="转投栏舍" min-width="130px" align="center">
  164. <template slot-scope="scope">
  165. <span >{{ scope.row.hstr }}</span>
  166. </template>
  167. </el-table-column>
  168. <!-- <el-table-column label="操作" align="center" width="80" class-name="small-padding fixed-width" fixed="right">
  169. <template slot-scope="{row}">
  170. <el-button v-if="row.isCreate && isRoleEdit" :disabled="isokDisable" icon="el-icon-folder-checked" class="miniSuccess" @click="createData(row)" />
  171. <span v-if="row.isCreate && isRoleEdit" class="centerSpan">|</span>
  172. <el-button v-if="row.isCreate && isRoleEdit" class="minCancel" icon="el-icon-close" @click="createCancel(row)" />
  173. <el-button v-if="row.isUpdate && isRoleEdit" class="miniSuccess" icon="el-icon-edit-outline" @click="handleUpdate(row)" />
  174. <span v-if="row.isUpdate && isRoleEdit" class="centerSpan">|</span>
  175. <el-button v-if="row.isUpdate && isRoleEdit" class="miniDanger" icon="el-icon-delete" @click="handleRowDelete(row)" />
  176. <el-button v-if="row.isUpdateSave && isRoleEdit" :disabled="isokDisable" icon="el-icon-folder-checked" class="miniSuccess" @click="updateData(row)" />
  177. <span v-if="row.isUpdateSave && isRoleEdit" class="centerSpan">|</span>
  178. <el-button v-if="row.isUpdateSave && isRoleEdit" class="minCancel" icon="el-icon-close" @click="updateCancel(row)" />
  179. </template>
  180. </el-table-column> -->
  181. <el-table-column label="操作" align="center" width="180" class-name="small-padding fixed-width" fixed="right">
  182. <template slot-scope="{row}">
  183. <span v-if="isRoleEdit" class="centerSpan">|</span>
  184. <el-button v-if="isRoleEdit" icon="el-icon-edit-outline" class="miniSuccess" @click="handleUpdate(row)" />
  185. <span v-if="isRoleEdit" class="centerSpan">|</span>
  186. <el-button v-if="isRoleEdit" icon="el-icon-delete" class="miniDanger" @click="handleRowDelete(row)" />
  187. </template>
  188. </el-table-column>
  189. </el-table>
  190. <span v-if="table.listLoading == false" style="margin-right: 30px;margin-top: 10px;font-size: 14px;">共{{ table.total }}条</span>
  191. </div>
  192. <!-- 新增/编辑 -->
  193. <el-dialog :fullscreen="dialogFull" :visible.sync="create.dialogFormVisible" :close-on-click-modal="false" width="90%">
  194. <template slot="title">
  195. <div class="avue-crud__dialog__header">
  196. <span class="el-dialog__title">
  197. <span style="display:inline-block;width:3px;height:20px;margin-right:5px; float: left;margin-top:2px" />
  198. {{ textMap[create.dialogStatus] }}
  199. </span>
  200. <div class="avue-crud__dialog__menu" @click="dialogFull? dialogFull=false: dialogFull=true">
  201. <svg-icon v-if="dialogFull" icon-class="exit-fullscreen" />
  202. <svg-icon v-else icon-class="fullscreen" />
  203. </div>
  204. </div>
  205. </template>
  206. <div class="app-add">
  207. <el-form ref="temp" :rules="create.rules" :model="create.temp" label-position="right" label-width="155px" style="width: 100%;margin:0 auto 50px">
  208. <el-row>
  209. <el-col :span="6">
  210. <el-form-item label="车次:" prop="sort">
  211. <el-input ref="sort" v-model="create.temp.sort" class="filter-item" type="number" placeholder="车次" />
  212. </el-form-item>
  213. </el-col>
  214. <el-col :span="6">
  215. <el-form-item label="栏舍名称:" prop="barid">
  216. <el-select v-model="create.temp.barid" multiple filterable placeholder="栏舍名称" class="filter-item" style="width:95%;padding:10px 0;" @change="changeBars">
  217. <el-option v-for="item in barsList" :key="item.id" :label="item.bname" :value="item.id" />
  218. </el-select>
  219. </el-form-item>
  220. </el-col>
  221. <el-col :span="6">
  222. <el-form-item label="TMR编号:" prop="tmrid">
  223. <el-select v-model="create.temp.tmrid" filterable placeholder="TMR编号" class="filter-item" style="width: 100%;" @change="changeTMRNumber">
  224. <el-option v-for="item in TMRNumberList" :key="item.id" :label="item.eqcode" :value="item.id" />
  225. </el-select>
  226. </el-form-item>
  227. </el-col>
  228. <el-col :span="6">
  229. <el-form-item label="生效:" prop="sort">
  230. <el-switch ref="enable" v-model="create.temp.enable" active-color="#13ce66" inactive-color="#ff4949" :active-value="1" :inactive-value="0" />
  231. </el-form-item>
  232. </el-col>
  233. </el-row>
  234. <el-row>
  235. <el-col :span="6">
  236. <el-form-item label="班次:" prop="times">
  237. <el-select v-model="create.temp.times" filterable placeholder="班次" class="filter-item" style="width: 100%;" @change="changeTimes">
  238. <el-option v-for="item in frequencyList" :key="item.id" :label="item.name" :value="item.id" />
  239. </el-select>
  240. </el-form-item>
  241. </el-col>
  242. <el-col :span="6">
  243. <el-form-item label="撒料计划车次跟随:" prop="lppid">
  244. <el-select v-model="create.temp.lppid" filterable placeholder="撒料计划车次跟随" class="filter-item" style="width: 100%;" @change="changeCarFollow">
  245. <el-option v-for="item in carFollowList" :key="item.id" :label="item.lppcode" :value="item.id" />
  246. </el-select>
  247. </el-form-item>
  248. </el-col>
  249. <el-col :span="6">
  250. <el-form-item label="时间:" prop="rtime">
  251. <el-time-picker v-model="create.temp.rtime" type="datetime" placeholder="选择时间" format="HH:mm" value-format="HH:mm" style="display: inline-block;width: 95%;" />
  252. </el-form-item>
  253. </el-col>
  254. <el-col :span="6">
  255. <el-form-item label="剩料处理方式:" prop="treatmethod">
  256. <el-select v-model="create.temp.treatmethod" filterable placeholder="剩料处理方式" class="filter-item" style="width: 100%;" @change="changeResidueDisposal">
  257. <el-option v-for="item in residueDisposalList" :key="item.value" :label="item.label" :value="item.label" />
  258. </el-select>
  259. </el-form-item>
  260. </el-col>
  261. </el-row>
  262. <el-row>
  263. <el-col :span="6">
  264. <el-form-item label="转投栏舍:" prop="useinbarid">
  265. <el-select v-model="create.temp.useinbarid" filterable placeholder="转投栏舍" class="filter-item" style="width: 100%;" @change="changeTransferbars">
  266. <el-option v-for="item in transferbarsList" :key="item.id" :label="item.bname" :value="item.id" />
  267. </el-select>
  268. </el-form-item>
  269. </el-col>
  270. </el-row>
  271. <el-row>
  272. <draggable v-model="barSortList" group="itxst" animation="300" :group="{name: 'dashboard',pull: true}" @start="onStart" @end="onEnd">
  273. <transition-group>
  274. <div style = "width:80px;height:30px;border:1px soild #333;display:inline-block;background: #2ed1f9;padding: 5px 5px;margin-right: 15px;margin-bottom: 15px;" v-for="item in barSortList" key="1">{{item.bname}}</div>
  275. </transition-group>
  276. </draggable>
  277. </el-row>
  278. </el-form>
  279. <div slot="footer" class="dialog-footer">
  280. <el-button class="cancelClose" @click="create.dialogFormVisible = false;getList()">关闭</el-button>
  281. <el-button v-if="create.dialogStatus==='create' || create.dialogStatus==='update'" class="save" :disabled="isokDisable" @click="create.dialogStatus==='create'?createData():updateData()">确认</el-button>
  282. </div>
  283. </div>
  284. </el-dialog>
  285. <!-- 历史记录 -->
  286. <el-dialog :fullscreen="dialogFull" :destroy-on-close="true" :visible.sync="history.dialogFormVisible" :close-on-click-modal="false" width="90%">
  287. <template slot="title">
  288. <div class="avue-crud__dialog__header">
  289. <span class="el-dialog__title">
  290. <span style="display:inline-block;width:3px;height:20px;margin-right:5px; float: left;margin-top:2px" />
  291. {{ textMap[history.dialogStatus] }}
  292. </span>
  293. <div class="avue-crud__dialog__menu" @click="dialogFull? dialogFull=false: dialogFull=true">
  294. <svg-icon v-if="dialogFull" icon-class="exit-fullscreen" />
  295. <svg-icon v-else icon-class="fullscreen" />
  296. </div>
  297. </div>
  298. </template>
  299. <div class="app-history">
  300. <div class="search">
  301. <el-date-picker v-model="history.getdataListParm.parammaps.date" type="date" placeholder="请选择历史记录时间" :clearable="false" style="width: 180px;" format="yyyy-MM-dd" value-format="yyyy-MM-dd" @change="changeDate" />
  302. <!-- <el-button class="successBorder" @click="handleApplication">应用</el-button> -->
  303. </div>
  304. <div class="table">
  305. <el-table
  306. :key="history.tableKey"
  307. v-loading="history.listLoading"
  308. element-loading-text="给我一点时间"
  309. :data="history.list"
  310. border
  311. fit
  312. highlight-current-row
  313. style="width: 100%;"
  314. :row-style="rowStyle"
  315. :cell-style="cellStyle"
  316. class="elTable table-fixed"
  317. >
  318. <el-table-column label="车次" min-width="130px" align="center">
  319. <template slot-scope="scope">
  320. <span>{{ scope.row.sort }}</span>
  321. </template>
  322. </el-table-column>
  323. <el-table-column label="栏舍" min-width="130px" align="center">
  324. <template slot-scope="scope">
  325. <span>{{ scope.row.qstr }}</span>
  326. </template>
  327. </el-table-column>
  328. <el-table-column label="TMR编号" prop="weight" min-width="130px" align="center">
  329. <template slot-scope="scope">
  330. <span>{{ scope.row.tmrcode }}</span>
  331. </template>
  332. </el-table-column>
  333. <el-table-column label="生效" min-width="130px" align="center">
  334. <template slot-scope="scope">
  335. <el-switch v-model="scope.row.enable" disabled active-color="#13ce66" inactive-color="#ff4949" :active-value="1" :inactive-value="0" @change="handleEnableChange(scope.$index, scope.row)" />
  336. </template>
  337. </el-table-column>
  338. <el-table-column label="班次" min-width="130px" align="center">
  339. <template slot-scope="scope">
  340. <span>{{ scope.row.times }}</span>
  341. </template>
  342. </el-table-column>
  343. <el-table-column label="发料计划车次跟随" min-width="130px" align="center">
  344. <template slot-scope="scope">
  345. <span>{{ scope.row.lppcode }}</span>
  346. </template>
  347. </el-table-column>
  348. <el-table-column label="时间" min-width="180px" align="center">
  349. <template slot-scope="scope">
  350. <span>{{ scope.row.rtime }}</span>
  351. </template>
  352. </el-table-column>
  353. <el-table-column label="剩料处理方式" min-width="130px" align="center">
  354. <template slot-scope="scope">
  355. <span>{{ scope.row.treatmethod }}</span>
  356. </template>
  357. </el-table-column>
  358. <el-table-column label="转投栏舍" min-width="130px" align="center">
  359. <template slot-scope="scope">
  360. <span>{{ scope.row.hstr }}</span>
  361. </template>
  362. </el-table-column>
  363. </el-table>
  364. <pagination v-show="history.total>0" :total="history.total" :page.sync="history.getdataListParm.offset" :limit.sync="history.getdataListParm.pagecount" @pagination="getHistoryList" />
  365. </div>
  366. </div>
  367. <div slot="footer" class="dialog-footer">
  368. <el-button class="cancelClose cancelClose1" @click="history.dialogFormVisible = false; ">关闭</el-button>
  369. </div>
  370. </el-dialog>
  371. <!-- 校验 -->
  372. <el-dialog :title="textMap[check.dialogStatus]" :destroy-on-close="true" :visible.sync="check.dialogFormVisible" :close-on-click-modal="false" width="30%">
  373. <div class="check">
  374. <p v-if="check.temp.isDistribution == '0'">当前有栏舍未分配,建议及时进行分配,未分配栏舍如下:</p>
  375. <p v-else>已分配完:当前栏舍已分配完善</p>
  376. {{ check.temp.bnames }}
  377. </div>
  378. <div slot="footer" class="dialog-footer" style="bottom: 10px;">
  379. <el-button class="save" @click="check.dialogFormVisible=false;">确认</el-button>
  380. </div>
  381. </el-dialog>
  382. </div>
  383. </template>
  384. <script>
  385. import { GetDataByName, GetDataByNames, PostDataByName, failproccess, ExecDataByConfig, checkButtons } from '@/api/common'
  386. import Pagination from '@/components/Pagination'
  387. import Sortable from 'sortablejs'
  388. import draggable from 'vuedraggable'
  389. import Cookies from 'js-cookie'
  390. import { MessageBox } from 'element-ui'
  391. export default {
  392. name: 'PushMaterialPlan',
  393. components: { Pagination ,draggable},
  394. data() {
  395. return {
  396. barSortList: [ ],
  397. dialogFull: false,
  398. isRoleEdit: [],
  399. requestParams: [
  400. { name: 'getBarListEnable', offset: 0, pagecount: 0, parammaps: { pastureid: Cookies.get('pastureid') }},
  401. { name: 'getTMRYHList', offset: 0, pagecount: 0, parammaps: { pastureid: Cookies.get('pastureid') }}
  402. ],
  403. barsList: [], // 栏舍
  404. residueDisposalList: [{ value: '0', label: '转投剩料' }, { value: '1', label: '继续饲喂' }], // 剩料处理方式
  405. TMRNumberList: [], // TMR编号
  406. barsNamesIdTempArr: [],
  407. useinbarNamesIdTempArr: [],
  408. // 班次
  409. maxTime: {
  410. getMaxTimesParm: {
  411. name: 'getSysoptEnable',
  412. page: 1,
  413. offset: 1,
  414. pagecount: 1,
  415. returntype: 'Map',
  416. parammaps: {
  417. pastureid: Cookies.get('pastureid'),
  418. inforname: 'times'
  419. }
  420. }
  421. },
  422. frequencyList: [], // 班次
  423. getCarFollowParm: {
  424. name: 'getLPPCodeList',
  425. offset: 0,
  426. pagecount: 0,
  427. parammaps: {
  428. pastureid: Cookies.get('pastureid'),
  429. times: ''
  430. }
  431. },
  432. carFollowList: [], // 发料计划车次跟随
  433. getTransferbarsParm: {
  434. name: 'getBarListEnable',
  435. offset: 0,
  436. pagecount: 0,
  437. parammaps: {
  438. pastureid: Cookies.get('pastureid'),
  439. times: ''
  440. }
  441. },
  442. transferbarsList: [], // 转头栏舍
  443. table: {
  444. getdataListParm: {
  445. name: 'getRemainplanList',
  446. page: 1,
  447. offset: 1,
  448. pagecount: '',
  449. returntype: 'Map',
  450. parammaps: {
  451. pastureid: Cookies.get('pastureid')
  452. }
  453. },
  454. tableKey: 0,
  455. list: [],
  456. total: 0,
  457. listLoading: true,
  458. temp: {},
  459. temp2: {}
  460. },
  461. // 新增/编辑
  462. create: {
  463. dialogFormVisible: false,
  464. dialogStatus: '',
  465. temp: { pastureid: Cookies.get('pastureid'), fname: '', fclassid: '', fclass: '', feedcode: '', source: '用户自定义', printgroupid: '1', printgroup: '无', unitweight: '', uprice: '', allowratio: '', autozone: '', autosecond: '0', autosecondname: '禁用', confirmstart: '0', confirmstartname: '禁用', enable: '1', trgaddress: '', backup1: '', backup2: '', backup3: '', sort: '' },
  466. rules: {
  467. // fname: [{ type: 'string', required: true, message: '必填', trigger: 'blur' }],
  468. // fclassid: [{ type: 'string', required: true, message: '必填', trigger: 'blur' }],
  469. // feedcode: [{ type: 'string', required: true, message: '必填', trigger: 'blur' }]
  470. }
  471. },
  472. history: {
  473. dialogFormVisible: false,
  474. dialogStatus: '',
  475. temp: {},
  476. rules: {},
  477. tableKey: 0,
  478. list: [],
  479. total: 0,
  480. listLoading: true,
  481. getdataDateParm: {
  482. name: 'getRPMaxDate',
  483. page: 1,
  484. offset: 1,
  485. pagecount: 10,
  486. returntype: 'Map',
  487. parammaps: {
  488. pastureid: Cookies.get('pastureid')
  489. }
  490. },
  491. getdataListParm: {
  492. name: 'getRemainplanListDate',
  493. page: 1,
  494. offset: 1,
  495. pagecount: 10,
  496. returntype: 'Map',
  497. parammaps: {
  498. pastureid: Cookies.get('pastureid'),
  499. date: ''
  500. }
  501. }
  502. },
  503. check: {
  504. dialogFormVisible: false,
  505. dialogStatus: '',
  506. getCheckParm: {
  507. name: 'checkRemainplan',
  508. page: 1,
  509. offset: 1,
  510. pagecount: 10,
  511. returntype: 'Map',
  512. parammaps: {
  513. pastureid: Cookies.get('pastureid')
  514. }
  515. },
  516. temp: {
  517. bnames: '',
  518. isDistribution: ''
  519. }
  520. },
  521. textMap: {
  522. create: '新增',
  523. update: '编辑',
  524. history: '历史记录',
  525. check: '提示'
  526. },
  527. requestParam: {},
  528. selectList: [],
  529. isokDisable: false,
  530. rowStyle: { maxHeight: 30 + 'px', height: 30 + 'px' },
  531. cellStyle: { padding: 0 + 'px' },
  532. dropState: false,
  533. isOrder: true
  534. }
  535. },
  536. created() {
  537. this.getButtons()
  538. this.getList()
  539. this.getDownList()
  540. this.getIsDisplay()
  541. },
  542. methods: {
  543. getButtons() {
  544. const Edit = 'SurplusMaterialPlan'
  545. const isRoleEdit = checkButtons(JSON.parse(sessionStorage.getItem('buttons')), Edit)
  546. this.isRoleEdit = isRoleEdit
  547. },
  548. getDownList() {
  549. GetDataByNames(this.requestParams).then(response => {
  550. this.barsList = response.data.getBarListEnable.list
  551. this.TMRNumberList = response.data.getTMRYHList.list
  552. })
  553. },
  554. getIsDisplay() {
  555. GetDataByName(this.maxTime.getMaxTimesParm).then(response => {
  556. if (response.data.list[0].inforvalue == 1) {
  557. this.frequencyList = [{ id: '1', name: '第一班' }]
  558. } else if (response.data.list[0].inforvalue == 2) {
  559. this.frequencyList = [{ id: '1', name: '第一班' }, { id: '2', name: '第二班' }]
  560. } else if (response.data.list[0].inforvalue == 3) {
  561. this.frequencyList = [{ id: '1', name: '第一班' }, { id: '2', name: '第二班' }, { id: '3', name: '第三班' }]
  562. } else if (response.data.list[0].inforvalue == 4) {
  563. this.frequencyList = [{ id: '1', name: '第一班' }, { id: '2', name: '第二班' }, { id: '3', name: '第三班' }, { id: '4', name: '第四班' }]
  564. }
  565. })
  566. },
  567. getList() {
  568. this.table.listLoading = true
  569. GetDataByName(this.table.getdataListParm).then(response => {
  570. console.log('table数据', response.data.list)
  571. if (response.data.list !== null) {
  572. for (let i = 0; i < response.data.list.length; i++) {
  573. this.$set(response.data.list[i], 'Edit', false) // 编辑
  574. this.$set(response.data.list[i], 'NoEdit', true) // 不可编辑/输入
  575. this.$set(response.data.list[i], 'groupEdit', false) // 饲料组编辑
  576. this.$set(response.data.list[i], 'groupNoEdit', true) // 饲料组不可编辑
  577. this.$set(response.data.list[i], 'isCreate', false) // 新增操作
  578. this.$set(response.data.list[i], 'isUpdate', true) // 编辑操作
  579. this.$set(response.data.list[i], 'isUpdateSave', false) // 编辑保存
  580. }
  581. var arr = response.data.list
  582. arr.map(function(i, j) {
  583. // console.log(i, '====')
  584. if (i.qstrids) {
  585. return i.barid = i.qstrids.split(',')
  586. } else {
  587. return i.barid = []
  588. }
  589. })
  590. arr.map(function(i, j) {
  591. if (i.hstrids) {
  592. return i.useinbarid = i.hstrids.split(',')
  593. } else {
  594. return i.useinbarid = []
  595. }
  596. })
  597. this.table.list = arr
  598. // this.table.list = response.data.list
  599. this.table.pageNum = response.data.pageNum
  600. this.table.pageSize = response.data.pageSize
  601. // this.rowDrop()
  602. this.table.total = response.data.total
  603. } else {
  604. this.table.list = []
  605. }
  606. setTimeout(() => {
  607. this.table.listLoading = false
  608. }, 100)
  609. })
  610. },
  611. handleEnableChange() {
  612. console.log('点击了生效')
  613. },
  614. handleChangeOrder() {
  615. this.isOrder = false
  616. this.rowDrop()
  617. },
  618. saveChangeOrder() {
  619. // 保存顺序
  620. var sortArr = []
  621. for (let i = 0; i < this.table.list.length; i++) {
  622. var obj = {}
  623. obj.sort = i + 1
  624. obj.id = this.table.list[i].id
  625. obj.pastureid = this.table.list[i].pastureid
  626. sortArr.push(obj)
  627. }
  628. this.requestParam = {}
  629. this.requestParam.common = { 'returnmap': '0' }
  630. this.requestParam.data = []
  631. this.requestParam.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': sortArr }}
  632. this.requestParam.data[0].children = []
  633. this.requestParam.data[0].children[0] = { 'name': 'updateRemainplanSort', 'type': 'e', 'parammaps': {
  634. id: '@insertSpotList.id',
  635. pastureid: '@insertSpotList.pastureid',
  636. sort: '@insertSpotList.sort'
  637. }}
  638. ExecDataByConfig(this.requestParam).then(response => {
  639. console.log('顺序切换保存发送参数', this.requestParam)
  640. if (response.msg === 'fail') {
  641. this.$notify({ title: '顺序切换失败', message: response.data, type: 'warning', duration: 2000 })
  642. } else {
  643. this.$notify({ title: '', message: '顺序切换成功', type: 'success', duration: 2000 })
  644. this.getList()
  645. this.isOrder = true
  646. }
  647. })
  648. },
  649. cancelChangeOrder() {
  650. // 取消顺序
  651. this.getList()
  652. this.isOrder = true
  653. },
  654. // 行拖拽
  655. rowDrop() {
  656. console.log(document.querySelector('#table .el-table__body-wrapper tbody'))
  657. const tbody = document.querySelector('#table .el-table__body-wrapper tbody')
  658. const that = this
  659. var sortable = Sortable.create(tbody, {
  660. disabled: that.dropState,
  661. onChoose({ newIndex, oldIndex }) {
  662. if (that.dropState == true) {
  663. sortable.destroy()
  664. }
  665. },
  666. onEnd({ newIndex, oldIndex }) {
  667. const currRow = that.table.list.splice(oldIndex, 1)[0]
  668. that.table.list.splice(newIndex, 0, currRow)
  669. console.log('索引', newIndex)
  670. console.log('拖动数据', currRow)
  671. console.log('上', that.table.list[newIndex - 1])
  672. console.log('下', that.table.list[newIndex + 1])
  673. }
  674. })
  675. },
  676. // 模板新增
  677. // handleCreate() {
  678. // console.log('点击了新增车次')
  679. // // 编辑true/不可编辑false
  680. // // 新增操true,编辑false,编辑保存false
  681. // this.dropState = true
  682. // for (let i = 0; i < this.table.list.length; i++) {
  683. // if (this.table.list[i].Edit === true) {
  684. // console.log(123)
  685. // this.$message({ type: 'error', message: '当前内容未保存,请点击取消或保存继续进行操作', duration: 2000 })
  686. // return false
  687. // }
  688. // }
  689. // var sort = 1
  690. // if (this.table.list.length > 0) {
  691. // sort = parseInt(this.table.list[this.table.list.length - 1].sort) + 1
  692. // } else {
  693. // sort = 1
  694. // }
  695. // this.table.list.unshift({ 'myId': (new Date()).valueOf(), 'Edit': true, 'NoEdit': false, 'isCreate': true, 'isUpdate': false, 'isUpdateSave': false, 'enable': 1, 'sort': sort, 'ftid': '', 'ftname': '', 'tmrcode': '', 'tmrid': '', 'times': '', 'lppcode': '', 'lppid': '', 'rtime': '', barid: '', 'treatmethod': '', 'useinbar': '', 'useinbarid': '' })
  696. // console.log(this.table.list)
  697. // },
  698. // 新增
  699. handleCreate() {
  700. console.log('点击了新增')
  701. this.resetTemp()
  702. this.dialogFull = false
  703. this.create.dialogStatus = 'create'
  704. this.create.dialogFormVisible = true
  705. },
  706. resetTemp() {
  707. this.create.temp = { pastureid: Cookies.get('pastureid'), 'myId': (new Date()).valueOf(), 'Edit': true, 'NoEdit': false, 'isCreate': true, 'isUpdate': false, 'isUpdateSave': false, 'enable': 1, 'sort': "", 'ftid': '', 'ftname': '', 'tmrcode': '', 'tmrid': '', 'times': '', 'lppcode': '', 'lppid': '', 'rtime': '', barid: '', 'treatmethod': '', 'useinbar': '', 'useinbarid': '' }
  708. },
  709. // // 栏舍
  710. // changeBars(val) {
  711. // console.log('点击了栏舍', val)
  712. // var arr = []
  713. // this.barsList.forEach(function(i) {
  714. // val.forEach(function(j) {
  715. // if (i.id == j) { arr.push(i) }
  716. // })
  717. // })
  718. // console.log('点击了栏舍', arr)
  719. // this.table.temp.barid = arr
  720. // this.barsNamesIdTempArr = arr
  721. // this.$forceUpdate()
  722. // },
  723. changeBars(val) {
  724. console.log(this.barsList)
  725. console.log('点击了栏舍1', val)
  726. var barSortList = []
  727. var barsList = this.barsList
  728. val.forEach(function(i){
  729. barsList.forEach(function(j){
  730. if(i == j.id){
  731. barSortList.push(j)
  732. }
  733. })
  734. })
  735. this.barSortList = barSortList
  736. console.log('点击了栏舍1', barSortList)
  737. this.table.temp.barid = barSortList
  738. this.barsNamesIdTempArr = barSortList
  739. this.$forceUpdate()
  740. },
  741. onStart(){
  742. console.log(2222)
  743. },
  744. onEnd(){
  745. console.log(this.barSortList)
  746. this.table.temp.barid = this.barSortList
  747. this.barsNamesIdTempArr = this.barSortList
  748. },
  749. // // TMR编号
  750. // changeTMRNumber(item, row) {
  751. // row.tmrcode = this.TMRNumberList.find(obj => obj.id == item).tname
  752. // },
  753. changeTMRNumber(item) {
  754. this.create.temp.tmrcode = this.TMRNumberList.find(obj => obj.id === item).eqcode
  755. },
  756. // // 撒料计划车次跟随列表
  757. // changeCarFollow(item, row) {
  758. // if (item == '') {
  759. // row.lppcode = ''
  760. // } else {
  761. // row.lppcode = this.carFollowList.find(obj => obj.id == item).lppcode
  762. // }
  763. // },
  764. changeCarFollow(item, row) {
  765. if (item == '') {
  766. this.create.temp.lppcode = ''
  767. } else {
  768. this.create.temp.lppcode = this.carFollowList.find(obj => obj.id == item).lppcode
  769. }
  770. },
  771. // 班次
  772. // changeTimes(item, row) {
  773. // console.log(item, row)
  774. // this.getCarFollowParm.parammaps.times = item
  775. // this.getCarFollowList(row)
  776. // },
  777. // 班次
  778. changeTimes(item) {
  779. console.log(item)
  780. this.getCarFollowParm.parammaps.times = item
  781. this.getCarFollowList()
  782. },
  783. // 撒料计划车次跟随列表
  784. // getCarFollowList(row) {
  785. // GetDataByName(this.getCarFollowParm).then(response => {
  786. // console.log('撒料计划车次跟随列表数据', response.data.list)
  787. // if (response.data.list !== null) {
  788. // this.carFollowList = response.data.list
  789. // row.lppid = this.carFollowList[0].id
  790. // row.lppcode = this.carFollowList[0].lppcode
  791. // }
  792. // })
  793. // },
  794. getCarFollowList() {
  795. GetDataByName(this.getCarFollowParm).then(response => {
  796. console.log('撒料计划车次跟随列表数据', response.data.list)
  797. if (response.data.list !== null) {
  798. this.carFollowList = response.data.list
  799. this.create.temp.lppid = this.carFollowList[0].id
  800. this.create.temp.lppcode = this.carFollowList[0].lppcode
  801. }
  802. })
  803. },
  804. // changeResidueDisposal(item, row) {
  805. // console.log(item, row)
  806. // this.getCarFollowParm.parammaps.times = item
  807. // this.getTransferbarsList()
  808. // },
  809. changeResidueDisposal(item) {
  810. console.log(item)
  811. this.getCarFollowParm.parammaps.times = item
  812. this.getTransferbarsList()
  813. },
  814. getTransferbarsList() {
  815. GetDataByName(this.getTransferbarsParm).then(response => {
  816. if (response.data.list !== null) {
  817. this.transferbarsList = response.data.list
  818. }
  819. console.log(this.transferbarsList)
  820. })
  821. },
  822. // // 转头栏舍
  823. // changeTransferbars(val) {
  824. // console.log('点击了转头栏舍', val)
  825. // var arr2 = []
  826. // this.transferbarsList.forEach(function(i) {
  827. // val.forEach(function(j) {
  828. // if (i.id == j) { arr2.push(i) }
  829. // })
  830. // })
  831. // this.table.temp2.useinbar = arr2
  832. // this.useinbarNamesIdTempArr = arr2
  833. // this.$forceUpdate()
  834. // },
  835. // 转头栏舍
  836. changeTransferbars(val) {
  837. console.log('点击了转头栏舍', val)
  838. var arr2 = []
  839. this.transferbarsList.forEach(function(i) {
  840. val.forEach(function(j) {
  841. if (i.id == j) { arr2.push(i) }
  842. })
  843. })
  844. this.table.temp2.useinbar = arr2
  845. this.useinbarNamesIdTempArr = arr2
  846. this.$forceUpdate()
  847. },
  848. // createData(row) {
  849. // console.log('点击了新增保存', row)
  850. // if (row.rtime == null || row.rtime == 'null') {
  851. // row.rtime = ''
  852. // }
  853. // if (row.sort == '' && row.barid == '' && row.tmrid == '' && row.times == '' && row.treatmethod == '') {
  854. // this.$message({ type: 'error', message: '车次/栏舍/TMR编号/班次/剩料处理方式不能为空', duration: 2000 })
  855. // return false
  856. // } else if (row.barid == '' && row.tmrid == '' && row.times == '' && row.treatmethod == '') {
  857. // this.$message({ type: 'error', message: '栏舍/TMR编号/班次/剩料处理方式不能为空', duration: 2000 })
  858. // return false
  859. // } else if (row.tmrid == '' && row.times == '' && row.treatmethod == '') {
  860. // this.$message({ type: 'error', message: 'TMR编号/班次/剩料处理方式不能为空', duration: 2000 })
  861. // return false
  862. // } else if (row.times == '' && row.treatmethod == '') {
  863. // this.$message({ type: 'error', message: '班次/剩料处理方式不能为空', duration: 2000 })
  864. // return false
  865. // } else if (row.sort == '' || row.sort == 0) {
  866. // this.$message({ type: 'error', message: '车次不能为空且大于0', duration: 2000 })
  867. // return false
  868. // } else if (row.barid == '') {
  869. // this.$message({ type: 'error', message: '栏舍不能为空', duration: 2000 })
  870. // return false
  871. // } else if (row.tmrid == '') {
  872. // this.$message({ type: 'error', message: 'TMR编号不能为空', duration: 2000 })
  873. // return false
  874. // } else if (row.times == '') {
  875. // this.$message({ type: 'error', message: '班次不能为空', duration: 2000 })
  876. // return false
  877. // } else if (row.treatmethod == '') {
  878. // this.$message({ type: 'error', message: '剩料处理方式不能为空', duration: 2000 })
  879. // return false
  880. // }
  881. // if (row.treatmethod !== '' && row.treatmethod == '转投剩料') {
  882. // if (row.useinbarid == '') {
  883. // this.$message({ type: 'error', message: '转投栏舍不能为空', duration: 2000 })
  884. // return false
  885. // }
  886. // }
  887. // if (row.treatmethod !== '' && row.treatmethod == '继续饲喂') {
  888. // row.useinbarid = '0'
  889. // }
  890. // if (row.rtime == '' || row.rtime == null) {
  891. // row.rtime = ''
  892. // }
  893. // for (let i = 0; i < this.table.list.length; i++) {
  894. // if (row.sort == this.table.list[i].sort) {
  895. // if (row.myId !== this.table.list[i].myId) {
  896. // this.$message({ type: 'error', message: '车次不可重复', duration: 2000 })
  897. // return false
  898. // }
  899. // }
  900. // }
  901. // var isInteger = /^\d+$/
  902. // if (row.sort !== '') {
  903. // if (!isInteger.test(parseFloat(row.sort))) {
  904. // this.$message({ type: 'error', message: '车次请输入整数', duration: 2000 })
  905. // return false
  906. // }
  907. // }
  908. // this.isokDisable = true
  909. // setTimeout(() => {
  910. // this.isokDisable = false
  911. // }, 1000)
  912. // this.requestParam.common = { 'returnmap': '0' }
  913. // this.requestParam.data = []
  914. // this.requestParam.data[0] = { 'name': 'insertRemainplan', 'type': 'e', 'parammaps': {
  915. // pastureid: Cookies.get('pastureid'),
  916. // sort: row.sort,
  917. // tmrid: row.tmrid,
  918. // tmrcode: row.tmrcode,
  919. // enable: row.enable,
  920. // times: row.times,
  921. // lppid: row.lppid,
  922. // lppcode: row.lppcode,
  923. // rtime: row.rtime,
  924. // treatmethod: row.treatmethod
  925. // }}
  926. // this.requestParam.data[1] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.barsNamesIdTempArr }}
  927. // this.requestParam.data[1].children = []
  928. // this.requestParam.data[1].children[0] = { 'name': 'insertRpdetail', 'type': 'e', 'parammaps': {
  929. // pastureid: Cookies.get('pastureid'),
  930. // bigid: '@insertRemainplan.LastInsertId',
  931. // barid: '@insertSpotList.id',
  932. // bar: '@insertSpotList.bname',
  933. // type: 0
  934. // }}
  935. // this.requestParam.data[2] = { 'name': 'insertSpotList2', 'resultmaps': { 'list': this.useinbarNamesIdTempArr }}
  936. // this.requestParam.data[2].children = []
  937. // this.requestParam.data[2].children[0] = { 'name': 'insertRpdetail', 'type': 'e', 'parammaps': {
  938. // pastureid: Cookies.get('pastureid'),
  939. // bigid: '@insertRemainplan.LastInsertId',
  940. // barid: '@insertSpotList2.id',
  941. // bar: '@insertSpotList2.bname',
  942. // type: 1
  943. // }}
  944. // ExecDataByConfig(this.requestParam).then(response => {
  945. // console.log('新增保存发送参数', this.requestParam)
  946. // if (response.msg === 'fail') {
  947. // this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  948. // } else {
  949. // this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  950. // this.getList()
  951. // this.dropState = false
  952. // }
  953. // })
  954. // },
  955. createData() {
  956. console.log('点击了新增保存')
  957. this.isokDisable = true
  958. setTimeout(() => {
  959. this.isokDisable = false
  960. }, 1000)
  961. this.$refs['temp'].validate(valid => {
  962. if (valid) {
  963. if (this.create.temp.rtime == null || this.create.temp.rtime == 'null') {
  964. this.create.temp.rtime = ''
  965. }
  966. if (this.create.temp.sort == '' && this.create.temp.barid == '' && this.create.temp.tmrid == '' && this.create.temp.times == '' && this.create.temp.treatmethod == '') {
  967. this.$message({ type: 'error', message: '车次/栏舍/TMR编号/班次/剩料处理方式不能为空', duration: 2000 })
  968. return false
  969. } else if (this.create.temp.barid == '' && this.create.temp.tmrid == '' && this.create.temp.times == '' && this.create.temp.treatmethod == '') {
  970. this.$message({ type: 'error', message: '栏舍/TMR编号/班次/剩料处理方式不能为空', duration: 2000 })
  971. return false
  972. } else if (this.create.temp.tmrid == '' && this.create.temp.times == '' && this.create.temp.treatmethod == '') {
  973. this.$message({ type: 'error', message: 'TMR编号/班次/剩料处理方式不能为空', duration: 2000 })
  974. return false
  975. } else if (this.create.temp.times == '' && this.create.temp.treatmethod == '') {
  976. this.$message({ type: 'error', message: '班次/剩料处理方式不能为空', duration: 2000 })
  977. return false
  978. } else if (this.create.temp.sort == '' || this.create.temp.sort == 0) {
  979. this.$message({ type: 'error', message: '车次不能为空且大于0', duration: 2000 })
  980. return false
  981. } else if (this.create.temp.barid == '') {
  982. this.$message({ type: 'error', message: '栏舍不能为空', duration: 2000 })
  983. return false
  984. } else if (this.create.temp.tmrid == '') {
  985. this.$message({ type: 'error', message: 'TMR编号不能为空', duration: 2000 })
  986. return false
  987. } else if (this.create.temp.times == '') {
  988. this.$message({ type: 'error', message: '班次不能为空', duration: 2000 })
  989. return false
  990. } else if (this.create.temp.treatmethod == '') {
  991. this.$message({ type: 'error', message: '剩料处理方式不能为空', duration: 2000 })
  992. return false
  993. }
  994. if (this.create.temp.treatmethod !== '' && this.create.temp.treatmethod == '转投剩料') {
  995. if (this.create.temp.useinbarid == '') {
  996. this.$message({ type: 'error', message: '转投栏舍不能为空', duration: 2000 })
  997. return false
  998. }
  999. }
  1000. if (this.create.temp.treatmethod !== '' && this.create.temp.treatmethod == '继续饲喂') {
  1001. this.create.temp.useinbarid = '0'
  1002. }
  1003. if (this.create.temp.rtime == '' || this.create.temp.rtime == null) {
  1004. this.create.temp.rtime = ''
  1005. }
  1006. for (let i = 0; i < this.table.list.length; i++) {
  1007. if (this.create.temp.sort == this.table.list[i].sort) {
  1008. if (this.create.temp.myId !== this.table.list[i].myId) {
  1009. this.$message({ type: 'error', message: '车次不可重复', duration: 2000 })
  1010. return false
  1011. }
  1012. }
  1013. }
  1014. var isInteger = /^\d+$/
  1015. if (this.create.temp.sort !== '') {
  1016. if (!isInteger.test(parseFloat(this.create.temp.sort))) {
  1017. this.$message({ type: 'error', message: '车次请输入整数', duration: 2000 })
  1018. return false
  1019. }
  1020. }
  1021. this.isokDisable = true
  1022. setTimeout(() => {
  1023. this.isokDisable = false
  1024. }, 1000)
  1025. this.requestParam.common = { 'returnmap': '0' }
  1026. this.requestParam.data = []
  1027. this.requestParam.data[0] = { 'name': 'insertRemainplan', 'type': 'e', 'parammaps': {
  1028. pastureid: Cookies.get('pastureid'),
  1029. sort: this.create.temp.sort,
  1030. tmrid: this.create.temp.tmrid,
  1031. tmrcode: this.create.temp.tmrcode,
  1032. enable: this.create.temp.enable,
  1033. times: this.create.temp.times,
  1034. lppid: this.create.temp.lppid,
  1035. lppcode: this.create.temp.lppcode,
  1036. rtime: this.create.temp.rtime,
  1037. treatmethod: this.create.temp.treatmethod
  1038. }}
  1039. this.requestParam.data[1] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.barsNamesIdTempArr }}
  1040. this.requestParam.data[1].children = []
  1041. this.requestParam.data[1].children[0] = { 'name': 'insertRpdetail', 'type': 'e', 'parammaps': {
  1042. pastureid: Cookies.get('pastureid'),
  1043. bigid: '@insertRemainplan.LastInsertId',
  1044. barid: '@insertSpotList.id',
  1045. bar: '@insertSpotList.bname',
  1046. type: 0
  1047. }}
  1048. this.requestParam.data[2] = { 'name': 'insertSpotList2', 'resultmaps': { 'list': this.useinbarNamesIdTempArr }}
  1049. this.requestParam.data[2].children = []
  1050. this.requestParam.data[2].children[0] = { 'name': 'insertRpdetail', 'type': 'e', 'parammaps': {
  1051. pastureid: Cookies.get('pastureid'),
  1052. bigid: '@insertRemainplan.LastInsertId',
  1053. barid: '@insertSpotList2.id',
  1054. bar: '@insertSpotList2.bname',
  1055. type: 1
  1056. }}
  1057. ExecDataByConfig(this.requestParam).then(response => {
  1058. console.log('新增保存发送参数', this.requestParam)
  1059. if (response.msg === 'fail') {
  1060. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  1061. } else {
  1062. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  1063. this.create.dialogFormVisible = false
  1064. this.getList()
  1065. this.dropState = false
  1066. }
  1067. })
  1068. }
  1069. })
  1070. },
  1071. createCancel(row) {
  1072. console.log('点击了新增取消')
  1073. this.dropState = false
  1074. for (let i = 0; i < this.table.list.length; i++) {
  1075. if (row.myId === this.table.list[i].myId) {
  1076. var listIndex = this.table.list.indexOf(this.table.list[i])
  1077. }
  1078. if (listIndex > -1) {
  1079. this.table.list.splice(listIndex, 1)
  1080. return
  1081. }
  1082. }
  1083. },
  1084. // 模板编辑
  1085. // handleUpdate(row) {
  1086. // for (let i = 0; i < this.table.list.length; i++) {
  1087. // if (this.table.list[i].Edit == true) {
  1088. // this.$message({ type: 'error', message: '当前内容未保存,请点击取消或保存继续进行操作', duration: 2000 })
  1089. // return false
  1090. // }
  1091. // }
  1092. // console.log(row, '=========')
  1093. // // 编辑true,不可编辑false
  1094. // row.Edit = true
  1095. // row.NoEdit = false
  1096. // // 新增false,编辑false,编辑保存true
  1097. // row.isCreate = false
  1098. // row.isUpdate = false
  1099. // row.isUpdateSave = true
  1100. // row.temp = {}
  1101. // row.temp2 = {}
  1102. // if (row.useinbarid == '0') { row.useinbarid = [] }
  1103. // if (row.barid == undefined) { row.barid = [] }
  1104. // if (row.tmrid == undefined) { row.tmrid = '' }
  1105. // if (row.times == undefined) { row.times = '' }
  1106. // if (row.treatmethod == undefined) { row.treatmethod = '' }
  1107. // // this.getCarFollowParm.parammaps.times = row.times
  1108. // if (row.times == '第一班') {
  1109. // this.getCarFollowParm.parammaps.times = 1
  1110. // row.times = '1'
  1111. // } else if (row.times == '第二班') {
  1112. // this.getCarFollowParm.parammaps.times = 2
  1113. // row.times = '2'
  1114. // } else if (row.times == '第三班') {
  1115. // this.getCarFollowParm.parammaps.times = 3
  1116. // row.times = '3'
  1117. // } else if (row.times == '第四班') {
  1118. // this.getCarFollowParm.parammaps.times = 4
  1119. // row.times = '4'
  1120. // } else if (row.times == '第五班') {
  1121. // this.getCarFollowParm.parammaps.times = 5
  1122. // row.times = '5'
  1123. // }
  1124. // GetDataByName(this.getCarFollowParm).then(response => {
  1125. // console.log('撒料计划车次跟随列表数据', response.data.list)
  1126. // if (response.data.list !== null) {
  1127. // this.carFollowList = response.data.list
  1128. // }
  1129. // })
  1130. // console.log(row, '====')
  1131. // if (row.lppcode == undefined) {
  1132. // this.$set(row, 'lppid', '')
  1133. // }
  1134. // this.getTransferbarsList()
  1135. // // row.barid = row.qstrids.split(',')
  1136. // // row.useinbarid = row.hstrids.split(',')
  1137. // var arr3 = []
  1138. // for (let i = 0; i < row.barid.length; i++) {
  1139. // arr3.push(this.barsList.find(obj => obj.id == row.barid[i]))
  1140. // }
  1141. // this.barsNamesIdTempArr = arr3
  1142. // var arr4 = []
  1143. // setTimeout(() => {
  1144. // for (let i = 0; i < row.useinbarid.length; i++) {
  1145. // arr4.push(this.transferbarsList.find(obj => obj.id == row.useinbarid[i]))
  1146. // }
  1147. // }, 500)
  1148. // this.useinbarNamesIdTempArr = arr4
  1149. // console.log(this.useinbarNamesIdTempArr, 'this.useinbarNamesIdTempArr')
  1150. // this.dropState = true
  1151. // },
  1152. // 编辑
  1153. handleUpdate(row) {
  1154. console.log('点击了编辑', row)
  1155. this.create.dialogStatus = 'update'
  1156. this.dialogFull = false
  1157. this.create.dialogFormVisible = true
  1158. row.temp = {}
  1159. row.temp2 = {}
  1160. if (row.useinbarid == '0') { row.useinbarid = [] }
  1161. if (row.barid == undefined) { row.barid = [] }
  1162. if (row.tmrid == undefined) { row.tmrid = '' }
  1163. if (row.times == undefined) { row.times = '' }
  1164. if (row.treatmethod == undefined) { row.treatmethod = '' }
  1165. // this.getCarFollowParm.parammaps.times = row.times
  1166. if (row.times == '第一班') {
  1167. this.getCarFollowParm.parammaps.times = 1
  1168. row.times = '1'
  1169. } else if (row.times == '第二班') {
  1170. this.getCarFollowParm.parammaps.times = 2
  1171. row.times = '2'
  1172. } else if (row.times == '第三班') {
  1173. this.getCarFollowParm.parammaps.times = 3
  1174. row.times = '3'
  1175. } else if (row.times == '第四班') {
  1176. this.getCarFollowParm.parammaps.times = 4
  1177. row.times = '4'
  1178. } else if (row.times == '第五班') {
  1179. this.getCarFollowParm.parammaps.times = 5
  1180. row.times = '5'
  1181. }
  1182. GetDataByName(this.getCarFollowParm).then(response => {
  1183. console.log('撒料计划车次跟随列表数据', response.data.list)
  1184. if (response.data.list !== null) {
  1185. this.carFollowList = response.data.list
  1186. }
  1187. })
  1188. console.log(row, '====')
  1189. if (row.lppcode == undefined) {
  1190. this.$set(row, 'lppid', '')
  1191. }
  1192. this.getTransferbarsList()
  1193. // row.barid = row.qstrids.split(',')
  1194. // row.useinbarid = row.hstrids.split(',')
  1195. var arr3 = []
  1196. for (let i = 0; i < row.barid.length; i++) {
  1197. arr3.push(this.barsList.find(obj => obj.id == row.barid[i]))
  1198. }
  1199. this.barsNamesIdTempArr = arr3
  1200. this.barSortList = arr3
  1201. var arr4 = []
  1202. setTimeout(() => {
  1203. for (let i = 0; i < row.useinbarid.length; i++) {
  1204. arr4.push(this.transferbarsList.find(obj => obj.id == row.useinbarid[i]))
  1205. }
  1206. }, 500)
  1207. this.useinbarNamesIdTempArr = arr4
  1208. console.log(this.useinbarNamesIdTempArr, 'this.useinbarNamesIdTempArr')
  1209. this.dropState = true
  1210. this.create.temp = Object.assign({}, row)
  1211. },
  1212. // updateData(row) {
  1213. // console.log('点击了编辑保存', row)
  1214. // console.log(this.useinbarNamesIdTempArr, 'this.useinbarNamesIdTempArr========')
  1215. // if (row.rtime == null || row.rtime == 'null') {
  1216. // row.rtime = ''
  1217. // }
  1218. // if (row.barid == '' && row.tmrid == '' && row.times == '' && row.treatmethod == '') {
  1219. // this.$message({ type: 'error', message: '栏舍/TMR编号/班次/剩料处理方式不能为空', duration: 2000 })
  1220. // return false
  1221. // } else if (row.tmrid == '' && row.times == '' && row.treatmethod == '') {
  1222. // this.$message({ type: 'error', message: 'TMR编号/班次/剩料处理方式不能为空', duration: 2000 })
  1223. // return false
  1224. // } else if (row.times == '' && row.treatmethod == '') {
  1225. // this.$message({ type: 'error', message: '班次/混剩料处理方式不能为空', duration: 2000 })
  1226. // return false
  1227. // } else if (row.barid == '') {
  1228. // this.$message({ type: 'error', message: '栏舍不能为空', duration: 2000 })
  1229. // return false
  1230. // } else if (row.tmrid == '') {
  1231. // this.$message({ type: 'error', message: 'TMR编号不能为空', duration: 2000 })
  1232. // return false
  1233. // } else if (row.times == '') {
  1234. // this.$message({ type: 'error', message: '班次不能为空', duration: 2000 })
  1235. // return false
  1236. // } else if (row.treatmethod == '') {
  1237. // this.$message({ type: 'error', message: '剩料处理方式不能为空', duration: 2000 })
  1238. // return false
  1239. // }
  1240. // if (row.treatmethod !== '' && row.treatmethod == '转投剩料') {
  1241. // if (row.useinbarid == '') {
  1242. // this.$message({ type: 'error', message: '转投栏舍不能为空', duration: 2000 })
  1243. // return false
  1244. // }
  1245. // }
  1246. // if (row.treatmethod !== '' && row.treatmethod == '继续饲喂') {
  1247. // row.useinbarid = '0'
  1248. // }
  1249. // if (row.rtime == '' || row.rtime == null) {
  1250. // row.rtime = ''
  1251. // }
  1252. // for (let i = 0; i < this.table.list.length; i++) {
  1253. // if (row.sort == this.table.list[i].sort) {
  1254. // if (row.id !== this.table.list[i].id) {
  1255. // this.$message({ type: 'error', message: '车次不可重复', duration: 2000 })
  1256. // return false
  1257. // }
  1258. // }
  1259. // }
  1260. // var isInteger = /^\d+$/
  1261. // if (row.sort !== '') {
  1262. // if (!isInteger.test(parseFloat(row.sort))) {
  1263. // this.$message({ type: 'error', message: '车次请输入整数', duration: 2000 })
  1264. // return false
  1265. // }
  1266. // }
  1267. // if (row.sort == '' || row.sort == 0) {
  1268. // this.$message({ type: 'error', message: '车次不能为空且大于0', duration: 2000 })
  1269. // return false
  1270. // }
  1271. // if (row.times == '第一班') {
  1272. // row.times = 1
  1273. // } else if (row.times == '第二班') {
  1274. // row.times = 2
  1275. // } else if (row.times == '第三班') {
  1276. // row.times = 3
  1277. // } else if (row.times == '第四班') {
  1278. // row.times = 4
  1279. // } else if (row.times == '第五班') {
  1280. // row.times = 5
  1281. // }
  1282. // this.isokDisable = true
  1283. // setTimeout(() => {
  1284. // this.isokDisable = false
  1285. // }, 1000)
  1286. // this.requestParam = {}
  1287. // this.requestParam.common = { 'returnmap': '0' }
  1288. // this.requestParam.data = []
  1289. // this.requestParam.data[0] = { 'name': 'updateRemainplan', 'type': 'e', 'parammaps': {
  1290. // pastureid: row.pastureid,
  1291. // id: row.id,
  1292. // sort: row.sort,
  1293. // tmrid: row.tmrid,
  1294. // tmrcode: row.tmrcode,
  1295. // enable: row.enable,
  1296. // times: row.times,
  1297. // lppid: row.lppid,
  1298. // lppcode: row.lppcode,
  1299. // rtime: row.rtime,
  1300. // treatmethod: row.treatmethod
  1301. // }}
  1302. // this.requestParam.data[1] = { 'name': 'deleteRpdetail', 'type': 'e', 'parammaps': {
  1303. // pastureid: row.pastureid,
  1304. // bigid: row.id
  1305. // }}
  1306. // this.requestParam.data[2] = { 'name': 'insertSpotList2', 'resultmaps': { 'list': this.barsNamesIdTempArr }}
  1307. // this.requestParam.data[2].children = []
  1308. // this.requestParam.data[2].children[0] = { 'name': 'insertRpdetail', 'type': 'e', 'parammaps': {
  1309. // pastureid: row.pastureid,
  1310. // bigid: row.id,
  1311. // barid: '@insertSpotList2.id',
  1312. // bar: '@insertSpotList2.bname',
  1313. // type: 0
  1314. // }}
  1315. // this.requestParam.data[3] = { 'name': 'insertSpotList3', 'resultmaps': { 'list': this.useinbarNamesIdTempArr }}
  1316. // this.requestParam.data[3].children = []
  1317. // this.requestParam.data[3].children[0] = { 'name': 'insertRpdetail', 'type': 'e', 'parammaps': {
  1318. // pastureid: row.pastureid,
  1319. // bigid: row.id,
  1320. // barid: '@insertSpotList3.id',
  1321. // bar: '@insertSpotList3.bname',
  1322. // type: 1
  1323. // }}
  1324. // ExecDataByConfig(this.requestParam).then(response => {
  1325. // console.log('新增保存发送参数', this.requestParam)
  1326. // if (response.msg === 'fail') {
  1327. // this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  1328. // } else {
  1329. // this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  1330. // this.getList()
  1331. // this.dropState = false
  1332. // }
  1333. // })
  1334. // },
  1335. updateData() {
  1336. console.log('点击了编辑保存')
  1337. this.isokDisable = true
  1338. setTimeout(() => {
  1339. this.isokDisable = false
  1340. }, 1000)
  1341. this.$refs['temp'].validate(valid => {
  1342. if (valid) {
  1343. if (this.create.temp.rtime == null || this.create.temp.rtime == 'null') {
  1344. this.create.temp.rtime = ''
  1345. }
  1346. if (this.create.temp.barid == '' && this.create.temp.tmrid == '' && this.create.temp.times == '' && this.create.temp.treatmethod == '') {
  1347. this.$message({ type: 'error', message: '栏舍/TMR编号/班次/剩料处理方式不能为空', duration: 2000 })
  1348. return false
  1349. } else if (this.create.temp.tmrid == '' && this.create.temp.times == '' && this.create.temp.treatmethod == '') {
  1350. this.$message({ type: 'error', message: 'TMR编号/班次/剩料处理方式不能为空', duration: 2000 })
  1351. return false
  1352. } else if (this.create.temp.times == '' && this.create.temp.treatmethod == '') {
  1353. this.$message({ type: 'error', message: '班次/混剩料处理方式不能为空', duration: 2000 })
  1354. return false
  1355. } else if (this.create.temp.barid == '') {
  1356. this.$message({ type: 'error', message: '栏舍不能为空', duration: 2000 })
  1357. return false
  1358. } else if (this.create.temp.tmrid == '') {
  1359. this.$message({ type: 'error', message: 'TMR编号不能为空', duration: 2000 })
  1360. return false
  1361. } else if (this.create.temp.times == '') {
  1362. this.$message({ type: 'error', message: '班次不能为空', duration: 2000 })
  1363. return false
  1364. } else if (this.create.temp.treatmethod == '') {
  1365. this.$message({ type: 'error', message: '剩料处理方式不能为空', duration: 2000 })
  1366. return false
  1367. }
  1368. if (this.create.temp.treatmethod !== '' && this.create.temp.treatmethod == '转投剩料') {
  1369. if (this.create.temp.useinbarid == '') {
  1370. this.$message({ type: 'error', message: '转投栏舍不能为空', duration: 2000 })
  1371. return false
  1372. }
  1373. }
  1374. if (this.create.temp.treatmethod !== '' && this.create.temp.treatmethod == '继续饲喂') {
  1375. this.create.temp.useinbarid = '0'
  1376. }
  1377. if (this.create.temp.rtime == '' || this.create.temp.rtime == null) {
  1378. this.create.temp.rtime = ''
  1379. }
  1380. for (let i = 0; i < this.table.list.length; i++) {
  1381. if (this.create.temp.sort == this.table.list[i].sort) {
  1382. if (this.create.temp.id !== this.table.list[i].id) {
  1383. this.$message({ type: 'error', message: '车次不可重复', duration: 2000 })
  1384. return false
  1385. }
  1386. }
  1387. }
  1388. var isInteger = /^\d+$/
  1389. if (this.create.temp.sort !== '') {
  1390. if (!isInteger.test(parseFloat(this.create.temp.sort))) {
  1391. this.$message({ type: 'error', message: '车次请输入整数', duration: 2000 })
  1392. return false
  1393. }
  1394. }
  1395. if (this.create.temp.sort == '' || this.create.temp.sort == 0) {
  1396. this.$message({ type: 'error', message: '车次不能为空且大于0', duration: 2000 })
  1397. return false
  1398. }
  1399. if (this.create.temp.times == '第一班') {
  1400. this.create.temp.times = 1
  1401. } else if (this.create.temp.times == '第二班') {
  1402. this.create.temp.times = 2
  1403. } else if (this.create.temp.times == '第三班') {
  1404. this.create.temp.times = 3
  1405. } else if (this.create.temp.times == '第四班') {
  1406. this.create.temp.times = 4
  1407. } else if (this.create.temp.times == '第五班') {
  1408. this.create.temp.times = 5
  1409. }
  1410. this.isokDisable = true
  1411. setTimeout(() => {
  1412. this.isokDisable = false
  1413. }, 1000)
  1414. this.requestParam = {}
  1415. this.requestParam.common = { 'returnmap': '0' }
  1416. this.requestParam.data = []
  1417. this.requestParam.data[0] = { 'name': 'updateRemainplan', 'type': 'e', 'parammaps': {
  1418. pastureid: this.create.temp.pastureid,
  1419. id: this.create.temp.id,
  1420. sort: this.create.temp.sort,
  1421. tmrid: this.create.temp.tmrid,
  1422. tmrcode: this.create.temp.tmrcode,
  1423. enable: this.create.temp.enable,
  1424. times: this.create.temp.times,
  1425. lppid: this.create.temp.lppid,
  1426. lppcode: this.create.temp.lppcode,
  1427. rtime: this.create.temp.rtime,
  1428. treatmethod: this.create.temp.treatmethod
  1429. }}
  1430. this.requestParam.data[1] = { 'name': 'deleteRpdetail', 'type': 'e', 'parammaps': {
  1431. pastureid: this.create.temp.pastureid,
  1432. bigid: this.create.temp.id
  1433. }}
  1434. this.requestParam.data[2] = { 'name': 'insertSpotList2', 'resultmaps': { 'list': this.barsNamesIdTempArr }}
  1435. this.requestParam.data[2].children = []
  1436. this.requestParam.data[2].children[0] = { 'name': 'insertRpdetail', 'type': 'e', 'parammaps': {
  1437. pastureid: this.create.temp.pastureid,
  1438. bigid: this.create.temp.id,
  1439. barid: '@insertSpotList2.id',
  1440. bar: '@insertSpotList2.bname',
  1441. type: 0
  1442. }}
  1443. this.requestParam.data[3] = { 'name': 'insertSpotList3', 'resultmaps': { 'list': this.useinbarNamesIdTempArr }}
  1444. this.requestParam.data[3].children = []
  1445. this.requestParam.data[3].children[0] = { 'name': 'insertRpdetail', 'type': 'e', 'parammaps': {
  1446. pastureid: this.create.temp.pastureid,
  1447. bigid: this.create.temp.id,
  1448. barid: '@insertSpotList3.id',
  1449. bar: '@insertSpotList3.bname',
  1450. type: 1
  1451. }}
  1452. ExecDataByConfig(this.requestParam).then(response => {
  1453. console.log('新增保存发送参数', this.requestParam)
  1454. if (response.msg === 'fail') {
  1455. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  1456. } else {
  1457. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  1458. this.create.dialogFormVisible = false
  1459. this.getList()
  1460. this.dropState = false
  1461. }
  1462. })
  1463. }
  1464. })
  1465. },
  1466. updateCancel(row) {
  1467. console.log('点击了编辑取消')
  1468. // 编辑false,不可编辑true
  1469. row.Edit = false
  1470. row.NoEdit = true
  1471. // 新增false,编辑true,编辑保存false
  1472. row.isCreate = false
  1473. row.isUpdate = true
  1474. row.isUpdateSave = false
  1475. this.getList()
  1476. this.dropState = false
  1477. },
  1478. handleSelect(val) {
  1479. console.log('勾选数据', val)
  1480. this.selectList = val
  1481. },
  1482. // 行内删除
  1483. handleRowDelete(row) {
  1484. console.log(row, '点击了行删除')
  1485. MessageBox.confirm('是否确认删除此信息?', {
  1486. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  1487. }).then(() => {
  1488. this.selectList = []
  1489. this.requestParam = {}
  1490. this.requestParam.name = 'deleteRemainplan'
  1491. this.requestParam.parammaps = {}
  1492. this.requestParam.parammaps.pastureid = row.pastureid
  1493. this.requestParam.parammaps.id = row.id
  1494. PostDataByName(this.requestParam).then(response => {
  1495. if (response.msg === 'fail') {
  1496. this.$notify({ title: '删除失败', message: response.data, type: 'warning', duration: 2000 })
  1497. } else {
  1498. this.$notify({ title: '成功', message: '删除成功', type: 'success', duration: 2000 })
  1499. this.getList()
  1500. }
  1501. })
  1502. }).catch(() => {
  1503. this.$message({ type: 'info', message: '已取消删除' })
  1504. })
  1505. },
  1506. // 减少车次
  1507. handleDelete() {
  1508. if (this.selectList.length == 0) {
  1509. this.$message({ type: 'error', message: '请选择车次信息', duration: 2000 })
  1510. } else {
  1511. MessageBox.confirm('当前选中' + this.selectList.length + '条信息,是否删除?', {
  1512. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  1513. }).then(() => {
  1514. console.log(this.selectList)
  1515. this.requestParam.common = { 'returnmap': '0' }
  1516. this.requestParam.data = []
  1517. this.requestParam.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.selectList }}
  1518. this.requestParam.data[0].children = []
  1519. this.requestParam.data[0].children[0] = { 'name': 'deleteRemainplan', 'type': 'e', 'parammaps': {
  1520. id: '@insertSpotList.id',
  1521. pastureid: '@insertSpotList.pastureid'
  1522. }}
  1523. ExecDataByConfig(this.requestParam).then(response => {
  1524. console.log('删除保存发送参数', this.requestParam)
  1525. if (response.msg === 'fail') {
  1526. this.$notify({ title: '删除失败', message: response.data, type: 'warning', duration: 2000 })
  1527. } else {
  1528. this.$notify({ title: '', message: '删除成功', type: 'success', duration: 2000 })
  1529. this.getList()
  1530. }
  1531. })
  1532. })
  1533. }
  1534. },
  1535. // 校验
  1536. handleCheck() {
  1537. console.log('点击了校验')
  1538. this.check.dialogStatus = 'check'
  1539. this.check.dialogFormVisible = true
  1540. this.getCheckList()
  1541. },
  1542. getCheckList() {
  1543. GetDataByName(this.check.getCheckParm).then(response => {
  1544. if (response.data.list[0].bnames !== undefined) {
  1545. this.check.temp.isDistribution = 0
  1546. this.check.temp.bnames = response.data.list[0].bnames
  1547. } else {
  1548. this.check.temp = {}
  1549. this.check.temp.isDistribution = 1
  1550. }
  1551. })
  1552. },
  1553. // 历史记录
  1554. handleHistoryRecords() {
  1555. console.log('点击了历史记录')
  1556. this.dialogFull = false
  1557. this.history.dialogStatus = 'history'
  1558. this.history.dialogFormVisible = true
  1559. this.getDateList()
  1560. },
  1561. // 历史时间
  1562. getDateList() {
  1563. GetDataByName(this.history.getdataDateParm).then(response => {
  1564. console.log('table数据', response.data.list)
  1565. if (response.data.list !== null) {
  1566. this.history.getdataListParm.parammaps.date = response.data.list[0].maxdate
  1567. this.getHistoryList()
  1568. } else {
  1569. this.history.getdataListParm.parammaps.date = ''
  1570. }
  1571. })
  1572. },
  1573. changeDate() {
  1574. this.getHistoryList()
  1575. },
  1576. // 应用
  1577. handleApplication() {
  1578. console.log('点击了应用')
  1579. MessageBox.confirm('是否确认将' + this.history.getdataListParm.parammaps.date + '的数据应用到当前?', {
  1580. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  1581. }).then(() => {
  1582. this.requestParam.name = 'applyFPdate'
  1583. this.requestParam.parammaps = {}
  1584. this.requestParam.parammaps.pastureid = Cookies.get('pastureid')
  1585. this.requestParam.parammaps.date = this.history.getdataListParm.parammaps.date
  1586. PostDataByName(this.requestParam).then(response => {
  1587. if (response.msg === 'fail') {
  1588. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  1589. } else {
  1590. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  1591. this.getHistoryIsDisplay()
  1592. this.getList()
  1593. }
  1594. })
  1595. }).catch(() => {
  1596. this.$message({ type: 'info', message: '已取消应用' })
  1597. })
  1598. },
  1599. getHistoryList() {
  1600. this.history.listLoading = true
  1601. GetDataByName(this.history.getdataListParm).then(response => {
  1602. console.log('table数据', response.data.list)
  1603. if (response.data.list !== null) {
  1604. console.log('table数据', response.data.list)
  1605. this.history.list = response.data.list
  1606. this.history.pageNum = response.data.pageNum
  1607. this.history.pageSize = response.data.pageSize
  1608. this.history.total = response.data.total
  1609. } else {
  1610. this.history.list = []
  1611. }
  1612. setTimeout(() => {
  1613. this.history.listLoading = false
  1614. }, 100)
  1615. })
  1616. },
  1617. handleTakeEffect() {
  1618. if (this.selectList.length == 0) {
  1619. this.$message({ type: 'error', message: '请选择车次信息', duration: 2000 })
  1620. } else {
  1621. MessageBox.confirm('当前选中' + this.selectList.length + '条信息,是否生效?', {
  1622. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  1623. }).then(() => {
  1624. for (let i = 0; i < this.selectList.length; i++) {
  1625. // this.$set(this.selectList[i], 'enable', '1')
  1626. this.selectList[i].enable = 1
  1627. }
  1628. console.log('生效', this.selectList)
  1629. this.requestParam.common = { 'returnmap': '0' }
  1630. this.requestParam.data = []
  1631. this.requestParam.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.selectList }}
  1632. this.requestParam.data[0].children = []
  1633. this.requestParam.data[0].children[0] = { 'name': 'updateRemainplanEnable', 'type': 'e', 'parammaps': {
  1634. enable: '@insertSpotList.enable',
  1635. id: '@insertSpotList.id',
  1636. pastureid: '@insertSpotList.pastureid'
  1637. }}
  1638. ExecDataByConfig(this.requestParam).then(response => {
  1639. console.log('生效保存发送参数', this.requestParam)
  1640. if (response.msg === 'fail') {
  1641. this.$notify({ title: '生效失败', message: response.data, type: 'warning', duration: 2000 })
  1642. } else {
  1643. this.$notify({ title: '', message: '生效成功', type: 'success', duration: 2000 })
  1644. this.getList()
  1645. }
  1646. })
  1647. })
  1648. }
  1649. },
  1650. handleDisable() {
  1651. if (this.selectList.length == 0) {
  1652. this.$message({ type: 'error', message: '请选择车次信息', duration: 2000 })
  1653. } else {
  1654. MessageBox.confirm('当前选中' + this.selectList.length + '条信息,是否禁用?', {
  1655. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  1656. }).then(() => {
  1657. for (let i = 0; i < this.selectList.length; i++) {
  1658. // this.$set(this.selectList[i], 'enable', '1')
  1659. this.selectList[i].enable = 0
  1660. }
  1661. console.log('禁用', this.selectList)
  1662. this.requestParam.common = { 'returnmap': '0' }
  1663. this.requestParam.data = []
  1664. this.requestParam.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.selectList }}
  1665. this.requestParam.data[0].children = []
  1666. this.requestParam.data[0].children[0] = { 'name': 'updateRemainplanEnable', 'type': 'e', 'parammaps': {
  1667. enable: '@insertSpotList.enable',
  1668. id: '@insertSpotList.id',
  1669. pastureid: '@insertSpotList.pastureid'
  1670. }}
  1671. ExecDataByConfig(this.requestParam).then(response => {
  1672. console.log('禁用保存发送参数', this.requestParam)
  1673. if (response.msg === 'fail') {
  1674. this.$notify({ title: '禁用失败', message: response.data, type: 'warning', duration: 2000 })
  1675. } else {
  1676. this.$notify({ title: '', message: '禁用成功', type: 'success', duration: 2000 })
  1677. this.getList()
  1678. }
  1679. })
  1680. })
  1681. }
  1682. }
  1683. }
  1684. }
  1685. </script>
  1686. <style lang="scss" scoped>
  1687. .search{clear: both;}
  1688. .table{margin-top:10px;}
  1689. </style>