调整界面
This commit is contained in:
parent
99a47de624
commit
5acdbf1c38
52
stdiet-ui/src/components/AutoHideInfo/index.vue
Normal file
52
stdiet-ui/src/components/AutoHideInfo/index.vue
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
<template>
|
||||||
|
<div class="autohideinfo_wrapper">
|
||||||
|
<div v-for="item in mData" :key="item">
|
||||||
|
{{ item }}
|
||||||
|
</div>
|
||||||
|
<div v-if="showMore">
|
||||||
|
<div>...</div>
|
||||||
|
<el-popover placement="top-start" width="200" popper-class="autohideinfo_detial" trigger="hover">
|
||||||
|
<div v-for="item in data" :key="item">{{ item }}</div>
|
||||||
|
<el-button type="text" slot="reference">详情</el-button>
|
||||||
|
</el-popover>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: "AutoHideInfo",
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
mData: [],
|
||||||
|
showMore: false,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
data: {
|
||||||
|
type: Array,
|
||||||
|
default: [],
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
data: function (val, oldVal) {
|
||||||
|
if (val) {
|
||||||
|
this.showMore = val.length > 3;
|
||||||
|
this.mData = val.slice(0, 3);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.autohideinfo_wrapper {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.autohideinfo_detial {
|
||||||
|
max-height: 240px;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
</style>
|
@ -1,6 +1,12 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
|
<el-form
|
||||||
|
:model="queryParams"
|
||||||
|
ref="queryForm"
|
||||||
|
:inline="true"
|
||||||
|
v-show="showSearch"
|
||||||
|
label-width="68px"
|
||||||
|
>
|
||||||
<el-form-item label="食材名称" prop="name">
|
<el-form-item label="食材名称" prop="name">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="queryParams.name"
|
v-model="queryParams.name"
|
||||||
@ -11,7 +17,12 @@
|
|||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="食材类别" prop="type">
|
<el-form-item label="食材类别" prop="type">
|
||||||
<el-select v-model="queryParams.type" placeholder="请选择食材类别" clearable size="small">
|
<el-select
|
||||||
|
v-model="queryParams.type"
|
||||||
|
placeholder="请选择食材类别"
|
||||||
|
clearable
|
||||||
|
size="small"
|
||||||
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in typeOptions"
|
v-for="dict in typeOptions"
|
||||||
:key="dict.dictValue"
|
:key="dict.dictValue"
|
||||||
@ -21,7 +32,12 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="地域" prop="area">
|
<el-form-item label="地域" prop="area">
|
||||||
<el-select v-model="queryParams.area" placeholder="请选择地域" clearable size="small">
|
<el-select
|
||||||
|
v-model="queryParams.area"
|
||||||
|
placeholder="请选择地域"
|
||||||
|
clearable
|
||||||
|
size="small"
|
||||||
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in areaOptions"
|
v-for="dict in areaOptions"
|
||||||
:key="dict.dictValue"
|
:key="dict.dictValue"
|
||||||
@ -31,37 +47,60 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="忌口人群" prop="notRecIds">
|
<el-form-item label="忌口人群" prop="notRecIds">
|
||||||
<el-select v-model="queryParams.notRecIds" multiple placeholder="请选择体征">
|
<el-select
|
||||||
|
v-model="queryParams.notRecIds"
|
||||||
|
multiple
|
||||||
|
placeholder="请选择体征"
|
||||||
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in physicalSignsOptions"
|
v-for="dict in physicalSignsOptions"
|
||||||
:key="dict.dictValue"
|
:key="dict.dictValue"
|
||||||
:label="dict.dictLabel"
|
:label="dict.dictLabel"
|
||||||
:value="dict.dictValue">
|
:value="dict.dictValue"
|
||||||
|
>
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="推荐人群" prop="recIds">
|
<el-form-item label="推荐人群" prop="recIds">
|
||||||
<el-select v-model="queryParams.recIds" multiple placeholder="请选择体征">
|
<el-select
|
||||||
|
v-model="queryParams.recIds"
|
||||||
|
multiple
|
||||||
|
placeholder="请选择体征"
|
||||||
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in physicalSignsOptions"
|
v-for="dict in physicalSignsOptions"
|
||||||
:key="dict.dictValue"
|
:key="dict.dictValue"
|
||||||
:label="dict.dictLabel"
|
:label="dict.dictLabel"
|
||||||
:value="dict.dictValue">
|
:value="dict.dictValue"
|
||||||
|
>
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="审核状态" prop="reviewStatus">
|
<el-form-item label="审核状态" prop="reviewStatus">
|
||||||
<el-select v-model="queryParams.reviewStatus" placeholder="请选择审核状态"
|
<el-select
|
||||||
clearable>
|
v-model="queryParams.reviewStatus"
|
||||||
<el-option v-for="dict in reviewStatusOptions"
|
placeholder="请选择审核状态"
|
||||||
|
clearable
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="dict in reviewStatusOptions"
|
||||||
:key="dict.dictValue"
|
:key="dict.dictValue"
|
||||||
:label="dict.dictLabel"
|
:label="dict.dictLabel"
|
||||||
:value="dict.dictValue"/>
|
:value="dict.dictValue"
|
||||||
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
<el-button
|
||||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
type="cyan"
|
||||||
|
icon="el-icon-search"
|
||||||
|
size="mini"
|
||||||
|
@click="handleQuery"
|
||||||
|
>搜索</el-button
|
||||||
|
>
|
||||||
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
|
||||||
|
>重置</el-button
|
||||||
|
>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
@ -76,28 +115,6 @@
|
|||||||
>新增
|
>新增
|
||||||
</el-button>
|
</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<!-- <el-col :span="1.5">-->
|
|
||||||
<!-- <el-button-->
|
|
||||||
<!-- type="success"-->
|
|
||||||
<!-- icon="el-icon-edit"-->
|
|
||||||
<!-- size="mini"-->
|
|
||||||
<!-- :disabled="single"-->
|
|
||||||
<!-- @click="handleUpdate"-->
|
|
||||||
<!-- v-hasPermi="['custom:ingredient:edit']"-->
|
|
||||||
<!-- >修改-->
|
|
||||||
<!-- </el-button>-->
|
|
||||||
<!-- </el-col>-->
|
|
||||||
<!-- <el-col :span="1.5">-->
|
|
||||||
<!-- <el-button-->
|
|
||||||
<!-- type="danger"-->
|
|
||||||
<!-- icon="el-icon-delete"-->
|
|
||||||
<!-- size="mini"-->
|
|
||||||
<!-- :disabled="multiple"-->
|
|
||||||
<!-- @click="handleDelete"-->
|
|
||||||
<!-- v-hasPermi="['custom:ingredient:remove']"-->
|
|
||||||
<!-- >删除-->
|
|
||||||
<!-- </el-button>-->
|
|
||||||
<!-- </el-col>-->
|
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
type="warning"
|
type="warning"
|
||||||
@ -108,31 +125,92 @@
|
|||||||
>导出
|
>导出
|
||||||
</el-button>
|
</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
<right-toolbar
|
||||||
|
:showSearch.sync="showSearch"
|
||||||
|
@queryTable="getList"
|
||||||
|
></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-table v-loading="loading" :data="ingredientList" @selection-change="handleSelectionChange">
|
<el-table
|
||||||
<!-- <el-table-column type="selection" width="55" align="center" />-->
|
v-loading="loading"
|
||||||
<!-- <el-table-column label="id" align="center" prop="id" />-->
|
:data="ingredientList"
|
||||||
<el-table-column label="审核状态" align="center">
|
@selection-change="handleSelectionChange"
|
||||||
|
>
|
||||||
|
<el-table-column label="审核状态" align="center" fixed="left" width="80">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-tag
|
<el-tag
|
||||||
:type="scope.row.reviewStatus === 'yes' ? 'success' : 'danger'"
|
:type="scope.row.reviewStatus === 'yes' ? 'success' : 'danger'"
|
||||||
disable-transitions>
|
disable-transitions
|
||||||
{{scope.row.reviewStatus === 'yes' ? '已审核':'未审核'}}
|
>
|
||||||
|
{{ scope.row.reviewStatus === "yes" ? "已审核" : "未审核" }}
|
||||||
</el-tag>
|
</el-tag>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="食材名称" align="center" prop="name"/>
|
<el-table-column
|
||||||
<el-table-column label="食材类别" align="center" prop="type" :formatter="typeFormat"/>
|
label="食材名称"
|
||||||
<el-table-column label="蛋白质比例(100g)" width="124" align="center" prop="proteinRatio"/>
|
align="center"
|
||||||
<el-table-column label="脂肪比例(100g)" width="120" align="center" prop="fatRatio"/>
|
prop="name"
|
||||||
<el-table-column label="碳水比例(100g)" width="120" align="center" prop="carbonRatio"/>
|
fixed="left"
|
||||||
<el-table-column label="地域" align="center" prop="area" :formatter="areaFormat"/>
|
width="120"
|
||||||
<el-table-column label="忌口人群" align="center" prop="notRec"/>
|
/>
|
||||||
<el-table-column label="推荐人群" align="center" prop="rec"/>
|
<el-table-column
|
||||||
|
label="食材类别"
|
||||||
|
align="center"
|
||||||
|
prop="type"
|
||||||
|
width="120"
|
||||||
|
:formatter="typeFormat"
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
label="蛋白质比例(100g)"
|
||||||
|
width="128"
|
||||||
|
align="center"
|
||||||
|
prop="proteinRatio"
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
label="脂肪比例(100g)"
|
||||||
|
width="120"
|
||||||
|
align="center"
|
||||||
|
prop="fatRatio"
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
label="碳水比例(100g)"
|
||||||
|
width="120"
|
||||||
|
align="center"
|
||||||
|
prop="carbonRatio"
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
label="地域"
|
||||||
|
align="center"
|
||||||
|
prop="area"
|
||||||
|
:formatter="areaFormat"
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
label="忌口人群"
|
||||||
|
align="center"
|
||||||
|
prop="notRec"
|
||||||
|
width="120"
|
||||||
|
>
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<div v-if="scope.row.notRec">
|
||||||
|
<autohideinfo :data="scope.row.notRec.split(',')" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="推荐人群" align="center" prop="rec" width="120">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<div v-if="scope.row.rec">
|
||||||
|
<autohideinfo :data="scope.row.rec.split(',')" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column label="备注" align="center" prop="remark" />
|
<el-table-column label="备注" align="center" prop="remark" />
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
<el-table-column
|
||||||
|
fixed="right"
|
||||||
|
label="操作"
|
||||||
|
width="180"
|
||||||
|
align="center"
|
||||||
|
class-name="small-padding fixed-width"
|
||||||
|
>
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button
|
<el-button
|
||||||
size="mini"
|
size="mini"
|
||||||
@ -172,20 +250,40 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="蛋白质比例" prop="proteinRatio" label-width="90px">
|
<el-form-item
|
||||||
<el-input v-model="form.proteinRatio" placeholder="请输入蛋白质比例" style="width: 150px"/>
|
label="蛋白质比例"
|
||||||
|
prop="proteinRatio"
|
||||||
|
label-width="90px"
|
||||||
|
>
|
||||||
|
<el-input
|
||||||
|
v-model="form.proteinRatio"
|
||||||
|
placeholder="请输入蛋白质比例"
|
||||||
|
style="width: 150px"
|
||||||
|
/>
|
||||||
/100g
|
/100g
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="脂肪比例" prop="fatRatio" label-width="90px">
|
<el-form-item label="脂肪比例" prop="fatRatio" label-width="90px">
|
||||||
<el-input v-model="form.fatRatio" placeholder="请输入脂肪比例" style="width: 150px"/>
|
<el-input
|
||||||
|
v-model="form.fatRatio"
|
||||||
|
placeholder="请输入脂肪比例"
|
||||||
|
style="width: 150px"
|
||||||
|
/>
|
||||||
/100g
|
/100g
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="碳水比例" prop="carbonRatio" label-width="90px">
|
<el-form-item
|
||||||
<el-input v-model="form.carbonRatio" placeholder="请输入碳水比例" style="width: 150px"/>
|
label="碳水比例"
|
||||||
|
prop="carbonRatio"
|
||||||
|
label-width="90px"
|
||||||
|
>
|
||||||
|
<el-input
|
||||||
|
v-model="form.carbonRatio"
|
||||||
|
placeholder="请输入碳水比例"
|
||||||
|
style="width: 150px"
|
||||||
|
/>
|
||||||
/100g
|
/100g
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
@ -215,42 +313,61 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="24">
|
<el-col :span="24">
|
||||||
<el-form-item label="忌口人群" label-width="90px">
|
<el-form-item label="忌口人群" label-width="90px">
|
||||||
<el-select v-model="form.notRecIds" multiple placeholder="请选择体征">
|
<el-select
|
||||||
|
v-model="form.notRecIds"
|
||||||
|
multiple
|
||||||
|
placeholder="请选择体征"
|
||||||
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in physicalSignsOptions"
|
v-for="dict in physicalSignsOptions"
|
||||||
:key="dict.dictValue"
|
:key="dict.dictValue"
|
||||||
:label="dict.dictLabel"
|
:label="dict.dictLabel"
|
||||||
:value="dict.dictValue">
|
:value="dict.dictValue"
|
||||||
|
>
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="推荐人群" label-width="90px">
|
<el-form-item label="推荐人群" label-width="90px">
|
||||||
<el-select v-model="form.recIds" multiple placeholder="请选择体征">
|
<el-select
|
||||||
|
v-model="form.recIds"
|
||||||
|
multiple
|
||||||
|
placeholder="请选择体征"
|
||||||
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in physicalSignsOptions"
|
v-for="dict in physicalSignsOptions"
|
||||||
:key="dict.dictValue"
|
:key="dict.dictValue"
|
||||||
:label="dict.dictLabel"
|
:label="dict.dictLabel"
|
||||||
:value="dict.dictValue">
|
:value="dict.dictValue"
|
||||||
|
>
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="审核状态" prop="reviewStatus">
|
<el-form-item label="审核状态" prop="reviewStatus">
|
||||||
<el-select v-model="form.reviewStatus" placeholder="请选择审核状态"
|
<el-select
|
||||||
clearable>
|
v-model="form.reviewStatus"
|
||||||
<el-option v-for="dict in reviewStatusOptions"
|
placeholder="请选择审核状态"
|
||||||
|
clearable
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="dict in reviewStatusOptions"
|
||||||
:key="dict.dictValue"
|
:key="dict.dictValue"
|
||||||
:label="dict.dictLabel"
|
:label="dict.dictLabel"
|
||||||
:value="dict.dictValue"/>
|
:value="dict.dictValue"
|
||||||
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="24">
|
<el-col :span="24">
|
||||||
<el-form-item label="备注" prop="remark" label-width="90px">
|
<el-form-item label="备注" prop="remark" label-width="90px">
|
||||||
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容"/>
|
<el-input
|
||||||
|
v-model="form.remark"
|
||||||
|
type="textarea"
|
||||||
|
placeholder="请输入内容"
|
||||||
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-form>
|
</el-form>
|
||||||
@ -270,13 +387,18 @@
|
|||||||
exportIngredient,
|
exportIngredient,
|
||||||
getIngredient,
|
getIngredient,
|
||||||
listIngredient,
|
listIngredient,
|
||||||
updateIngredient
|
updateIngredient,
|
||||||
} from "@/api/custom/ingredient";
|
} from "@/api/custom/ingredient";
|
||||||
|
|
||||||
|
import AutoHideInfo from "@/components/AutoHideInfo";
|
||||||
|
|
||||||
import { listPhysicalSigns } from "@/api/custom/physicalSigns";
|
import { listPhysicalSigns } from "@/api/custom/physicalSigns";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Ingredient",
|
name: "Ingredient",
|
||||||
|
components: {
|
||||||
|
autohideinfo: AutoHideInfo,
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
// 遮罩层
|
// 遮罩层
|
||||||
@ -314,37 +436,37 @@
|
|||||||
area: null,
|
area: null,
|
||||||
notRecIds: null,
|
notRecIds: null,
|
||||||
recIds: null,
|
recIds: null,
|
||||||
reviewStatus: null
|
reviewStatus: null,
|
||||||
},
|
},
|
||||||
// 表单参数
|
// 表单参数
|
||||||
form: {},
|
form: {},
|
||||||
// 表单校验
|
// 表单校验
|
||||||
rules: {}
|
rules: {},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.getList();
|
this.getList();
|
||||||
this.getDicts("cus_ing_type").then(response => {
|
this.getDicts("cus_ing_type").then((response) => {
|
||||||
this.typeOptions = response.data;
|
this.typeOptions = response.data;
|
||||||
});
|
});
|
||||||
this.getDicts("cus_area").then(response => {
|
this.getDicts("cus_area").then((response) => {
|
||||||
this.areaOptions = response.data;
|
this.areaOptions = response.data;
|
||||||
});
|
});
|
||||||
this.getDicts("cus_review_status").then(response => {
|
this.getDicts("cus_review_status").then((response) => {
|
||||||
this.reviewStatusOptions = response.data;
|
this.reviewStatusOptions = response.data;
|
||||||
})
|
});
|
||||||
listPhysicalSigns().then(response => {
|
listPhysicalSigns().then((response) => {
|
||||||
this.physicalSignsOptions = response.rows.map(obj => ({
|
this.physicalSignsOptions = response.rows.map((obj) => ({
|
||||||
dictLabel: obj.name,
|
dictLabel: obj.name,
|
||||||
dictValue: obj.id
|
dictValue: obj.id,
|
||||||
}))
|
}));
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
/** 查询食材列表 */
|
/** 查询食材列表 */
|
||||||
getList() {
|
getList() {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
listIngredient(this.queryParams).then(response => {
|
listIngredient(this.queryParams).then((response) => {
|
||||||
this.ingredientList = response.rows;
|
this.ingredientList = response.rows;
|
||||||
this.total = response.total;
|
this.total = response.total;
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
@ -379,7 +501,7 @@
|
|||||||
createBy: null,
|
createBy: null,
|
||||||
createTime: null,
|
createTime: null,
|
||||||
updateBy: null,
|
updateBy: null,
|
||||||
updateTime: null
|
updateTime: null,
|
||||||
};
|
};
|
||||||
this.resetForm("form");
|
this.resetForm("form");
|
||||||
},
|
},
|
||||||
@ -395,9 +517,9 @@
|
|||||||
},
|
},
|
||||||
// 多选框选中数据
|
// 多选框选中数据
|
||||||
handleSelectionChange(selection) {
|
handleSelectionChange(selection) {
|
||||||
this.ids = selection.map(item => item.id)
|
this.ids = selection.map((item) => item.id);
|
||||||
this.single = selection.length !== 1
|
this.single = selection.length !== 1;
|
||||||
this.multiple = !selection.length
|
this.multiple = !selection.length;
|
||||||
},
|
},
|
||||||
/** 新增按钮操作 */
|
/** 新增按钮操作 */
|
||||||
handleAdd() {
|
handleAdd() {
|
||||||
@ -408,21 +530,39 @@
|
|||||||
/** 修改按钮操作 */
|
/** 修改按钮操作 */
|
||||||
handleUpdate(row) {
|
handleUpdate(row) {
|
||||||
this.reset();
|
this.reset();
|
||||||
const id = row.id || this.ids
|
const id = row.id || this.ids;
|
||||||
getIngredient(id).then(response => {
|
getIngredient(id).then((response) => {
|
||||||
this.form = response.data;
|
this.form = response.data;
|
||||||
this.form.notRecIds = this.form.rec ? this.form.rec.split(',').map(label => this.physicalSignsOptions.find(pObj => pObj.dictLabel === label).dictValue) : [];
|
this.form.notRecIds = this.form.rec
|
||||||
this.form.recIds = this.form.notRec ? this.form.notRec.split(',').map(label => this.physicalSignsOptions.find(pObj => pObj.dictLabel === label).dictValue) : [];
|
? this.form.rec
|
||||||
|
.split(",")
|
||||||
|
.map(
|
||||||
|
(label) =>
|
||||||
|
this.physicalSignsOptions.find(
|
||||||
|
(pObj) => pObj.dictLabel === label
|
||||||
|
).dictValue
|
||||||
|
)
|
||||||
|
: [];
|
||||||
|
this.form.recIds = this.form.notRec
|
||||||
|
? this.form.notRec
|
||||||
|
.split(",")
|
||||||
|
.map(
|
||||||
|
(label) =>
|
||||||
|
this.physicalSignsOptions.find(
|
||||||
|
(pObj) => pObj.dictLabel === label
|
||||||
|
).dictValue
|
||||||
|
)
|
||||||
|
: [];
|
||||||
this.open = true;
|
this.open = true;
|
||||||
this.title = "修改食材";
|
this.title = "修改食材";
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
/** 提交按钮 */
|
/** 提交按钮 */
|
||||||
submitForm() {
|
submitForm() {
|
||||||
this.$refs["form"].validate(valid => {
|
this.$refs["form"].validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (this.form.id != null) {
|
if (this.form.id != null) {
|
||||||
updateIngredient(this.form).then(response => {
|
updateIngredient(this.form).then((response) => {
|
||||||
if (response.code === 200) {
|
if (response.code === 200) {
|
||||||
this.msgSuccess("修改成功");
|
this.msgSuccess("修改成功");
|
||||||
this.open = false;
|
this.open = false;
|
||||||
@ -430,7 +570,7 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
addIngredient(this.form).then(response => {
|
addIngredient(this.form).then((response) => {
|
||||||
if (response.code === 200) {
|
if (response.code === 200) {
|
||||||
this.msgSuccess("新增成功");
|
this.msgSuccess("新增成功");
|
||||||
this.open = false;
|
this.open = false;
|
||||||
@ -447,29 +587,33 @@
|
|||||||
this.$confirm('是否确认删除食材编号为"' + ids + '"的数据项?', "警告", {
|
this.$confirm('是否确认删除食材编号为"' + ids + '"的数据项?', "警告", {
|
||||||
confirmButtonText: "确定",
|
confirmButtonText: "确定",
|
||||||
cancelButtonText: "取消",
|
cancelButtonText: "取消",
|
||||||
type: "warning"
|
type: "warning",
|
||||||
}).then(function () {
|
})
|
||||||
|
.then(function () {
|
||||||
return delIngredient(ids);
|
return delIngredient(ids);
|
||||||
}).then(() => {
|
})
|
||||||
|
.then(() => {
|
||||||
this.getList();
|
this.getList();
|
||||||
this.msgSuccess("删除成功");
|
this.msgSuccess("删除成功");
|
||||||
}).catch(function () {
|
})
|
||||||
});
|
.catch(function () {});
|
||||||
},
|
},
|
||||||
/** 导出按钮操作 */
|
/** 导出按钮操作 */
|
||||||
handleExport() {
|
handleExport() {
|
||||||
const queryParams = this.queryParams;
|
const queryParams = this.queryParams;
|
||||||
this.$confirm('是否确认导出所有食材数据项?', "警告", {
|
this.$confirm("是否确认导出所有食材数据项?", "警告", {
|
||||||
confirmButtonText: "确定",
|
confirmButtonText: "确定",
|
||||||
cancelButtonText: "取消",
|
cancelButtonText: "取消",
|
||||||
type: "warning"
|
type: "warning",
|
||||||
}).then(function () {
|
})
|
||||||
|
.then(function () {
|
||||||
return exportIngredient(queryParams);
|
return exportIngredient(queryParams);
|
||||||
}).then(response => {
|
})
|
||||||
|
.then((response) => {
|
||||||
this.download(response.msg);
|
this.download(response.msg);
|
||||||
}).catch(function () {
|
})
|
||||||
});
|
.catch(function () {});
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user