44be61ef4a9ce3ccaf341682d50f3db189e10635.svn-base 30 KB

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