|
@@ -1,328 +0,0 @@
|
|
|
-<template>
|
|
|
- <div id="index">
|
|
|
- <el-row>
|
|
|
- <el-col :span="24" class="main">
|
|
|
- <breadcrumb :breadcrumbTitle="this.$route.meta.title"></breadcrumb>
|
|
|
- <el-col :span="24" class="container">
|
|
|
- <el-col :span="24" class="top">
|
|
|
- <el-button type="primary" size="mini" @click="back()">返回</el-button>
|
|
|
- </el-col>
|
|
|
- <el-form ref="form" :model="form" label-width="120px">
|
|
|
- <el-col :span="6">
|
|
|
- <el-form-item label="顾客姓名">
|
|
|
- <el-input v-model="form.name" disabled></el-input>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="6">
|
|
|
- <el-form-item label="车型">
|
|
|
- <el-input v-model="form.model" disabled></el-input>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="6">
|
|
|
- <el-form-item label="车辆颜色">
|
|
|
- <el-input v-model="form.carcolor" disabled></el-input>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="6">
|
|
|
- <el-form-item label="顾客电话">
|
|
|
- <el-input v-model="form.mobile" disabled></el-input>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="6">
|
|
|
- <el-form-item label="VIN号">
|
|
|
- <el-input v-model="form.vin" disabled></el-input>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="6">
|
|
|
- <el-form-item label="车牌号">
|
|
|
- <el-input v-model="form.license" disabled></el-input>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="6">
|
|
|
- <el-form-item label="保险日期">
|
|
|
- <el-date-picker type="date" placeholder="选择日期" v-model="form.insurance" style="width: 100%;" disabled></el-date-picker>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="6">
|
|
|
- <el-form-item label="驾驶证日期">
|
|
|
- <el-date-picker type="date" placeholder="选择日期" v-model="form.drive" style="width: 100%;" disabled></el-date-picker>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="6">
|
|
|
- <el-form-item label="行驶证日期">
|
|
|
- <el-date-picker type="date" placeholder="选择日期" v-model="form.travel" style="width: 100%;" disabled></el-date-picker>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- </el-form>
|
|
|
- <el-form :model="formData" ref="formData">
|
|
|
- <el-col :span="24" class="btn">
|
|
|
- <el-button type="primary" size="medium" @click="addData">添加</el-button>
|
|
|
- <el-divider></el-divider>
|
|
|
- </el-col>
|
|
|
- <el-table :data="formData.tableData" border stripe style="width: 100%;">
|
|
|
- <el-table-column prop="name" label="维修项目名" class="tab1">
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-input v-model="scope.row.name" placeholder="维修项目名"></el-input>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="type" label="类型">
|
|
|
- <!-- <template slot-scope="scope">
|
|
|
- <el-input v-model="scope.row.type" placeholder="类型"></el-input>
|
|
|
- </template> -->
|
|
|
- <template slot-scope="scope">
|
|
|
- <!-- <el-input v-model="scope.row.type" placeholder="类型"></el-input> -->
|
|
|
- <el-select v-model="scope.row.type" placeholder="请选择">
|
|
|
- <el-option v-for="item in typeList" :key="item.value" :label="item.name" :value="item.name"> </el-option>
|
|
|
- </el-select>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="parts" label="配件">
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-input v-model="scope.row.parts" placeholder="配件"></el-input>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="create_data" label="进店时间">
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-date-picker
|
|
|
- :disabled="true"
|
|
|
- v-model="scope.row.create_data"
|
|
|
- type="date"
|
|
|
- placeholder="请选择进店时间"
|
|
|
- format="yyyy-MM-dd"
|
|
|
- value-format="yyyy-MM-dd"
|
|
|
- >
|
|
|
- </el-date-picker>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="finish_date" label="交车时间">
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-date-picker v-model="scope.row.finish_date" type="date" placeholder="请选择交车时间" format="yyyy-MM-dd" value-format="yyyy-MM-dd">
|
|
|
- </el-date-picker>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="jobdate" label="工时">
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-input v-model="scope.row.jobdate" placeholder="工时"></el-input>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="totalmoney" label="合计">
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-input v-model="scope.row.totalmoney" placeholder="合计"></el-input>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="操作">
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-button size="mini" type="primary" v-if="!scope.row.editing" @click="delete1(scope.$index, scope.row)">删除 </el-button>
|
|
|
- <el-button size="mini" type="danger" v-if="!scope.row.editing" @click="save(scope.$index, scope.row)">保存</el-button>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- </el-table>
|
|
|
- </el-form>
|
|
|
- <el-col :span="24" class="page">
|
|
|
- <el-pagination
|
|
|
- @current-change="handleCurrentChange"
|
|
|
- :current-page="currentPage"
|
|
|
- layout="total, prev, pager, next, jumper"
|
|
|
- :total="total"
|
|
|
- :page-size="pageSize"
|
|
|
- >
|
|
|
- </el-pagination>
|
|
|
- </el-col>
|
|
|
- </el-col>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- </div>
|
|
|
-</template>
|
|
|
-
|
|
|
-<script>
|
|
|
-import breadcrumb from '@c/common/breadcrumb.vue';
|
|
|
-import { type } from '@/util/type';
|
|
|
-import { mapState, createNamespacedHelpers } from 'vuex';
|
|
|
-import dataForm from '@/components/frame/form.vue';
|
|
|
-import dataTable from '@/components/frame/filter-page-table.vue';
|
|
|
-const { mapActions: car } = createNamespacedHelpers('car');
|
|
|
-const { mapActions: repair } = createNamespacedHelpers('repair');
|
|
|
-export default {
|
|
|
- metaInfo() {
|
|
|
- return { title: this.$route.meta.title };
|
|
|
- },
|
|
|
- name: 'index',
|
|
|
- props: {},
|
|
|
- components: {
|
|
|
- breadcrumb,
|
|
|
- },
|
|
|
- data: function() {
|
|
|
- return {
|
|
|
- form: {},
|
|
|
- formData: {
|
|
|
- tableData: [],
|
|
|
- },
|
|
|
- total: 0,
|
|
|
- currentPage: 0,
|
|
|
- pageSize: 7,
|
|
|
- skip: '',
|
|
|
- typeList: type,
|
|
|
- // typeList: [{ name: 'Km常规保养口' }, { name: '一般维修口' }, { name: '事故车口' }, { name: '洗车口' }, { name: '其他口' }],
|
|
|
- };
|
|
|
- },
|
|
|
- created() {
|
|
|
- this.search();
|
|
|
- },
|
|
|
- methods: {
|
|
|
- ...car({ newquery: 'query', newfetch: 'fetch', newdelete: 'delete', newcreate: 'create', newupdate: 'update' }),
|
|
|
- ...repair(['query', 'create', 'delete', 'update', 'fetch']),
|
|
|
- //查询信息
|
|
|
- async search({ skip = 0, limit = 7, ...info } = {}) {
|
|
|
- skip = this.skip;
|
|
|
- if (this.id) {
|
|
|
- let res = await this.newfetch(this.id);
|
|
|
- let arr = await this.query({ uid: this.id, skip, limit });
|
|
|
- if (this.$checkRes(res)) {
|
|
|
- this.$set(this, `form`, res.data);
|
|
|
- this.$set(this.formData, `tableData`, arr.data);
|
|
|
- this.$set(this, `total`, arr.total);
|
|
|
- } else {
|
|
|
- this.$message({
|
|
|
- message: res.errmsg,
|
|
|
- type: 'error',
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- //添加
|
|
|
- addData() {
|
|
|
- this.formData.tableData.push({
|
|
|
- edit: true,
|
|
|
- });
|
|
|
- },
|
|
|
- //保存
|
|
|
- async save(index, row) {
|
|
|
- let data = row;
|
|
|
- if (data.id) {
|
|
|
- const res = await this.update(data);
|
|
|
- if (this.$checkRes(res)) {
|
|
|
- this.$message({
|
|
|
- message: '修改成功',
|
|
|
- type: 'success',
|
|
|
- });
|
|
|
- this.search();
|
|
|
- } else {
|
|
|
- this.$message({
|
|
|
- message: res.errmsg,
|
|
|
- type: 'error',
|
|
|
- });
|
|
|
- }
|
|
|
- } else {
|
|
|
- data.uid = this.id;
|
|
|
- if (data.name || data.type || data.parts || data.finish_date || data.jobdate || data.totalmoney) {
|
|
|
- const res = await this.create(data);
|
|
|
- if (this.$checkRes(res)) {
|
|
|
- this.$message({
|
|
|
- message: '创建成功',
|
|
|
- type: 'success',
|
|
|
- });
|
|
|
- this.search();
|
|
|
- } else {
|
|
|
- this.$message({
|
|
|
- message: res.errmsg,
|
|
|
- type: 'error',
|
|
|
- });
|
|
|
- }
|
|
|
- } else {
|
|
|
- this.$message({
|
|
|
- message: '需把信息填写完全,方可保存!',
|
|
|
- type: 'warning',
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- //确认添加
|
|
|
- confirmAdd(row, formName) {
|
|
|
- this.$refs[formName].validate(valid => {
|
|
|
- if (valid) {
|
|
|
- row.edit = false;
|
|
|
- }
|
|
|
- });
|
|
|
- },
|
|
|
- //修改
|
|
|
- editData(row, index) {
|
|
|
- // console.log(row);
|
|
|
- row.edit = true;
|
|
|
- },
|
|
|
- //删除
|
|
|
- async delete1(index, row) {
|
|
|
- if (row.id) {
|
|
|
- const res = await this.delete(row.id);
|
|
|
- if (this.$checkRes(res)) {
|
|
|
- this.$message({
|
|
|
- message: '删除成功',
|
|
|
- type: 'success',
|
|
|
- });
|
|
|
- this.search();
|
|
|
- } else {
|
|
|
- this.$message({
|
|
|
- message: res.errmsg,
|
|
|
- type: 'error',
|
|
|
- });
|
|
|
- }
|
|
|
- } else {
|
|
|
- this.formData.tableData.splice(index, 1);
|
|
|
- }
|
|
|
- },
|
|
|
- back() {
|
|
|
- this.$router.push({ path: '/user' });
|
|
|
- },
|
|
|
- handleCurrentChange(currentPage) {
|
|
|
- this.$set(this, `skip`, (currentPage - 1) * this.pageSize);
|
|
|
- this.search();
|
|
|
- },
|
|
|
- },
|
|
|
- computed: {
|
|
|
- ...mapState(['user']),
|
|
|
- id() {
|
|
|
- return this.$route.query.id;
|
|
|
- },
|
|
|
- },
|
|
|
- // watch: {
|
|
|
- // id: {
|
|
|
- // deep: true,
|
|
|
- // immediate: true,
|
|
|
- // handler(val) {
|
|
|
- // this.search();
|
|
|
- // },
|
|
|
- // },
|
|
|
- // },
|
|
|
-};
|
|
|
-</script>
|
|
|
-
|
|
|
-<style lang="less" scoped>
|
|
|
-/deep/.btn {
|
|
|
- display: block;
|
|
|
- text-align: right;
|
|
|
-}
|
|
|
-/deep/.el-table th.is-leaf {
|
|
|
- text-align: center;
|
|
|
-}
|
|
|
-/deep/.el-form-item--small.el-form-item {
|
|
|
- padding-right: 0;
|
|
|
- margin-right: 0;
|
|
|
- margin-top: 10px;
|
|
|
-}
|
|
|
-/deep/.el-table .cell {
|
|
|
- text-align: center;
|
|
|
-}
|
|
|
-// /deep/.el-form-item--small.el-form-item{
|
|
|
-// margin-bottom: 0px;
|
|
|
-// }
|
|
|
-// .tab1 {
|
|
|
-// text-align: center;
|
|
|
-// }
|
|
|
-.top {
|
|
|
- text-align: right;
|
|
|
- margin: 15px 0;
|
|
|
-}
|
|
|
-.page {
|
|
|
- text-align: center;
|
|
|
- padding: 15px 0;
|
|
|
-}
|
|
|
-</style>
|