79d43ce5d587748a0229339094ccc7e0def1b19d.svn-base 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615
  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. times: [{ type: 'string', required: true, message: '必填', trigger: 'blur' }],
  211. freshweight: [{ type: 'string', required: true, message: '必填', trigger: 'blur' }],
  212. dryweight: [{ type: 'string', required: true, message: '必填', trigger: 'blur' }]
  213. },
  214. // 操作人
  215. getdataListParm: {
  216. name: 'getFtdryEmpHis',
  217. page: 1,
  218. offset: 1,
  219. pagecount: 10,
  220. returntype: 'Map',
  221. parammaps: {
  222. pastureid: Cookies.get('pastureid')
  223. }
  224. },
  225. // 理论干物质
  226. getdataListParm2: {
  227. name: 'getFtdrytweight',
  228. page: 1,
  229. offset: 1,
  230. pagecount: 10,
  231. returntype: 'Map',
  232. parammaps: {
  233. pastureid: Cookies.get('pastureid'),
  234. barid: '',
  235. date: ''
  236. }
  237. },
  238. noteTakerList: [] // 记录人
  239. },
  240. textMap: {
  241. create: '新增',
  242. update: '编辑'
  243. },
  244. requestParam: {},
  245. isokDisable: false,
  246. selectList: [],
  247. rowStyle: { maxHeight: 50 + 'px', height: 45 + 'px' },
  248. cellStyle: { padding: 0 + 'px' }
  249. }
  250. },
  251. created() {
  252. this.getList()
  253. this.getDownList()
  254. },
  255. methods: {
  256. getDownList() {
  257. GetDataByNames(this.requestParams).then(response => {
  258. this.houseNameList = response.data.getBarListEnable.list
  259. if (response.data.getSysoptEnable.list !== null) {
  260. for (let i = 1; i <= response.data.getSysoptEnable.list[0].inforvalue; i++) {
  261. const obj = {}
  262. obj.id = String(i)
  263. if (i == 1) { obj.name = '第一班' } else if (i == 2) { obj.name = '第二班' } else if (i == 3) { obj.name = '第三班' } else if (i == 4) { obj.name = '第四班' }
  264. this.frequencyList.push(obj)
  265. }
  266. } else {
  267. this.frequencyList = []
  268. }
  269. })
  270. },
  271. getList() {
  272. this.table.listLoading = true
  273. GetDataByName(this.table.getdataListParm).then(response => {
  274. console.log('table数据', response.data.list)
  275. if (response.data.list !== null) {
  276. this.table.list = response.data.list
  277. this.table.pageNum = response.data.pageNum
  278. this.table.pageSize = response.data.pageSize
  279. this.table.total = response.data.total
  280. } else {
  281. this.table.list = []
  282. }
  283. setTimeout(() => {
  284. this.table.listLoading = false
  285. }, 100)
  286. })
  287. },
  288. handleSearch() {
  289. console.log('点击了查询')
  290. if (this.table.getdataListParm.parammaps.inputDatetime !== '' && this.table.getdataListParm.parammaps.inputDatetime !== null) {
  291. this.table.getdataListParm.parammaps.startTime = parseTime(this.table.getdataListParm.parammaps.inputDatetime[0], '{y}-{m}-{d}')
  292. this.table.getdataListParm.parammaps.stopTime = parseTime(this.table.getdataListParm.parammaps.inputDatetime[1], '{y}-{m}-{d}')
  293. } else {
  294. this.table.getdataListParm.parammaps.inputDatetime = ''
  295. this.table.getdataListParm.parammaps.startTime = ''
  296. this.table.getdataListParm.parammaps.stopTime = ''
  297. }
  298. this.table.getdataListParm.offset = 1
  299. this.getList()
  300. },
  301. handleRefresh() {
  302. console.log('点击了重置')
  303. this.table.getdataListParm.parammaps.barid = ''
  304. this.table.getdataListParm.parammaps.times = ''
  305. this.table.getdataListParm.parammaps.startTime = ''
  306. this.table.getdataListParm.parammaps.stopTime = ''
  307. this.table.getdataListParm.parammaps.inputDatetime = ''
  308. this.table.getdataListParm.offset = 1
  309. this.getList()
  310. },
  311. // 新增
  312. resetTemp() {
  313. 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: '' }
  314. },
  315. blurEmp(item) {
  316. this.create.temp.emp = item.target.value
  317. },
  318. // 栏舍名称
  319. changeBar(item) {
  320. this.create.temp.barname = this.houseNameList.find(obj => obj.id === item).bname
  321. this.getThoweight()
  322. },
  323. changeOperatetime() {
  324. this.getThoweight()
  325. },
  326. // 理论干物质
  327. getThoweight() {
  328. this.create.getdataListParm2.parammaps.date = this.create.temp.operatetime
  329. this.create.getdataListParm2.parammaps.barid = this.create.temp.barid
  330. GetDataByName(this.create.getdataListParm2).then(response => {
  331. if (response.data.list !== null) {
  332. this.create.temp.thoweight = response.data.list[0].thoweight
  333. } else {
  334. this.create.temp.thoweight = 0
  335. }
  336. })
  337. },
  338. // 操作人
  339. getNoteTakerList() {
  340. GetDataByName(this.create.getdataListParm).then(response => {
  341. if (response.data.list !== null) {
  342. for (let i = 0; i < response.data.list.length; i++) {
  343. response.data.list[i].myId = i
  344. }
  345. this.create.noteTakerList = response.data.list
  346. console.log('记录人数据', response.data.list)
  347. console.log(this.create.noteTakerList)
  348. } else {
  349. this.create.noteTakerList = []
  350. }
  351. })
  352. },
  353. blurFreshweight() {
  354. if (this.create.temp.dryweight !== '' && this.create.temp.freshweight !== '') {
  355. this.create.temp.actweight = parseFloat(this.create.temp.dryweight) / parseFloat(this.create.temp.freshweight)
  356. this.create.temp.actweight = this.create.temp.actweight.toFixed(2)
  357. }
  358. },
  359. blurDryweight() {
  360. if (this.create.temp.freshweight !== '' && this.create.temp.dryweight !== '') {
  361. this.create.temp.actweight = parseFloat(this.create.temp.dryweight) / parseFloat(this.create.temp.freshweight)
  362. this.create.temp.actweight = this.create.temp.actweight.toFixed(2)
  363. }
  364. },
  365. handleCreate() {
  366. console.log('点击了新增')
  367. this.resetTemp()
  368. this.getNoteTakerList()
  369. this.create.dialogStatus = 'create'
  370. this.create.dialogFormVisible = true
  371. },
  372. createData() {
  373. console.log('点击了新增保存')
  374. this.isokDisable = true
  375. setTimeout(() => {
  376. this.isokDisable = false
  377. }, 1000)
  378. this.$refs['temp'].validate(valid => {
  379. if (valid) {
  380. this.isokDisable = true
  381. setTimeout(() => {
  382. this.isokDisable = false
  383. }, 1000)
  384. const weight = /^\d+(\.\d{1,2})?$/
  385. // 鲜样重量/烘干重量
  386. if (!weight.test(parseFloat(this.create.temp.freshweight)) || !weight.test(parseFloat(this.create.temp.dryweight))) {
  387. this.$message({ type: 'error', message: '重量不可小于0,最多保留俩位小数', duration: 2000 })
  388. return false
  389. }
  390. this.requestParam.name = 'insertFtdry'
  391. this.requestParam.parammaps = this.create.temp
  392. if (this.create.temp.emp == '') { this.create.temp.emp = Cookies.get('employename') }
  393. PostDataByName(this.requestParam).then(response => {
  394. console.log('新增保存发送参数', this.requestParam)
  395. if (response.msg !== 'fail') {
  396. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  397. this.create.dialogFormVisible = false
  398. this.getList()
  399. } else {
  400. const barid = new RegExp("key 'barid'")
  401. if (barid.test(response.data)) {
  402. this.$message({ type: 'error', message: '该栏舍今日配方干物质已存在,不可重复生成', duration: 2000 })
  403. } else {
  404. failproccess(response, this.$notify)
  405. }
  406. }
  407. })
  408. }
  409. })
  410. },
  411. createDataAgain() {
  412. console.log('点击了新增保存')
  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 weight = /^\d+(\.\d{1,2})?$/
  424. // 鲜样重量/烘干重量
  425. if (!weight.test(parseFloat(this.create.temp.freshweight)) || !weight.test(parseFloat(this.create.temp.dryweight))) {
  426. this.$message({ type: 'error', message: '重量不可小于0,最多保留俩位小数', duration: 2000 })
  427. return false
  428. }
  429. this.requestParam.name = 'insertFtdry'
  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.resetTemp()
  437. this.getList()
  438. this.getNoteTakerList()
  439. } else {
  440. const barid = new RegExp("key 'barid'")
  441. if (barid.test(response.data)) {
  442. this.$message({ type: 'error', message: '该栏舍今日配方干物质已存在,不可重复生成', duration: 2000 })
  443. } else {
  444. failproccess(response, this.$notify)
  445. }
  446. }
  447. })
  448. }
  449. })
  450. },
  451. // 编辑
  452. handleUpdate(row) {
  453. console.log('点击了编辑', row)
  454. row.barid = String(row.barid)
  455. this.create.temp = Object.assign({}, row)
  456. this.create.temp.id = row.id
  457. this.getNoteTakerList()
  458. this.create.dialogStatus = 'update'
  459. this.create.dialogFormVisible = true
  460. },
  461. updateData() {
  462. this.isokDisable = true
  463. setTimeout(() => {
  464. this.isokDisable = false
  465. }, 1000)
  466. this.$refs['temp'].validate(valid => {
  467. if (valid) {
  468. this.isokDisable = true
  469. setTimeout(() => {
  470. this.isokDisable = false
  471. }, 1000)
  472. const weight = /^\d+(\.\d{1,2})?$/
  473. // 鲜样重量/烘干重量
  474. if (!weight.test(parseFloat(this.create.temp.freshweight)) || !weight.test(parseFloat(this.create.temp.dryweight))) {
  475. this.$message({ type: 'error', message: '重量不可小于0,最多保留俩位小数', duration: 2000 })
  476. return false
  477. }
  478. this.requestParam.name = 'updateFtdry'
  479. this.requestParam.parammaps = this.create.temp
  480. if (this.create.temp.emp == '') { this.create.temp.emp = Cookies.get('employename') }
  481. PostDataByName(this.requestParam).then(response => {
  482. console.log('新增保存发送参数', this.requestParam)
  483. if (response.msg !== 'fail') {
  484. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  485. this.create.dialogFormVisible = false
  486. this.getList()
  487. } else {
  488. failproccess(response, this.$notify)
  489. }
  490. })
  491. }
  492. })
  493. },
  494. // 删除
  495. handleRowDelete(row) {
  496. console.log('点击了行内删除')
  497. MessageBox.confirm('是否确认删除此信息?', {
  498. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  499. }).then(() => {
  500. this.selectList = []
  501. this.requestParam.name = 'deleteFtdry'
  502. this.requestParam.parammaps = {}
  503. this.requestParam.parammaps.pastureid = row.pastureid
  504. this.requestParam.parammaps.id = row.id
  505. PostDataByName(this.requestParam).then(response => {
  506. if (response.msg === 'fail') {
  507. this.$notify({ title: '删除失败', message: response.data, type: 'warning', duration: 2000 })
  508. } else {
  509. this.$notify({ title: '成功', message: '删除成功', type: 'success', duration: 2000 })
  510. this.getList()
  511. }
  512. })
  513. }).catch(() => {
  514. this.$message({ type: 'info', message: '已取消删除' })
  515. })
  516. },
  517. handleSelectionChange(val) {
  518. console.log('勾选数据', val)
  519. this.selectList = val
  520. },
  521. handleDelete() {
  522. console.log('点击了删除')
  523. if (this.selectList.length == 0) {
  524. this.$message({ type: 'error', message: '请选择配方干物质', duration: 2000 })
  525. } else {
  526. MessageBox.confirm('是否确认删除此信息?', {
  527. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  528. }).then(() => {
  529. console.log(this.selectList)
  530. this.requestParam.common = { 'returnmap': '0' }
  531. this.requestParam.data = []
  532. this.requestParam.data[0] = { 'name': 'insertSpotList', 'resultmaps': { 'list': this.selectList }}
  533. this.requestParam.data[0].children = []
  534. this.requestParam.data[0].children[0] = { 'name': 'deleteFtdry', 'type': 'e', 'parammaps': {
  535. id: '@insertSpotList.id',
  536. pastureid: '@insertSpotList.pastureid'
  537. }}
  538. ExecDataByConfig(this.requestParam).then(response => {
  539. console.log('删除保存发送参数', this.requestParam)
  540. if (response.msg === 'fail') {
  541. this.$notify({ title: '删除失败', message: response.data, type: 'warning', duration: 2000 })
  542. } else {
  543. this.$notify({ title: '', message: '删除成功', type: 'success', duration: 2000 })
  544. this.getList()
  545. }
  546. })
  547. })
  548. }
  549. },
  550. // 复制
  551. handleCopy() {
  552. console.log('点击了复制')
  553. if (this.selectList.length == 0) {
  554. this.$message({ type: 'error', message: '请选择配方干物质', duration: 2000 })
  555. } else if (this.selectList.length == 1) {
  556. MessageBox.confirm('是否确认复制此信息?', {
  557. confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning'
  558. }).then(() => {
  559. this.requestParam.name = 'copyFtdry'
  560. this.requestParam.parammaps = {}
  561. this.requestParam.parammaps.pastureid = this.selectList[0].pastureid
  562. this.requestParam.parammaps.id = this.selectList[0].id
  563. PostDataByName(this.requestParam).then(response => {
  564. if (response.msg === 'fail') {
  565. const barid = new RegExp("key 'barid'")
  566. if (barid.test(response.data)) {
  567. this.$message({ type: 'error', message: '该栏舍今日配方干物质已存在,不可重复生成', duration: 2000 })
  568. } else {
  569. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  570. }
  571. } else {
  572. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  573. this.getList()
  574. }
  575. })
  576. }).catch(() => {
  577. this.$message({ type: 'info', message: '已取消删除' })
  578. })
  579. } else {
  580. this.$message({ type: 'error', message: '请选择一条配方干物质', duration: 2000 })
  581. }
  582. },
  583. // 导出
  584. handleExport() {
  585. console.log('点击了导出')
  586. },
  587. // 导入
  588. handleImport() {
  589. console.log('点击了导入')
  590. }
  591. }
  592. }
  593. </script>
  594. <style lang="scss" scoped>
  595. .search{padding-top:10px;clear: both;}
  596. .table{margin-top:10px;}
  597. </style>