2d276c67127c05a5538e788e353aa76409d2440b.svn-base 25 KB

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