f3fd8bbde292e2e82c0816e06e1a58b9ce5e933b.svn-base 32 KB

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