修正
This commit is contained in:
parent
2e09cd299b
commit
9b8824842d
@ -31,6 +31,13 @@ class Xiao4rApis {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 根据字典类型查询字典数据信息
|
||||||
|
getDicts(dictType) {
|
||||||
|
return request.get({
|
||||||
|
url: '/system/dict/data/type/' + dictType,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default new Xiao4rApis()
|
export default new Xiao4rApis()
|
||||||
|
@ -1,16 +1 @@
|
|||||||
/**
|
|
||||||
* 根据字典值获取名称
|
|
||||||
* @param value
|
|
||||||
* @param options
|
|
||||||
* @returns {string}
|
|
||||||
*/
|
|
||||||
export function getDictName(value,options) {
|
|
||||||
let actions = [];
|
|
||||||
Object.keys(options).some((key) => {
|
|
||||||
if (options[key].dictValue == ('' + value)) {
|
|
||||||
actions.push(options[key].dictLabel);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
return actions.join('');
|
|
||||||
}
|
|
||||||
|
@ -105,7 +105,7 @@
|
|||||||
<el-table v-loading="loading" :data="goodsList" @selection-change="handleSelectionChange">
|
<el-table v-loading="loading" :data="goodsList" @selection-change="handleSelectionChange">
|
||||||
<el-table-column type="selection" width="55" align="center"/>
|
<el-table-column type="selection" width="55" align="center"/>
|
||||||
<el-table-column label="商品ID" align="center" prop="id" v-if="false"/>
|
<el-table-column label="商品ID" align="center" prop="id" v-if="false"/>
|
||||||
<el-table-column label="商户名称" align="center" prop="deptId" :formatter="mchFormat" width="100px"/>
|
<el-table-column label="商户名称" align="center" prop="deptId" :formatter="deptFormat" width="100px"/>
|
||||||
<el-table-column label="商品名称" align="center" prop="goodsName"/>
|
<el-table-column label="商品名称" align="center" prop="goodsName"/>
|
||||||
<el-table-column label="商品简称" align="center" prop="goodsAlias"/>
|
<el-table-column label="商品简称" align="center" prop="goodsAlias"/>
|
||||||
<el-table-column label="商品价格" align="center" prop="goodsPrice"/>
|
<el-table-column label="商品价格" align="center" prop="goodsPrice"/>
|
||||||
@ -165,10 +165,10 @@
|
|||||||
<el-form-item label="商户" prop="deptId">
|
<el-form-item label="商户" prop="deptId">
|
||||||
<el-select v-model="form.deptId" placeholder="请选择商户">
|
<el-select v-model="form.deptId" placeholder="请选择商户">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in mchOptions"
|
v-for="dict in deptOptions"
|
||||||
:key="dict.dictValue"
|
:key="dict.deptId"
|
||||||
:label="dict.dictLabel"
|
:label="dict.deptName"
|
||||||
:value="dict.dictValue"
|
:value="dict.deptId"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@ -252,7 +252,8 @@ import UploadImageMultiple from '@/components/UploadImageMultiple/index'
|
|||||||
import CommonMixin from "@/mixin/common";
|
import CommonMixin from "@/mixin/common";
|
||||||
import Editor from '@/components/Editor/index';
|
import Editor from '@/components/Editor/index';
|
||||||
import {listSpec} from "@/api/goods/goods_spec";
|
import {listSpec} from "@/api/goods/goods_spec";
|
||||||
import {getDictName} from "@/utils/utils";
|
import {getDept, listDept} from "@/api/system/dept";
|
||||||
|
import {selectDictLabel} from "@/utils/ruoyi";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "GoodsMain",
|
name: "GoodsMain",
|
||||||
@ -288,7 +289,7 @@ export default {
|
|||||||
// 商品类型字典
|
// 商品类型字典
|
||||||
goodsTypeOptions: [],
|
goodsTypeOptions: [],
|
||||||
// 商户类型字典
|
// 商户类型字典
|
||||||
mchOptions: [],
|
deptOptions: [],
|
||||||
// 查询参数
|
// 查询参数
|
||||||
queryParams: {
|
queryParams: {
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
@ -302,6 +303,7 @@ export default {
|
|||||||
goodsImg: undefined,
|
goodsImg: undefined,
|
||||||
goodsPrice: undefined,
|
goodsPrice: undefined,
|
||||||
goodsStock: undefined,
|
goodsStock: undefined,
|
||||||
|
deptId: undefined,
|
||||||
state: 0
|
state: 0
|
||||||
},
|
},
|
||||||
// 表单参数
|
// 表单参数
|
||||||
@ -318,7 +320,7 @@ export default {
|
|||||||
},
|
},
|
||||||
filters: {
|
filters: {
|
||||||
getStateName(value, options) {
|
getStateName(value, options) {
|
||||||
return getDictName(value, options)
|
return selectDictLabel(options, value);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
@ -331,9 +333,11 @@ export default {
|
|||||||
this.goodsTypeOptions = response.data;
|
this.goodsTypeOptions = response.data;
|
||||||
});
|
});
|
||||||
|
|
||||||
this.getDicts("merchant_dept").then(response => {
|
listDept().then(r => {
|
||||||
this.mchOptions = response.data;
|
|
||||||
});
|
this.deptOptions = r.data.filter(x => x.parentId === 300)
|
||||||
|
|
||||||
|
})
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
inputGoodsFaceImg(fileName) {
|
inputGoodsFaceImg(fileName) {
|
||||||
@ -354,8 +358,11 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
// 商户类型字典翻译
|
// 商户类型字典翻译
|
||||||
mchFormat(row, column) {
|
deptFormat(row, column) {
|
||||||
return this.selectDictLabel(this.mchOptions, row.deptId);
|
if (this.deptOptions.length < 1) {
|
||||||
|
return ''
|
||||||
|
}
|
||||||
|
return this.deptOptions.filter(x => x.deptId === row.deptId)[0].deptName
|
||||||
},
|
},
|
||||||
/** 查询商品信息列表 */
|
/** 查询商品信息列表 */
|
||||||
getList() {
|
getList() {
|
||||||
@ -375,6 +382,7 @@ export default {
|
|||||||
reset() {
|
reset() {
|
||||||
this.form = {
|
this.form = {
|
||||||
id: undefined,
|
id: undefined,
|
||||||
|
deptId: undefined,
|
||||||
goodsName: undefined,
|
goodsName: undefined,
|
||||||
goodsAlias: undefined,
|
goodsAlias: undefined,
|
||||||
goodsType: undefined,
|
goodsType: undefined,
|
||||||
|
@ -220,8 +220,8 @@ import {
|
|||||||
import UploadImage from '@/components/UploadImage';
|
import UploadImage from '@/components/UploadImage';
|
||||||
import CommonMixin from "@/mixin/common";
|
import CommonMixin from "@/mixin/common";
|
||||||
import Editor from '@/components/Editor';
|
import Editor from '@/components/Editor';
|
||||||
import {getDictName} from "@/utils/utils";
|
|
||||||
import {delTable} from "@/api/tool/gen";
|
import {delTable} from "@/api/tool/gen";
|
||||||
|
import {selectDictLabel} from "@/utils/ruoyi";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "News_content",
|
name: "News_content",
|
||||||
@ -283,7 +283,7 @@ export default {
|
|||||||
},
|
},
|
||||||
filters: {
|
filters: {
|
||||||
getStateName(value, options) {
|
getStateName(value, options) {
|
||||||
return getDictName(value, options)
|
return selectDictLabel(options, value)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user