3b168e135cd6d6a8341602d44e3ee5e1e2af508a.svn-base 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571
  1. <template>
  2. <div class="app-container">
  3. <div class="operation">
  4. <el-button v-if="isRoleEdit" class="success" style="float: left;margin-right:10px;" @click="handleCreate">新增</el-button>
  5. <el-button v-if="isRoleEdit" class="danger" style="float: left;margin-right:10px;" @click="handleDelete">删除</el-button>
  6. <el-button v-if="isRoleEdit" class="warning" style="float: left;margin-right:10px;" @click="handleCopy">复制</el-button>
  7. <el-button v-if="isRoleEdit" class="import" style="float: right;" @click="handleImport">导入</el-button>
  8. <el-dropdown style="float: right;margin-right: 10px;">
  9. <el-button class="export">导出</el-button>
  10. <el-dropdown-menu slot="dropdown">
  11. <el-dropdown-item @click.native="handleExport(1)">导出模板</el-dropdown-item>
  12. <el-dropdown-item @click.native="handleExport(2)">导出数据</el-dropdown-item>
  13. </el-dropdown-menu>
  14. </el-dropdown>
  15. </div>
  16. <div class="search">
  17. <el-date-picker v-model="table.getdataListParm.parammaps.inputDatetime" class="inputDatetime filter-item" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" style="width: 250px;" />
  18. <el-button class="el-icon-arrow-left elIconArrowLeft" @click="handleBefore" />
  19. <el-button class="el-icon-arrow-right elIconArrowRight" @click="handleNext" />
  20. <el-select v-model="table.getdataListParm.parammaps.barid" placeholder="栏舍名称" class="filter-item" style="width: 120px;" clearable>
  21. <el-option v-for="item in houseNameList" :key="item.id" :label="item.bname" :value="item.id" />
  22. </el-select>
  23. <el-button class="successBorder" @click="handleSearch">查询</el-button>
  24. <el-button class="successBorder" @click="handleRefresh">重置</el-button>
  25. </div>
  26. <div class="table">
  27. <el-table
  28. :key="table.tableKey"
  29. v-loading="table.listLoading"
  30. element-loading-text="给我一点时间"
  31. :data="table.list"
  32. border
  33. fit
  34. highlight-current-row
  35. style="width: 100%;"
  36. :row-style="rowStyle"
  37. :cell-style="cellStyle"
  38. class="elTable table-fixed"
  39. @selection-change="handleSelectionChange"
  40. >
  41. <el-table-column type="selection" align="center" width="50" />
  42. <el-table-column label="序号" align="center" type="index" width="50px">
  43. <template slot-scope="scope">
  44. <span>{{ scope.$index + (table.pageNum-1) * table.pageSize + 1 }}</span>
  45. </template>
  46. </el-table-column>
  47. <el-table-column label="栏舍名称" min-width="150px" align="center">
  48. <template slot-scope="scope">
  49. <span>{{ scope.row.barname }}</span>
  50. </template>
  51. </el-table-column>
  52. <el-table-column label="剩料量(kg)" min-width="150px" align="center">
  53. <template slot-scope="scope">
  54. <span>{{ scope.row.remain }}</span>
  55. </template>
  56. </el-table-column>
  57. <el-table-column label="应用班次" min-width="90px" align="center">
  58. <template slot-scope="scope">
  59. <span>{{ scope.row.timesstr }}</span>
  60. </template>
  61. </el-table-column>
  62. <el-table-column label="处理时间" min-width="100px" align="center">
  63. <template slot-scope="scope">
  64. <span>{{ scope.row.operatetime }}</span>
  65. </template>
  66. </el-table-column>
  67. <el-table-column label="操作人" min-width="90px" align="center">
  68. <template slot-scope="scope">
  69. <span>{{ scope.row.emp }}</span>
  70. </template>
  71. </el-table-column>
  72. <el-table-column label="操作" align="center" width="250" class-name="small-padding fixed-width" fixed="right">
  73. <template slot-scope="{row}">
  74. <el-button v-if="isRoleEdit" class="miniSuccess" @click="handleUpdate(row)">编辑</el-button>
  75. <el-button v-if="isRoleEdit" class="miniDanger" @click="handleRowDelete(row)">删除</el-button>
  76. </template>
  77. </el-table-column>
  78. </el-table>
  79. <pagination v-show="table.total>=0" :total="table.total" :page.sync="table.getdataListParm.offset" :limit.sync="table.getdataListParm.pagecount" @pagination="getList" />
  80. </div>
  81. <!-- 新增/编辑 -->
  82. <el-dialog :title="textMap[create.dialogStatus]" :visible.sync="create.dialogFormVisible" :close-on-click-modal="false" width="40%">
  83. <div class="app-add">
  84. <el-form ref="temp" :rules="create.rules" :model="create.temp" label-position="right" label-width="135px" style="width: 90%;margin:0 auto 50px">
  85. <el-row>
  86. <el-col :span="20">
  87. <el-form-item label="栏舍名称:" prop="barid">
  88. <el-select ref="barid" v-model="create.temp.barid" :disabled="create.dialogStatus=='update'" filterable placeholder="栏舍名称" class="filter-item" style="width: 100%;" @change="changeBar">
  89. <el-option v-for="item in houseNameList" :key="item.id" :label="item.bname" :value="item.id" />
  90. </el-select>
  91. </el-form-item>
  92. </el-col>
  93. </el-row>
  94. <el-row>
  95. <el-col :span="20">
  96. <el-form-item label="剩料量:" prop="remain">
  97. <el-input ref="remain" v-model="create.temp.remain" class="filter-item" placeholder="剩料量" type="number" />
  98. </el-form-item>
  99. </el-col>
  100. </el-row>
  101. <el-row>
  102. <el-col :span="20">
  103. <el-form-item label="班次:" prop="times">
  104. <el-select ref="times" v-model="create.temp.times" filterable placeholder="班次" class="filter-item" style="width: 100%;">
  105. <el-option v-for="item in frequencyList" :key="item.id" :label="item.name" :value="item.id" />
  106. </el-select>
  107. </el-form-item>
  108. </el-col>
  109. </el-row>
  110. <el-row>
  111. <el-col :span="20">
  112. <el-form-item label="处理时间:" prop="operatetime">
  113. <el-date-picker v-model="create.temp.operatetime" :disabled="create.dialogStatus=='update'" type="datetime" placeholder="选择处理时间" format="yyyy-MM-dd HH:mm" value-format="yyyy-MM-dd HH:mm" style="width: 100%;" :clearable="false" />
  114. </el-form-item>
  115. </el-col>
  116. </el-row>
  117. <el-row>
  118. <el-col :span="20">
  119. <el-form-item label="操作人:" prop="emp">
  120. <el-select ref="emp" v-model="create.temp.emp" filterable placeholder="操作人" class="filter-item" style="width: 100%;" @blur="blurEmp">
  121. <el-option v-for="item in create.noteTakerList" :key="item.myId" :label="item.emp" :value="item.emp" />
  122. </el-select>
  123. </el-form-item>
  124. </el-col>
  125. </el-row>
  126. </el-form>
  127. <div slot="footer" class="dialog-footer">
  128. <el-button class="cancel" @click="create.dialogFormVisible = false;getList()">关闭</el-button>
  129. <el-button v-if="create.dialogStatus==='create'" class="success" :disabled="isokDisable" @click="createDataAgain()">确认新增</el-button>
  130. <el-button v-if="create.dialogStatus==='create' || create.dialogStatus==='update'" class="success" :disabled="isokDisable" @click="create.dialogStatus==='create'?createData():updateData()">确认</el-button>
  131. </div>
  132. </div>
  133. </el-dialog>
  134. </div>
  135. </template>
  136. <script>
  137. import { GetDataByName, PostDataByName, failproccess, ExecDataByConfig, GetDataByNames, checkButtons } from '@/api/common'
  138. import Cookies from 'js-cookie'
  139. import { parseTime } from '@/utils/index.js'
  140. import Pagination from '@/components/Pagination'
  141. import { MessageBox } from 'element-ui'
  142. export default {
  143. name: 'MaterialRemainingRecord',
  144. components: { Pagination },
  145. data() {
  146. return {
  147. isRoleEdit: [],
  148. requestParams: [
  149. { name: 'getBarListEnable', offset: 0, pagecount: 0, parammaps: { 'pastureid': Cookies.get('pastureid') }},
  150. { name: 'getSysoptEnable', offset: 0, pagecount: 0, parammaps: { 'pastureid': Cookies.get('pastureid'), 'inforname': 'times' }}
  151. ],
  152. houseNameList: [], // 栏舍名称
  153. frequencyList: [], // 班次
  154. table: {
  155. getdataListParm: {
  156. name: 'getBarfeedremainList',
  157. page: 1,
  158. offset: 1,
  159. pagecount: 10,
  160. returntype: 'Map',
  161. parammaps: {
  162. pastureid: Cookies.get('pastureid'),
  163. barid: '',
  164. startTime: '',
  165. stopTime: '',
  166. inputDatetime: ''
  167. }
  168. },
  169. tableKey: 0,
  170. list: [],
  171. total: 0,
  172. listLoading: true,
  173. temp: {}
  174. },
  175. // 新增/编辑
  176. create: {
  177. dialogFormVisible: false,
  178. dialogStatus: '',
  179. temp: { pastureid: Cookies.get('pastureid'), operatetime: parseTime(new Date(), '{y}-{m}-{d} {h}:{i}'), emp: Cookies.get('employename'), barid: '', barname: '', remain: '', times: '' },
  180. rules: {
  181. barid: [{ type: 'string', required: true, message: '必填', trigger: 'blur' }],
  182. remain: [{ type: 'string', required: true, message: '必填', trigger: 'blur' }],
  183. times: [{ type: 'string', required: true, message: '必填', trigger: 'blur' }]
  184. },
  185. getdataListParm: {
  186. name: 'getBarfeedremainEmpHis',
  187. page: 1,
  188. offset: 1,
  189. pagecount: 10,
  190. returntype: 'Map',
  191. parammaps: {
  192. pastureid: Cookies.get('pastureid')
  193. }
  194. },
  195. noteTakerList: [] // 记录人
  196. },
  197. textMap: {
  198. create: '新增',
  199. update: '编辑'
  200. },
  201. requestParam: {},
  202. isokDisable: false,
  203. selectList: [],
  204. rowStyle: { maxHeight: 50 + 'px', height: 45 + 'px' },
  205. cellStyle: { padding: 0 + 'px' }
  206. }
  207. },
  208. created() {
  209. this.getList()
  210. this.getDownList()
  211. this.getButtons()
  212. },
  213. methods: {
  214. getButtons() {
  215. const Edit = 'MaterialRemainingRecord'
  216. const isRoleEdit = checkButtons(JSON.parse(sessionStorage.getItem('buttons')), Edit)
  217. this.isRoleEdit = isRoleEdit
  218. },
  219. getDownList() {
  220. GetDataByNames(this.requestParams).then(response => {
  221. this.houseNameList = response.data.getBarListEnable.list
  222. if (response.data.getSysoptEnable.list !== null) {
  223. for (let i = 1; i <= response.data.getSysoptEnable.list[0].inforvalue; i++) {
  224. const obj = {}
  225. obj.id = String(i)
  226. if (i == 1) { obj.name = '第一班' } else if (i == 2) { obj.name = '第二班' } else if (i == 3) { obj.name = '第三班' } else if (i == 4) { obj.name = '第四班' }
  227. this.frequencyList.push(obj)
  228. }
  229. } else {
  230. this.frequencyList = []
  231. }
  232. })
  233. },
  234. handleBefore() {
  235. if (this.table.getdataListParm.parammaps.inputDatetime !== '' && this.table.getdataListParm.parammaps.inputDatetime !== null) {
  236. var start = new Date(this.table.getdataListParm.parammaps.inputDatetime[0].setDate(this.table.getdataListParm.parammaps.inputDatetime[0].getDate() - 1))
  237. var stop = new Date(this.table.getdataListParm.parammaps.inputDatetime[1].setDate(this.table.getdataListParm.parammaps.inputDatetime[1].getDate() - 1))
  238. this.table.getdataListParm.parammaps.inputDatetime.length = 0
  239. this.table.getdataListParm.parammaps.inputDatetime.push(start, stop)
  240. this.$forceUpdate()
  241. }
  242. },
  243. handleNext() {
  244. if (this.table.getdataListParm.parammaps.inputDatetime !== '' && this.table.getdataListParm.parammaps.inputDatetime !== null) {
  245. var start = new Date(this.table.getdataListParm.parammaps.inputDatetime[0].setDate(this.table.getdataListParm.parammaps.inputDatetime[0].getDate() + 1))
  246. var stop = new Date(this.table.getdataListParm.parammaps.inputDatetime[1].setDate(this.table.getdataListParm.parammaps.inputDatetime[1].getDate() + 1))
  247. this.table.getdataListParm.parammaps.inputDatetime.length = 0
  248. this.table.getdataListParm.parammaps.inputDatetime.push(start, stop)
  249. this.$forceUpdate()
  250. }
  251. },
  252. getList() {
  253. this.table.listLoading = true
  254. GetDataByName(this.table.getdataListParm).then(response => {
  255. console.log('table数据', response.data.list)
  256. if (response.data.list !== null) {
  257. this.table.list = response.data.list
  258. this.table.pageNum = response.data.pageNum
  259. this.table.pageSize = response.data.pageSize
  260. this.table.total = response.data.total
  261. } else {
  262. this.table.list = []
  263. }
  264. setTimeout(() => {
  265. this.table.listLoading = false
  266. }, 100)
  267. })
  268. },
  269. handleSearch() {
  270. console.log('点击了查询')
  271. if (this.table.getdataListParm.parammaps.inputDatetime !== '' && this.table.getdataListParm.parammaps.inputDatetime !== null) {
  272. this.table.getdataListParm.parammaps.startTime = parseTime(this.table.getdataListParm.parammaps.inputDatetime[0], '{y}-{m}-{d}')
  273. this.table.getdataListParm.parammaps.stopTime = parseTime(this.table.getdataListParm.parammaps.inputDatetime[1], '{y}-{m}-{d}')
  274. } else {
  275. this.table.getdataListParm.parammaps.inputDatetime = ''
  276. this.table.getdataListParm.parammaps.startTime = ''
  277. this.table.getdataListParm.parammaps.stopTime = ''
  278. }
  279. this.table.getdataListParm.offset = 1
  280. this.getList()
  281. },
  282. handleRefresh() {
  283. console.log('点击了重置')
  284. this.table.getdataListParm.parammaps.barid = ''
  285. this.table.getdataListParm.parammaps.startTime = ''
  286. this.table.getdataListParm.parammaps.stopTime = ''
  287. this.table.getdataListParm.parammaps.inputDatetime = ''
  288. this.table.getdataListParm.offset = 1
  289. this.getList()
  290. },
  291. // 新增
  292. resetTemp() {
  293. this.create.temp = { pastureid: Cookies.get('pastureid'), operatetime: parseTime(new Date(), '{y}-{m}-{d} {h}:{i}'), emp: Cookies.get('employename'), barid: '', barname: '', remain: '', times: '' }
  294. },
  295. blurEmp(item) {
  296. this.create.temp.emp = item.target.value
  297. },
  298. // 栏舍名称
  299. changeBar(item) {
  300. this.create.temp.barname = this.houseNameList.find(obj => obj.id === item).bname
  301. },
  302. getNoteTakerList() {
  303. GetDataByName(this.create.getdataListParm).then(response => {
  304. if (response.data.list !== null) {
  305. for (let i = 0; i < response.data.list.length; i++) {
  306. response.data.list[i].myId = i
  307. }
  308. this.create.noteTakerList = response.data.list
  309. console.log('记录人数据', response.data.list)
  310. console.log(this.create.noteTakerList)
  311. } else {
  312. this.create.noteTakerList = []
  313. }
  314. })
  315. },
  316. handleCreate() {
  317. console.log('点击了新增')
  318. this.resetTemp()
  319. this.getNoteTakerList()
  320. this.create.dialogStatus = 'create'
  321. this.create.dialogFormVisible = true
  322. },
  323. createData() {
  324. console.log('点击了新增保存')
  325. this.isokDisable = true
  326. setTimeout(() => {
  327. this.isokDisable = false
  328. }, 1000)
  329. this.$refs['temp'].validate(valid => {
  330. if (valid) {
  331. this.isokDisable = true
  332. setTimeout(() => {
  333. this.isokDisable = false
  334. }, 1000)
  335. const remain = /^\d+(\.\d{1,2})?$/
  336. // 剩料量
  337. if (!remain.test(parseFloat(this.create.temp.remain))) {
  338. this.$message({ type: 'error', message: '剩料量请输入自然数并保留两位小数', duration: 2000 })
  339. return false
  340. }
  341. this.requestParam.name = 'insertBarfeedremain'
  342. this.requestParam.parammaps = this.create.temp
  343. if (this.create.temp.emp == '') { this.create.temp.emp = Cookies.get('employename') }
  344. PostDataByName(this.requestParam).then(response => {
  345. console.log('新增保存发送参数', this.requestParam)
  346. if (response.msg !== 'fail') {
  347. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  348. this.create.dialogFormVisible = false
  349. this.getList()
  350. } else {
  351. const barid = new RegExp("key 'barid'")
  352. if (barid.test(response.data)) {
  353. this.$message({ type: 'error', message: '该栏舍该班次今日剩料量已存在,不可重复生成', duration: 2000 })
  354. } else {
  355. failproccess(response, this.$notify)
  356. }
  357. }
  358. })
  359. }
  360. })
  361. },
  362. createDataAgain() {
  363. console.log('点击了新增保存')
  364. this.isokDisable = true
  365. setTimeout(() => {
  366. this.isokDisable = false
  367. }, 1000)
  368. this.$refs['temp'].validate(valid => {
  369. if (valid) {
  370. this.isokDisable = true
  371. setTimeout(() => {
  372. this.isokDisable = false
  373. }, 1000)
  374. const remain = /^\d+(\.\d{1,2})?$/
  375. // 剩料量
  376. if (!remain.test(parseFloat(this.create.temp.remain))) {
  377. this.$message({ type: 'error', message: '剩料量请输入自然数并保留两位小数', duration: 2000 })
  378. return false
  379. }
  380. this.requestParam.name = 'insertBarfeedremain'
  381. this.requestParam.parammaps = this.create.temp
  382. if (this.create.temp.emp == '') { this.create.temp.emp = Cookies.get('employename') }
  383. PostDataByName(this.requestParam).then(response => {
  384. console.log('新增保存发送参数', this.requestParam)
  385. if (response.msg !== 'fail') {
  386. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  387. this.resetTemp()
  388. this.getList()
  389. this.getNoteTakerList()
  390. } else {
  391. const barid = new RegExp("key 'barid'")
  392. if (barid.test(response.data)) {
  393. this.$message({ type: 'error', message: '该栏舍该班次今日剩料量已存在,不可重复生成', duration: 2000 })
  394. } else {
  395. failproccess(response, this.$notify)
  396. }
  397. }
  398. })
  399. }
  400. })
  401. },
  402. // 编辑
  403. handleUpdate(row) {
  404. console.log('点击了编辑', row)
  405. row.barid = String(row.barid)
  406. this.create.temp = Object.assign({}, row)
  407. this.create.temp.id = row.id
  408. this.getNoteTakerList()
  409. this.create.dialogStatus = 'update'
  410. this.create.dialogFormVisible = true
  411. },
  412. updateData() {
  413. this.isokDisable = true
  414. setTimeout(() => {
  415. this.isokDisable = false
  416. }, 1000)
  417. this.$refs['temp'].validate(valid => {
  418. if (valid) {
  419. this.isokDisable = true
  420. setTimeout(() => {
  421. this.isokDisable = false
  422. }, 1000)
  423. const remain = /^\d+(\.\d{1,2})?$/
  424. // 剩料量
  425. if (!remain.test(parseFloat(this.create.temp.remain))) {
  426. this.$message({ type: 'error', message: '剩料量请输入自然数并保留两位小数', duration: 2000 })
  427. return false
  428. }
  429. this.requestParam.name = 'updateBarfeedremain'
  430. this.requestParam.parammaps = this.create.temp
  431. if (this.create.temp.emp == '') { this.create.temp.emp = Cookies.get('employename') }
  432. PostDataByName(this.requestParam).then(response => {
  433. console.log('新增保存发送参数', this.requestParam)
  434. if (response.msg !== 'fail') {
  435. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  436. this.create.dialogFormVisible = false
  437. this.getList()
  438. } else {
  439. failproccess(response, this.$notify)
  440. }
  441. })
  442. }
  443. })
  444. },
  445. // 删除
  446. handleRowDelete(row) {
  447. console.log('点击了行内删除')
  448. MessageBox.confirm('是否确认删除此信息?', {
  449. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  450. }).then(() => {
  451. this.selectList = []
  452. this.requestParam.name = 'deleteBarfeedremain'
  453. this.requestParam.parammaps = {}
  454. this.requestParam.parammaps.pastureid = row.pastureid
  455. this.requestParam.parammaps.id = row.id
  456. PostDataByName(this.requestParam).then(response => {
  457. if (response.msg === 'fail') {
  458. this.$notify({ title: '删除失败', message: response.data, type: 'warning', duration: 2000 })
  459. } else {
  460. this.$notify({ title: '成功', message: '删除成功', type: 'success', duration: 2000 })
  461. this.getList()
  462. }
  463. })
  464. }).catch(() => {
  465. this.$message({ type: 'info', message: '已取消删除' })
  466. })
  467. },
  468. handleSelectionChange(val) {
  469. console.log('勾选数据', val)
  470. this.selectList = val
  471. },
  472. handleDelete() {
  473. console.log('点击了删除')
  474. if (this.selectList.length == 0) {
  475. this.$message({ type: 'error', message: '请选择栏舍剩料记录', duration: 2000 })
  476. } else {
  477. MessageBox.confirm('当前选中' + this.selectList.length + '条信息,是否删除?', {
  478. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  479. }).then(() => {
  480. console.log(this.selectList)
  481. this.requestParam.common = { 'returnmap': '0' }
  482. this.requestParam.data = []
  483. this.requestParam.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.selectList }}
  484. this.requestParam.data[0].children = []
  485. this.requestParam.data[0].children[0] = { 'name': 'deleteBarfeedremain', 'type': 'e', 'parammaps': {
  486. id: '@insertSpotList.id',
  487. pastureid: '@insertSpotList.pastureid'
  488. }}
  489. ExecDataByConfig(this.requestParam).then(response => {
  490. console.log('删除保存发送参数', this.requestParam)
  491. if (response.msg === 'fail') {
  492. this.$notify({ title: '删除失败', message: response.data, type: 'warning', duration: 2000 })
  493. } else {
  494. this.$notify({ title: '', message: '删除成功', type: 'success', duration: 2000 })
  495. this.getList()
  496. }
  497. })
  498. })
  499. }
  500. },
  501. // 复制
  502. handleCopy() {
  503. console.log('点击了复制')
  504. if (this.selectList.length == 0) {
  505. this.$message({ type: 'error', message: '请选择栏舍剩料记录', duration: 2000 })
  506. } else if (this.selectList.length == 1) {
  507. MessageBox.confirm('是否确认复制此信息?', {
  508. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  509. }).then(() => {
  510. this.requestParam.name = 'copybarfeedremain'
  511. this.requestParam.parammaps = {}
  512. this.requestParam.parammaps.pastureid = this.selectList[0].pastureid
  513. this.requestParam.parammaps.id = this.selectList[0].id
  514. PostDataByName(this.requestParam).then(response => {
  515. if (response.msg === 'fail') {
  516. const barid = new RegExp("key 'barid'")
  517. if (barid.test(response.data)) {
  518. this.$message({ type: 'error', message: '该栏舍该班次今日剩料量已存在,不可重复生成', duration: 2000 })
  519. } else {
  520. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  521. }
  522. } else {
  523. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  524. this.getList()
  525. }
  526. })
  527. }).catch(() => {
  528. this.$message({ type: 'info', message: '已取消删除' })
  529. })
  530. } else {
  531. this.$message({ type: 'error', message: '请选择一条栏舍剩料记录', duration: 2000 })
  532. }
  533. },
  534. // 导出
  535. handleExport(item) {
  536. if (item == 1) {
  537. console.log('点击了导出模板')
  538. } else {
  539. console.log('点击了导出数据')
  540. }
  541. },
  542. // 导入
  543. handleImport() {
  544. console.log('点击了导入')
  545. }
  546. }
  547. }
  548. </script>
  549. <style lang="scss" scoped>
  550. .search{padding-top:10px;clear: both;}
  551. .table{margin-top:10px;}
  552. </style>