b98c3a8ed839f5fb113c169341a2300962650750.svn-base 29 KB

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