index.vue 68 KB

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