Commit 139abe39 authored by 徐一鸣's avatar 徐一鸣

服务超市服务详情修复

parent 7a8df890
......@@ -195,6 +195,17 @@ export default {
},
},
mounted() {
// 初始化购买方式
if (this.data.serviceRequestSpcs && this.data.serviceRequestSpcs.length) {
let types = Array.from(
new Set(this.data.serviceRequestSpcs.map((item) => item.type))
);
this.types = this.types.filter((item) => types.indexOf(item.value) > -1);
this.type = (this.types[0] && this.types[0].value) || 0;
}
// 初始化规格
if (this.specifications.length > 0) {
this.specification = this.specifications[0];
}
......
......@@ -24,7 +24,7 @@
<el-table
v-else-if="item.type == 'table'"
class="detail-table"
row-key="name"
row-key="rowId"
default-expand-all
:border="false"
:data="item.value.datas"
......
......@@ -111,7 +111,7 @@ export default {
name: "请求参数",
type: "table",
value: {
datas: (datas.req_fields && JSON.parse(datas.req_fields)) || [],
datas: this.getTableData(datas.req_fields),
columns: [
{
prop: "name",
......@@ -154,7 +154,7 @@ export default {
name: "响应参数",
type: "table",
value: {
datas: (datas.res_fields && JSON.parse(datas.res_fields)) || [],
datas: this.getTableData(datas.res_fields),
columns: [
{
prop: "name",
......@@ -195,6 +195,24 @@ export default {
console.log(error);
});
},
getTableData(tableStr) {
let tabledata = (tableStr && JSON.parse(tableStr)) || [];
let addId = (data, baseId = "") => {
data.forEach((item, index) => {
let rowId = baseId + (index + 1) + "";
item.rowId = rowId;
if (item.children && item.children.length) {
addId(item.children, rowId);
}
});
};
addId(tabledata);
return tabledata;
},
},
mounted() {
this.init();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment