8f82ab3224f85e4047ea1a9a0c6e2fe706f762aa.svn-base 31 KB

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