|
@@ -5,7 +5,7 @@
|
|
|
<el-col :span="24" class="one">
|
|
|
<c-search :is_search="true" :fields="fields" @search="btSearch">
|
|
|
<template #type>
|
|
|
- <el-option v-for="i in typeList" :key="i.dict_value" :label="i.dict_label" :value="i.dict_value"></el-option>
|
|
|
+ <el-option v-for="i in typeList" :key="i.code" :label="i.name" :value="i.code"></el-option>
|
|
|
</template>
|
|
|
<template #is_use>
|
|
|
<el-option v-for="i in is_useList" :key="i.dict_value" :label="i.dict_label" :value="i.dict_value"></el-option>
|
|
@@ -24,9 +24,10 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { is_use, goods_type } from '@common/src/layout/site';
|
|
|
+import { is_use } from '@common/src/layout/site';
|
|
|
import { mapState, createNamespacedHelpers } from 'vuex';
|
|
|
-// const { mapActions } = createNamespacedHelpers('program');
|
|
|
+const { mapActions } = createNamespacedHelpers('goods');
|
|
|
+const { mapActions: goodsTags } = createNamespacedHelpers('goodsTags');
|
|
|
export default {
|
|
|
name: 'index',
|
|
|
props: {},
|
|
@@ -45,8 +46,8 @@ export default {
|
|
|
model: 'type',
|
|
|
type: 'select',
|
|
|
format: (i) => {
|
|
|
- let data = this.typeList.find((r) => r.dict_value == i);
|
|
|
- if (data) return data.dict_label;
|
|
|
+ let data = this.typeList.find((r) => r.code == i);
|
|
|
+ if (data) return data.name;
|
|
|
else return '暂无';
|
|
|
},
|
|
|
isSearch: true,
|
|
@@ -73,21 +74,31 @@ export default {
|
|
|
],
|
|
|
is_useList: is_use,
|
|
|
// 商品类型
|
|
|
- typeList: goods_type,
|
|
|
+ typeList: [],
|
|
|
};
|
|
|
},
|
|
|
- created() {
|
|
|
- this.search();
|
|
|
+ async created() {
|
|
|
+ await this.searchOther();
|
|
|
+ await this.search();
|
|
|
},
|
|
|
mounted() {},
|
|
|
methods: {
|
|
|
- // ...mapActions(['query', 'fetch', 'delete']),
|
|
|
+ ...mapActions(['query', 'fetch', 'delete']),
|
|
|
+ ...goodsTags({ gQuery: 'query' }),
|
|
|
async search({ skip = 0, limit = 10, ...info } = {}) {
|
|
|
- // let res = await this.query({ skip, limit, ...info, ...this.searchInfo });
|
|
|
- // if (this.$checkRes(res)) {
|
|
|
- // this.$set(this, `list`, res.data);
|
|
|
- // this.$set(this, `total`, res.total);
|
|
|
- // }
|
|
|
+ let res = await this.query({ skip, limit, ...info, ...this.searchInfo });
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ this.$set(this, `list`, res.data);
|
|
|
+ this.$set(this, `total`, res.total);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async searchOther() {
|
|
|
+ let res;
|
|
|
+ // 类型
|
|
|
+ res = await this.gQuery();
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ this.$set(this, `typeList`, res.data);
|
|
|
+ }
|
|
|
},
|
|
|
btSearch(query) {
|
|
|
this.$set(this, `searchInfo`, query);
|
|
@@ -107,8 +118,8 @@ export default {
|
|
|
},
|
|
|
// 删除信息
|
|
|
async toDel({ data }) {
|
|
|
- // let res = await this.delete(data.id);
|
|
|
- // if (this.$checkRes(res, `刪除信息成功`, `${res.errmsg}`)) this.search();
|
|
|
+ let res = await this.delete(data.id);
|
|
|
+ if (this.$checkRes(res, `刪除信息成功`, `${res.errmsg}`)) this.search();
|
|
|
},
|
|
|
},
|
|
|
computed: {
|