index.vue 46 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166
  1. <template>
  2. <div class="app-container">
  3. <div v-if="isPercentage" class="percentage" style="width: 210px;height: 90px;background: #fff;position: fixed;bottom: 0;left: 0;z-index: 9999999999999;">
  4. <h4 style="padding-left: 10px;line-height: 0;">导出进度:</h4>
  5. <el-progress style="padding-left: 10px;" :text-inside="true" :stroke-width="26" :percentage="percentage" />
  6. </div>
  7. <div class="filter-container">
  8. <el-select v-model="getdataListParm.parammaps.pastureName" placeholder="牧场" style="width: 120px;" class="filter-item" @change="changePastureName">
  9. <el-option v-for="item in findAllPasture" :key="item.id" :label="item.name" :value="item.name" />
  10. </el-select>
  11. <el-select v-model="getdataListParm.parammaps.deptName" placeholder="部门" style="width: 120px;" class="filter-item" clearable>
  12. <el-option v-for="item in findAllDepart" :key="item.id" :label="item.name" :value="item.name" />
  13. </el-select>
  14. <el-input v-model="getdataListParm.parammaps.cardNumber" placeholder="卡号" clearable class="filter-item" style="width: 120px" />
  15. <!-- <el-date-picker v-model="getdataListParm.parammaps.selTime" type="date" placeholder="交易时间" style="width:170px;top:-3px;" format="yyyy-MM-dd" value-format="yyyy-MM-dd" /> -->
  16. <el-date-picker ref="inputDatetime" v-model="getdataListParm.parammaps.inputDatetime" class="inputDatetime" type="datetimerange" style="width: 250px;top:-5px;" format="yyyy-MM-dd" value-format="yyyy-MM-dd" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" />
  17. <el-input v-model="getdataListParm.parammaps.equipmentNumber" placeholder="设备编号" clearable class="filter-item" style="width: 120px" />
  18. <el-input v-model="getdataListParm.parammaps.assetName" placeholder="设备名称" clearable class="filter-item" style="width: 120px" />
  19. <el-input v-model="getdataListParm.parammaps.employName" placeholder="加油工" clearable class="filter-item" style="width: 120px" />
  20. <el-input v-model="getdataListParm.parammaps.oilClass" placeholder="加油工班" clearable class="filter-item" style="width: 120px" />
  21. <el-button v-waves class="filter-item" type="primary" icon="el-icon-search" @click="form_search">搜索</el-button>
  22. <div>
  23. <el-button v-if="isDieselAdd" class="filter-item" type="primary" icon="el-icon-edit" @click="form_add">新增</el-button>
  24. <el-button v-if="isDieselExport" v-waves class="filter-item" type="info" icon="el-icon-tickets" @click="handleDownloadTemp">模板</el-button>
  25. <el-upload style="display: inline-block;" :headers="headers" :data="uploadData" :action="uploadExcelUrl" :show-file-list="false" :before-upload="beforeImportExcel" :on-success="handleImportExcelSuccess">
  26. <el-button v-if="isRetreatImport" v-waves class="filter-item" type="warning" icon="el-icon-upload2" @click="form_search">导入</el-button>
  27. </el-upload>
  28. <el-button v-if="isDieselExport" v-waves class="filter-item" type="success" icon="el-icon-download" @click="handleDownload">数据导出</el-button>
  29. <el-button class="filter-item" type="danger" icon="el-icon-download" @click="form_delete">删除</el-button>
  30. </div>
  31. </div>
  32. <el-table
  33. :key="tableKey"
  34. v-loading="listLoading"
  35. element-loading-text="给我一点时间"
  36. :data="list"
  37. border
  38. fit
  39. highlight-current-row
  40. style="width: 100%;"
  41. :row-style="rowStyle"
  42. :cell-style="cellStyle"
  43. class="elTable"
  44. @sort-change="tableSort1"
  45. >
  46. <el-table-column label="序号" align="center" type="index" width="50px">
  47. <template slot-scope="scope">
  48. <span>{{ scope.$index + (pageNum-1) * pageSize + 1 }}</span>
  49. </template>
  50. </el-table-column>
  51. <el-table-column label="牧场" width="90px" align="center">
  52. <template slot-scope="scope">
  53. <span>{{ scope.row.pastureName }}</span>
  54. </template>
  55. </el-table-column>
  56. <el-table-column label="部门" width="80px" align="center">
  57. <template slot-scope="scope">
  58. <span>{{ scope.row.departName }}</span>
  59. </template>
  60. </el-table-column>
  61. <el-table-column label="交易时间" sortable prop="selTime" width="90px" align="center" />
  62. <el-table-column label="车号" min-width="110px" align="center">
  63. <template slot-scope="scope">
  64. <span>{{ scope.row.assetNumber }}</span>
  65. </template>
  66. </el-table-column>
  67. <el-table-column label="加油工班" width="80px" align="center">
  68. <template slot-scope="scope">
  69. <span>{{ scope.row.oilClass }}</span>
  70. </template>
  71. </el-table-column>
  72. <el-table-column label="加油工" width="80px" align="center">
  73. <template slot-scope="scope">
  74. <span>{{ scope.row.empId }}</span>
  75. </template>
  76. </el-table-column>
  77. <el-table-column label="卡号" width="90px" align="center">
  78. <template slot-scope="scope">
  79. <span>{{ scope.row.cardNumber }}</span>
  80. </template>
  81. </el-table-column>
  82. <el-table-column label="卡类型" width="80px" align="center">
  83. <template slot-scope="scope">
  84. <span>{{ scope.row.cardType }}</span>
  85. </template>
  86. </el-table-column>
  87. <el-table-column label="本次加油量(升)" sortable prop="oilAmount" width="80px" align="center">
  88. <template slot-scope="scope">
  89. <span>{{ scope.row.oilAmount }}</span>
  90. </template>
  91. </el-table-column>
  92. <el-table-column label="本次消费金额(元)" sortable prop="nowPrice" width="80px" align="center">
  93. <template slot-scope="scope">
  94. <span>{{ scope.row.nowPrice }}</span>
  95. </template>
  96. </el-table-column>
  97. <el-table-column label="备注" min-width="110px" align="center">
  98. <template slot-scope="scope">
  99. <span>{{ scope.row.note }}</span>
  100. </template>
  101. </el-table-column>
  102. <el-table-column label="操作" align="center" width="200px" class-name="small-padding fixed-width" fixed="right">
  103. <template slot-scope="{row}">
  104. <el-button v-if="isDieselModify" type="success" size="mini" @click="handleDieselUpdate(row)">编辑</el-button>
  105. <!-- <el-button type="primary" size="mini" style="width:70px" @click="handleDosageRecord(row)">用量记录</el-button> -->
  106. <!-- <el-button v-if="isDieselUpdate" type="success" size="mini" @click="handleDieselUpdate(row)">修改</el-button> -->
  107. <!-- <el-button v-if="isDieselDel" type="danger" size="mini" @click="handleDieselDel(row)">删除</el-button> -->
  108. </template>
  109. </el-table-column>
  110. </el-table>
  111. <pagination v-show="total>0" :total="total" :page.sync="getdataListParm.offset" :limit.sync="getdataListParm.pagecount" @pagination="get_table_data" />
  112. <!-- 弹出层新增or修改 -->
  113. <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible" :close-on-click-modal="false">
  114. <el-form ref="temp" :rules="rules" :model="temp" label-position="right" label-width="150px">
  115. <el-row>
  116. <el-col :span="8">
  117. <el-form-item label="油卡编号" prop="cardNumber">
  118. <el-autocomplete
  119. ref="cardNumber"
  120. v-model="temp.cardNumber"
  121. value-key="cardNumber"
  122. class="inline-input"
  123. :fetch-suggestions="formCardSearch"
  124. placeholder="请输入内容"
  125. :disabled="dialogStatus==='update'"
  126. @select="handleformNameSelect"
  127. @blur="blurformNameSelect"
  128. style="width: 100%;"
  129. >
  130. <template slot-scope="{ item }">
  131. <div class="name" style="display: inline;">{{ item.cardCode }}</div>
  132. </template>
  133. </el-autocomplete>
  134. </el-form-item>
  135. </el-col>
  136. <el-col :span="8">
  137. <el-form-item label="单价:" prop="price">
  138. <el-input ref="price" v-model="temp.price" />
  139. </el-form-item>
  140. </el-col>
  141. <el-col :span="8">
  142. <el-form-item label="油量(L):" prop="oilAmount">
  143. <el-input ref="oilAmount" v-model="temp.oilAmount" />
  144. </el-form-item>
  145. </el-col>
  146. </el-row>
  147. <el-row>
  148. <el-col :span="8">
  149. <el-form-item label="设备名称:" prop="assetName">
  150. <el-autocomplete ref="assetName" style="width: 100%;" v-model="temp.assetName" value-key="assetName" class="inline-input" :fetch-suggestions="formNameSearch" placeholder="" disabled @select="handleformNameSelect" />
  151. </el-form-item>
  152. </el-col>
  153. <el-col :span="8">
  154. <el-form-item label="牧场设备编号:" prop="eqCode">
  155. <el-autocomplete ref="eqCode" style="width: 100%;" v-model="temp.eqCode" value-key="eqCode" class="inline-input" :fetch-suggestions="formNumberSearch" placeholder="" disabled @select="handleformNameSelect">
  156. <template slot-scope="{ item }">
  157. <div class="name" style="display: inline;">{{ item.assetNumber }}</div>
  158. </template>
  159. </el-autocomplete>
  160. </el-form-item>
  161. </el-col>
  162. <el-col :span="8">
  163. <el-form-item label="柴油类型:" prop="oilType">
  164. <el-select style="width: 100%;" v-model="temp.oilType" placeholder="柴油类型" class="filter-item">
  165. <el-option v-for="item in dieselTypeList" :key="item.value" :label="item.label" :value="item.value" />
  166. </el-select>
  167. </el-form-item>
  168. </el-col>
  169. </el-row>
  170. <el-row>
  171. <el-col :span="8">
  172. <el-form-item label="牧场" prop="pastureName">
  173. <el-input ref="pastureName" v-model="temp.pastureName" disabled />
  174. </el-form-item>
  175. </el-col>
  176. <el-col :span="8">
  177. <el-form-item label="部门" prop="deptName">
  178. <el-input ref="deptName" v-model="temp.deptName" disabled />
  179. </el-form-item>
  180. </el-col>
  181. </el-row>
  182. <el-row>
  183. <el-col :span="8">
  184. <el-form-item label="加油人:" prop="employeId">
  185. <el-input ref="employeId" v-model="temp.empId" :disabled="dialogStatus==='update'" />
  186. <!-- <el-select v-model="temp.employeId" placeholder="负责人" :disabled="dialogStatus==='update'" class="filter-item">
  187. <el-option
  188. v-for="item in findAllEmploye"
  189. :key="item.id"
  190. :label="item.name"
  191. :value="item.id"
  192. />
  193. </el-select> -->
  194. </el-form-item>
  195. </el-col>
  196. <el-col :span="8">
  197. <el-form-item label="录入人:" prop="inputId">
  198. <el-select v-model="temp.inputId" placeholder="负责人" :disabled="dialogStatus==='update'" style="width: 100%;">
  199. <el-option v-for="item in findAllEmploye" :key="item.id" :label="item.name" :value="item.id" />
  200. </el-select>
  201. </el-form-item>
  202. </el-col>
  203. <el-col :span="8">
  204. <el-form-item label="加油工班次:" prop="oilClass">
  205. <el-input ref="oilClass" v-model="temp.oilClass" :disabled="dialogStatus==='update'" />
  206. </el-form-item>
  207. </el-col>
  208. <el-col :span="8">
  209. <el-form-item label="交易时间:" prop="selTime">
  210. <el-date-picker v-model="temp.selTime" type="date" placeholder="交易时间" format="yyyy-MM-dd" value-format="yyyy-MM-dd" style="width:100%;" :disabled="dialogStatus==='update'" />
  211. </el-form-item>
  212. </el-col>
  213. <el-col :span="8">
  214. <el-form-item label="备注:" prop="note">
  215. <el-input v-model="temp.note" type="textarea" :rows="2" placeholder="请输入内容" />
  216. </el-form-item>
  217. </el-col>
  218. </el-row>
  219. </el-form>
  220. <div slot="footer" class="dialog-footer">
  221. <el-button v-if="dialogStatus==='create'" ref="createb" :disabled="isokDisable" type="success" @click="add_dialog_save_again()">保存并新增</el-button>
  222. <el-button type="primary" :disabled="isokDisable" @click="dialogStatus==='create'?add_dialog_save():edit_dialog_save()">保存并关闭</el-button>
  223. <el-button @click="dialogFormVisible = false;get_table_data()">取消并关闭</el-button>
  224. </div>
  225. </el-dialog>
  226. <!-- 用量记录 -->
  227. <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormDosageRecord" :close-on-click-modal="false">
  228. <div class="dosageRecord">
  229. <div style="position: absolute;top:20px;left:100px;font:18px/24px '' ;color:#303133;">
  230. <span style="margin:0 10px;">表名称:{{ dosageRecordTemp.formName }}</span>
  231. <span>表编号:{{ dosageRecordTemp.formNumber }}</span>
  232. </div>
  233. <el-table
  234. :key="tableKey"
  235. v-loading="listLoadingDosageRecord"
  236. element-loading-text="给我一点时间"
  237. :data="listDosageRecord"
  238. border
  239. fit
  240. highlight-current-row
  241. style="width: 100%;"
  242. :row-style="rowStyle"
  243. :cell-style="cellStyle"
  244. class="elTable"
  245. @sort-change="tableSort2"
  246. >
  247. <el-table-column label="序号" align="center" type="index" width="50px">
  248. <template slot-scope="scope">
  249. <span>{{ scope.$index + (pageNumDosageRecord-1) * pageSizeDosageRecord + 1 }}</span>
  250. </template>
  251. </el-table-column>
  252. <el-table-column label="上次值" sortable prop="lastAmount" min-width="110px" align="center">
  253. <template slot-scope="scope">
  254. <span>{{ scope.row.lastAmount }}</span>
  255. </template>
  256. </el-table-column>
  257. <el-table-column label="本次值" sortable prop="endAmount" min-width="110px" align="center">
  258. <template slot-scope="scope">
  259. <span>{{ scope.row.endAmount }}</span>
  260. </template>
  261. </el-table-column>
  262. <el-table-column label="用量" sortable prop="waterConsumption" min-width="110px" align="center">
  263. <template slot-scope="scope">
  264. <span>{{ scope.row.waterConsumption }}</span>
  265. </template>
  266. </el-table-column>
  267. <el-table-column label="单价" sortable prop="price" align="center" width="150">
  268. <template slot-scope="scope">
  269. <span>{{ scope.row.price }}</span>
  270. </template>
  271. </el-table-column>
  272. <el-table-column label="总价" sortable prop="sumPrice" align="center" width="150">
  273. <template slot-scope="scope">
  274. <span>{{ scope.row.sumPrice }}</span>
  275. </template>
  276. </el-table-column>
  277. <el-table-column label="记录人" width="150px" align="center">
  278. <template slot-scope="scope">
  279. <span>{{ scope.row.empname }}</span>
  280. </template>
  281. </el-table-column>
  282. <el-table-column label="记录日期" min-width="110px" align="center" sortable prop="date" />
  283. </el-table>
  284. <pagination v-show="totalDosageRecord>=0" :total="totalDosageRecord" :page.sync="getDosageRecordListParm.offset" :limit.sync="getDosageRecordListParm.pagecount" @pagination="getDosageRecordList" />
  285. <div slot="footer" class="dialog-footer">
  286. <el-button @click="dialogFormDosageRecord = false">关闭</el-button>
  287. </div>
  288. </div>
  289. </el-dialog>
  290. <!-- 删除 -->
  291. <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormDelete" :close-on-click-modal="false" width="40%">
  292. <el-form ref="deleteTemp" :rules="rules" :model="deleteTemp" label-position="right" label-width="190px">
  293. <el-row>
  294. <el-col :span="8">
  295. <el-form-item label="请选择要删除数据的日期:" prop="startTime">
  296. <el-date-picker ref="startTime" v-model="deleteTemp.startTime" :clearable="false" type="date" placeholder="日期" style="width:100%px;" format="yyyy-MM-dd" value-format="yyyy-MM-dd" />
  297. </el-form-item>
  298. </el-col>
  299. </el-row>
  300. </el-form>
  301. <div slot="footer" class="dialog-footer">
  302. <el-button type="primary" :disabled="isokDisable" @click="deleteData()">确认</el-button>
  303. <el-button @click="dialogFormDelete = false;get_table_data()">关闭</el-button>
  304. </div>
  305. </el-dialog>
  306. </div>
  307. </template>
  308. <script>
  309. // 引入
  310. require('script-loader!file-saver')
  311. import { GetDataByName, GetDataByNames, PostDataByName, checkButtons, ExecDataByConfig, failproccess, GetAccount,getJson } from '@/api/common'
  312. // import { DownloadExcel, GetDataByNameXlsx } from '@/api/common'
  313. import waves from '@/directive/waves'
  314. import { parseTime, sortChange } from '@/utils/index.js'
  315. import Pagination from '@/components/Pagination' // secondary package based on el-pagination
  316. import { MessageBox } from 'element-ui'
  317. import { getToken } from '@/utils/auth'
  318. import Cookies from 'js-cookie'
  319. export default {
  320. name: 'Diesel',
  321. components: { Pagination },
  322. directives: { waves },
  323. data() {
  324. return {
  325. isokDisable: false,
  326. isDieselUpdate: [],
  327. isDieselDel: [],
  328. isDieselAdd: [],
  329. isDieselExport: [],
  330. isDieselModify: [],
  331. isRetreatImport: [],
  332. isRetreatMuban: [],
  333. formNumberSearchList: [],
  334. formNameSearchList: [],
  335. tableKey: 0,
  336. list: null,
  337. total: 0,
  338. listLoading: true,
  339. requestParam: {
  340. name: 'insertDiesel',
  341. offset: 0,
  342. pagecount: 0,
  343. parammaps: {}
  344. },
  345. postDataPramas: {
  346. },
  347. // 1-2:table&搜索传参
  348. getdataListParm: {
  349. name: 'getDieselList',
  350. page: 1,
  351. offset: 1,
  352. pagecount: 10,
  353. returntype: 'Map',
  354. parammaps: {
  355. selTime: '',
  356. pastureName: Cookies.get('pasturename'),
  357. departName: ''
  358. }
  359. },
  360. // 2-3:下拉框请求后数据加入[]
  361. getDictByName: [],
  362. findAllAssetType: [],
  363. findAllPasture: [],
  364. findAllDepart: [],
  365. findAllEmploye: [],
  366. // 2-1.请求下拉框接口
  367. requestParams: [
  368. { name: 'getDictByName', offset: 0, pagecount: 0, params: ['水表类型'] },
  369. { name: 'findAllAssetType', offset: 0, pagecount: 0, params: [] },
  370. { name: 'findAllPasture', offset: 0, pagecount: 0, returntype: 'Map', parammaps: { 'id': Cookies.get('pastureid') }},
  371. { name: 'findAllDepart', offset: 0, pagecount: 0, parammaps: { 'pastureId': Cookies.get('pastureid') }},
  372. { name: 'findAllEmploye', offset: 0, pagecount: 0, parammaps: { 'pastureId': Cookies.get('pastureid') }}
  373. ],
  374. getDepartParam: {
  375. name: 'findAllDepart', offset: 0, pagecount: 0, parammaps: { 'pastureId': Cookies.get('pastureid') }
  376. },
  377. requestFilterParams: {
  378. name: 'getWaterList',
  379. page: 1,
  380. offset: 1,
  381. pagecount: 10,
  382. returntype: 'Map',
  383. parammaps: {}
  384. },
  385. temp: {
  386. selTime: parseTime(new Date(), '{y}-{m}-{d}'),
  387. oilClass: '', // 加油工班
  388. cardNumber: '',
  389. price: '',
  390. empId: '',
  391. inputId: this.$store.state.user.employeid,
  392. departmentId: this.$store.state.user.departmentid,
  393. pastureId: this.$store.state.user.pastureid,
  394. oilAmount: '',
  395. nowPrice: '',
  396. note: '',
  397. eqId: '',
  398. eqCode: '',
  399. oilcardId: '',
  400. oilType:''
  401. },
  402. dialogFormVisible: false,
  403. dialogStatus: '',
  404. textMap: {
  405. update: '编辑',
  406. create: '新增',
  407. DosageRecord: '用量记录',
  408. delete: '删除'
  409. },
  410. dialogFormDosageRecord: false,
  411. totalDosageRecord: 0,
  412. listDosageRecord: [],
  413. listLoadingDosageRecord: false,
  414. getDosageRecordListParm: {
  415. name: 'getDieselHistory',
  416. page: 1,
  417. offset: 1,
  418. pagecount: 10,
  419. returntype: 'Map',
  420. parammaps: {}
  421. },
  422. dosageRecordTemp: {},
  423. // 校验规则
  424. rules: {
  425. cardNumber: [{ required: true, message: '必填', trigger: 'blur' }],
  426. price: [{ required: true, message: '必填', trigger: 'blur' }],
  427. oilAmount: [{ required: true, message: '必填', trigger: 'blur' }],
  428. oilType: [{ required: true, message: '必填', trigger: 'blur' }],
  429. endAmount: [{ type: 'number', required: true, validator: (rule, value, callback) => {
  430. console.log(rule, value, callback)
  431. if (!value) {
  432. callback(new Error('不能为空'))
  433. }
  434. if (value < 0) {
  435. callback(new Error('必须大于0'))
  436. } else if (value < this.temp.aAmount) {
  437. callback(new Error('必须大于上次值'))
  438. }
  439. setTimeout(() => {
  440. const re = /^\d+$/ // /^[0-9]*[1-9][0-9]*$/
  441. const rsCheck = re.test(value)
  442. if (!rsCheck) {
  443. callback(new Error('请输入整数'))
  444. } else {
  445. callback()
  446. }
  447. }, 0)
  448. }, trigger: 'blur' }],
  449. equipmentName: [{ required: true, message: '必填', trigger: 'blur' }],
  450. startTime: [{ required: true, message: '必填', trigger: 'blur' }]
  451. },
  452. MeasureListbyfilter: [],
  453. rowStyle: { maxHeight: 50 + 'px', height: 45 + 'px' },
  454. cellStyle: { padding: 0 + 'px' },
  455. buttons: [],
  456. isPercentage: false,
  457. percentage: 1,
  458. dialogFormDelete: false,
  459. deleteTemp: {},
  460. dieselTypeList:[]
  461. }
  462. },
  463. computed: {
  464. // 设置请求头
  465. headers() {
  466. return {
  467. // 设置token
  468. token: getToken()
  469. }
  470. },
  471. uploadData() {
  472. return {
  473. name: 'importDiesel',
  474. importParams: '牧场,油卡编号,设备名称,设备编号,加油日期,加油量(升),单价,录入人,加油人,加油工班,备注',
  475. sheetname: 'SheetJS'
  476. }
  477. },
  478. // 设置上传地址
  479. uploadExcelUrl() {
  480. // process.env.VUE_APP_BASE_API是服务器的路径,也是axios的基本路径
  481. return process.env.VUE_APP_BASE_API + 'authdata/ImportExcel'
  482. }
  483. },
  484. created() {
  485. const that = this
  486. GetDataByName({ 'name': 'getUserPCButtons', 'parammaps': { 'jwt_username': Cookies.get('name') }}).then(response => {
  487. that.buttons = response.data.list
  488. that.get_auto_buttons()
  489. })
  490. this.get_select_list()
  491. this.get_table_data()
  492. this.getDieselTypeList()
  493. },
  494. methods: {
  495. getDieselTypeList(){
  496. let url = 'authdata/diesel/type/list'
  497. let data = ''
  498. getJson(url, data).then(response => {
  499. if (response.code == 200) {
  500. this.dieselTypeList = response.data.diesel_type
  501. } else {
  502. this.dieselTypeList = []
  503. }
  504. })
  505. },
  506. tableSort1(column) {
  507. sortChange(column, this.list)
  508. },
  509. tableSort2(column) {
  510. sortChange(column, this.listDosageRecord)
  511. },
  512. get_auto_buttons() {
  513. // 新增
  514. const DieselAdd = 'cost:diesel:add'
  515. const isDieselAdd = checkButtons(this.$store.state.user.buttons, DieselAdd)
  516. this.isDieselAdd = isDieselAdd
  517. // 模板
  518. const RetreatMuban = 'cost:diesel:muban'
  519. const isRetreatMuban = checkButtons(this.$store.state.user.buttons, RetreatMuban)
  520. this.isRetreatMuban = isRetreatMuban
  521. // 导出
  522. const DieselExport = 'cost:diesel:export'
  523. const isDieselExport = checkButtons(this.$store.state.user.buttons, DieselExport)
  524. this.isDieselExport = isDieselExport
  525. // 导入
  526. const RetreatImport = 'cost:diesel:import'
  527. const isRetreatImport = checkButtons(this.$store.state.user.buttons, RetreatImport)
  528. this.isRetreatImport = isRetreatImport
  529. // 编辑
  530. const DieselModify = 'cost:diesel:modify'
  531. const isDieselModify = checkButtons(this.$store.state.user.buttons, DieselModify)
  532. this.isDieselModify = isDieselModify
  533. // 修改
  534. const DieselUpdate = 'cost:diesel:update'
  535. const isDieselUpdate = checkButtons(this.$store.state.user.buttons, DieselUpdate)
  536. this.isDieselUpdate = isDieselUpdate
  537. // 删除
  538. const DieselDel = 'cost:diesel:del'
  539. const isDieselDel = checkButtons(this.$store.state.user.buttons, DieselDel)
  540. this.isDieselDel = isDieselDel
  541. },
  542. isIntegerZero_(rule, value, callback) {
  543. if (value === '' || value === undefined || value === null) {
  544. return callback(new Error('输入不可以为空'))
  545. }
  546. if (value.length === 0) {
  547. return callback(new Error('输入不可以为空'))
  548. }
  549. setTimeout(() => {
  550. const re = /^\d+$/ // /^[0-9]*[1-9][0-9]*$/
  551. const rsCheck = re.test(value)
  552. if (!rsCheck) {
  553. callback(new Error('请输入整数'))
  554. } else {
  555. callback()
  556. }
  557. }, 0)
  558. },
  559. // 模糊查询-报修名称
  560. formNumberSearch(queryString, cb) {
  561. this.requestFilterParams.name = 'findAssetMainOil'
  562. this.requestFilterParams.parammaps['assetNumber'] = queryString
  563. this.requestFilterParams.parammaps['pastureId'] = Cookies.get('pastureid')
  564. this.requestFilterParams.parammaps['assetName'] = ''
  565. this.requestFilterParams.parammaps['cardCode'] = ''
  566. GetDataByName(this.requestFilterParams).then(response => {
  567. this.formNumberSearchList = response.data.list
  568. var results = queryString ? this.formNumberSearchList.filter(this.createFilter(queryString)) : this.formNumberSearchList
  569. cb(results)
  570. })
  571. },
  572. createFilter(queryString) {
  573. return returnValue => {
  574. return (
  575. returnValue.assetNumber.toLowerCase().indexOf(queryString.toLowerCase()) >= 0
  576. )
  577. }
  578. },
  579. formNameSearch(queryString, cb) {
  580. this.requestFilterParams.name = 'findAssetMainOil'
  581. this.requestFilterParams.parammaps['assetNumber'] = ''
  582. this.requestFilterParams.parammaps['pastureId'] = Cookies.get('pastureid')
  583. this.requestFilterParams.parammaps['assetName'] = queryString
  584. this.requestFilterParams.parammaps['cardCode'] = ''
  585. GetDataByName(this.requestFilterParams).then(response => {
  586. this.formNameSearchList = response.data.list
  587. var results = queryString ? this.formNameSearchList.filter(this.createFilterName(queryString)) : this.formNameSearchList
  588. cb(results)
  589. })
  590. },
  591. formCardSearch(queryString, cb) {
  592. this.requestFilterParams.name = 'findAssetMainOil'
  593. this.requestFilterParams.parammaps['assetNumber'] = ''
  594. this.requestFilterParams.parammaps['assetName'] = ''
  595. this.requestFilterParams.parammaps['cardCode'] = queryString
  596. this.requestFilterParams.parammaps['pastureId'] = Cookies.get('pastureid')
  597. GetDataByName(this.requestFilterParams).then(response => {
  598. if (response.data.list === null) {
  599. this.formNameSearchList = []
  600. } else {
  601. this.formNameSearchList = response.data.list
  602. }
  603. var results = queryString ? this.formNameSearchList.filter(this.createFilterName(queryString)) : this.formNameSearchList
  604. cb(results)
  605. })
  606. },
  607. createFilterName(queryString) {
  608. return returnValue => {
  609. return (
  610. returnValue.cardCode.toLowerCase().indexOf(queryString.toLowerCase()) >= 0
  611. )
  612. }
  613. },
  614. handleformNameSelect(item) {
  615. this.temp.assetName = item.assetName
  616. this.temp.cardNumber = item.cardCode
  617. this.temp.eqId = item.eqId
  618. this.temp.eqCode = item.eqCode
  619. this.temp.oilcardId = item.oilcardId
  620. this.temp.deptName = item.deptName
  621. this.temp.departmentId = item.deptId
  622. this.temp.pastureName = item.pastureName
  623. this.temp.price = item.price
  624. },
  625. blurformNameSelect(item) {
  626. this.temp.assetName = ''
  627. this.temp.cardNumber = ''
  628. this.temp.eqId = ''
  629. this.temp.eqCode = ''
  630. this.temp.oilcardId = ''
  631. this.temp.deptName = ''
  632. this.temp.pastureName = ''
  633. this.temp.price = ''
  634. }, // 导出
  635. handleDownload() {
  636. this.$alert('油卡正在导出中,请勿刷新或离开本页面,若导出时间过长,建议缩小导出数据范围重新导出', {})
  637. this.isPercentage = true
  638. this.percentage = 1
  639. var timer = setInterval(() => {
  640. this.percentage += 5
  641. if (this.percentage > 95) {
  642. this.percentage = 99
  643. clearInterval(timer)
  644. }
  645. this.percentage = this.percentage
  646. }, 1000)
  647. this.requestParam.name = 'getDieselList'
  648. this.requestParam.parammaps.pastureName = this.getdataListParm.parammaps.pastureName
  649. this.requestParam.parammaps.departName = this.getdataListParm.parammaps.departName
  650. this.requestParam.parammaps.startTime = this.getdataListParm.parammaps.startTime
  651. this.requestParam.parammaps.stopTime = this.getdataListParm.parammaps.stopTime
  652. GetAccount(this.requestParam).then(response => {
  653. if (response.data.list !== '') {
  654. this.percentage = 99
  655. setTimeout(() => {
  656. this.isPercentage = false
  657. }, 2000)
  658. }
  659. this.$nextTick(() => {
  660. import('@/vendor/Export2Excel').then(excel => {
  661. const list1 = response.data.list
  662. const tHeader = [
  663. '牧场', '部门', '交易时间', '车号', '加油工班', '加油工', '卡号', '卡类型', '本次加油量(升)', '本次消费金额(元)', '备注'
  664. ]
  665. const filterVal = [
  666. 'pastureName', 'departName', 'selTime', 'assetNumber', 'oilClass', 'empId', 'cardNumber', 'cardType', 'oilAmount', 'nowPrice', 'note'
  667. ]
  668. const data1 = this.formatJson(filterVal, list1)
  669. excel.export_json_to_excel({ header: tHeader, data: data1, filename: '柴油用量', autoWidth: true, bookType: 'xlsx' })
  670. })
  671. })
  672. })
  673. },
  674. handleDownloadTemp() {
  675. this.$alert('柴油模板正在导出中,请勿刷新或离开本页面,若导出时间过长,建议缩小导出数据范围重新导出', {})
  676. this.isPercentage = true
  677. this.percentage = 1
  678. var timer = setInterval(() => {
  679. this.percentage += 5
  680. if (this.percentage > 95) {
  681. this.percentage = 99
  682. clearInterval(timer)
  683. }
  684. this.percentage = this.percentage
  685. }, 1000)
  686. this.requestParam.name = 'getOilcardList'
  687. this.requestParam.parammaps.pastureName = this.getdataListParm.parammaps.pastureName
  688. GetDataByName(this.requestParam).then(response => {
  689. if (response.data.list !== '') {
  690. this.percentage = 99
  691. setTimeout(() => {
  692. this.isPercentage = false
  693. }, 2000)
  694. }
  695. this.$nextTick(() => {
  696. import('@/vendor/Export2Excel').then(excel => {
  697. let day = parseTime(new Date(), '{y}-{m}-{d}')
  698. for(let i=0;i<response.data.list.length;i++){
  699. this.$set(response.data.list[i], 'i', i+1)
  700. this.$set(response.data.list[i], 'day', day)
  701. this.$set(response.data.list[i], 'day', day)
  702. this.$set(response.data.list[i], 'name', Cookies.get('employename'))
  703. }
  704. const list1 = response.data.list
  705. console.log(list1,'list1')
  706. const tHeader = [
  707. '编号', '牧场', '油卡编号', '设备名称', '设备编号', '加油日期', '加油量(升)', '单价', '录入人', '加油人', '加油工班', '备注'
  708. ]
  709. const filterVal = [
  710. 'i', 'pastureName', 'cardNumber', 'assetName', 'assetNumber', 'day', '加油量(L)', '单价', 'name', '加油人', '加油工班', '备注'
  711. ]
  712. const data1 = this.formatJson(filterVal, list1)
  713. excel.export_json_to_excel({
  714. header: tHeader,
  715. data: data1,
  716. filename: '柴油模板',
  717. autoWidth: true,
  718. bookType: 'xlsx'
  719. })
  720. })
  721. })
  722. })
  723. },
  724. formatJson(filterVal, jsonData) {
  725. return jsonData.map(v =>
  726. filterVal.map(j => {
  727. if (j === 'timestamp') {
  728. return parseTime(v[j])
  729. } else {
  730. return v[j]
  731. }
  732. })
  733. )
  734. },
  735. // 导入
  736. beforeImportExcel(file) {
  737. /* const isExcel =
  738. file.type ===
  739. 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' */
  740. const isLt2M = file.size / 1024 / 1024 < 2
  741. /* if (!isExcel) {
  742. this.$message.error(
  743. '上传文件必须是Xlsx格式!建议先导出,再修改导出文件再导入!'
  744. )
  745. }*/
  746. if (!isLt2M) {
  747. this.$message.error('上传文件大小不能超过 2MB!')
  748. }
  749. return isLt2M
  750. },
  751. handleImportExcelSuccess(res, file) {
  752. // if (res.msg === 'ok') {
  753. if (res.msg === 'ok') {
  754. this.$message({
  755. title: '成功',
  756. message: '导入成功:' + res.data.success + '条!',
  757. type: 'success',
  758. duration: 2000
  759. })
  760. if (res.data.err_count > 0) {
  761. this.$notify({
  762. title: '失败',
  763. message: '导入失败:' + res.data.err_count + '条!',
  764. type: 'danger',
  765. duration: 2000
  766. })
  767. import('@/vendor/Export2Excel').then(excel => {
  768. const list1 = res.data.result
  769. const tHeader = [
  770. '编号', '牧场', '油卡编号', '设备名称', '设备编号', '加油日期', '加油量(L)', '单价', '录入人', '加油人', '加油工班', '备注', '错误信息'
  771. ]
  772. const filterVal = [
  773. '编号', '牧场', '油卡编号', '设备名称', '设备编号', '加油日期', '加油量(L)', '单价', '录入人', '加油人', '加油工班', '备注', 'error_msg'
  774. ]
  775. const data1 = this.formatJson(filterVal, list1)
  776. excel.export_json_to_excel({
  777. header: tHeader,
  778. data: data1,
  779. filename: this.requestParam.parammaps.formType,
  780. autoWidth: true,
  781. bookType: 'xlsx'
  782. })
  783. })
  784. }
  785. } else {
  786. this.$notify({
  787. title: '失败',
  788. message: '上传失败',
  789. type: 'danger',
  790. duration: 2000
  791. })
  792. }
  793. },
  794. // 1-1: table&搜索
  795. get_table_data() {
  796. this.listLoading = true
  797. GetDataByName(this.getdataListParm).then(response => {
  798. if (response.data.list == null) {
  799. this.list = []
  800. } else {
  801. this.list = response.data.list
  802. this.pageNum = response.data.pageNum
  803. this.pageSize = response.data.pageSize
  804. if (response.data.total) {
  805. this.total = response.data.total
  806. }
  807. }
  808. setTimeout(() => {
  809. this.listLoading = false
  810. }, 100)
  811. })
  812. },
  813. // 2-2:下拉框
  814. get_select_list() {
  815. GetDataByNames(this.requestParams).then(response => {
  816. this.getDictByName = response.data.getDictByName.list
  817. this.findAllAssetType = response.data.findAllAssetType.list
  818. this.findAllPasture = response.data.findAllPasture.list
  819. this.findAllEmploye = response.data.findAllEmploye.list
  820. this.getDepartDownList()
  821. })
  822. },
  823. getDepartDownList() {
  824. GetDataByName(this.getDepartParam).then(response => {
  825. this.findAllDepart = response.data.list
  826. })
  827. },
  828. changePastureName(item) {
  829. this.getDepartParam.parammaps.pastureId = this.findAllPasture.find(obj => obj.name == item).id
  830. this.getdataListParm.parammaps.deptName = ''
  831. this.getDepartDownList()
  832. },
  833. form_search() {
  834. this.listLoading = true
  835. this.getdataListParm.offset = 1
  836. if (this.getdataListParm.parammaps.inputDatetime == null) {
  837. this.getdataListParm.parammaps.inputDatetime = ''
  838. }
  839. if (this.getdataListParm.parammaps.inputDatetime !== '' && this.getdataListParm.parammaps.inputDatetime !== null) {
  840. this.getdataListParm.parammaps.startTime = parseTime(this.getdataListParm.parammaps.inputDatetime[0], '{y}-{m}-{d}')
  841. this.getdataListParm.parammaps.stopTime = parseTime(this.getdataListParm.parammaps.inputDatetime[1], '{y}-{m}-{d}')
  842. } else {
  843. this.getdataListParm.parammaps.inputDatetime = ''
  844. this.getdataListParm.parammaps.startTime = ''
  845. this.getdataListParm.parammaps.stopTime = ''
  846. }
  847. // if (this.getdataListParm.parammaps.selTime == null) {
  848. // this.getdataListParm.parammaps.selTime = ''
  849. // }
  850. this.get_table_data()
  851. },
  852. handleModifyStatus(row, status) {
  853. this.$message({
  854. message: '操作成功',
  855. type: 'success'
  856. })
  857. row.status = status
  858. },
  859. form_reset() {
  860. this.temp.cardNumber = ''
  861. this.temp.price = ''
  862. this.temp.oilAmount = ''
  863. this.temp.assetName = ''
  864. this.temp.eqCode = ''
  865. this.temp.pastureName = ''
  866. this.temp.deptName = ''
  867. this.temp.oilClass = ''
  868. this.temp.selTime = parseTime(new Date(), '{y}-{m}-{d}')
  869. this.temp.note = ''
  870. },
  871. form_add() {
  872. console.log(this.temp.DATE)
  873. this.form_reset()
  874. this.dialogStatus = 'create'
  875. this.dialogFormVisible = true
  876. this.temp.empId = ''
  877. this.temp.departmentId = ''
  878. this.temp.pastureId = this.$store.state.user.pastureid
  879. this.$nextTick(() => {
  880. this.$refs['temp'].clearValidate()
  881. })
  882. },
  883. add_dialog_save() {
  884. this.isokDisable = true
  885. setTimeout(() => {
  886. this.isokDisable = false
  887. }, 1000)
  888. this.$refs['temp'].validate(valid => {
  889. if (valid) {
  890. if(this.temp.oilType){
  891. var oilName = this.dieselTypeList.find(obj => obj.value == this.temp.oilType).label
  892. }
  893. this.$set(this.temp,'oilName',oilName)
  894. this.postDataPramas.common = { 'returnmap': '0' }
  895. this.postDataPramas.data = []
  896. this.postDataPramas.data[0] = { 'name': 'insertDiesel', 'type': 'e', 'parammaps': {
  897. 'pastureId': this.temp.pastureId,
  898. 'selTime': this.temp.selTime,
  899. 'oilClass': this.temp.oilClass,
  900. 'oilAmount': this.temp.oilAmount,
  901. 'eqId': this.temp.eqId,
  902. 'eqCode': this.temp.eqCode,
  903. 'departmentId': this.temp.departmentId,
  904. 'note': this.temp.note,
  905. 'nowPrice': this.temp.price * this.temp.oilAmount,
  906. 'oilcardId': this.temp.oilcardId,
  907. 'cardNumber': this.temp.cardNumber,
  908. 'price': this.temp.price,
  909. 'empId': this.temp.empId,
  910. 'inputId': this.temp.inputId,
  911. 'oilType':this.temp.oilType,
  912. 'oilName':this.temp.oilName,
  913. }}
  914. this.postDataPramas.data[1] = { 'name': 'updateOilCardExecData', 'type': 'e',
  915. 'parammaps': {
  916. 'id': this.temp.oilcardId,
  917. 'nowPrice': this.temp.price * this.temp.oilAmount
  918. }}
  919. ExecDataByConfig(this.postDataPramas).then(response => {
  920. if (response.msg === 'fail') {
  921. this.$notify({
  922. title: '保存失败',
  923. message: response.data,
  924. type: 'warning',
  925. duration: 2000
  926. })
  927. } else {
  928. this.get_table_data()
  929. this.dialogFormVisible = false
  930. this.$notify({
  931. title: '',
  932. message: '保存成功',
  933. type: 'success',
  934. duration: 2000
  935. })
  936. }
  937. })
  938. }
  939. })
  940. },
  941. // 继续新增
  942. add_dialog_save_again() {
  943. this.isokDisable = true
  944. setTimeout(() => {
  945. this.isokDisable = false
  946. }, 1000)
  947. this.$refs['temp'].validate(valid => {
  948. if (valid) {
  949. if(this.temp.oilType){
  950. var oilName = this.dieselTypeList.find(obj => obj.value == this.temp.oilType).label
  951. }
  952. this.$set(this.temp,'oilName',oilName)
  953. this.postDataPramas.common = { 'returnmap': '0' }
  954. this.postDataPramas.data = []
  955. this.postDataPramas.data[0] = { 'name': 'insertDiesel', 'type': 'e', 'parammaps': {
  956. 'pastureId': this.temp.pastureId,
  957. 'selTime': this.temp.selTime,
  958. 'oilClass': this.temp.oilClass,
  959. 'oilAmount': this.temp.oilAmount,
  960. 'eqId': this.temp.eqId,
  961. 'eqCode': this.temp.eqCode,
  962. 'departmentId': this.temp.departmentId,
  963. 'note': this.temp.note,
  964. 'nowPrice': this.temp.price * this.temp.oilAmount,
  965. 'oilcardId': this.temp.oilcardId,
  966. 'cardNumber': this.temp.cardNumber,
  967. 'price': this.temp.price,
  968. 'empId': this.temp.empId,
  969. 'inputId': this.temp.inputId,
  970. 'oilType':this.temp.oilType,
  971. 'oilName':this.temp.oilName,
  972. }}
  973. this.postDataPramas.data[1] = { 'name': 'updateOilCardExecData', 'type': 'e',
  974. 'parammaps': {
  975. 'id': this.temp.oilcardId,
  976. 'nowPrice': this.temp.price * this.temp.oilAmount
  977. }}
  978. ExecDataByConfig(this.postDataPramas).then(response => {
  979. if (response.msg !== 'fail') {
  980. this.form_reset()
  981. this.$nextTick(() => {
  982. this.$refs['temp'].clearValidate()
  983. })
  984. this.$notify({
  985. title: '成功',
  986. message: '新增成功',
  987. type: 'success',
  988. duration: 2000
  989. })
  990. } else {
  991. failproccess(response, this.$notify)
  992. }
  993. })
  994. }
  995. })
  996. },
  997. form_edit(row) {
  998. this.temp = Object.assign({}, row) // copy obj
  999. this.dialogStatus = 'update'
  1000. this.dialogFormVisible = true
  1001. this.$nextTick(() => {
  1002. this.$refs['temp'].clearValidate()
  1003. })
  1004. },
  1005. // 修改加油信息
  1006. edit_dialog_save() {
  1007. this.$refs['temp'].validate(valid => {
  1008. if (valid) {
  1009. if(this.temp.oilType){
  1010. var oilName = this.dieselTypeList.find(obj => obj.value == this.temp.oilType).label
  1011. }
  1012. this.$set(this.temp,'oilName',oilName)
  1013. this.postDataPramas.common = { 'returnmap': '0' }
  1014. this.postDataPramas.data = []
  1015. this.postDataPramas.data[0] = { 'name': 'updateDieselExecData', 'type': 'e', 'parammaps': {
  1016. 'id': this.temp.id,
  1017. 'oilAmount': this.temp.oilAmount,
  1018. 'note': this.temp.note,
  1019. 'nowPrice': this.temp.price * this.temp.oilAmount,
  1020. 'price': this.temp.price,
  1021. 'oilType':this.temp.oilType,
  1022. 'oilName':this.temp.oilName,
  1023. }}
  1024. this.postDataPramas.data[1] = { 'name': 'updateOilCardLAExecData', 'type': 'e',
  1025. 'parammaps': {
  1026. 'id': this.temp.oilcardId,
  1027. 'nowPrice': this.temp.price * this.temp.oilAmount
  1028. }}
  1029. ExecDataByConfig(this.postDataPramas).then(response => {
  1030. if (response.msg === 'fail') {
  1031. this.$notify({
  1032. title: '保存失败',
  1033. message: response.data,
  1034. type: 'warning',
  1035. duration: 2000
  1036. })
  1037. } else {
  1038. this.get_table_data()
  1039. this.dialogFormVisible = false
  1040. this.$notify({
  1041. title: '',
  1042. message: '保存成功',
  1043. type: 'success',
  1044. duration: 2000
  1045. })
  1046. }
  1047. })
  1048. }
  1049. })
  1050. },
  1051. handleDieselUpdate(row) {
  1052. this.temp = Object.assign({}, row) // copy obj
  1053. this.temp.eqCode = this.temp.assetNumber
  1054. this.temp.deptName = this.temp.departName
  1055. this.dialogStatus = 'update'
  1056. this.dialogFormVisible = true
  1057. this.$nextTick(() => {
  1058. this.$refs['temp'].clearValidate()
  1059. })
  1060. },
  1061. // 删除加油信息
  1062. handleDieselDel(row) {
  1063. MessageBox.confirm('是否确认删除此条加油信息?', {
  1064. confirmButtonText: '确认',
  1065. cancelButtonText: '取消',
  1066. type: 'warning'
  1067. })
  1068. .then(() => {
  1069. this.requestParam.name = 'deleteDiesel'
  1070. this.requestParam.parammaps = {}
  1071. this.requestParam.parammaps['id'] = row.id
  1072. PostDataByName(this.requestParam).then(() => {
  1073. this.get_table_data()
  1074. this.dialogFormVisible = false
  1075. this.$notify({
  1076. title: '成功',
  1077. message: '删除成功',
  1078. type: 'success',
  1079. duration: 2000
  1080. })
  1081. })
  1082. })
  1083. .catch(() => {
  1084. this.$message({
  1085. type: 'info',
  1086. message: '已取消删除'
  1087. })
  1088. })
  1089. },
  1090. handleDosageRecord(row) {
  1091. this.dialogStatus = 'DosageRecord'
  1092. this.dialogFormDosageRecord = true
  1093. this.dosageRecordTemp = Object(row, {})
  1094. this.getDosageRecordList()
  1095. },
  1096. form_delete() {
  1097. this.deleteTemp = {}
  1098. this.dialogStatus = 'delete'
  1099. this.dialogFormDelete = true
  1100. },
  1101. deleteData() {
  1102. this.$refs['deleteTemp'].validate(valid => {
  1103. if (valid) {
  1104. this.requestParam.name = 'deletedatastem'
  1105. this.requestParam.parammaps = {}
  1106. this.requestParam.parammaps.pastureName = this.getdataListParm.parammaps.pastureName
  1107. this.requestParam.parammaps.codeType = 3
  1108. this.requestParam.parammaps.startTime = this.deleteTemp.startTime
  1109. this.requestParam.parammaps.stopTime = this.deleteTemp.startTime
  1110. PostDataByName(this.requestParam).then(response => {
  1111. if (response.msg == 'fail') {
  1112. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  1113. } else {
  1114. this.$notify({ title: '成功', message: '删除成功', type: 'success', duration: 2000 })
  1115. this.dialogFormDelete = false
  1116. this.get_table_data()
  1117. }
  1118. })
  1119. }
  1120. })
  1121. },
  1122. getDosageRecordList() {
  1123. this.listLoadingDosageRecord = true
  1124. this.getDosageRecordListParm.parammaps.id = this.dosageRecordTemp.oilcardId
  1125. GetDataByName(this.getDosageRecordListParm).then(response => {
  1126. this.listDosageRecord = response.data.list
  1127. this.pageNumDosageRecord = response.data.pageNum
  1128. this.pageSizeDosageRecord = response.data.pageSize
  1129. if (response.data.total) {
  1130. this.totalDosageRecord = response.data.total
  1131. }
  1132. setTimeout(() => {
  1133. this.listLoadingDosageRecord = false
  1134. }, 100)
  1135. })
  1136. }
  1137. }
  1138. }
  1139. </script>