68d2b66822cd48c942f1ea42d17c5765c7d6d2f1.svn-base 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586
  1. <template>
  2. <div>
  3. <div class="operation">
  4. <el-button class="success" icon="el-icon-plus" style="float: left;" @click="handleCreate">新增车次</el-button>
  5. <el-button class="danger" icon="el-icon-delete" style="float: left;" @click="handleDelete">减少车次</el-button>
  6. </div>
  7. <div class="search" />
  8. <div class="table">
  9. <el-table
  10. id="table"
  11. :key="table.tableKey"
  12. v-loading="table.listLoading"
  13. element-loading-text="给我一点时间"
  14. :data="table.list"
  15. border
  16. fit
  17. highlight-current-row
  18. style="width: 100%;"
  19. :row-style="rowStyle"
  20. :cell-style="cellStyle"
  21. class="elTable table-fixed"
  22. row-key="id"
  23. @selection-change="handleSelect"
  24. >
  25. <el-table-column type="selection" min-width="50" />
  26. <el-table-column label="车次" min-width="85px" align="center">
  27. <template slot-scope="scope">
  28. <span v-if="scope.row.NoEdit">{{ scope.row.sort }}</span>
  29. <el-input v-if="scope.row.Edit" v-model.trim="scope.row.sort" type="number" style="width:80%;padding:10px 0;" />
  30. </template>
  31. </el-table-column>
  32. <el-table-column label="配方名称" min-width="110px" align="center">
  33. <template slot-scope="scope">
  34. <span v-if="scope.row.NoEdit">{{ scope.row.ftname }}</span>
  35. <el-select v-if="scope.row.Edit" v-model="scope.row.ftid" filterable placeholder="" class="filter-item" style="width:80%;padding:10px 0;" @change="(value)=> {changeformulaName(value, scope.row)}">
  36. <el-option v-for="item in formulaNameList" :key="item.id" :label="item.tname" :value="item.id" />
  37. </el-select>
  38. </template>
  39. </el-table-column>
  40. <el-table-column label="TMR编号" prop="weight" min-width="130px" align="center">
  41. <template slot-scope="scope">
  42. <span v-if="scope.row.NoEdit">{{ scope.row.tmrcode }}</span>
  43. <el-select v-if="scope.row.Edit" v-model="scope.row.tmrid" filterable placeholder="" class="filter-item" style="width:80%;padding:10px 0;" @change="(value)=> {changeTMRNumber(value, scope.row)}">
  44. <el-option v-for="item in TMRNumberList" :key="item.id" :label="item.tname" :value="item.id" />
  45. </el-select>
  46. </template>
  47. </el-table-column>
  48. <el-table-column label="班次" min-width="120px" align="center">
  49. <template slot-scope="scope">
  50. <span v-if="scope.row.NoEdit">{{ scope.row.times }}</span>
  51. <el-select v-if="scope.row.Edit" v-model="scope.row.times" filterable placeholder="" class="filter-item" style="width:80%;padding:10px 0;" @change="(value)=> {changeTimes(value, scope.row)}">
  52. <el-option v-for="item in frequencyList" :key="item.id" :label="item.name" :value="item.id" />
  53. </el-select>
  54. </template>
  55. </el-table-column>
  56. <el-table-column label="撒料计划车次跟随" min-width="100px" align="center">
  57. <template slot-scope="scope">
  58. <span v-if="scope.row.NoEdit">{{ scope.row.lppcode }}</span>
  59. <el-select v-if="scope.row.Edit" v-model="scope.row.lppid" filterable clearable placeholder="" class="filter-item" style="width:80%;padding:10px 0;" @change="(value)=> {changeCarFollow(value, scope.row)}">
  60. <el-option v-for="item in carFollowList" :key="item.id" :label="item.lppcode" :value="item.id" />
  61. </el-select>
  62. </template>
  63. </el-table-column>
  64. <el-table-column label="生效" min-width="80px" align="center">
  65. <template slot-scope="scope">
  66. <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)" />
  67. </template>
  68. </el-table-column>
  69. <el-table-column label="时间" min-width="130px" align="center">
  70. <template slot-scope="scope">
  71. <span v-if="scope.row.NoEdit">{{ scope.row.ptime }}</span>
  72. <el-time-picker v-if="scope.row.Edit" v-model="scope.row.ptime" type="datetime" placeholder="选择时间" format="HH:mm" value-format="HH:mm" style="display: inline-block;width: 95%;" />
  73. </template>
  74. </el-table-column>
  75. <el-table-column label="单车操作重量" min-width="80px" align="center">
  76. <template slot-scope="scope">
  77. <span>{{ scope.row.maxweight }}</span>
  78. </template>
  79. </el-table-column>
  80. <el-table-column label="混料重量" min-width="90px" align="center">
  81. <template slot-scope="scope">
  82. <span v-if="scope.row.NoEdit">{{ scope.row.operateweight }}</span>
  83. <el-input v-if="scope.row.Edit" v-model="scope.row.operateweight" type="number" style="width:80%;padding:10px 0;" />
  84. </template>
  85. </el-table-column>
  86. <el-table-column label="操作" align="center" min-width="80" class-name="small-padding fixed-width" fixed="right">
  87. <template slot-scope="{row}">
  88. <el-button v-if="row.isCreate" :disabled="isokDisable" icon="el-icon-folder-checked" class="miniSuccess" @click="createData(row)" />
  89. <span v-if="row.isCreate" class="centerSpan">|</span>
  90. <el-button v-if="row.isCreate" class="minCancel" icon="el-icon-close" @click="createCancel(row)" />
  91. <el-button v-if="row.isUpdate" class="miniSuccess" icon="el-icon-edit-outline" @click="handleUpdate(row)" />
  92. <span v-if="row.isUpdate" class="centerSpan">|</span>
  93. <el-button v-if="row.isUpdate" class="miniDanger" icon="el-icon-delete" @click="handleRowDelete(row)" />
  94. <el-button v-if="row.isUpdateSave" :disabled="isokDisable" icon="el-icon-folder-checked" class="miniSuccess" @click="updateData(row)" />
  95. <span v-if="row.isUpdateSave" class="centerSpan">|</span>
  96. <el-button v-if="row.isUpdateSave" class="minCancel" icon="el-icon-close" @click="updateCancel(row)" />
  97. </template>
  98. </el-table-column>
  99. </el-table>
  100. </div>
  101. </span>
  102. </div>
  103. </template>
  104. <script>
  105. import { GetDataByName, GetDataByNames, PostDataByName, failproccess, ExecDataByConfig } from '@/api/common'
  106. import Sortable from 'sortablejs'
  107. import Pagination from '@/components/Pagination'
  108. import Cookies from 'js-cookie'
  109. import { MessageBox } from 'element-ui'
  110. export default {
  111. name: 'PremixedPlan',
  112. components: { Pagination },
  113. props: {
  114. show: { type: Boolean, default: false }, // 弹框可见标志
  115. parentDate: { type: String, defalut: '' }
  116. },
  117. data() {
  118. return {
  119. date: '',
  120. requestParams: [
  121. { name: 'getTMRYHList', offset: 0, pagecount: 0, parammaps: { pastureid: Cookies.get('pastureid') }},
  122. { name: 'getFTYHList', offset: 0, pagecount: 0, parammaps: { pastureid: Cookies.get('pastureid') }}
  123. ],
  124. formulaNameList: [], // 配方名称
  125. TMRNumberList: [], // TMR编号
  126. // 班次
  127. maxTime: {
  128. getMaxTimesParm: {
  129. name: 'getSysoptEnable',
  130. page: 1,
  131. offset: 1,
  132. pagecount: 1,
  133. returntype: 'Map',
  134. parammaps: {
  135. pastureid: Cookies.get('pastureid'),
  136. inforname: 'times'
  137. }
  138. }
  139. },
  140. frequencyList: [], // 班次
  141. getCarFollowParm: {
  142. name: 'getLPPCodeListdate',
  143. offset: 0,
  144. pagecount: 0,
  145. parammaps: {
  146. pastureid: Cookies.get('pastureid'),
  147. times: ''
  148. }
  149. },
  150. carFollowList: [], // 发料计划车次跟随
  151. table: {
  152. getdataListParm: {
  153. name: 'getPremixplanListdate',
  154. page: 1,
  155. offset: 1,
  156. pagecount: '',
  157. returntype: 'Map',
  158. parammaps: {
  159. pastureid: Cookies.get('pastureid')
  160. }
  161. },
  162. tableKey: 0,
  163. list: [],
  164. total: 0,
  165. listLoading: true
  166. },
  167. selectList: [],
  168. isokDisable: false,
  169. requestParam: {},
  170. rowStyle: { maxHeight: 30 + 'px', height: 30 + 'px' },
  171. cellStyle: { padding: 0 + 'px' },
  172. dropState: false
  173. }
  174. },
  175. watch: {
  176. // 监听show,visible 随着show变化而变化
  177. show: {
  178. immediate: true,
  179. handler(newVal, oldVal) {
  180. console.log('newVal-show', newVal)
  181. }
  182. },
  183. parentDate: {
  184. immediate: true,
  185. handler(newVal, oldVal) {
  186. console.log('newVal-show', newVal)
  187. this.date = newVal
  188. }
  189. }
  190. },
  191. created() {
  192. this.getDownList()
  193. this.getIsDisplay()
  194. this.getList()
  195. },
  196. methods: {
  197. getDownList() {
  198. GetDataByNames(this.requestParams).then(response => {
  199. this.TMRNumberList = response.data.getTMRYHList.list
  200. this.formulaNameList = response.data.getFTYHList.list
  201. })
  202. },
  203. getIsDisplay() {
  204. GetDataByName(this.maxTime.getMaxTimesParm).then(response => {
  205. if (response.data.list[0].inforvalue == 1) {
  206. this.frequencyList = [{ id: '1', name: '第一班' }]
  207. } else if (response.data.list[0].inforvalue == 2) {
  208. this.frequencyList = [{ id: '1', name: '第一班' }, { id: '2', name: '第二班' }]
  209. } else if (response.data.list[0].inforvalue == 3) {
  210. this.frequencyList = [{ id: '1', name: '第一班' }, { id: '2', name: '第二班' }, { id: '3', name: '第三班' }]
  211. } else if (response.data.list[0].inforvalue == 4) {
  212. this.frequencyList = [{ id: '1', name: '第一班' }, { id: '2', name: '第二班' }, { id: '3', name: '第三班' }, { id: '4', name: '第四班' }]
  213. }
  214. })
  215. },
  216. getList() {
  217. this.table.listLoading = true
  218. this.table.getdataListParm.parammaps.date = this.date
  219. GetDataByName(this.table.getdataListParm).then(response => {
  220. console.log('table数据', response.data.list)
  221. if (response.data.list !== null) {
  222. for (let i = 0; i < response.data.list.length; i++) {
  223. this.$set(response.data.list[i], 'Edit', false) // 编辑
  224. this.$set(response.data.list[i], 'NoEdit', true) // 不可编辑/输入
  225. this.$set(response.data.list[i], 'groupEdit', false) // 饲料组编辑
  226. this.$set(response.data.list[i], 'groupNoEdit', true) // 饲料组不可编辑
  227. this.$set(response.data.list[i], 'isCreate', false) // 新增操作
  228. this.$set(response.data.list[i], 'isUpdate', true) // 编辑操作
  229. this.$set(response.data.list[i], 'isUpdateSave', false) // 编辑保存
  230. }
  231. this.table.list = response.data.list
  232. this.table.pageNum = response.data.pageNum
  233. this.table.pageSize = response.data.pageSize
  234. this.rowDrop()
  235. this.table.total = response.data.total
  236. } else {
  237. this.table.list = []
  238. }
  239. setTimeout(() => {
  240. this.table.listLoading = false
  241. }, 100)
  242. })
  243. },
  244. // 配方名称
  245. changeformulaName(item, row) {
  246. row.ftname = this.formulaNameList.find(obj => obj.id == item).tname
  247. },
  248. // TMR编号
  249. changeTMRNumber(item, row) {
  250. row.tmrcode = this.TMRNumberList.find(obj => obj.id == item).tname
  251. row.maxweight = this.TMRNumberList.find(obj => obj.id == item).maxstirfeed
  252. },
  253. // 撒料计划车次跟随列表
  254. changeCarFollow(item, row) {
  255. if (item == '') {
  256. row.lppcode = ''
  257. } else {
  258. row.lppcode = this.carFollowList.find(obj => obj.id == item).lppcode
  259. }
  260. },
  261. // 班次
  262. changeTimes(item, row) {
  263. console.log(item, row)
  264. this.getCarFollowParm.parammaps.times = item
  265. this.getCarFollowList(row)
  266. },
  267. // 撒料计划车次跟随列表
  268. getCarFollowList(row) {
  269. this.getCarFollowParm.parammaps.date = this.date
  270. GetDataByName(this.getCarFollowParm).then(response => {
  271. console.log('撒料计划车次跟随列表数据', response.data.list)
  272. if (response.data.list !== null) {
  273. this.carFollowList = response.data.list
  274. row.lppid = this.carFollowList[0].id
  275. row.lppcode = this.carFollowList[0].lppcode
  276. }
  277. })
  278. },
  279. handleEnableChange() {
  280. console.log('点击了生效')
  281. },
  282. // 行拖拽
  283. rowDrop() {
  284. console.log(document.querySelector('#table .el-table__body-wrapper tbody'))
  285. const tbody = document.querySelector('#table .el-table__body-wrapper tbody')
  286. const that = this
  287. var sortable = Sortable.create(tbody, {
  288. disabled: that.dropState,
  289. onChoose({ newIndex, oldIndex }) {
  290. if (that.dropState == true) {
  291. sortable.destroy()
  292. }
  293. },
  294. onEnd({ newIndex, oldIndex }) {
  295. const currRow = that.table.list.splice(oldIndex, 1)[0]
  296. that.table.list.splice(newIndex, 0, currRow)
  297. console.log('索引', newIndex)
  298. console.log('拖动数据', currRow)
  299. console.log('上', that.table.list[newIndex - 1])
  300. console.log('下', that.table.list[newIndex + 1])
  301. }
  302. })
  303. },
  304. // 模板新增
  305. handleCreate() {
  306. this.dropState = true
  307. console.log('点击了新增车次')
  308. // 编辑true/不可编辑false
  309. // 新增操true,编辑false,编辑保存false
  310. for (let i = 0; i < this.table.list.length; i++) {
  311. if (this.table.list[i].Edit === true) {
  312. console.log(123)
  313. this.$message({ type: 'error', message: '当前内容未保存,请点击取消或保存继续进行操作', duration: 2000 })
  314. return false
  315. }
  316. }
  317. var sort = 1
  318. if (this.table.list.length > 0) {
  319. sort = parseInt(this.table.list[this.table.list.length - 1].sort) + 1
  320. } else {
  321. sort = 1
  322. }
  323. 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': '', 'ptime': '', 'maxweight': '', 'operateweight': '' })
  324. },
  325. createData(row) {
  326. console.log('点击了新增保存', row)
  327. if (row.sort == '' && row.ftid == '' && row.tmrid == '' && row.times == '' && row.operateweight == '') {
  328. this.$message({ type: 'error', message: '车次/配方名称/TMR编号/班次/混料重量不能为空', duration: 2000 })
  329. return false
  330. } else if (row.ftid == '' && row.tmrid == '' && row.times == '' && row.operateweight == '') {
  331. this.$message({ type: 'error', message: '配方名称/TMR编号/班次/混料重量不能为空', duration: 2000 })
  332. return false
  333. } else if (row.tmrid == '' && row.times == '' && row.operateweight == '') {
  334. this.$message({ type: 'error', message: 'TMR编号/班次/混料重量不能为空', duration: 2000 })
  335. return false
  336. } else if (row.times == '' && row.operateweight == '') {
  337. this.$message({ type: 'error', message: '班次/混料重量不能为空', duration: 2000 })
  338. return false
  339. } else if (row.sort == '' || row.sort == 0) {
  340. this.$message({ type: 'error', message: '车次不能为空且大于0', duration: 2000 })
  341. return false
  342. } else if (row.ftid == '') {
  343. this.$message({ type: 'error', message: '配方名称不能为空', duration: 2000 })
  344. return false
  345. } else if (row.tmrid == '') {
  346. this.$message({ type: 'error', message: 'TMR编号不能为空', duration: 2000 })
  347. return false
  348. } else if (row.times == '') {
  349. this.$message({ type: 'error', message: '班次不能为空', duration: 2000 })
  350. return false
  351. } else if (row.operateweight == '') {
  352. this.$message({ type: 'error', message: '混料重量不能为空', duration: 2000 })
  353. return false
  354. }
  355. for (let i = 0; i < this.table.list.length; i++) {
  356. if (row.sort !== '') {
  357. if (row.sort == this.table.list[i].sort) {
  358. if (row.myId !== this.table.list[i].myId) {
  359. this.$message({ type: 'error', message: '车次不可重复', duration: 2000 })
  360. return false
  361. }
  362. }
  363. }
  364. }
  365. var isInteger = /^\d+$/
  366. if (row.sort !== '') {
  367. if (!isInteger.test(parseFloat(row.sort))) {
  368. this.$message({ type: 'error', message: '车次请输入整数', duration: 2000 })
  369. return false
  370. }
  371. }
  372. this.isokDisable = true
  373. setTimeout(() => {
  374. this.isokDisable = false
  375. }, 1000)
  376. this.requestParam.name = 'insertPremixplandate'
  377. row.date = this.date
  378. this.requestParam.parammaps = row
  379. this.requestParam.parammaps.pastureid = Cookies.get('pastureid')
  380. PostDataByName(this.requestParam).then(response => {
  381. console.log('新增保存发送参数', this.requestParam)
  382. if (response.msg !== 'fail') {
  383. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  384. this.getList()
  385. this.dropState = false
  386. } else {
  387. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  388. }
  389. })
  390. },
  391. createCancel(row) {
  392. console.log('点击了新增取消')
  393. this.dropState = false
  394. for (let i = 0; i < this.table.list.length; i++) {
  395. if (row.myId === this.table.list[i].myId) {
  396. var listIndex = this.table.list.indexOf(this.table.list[i])
  397. }
  398. if (listIndex > -1) {
  399. this.table.list.splice(listIndex, 1)
  400. return
  401. }
  402. }
  403. },
  404. // 模板编辑
  405. handleUpdate(row) {
  406. for (let i = 0; i < this.table.list.length; i++) {
  407. if (this.table.list[i].Edit == true) {
  408. this.$message({ type: 'error', message: '当前内容未保存,请点击取消或保存继续进行操作', duration: 2000 })
  409. return false
  410. }
  411. }
  412. // 编辑true,不可编辑false
  413. row.Edit = true
  414. row.NoEdit = false
  415. // 新增false,编辑false,编辑保存true
  416. row.isCreate = false
  417. row.isUpdate = false
  418. row.isUpdateSave = true
  419. row.lppid = String(row.lppid)
  420. if (row.times == '第一班') {
  421. this.getCarFollowParm.parammaps.times = '1'
  422. row.times = '1'
  423. } else if (row.times == '第二班') {
  424. this.getCarFollowParm.parammaps.times = '2'
  425. row.times = '2'
  426. } else if (row.times == '第三班') {
  427. this.getCarFollowParm.parammaps.times = '3'
  428. row.times = '3'
  429. } else if (row.times == '第四班') {
  430. this.getCarFollowParm.parammaps.times = '4'
  431. row.times = '4'
  432. }
  433. console.log(row)
  434. GetDataByName(this.getCarFollowParm).then(response => {
  435. console.log('撒料计划车次跟随列表数据', response.data.list)
  436. if (response.data.list !== null) {
  437. this.carFollowList = response.data.list
  438. }
  439. })
  440. this.dropState = true
  441. },
  442. updateData(row) {
  443. console.log('点击了编辑保存', row)
  444. if (row.ftid == '' && row.tmrid == '' && row.times == '' && row.operateweight == '') {
  445. this.$message({ type: 'error', message: '配方名称/TMR编号/班次/混料重量不能为空', duration: 2000 })
  446. return false
  447. } else if (row.tmrid == '' && row.times == '' && row.operateweight == '') {
  448. this.$message({ type: 'error', message: 'TMR编号/班次/混料重量不能为空', duration: 2000 })
  449. return false
  450. } else if (row.times == '' && row.operateweight == '') {
  451. this.$message({ type: 'error', message: '班次/混料重量不能为空', duration: 2000 })
  452. return false
  453. } else if (row.ftid == '') {
  454. this.$message({ type: 'error', message: '配方名称不能为空', duration: 2000 })
  455. return false
  456. } else if (row.tmrid == '') {
  457. this.$message({ type: 'error', message: 'TMR编号不能为空', duration: 2000 })
  458. return false
  459. } else if (row.times == '') {
  460. this.$message({ type: 'error', message: '班次不能为空', duration: 2000 })
  461. return false
  462. } else if (row.operateweight == '') {
  463. this.$message({ type: 'error', message: '混料重量不能为空', duration: 2000 })
  464. return false
  465. }
  466. for (let i = 0; i < this.table.list.length; i++) {
  467. if (row.sort == this.table.list[i].sort) {
  468. if (row.id !== this.table.list[i].id) {
  469. this.$message({ type: 'error', message: '车次不可重复', duration: 2000 })
  470. return false
  471. }
  472. }
  473. }
  474. var isInteger = /^\d+$/
  475. if (row.sort !== '') {
  476. if (!isInteger.test(parseFloat(row.sort))) {
  477. this.$message({ type: 'error', message: '车次请输入整数', duration: 2000 })
  478. return false
  479. }
  480. }
  481. if (row.sort == '' || row.sort == 0) {
  482. this.$message({ type: 'error', message: '车次不能为空且大于0', duration: 2000 })
  483. return false
  484. }
  485. this.isokDisable = true
  486. setTimeout(() => {
  487. this.isokDisable = false
  488. }, 1000)
  489. this.requestParam.name = 'updatePremixplandate'
  490. row.date = this.date
  491. this.requestParam.parammaps = row
  492. PostDataByName(this.requestParam).then(response => {
  493. console.log('新增保存发送参数', this.requestParam)
  494. if (response.msg !== 'fail') {
  495. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  496. this.getList()
  497. this.dropState = false
  498. } else {
  499. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  500. }
  501. })
  502. },
  503. updateCancel(row) {
  504. console.log('点击了编辑取消')
  505. // 编辑false,不可编辑true
  506. row.Edit = false
  507. row.NoEdit = true
  508. // 新增false,编辑true,编辑保存false
  509. row.isCreate = false
  510. row.isUpdate = true
  511. row.isUpdateSave = false
  512. this.getList()
  513. this.dropState = false
  514. },
  515. handleSelect(val) {
  516. console.log('勾选数据', val)
  517. this.selectList = val
  518. },
  519. // 行内删除
  520. handleRowDelete(row) {
  521. console.log(row, '点击了行删除')
  522. MessageBox.confirm('是否确认删除此信息?', {
  523. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  524. }).then(() => {
  525. this.selectList = []
  526. this.requestParam = {}
  527. this.requestParam.name = 'deletePremixplandate'
  528. this.requestParam.parammaps = {}
  529. this.requestParam.parammaps.pastureid = row.pastureid
  530. this.requestParam.parammaps.id = row.id
  531. this.requestParam.parammaps.date = this.date
  532. PostDataByName(this.requestParam).then(response => {
  533. if (response.msg === 'fail') {
  534. this.$notify({ title: '删除失败', message: response.data, type: 'warning', duration: 2000 })
  535. } else {
  536. this.$notify({ title: '成功', message: '删除成功', type: 'success', duration: 2000 })
  537. this.getList()
  538. }
  539. })
  540. }).catch(() => {
  541. this.$message({ type: 'info', message: '已取消删除' })
  542. })
  543. },
  544. // 减少车次
  545. handleDelete() {
  546. if (this.selectList.length == 0) {
  547. this.$message({ type: 'error', message: '请选择车次信息', duration: 2000 })
  548. } else {
  549. MessageBox.confirm('当前选中' + this.selectList.length + '条信息,是否删除?', {
  550. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  551. }).then(() => {
  552. console.log(this.selectList)
  553. this.requestParam.common = { 'returnmap': '0' }
  554. this.requestParam.data = []
  555. this.requestParam.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.selectList }}
  556. this.requestParam.data[0].children = []
  557. this.requestParam.data[0].children[0] = { 'name': 'deletePremixplandate', 'type': 'e', 'parammaps': {
  558. id: '@insertSpotList.id',
  559. pastureid: '@insertSpotList.pastureid',
  560. date: this.date
  561. }}
  562. ExecDataByConfig(this.requestParam).then(response => {
  563. console.log('删除保存发送参数', this.requestParam)
  564. if (response.msg === 'fail') {
  565. this.$notify({ title: '删除失败', message: response.data, type: 'warning', duration: 2000 })
  566. } else {
  567. this.$notify({ title: '', message: '删除成功', type: 'success', duration: 2000 })
  568. this.getList()
  569. }
  570. })
  571. })
  572. }
  573. }
  574. }
  575. }
  576. </script>