b273267010f00738e2ac93dd1159e2d9af155f3c.svn-base 47 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148
  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.rtime }}</span>
  81. <el-time-picker v-if="scope.row.Edit" v-model="scope.row.rtime" type="datetime" placeholder="选择时间" format="HH:mm" value-format="HH:mm" style="display: inline-block;width: 95%;" />
  82. </template>
  83. </el-table-column> -->
  84. <el-table-column label="剩料处理方式" min-width="130px" align="center">
  85. <template slot-scope="scope">
  86. <span v-if="scope.row.NoEdit">{{ scope.row.treatmethod }}</span>
  87. <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)}">
  88. <el-option v-for="item in residueDisposalList" :key="item.value" :label="item.label" :value="item.label" />
  89. </el-select>
  90. </template>
  91. </el-table-column>
  92. <el-table-column label="转投栏舍" min-width="130px" align="center">
  93. <template slot-scope="scope">
  94. <span v-if="scope.row.NoEdit">{{ scope.row.hstr }}</span>
  95. <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">
  96. <el-option v-for="item in transferbarsList" :key="item.id" :label="item.bname" :value="item.id" />
  97. </el-select>
  98. </template>
  99. </el-table-column>
  100. <el-table-column label="操作" align="center" width="80" class-name="small-padding fixed-width" fixed="right">
  101. <template slot-scope="{row}">
  102. <el-button v-if="row.isCreate && isRoleEdit" :disabled="isokDisable" icon="el-icon-folder-checked" class="miniSuccess" @click="createData(row)" />
  103. <span v-if="row.isCreate && isRoleEdit" class="centerSpan">|</span>
  104. <el-button v-if="row.isCreate && isRoleEdit" class="minCancel" icon="el-icon-close" @click="createCancel(row)" />
  105. <el-button v-if="row.isUpdate && isRoleEdit" class="miniSuccess" icon="el-icon-edit-outline" @click="handleUpdate(row)" />
  106. <span v-if="row.isUpdate && isRoleEdit" class="centerSpan">|</span>
  107. <el-button v-if="row.isUpdate && isRoleEdit" class="miniDanger" icon="el-icon-delete" @click="handleRowDelete(row)" />
  108. <el-button v-if="row.isUpdateSave && isRoleEdit" :disabled="isokDisable" icon="el-icon-folder-checked" class="miniSuccess" @click="updateData(row)" />
  109. <span v-if="row.isUpdateSave && isRoleEdit" class="centerSpan">|</span>
  110. <el-button v-if="row.isUpdateSave && isRoleEdit" class="minCancel" icon="el-icon-close" @click="updateCancel(row)" />
  111. </template>
  112. </el-table-column>
  113. </el-table>
  114. <span v-if="table.listLoading == false" style="margin-right: 30px;margin-top: 10px;font-size: 14px;">共{{ table.total }}条</span>
  115. </div>
  116. <!-- 历史记录 -->
  117. <el-dialog :fullscreen="dialogFull" :destroy-on-close="true" :visible.sync="history.dialogFormVisible" :close-on-click-modal="false" width="90%">
  118. <template slot="title">
  119. <div class="avue-crud__dialog__header">
  120. <span class="el-dialog__title">
  121. <span style="display:inline-block;width:3px;height:20px;margin-right:5px; float: left;margin-top:2px" />
  122. {{ textMap[history.dialogStatus] }}
  123. </span>
  124. <div class="avue-crud__dialog__menu" @click="dialogFull? dialogFull=false: dialogFull=true">
  125. <svg-icon v-if="dialogFull" icon-class="exit-fullscreen" />
  126. <svg-icon v-else icon-class="fullscreen" />
  127. </div>
  128. </div>
  129. </template>
  130. <div class="app-history">
  131. <div class="search">
  132. <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" />
  133. <!-- <el-button class="successBorder" @click="handleApplication">应用</el-button> -->
  134. </div>
  135. <div class="table">
  136. <el-table
  137. :key="history.tableKey"
  138. v-loading="history.listLoading"
  139. element-loading-text="给我一点时间"
  140. :data="history.list"
  141. border
  142. fit
  143. highlight-current-row
  144. style="width: 100%;"
  145. :row-style="rowStyle"
  146. :cell-style="cellStyle"
  147. class="elTable table-fixed"
  148. >
  149. <el-table-column label="车次" min-width="130px" align="center">
  150. <template slot-scope="scope">
  151. <span>{{ scope.row.sort }}</span>
  152. </template>
  153. </el-table-column>
  154. <el-table-column label="栏舍" min-width="130px" align="center">
  155. <template slot-scope="scope">
  156. <span>{{ scope.row.qstr }}</span>
  157. </template>
  158. </el-table-column>
  159. <el-table-column label="TMR编号" prop="weight" min-width="130px" align="center">
  160. <template slot-scope="scope">
  161. <span>{{ scope.row.tmrcode }}</span>
  162. </template>
  163. </el-table-column>
  164. <el-table-column label="生效" min-width="130px" align="center">
  165. <template slot-scope="scope">
  166. <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)" />
  167. </template>
  168. </el-table-column>
  169. <el-table-column label="班次" min-width="130px" align="center">
  170. <template slot-scope="scope">
  171. <span>{{ scope.row.times }}</span>
  172. </template>
  173. </el-table-column>
  174. <el-table-column label="发料计划车次跟随" min-width="130px" align="center">
  175. <template slot-scope="scope">
  176. <span>{{ scope.row.lppcode }}</span>
  177. </template>
  178. </el-table-column>
  179. <el-table-column label="时间" min-width="180px" align="center">
  180. <template slot-scope="scope">
  181. <span>{{ scope.row.rtime }}</span>
  182. </template>
  183. </el-table-column>
  184. <el-table-column label="剩料处理方式" min-width="130px" align="center">
  185. <template slot-scope="scope">
  186. <span>{{ scope.row.treatmethod }}</span>
  187. </template>
  188. </el-table-column>
  189. <el-table-column label="转投栏舍" min-width="130px" align="center">
  190. <template slot-scope="scope">
  191. <span>{{ scope.row.hstr }}</span>
  192. </template>
  193. </el-table-column>
  194. </el-table>
  195. <pagination v-show="history.total>0" :total="history.total" :page.sync="history.getdataListParm.offset" :limit.sync="history.getdataListParm.pagecount" @pagination="getHistoryList" />
  196. </div>
  197. </div>
  198. <div slot="footer" class="dialog-footer">
  199. <el-button class="cancelClose cancelClose1" @click="history.dialogFormVisible = false; ">关闭</el-button>
  200. </div>
  201. </el-dialog>
  202. <!-- 校验 -->
  203. <el-dialog :title="textMap[check.dialogStatus]" :destroy-on-close="true" :visible.sync="check.dialogFormVisible" :close-on-click-modal="false" width="30%">
  204. <div class="check">
  205. <p v-if="check.temp.isDistribution == '0'">当前有栏舍未分配,建议及时进行分配,未分配栏舍如下:</p>
  206. <p v-else>已分配完:当前栏舍已分配完善</p>
  207. {{ check.temp.bnames }}
  208. </div>
  209. <div slot="footer" class="dialog-footer" style="bottom: 10px;">
  210. <el-button class="save" @click="check.dialogFormVisible=false;">确认</el-button>
  211. </div>
  212. </el-dialog>
  213. </div>
  214. </template>
  215. <script>
  216. import { GetDataByName, GetDataByNames, PostDataByName, failproccess, ExecDataByConfig, checkButtons } from '@/api/common'
  217. import Pagination from '@/components/Pagination'
  218. import Sortable from 'sortablejs'
  219. import Cookies from 'js-cookie'
  220. import { MessageBox } from 'element-ui'
  221. export default {
  222. name: 'SurplusMaterialPlan',
  223. components: { Pagination },
  224. data() {
  225. return {
  226. dialogFull: false,
  227. isRoleEdit: [],
  228. requestParams: [
  229. { name: 'getBarListEnable', offset: 0, pagecount: 0, parammaps: { pastureid: Cookies.get('pastureid') }},
  230. { name: 'getTMRYHList', offset: 0, pagecount: 0, parammaps: { pastureid: Cookies.get('pastureid') }}
  231. ],
  232. barsList: [], // 栏舍
  233. residueDisposalList: [{ value: '0', label: '转投剩料' }, { value: '1', label: '继续饲喂' }], // 剩料处理方式
  234. TMRNumberList: [], // TMR编号
  235. barsNamesIdTempArr: [],
  236. useinbarNamesIdTempArr: [],
  237. // 班次
  238. maxTime: {
  239. getMaxTimesParm: {
  240. name: 'getSysoptEnable',
  241. page: 1,
  242. offset: 1,
  243. pagecount: 1,
  244. returntype: 'Map',
  245. parammaps: {
  246. pastureid: Cookies.get('pastureid'),
  247. inforname: 'times'
  248. }
  249. }
  250. },
  251. frequencyList: [], // 班次
  252. getCarFollowParm: {
  253. name: 'getLPPCodeList',
  254. offset: 0,
  255. pagecount: 0,
  256. parammaps: {
  257. pastureid: Cookies.get('pastureid'),
  258. times: ''
  259. }
  260. },
  261. carFollowList: [], // 发料计划车次跟随
  262. getTransferbarsParm: {
  263. name: 'getBarListEnable',
  264. offset: 0,
  265. pagecount: 0,
  266. parammaps: {
  267. pastureid: Cookies.get('pastureid'),
  268. times: ''
  269. }
  270. },
  271. transferbarsList: [], // 转头栏舍
  272. table: {
  273. getdataListParm: {
  274. name: 'getRemainplanList',
  275. page: 1,
  276. offset: 1,
  277. pagecount: '',
  278. returntype: 'Map',
  279. parammaps: {
  280. pastureid: Cookies.get('pastureid')
  281. }
  282. },
  283. tableKey: 0,
  284. list: [],
  285. total: 0,
  286. listLoading: true,
  287. temp: {},
  288. temp2: {}
  289. },
  290. history: {
  291. dialogFormVisible: false,
  292. dialogStatus: '',
  293. temp: {},
  294. rules: {},
  295. tableKey: 0,
  296. list: [],
  297. total: 0,
  298. listLoading: true,
  299. getdataDateParm: {
  300. name: 'getRPMaxDate',
  301. page: 1,
  302. offset: 1,
  303. pagecount: 10,
  304. returntype: 'Map',
  305. parammaps: {
  306. pastureid: Cookies.get('pastureid')
  307. }
  308. },
  309. getdataListParm: {
  310. name: 'getRemainplanListDate',
  311. page: 1,
  312. offset: 1,
  313. pagecount: 10,
  314. returntype: 'Map',
  315. parammaps: {
  316. pastureid: Cookies.get('pastureid'),
  317. date: ''
  318. }
  319. }
  320. },
  321. check: {
  322. dialogFormVisible: false,
  323. dialogStatus: '',
  324. getCheckParm: {
  325. name: 'checkRemainplan',
  326. page: 1,
  327. offset: 1,
  328. pagecount: 10,
  329. returntype: 'Map',
  330. parammaps: {
  331. pastureid: Cookies.get('pastureid')
  332. }
  333. },
  334. temp: {
  335. bnames: '',
  336. isDistribution: ''
  337. }
  338. },
  339. textMap: {
  340. history: '历史记录',
  341. check: '提示'
  342. },
  343. requestParam: {},
  344. selectList: [],
  345. isokDisable: false,
  346. rowStyle: { maxHeight: 30 + 'px', height: 30 + 'px' },
  347. cellStyle: { padding: 0 + 'px' },
  348. dropState: false,
  349. isOrder: true
  350. }
  351. },
  352. created() {
  353. this.getButtons()
  354. this.getList()
  355. this.getDownList()
  356. this.getIsDisplay()
  357. },
  358. methods: {
  359. getButtons() {
  360. const Edit = 'SurplusMaterialPlan'
  361. const isRoleEdit = checkButtons(JSON.parse(sessionStorage.getItem('buttons')), Edit)
  362. this.isRoleEdit = isRoleEdit
  363. },
  364. getDownList() {
  365. GetDataByNames(this.requestParams).then(response => {
  366. this.barsList = response.data.getBarListEnable.list
  367. this.TMRNumberList = response.data.getTMRYHList.list
  368. })
  369. },
  370. getIsDisplay() {
  371. GetDataByName(this.maxTime.getMaxTimesParm).then(response => {
  372. if (response.data.list[0].inforvalue == 1) {
  373. this.frequencyList = [{ id: '1', name: '第一班' }]
  374. } else if (response.data.list[0].inforvalue == 2) {
  375. this.frequencyList = [{ id: '1', name: '第一班' }, { id: '2', name: '第二班' }]
  376. } else if (response.data.list[0].inforvalue == 3) {
  377. this.frequencyList = [{ id: '1', name: '第一班' }, { id: '2', name: '第二班' }, { id: '3', name: '第三班' }]
  378. } else if (response.data.list[0].inforvalue == 4) {
  379. this.frequencyList = [{ id: '1', name: '第一班' }, { id: '2', name: '第二班' }, { id: '3', name: '第三班' }, { id: '4', name: '第四班' }]
  380. }
  381. })
  382. },
  383. getList() {
  384. this.table.listLoading = true
  385. GetDataByName(this.table.getdataListParm).then(response => {
  386. console.log('table数据', response.data.list)
  387. if (response.data.list !== null) {
  388. for (let i = 0; i < response.data.list.length; i++) {
  389. this.$set(response.data.list[i], 'Edit', false) // 编辑
  390. this.$set(response.data.list[i], 'NoEdit', true) // 不可编辑/输入
  391. this.$set(response.data.list[i], 'groupEdit', false) // 饲料组编辑
  392. this.$set(response.data.list[i], 'groupNoEdit', true) // 饲料组不可编辑
  393. this.$set(response.data.list[i], 'isCreate', false) // 新增操作
  394. this.$set(response.data.list[i], 'isUpdate', true) // 编辑操作
  395. this.$set(response.data.list[i], 'isUpdateSave', false) // 编辑保存
  396. }
  397. var arr = response.data.list
  398. arr.map(function(i, j) {
  399. // console.log(i, '====')
  400. if (i.qstrids) {
  401. return i.barid = i.qstrids.split(',')
  402. } else {
  403. return i.barid = []
  404. }
  405. })
  406. arr.map(function(i, j) {
  407. if (i.hstrids) {
  408. return i.useinbarid = i.hstrids.split(',')
  409. } else {
  410. return i.useinbarid = []
  411. }
  412. })
  413. this.table.list = arr
  414. // this.table.list = response.data.list
  415. this.table.pageNum = response.data.pageNum
  416. this.table.pageSize = response.data.pageSize
  417. // this.rowDrop()
  418. this.table.total = response.data.total
  419. } else {
  420. this.table.list = []
  421. }
  422. setTimeout(() => {
  423. this.table.listLoading = false
  424. }, 100)
  425. })
  426. },
  427. handleEnableChange() {
  428. console.log('点击了生效')
  429. },
  430. handleChangeOrder() {
  431. this.isOrder = false
  432. this.rowDrop()
  433. },
  434. saveChangeOrder() {
  435. // 保存顺序
  436. var sortArr = []
  437. for (let i = 0; i < this.table.list.length; i++) {
  438. var obj = {}
  439. obj.sort = i + 1
  440. obj.id = this.table.list[i].id
  441. obj.pastureid = this.table.list[i].pastureid
  442. sortArr.push(obj)
  443. }
  444. this.requestParam = {}
  445. this.requestParam.common = { 'returnmap': '0' }
  446. this.requestParam.data = []
  447. this.requestParam.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': sortArr }}
  448. this.requestParam.data[0].children = []
  449. this.requestParam.data[0].children[0] = { 'name': 'updateRemainplanSort', 'type': 'e', 'parammaps': {
  450. id: '@insertSpotList.id',
  451. pastureid: '@insertSpotList.pastureid',
  452. sort: '@insertSpotList.sort'
  453. }}
  454. ExecDataByConfig(this.requestParam).then(response => {
  455. console.log('顺序切换保存发送参数', this.requestParam)
  456. if (response.msg === 'fail') {
  457. this.$notify({ title: '顺序切换失败', message: response.data, type: 'warning', duration: 2000 })
  458. } else {
  459. this.$notify({ title: '', message: '顺序切换成功', type: 'success', duration: 2000 })
  460. this.getList()
  461. this.isOrder = true
  462. }
  463. })
  464. },
  465. cancelChangeOrder() {
  466. // 取消顺序
  467. this.getList()
  468. this.isOrder = true
  469. },
  470. // 行拖拽
  471. rowDrop() {
  472. console.log(document.querySelector('#table .el-table__body-wrapper tbody'))
  473. const tbody = document.querySelector('#table .el-table__body-wrapper tbody')
  474. const that = this
  475. var sortable = Sortable.create(tbody, {
  476. disabled: that.dropState,
  477. onChoose({ newIndex, oldIndex }) {
  478. if (that.dropState == true) {
  479. sortable.destroy()
  480. }
  481. },
  482. onEnd({ newIndex, oldIndex }) {
  483. const currRow = that.table.list.splice(oldIndex, 1)[0]
  484. that.table.list.splice(newIndex, 0, currRow)
  485. console.log('索引', newIndex)
  486. console.log('拖动数据', currRow)
  487. console.log('上', that.table.list[newIndex - 1])
  488. console.log('下', that.table.list[newIndex + 1])
  489. }
  490. })
  491. },
  492. // 模板新增
  493. handleCreate() {
  494. console.log('点击了新增车次')
  495. // 编辑true/不可编辑false
  496. // 新增操true,编辑false,编辑保存false
  497. this.dropState = true
  498. for (let i = 0; i < this.table.list.length; i++) {
  499. if (this.table.list[i].Edit === true) {
  500. console.log(123)
  501. this.$message({ type: 'error', message: '当前内容未保存,请点击取消或保存继续进行操作', duration: 2000 })
  502. return false
  503. }
  504. }
  505. var sort = 1
  506. if (this.table.list.length > 0) {
  507. sort = parseInt(this.table.list[this.table.list.length - 1].sort) + 1
  508. } else {
  509. sort = 1
  510. }
  511. 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': '' })
  512. console.log(this.table.list)
  513. },
  514. // 栏舍
  515. changeBars(val) {
  516. console.log('点击了栏舍', val)
  517. var arr = []
  518. this.barsList.forEach(function(i) {
  519. val.forEach(function(j) {
  520. if (i.id == j) { arr.push(i) }
  521. })
  522. })
  523. console.log('点击了栏舍', arr)
  524. this.table.temp.barid = arr
  525. this.barsNamesIdTempArr = arr
  526. this.$forceUpdate()
  527. },
  528. // TMR编号
  529. changeTMRNumber(item, row) {
  530. row.tmrcode = this.TMRNumberList.find(obj => obj.id == item).tname
  531. },
  532. // 撒料计划车次跟随列表
  533. changeCarFollow(item, row) {
  534. if (item == '') {
  535. row.lppcode = ''
  536. } else {
  537. row.lppcode = this.carFollowList.find(obj => obj.id == item).lppcode
  538. }
  539. },
  540. // 班次
  541. changeTimes(item, row) {
  542. console.log(item, row)
  543. this.getCarFollowParm.parammaps.times = item
  544. this.getCarFollowList(row)
  545. },
  546. // 撒料计划车次跟随列表
  547. getCarFollowList(row) {
  548. GetDataByName(this.getCarFollowParm).then(response => {
  549. console.log('撒料计划车次跟随列表数据', response.data.list)
  550. if (response.data.list !== null) {
  551. this.carFollowList = response.data.list
  552. row.lppid = this.carFollowList[0].id
  553. row.lppcode = this.carFollowList[0].lppcode
  554. }
  555. })
  556. },
  557. changeResidueDisposal(item, row) {
  558. console.log(item, row)
  559. this.getCarFollowParm.parammaps.times = item
  560. this.getTransferbarsList()
  561. },
  562. getTransferbarsList() {
  563. GetDataByName(this.getTransferbarsParm).then(response => {
  564. if (response.data.list !== null) {
  565. this.transferbarsList = response.data.list
  566. }
  567. })
  568. },
  569. // 转头栏舍
  570. changeTransferbars(val) {
  571. console.log('点击了转头栏舍', val)
  572. var arr2 = []
  573. this.transferbarsList.forEach(function(i) {
  574. val.forEach(function(j) {
  575. if (i.id == j) { arr2.push(i) }
  576. })
  577. })
  578. this.table.temp2.useinbar = arr2
  579. this.useinbarNamesIdTempArr = arr2
  580. this.$forceUpdate()
  581. },
  582. createData(row) {
  583. console.log('点击了新增保存', row)
  584. if (row.rtime == null || row.rtime == 'null') {
  585. row.rtime = ''
  586. }
  587. if (row.sort == '' && row.barid == '' && row.tmrid == '' && row.times == '' && row.treatmethod == '') {
  588. this.$message({ type: 'error', message: '车次/栏舍/TMR编号/班次/剩料处理方式不能为空', duration: 2000 })
  589. return false
  590. } else if (row.barid == '' && row.tmrid == '' && row.times == '' && row.treatmethod == '') {
  591. this.$message({ type: 'error', message: '栏舍/TMR编号/班次/剩料处理方式不能为空', duration: 2000 })
  592. return false
  593. } else if (row.tmrid == '' && row.times == '' && row.treatmethod == '') {
  594. this.$message({ type: 'error', message: 'TMR编号/班次/剩料处理方式不能为空', duration: 2000 })
  595. return false
  596. } else if (row.times == '' && row.treatmethod == '') {
  597. this.$message({ type: 'error', message: '班次/剩料处理方式不能为空', duration: 2000 })
  598. return false
  599. } else if (row.sort == '' || row.sort == 0) {
  600. this.$message({ type: 'error', message: '车次不能为空且大于0', duration: 2000 })
  601. return false
  602. } else if (row.barid == '') {
  603. this.$message({ type: 'error', message: '栏舍不能为空', duration: 2000 })
  604. return false
  605. } else if (row.tmrid == '') {
  606. this.$message({ type: 'error', message: 'TMR编号不能为空', duration: 2000 })
  607. return false
  608. } else if (row.times == '') {
  609. this.$message({ type: 'error', message: '班次不能为空', duration: 2000 })
  610. return false
  611. } else if (row.treatmethod == '') {
  612. this.$message({ type: 'error', message: '剩料处理方式不能为空', duration: 2000 })
  613. return false
  614. }
  615. if (row.treatmethod !== '' && row.treatmethod == '转投剩料') {
  616. if (row.useinbarid == '') {
  617. this.$message({ type: 'error', message: '转投栏舍不能为空', duration: 2000 })
  618. return false
  619. }
  620. }
  621. if (row.treatmethod !== '' && row.treatmethod == '继续饲喂') {
  622. row.useinbarid = '0'
  623. }
  624. if (row.rtime == '' || row.rtime == null) {
  625. row.rtime = ''
  626. }
  627. for (let i = 0; i < this.table.list.length; i++) {
  628. if (row.sort == this.table.list[i].sort) {
  629. if (row.myId !== this.table.list[i].myId) {
  630. this.$message({ type: 'error', message: '车次不可重复', duration: 2000 })
  631. return false
  632. }
  633. }
  634. }
  635. var isInteger = /^\d+$/
  636. if (row.sort !== '') {
  637. if (!isInteger.test(parseFloat(row.sort))) {
  638. this.$message({ type: 'error', message: '车次请输入整数', duration: 2000 })
  639. return false
  640. }
  641. }
  642. this.isokDisable = true
  643. setTimeout(() => {
  644. this.isokDisable = false
  645. }, 1000)
  646. this.requestParam.common = { 'returnmap': '0' }
  647. this.requestParam.data = []
  648. this.requestParam.data[0] = { 'name': 'insertRemainplan', 'type': 'e', 'parammaps': {
  649. pastureid: Cookies.get('pastureid'),
  650. sort: row.sort,
  651. tmrid: row.tmrid,
  652. tmrcode: row.tmrcode,
  653. enable: row.enable,
  654. times: row.times,
  655. lppid: row.lppid,
  656. lppcode: row.lppcode,
  657. rtime: row.rtime,
  658. treatmethod: row.treatmethod
  659. }}
  660. this.requestParam.data[1] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.barsNamesIdTempArr }}
  661. this.requestParam.data[1].children = []
  662. this.requestParam.data[1].children[0] = { 'name': 'insertRpdetail', 'type': 'e', 'parammaps': {
  663. pastureid: Cookies.get('pastureid'),
  664. bigid: '@insertRemainplan.LastInsertId',
  665. barid: '@insertSpotList.id',
  666. bar: '@insertSpotList.bname',
  667. type: 0
  668. }}
  669. this.requestParam.data[2] = { 'name': 'insertSpotList2', 'resultmaps': { 'list': this.useinbarNamesIdTempArr }}
  670. this.requestParam.data[2].children = []
  671. this.requestParam.data[2].children[0] = { 'name': 'insertRpdetail', 'type': 'e', 'parammaps': {
  672. pastureid: Cookies.get('pastureid'),
  673. bigid: '@insertRemainplan.LastInsertId',
  674. barid: '@insertSpotList2.id',
  675. bar: '@insertSpotList2.bname',
  676. type: 1
  677. }}
  678. ExecDataByConfig(this.requestParam).then(response => {
  679. console.log('新增保存发送参数', this.requestParam)
  680. if (response.msg === 'fail') {
  681. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  682. } else {
  683. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  684. this.getList()
  685. this.dropState = false
  686. }
  687. })
  688. },
  689. createCancel(row) {
  690. console.log('点击了新增取消')
  691. this.dropState = false
  692. for (let i = 0; i < this.table.list.length; i++) {
  693. if (row.myId === this.table.list[i].myId) {
  694. var listIndex = this.table.list.indexOf(this.table.list[i])
  695. }
  696. if (listIndex > -1) {
  697. this.table.list.splice(listIndex, 1)
  698. return
  699. }
  700. }
  701. },
  702. // 模板编辑
  703. handleUpdate(row) {
  704. for (let i = 0; i < this.table.list.length; i++) {
  705. if (this.table.list[i].Edit == true) {
  706. this.$message({ type: 'error', message: '当前内容未保存,请点击取消或保存继续进行操作', duration: 2000 })
  707. return false
  708. }
  709. }
  710. console.log(row, '=========')
  711. // 编辑true,不可编辑false
  712. row.Edit = true
  713. row.NoEdit = false
  714. // 新增false,编辑false,编辑保存true
  715. row.isCreate = false
  716. row.isUpdate = false
  717. row.isUpdateSave = true
  718. row.temp = {}
  719. row.temp2 = {}
  720. if (row.useinbarid == '0') { row.useinbarid = [] }
  721. if (row.barid == undefined) { row.barid = [] }
  722. if (row.tmrid == undefined) { row.tmrid = '' }
  723. if (row.times == undefined) { row.times = '' }
  724. if (row.treatmethod == undefined) { row.treatmethod = '' }
  725. // this.getCarFollowParm.parammaps.times = row.times
  726. if (row.times == '第一班') {
  727. this.getCarFollowParm.parammaps.times = 1
  728. row.times = '1'
  729. } else if (row.times == '第二班') {
  730. this.getCarFollowParm.parammaps.times = 2
  731. row.times = '2'
  732. } else if (row.times == '第三班') {
  733. this.getCarFollowParm.parammaps.times = 3
  734. row.times = '3'
  735. } else if (row.times == '第四班') {
  736. this.getCarFollowParm.parammaps.times = 4
  737. row.times = '4'
  738. } else if (row.times == '第五班') {
  739. this.getCarFollowParm.parammaps.times = 5
  740. row.times = '5'
  741. }
  742. GetDataByName(this.getCarFollowParm).then(response => {
  743. console.log('撒料计划车次跟随列表数据', response.data.list)
  744. if (response.data.list !== null) {
  745. this.carFollowList = response.data.list
  746. }
  747. })
  748. console.log(row, '====')
  749. if (row.lppcode == undefined) {
  750. this.$set(row, 'lppid', '')
  751. }
  752. this.getTransferbarsList()
  753. // row.barid = row.qstrids.split(',')
  754. // row.useinbarid = row.hstrids.split(',')
  755. var arr3 = []
  756. for (let i = 0; i < row.barid.length; i++) {
  757. arr3.push(this.barsList.find(obj => obj.id == row.barid[i]))
  758. }
  759. this.barsNamesIdTempArr = arr3
  760. var arr4 = []
  761. setTimeout(() => {
  762. for (let i = 0; i < row.useinbarid.length; i++) {
  763. arr4.push(this.transferbarsList.find(obj => obj.id == row.useinbarid[i]))
  764. }
  765. }, 500)
  766. this.useinbarNamesIdTempArr = arr4
  767. console.log(this.useinbarNamesIdTempArr, 'this.useinbarNamesIdTempArr')
  768. this.dropState = true
  769. },
  770. updateData(row) {
  771. console.log('点击了编辑保存', row)
  772. console.log(this.useinbarNamesIdTempArr, 'this.useinbarNamesIdTempArr========')
  773. if (row.rtime == null || row.rtime == 'null') {
  774. row.rtime = ''
  775. }
  776. if (row.barid == '' && row.tmrid == '' && row.times == '' && row.treatmethod == '') {
  777. this.$message({ type: 'error', message: '栏舍/TMR编号/班次/剩料处理方式不能为空', duration: 2000 })
  778. return false
  779. } else if (row.tmrid == '' && row.times == '' && row.treatmethod == '') {
  780. this.$message({ type: 'error', message: 'TMR编号/班次/剩料处理方式不能为空', duration: 2000 })
  781. return false
  782. } else if (row.times == '' && row.treatmethod == '') {
  783. this.$message({ type: 'error', message: '班次/混剩料处理方式不能为空', duration: 2000 })
  784. return false
  785. } else if (row.barid == '') {
  786. this.$message({ type: 'error', message: '栏舍不能为空', duration: 2000 })
  787. return false
  788. } else if (row.tmrid == '') {
  789. this.$message({ type: 'error', message: 'TMR编号不能为空', duration: 2000 })
  790. return false
  791. } else if (row.times == '') {
  792. this.$message({ type: 'error', message: '班次不能为空', duration: 2000 })
  793. return false
  794. } else if (row.treatmethod == '') {
  795. this.$message({ type: 'error', message: '剩料处理方式不能为空', duration: 2000 })
  796. return false
  797. }
  798. if (row.treatmethod !== '' && row.treatmethod == '转投剩料') {
  799. if (row.useinbarid == '') {
  800. this.$message({ type: 'error', message: '转投栏舍不能为空', duration: 2000 })
  801. return false
  802. }
  803. }
  804. if (row.treatmethod !== '' && row.treatmethod == '继续饲喂') {
  805. row.useinbarid = '0'
  806. }
  807. if (row.rtime == '' || row.rtime == null) {
  808. row.rtime = ''
  809. }
  810. for (let i = 0; i < this.table.list.length; i++) {
  811. if (row.sort == this.table.list[i].sort) {
  812. if (row.id !== this.table.list[i].id) {
  813. this.$message({ type: 'error', message: '车次不可重复', duration: 2000 })
  814. return false
  815. }
  816. }
  817. }
  818. var isInteger = /^\d+$/
  819. if (row.sort !== '') {
  820. if (!isInteger.test(parseFloat(row.sort))) {
  821. this.$message({ type: 'error', message: '车次请输入整数', duration: 2000 })
  822. return false
  823. }
  824. }
  825. if (row.sort == '' || row.sort == 0) {
  826. this.$message({ type: 'error', message: '车次不能为空且大于0', duration: 2000 })
  827. return false
  828. }
  829. if (row.times == '第一班') {
  830. row.times = 1
  831. } else if (row.times == '第二班') {
  832. row.times = 2
  833. } else if (row.times == '第三班') {
  834. row.times = 3
  835. } else if (row.times == '第四班') {
  836. row.times = 4
  837. } else if (row.times == '第五班') {
  838. row.times = 5
  839. }
  840. this.isokDisable = true
  841. setTimeout(() => {
  842. this.isokDisable = false
  843. }, 1000)
  844. this.requestParam = {}
  845. this.requestParam.common = { 'returnmap': '0' }
  846. this.requestParam.data = []
  847. this.requestParam.data[0] = { 'name': 'updateRemainplan', 'type': 'e', 'parammaps': {
  848. pastureid: row.pastureid,
  849. id: row.id,
  850. sort: row.sort,
  851. tmrid: row.tmrid,
  852. tmrcode: row.tmrcode,
  853. enable: row.enable,
  854. times: row.times,
  855. lppid: row.lppid,
  856. lppcode: row.lppcode,
  857. rtime: row.rtime,
  858. treatmethod: row.treatmethod
  859. }}
  860. this.requestParam.data[1] = { 'name': 'deleteRpdetail', 'type': 'e', 'parammaps': {
  861. pastureid: row.pastureid,
  862. bigid: row.id
  863. }}
  864. this.requestParam.data[2] = { 'name': 'insertSpotList2', 'resultmaps': { 'list': this.barsNamesIdTempArr }}
  865. this.requestParam.data[2].children = []
  866. this.requestParam.data[2].children[0] = { 'name': 'insertRpdetail', 'type': 'e', 'parammaps': {
  867. pastureid: row.pastureid,
  868. bigid: row.id,
  869. barid: '@insertSpotList2.id',
  870. bar: '@insertSpotList2.bname',
  871. type: 0
  872. }}
  873. this.requestParam.data[3] = { 'name': 'insertSpotList3', 'resultmaps': { 'list': this.useinbarNamesIdTempArr }}
  874. this.requestParam.data[3].children = []
  875. this.requestParam.data[3].children[0] = { 'name': 'insertRpdetail', 'type': 'e', 'parammaps': {
  876. pastureid: row.pastureid,
  877. bigid: row.id,
  878. barid: '@insertSpotList3.id',
  879. bar: '@insertSpotList3.bname',
  880. type: 1
  881. }}
  882. ExecDataByConfig(this.requestParam).then(response => {
  883. console.log('新增保存发送参数', this.requestParam)
  884. if (response.msg === 'fail') {
  885. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  886. } else {
  887. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  888. this.getList()
  889. this.dropState = false
  890. }
  891. })
  892. // this.requestParam.name = 'updateRemainplan'
  893. // this.requestParam.parammaps = row
  894. // this.requestParam.parammaps.pastureid = Cookies.get('pastureid')
  895. // PostDataByName(this.requestParam).then(response => {
  896. // console.log('新增保存发送参数', this.requestParam)
  897. // if (response.msg !== 'fail') {
  898. // this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  899. // this.getList()
  900. // this.dropState = false
  901. // } else {
  902. // this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  903. // }
  904. // })
  905. },
  906. updateCancel(row) {
  907. console.log('点击了编辑取消')
  908. // 编辑false,不可编辑true
  909. row.Edit = false
  910. row.NoEdit = true
  911. // 新增false,编辑true,编辑保存false
  912. row.isCreate = false
  913. row.isUpdate = true
  914. row.isUpdateSave = false
  915. this.getList()
  916. this.dropState = false
  917. },
  918. handleSelect(val) {
  919. console.log('勾选数据', val)
  920. this.selectList = val
  921. },
  922. // 行内删除
  923. handleRowDelete(row) {
  924. console.log(row, '点击了行删除')
  925. MessageBox.confirm('是否确认删除此信息?', {
  926. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  927. }).then(() => {
  928. this.selectList = []
  929. this.requestParam = {}
  930. this.requestParam.name = 'deleteRemainplan'
  931. this.requestParam.parammaps = {}
  932. this.requestParam.parammaps.pastureid = row.pastureid
  933. this.requestParam.parammaps.id = row.id
  934. PostDataByName(this.requestParam).then(response => {
  935. if (response.msg === 'fail') {
  936. this.$notify({ title: '删除失败', message: response.data, type: 'warning', duration: 2000 })
  937. } else {
  938. this.$notify({ title: '成功', message: '删除成功', type: 'success', duration: 2000 })
  939. this.getList()
  940. }
  941. })
  942. }).catch(() => {
  943. this.$message({ type: 'info', message: '已取消删除' })
  944. })
  945. },
  946. // 减少车次
  947. handleDelete() {
  948. if (this.selectList.length == 0) {
  949. this.$message({ type: 'error', message: '请选择车次信息', duration: 2000 })
  950. } else {
  951. MessageBox.confirm('当前选中' + this.selectList.length + '条信息,是否删除?', {
  952. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  953. }).then(() => {
  954. console.log(this.selectList)
  955. this.requestParam.common = { 'returnmap': '0' }
  956. this.requestParam.data = []
  957. this.requestParam.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.selectList }}
  958. this.requestParam.data[0].children = []
  959. this.requestParam.data[0].children[0] = { 'name': 'deleteRemainplan', 'type': 'e', 'parammaps': {
  960. id: '@insertSpotList.id',
  961. pastureid: '@insertSpotList.pastureid'
  962. }}
  963. ExecDataByConfig(this.requestParam).then(response => {
  964. console.log('删除保存发送参数', this.requestParam)
  965. if (response.msg === 'fail') {
  966. this.$notify({ title: '删除失败', message: response.data, type: 'warning', duration: 2000 })
  967. } else {
  968. this.$notify({ title: '', message: '删除成功', type: 'success', duration: 2000 })
  969. this.getList()
  970. }
  971. })
  972. })
  973. }
  974. },
  975. // 校验
  976. handleCheck() {
  977. console.log('点击了校验')
  978. this.check.dialogStatus = 'check'
  979. this.check.dialogFormVisible = true
  980. this.getCheckList()
  981. },
  982. getCheckList() {
  983. GetDataByName(this.check.getCheckParm).then(response => {
  984. if (response.data.list[0].bnames !== undefined) {
  985. this.check.temp.isDistribution = 0
  986. this.check.temp.bnames = response.data.list[0].bnames
  987. } else {
  988. this.check.temp = {}
  989. this.check.temp.isDistribution = 1
  990. }
  991. })
  992. },
  993. // 历史记录
  994. handleHistoryRecords() {
  995. console.log('点击了历史记录')
  996. this.dialogFull = false
  997. this.history.dialogStatus = 'history'
  998. this.history.dialogFormVisible = true
  999. this.getDateList()
  1000. },
  1001. // 历史时间
  1002. getDateList() {
  1003. GetDataByName(this.history.getdataDateParm).then(response => {
  1004. console.log('table数据', response.data.list)
  1005. if (response.data.list !== null) {
  1006. this.history.getdataListParm.parammaps.date = response.data.list[0].maxdate
  1007. this.getHistoryList()
  1008. } else {
  1009. this.history.getdataListParm.parammaps.date = ''
  1010. }
  1011. })
  1012. },
  1013. changeDate() {
  1014. this.getHistoryList()
  1015. },
  1016. // 应用
  1017. handleApplication() {
  1018. console.log('点击了应用')
  1019. MessageBox.confirm('是否确认将' + this.history.getdataListParm.parammaps.date + '的数据应用到当前?', {
  1020. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  1021. }).then(() => {
  1022. this.requestParam.name = 'applyFPdate'
  1023. this.requestParam.parammaps = {}
  1024. this.requestParam.parammaps.pastureid = Cookies.get('pastureid')
  1025. this.requestParam.parammaps.date = this.history.getdataListParm.parammaps.date
  1026. PostDataByName(this.requestParam).then(response => {
  1027. if (response.msg === 'fail') {
  1028. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  1029. } else {
  1030. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  1031. this.getHistoryIsDisplay()
  1032. this.getList()
  1033. }
  1034. })
  1035. }).catch(() => {
  1036. this.$message({ type: 'info', message: '已取消应用' })
  1037. })
  1038. },
  1039. getHistoryList() {
  1040. this.history.listLoading = true
  1041. GetDataByName(this.history.getdataListParm).then(response => {
  1042. console.log('table数据', response.data.list)
  1043. if (response.data.list !== null) {
  1044. console.log('table数据', response.data.list)
  1045. this.history.list = response.data.list
  1046. this.history.pageNum = response.data.pageNum
  1047. this.history.pageSize = response.data.pageSize
  1048. this.history.total = response.data.total
  1049. } else {
  1050. this.history.list = []
  1051. }
  1052. setTimeout(() => {
  1053. this.history.listLoading = false
  1054. }, 100)
  1055. })
  1056. },
  1057. handleTakeEffect() {
  1058. if (this.selectList.length == 0) {
  1059. this.$message({ type: 'error', message: '请选择车次信息', duration: 2000 })
  1060. } else {
  1061. MessageBox.confirm('当前选中' + this.selectList.length + '条信息,是否生效?', {
  1062. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  1063. }).then(() => {
  1064. for (let i = 0; i < this.selectList.length; i++) {
  1065. // this.$set(this.selectList[i], 'enable', '1')
  1066. this.selectList[i].enable = 1
  1067. }
  1068. console.log('生效', this.selectList)
  1069. this.requestParam.common = { 'returnmap': '0' }
  1070. this.requestParam.data = []
  1071. this.requestParam.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.selectList }}
  1072. this.requestParam.data[0].children = []
  1073. this.requestParam.data[0].children[0] = { 'name': 'updateRemainplanEnable', 'type': 'e', 'parammaps': {
  1074. enable: '@insertSpotList.enable',
  1075. id: '@insertSpotList.id',
  1076. pastureid: '@insertSpotList.pastureid'
  1077. }}
  1078. ExecDataByConfig(this.requestParam).then(response => {
  1079. console.log('生效保存发送参数', this.requestParam)
  1080. if (response.msg === 'fail') {
  1081. this.$notify({ title: '生效失败', message: response.data, type: 'warning', duration: 2000 })
  1082. } else {
  1083. this.$notify({ title: '', message: '生效成功', type: 'success', duration: 2000 })
  1084. this.getList()
  1085. }
  1086. })
  1087. })
  1088. }
  1089. },
  1090. handleDisable() {
  1091. if (this.selectList.length == 0) {
  1092. this.$message({ type: 'error', message: '请选择车次信息', duration: 2000 })
  1093. } else {
  1094. MessageBox.confirm('当前选中' + this.selectList.length + '条信息,是否禁用?', {
  1095. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  1096. }).then(() => {
  1097. for (let i = 0; i < this.selectList.length; i++) {
  1098. // this.$set(this.selectList[i], 'enable', '1')
  1099. this.selectList[i].enable = 0
  1100. }
  1101. console.log('禁用', this.selectList)
  1102. this.requestParam.common = { 'returnmap': '0' }
  1103. this.requestParam.data = []
  1104. this.requestParam.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.selectList }}
  1105. this.requestParam.data[0].children = []
  1106. this.requestParam.data[0].children[0] = { 'name': 'updateRemainplanEnable', 'type': 'e', 'parammaps': {
  1107. enable: '@insertSpotList.enable',
  1108. id: '@insertSpotList.id',
  1109. pastureid: '@insertSpotList.pastureid'
  1110. }}
  1111. ExecDataByConfig(this.requestParam).then(response => {
  1112. console.log('禁用保存发送参数', this.requestParam)
  1113. if (response.msg === 'fail') {
  1114. this.$notify({ title: '禁用失败', message: response.data, type: 'warning', duration: 2000 })
  1115. } else {
  1116. this.$notify({ title: '', message: '禁用成功', type: 'success', duration: 2000 })
  1117. this.getList()
  1118. }
  1119. })
  1120. })
  1121. }
  1122. }
  1123. }
  1124. }
  1125. </script>
  1126. <style lang="scss" scoped>
  1127. .search{clear: both;}
  1128. .table{margin-top:10px;}
  1129. </style>