index.vue 47 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191
  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,postJson, 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. inputDatetime:''
  359. }
  360. },
  361. // 2-3:下拉框请求后数据加入[]
  362. getDictByName: [],
  363. findAllAssetType: [],
  364. findAllPasture: [],
  365. findAllDepart: [],
  366. findAllEmploye: [],
  367. // 2-1.请求下拉框接口
  368. requestParams: [
  369. { name: 'getDictByName', offset: 0, pagecount: 0, params: ['水表类型'] },
  370. { name: 'findAllAssetType', offset: 0, pagecount: 0, params: [] },
  371. { name: 'findAllPasture', offset: 0, pagecount: 0, returntype: 'Map', parammaps: { 'id': Cookies.get('pastureid') }},
  372. { name: 'findAllDepart', offset: 0, pagecount: 0, parammaps: { 'pastureId': Cookies.get('pastureid') }},
  373. { name: 'findAllEmploye', offset: 0, pagecount: 0, parammaps: { 'pastureId': Cookies.get('pastureid') }}
  374. ],
  375. getDepartParam: {
  376. name: 'findAllDepart', offset: 0, pagecount: 0, parammaps: { 'pastureId': Cookies.get('pastureid') }
  377. },
  378. requestFilterParams: {
  379. name: 'getWaterList',
  380. page: 1,
  381. offset: 1,
  382. pagecount: 10,
  383. returntype: 'Map',
  384. parammaps: {}
  385. },
  386. temp: {
  387. selTime: parseTime(new Date(), '{y}-{m}-{d}'),
  388. oilClass: '', // 加油工班
  389. cardNumber: '',
  390. price: '',
  391. empId: '',
  392. inputId: this.$store.state.user.employeid,
  393. departmentId: this.$store.state.user.departmentid,
  394. pastureId: this.$store.state.user.pastureid,
  395. oilAmount: '',
  396. nowPrice: '',
  397. note: '',
  398. eqId: '',
  399. eqCode: '',
  400. oilcardId: '',
  401. oilType:''
  402. },
  403. dialogFormVisible: false,
  404. dialogStatus: '',
  405. textMap: {
  406. update: '编辑',
  407. create: '新增',
  408. DosageRecord: '用量记录',
  409. delete: '删除'
  410. },
  411. dialogFormDosageRecord: false,
  412. totalDosageRecord: 0,
  413. listDosageRecord: [],
  414. listLoadingDosageRecord: false,
  415. getDosageRecordListParm: {
  416. name: 'getDieselHistory',
  417. page: 1,
  418. offset: 1,
  419. pagecount: 10,
  420. returntype: 'Map',
  421. parammaps: {}
  422. },
  423. dosageRecordTemp: {},
  424. // 校验规则
  425. rules: {
  426. cardNumber: [{ required: true, message: '必填', trigger: 'blur' }],
  427. price: [{ required: true, message: '必填', trigger: 'blur' }],
  428. oilAmount: [{ required: true, message: '必填', trigger: 'blur' }],
  429. oilType: [{ required: true, message: '必填', trigger: 'blur' }],
  430. endAmount: [{ type: 'number', required: true, validator: (rule, value, callback) => {
  431. console.log(rule, value, callback)
  432. if (!value) {
  433. callback(new Error('不能为空'))
  434. }
  435. if (value < 0) {
  436. callback(new Error('必须大于0'))
  437. } else if (value < this.temp.aAmount) {
  438. callback(new Error('必须大于上次值'))
  439. }
  440. setTimeout(() => {
  441. const re = /^\d+$/ // /^[0-9]*[1-9][0-9]*$/
  442. const rsCheck = re.test(value)
  443. if (!rsCheck) {
  444. callback(new Error('请输入整数'))
  445. } else {
  446. callback()
  447. }
  448. }, 0)
  449. }, trigger: 'blur' }],
  450. equipmentName: [{ required: true, message: '必填', trigger: 'blur' }],
  451. startTime: [{ required: true, message: '必填', trigger: 'blur' }]
  452. },
  453. MeasureListbyfilter: [],
  454. rowStyle: { maxHeight: 50 + 'px', height: 45 + 'px' },
  455. cellStyle: { padding: 0 + 'px' },
  456. buttons: [],
  457. isPercentage: false,
  458. percentage: 1,
  459. dialogFormDelete: false,
  460. deleteTemp: {},
  461. dieselTypeList:[]
  462. }
  463. },
  464. computed: {
  465. // 设置请求头
  466. headers() {
  467. return {
  468. // 设置token
  469. token: getToken()
  470. }
  471. },
  472. uploadData() {
  473. return {
  474. name: 'importDiesel',
  475. importParams: '牧场,油卡编号,设备名称,设备编号,加油日期,加油量(升),单价,录入人,加油人,加油工班,备注,柴油类型',
  476. sheetname: 'SheetJS',
  477. pastureId:Cookies.get('pastureid')
  478. }
  479. },
  480. // 设置上传地址
  481. uploadExcelUrl() {
  482. // process.env.VUE_APP_BASE_API是服务器的路径,也是axios的基本路径
  483. return process.env.VUE_APP_BASE_API + 'authdata/diese/import/excel'
  484. }
  485. },
  486. created() {
  487. const that = this
  488. GetDataByName({ 'name': 'getUserPCButtons', 'parammaps': { 'jwt_username': Cookies.get('name') }}).then(response => {
  489. that.buttons = response.data.list
  490. that.get_auto_buttons()
  491. })
  492. this.get_select_list()
  493. this.get_table_data()
  494. this.getDieselTypeList()
  495. },
  496. methods: {
  497. getDieselTypeList(){
  498. let url = 'authdata/diesel/type/list'
  499. let data = ''
  500. getJson(url, data).then(response => {
  501. if (response.code == 200) {
  502. this.dieselTypeList = response.data.diesel_type
  503. } else {
  504. this.dieselTypeList = []
  505. }
  506. })
  507. },
  508. tableSort1(column) {
  509. sortChange(column, this.list)
  510. },
  511. tableSort2(column) {
  512. sortChange(column, this.listDosageRecord)
  513. },
  514. get_auto_buttons() {
  515. // 新增
  516. const DieselAdd = 'cost:diesel:add'
  517. const isDieselAdd = checkButtons(this.$store.state.user.buttons, DieselAdd)
  518. this.isDieselAdd = isDieselAdd
  519. // 模板
  520. const RetreatMuban = 'cost:diesel:muban'
  521. const isRetreatMuban = checkButtons(this.$store.state.user.buttons, RetreatMuban)
  522. this.isRetreatMuban = isRetreatMuban
  523. // 导出
  524. const DieselExport = 'cost:diesel:export'
  525. const isDieselExport = checkButtons(this.$store.state.user.buttons, DieselExport)
  526. this.isDieselExport = isDieselExport
  527. // 导入
  528. const RetreatImport = 'cost:diesel:import'
  529. const isRetreatImport = checkButtons(this.$store.state.user.buttons, RetreatImport)
  530. this.isRetreatImport = isRetreatImport
  531. // 编辑
  532. const DieselModify = 'cost:diesel:modify'
  533. const isDieselModify = checkButtons(this.$store.state.user.buttons, DieselModify)
  534. this.isDieselModify = isDieselModify
  535. // 修改
  536. const DieselUpdate = 'cost:diesel:update'
  537. const isDieselUpdate = checkButtons(this.$store.state.user.buttons, DieselUpdate)
  538. this.isDieselUpdate = isDieselUpdate
  539. // 删除
  540. const DieselDel = 'cost:diesel:del'
  541. const isDieselDel = checkButtons(this.$store.state.user.buttons, DieselDel)
  542. this.isDieselDel = isDieselDel
  543. },
  544. isIntegerZero_(rule, value, callback) {
  545. if (value === '' || value === undefined || value === null) {
  546. return callback(new Error('输入不可以为空'))
  547. }
  548. if (value.length === 0) {
  549. return callback(new Error('输入不可以为空'))
  550. }
  551. setTimeout(() => {
  552. const re = /^\d+$/ // /^[0-9]*[1-9][0-9]*$/
  553. const rsCheck = re.test(value)
  554. if (!rsCheck) {
  555. callback(new Error('请输入整数'))
  556. } else {
  557. callback()
  558. }
  559. }, 0)
  560. },
  561. // 模糊查询-报修名称
  562. formNumberSearch(queryString, cb) {
  563. this.requestFilterParams.name = 'findAssetMainOil'
  564. this.requestFilterParams.parammaps['assetNumber'] = queryString
  565. this.requestFilterParams.parammaps['pastureId'] = Cookies.get('pastureid')
  566. this.requestFilterParams.parammaps['assetName'] = ''
  567. this.requestFilterParams.parammaps['cardCode'] = ''
  568. GetDataByName(this.requestFilterParams).then(response => {
  569. this.formNumberSearchList = response.data.list
  570. var results = queryString ? this.formNumberSearchList.filter(this.createFilter(queryString)) : this.formNumberSearchList
  571. cb(results)
  572. })
  573. },
  574. createFilter(queryString) {
  575. return returnValue => {
  576. return (
  577. returnValue.assetNumber.toLowerCase().indexOf(queryString.toLowerCase()) >= 0
  578. )
  579. }
  580. },
  581. formNameSearch(queryString, cb) {
  582. this.requestFilterParams.name = 'findAssetMainOil'
  583. this.requestFilterParams.parammaps['assetNumber'] = ''
  584. this.requestFilterParams.parammaps['pastureId'] = Cookies.get('pastureid')
  585. this.requestFilterParams.parammaps['assetName'] = queryString
  586. this.requestFilterParams.parammaps['cardCode'] = ''
  587. GetDataByName(this.requestFilterParams).then(response => {
  588. this.formNameSearchList = response.data.list
  589. var results = queryString ? this.formNameSearchList.filter(this.createFilterName(queryString)) : this.formNameSearchList
  590. cb(results)
  591. })
  592. },
  593. formCardSearch(queryString, cb) {
  594. this.requestFilterParams.name = 'findAssetMainOil'
  595. this.requestFilterParams.parammaps['assetNumber'] = ''
  596. this.requestFilterParams.parammaps['assetName'] = ''
  597. this.requestFilterParams.parammaps['cardCode'] = queryString
  598. this.requestFilterParams.parammaps['pastureId'] = Cookies.get('pastureid')
  599. GetDataByName(this.requestFilterParams).then(response => {
  600. if (response.data.list === null) {
  601. this.formNameSearchList = []
  602. } else {
  603. this.formNameSearchList = response.data.list
  604. }
  605. var results = queryString ? this.formNameSearchList.filter(this.createFilterName(queryString)) : this.formNameSearchList
  606. cb(results)
  607. })
  608. },
  609. createFilterName(queryString) {
  610. return returnValue => {
  611. return (
  612. returnValue.cardCode.toLowerCase().indexOf(queryString.toLowerCase()) >= 0
  613. )
  614. }
  615. },
  616. handleformNameSelect(item) {
  617. this.temp.assetName = item.assetName
  618. this.temp.cardNumber = item.cardCode
  619. this.temp.eqId = item.eqId
  620. this.temp.eqCode = item.eqCode
  621. this.temp.oilcardId = item.oilcardId
  622. this.temp.deptName = item.deptName
  623. this.temp.departmentId = item.deptId
  624. this.temp.pastureName = item.pastureName
  625. this.temp.price = item.price
  626. },
  627. blurformNameSelect(item) {
  628. this.temp.assetName = ''
  629. this.temp.cardNumber = ''
  630. this.temp.eqId = ''
  631. this.temp.eqCode = ''
  632. this.temp.oilcardId = ''
  633. this.temp.deptName = ''
  634. this.temp.pastureName = ''
  635. this.temp.price = ''
  636. }, // 导出
  637. handleDownload() {
  638. this.$alert('油卡正在导出中,请勿刷新或离开本页面,若导出时间过长,建议缩小导出数据范围重新导出', {})
  639. this.isPercentage = true
  640. this.percentage = 1
  641. var timer = setInterval(() => {
  642. this.percentage += 5
  643. if (this.percentage > 95) {
  644. this.percentage = 99
  645. clearInterval(timer)
  646. }
  647. this.percentage = this.percentage
  648. }, 1000)
  649. this.requestParam.name = 'getDieselList'
  650. this.requestParam.parammaps.pastureName = this.getdataListParm.parammaps.pastureName
  651. this.requestParam.parammaps.departName = this.getdataListParm.parammaps.departName
  652. this.requestParam.parammaps.startTime = this.getdataListParm.parammaps.startTime
  653. this.requestParam.parammaps.stopTime = this.getdataListParm.parammaps.stopTime
  654. GetAccount(this.requestParam).then(response => {
  655. if (response.data.list !== '') {
  656. this.percentage = 99
  657. setTimeout(() => {
  658. this.isPercentage = false
  659. }, 2000)
  660. }
  661. this.$nextTick(() => {
  662. import('@/vendor/Export2Excel').then(excel => {
  663. const list1 = response.data.list
  664. const tHeader = [
  665. '牧场', '部门', '交易时间', '车号', '加油工班', '加油工', '卡号', '卡类型', '本次加油量(升)', '本次消费金额(元)', '备注'
  666. ]
  667. const filterVal = [
  668. 'pastureName', 'departName', 'selTime', 'assetNumber', 'oilClass', 'empId', 'cardNumber', 'cardType', 'oilAmount', 'nowPrice', 'note'
  669. ]
  670. const data1 = this.formatJson(filterVal, list1)
  671. excel.export_json_to_excel({ header: tHeader, data: data1, filename: '柴油用量', autoWidth: true, bookType: 'xlsx' })
  672. })
  673. })
  674. })
  675. },
  676. handleDownloadTemp() {
  677. this.$alert('柴油模板正在导出中,请勿刷新或离开本页面,若导出时间过长,建议缩小导出数据范围重新导出', {})
  678. this.isPercentage = true
  679. this.percentage = 1
  680. var timer = setInterval(() => {
  681. this.percentage += 5
  682. if (this.percentage > 95) {
  683. this.percentage = 99
  684. clearInterval(timer)
  685. }
  686. this.percentage = this.percentage
  687. }, 1000)
  688. this.requestParam.name = 'getOilcardList'
  689. this.requestParam.parammaps.pastureName = this.getdataListParm.parammaps.pastureName
  690. GetDataByName(this.requestParam).then(response => {
  691. if (response.data.list !== '') {
  692. this.percentage = 99
  693. setTimeout(() => {
  694. this.isPercentage = false
  695. }, 2000)
  696. }
  697. this.$nextTick(() => {
  698. import('@/vendor/Export2Excel').then(excel => {
  699. let day = parseTime(new Date(), '{y}-{m}-{d}')
  700. for(let i=0;i<response.data.list.length;i++){
  701. this.$set(response.data.list[i], 'i', i+1)
  702. this.$set(response.data.list[i], 'day', day)
  703. this.$set(response.data.list[i], 'day', day)
  704. this.$set(response.data.list[i], 'name', Cookies.get('employename'))
  705. }
  706. const list1 = response.data.list
  707. console.log(list1,'list1')
  708. const tHeader = [
  709. '编号', '牧场', '油卡编号', '设备名称', '设备编号', '加油日期', '加油量(升)', '单价', '录入人', '加油人', '加油工班', '备注','柴油类型'
  710. ]
  711. const filterVal = [
  712. 'i', 'pastureName', 'cardNumber', 'assetName', 'assetNumber', 'day', '加油量(L)', '单价', 'name', '加油人', '加油工班', '备注','柴油类型'
  713. ]
  714. const data1 = this.formatJson(filterVal, list1)
  715. excel.export_json_to_excel({
  716. header: tHeader,
  717. data: data1,
  718. filename: '柴油模板',
  719. autoWidth: true,
  720. bookType: 'xlsx'
  721. })
  722. })
  723. })
  724. })
  725. },
  726. formatJson(filterVal, jsonData) {
  727. return jsonData.map(v =>
  728. filterVal.map(j => {
  729. if (j === 'timestamp') {
  730. return parseTime(v[j])
  731. } else {
  732. return v[j]
  733. }
  734. })
  735. )
  736. },
  737. // 导入
  738. beforeImportExcel(file) {
  739. /* const isExcel =
  740. file.type ===
  741. 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' */
  742. const isLt2M = file.size / 1024 / 1024 < 2
  743. /* if (!isExcel) {
  744. this.$message.error(
  745. '上传文件必须是Xlsx格式!建议先导出,再修改导出文件再导入!'
  746. )
  747. }*/
  748. if (!isLt2M) {
  749. this.$message.error('上传文件大小不能超过 2MB!')
  750. }
  751. return isLt2M
  752. },
  753. handleImportExcelSuccess(res, file) {
  754. // if (res.msg === 'ok') {
  755. if (res.msg === 'ok') {
  756. if (res.data.err_count > 0) {
  757. this.$message({
  758. title: '失败',
  759. message: '导入失败',
  760. type: 'danger',
  761. duration: 2000
  762. })
  763. this.$notify({
  764. title: '失败',
  765. message: '导入失败',
  766. type: 'danger',
  767. duration: 2000
  768. })
  769. import('@/vendor/Export2Excel').then(excel => {
  770. const list1 = res.data.result
  771. const tHeader = [
  772. '编号', '牧场', '油卡编号', '设备名称', '设备编号', '加油日期', '加油量(L)', '单价', '录入人', '加油人', '加油工班','柴油类型', '备注', '错误信息'
  773. ]
  774. const filterVal = [
  775. '编号', '牧场', '油卡编号', '设备名称', '设备编号', '加油日期', '加油量(L)', '单价', '录入人', '加油人', '加油工班','柴油类型', '备注', 'error_msg'
  776. ]
  777. const data1 = this.formatJson(filterVal, list1)
  778. excel.export_json_to_excel({
  779. header: tHeader,
  780. data: data1,
  781. filename: this.requestParam.parammaps.formType,
  782. autoWidth: true,
  783. bookType: 'xlsx'
  784. })
  785. })
  786. }else{
  787. this.$message({
  788. title: '成功',
  789. message: '导入成功',
  790. type: 'success',
  791. duration: 2000
  792. })
  793. this.$notify({
  794. title: '成功',
  795. message: '导入成功',
  796. type: 'success',
  797. duration: 2000
  798. })
  799. }
  800. } else {
  801. this.$notify({
  802. title: '失败',
  803. message: '上传失败',
  804. type: 'danger',
  805. duration: 2000
  806. })
  807. }
  808. },
  809. // 1-1: table&搜索
  810. get_table_data() {
  811. this.listLoading = true
  812. GetDataByName(this.getdataListParm).then(response => {
  813. if (response.data.list == null) {
  814. this.list = []
  815. } else {
  816. this.list = response.data.list
  817. this.pageNum = response.data.pageNum
  818. this.pageSize = response.data.pageSize
  819. if (response.data.total) {
  820. this.total = response.data.total
  821. }
  822. }
  823. setTimeout(() => {
  824. this.listLoading = false
  825. }, 100)
  826. })
  827. },
  828. // 2-2:下拉框
  829. get_select_list() {
  830. GetDataByNames(this.requestParams).then(response => {
  831. this.getDictByName = response.data.getDictByName.list
  832. this.findAllAssetType = response.data.findAllAssetType.list
  833. this.findAllPasture = response.data.findAllPasture.list
  834. this.findAllEmploye = response.data.findAllEmploye.list
  835. this.getDepartDownList()
  836. })
  837. },
  838. getDepartDownList() {
  839. GetDataByName(this.getDepartParam).then(response => {
  840. this.findAllDepart = response.data.list
  841. })
  842. },
  843. changePastureName(item) {
  844. this.getDepartParam.parammaps.pastureId = this.findAllPasture.find(obj => obj.name == item).id
  845. this.getdataListParm.parammaps.deptName = ''
  846. this.getDepartDownList()
  847. },
  848. form_search() {
  849. this.listLoading = true
  850. this.getdataListParm.offset = 1
  851. if (this.getdataListParm.parammaps.inputDatetime == null) {
  852. this.getdataListParm.parammaps.inputDatetime = ''
  853. }
  854. if (this.getdataListParm.parammaps.inputDatetime !== '' && this.getdataListParm.parammaps.inputDatetime !== null) {
  855. this.getdataListParm.parammaps.startTime = parseTime(this.getdataListParm.parammaps.inputDatetime[0], '{y}-{m}-{d}')
  856. this.getdataListParm.parammaps.stopTime = parseTime(this.getdataListParm.parammaps.inputDatetime[1], '{y}-{m}-{d}')
  857. } else {
  858. this.getdataListParm.parammaps.inputDatetime = ''
  859. this.getdataListParm.parammaps.startTime = ''
  860. this.getdataListParm.parammaps.stopTime = ''
  861. }
  862. // if (this.getdataListParm.parammaps.selTime == null) {
  863. // this.getdataListParm.parammaps.selTime = ''
  864. // }
  865. this.get_table_data()
  866. },
  867. handleModifyStatus(row, status) {
  868. this.$message({
  869. message: '操作成功',
  870. type: 'success'
  871. })
  872. row.status = status
  873. },
  874. form_reset() {
  875. this.temp.cardNumber = ''
  876. this.temp.price = ''
  877. this.temp.oilAmount = ''
  878. this.temp.assetName = ''
  879. this.temp.eqCode = ''
  880. this.temp.pastureName = ''
  881. this.temp.deptName = ''
  882. this.temp.oilClass = ''
  883. this.temp.selTime = parseTime(new Date(), '{y}-{m}-{d}')
  884. this.temp.note = ''
  885. },
  886. form_add() {
  887. console.log(this.temp.DATE)
  888. this.form_reset()
  889. this.dialogStatus = 'create'
  890. this.dialogFormVisible = true
  891. this.temp.empId = ''
  892. this.temp.departmentId = ''
  893. this.temp.oilType = ''
  894. this.temp.pastureId = this.$store.state.user.pastureid
  895. this.$nextTick(() => {
  896. this.$refs['temp'].clearValidate()
  897. })
  898. },
  899. add_dialog_save() {
  900. this.isokDisable = true
  901. setTimeout(() => {
  902. this.isokDisable = false
  903. }, 10000)
  904. this.$refs['temp'].validate(valid => {
  905. if (valid) {
  906. if(this.temp.oilType){
  907. var oilName = this.dieselTypeList.find(obj => obj.value == this.temp.oilType).label
  908. }
  909. this.$set(this.temp,'oilName',oilName)
  910. if(this.temp.eqId == '' || this.temp.eqId == null || this.temp.eqId == undefined){
  911. this.temp.eqId = 0
  912. }else{
  913. this.temp.eqId = parseFloat(this.temp.eqId)
  914. }
  915. let url = 'authdata/diese/add'
  916. let data = {
  917. pastureId:this.temp.pastureId,
  918. selTime: this.temp.selTime,
  919. oilClass:this.temp.oilClass,
  920. oilAmount: this.temp.oilAmount,
  921. eqId: this.temp.eqId,
  922. eqCode: this.temp.eqCode,
  923. departmentId: this.temp.departmentId,
  924. note: this.temp.note,
  925. nowPrice: this.temp.price * this.temp.oilAmount,
  926. oilcardId: this.temp.oilcardId,
  927. cardNumber: this.temp.cardNumber,
  928. price: this.temp.price,
  929. empId: this.temp.empId,
  930. inputId: this.temp.inputId,
  931. oilType:this.temp.oilType,
  932. oilName:this.temp.oilName,
  933. }
  934. postJson(url,data).then(response => {
  935. // ExecDataByConfig(this.postDataPramas).then(response => {
  936. if (response.msg === 'fail') {
  937. this.$notify({
  938. title: '保存失败',
  939. message: response.data,
  940. type: 'warning',
  941. duration: 2000
  942. })
  943. } else {
  944. this.get_table_data()
  945. this.dialogFormVisible = false
  946. this.$notify({
  947. title: '',
  948. message: '保存成功',
  949. type: 'success',
  950. duration: 2000
  951. })
  952. }
  953. this.isokDisable = false
  954. })
  955. }
  956. })
  957. },
  958. // 继续新增
  959. add_dialog_save_again() {
  960. this.isokDisable = true
  961. setTimeout(() => {
  962. this.isokDisable = false
  963. }, 10000)
  964. this.$refs['temp'].validate(valid => {
  965. if (valid) {
  966. if(this.temp.oilType){
  967. var oilName = this.dieselTypeList.find(obj => obj.value == this.temp.oilType).label
  968. }
  969. this.$set(this.temp,'oilName',oilName)
  970. if(this.temp.eqId == '' || this.temp.eqId == null || this.temp.eqId == undefined){
  971. this.temp.eqId = 0
  972. }else{
  973. this.temp.eqId = parseFloat(this.temp.eqId)
  974. }
  975. let url = 'authdata/diese/add'
  976. let data = {
  977. pastureId:this.temp.pastureId,
  978. selTime: this.temp.selTime,
  979. oilClass:this.temp.oilClass,
  980. oilAmount: this.temp.oilAmount,
  981. eqId: this.temp.eqId,
  982. eqCode: this.temp.eqCode,
  983. departmentId: this.temp.departmentId,
  984. note: this.temp.note,
  985. nowPrice: this.temp.price * this.temp.oilAmount,
  986. oilcardId: this.temp.oilcardId,
  987. cardNumber: this.temp.cardNumber,
  988. price: this.temp.price,
  989. empId: this.temp.empId,
  990. inputId: this.temp.inputId,
  991. oilType:this.temp.oilType,
  992. oilName:this.temp.oilName,
  993. }
  994. postJson(url,data).then(response => {
  995. if (response.msg !== 'fail') {
  996. this.form_reset()
  997. this.$nextTick(() => {
  998. this.$refs['temp'].clearValidate()
  999. })
  1000. this.$notify({
  1001. title: '成功',
  1002. message: '新增成功',
  1003. type: 'success',
  1004. duration: 2000
  1005. })
  1006. } else {
  1007. this.$notify({
  1008. title: '保存失败',
  1009. message: response.data,
  1010. type: 'warning',
  1011. duration: 2000
  1012. })
  1013. }
  1014. this.isokDisable = false
  1015. })
  1016. }
  1017. })
  1018. },
  1019. form_edit(row) {
  1020. this.temp = Object.assign({}, row) // copy obj
  1021. this.dialogStatus = 'update'
  1022. this.dialogFormVisible = true
  1023. this.$nextTick(() => {
  1024. this.$refs['temp'].clearValidate()
  1025. })
  1026. },
  1027. // 修改加油信息
  1028. edit_dialog_save() {
  1029. this.isokDisable = true
  1030. setTimeout(() => {
  1031. this.isokDisable = false
  1032. }, 10000)
  1033. this.$refs['temp'].validate(valid => {
  1034. if (valid) {
  1035. if(this.temp.oilType){
  1036. var oilName = this.dieselTypeList.find(obj => obj.value == this.temp.oilType).label
  1037. }
  1038. this.$set(this.temp,'oilName',oilName)
  1039. this.postDataPramas.common = { 'returnmap': '0' }
  1040. this.postDataPramas.data = []
  1041. this.postDataPramas.data[0] = { 'name': 'updateDieselExecData', 'type': 'e', 'parammaps': {
  1042. 'id': this.temp.id,
  1043. 'oilAmount': this.temp.oilAmount,
  1044. 'note': this.temp.note,
  1045. 'nowPrice': this.temp.price * this.temp.oilAmount,
  1046. 'price': this.temp.price,
  1047. 'oilType':this.temp.oilType,
  1048. 'oilName':this.temp.oilName,
  1049. }}
  1050. this.postDataPramas.data[1] = { 'name': 'updateOilCardLAExecData', 'type': 'e',
  1051. 'parammaps': {
  1052. 'id': this.temp.oilcardId,
  1053. 'nowPrice': this.temp.price * this.temp.oilAmount
  1054. }}
  1055. ExecDataByConfig(this.postDataPramas).then(response => {
  1056. if (response.msg === 'fail') {
  1057. this.$notify({
  1058. title: '保存失败',
  1059. message: response.data,
  1060. type: 'warning',
  1061. duration: 2000
  1062. })
  1063. } else {
  1064. this.get_table_data()
  1065. this.dialogFormVisible = false
  1066. this.$notify({
  1067. title: '',
  1068. message: '保存成功',
  1069. type: 'success',
  1070. duration: 2000
  1071. })
  1072. }
  1073. this.isokDisable = false
  1074. })
  1075. }
  1076. })
  1077. },
  1078. handleDieselUpdate(row) {
  1079. this.temp = Object.assign({}, row) // copy obj
  1080. this.temp.eqCode = this.temp.assetNumber
  1081. this.temp.deptName = this.temp.departName
  1082. this.dialogStatus = 'update'
  1083. this.dialogFormVisible = true
  1084. this.$nextTick(() => {
  1085. this.$refs['temp'].clearValidate()
  1086. })
  1087. },
  1088. // 删除加油信息
  1089. handleDieselDel(row) {
  1090. MessageBox.confirm('是否确认删除此条加油信息?', {
  1091. confirmButtonText: '确认',
  1092. cancelButtonText: '取消',
  1093. type: 'warning'
  1094. })
  1095. .then(() => {
  1096. this.requestParam.name = 'deleteDiesel'
  1097. this.requestParam.parammaps = {}
  1098. this.requestParam.parammaps['id'] = row.id
  1099. let url = 'authdata/diese/off'
  1100. let data = {
  1101. id:parseInt(row.id),
  1102. }
  1103. postJson(url,data).then(response => {
  1104. this.get_table_data()
  1105. this.dialogFormVisible = false
  1106. this.$notify({
  1107. title: '成功',
  1108. message: response.message,
  1109. type: 'success',
  1110. duration: 2000
  1111. })
  1112. })
  1113. })
  1114. .catch(() => {
  1115. this.$message({
  1116. type: 'info',
  1117. message: '已取消删除'
  1118. })
  1119. })
  1120. },
  1121. handleDosageRecord(row) {
  1122. this.dialogStatus = 'DosageRecord'
  1123. this.dialogFormDosageRecord = true
  1124. this.dosageRecordTemp = Object(row, {})
  1125. this.getDosageRecordList()
  1126. },
  1127. form_delete() {
  1128. this.deleteTemp = {}
  1129. this.dialogStatus = 'delete'
  1130. this.dialogFormDelete = true
  1131. },
  1132. deleteData() {
  1133. this.$refs['deleteTemp'].validate(valid => {
  1134. if (valid) {
  1135. this.requestParam.name = 'deletedatastem'
  1136. this.requestParam.parammaps = {}
  1137. this.requestParam.parammaps.pastureName = this.getdataListParm.parammaps.pastureName
  1138. this.requestParam.parammaps.codeType = 3
  1139. this.requestParam.parammaps.startTime = this.deleteTemp.startTime
  1140. this.requestParam.parammaps.stopTime = this.deleteTemp.startTime
  1141. PostDataByName(this.requestParam).then(response => {
  1142. if (response.msg == 'fail') {
  1143. this.$notify({ title: '保存失败', message: response.data, type: 'warning', duration: 2000 })
  1144. } else {
  1145. this.$notify({ title: '成功', message: '删除成功', type: 'success', duration: 2000 })
  1146. this.dialogFormDelete = false
  1147. this.get_table_data()
  1148. }
  1149. })
  1150. }
  1151. })
  1152. },
  1153. getDosageRecordList() {
  1154. this.listLoadingDosageRecord = true
  1155. this.getDosageRecordListParm.parammaps.id = this.dosageRecordTemp.oilcardId
  1156. GetDataByName(this.getDosageRecordListParm).then(response => {
  1157. this.listDosageRecord = response.data.list
  1158. this.pageNumDosageRecord = response.data.pageNum
  1159. this.pageSizeDosageRecord = response.data.pageSize
  1160. if (response.data.total) {
  1161. this.totalDosageRecord = response.data.total
  1162. }
  1163. setTimeout(() => {
  1164. this.listLoadingDosageRecord = false
  1165. }, 100)
  1166. })
  1167. }
  1168. }
  1169. }
  1170. </script>