e4db400d9ddb7913c3f37d1a9aa4ee9ed3da642c.svn-base 28 KB

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