d43c5ac1a9f5d903b67bd63cbc65384de7c0e8e1.svn-base 28 KB

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