e9762b6025018f55e55ba1806ca41ab01e220efe.svn-base 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651
  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="第一层" 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="第四层" align="center">
  65. <el-table-column prop="fourrate" label="比例(%)" min-width="90px" align="center" />
  66. <el-table-column prop="fourweight" label="重量(g)" min-width="90px" align="center" />
  67. </el-table-column>
  68. <el-table-column label="备注" min-width="90px" align="center">
  69. <template slot-scope="scope">
  70. <span>{{ scope.row.remark }}</span>
  71. </template>
  72. </el-table-column>
  73. <el-table-column label="操作人" min-width="90px" align="center">
  74. <template slot-scope="scope">
  75. <span>{{ scope.row.emp }}</span>
  76. </template>
  77. </el-table-column>
  78. <el-table-column label="操作日期" min-width="90px" align="center">
  79. <template slot-scope="scope">
  80. <span>{{ scope.row.operatetime }}</span>
  81. </template>
  82. </el-table-column>
  83. <el-table-column label="操作" align="center" width="250" class-name="small-padding fixed-width" fixed="right">
  84. <template slot-scope="{row}">
  85. <el-button class="miniSuccess" @click="handleUpdate(row)">编辑</el-button>
  86. <el-button class="miniDanger" @click="handleRowDelete(row)">删除</el-button>
  87. </template>
  88. </el-table-column>
  89. </el-table>
  90. <pagination v-show="table.total>=0" :total="table.total" :page.sync="table.getdataListParm.offset" :limit.sync="table.getdataListParm.pagecount" @pagination="getList" />
  91. </div>
  92. <!-- 新增/编辑 -->
  93. <el-dialog :title="textMap[create.dialogStatus]" :visible.sync="create.dialogFormVisible" :close-on-click-modal="false" width="90%">
  94. <div class="app-add">
  95. <el-form ref="temp" :rules="create.rules" :model="create.temp" label-position="right" label-width="150px" style="width: 100%;margin:0 auto 50px">
  96. <el-row>
  97. <el-col :span="24">
  98. <h3 style="width: 150px;text-align: right;">栏舍信息</h3>
  99. </el-col>
  100. </el-row>
  101. <el-row>
  102. <el-col :span="6">
  103. <el-form-item label="栏舍名称:" prop="barid">
  104. <el-select ref="barid" v-model="create.temp.barid" filterable placeholder="栏舍名称" class="filter-item" style="width: 100%;" @change="changeBar">
  105. <el-option v-for="item in houseNameList" :key="item.id" :label="item.bname" :value="item.id" />
  106. </el-select>
  107. </el-form-item>
  108. </el-col>
  109. <el-col :span="6">
  110. <el-form-item label="班次:" prop="times">
  111. <el-select ref="times" v-model="create.temp.times" filterable placeholder="班次" class="filter-item" style="width: 100%;">
  112. <el-option v-for="item in frequencyList" :key="item.id" :label="item.name" :value="item.id" />
  113. </el-select>
  114. </el-form-item>
  115. </el-col>
  116. </el-row>
  117. <el-row>
  118. <el-col :span="24">
  119. <h3 style="width: 150px;text-align: right;">重量比例</h3>
  120. </el-col>
  121. </el-row>
  122. <el-row>
  123. <el-col :span="6">
  124. <el-form-item label="第一层重量(g):" prop="oneweight">
  125. <el-input ref="oneweight" v-model="create.temp.oneweight" class="filter-item" placeholder="最多两位小数" type="number" style="width: 100%;" blur-weight="blurWeight" />
  126. </el-form-item>
  127. </el-col>
  128. <el-col :span="6">
  129. <el-form-item label="第二层重量(g):" prop="twoweight">
  130. <el-input ref="twoweight" v-model="create.temp.twoweight" class="filter-item" placeholder="最多两位小数" type="number" style="width: 100%;" @blur="blurWeight" />
  131. </el-form-item>
  132. </el-col>
  133. <el-col :span="6">
  134. <el-form-item label="第三层重量(g):" prop="threeweight">
  135. <el-input ref="threeweight" v-model="create.temp.threeweight" class="filter-item" placeholder="最多两位小数" type="number" style="width: 100%;" @blur="blurWeight" />
  136. </el-form-item>
  137. </el-col>
  138. <el-col :span="6">
  139. <el-form-item label="第四层重量(g):" prop="fourweight">
  140. <el-input ref="fourweight" v-model="create.temp.fourweight" class="filter-item" placeholder="最多两位小数" type="number" style="width: 100%;" @blur="blurWeight" />
  141. </el-form-item>
  142. </el-col>
  143. </el-row>
  144. <el-row>
  145. <el-col :span="6">
  146. <el-form-item label="第一层比例 (%):">
  147. <span>{{ create.temp.onerate }}</span>
  148. <span>{{ create.temp.onerange }}</span>
  149. </el-form-item>
  150. </el-col>
  151. <el-col :span="6">
  152. <el-form-item label="第二层比例 (%):">
  153. <span>{{ create.temp.tworate }}</span>
  154. <span>{{ create.temp.tworange }}</span>
  155. </el-form-item>
  156. </el-col>
  157. <el-col :span="6">
  158. <el-form-item label="第三层比例 (%):">
  159. <span>{{ create.temp.threerate }}</span>
  160. <span>{{ create.temp.threerange }}</span>
  161. </el-form-item>
  162. </el-col>
  163. <el-col :span="6">
  164. <el-form-item label="第四层比例 (%):">
  165. <span>{{ create.temp.fourrate }}</span>
  166. <span>{{ create.temp.fourrange }}</span>
  167. </el-form-item>
  168. </el-col>
  169. </el-row>
  170. <el-row>
  171. <el-col :span="24">
  172. <h3 style="width: 150px;text-align: right;">操作详情</h3>
  173. </el-col>
  174. </el-row>
  175. <el-row>
  176. <el-col :span="6">
  177. <el-form-item label="操作人:" prop="emp">
  178. <el-select ref="emp" v-model="create.temp.emp" filterable placeholder="操作人" class="filter-item" style="width: 100%;" @blur="blurEmp">
  179. <el-option v-for="item in create.noteTakerList" :key="item.myId" :label="item.emp" :value="item.emp" />
  180. </el-select>
  181. </el-form-item>
  182. </el-col>
  183. <el-col :span="6">
  184. <el-form-item label="操作日期:" prop="operatetime">
  185. <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" />
  186. </el-form-item>
  187. </el-col>
  188. <el-col :span="12">
  189. <el-form-item label="备注:" prop="remark">
  190. <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%;" />
  191. </el-form-item>
  192. </el-col>
  193. </el-row>
  194. </el-form>
  195. <div slot="footer" class="dialog-footer">
  196. <el-button class="cancel" @click="create.dialogFormVisible = false;getList()">关闭</el-button>
  197. <el-button v-if="create.dialogStatus==='create'" class="success" :disabled="isokDisable" @click="createDataAgain()">确认新增</el-button>
  198. <el-button v-if="create.dialogStatus==='create' || create.dialogStatus==='update'" class="success" :disabled="isokDisable" @click="create.dialogStatus==='create'?createData():updateData()">确认</el-button>
  199. </div>
  200. </div>
  201. </el-dialog>
  202. </div>
  203. </template>
  204. <script>
  205. import { GetDataByName, PostDataByName, failproccess, ExecDataByConfig, GetDataByNames } from '@/api/common'
  206. import Cookies from 'js-cookie'
  207. import { parseTime } from '@/utils/index.js'
  208. import Pagination from '@/components/Pagination'
  209. import { MessageBox } from 'element-ui'
  210. export default {
  211. name: 'PennsylvaniaSieve',
  212. components: { Pagination },
  213. data() {
  214. return {
  215. requestParams: [
  216. { name: 'getBarListEnable', offset: 0, pagecount: 0, parammaps: { 'pastureid': Cookies.get('pastureid') }},
  217. { name: 'getSysoptEnable', offset: 0, pagecount: 0, parammaps: { 'pastureid': Cookies.get('pastureid'), 'inforname': 'times' }}
  218. ],
  219. houseNameList: [], // 栏舍名称
  220. frequencyList: [], // 班次
  221. table: {
  222. getdataListParm: {
  223. name: 'getPennsieveList',
  224. page: 1,
  225. offset: 1,
  226. pagecount: 10,
  227. returntype: 'Map',
  228. parammaps: {
  229. pastureid: Cookies.get('pastureid'),
  230. barid: '',
  231. times: '',
  232. startTime: '',
  233. stopTime: '',
  234. inputDatetime: ''
  235. }
  236. },
  237. tableKey: 0,
  238. list: [],
  239. total: 0,
  240. listLoading: true,
  241. temp: {}
  242. },
  243. // 新增/编辑
  244. create: {
  245. dialogFormVisible: false,
  246. dialogStatus: '',
  247. temp: { pastureid: Cookies.get('pastureid'), operatetime: parseTime(new Date(), '{y}-{m}-{d}'), emp: Cookies.get('employename'), barid: '', barname: '', times: '', oneweight: '', twoweight: '', threeweight: '', fourweight: '', onerate: '', tworate: '', threerate: '', fourrate: '', tworange: '', threerange: '', fourrange: '', remark: '', ccid: '', ccname: '' },
  248. rules: {
  249. barid: [{ type: 'string', required: true, message: '必填', trigger: 'blur' }],
  250. times: [{ type: 'string', required: true, message: '必填', trigger: 'blur' }],
  251. oneweight: [{ type: 'string', required: true, message: '必填', trigger: 'blur' }],
  252. twoweight: [{ type: 'string', required: true, message: '必填', trigger: 'blur' }],
  253. threeweight: [{ type: 'string', required: true, message: '必填', trigger: 'blur' }],
  254. fourweight: [{ type: 'string', required: true, message: '必填', trigger: 'blur' }]
  255. },
  256. // 操作人
  257. getdataListParm: {
  258. name: 'getPennsieveEmpHis',
  259. page: 1,
  260. offset: 1,
  261. pagecount: 10,
  262. returntype: 'Map',
  263. parammaps: {
  264. pastureid: Cookies.get('pastureid')
  265. }
  266. },
  267. // 宾州筛范围
  268. getdataListParm2: {
  269. name: 'getPennsieveRange',
  270. page: 1,
  271. offset: 1,
  272. pagecount: 1,
  273. returntype: 'Map',
  274. parammaps: {
  275. pastureid: Cookies.get('pastureid'),
  276. barid: '',
  277. date: ''
  278. }
  279. },
  280. noteTakerList: [] // 记录人
  281. },
  282. textMap: {
  283. create: '新增',
  284. update: '编辑'
  285. },
  286. requestParam: {},
  287. isokDisable: false,
  288. selectList: [],
  289. rowStyle: { maxHeight: 50 + 'px', height: 45 + 'px' },
  290. cellStyle: { padding: 0 + 'px' }
  291. }
  292. },
  293. created() {
  294. this.getList()
  295. this.getDownList()
  296. },
  297. methods: {
  298. getDownList() {
  299. GetDataByNames(this.requestParams).then(response => {
  300. this.houseNameList = response.data.getBarListEnable.list
  301. if (response.data.getSysoptEnable.list !== null) {
  302. for (let i = 1; i <= response.data.getSysoptEnable.list[0].inforvalue; i++) {
  303. const obj = {}
  304. obj.id = String(i)
  305. if (i == 1) { obj.name = '第一班' } else if (i == 2) { obj.name = '第二班' } else if (i == 3) { obj.name = '第三班' } else if (i == 4) { obj.name = '第四班' }
  306. this.frequencyList.push(obj)
  307. }
  308. } else {
  309. this.frequencyList = []
  310. }
  311. })
  312. },
  313. getList() {
  314. this.table.listLoading = true
  315. GetDataByName(this.table.getdataListParm).then(response => {
  316. console.log('table数据', response.data.list)
  317. if (response.data.list !== null) {
  318. this.table.list = response.data.list
  319. this.table.pageNum = response.data.pageNum
  320. this.table.pageSize = response.data.pageSize
  321. this.table.total = response.data.total
  322. } else {
  323. this.table.list = []
  324. }
  325. setTimeout(() => {
  326. this.table.listLoading = false
  327. }, 100)
  328. })
  329. },
  330. handleSearch() {
  331. console.log('点击了查询')
  332. if (this.table.getdataListParm.parammaps.inputDatetime !== '' && this.table.getdataListParm.parammaps.inputDatetime !== null) {
  333. this.table.getdataListParm.parammaps.startTime = parseTime(this.table.getdataListParm.parammaps.inputDatetime[0], '{y}-{m}-{d}')
  334. this.table.getdataListParm.parammaps.stopTime = parseTime(this.table.getdataListParm.parammaps.inputDatetime[1], '{y}-{m}-{d}')
  335. } else {
  336. this.table.getdataListParm.parammaps.inputDatetime = ''
  337. this.table.getdataListParm.parammaps.startTime = ''
  338. this.table.getdataListParm.parammaps.stopTime = ''
  339. }
  340. this.table.getdataListParm.offset = 1
  341. this.getList()
  342. },
  343. handleRefresh() {
  344. console.log('点击了重置')
  345. this.table.getdataListParm.parammaps.barid = ''
  346. this.table.getdataListParm.parammaps.times = ''
  347. this.table.getdataListParm.parammaps.startTime = ''
  348. this.table.getdataListParm.parammaps.stopTime = ''
  349. this.table.getdataListParm.parammaps.inputDatetime = ''
  350. this.table.getdataListParm.offset = 1
  351. this.getList()
  352. },
  353. // 新增
  354. resetTemp() {
  355. this.create.temp = { pastureid: Cookies.get('pastureid'), operatetime: parseTime(new Date(), '{y}-{m}-{d}'), emp: Cookies.get('employename'), barid: '', barname: '', times: '', oneweight: '', twoweight: '', threeweight: '', fourweight: '', onerate: '', tworate: '', threerate: '', fourrate: '', tworange: '', threerange: '', fourrange: '', remark: '', ccid: '', ccname: '' }
  356. },
  357. blurEmp(item) {
  358. this.create.temp.emp = item.target.value
  359. },
  360. // 栏舍名称
  361. changeBar(item) {
  362. this.create.temp.barname = this.houseNameList.find(obj => obj.id === item).bname
  363. this.getRange()
  364. },
  365. changeOperatetime() {
  366. this.getRange()
  367. },
  368. // 宾州筛范围
  369. getRange() {
  370. this.create.getdataListParm2.parammaps.date = this.create.temp.operatetime
  371. this.create.getdataListParm2.parammaps.barid = this.create.temp.barid
  372. GetDataByName(this.create.getdataListParm2).then(response => {
  373. if (response.data.list !== null) {
  374. this.create.temp.onerange = response.data.list[0].oneRange
  375. this.create.temp.tworange = response.data.list[0].twoRange
  376. this.create.temp.threerange = response.data.list[0].threeRange
  377. this.create.temp.fourrange = response.data.list[0].fourRange
  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.fourrange = ''
  385. this.create.temp.ccid = ''
  386. this.create.temp.ccname = ''
  387. }
  388. })
  389. },
  390. // 操作人
  391. getNoteTakerList() {
  392. GetDataByName(this.create.getdataListParm).then(response => {
  393. if (response.data.list !== null) {
  394. for (let i = 0; i < response.data.list.length; i++) {
  395. response.data.list[i].myId = i
  396. }
  397. this.create.noteTakerList = response.data.list
  398. console.log('记录人数据', response.data.list)
  399. console.log(this.create.noteTakerList)
  400. } else {
  401. this.create.noteTakerList = []
  402. }
  403. })
  404. },
  405. blurWeight() {
  406. if (this.create.temp.oneweight && this.create.temp.twoweight && this.create.temp.threeweight && this.create.temp.fourweight) {
  407. const weightSum = parseFloat(this.create.temp.oneweight) + parseFloat(this.create.temp.twoweight) + parseFloat(this.create.temp.threeweight) + parseFloat(this.create.temp.fourweight)
  408. this.create.temp.onerate = parseInt(parseFloat(this.create.temp.oneweight) / weightSum * 100)
  409. this.create.temp.tworate = parseInt(parseFloat(this.create.temp.twoweight) / weightSum * 100)
  410. this.create.temp.threerate = parseInt(parseFloat(this.create.temp.threeweight) / weightSum * 100)
  411. this.create.temp.fourrate = 100 - this.create.temp.onerate - this.create.temp.tworate - this.create.temp.threerate
  412. }
  413. },
  414. handleCreate() {
  415. console.log('点击了新增')
  416. this.resetTemp()
  417. this.getNoteTakerList()
  418. this.create.dialogStatus = 'create'
  419. this.create.dialogFormVisible = true
  420. },
  421. createData() {
  422. console.log('点击了新增保存')
  423. this.isokDisable = true
  424. setTimeout(() => {
  425. this.isokDisable = false
  426. }, 1000)
  427. this.$refs['temp'].validate(valid => {
  428. if (valid) {
  429. this.isokDisable = true
  430. setTimeout(() => {
  431. this.isokDisable = false
  432. }, 1000)
  433. const weight = /^\d+(\.\d{1,2})?$/
  434. // 第一层重量
  435. if (!weight.test(parseFloat(this.create.temp.oneweight)) || !weight.test(parseFloat(this.create.temp.twoweight)) || !weight.test(parseFloat(this.create.temp.threeweight)) || !weight.test(parseFloat(this.create.temp.fourweight))) {
  436. this.$message({ type: 'error', message: '重量不可小于0,最多保留俩位小数', duration: 2000 })
  437. return false
  438. }
  439. this.requestParam.name = 'insertPennsieve'
  440. this.requestParam.parammaps = this.create.temp
  441. if (this.create.temp.emp == '') { this.create.temp.emp = Cookies.get('employename') }
  442. PostDataByName(this.requestParam).then(response => {
  443. console.log('新增保存发送参数', this.requestParam)
  444. if (response.msg !== 'fail') {
  445. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  446. this.create.dialogFormVisible = false
  447. this.getList()
  448. } else {
  449. failproccess(response, this.$notify)
  450. }
  451. })
  452. }
  453. })
  454. },
  455. createDataAgain() {
  456. console.log('点击了新增保存')
  457. this.isokDisable = true
  458. setTimeout(() => {
  459. this.isokDisable = false
  460. }, 1000)
  461. this.$refs['temp'].validate(valid => {
  462. if (valid) {
  463. this.isokDisable = true
  464. setTimeout(() => {
  465. this.isokDisable = false
  466. }, 1000)
  467. const weight = /^\d+(\.\d{1,2})?$/
  468. // 第一层重量
  469. if (!weight.test(parseFloat(this.create.temp.oneweight)) || !weight.test(parseFloat(this.create.temp.twoweight)) || !weight.test(parseFloat(this.create.temp.threeweight)) || !weight.test(parseFloat(this.create.temp.fourweight))) {
  470. this.$message({ type: 'error', message: '重量不可小于0,最多保留俩位小数', duration: 2000 })
  471. return false
  472. }
  473. this.requestParam.name = 'insertPennsieve'
  474. this.requestParam.parammaps = this.create.temp
  475. if (this.create.temp.emp == '') { this.create.temp.emp = Cookies.get('employename') }
  476. PostDataByName(this.requestParam).then(response => {
  477. console.log('新增保存发送参数', this.requestParam)
  478. if (response.msg !== 'fail') {
  479. this.$notify({ title: '成功', message: '保存成功', type: 'success', duration: 2000 })
  480. this.resetTemp()
  481. this.getList()
  482. this.getNoteTakerList()
  483. } else {
  484. failproccess(response, this.$notify)
  485. }
  486. })
  487. }
  488. })
  489. },
  490. // 编辑
  491. handleUpdate(row) {
  492. console.log('点击了编辑', row)
  493. row.barid = String(row.barid)
  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 weight = /^\d+(\.\d{1,2})?$/
  512. // 第一层重量
  513. if (!weight.test(parseFloat(this.create.temp.oneweight)) || !weight.test(parseFloat(this.create.temp.twoweight)) || !weight.test(parseFloat(this.create.temp.threeweight)) || !weight.test(parseFloat(this.create.temp.fourweight))) {
  514. this.$message({ type: 'error', message: '重量不可小于0,最多保留俩位小数', duration: 2000 })
  515. return false
  516. }
  517. this.requestParam.name = 'updatePennsieve'
  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 = 'deletePennsieve'
  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': 'deletePennsieve', '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 = 'copyPennsieve'
  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>