index.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676
  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="handleCreate1">设置推料时间</el-button>
  5. <el-button v-if="isRoleEdit" class="success" icon="el-icon-plus" style="float: left;" @click="handleCreate2">设置允许误差时间</el-button>
  6. <el-button v-if="isRoleEdit" class="success" icon="el-icon-open" style="float: left;" @click="handleTakeEffect">启用</el-button>
  7. <el-button v-if="isRoleEdit" class="danger" icon="el-icon-turn-off" style="float: left;" @click="handleDisable">禁用</el-button>
  8. <el-button v-if="isRoleEdit" class="success" style="float: left;" @click="handleCheck">校验</el-button>
  9. </div>
  10. <div class="table">
  11. <el-table
  12. :key="table.tableKey"
  13. ref="table"
  14. v-loading="table.listLoading"
  15. element-loading-text="给我一点时间"
  16. :data="table.list"
  17. border
  18. fit
  19. highlight-current-row
  20. style="width: 100%;"
  21. :row-style="rowStyle"
  22. :cell-style="cellStyle"
  23. class="elTable table-fixed"
  24. :max-height="myHeight"
  25. @header-click="headerClick"
  26. @cell-click="cellClick"
  27. @selection-change="handleSelect"
  28. @cell-dblclick="celldblclick"
  29. >
  30. <el-table-column type="selection" width="50" />
  31. <el-table-column :key="1" label="序号" align="center" type="index" width="50px" class-name="small-padding fixed-width" fixed="left" />
  32. <el-table-column label="栏舍名称" min-width="100px" align="center" class-name="small-padding fixed-width" fixed="left">
  33. <template slot-scope="scope">
  34. <span>{{ scope.row.barname }}</span>
  35. </template>
  36. </el-table-column>
  37. <el-table-column :key="2" label="推料车名称" min-width="70px" align="center">
  38. <template slot-scope="scope">
  39. <span>{{ scope.row.softccount }}</span>
  40. </template>
  41. </el-table-column>
  42. <el-table-column :key="3" label="推料车编号" min-width="90px" align="center">
  43. <template slot-scope="scope">
  44. <span v-if="scope.row.NoEdit">{{ scope.row.ccount }}</span>
  45. <el-input v-if="scope.row.Edit" v-model="scope.row.ccount" step="0.01" type="number" style="width:95%;padding:10px 0;" />
  46. </template>
  47. </el-table-column>
  48. <el-table-column :key="4" label="推料时间(每天)" min-width="85px" align="center">
  49. <template slot-scope="scope">
  50. <span v-if="scope.row.NoEdit">{{ scope.row.ratio }}</span>
  51. <el-input v-if="scope.row.Edit" v-model="scope.row.ratio" step="0.01" type="number" style="width:95%;padding:10px 0;" />
  52. </template>
  53. </el-table-column>
  54. <el-table-column :key="5" label="允许误差时间(分钟)" min-width="85px" align="center">
  55. <template slot-scope="scope">
  56. <span v-if="scope.row.NoEdit">{{ scope.row.ccountratio }}</span>
  57. <el-input v-if="scope.row.Edit" v-model="scope.row.ccountratio" type="number" style="width:95%;padding:10px 0;" />
  58. </template>
  59. </el-table-column>
  60. <el-table-column label="操作" align="center" width="80" class-name="small-padding fixed-width" fixed="right">
  61. <template slot-scope="{row}">
  62. <el-button v-if="row.isUpdate && isRoleEdit" class="miniSuccess" icon="el-icon-edit-outline" @click="handleUpdate(row)" />
  63. <el-button v-if="row.isUpdateSave && isRoleEdit" :disabled="isokDisable" icon="el-icon-folder-checked" class="miniSuccess" @click="updateData(row)" />
  64. <span v-if="row.isUpdateSave && isRoleEdit" class="centerSpan">|</span>
  65. <el-button v-if="row.isUpdateSave && isRoleEdit" class="minCancel" icon="el-icon-close" @click="updateCancel(row)" />
  66. </template>
  67. </el-table-column>
  68. </el-table>
  69. <!-- <pagination v-show="table.total>=0" :total="table.total" :page.sync="table.getdataListParm.offset" :limit.sync="table.getdataListParm.pagecount" @pagination="getList" /> -->
  70. </div>
  71. <el-dialog :fullscreen="dialogFull" :visible.sync="create1.dialogFormVisible" :close-on-click-modal="false" width="50%">
  72. <template slot="title">
  73. <div class="avue-crud__dialog__header">
  74. <span class="el-dialog__title">
  75. <span style="display:inline-block;width:3px;height:20px;margin-right:5px; float: left;margin-top:2px" />
  76. 推料计划
  77. </span>
  78. <div class="avue-crud__dialog__menu" @click="dialogFull? dialogFull=false: dialogFull=true">
  79. <svg-icon v-if="dialogFull" icon-class="exit-fullscreen" />
  80. <svg-icon v-else icon-class="fullscreen" />
  81. </div>
  82. </div>
  83. </template>
  84. <div class="app-add">
  85. <el-form ref="temp" :rules="create1.rules" :model="create1.temp" label-position="right" label-width="155px" style="width: 100%;margin:0 auto 50px">
  86. <el-row>
  87. <el-col :span="6">
  88. <el-form-item label="设置时间:" prop="useinbarid">
  89. <el-time-picker
  90. v-model="timevalue1"
  91. :picker-options="{ selectableRange: '00:00:00 - 23:59:59' }"
  92. value-format="HH:mm"
  93. @change="change_time1"
  94. format="HH:mm"
  95. placeholder="任意时间点">
  96. </el-time-picker>
  97. </el-form-item>
  98. </el-col>
  99. </el-row>
  100. <el-row>
  101. <el-tag v-for="tag in timetags1" :key="tag.name" closable @close="tag_close1(tag)" type="success">{{tag}}</el-tag>
  102. </el-row>
  103. </el-form>
  104. <div slot="footer" class="dialog-footer">
  105. <el-button class="cancelClose" @click="create1.dialogFormVisible = false;getList()">关闭</el-button>
  106. <el-button class="save" @click="handleCreate">确认</el-button>
  107. </div>
  108. </div>
  109. </el-dialog>
  110. </div>
  111. </template>
  112. <script>
  113. import { GetDataByName, postJson, GetDataByNames, compareSort, ExecDataByConfig, failproccess, PostDataByName, formatNum, checkButtons } from '@/api/common'
  114. import Pagination from '@/components/Pagination'
  115. import Pagination2 from '@/components/Pagination2'
  116. import { parseTime, json2excel, handleTableSpan, handleObjectSpanMethod } from '@/utils/index.js'
  117. import { MessageBox } from 'element-ui'
  118. import Cookies from 'js-cookie'
  119. import axios from 'axios'
  120. import { getToken } from '@/utils/auth'
  121. export default {
  122. inject: ['reload'],
  123. name: 'PushMaterialPlan',
  124. components: { Pagination, Pagination2 },
  125. data() {
  126. return {
  127. table: {
  128. getdataListParm: {
  129. name: 'getFPList',
  130. page: 1,
  131. offset: 1,
  132. // pagecount: parseInt(Cookies.get('pageCount')),
  133. pagecount: '',
  134. returntype: 'Map',
  135. parammaps: {
  136. pastureid: Cookies.get('pastureid'),
  137. enable: '',
  138. barid: '',
  139. tname: ''
  140. }
  141. },
  142. tableKey: 0,
  143. list: [],
  144. total: 0,
  145. listLoading: true,
  146. temp: {},
  147. },
  148. timevalue1: new Date(2016, 9, 10, 18, 40),
  149. timetags1: ['8:40','9:00','10:00'],
  150. dialogFull: false,
  151. isRoleEdit: [],
  152. headerList: [],
  153. pickerMinDate: '',
  154. tnameList: [], // 配方名 称
  155. recipeTemplateList: [], // 配方模板
  156. feedingFormulaList: [], // 补料配方
  157. livestockTypeList: [], // 类别
  158. barList: [],
  159. rules: {
  160. cowclassid: [{ type: 'string', required: true, message: '必填', trigger: 'blur' }]
  161. },
  162. selectList: [],
  163. textMap: {
  164. Nutritional: '营养评估',
  165. history: '历史记录'
  166. },
  167. focusWRow: {}, // 一班重量得到焦点暂存
  168. focusWRow2: {}, // 2班重量得到焦点暂存
  169. focusWRow3: {}, // 3班重量得到焦点暂存
  170. focusWRow4: {}, // 4班重量得到焦点暂存
  171. requestParam: {},
  172. download: {
  173. getdataListParm: {
  174. name: 'getFPList',
  175. page: 1,
  176. offset: 1,
  177. pagecount: 0,
  178. returntype: 'Map',
  179. parammaps: {
  180. pastureid: Cookies.get('pastureid'),
  181. enable: ''
  182. }
  183. },
  184. list: []
  185. },
  186. spanObj: {},
  187. mergekeys: ['barname', 'sumweight'],
  188. isShowDialog: false,
  189. isokDisable: false,
  190. rowStyle: { maxHeight: 30 + 'px', height: 30 + 'px' },
  191. cellStyle: { padding: 0 + 'px' },
  192. myHeight: document.documentElement.clientHeight - 85 - 140,
  193. oldRowList:{},
  194. create1: {
  195. dialogFormVisible: false,
  196. dialogStatus: '',
  197. temp: { pastureid: Cookies.get('pastureid'), fname: '', fclassid: '', fclass: '', feedcode: '', source: '用户自定义', printgroupid: '1', printgroup: '无', unitweight: '', uprice: '', allowratio: '', autozone: '', autosecond: '0', autosecondname: '禁用', confirmstart: '0', confirmstartname: '禁用', enable: '1', trgaddress: '', backup1: '', backup2: '', backup3: '', sort: '' },
  198. rules: {
  199. // fname: [{ type: 'string', required: true, message: '必填', trigger: 'blur' }],
  200. // fclassid: [{ type: 'string', required: true, message: '必填', trigger: 'blur' }],
  201. // feedcode: [{ type: 'string', required: true, message: '必填', trigger: 'blur' }]
  202. }
  203. },
  204. }
  205. },
  206. computed: {
  207. },
  208. created() {
  209. this.getButtons()
  210. this.getList()
  211. },
  212. methods: {
  213. getButtons() {
  214. const Edit = 'DhedFormula'
  215. const isRoleEdit = checkButtons(JSON.parse(sessionStorage.getItem('buttons')), Edit)
  216. this.isRoleEdit = isRoleEdit
  217. },
  218. getTimeList() {
  219. GetDataByName(this.getTimeListParm).then(response => {
  220. if (response.data.list !== null) {
  221. this.timeList = response.data.list
  222. } else {
  223. this.tnameList = []
  224. }
  225. })
  226. },
  227. // 新增
  228. handleCreate1() {
  229. console.log('点击了新增')
  230. this.resetTemp1()
  231. this.dialogFull = false
  232. this.create1.dialogStatus = 'create'
  233. this.create1.dialogFormVisible = true
  234. },
  235. resetTemp1() {
  236. this.create1.temp = { pastureid: Cookies.get('pastureid'), 'myId': (new Date()).valueOf(), 'Edit': true, 'NoEdit': false, 'isCreate': true, 'isUpdate': false, 'isUpdateSave': false, 'enable': 1, 'sort': "", 'ftid': '', 'ftname': '', 'tmrcode': '', 'tmrid': '', 'times': '', 'lppcode': '', 'lppid': '', 'rtime': '', barid: '', 'treatmethod': '', 'useinbar': '', 'useinbarid': '' }
  237. },
  238. getList() {
  239. this.table.listLoading = true
  240. GetDataByName(this.table.getdataListParm).then(response => {
  241. console.log('table数据', response.data.list)
  242. if (response.data.list !== null) {
  243. for (let i = 0; i < response.data.list.length; i++) {
  244. this.$set(response.data.list[i], 'Edit', false) // 编辑
  245. this.$set(response.data.list[i], 'NoEdit', true) // 不可编辑/输入
  246. this.$set(response.data.list[i], 'isUpdate', true) // 编辑操作
  247. this.$set(response.data.list[i], 'isUpdateSave', false) // 编辑保存
  248. }
  249. // console.log(response.data.list, sumr)
  250. this.table.list = response.data.list
  251. console.log(this.table.list, 'this.table.list')
  252. this.table.pageNum = response.data.pageNum
  253. this.table.pageSize = response.data.pageSize
  254. this.table.total = response.data.total
  255. } else {
  256. this.table.list = []
  257. }
  258. setTimeout(() => {
  259. this.table.listLoading = false
  260. }, 100)
  261. })
  262. },
  263. handleSearch() {
  264. this.getList()
  265. },
  266. change_time1(e){
  267. console.log(e)
  268. },
  269. tag_close1(e){
  270. console.log(e)
  271. },
  272. renderHeader(h, { column, $index }) { // h即为cerateElement的简写,具体可看vue官方文档
  273. return h(
  274. 'div',
  275. [
  276. h('span', column.label),
  277. h('i', {
  278. class: 'el-icon-unlock',
  279. ref: 'el-icon-unlock',
  280. style: 'margin-left:5px;'
  281. })
  282. ]
  283. )
  284. },
  285. headerClick(column, event) {
  286. console.log(column, event)
  287. this.headerList.push(event)
  288. for (let i = 0; i < this.table.list.length; i++) {
  289. if (this.table.list[i].Edit == true) {
  290. if (event.target.outerHTML == '<i class="el-icon-unlock" style="margin-left: 5px;"></i>') {
  291. event.target.className = 'el-icon-lock'
  292. this.$set(this.table.list[i], 'isTwoWeight', true) // 锁住不可编辑
  293. } else if (event.target.outerHTML == '<i class="el-icon-lock" style="margin-left: 5px;"></i>') {
  294. event.target.className = 'el-icon-unlock'
  295. this.$set(this.table.list[i], 'isTwoWeight', false) // 解锁可编辑
  296. }
  297. }
  298. }
  299. },
  300. celldblclick(row, column, cell, event) {
  301. console.log(row, '=====')
  302. this.handleUpdate(row)
  303. },
  304. // 编辑
  305. handleUpdate(row) {
  306. console.log(row)
  307. this.oldRowList = {...row}
  308. for (let i = 0; i < this.table.list.length; i++) {
  309. if (this.table.list[i].Edit == true) {
  310. this.$message({ type: 'error', message: '当前内容未保存,请点击取消或保存继续进行操作', duration: 2000 })
  311. return false
  312. }
  313. }
  314. // 编辑true,不可编辑false
  315. row.Edit = true
  316. row.NoEdit = false
  317. // 编辑false,编辑保存true
  318. row.isUpdate = false
  319. row.isUpdateSave = true
  320. row.ftid = String(row.ftid)
  321. if (row.ptsfid == '-1') {
  322. row.ptsfid = ''
  323. }
  324. row.ptsfid = String(row.ptsfid)
  325. // dryweight
  326. this.table.temp.ftid = row.ftid
  327. this.table.temp.ftname = row.ftname
  328. this.table.temp.ptsfid = row.ptsfid
  329. this.table.temp.ptsfname = row.ptsfname
  330. },
  331. updateData(row) {
  332. var arr = []
  333. for (let i = 1; i <= this.table.RWLength; i++) {
  334. var obj = {}
  335. obj['times'] = i
  336. obj['pastureid'] = row.pastureid
  337. obj['barid'] = row.barid
  338. obj['cowcount'] = row.ccount
  339. obj['ccountradio'] = row.ccountradio
  340. obj['ptid'] = row.ftid
  341. if (row.ptsfid !== '') {
  342. obj['ptsid'] = row.ptsfid
  343. } else {
  344. obj['ptsid'] = '-1'
  345. }
  346. obj['weight'] = row['w' + i]
  347. if(row['bw' + i] == ""){
  348. obj['supplement'] = 0
  349. }else{
  350. obj['supplement'] = row['bw' + i]
  351. }
  352. obj['tratio'] = Math.round(row['r' + i])
  353. obj['todaysupplement'] = row.todaysupplement
  354. obj['todayweight'] = row.todayweight
  355. arr.push(obj)
  356. }
  357. if (this.table.isPtsfname == 0) {
  358. row.ptsfid = '-1'
  359. row.ptsfname = ''
  360. } else {
  361. if (row.ptsfid == '') {
  362. row.ptsfid = '-1'
  363. row.ptsfname = ''
  364. }
  365. }
  366. if (row.supplyweight == '') {
  367. row.supplyweight = '0'
  368. }
  369. if (this.table.isPtsfname == false) {
  370. row.supplyweight = '0'
  371. }
  372. console.log(row, '============')
  373. this.$set(row, 'ratio', Math.floor(parseFloat(row.ratio) * 100) / 100)
  374. this.$set(row, 'ccountratio', Math.floor(parseFloat(row.ccountratio) * 100) / 100)
  375. row.ccountratio = String(row.ccountratio)
  376. row.sumr = Math.round(row.sumr)
  377. // for(let i=0;i<arr.length;i++){
  378. // if(arr[i].tratio == undefined ||arr[i].tratio =='' || arr[i].tratio == null){
  379. // arr[i].tratio = 0
  380. // }
  381. // }
  382. this.table.rwList = arr
  383. console.log('点击了编辑保存', row)
  384. this.table.temp.pastureid = row.pastureid
  385. this.table.temp.id = row.id
  386. this.table.temp.barname = row.barname
  387. this.table.temp.barid = row.barid
  388. this.table.temp.ccount = row.ccount
  389. this.table.temp.ratio = row.ratio
  390. this.table.temp.ccountratio = row.ccountratio
  391. this.table.temp.ftid = row.ftid
  392. this.table.temp.ftname = row.ftname
  393. this.table.temp.ptsfid = row.ptsfid
  394. this.table.temp.ptsfname = row.ptsfname
  395. this.table.temp.ftweight = row.ftweight
  396. this.table.temp.supplyweight = row.supplyweight
  397. this.table.temp.feedweight = row.feedweight
  398. this.table.temp.owner = row.owner
  399. this.table.temp.sumr = row.sumr
  400. console.log(row, '===========')
  401. this.table.temp.softccount = row.softccount
  402. var obj = {}
  403. obj.pastureid = row.pastureid
  404. obj.id = row.id
  405. obj.data = []
  406. if (this.table.temp.ccount === '') {
  407. this.$message({ type: 'error', message: '实际牛头数不能为空', duration: 2000 })
  408. return false
  409. }
  410. const positiveInteger = /^[0-9]\d*$/
  411. if (!positiveInteger.test(parseFloat(this.table.temp.ccount))) {
  412. this.$message({
  413. type: 'error',
  414. message: '实际牛头数请输入正整数',
  415. duration: 2000
  416. })
  417. return false
  418. }
  419. this.isokDisable = true
  420. setTimeout(() => {
  421. this.isokDisable = false
  422. }, 1000)
  423. // this.requestParam.parammaps = this.table.temp
  424. this.requestParam.common = {
  425. 'returnmap': '0'
  426. }
  427. this.requestParam.data = []
  428. this.requestParam.data[0] = { 'name': 'updateBigFP', 'type': 'e', 'parammaps': {
  429. pastureid: row.pastureid,
  430. id: row.id,
  431. barname: row.barname,
  432. barid: row.barid,
  433. softccount: row.softccount,
  434. ccount: row.ccount,
  435. ratio: row.ratio,
  436. ccountratio: row.ccountratio,
  437. ftid: row.ftid,
  438. ftname: row.ftname,
  439. ptsfid: row.ptsfid,
  440. ptsfname: row.ptsfname,
  441. ftweight: row.ftweight,
  442. supplyweight: row.supplyweight,
  443. feedweight: row.feedweight,
  444. owner: row.owner,
  445. sumr: row.sumr
  446. }}
  447. this.requestParam.data[1] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.table.rwList }}
  448. this.requestParam.data[1].children = []
  449. this.requestParam.data[1].children[0] = { 'name': 'updateBigFPDetail', 'type': 'e', 'parammaps': {
  450. pastureid: '@insertSpotList.pastureid',
  451. barname: row.barname,
  452. barid: '@insertSpotList.barid',
  453. times: '@insertSpotList.times',
  454. tratio: '@insertSpotList.tratio',
  455. weight: '@insertSpotList.weight',
  456. cowcount: '@insertSpotList.cowcount',
  457. ccountradio: row.ccountratio,
  458. ptid: '@insertSpotList.ptid',
  459. ptsid: '@insertSpotList.ptsid',
  460. supplement: '@insertSpotList.supplement',
  461. feedweight: row.feedweight,
  462. supplyweight: row.supplyweight,
  463. ratio: row.ratio
  464. }}
  465. this.requestParam.data[2] = { 'name': 'updateLPPbyFPChange', 'type': 'e', 'parammaps': {
  466. pastureid: row.pastureid,
  467. fpid: row.id
  468. }}
  469. ExecDataByConfig(this.requestParam).then(response => {
  470. console.log('编辑保存发送参数', this.requestParam)
  471. if (response.msg === 'fail') {
  472. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  473. } else {
  474. if(obj.data.length>0){
  475. const url = 'authdata/fpdetail/edit'
  476. const data = obj
  477. postJson(url, data).then(response => {
  478. if(response.msg !== 'fail'){
  479. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  480. }
  481. })
  482. }else{
  483. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  484. }
  485. this.getList()
  486. for (let i = 0; i < this.headerList.length; i++) {
  487. if (this.headerList[i].target.className == 'el-icon-lock') {
  488. this.headerList[i].target.className = 'el-icon-unlock'
  489. this.$set(this.headerList[i].target, 'className', 'el-icon-unlock')
  490. }
  491. }
  492. }
  493. })
  494. },
  495. updateCancel(row) {
  496. console.log('点击了编辑取消')
  497. // 编辑false,不可编辑true
  498. row.Edit = false
  499. row.NoEdit = true
  500. // 编辑true,编辑保存false
  501. row.isUpdate = true
  502. row.isUpdateSave = false
  503. // this.reload()
  504. for (let i = 0; i < this.headerList.length; i++) {
  505. if (this.headerList[i].target.className == 'el-icon-lock') {
  506. this.headerList[i].target.className = 'el-icon-unlock'
  507. this.$set(this.headerList[i].target, 'className', 'el-icon-unlock')
  508. }
  509. }
  510. console.log(this.table.getdataListParm.offset)
  511. this.table.getdataListParm.offset = this.table.getdataListParm.offset
  512. this.getList()
  513. // this.$router.push('/formulationPlan/dhedFormula')
  514. },
  515. cellClick(row, column, event) {
  516. console.log(column)
  517. },
  518. handleSelect(val) {
  519. console.log('勾选数据', val)
  520. this.selectList = val
  521. },
  522. tableRowClassName({ row }) {
  523. // console.log(row)
  524. if (row.isColor == '0') {
  525. return 'red-row'
  526. } else {
  527. return ''
  528. }
  529. },
  530. // 应用
  531. handleApplication() {
  532. console.log('点击了应用')
  533. MessageBox.confirm('是否确认将' + this.history.getdataListParm.parammaps.date + '的数据应用到当前?', {
  534. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  535. }).then(() => {
  536. this.requestParam.name = 'applyFPdate'
  537. this.requestParam.parammaps = {}
  538. this.requestParam.parammaps.pastureid = Cookies.get('pastureid')
  539. this.requestParam.parammaps.date = this.history.getdataListParm.parammaps.date
  540. PostDataByName(this.requestParam).then(response => {
  541. if (response.msg === 'fail') {
  542. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  543. } else {
  544. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  545. this.getList()
  546. }
  547. })
  548. }).catch(() => {
  549. this.$message({ type: 'info', message: '已取消应用' })
  550. })
  551. },
  552. formatJson(filterVal, jsonData) {
  553. return jsonData.map(v =>
  554. filterVal.map(j => {
  555. if (j === 'timestamp') {
  556. return parseTime(v[j])
  557. } else {
  558. return v[j]
  559. }
  560. })
  561. )
  562. },
  563. blurBw(row) {
  564. console.log(row)
  565. },
  566. focusBw(row) {
  567. console.log(row)
  568. }
  569. }
  570. }
  571. </script>
  572. <style lang="scss" scoped>
  573. .search {
  574. clear: both;
  575. }
  576. .table {
  577. margin-top: 10px;
  578. }
  579. </style>
  580. <style lang="scss">
  581. .red-row{
  582. background: #fde2e2 !important;
  583. }
  584. </style>