39c4f992177ff48b68ff4d3a59ec688dd414fc54.svn-base 27 KB

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