|
@@ -99,6 +99,9 @@ import { mapState, createNamespacedHelpers } from 'vuex';
|
|
const { mapActions: car } = createNamespacedHelpers('car');
|
|
const { mapActions: car } = createNamespacedHelpers('car');
|
|
const { mapActions: repair } = createNamespacedHelpers('repair');
|
|
const { mapActions: repair } = createNamespacedHelpers('repair');
|
|
export default {
|
|
export default {
|
|
|
|
+ metaInfo() {
|
|
|
|
+ return { title: this.$route.meta.title };
|
|
|
|
+ },
|
|
name: 'index',
|
|
name: 'index',
|
|
props: {},
|
|
props: {},
|
|
components: {
|
|
components: {
|
|
@@ -112,23 +115,18 @@ export default {
|
|
},
|
|
},
|
|
};
|
|
};
|
|
},
|
|
},
|
|
- async created() {
|
|
|
|
- await this.search1();
|
|
|
|
- },
|
|
|
|
|
|
+ created() {},
|
|
methods: {
|
|
methods: {
|
|
...car({ newquery: 'query', newfetch: 'fetch', newdelete: 'delete', newcreate: 'create', newupdate: 'update' }),
|
|
...car({ newquery: 'query', newfetch: 'fetch', newdelete: 'delete', newcreate: 'create', newupdate: 'update' }),
|
|
...repair(['query', 'create', 'delete', 'update', 'fetch']),
|
|
...repair(['query', 'create', 'delete', 'update', 'fetch']),
|
|
//查询信息
|
|
//查询信息
|
|
- async search1() {
|
|
|
|
- console.log(this.id);
|
|
|
|
- console.log('hhh');
|
|
|
|
|
|
+ async search() {
|
|
if (this.id) {
|
|
if (this.id) {
|
|
let res = await this.newfetch(this.id);
|
|
let res = await this.newfetch(this.id);
|
|
- // let arr = await this.query({ uid: this.id });
|
|
|
|
-
|
|
|
|
|
|
+ let arr = await this.query({ uid: this.id });
|
|
if (this.$checkRes(res)) {
|
|
if (this.$checkRes(res)) {
|
|
this.$set(this, `form`, res.data);
|
|
this.$set(this, `form`, res.data);
|
|
- // this.$set(this.formData, `tableData`, arr.data);
|
|
|
|
|
|
+ this.$set(this.formData, `tableData`, arr.data);
|
|
} else {
|
|
} else {
|
|
this.$message({
|
|
this.$message({
|
|
message: res.errmsg,
|
|
message: res.errmsg,
|
|
@@ -137,28 +135,6 @@ export default {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- // async search2() {
|
|
|
|
- // if (this.id) {
|
|
|
|
- // console.log(this.id);
|
|
|
|
- // const res = await this.query(this.id);
|
|
|
|
- // console.log(res);
|
|
|
|
- // }
|
|
|
|
- // },
|
|
|
|
- //查询维修单信息
|
|
|
|
- // async search2({ data }) {
|
|
|
|
- // console.log(data);
|
|
|
|
- // if (this.id) {
|
|
|
|
- // const res = await this.fetch(this.id);
|
|
|
|
- // if (this.$checkRes(res)) {
|
|
|
|
- // this.$set(this, `formData.tableData`, res.data);
|
|
|
|
- // } else {
|
|
|
|
- // this.$message({
|
|
|
|
- // message: res.errmsg,
|
|
|
|
- // type: 'error',
|
|
|
|
- // });
|
|
|
|
- // }
|
|
|
|
- // }
|
|
|
|
- // },
|
|
|
|
//添加
|
|
//添加
|
|
addData() {
|
|
addData() {
|
|
this.formData.tableData.push({
|
|
this.formData.tableData.push({
|
|
@@ -181,18 +157,8 @@ export default {
|
|
deleteData(row, index) {
|
|
deleteData(row, index) {
|
|
this.formData.tableData.splice(index, 1);
|
|
this.formData.tableData.splice(index, 1);
|
|
},
|
|
},
|
|
- submitData(formName) {
|
|
|
|
- this.$refs[formName].validate(valid => {
|
|
|
|
- if (valid) {
|
|
|
|
- let data = this.formData.tableData;
|
|
|
|
- alert(JSON.stringify(data));
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- },
|
|
|
|
back() {
|
|
back() {
|
|
- // this.$set(this, `form`, {});
|
|
|
|
this.$router.push({ path: '/user' });
|
|
this.$router.push({ path: '/user' });
|
|
- // this.search1();
|
|
|
|
},
|
|
},
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
@@ -201,19 +167,15 @@ export default {
|
|
return this.$route.query.id;
|
|
return this.$route.query.id;
|
|
},
|
|
},
|
|
},
|
|
},
|
|
- metaInfo() {
|
|
|
|
- return { title: this.$route.meta.title };
|
|
|
|
|
|
+ watch: {
|
|
|
|
+ id: {
|
|
|
|
+ deep: true,
|
|
|
|
+ immediate: true,
|
|
|
|
+ handler(val) {
|
|
|
|
+ this.search();
|
|
|
|
+ },
|
|
|
|
+ },
|
|
},
|
|
},
|
|
- // watch: {
|
|
|
|
- // id: {
|
|
|
|
- // deep: true,
|
|
|
|
- // immediate: true,
|
|
|
|
- // handler(val) {
|
|
|
|
- // this.search1();
|
|
|
|
- // this.search2();
|
|
|
|
- // },
|
|
|
|
- // },
|
|
|
|
- // },
|
|
|
|
};
|
|
};
|
|
</script>
|
|
</script>
|
|
|
|
|