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