8ae01d70773c31511f501efacd52d6cc685de65c.svn-base 24 KB

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