综合办公系统
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

detail.vue 19KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550
  1. <template>
  2. <div class="app-container">
  3. <div class="header">
  4. <el-button icon="el-icon-d-arrow-left" plain type="primary" class="back" @click="goBack">返回</el-button>
  5. <h1>{{ '【' + carInfo.licensePlate + '】' }}车辆明细</h1>
  6. </div>
  7. <el-divider></el-divider>
  8. <el-descriptions class="descriptions" :column="column" border style="text-align: center;">
  9. <el-descriptions-item>
  10. <template slot="label">
  11. <svg-icon slot="prefix" icon-class="car" class="el-input__icon input-icon" />
  12. 车牌号
  13. </template>
  14. {{ carInfo.licensePlate }}
  15. </el-descriptions-item>
  16. <el-descriptions-item>
  17. <template slot="label">
  18. <svg-icon slot="prefix" icon-class="Branding" class="el-input__icon input-icon" />
  19. 品牌
  20. </template>
  21. {{ carInfo.brand }}
  22. </el-descriptions-item>
  23. <el-descriptions-item>
  24. <template slot="label">
  25. <svg-icon slot="prefix" icon-class="PhAppStoreLogoFill" class="el-input__icon input-icon" />
  26. 车型
  27. </template>
  28. {{ carInfo.series }}
  29. </el-descriptions-item>
  30. <el-descriptions-item>
  31. <template slot="label">
  32. <svg-icon slot="prefix" icon-class="cost" class="el-input__icon input-icon" />
  33. 总价(元)
  34. </template>
  35. {{ carInfo.cost }}
  36. </el-descriptions-item>
  37. <el-descriptions-item>
  38. <template slot="label">
  39. <svg-icon slot="prefix" icon-class="date" class="el-input__icon input-icon" />
  40. 上牌时间
  41. </template>
  42. {{ parseTime(carInfo.acquisitionTime, '{y}-{m}-{d}') }}
  43. </el-descriptions-item>
  44. <el-descriptions-item>
  45. <template slot="label">
  46. <i class="el-icon-user-solid"></i>
  47. 驾驶员
  48. </template>
  49. {{ carInfo.driverUser ? carInfo.driverUser.nickName : '' }}
  50. </el-descriptions-item>
  51. <el-descriptions-item>
  52. <template slot="label">
  53. <svg-icon slot="prefix" icon-class="date" class="el-input__icon input-icon" />
  54. 预计使用年限(年)
  55. </template>
  56. {{ carInfo.expectLife }}
  57. </el-descriptions-item>
  58. <el-descriptions-item>
  59. <template slot="label">
  60. <svg-icon slot="prefix" icon-class="car" class="el-input__icon input-icon" />
  61. 预计行驶里程(万千米)
  62. </template>
  63. {{ carInfo.expectKm }}
  64. </el-descriptions-item>
  65. <el-descriptions-item>
  66. <template slot="label">
  67. <svg-icon slot="prefix" icon-class="JamYelpSquare" class="el-input__icon input-icon" />
  68. 是否为租车
  69. </template>
  70. {{ carInfo.isRent == '0' ? '否' : '是' }}
  71. </el-descriptions-item>
  72. <el-descriptions-item>
  73. <template slot="label">
  74. <svg-icon slot="prefix" icon-class="TeenyiconsYenSolid" class="el-input__icon input-icon" />
  75. 单日成本(元)
  76. </template>
  77. {{ carInfo.dayCost }}
  78. </el-descriptions-item>
  79. <el-descriptions-item>
  80. <template slot="label">
  81. <svg-icon slot="prefix" icon-class="dept" class="el-input__icon input-icon" />
  82. 状态
  83. </template>
  84. {{ statusTypeText(carInfo.status) }}
  85. </el-descriptions-item>
  86. <el-descriptions-item>
  87. <template slot="label">
  88. <svg-icon slot="prefix" icon-class="remark" class="el-input__icon input-icon" />
  89. 备注
  90. </template>
  91. {{ carInfo.remark }}
  92. </el-descriptions-item>
  93. </el-descriptions>
  94. <el-divider></el-divider>
  95. <el-row :gutter="20">
  96. <!-- 费用明细 -->
  97. <el-col :span="12" :xs="24">
  98. <el-card>
  99. <div slot="header" class="clearfix">
  100. <h3>维保记录</h3>
  101. </div>
  102. <el-row :gutter="10" class="mb8">
  103. <el-col :span="1.5">
  104. <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd">新增</el-button>
  105. </el-col>
  106. <el-col :span="1.5">
  107. <el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single"
  108. @click="handleUpdate">修改</el-button>
  109. </el-col>
  110. <el-col :span="1.5">
  111. <el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple"
  112. @click="handleDelete">删除</el-button>
  113. </el-col>
  114. <el-col :span="1.5">
  115. <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport">导出</el-button>
  116. </el-col>
  117. <el-col :span="1.5">
  118. <el-button type="info" plain icon="el-icon-s-release" size="mini"@click="handleScrap">{{ scrapButtonName }}</el-button>
  119. </el-col>
  120. </el-row>
  121. <el-table v-loading="loading" :data="expenseList" @selection-change="handleSelectionChange">
  122. <el-table-column type="selection" width="55" align="center" />
  123. <el-table-column type="index" width="55" align="center" label="序号" />
  124. <el-table-column label="费用类型" align="center" prop="expenseType">
  125. <template slot-scope="scope">
  126. <el-tag :type="typeStyle(scope.row.expenseType)">{{ expenseTypeText(scope.row.expenseType) }}</el-tag>
  127. </template>
  128. </el-table-column>
  129. <el-table-column label="费用金额" align="center" prop="expense">
  130. <template slot-scope="scope">
  131. {{ scope.row.expense + '元' }}
  132. </template>
  133. </el-table-column>
  134. <el-table-column label="发生日期" align="center" prop="occurDate" width="180">
  135. <template slot-scope="scope">
  136. {{ scope.row.occurDate }}
  137. </template>
  138. </el-table-column>
  139. <el-table-column width="55" align="center" label="备注" prop="remark" />
  140. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  141. <template slot-scope="scope">
  142. <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
  143. v-hasPermi="['oa:carExpense:edit']">修改</el-button>
  144. <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
  145. v-hasPermi="['oa:carExpense:remove']">删除</el-button>
  146. </template>
  147. </el-table-column>
  148. </el-table>
  149. <pagination v-show="expenseTotal > 0" :total="expenseTotal" :page.sync="queryParams.pageNum"
  150. :limit.sync="queryParams.pageSize" @pagination="getList" />
  151. </el-card>
  152. </el-col>
  153. <el-col :span="12" :xs="24">
  154. <el-card>
  155. <div slot="header" class="clearfix">
  156. <h3>派出任务</h3>
  157. </div>
  158. <el-table v-loading="loading" :data="approvalList" @selection-change="handleSelectionChange">
  159. <el-table-column type="selection" width="55" align="center" />
  160. <el-table-column type="index" width="55" align="center" label="序号" />
  161. <el-table-column label="申请人" align="center" prop="user.nickName">
  162. <template slot-scope="scope">
  163. {{ scope.row.applierUser ? scope.row.applierUser.nickName : '' }}
  164. </template>
  165. </el-table-column>
  166. <el-table-column label="使用部门" align="center" prop="dept.deptName">
  167. <template slot-scope="scope">
  168. {{ scope.row.dept ? scope.row.dept.deptName : '' }}
  169. </template>
  170. </el-table-column>
  171. <el-table-column label="项目编号" align="center" prop="project.projectNumber">
  172. <template slot-scope="scope">
  173. {{ scope.row.project ? scope.row.project.projectNumber : '' }}
  174. </template>
  175. </el-table-column>
  176. <el-table-column label="项目名称" align="center" prop="project.projectName">
  177. <template slot-scope="scope">
  178. {{ scope.row.project ? scope.row.project.projectName : '' }}
  179. </template>
  180. </el-table-column>
  181. <el-table-column label="开始时间" align="center" prop="beginDate">
  182. <template slot-scope="scope">
  183. {{ scope.row.beginDate }}
  184. </template>
  185. </el-table-column>
  186. <el-table-column label="结束时间" align="center" prop="endDate">
  187. <template slot-scope="scope">
  188. {{ scope.row.endDate }}
  189. </template>
  190. </el-table-column>
  191. </el-table>
  192. <pagination v-show="approvalTotal > 0" :total="approvalTotal" :page.sync="queryParams.pageNum"
  193. :limit.sync="queryParams.pageSize" @pagination="getList" />
  194. </el-card>
  195. </el-col>
  196. </el-row>
  197. <!-- 添加明细 -->
  198. <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
  199. <el-form ref="expenseForm" :model="form" :rules="rules" label-width="100px">
  200. <el-form-item label="费用类型" prop="expenseType">
  201. <el-select v-model="form.expenseType" placeholder="请选择" clearable>
  202. <el-option label="保险费" value="0"></el-option>
  203. <el-option label="维修/保养费" value="1"></el-option>
  204. <el-option label="轮胎费" value="2"></el-option>
  205. </el-select>
  206. </el-form-item>
  207. <el-form-item label="费用金额" prop="expense">
  208. <el-input v-model="form.expense" placeholder="请输入费用金额" style="width:150px" /> <el-tag>元</el-tag>
  209. </el-form-item>
  210. <el-form-item label="发生日期" prop="occurDate">
  211. <el-date-picker clearable v-model="form.occurDate" type="date" value-format="yyyy-MM-dd" placeholder="请选择发生日期">
  212. </el-date-picker>
  213. </el-form-item>
  214. <el-form-item label="备注说明" prop="remark">
  215. <el-input type="textarea" v-model="form.remark" placeholder="请输入备注说明" style="width:220px" />
  216. </el-form-item>
  217. </el-form>
  218. <div slot="footer" class="dialog-footer">
  219. <el-button type="primary" @click="submitForm">确 定</el-button>
  220. <el-button @click="cancel">取 消</el-button>
  221. </div>
  222. </el-dialog>
  223. <!-- 添加或修改cmc设备报废对话框 -->
  224. <el-dialog :title="title" :visible.sync="scrapOpen" width="500px" append-to-body>
  225. <el-form ref="scrapForm" :model="scrapForm" :rules="rules" label-width="80px">
  226. <el-form-item label="原价值" prop="cost">
  227. <el-input v-model="scrapForm.cost" placeholder="请输入原价值" />
  228. </el-form-item>
  229. <el-form-item label="报废日期" prop="scrapDate">
  230. <el-date-picker clearable v-model="scrapForm.scrapDate" type="date" value-format="yyyy-MM-dd"
  231. placeholder="请选择报废日期">
  232. </el-date-picker>
  233. </el-form-item>
  234. <el-form-item label="报废原因" prop="reason">
  235. <el-input v-model="scrapForm.reason" placeholder="请输入报废原因" />
  236. </el-form-item>
  237. <el-form-item label="处理结果" prop="deal">
  238. <el-input v-model="scrapForm.deal" placeholder="请输入处理结果" />
  239. </el-form-item>
  240. <el-form-item label="备注" prop="remark">
  241. <el-input v-model="scrapForm.remark" placeholder="请输入备注" />
  242. </el-form-item>
  243. <el-form-item label="附件" prop="document">
  244. <el-input v-model="scrapForm.document" placeholder="请输入附件" />
  245. </el-form-item>
  246. </el-form>
  247. <div slot="footer" class="dialog-footer">
  248. <el-button type="primary" @click="submitScrapForm">确 定</el-button>
  249. <el-button @click="scrapCancel">取 消</el-button>
  250. </div>
  251. </el-dialog>
  252. </div>
  253. </template>
  254. <script>
  255. import { getCar } from '@/api/oa/car/car.js'
  256. import { listCarExpense, getCarExpense, delCarExpense, addCarExpense, updateCarExpense } from "@/api/oa/car/carExpense";
  257. import { listDeviceScrap, getDeviceScrap, delDeviceScrap, addDeviceScrap, updateDeviceScrap } from "@/api/oa/device/deviceScrap";
  258. import { listCarApproval } from "@/api/oa/car/carApproval";
  259. export default {
  260. data() {
  261. let validateExpense = (rule, value, callback) => {
  262. setTimeout(() => {
  263. if (!value) {
  264. return callback(new Error('请输入金额'));
  265. }
  266. if (!this.isNumber(Number(value))) {
  267. callback(new Error('请输入数字值'));
  268. } else {
  269. callback();
  270. }
  271. }, 100)
  272. }
  273. return {
  274. column: 4,
  275. carInfo: {},
  276. expenseList: [],
  277. approvalList: [],
  278. queryParams: {
  279. pageNum: 1,
  280. pageSize: 10,
  281. },
  282. expenseTotal: 0,
  283. approvalTotal: 0,
  284. multiple: true,
  285. // 选中数组
  286. ids: [],
  287. // 非单个禁用
  288. single: true,
  289. title: '',
  290. open: false,
  291. scrapOpen: false,
  292. form: {},
  293. scrapForm: {},
  294. scrapButtonName: '',
  295. rules: {
  296. expenseType: [
  297. { required: true, message: '请选择费用类型', trigger: 'change' }
  298. ],
  299. expense: [
  300. { validator: validateExpense, required: true, trigger: 'blur' },
  301. ],
  302. occurDate: [
  303. { required: true, message: '请选择发生日期', trigger: 'change' },
  304. ],
  305. },
  306. loading: false
  307. }
  308. },
  309. created() {
  310. if (this.$route.query) {
  311. getCar(this.$route.query.carId).then(res => {
  312. this.carInfo = res.data;
  313. })
  314. this.getList();
  315. this.getScrapStatus();
  316. }
  317. if (this.$store.state.app.device == 'desktop') {
  318. } else {
  319. this.column = 1
  320. }
  321. },
  322. methods: {
  323. getList() {
  324. this.queryParams.carId = this.$route.query.carId;
  325. listCarExpense(this.queryParams).then(res => {
  326. this.expenseList = res.rows;
  327. this.expenseTotal = res.total;
  328. });
  329. this.queryParams.cars = this.$route.query.carId;
  330. listCarApproval(this.queryParams).then(res => {
  331. this.approvalList = res.rows;
  332. this.approvalTotal = res.total;
  333. })
  334. },
  335. goBack() {
  336. let obj = { path: "/car/detail" }
  337. this.$tab.closeOpenPage(obj);
  338. this.$router.push({ path: '/car' });
  339. },
  340. getScrapStatus() {
  341. this.queryParams.deviceId = this.$route.query.deviceId
  342. listDeviceScrap(this.queryParams).then(res => {
  343. if (res.total > 0)
  344. this.scrapButtonName = '查看报废信息';
  345. else
  346. this.scrapButtonName = '前往报废';
  347. })
  348. },
  349. /** 搜索按钮操作 */
  350. handleQuery() {
  351. this.queryParams.pageNum = 1;
  352. this.getList();
  353. },
  354. // 多选框选中数据
  355. handleSelectionChange(selection) {
  356. this.ids = selection.map(item => item.carExpenseId)
  357. this.single = selection.length !== 1
  358. this.multiple = !selection.length
  359. },
  360. handleAdd() {
  361. this.reset();
  362. this.open = true;
  363. this.title = "添加车辆明细";
  364. },
  365. handleUpdate(row) {
  366. this.reset();
  367. const carExpenseId = row.carExpenseId || this.ids
  368. getCarExpense(carExpenseId).then(response => {
  369. this.form = response.data;
  370. this.open = true;
  371. this.title = "修改车辆明细";
  372. });
  373. },
  374. handleDelete(row) {
  375. const carExpenseIds = row.carExpenseId || this.ids;
  376. this.$modal.confirm('是否确认删除车辆费用编号为"' + carExpenseIds + '"的数据项?').then(function () {
  377. return delCarExpense(carExpenseIds);
  378. }).then(() => {
  379. this.getList();
  380. this.$modal.msgSuccess("删除成功");
  381. }).catch(() => { });
  382. },
  383. handleExport() {
  384. this.download('oa/carExpense/export', {
  385. ...this.queryParams
  386. }, `carExpense_${new Date().getTime()}.xlsx`)
  387. },
  388. // 表单重置
  389. reset() {
  390. this.form = {
  391. carExpenseId: null,
  392. carId: null,
  393. expenseType: null,
  394. expense: null,
  395. occurDate: null,
  396. remark: null,
  397. };
  398. this.resetForm("expenseForm");
  399. },
  400. submitForm() {
  401. this.$refs["expenseForm"].validate(valid => {
  402. if (valid) {
  403. this.form.carId = this.$route.query.carId
  404. if (this.form.carExpenseId != null) {
  405. updateCarExpense(this.form).then(response => {
  406. this.$modal.msgSuccess("修改成功");
  407. this.open = false;
  408. this.getList();
  409. });
  410. } else {
  411. addCarExpense(this.form).then(response => {
  412. this.$modal.msgSuccess("新增成功");
  413. this.open = false;
  414. this.getList();
  415. });
  416. }
  417. }
  418. });
  419. },
  420. cancel() {
  421. this.open = false;
  422. this.reset();
  423. },
  424. /* 报废记录 */
  425. handleScrap() {
  426. if (this.scrapButtonName == '查看报废信息')
  427. this.handleUpdateScrap();
  428. else
  429. this.handleAddScrap();
  430. },
  431. handleAddScrap() {
  432. this.resetScrap();
  433. this.scrapOpen = true;
  434. this.title = "添加设备报废信息";
  435. },
  436. handleUpdateScrap() {
  437. this.resetScrap();
  438. this.scrapForm.carId = this.$route.query.carId
  439. listDeviceScrap(this.scrapForm).then(response => {
  440. this.scrapForm = response.rows[0];
  441. this.scrapOpen = true;
  442. this.title = "修改设备报废信息";
  443. });
  444. },
  445. // 表单重置
  446. resetScrap() {
  447. this.scrapForm = {
  448. deviceScrapId: null,
  449. };
  450. this.resetForm("scrapForm");
  451. },
  452. submitScrapForm() {
  453. this.$refs["scrapForm"].validate(valid => {
  454. if (valid) {
  455. this.scrapForm.carId = this.$route.query.carId
  456. if (this.scrapForm.deviceScrapId != null) {
  457. updateDeviceScrap(this.scrapForm).then(response => {
  458. this.$modal.msgSuccess("修改成功");
  459. this.scrapOpen = false;
  460. this.getScrapList();
  461. });
  462. } else {
  463. addDeviceScrap(this.scrapForm).then(response => {
  464. this.$modal.msgSuccess("新增成功");
  465. this.scrapOpen = false;
  466. this.getScrapList();
  467. });
  468. }
  469. }
  470. });
  471. },
  472. scrapCancel() {
  473. this.scrapOpen = false;
  474. this.resetScrap();
  475. },
  476. isNumber(value) {
  477. return typeof value === 'number' && /^\d+(\.\d+)?$/.test(value);
  478. },
  479. statusTypeText(row) {
  480. if (row == '0') {
  481. return '被领用'
  482. }
  483. if (row == '1') {
  484. return '可领用'
  485. }
  486. if (row == '2') {
  487. return '维修中'
  488. }
  489. if (row == '3') {
  490. return '已停用'
  491. }
  492. if (row == '4') {
  493. return '已报废'
  494. }
  495. },
  496. expenseTypeText(row) {
  497. if (row == '0') {
  498. return '保险费'
  499. }
  500. if (row == '1') {
  501. return '维修/保养费'
  502. }
  503. if (row == '2') {
  504. return '轮胎费'
  505. }
  506. },
  507. typeStyle(row) {
  508. if (row == '0') {
  509. return 'primary'
  510. }
  511. if (row == '1') {
  512. return 'warning'
  513. }
  514. if (row == '2') {
  515. return 'success'
  516. }
  517. }
  518. },
  519. }
  520. </script>
  521. <style lang="scss" scoped>
  522. .header {
  523. position: relative;
  524. text-align: center;
  525. .back {
  526. position: absolute;
  527. left: 12px;
  528. top: -10px;
  529. }
  530. }
  531. .descriptions {
  532. padding: 20px 50px;
  533. }
  534. ::v-deep .el-descriptions-item__label.is-bordered-label {
  535. color: #121212;
  536. background: rgba($color: #46a6ff, $alpha: 0.1);
  537. width: 200px;
  538. }
  539. ::v-deep .el-descriptions .is-bordered .el-descriptions-item__cell {
  540. border: 1px solid #2d3f62;
  541. }
  542. </style>