运检食堂代码修改2
This commit is contained in:
parent
6b27e95359
commit
f4dc839318
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<div class="form-file-wrap" >
|
||||
<div class="form-file-content" v-if="fileObj && (fileObj[nameField]||fileObj[pathField])" @click="handlePictureCardPreview">
|
||||
<el-image v-if="getFileClass == 'icon-PNG'" class="file-img" :src="prefix_url + fileObj.url" :preview-src-list="[fileObj.url]"> </el-image>
|
||||
<el-image v-if="getFileClass == 'icon-PNG'" class="file-img" :src="prefix_url + fileObj.url" :preview-src-list="[prefix_url + fileObj.url]"> </el-image>
|
||||
<i v-if="getFileClass != 'icon-PNG'" class="iconfont file-icon" :class="getFileClass" ></i> <!--<svg-icon style="" icon-class="pdf" />-->
|
||||
<div class="file-name outer" :title="fileObj[nameField]">{{fileObj[nameField]}}</div>
|
||||
<!-- <span class="file-btn iconfont icon-ic_show" v-if="!isDelBtn" title="在线预览"></span> -->
|
||||
|
|
@ -132,8 +132,8 @@ import { fileSuffixType, isImageForFileName, getFileName } from '@/utils/yjCante
|
|||
return
|
||||
}
|
||||
window.open(this.fileObj[this.urlPathField], '_blank')
|
||||
return
|
||||
}
|
||||
|
||||
// this.dialogImageUrl = this.fileObj.url;
|
||||
// this.dialogVisible = true
|
||||
},
|
||||
|
|
|
|||
|
|
@ -206,6 +206,14 @@
|
|||
this.$emit('input', newData)
|
||||
this.$emit('afterFileChanged', {})
|
||||
},
|
||||
// 清除组件中已上传的文件 仅可以使用于限制上传一个文件的情况
|
||||
clearFile(indexx){
|
||||
const newData = [...this.computedListData]
|
||||
newData.splice(indexx, 1)
|
||||
this.fileList = newData
|
||||
this.$emit('input', newData)
|
||||
this.$emit('afterFileChanged', {})
|
||||
},
|
||||
// 删除文件 -- 用不到
|
||||
handleRemove(file, fileList) {
|
||||
this.fileList = fileList
|
||||
|
|
|
|||
|
|
@ -22,12 +22,8 @@
|
|||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="选择食堂:" prop="carteenId" label-width="120px">
|
||||
<el-select v-model="queryParams.carteenId" placeholder="请选择食堂" clearable filterable >
|
||||
<el-option
|
||||
v-for="item in canteenList"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id">
|
||||
<el-select v-model="queryParams.carteenId" placeholder="请选择食堂" clearable filterable>
|
||||
<el-option v-for="item in canteenList" :key="item.id" :label="item.name" :value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
|
@ -40,7 +36,8 @@
|
|||
<el-table v-loading="loading" :data="carteList" @selection-change="handleSelectionChange" class="tableContent">
|
||||
<el-table-column label="图片" align="center" prop="pic">
|
||||
<template slot-scope="scope">
|
||||
<image-preview :src="$store.state.yjUser.configItem.file_server_address + scope.row.pic" :width="50" :height="50"/>
|
||||
<image-preview :src="$store.state.yjUser.configItem.file_server_address + scope.row.pic" :width="50"
|
||||
:height="50" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="名称" align="center" prop="name" />
|
||||
|
|
@ -49,7 +46,7 @@
|
|||
<el-table-column label="菜品" align="center" prop="carteType">
|
||||
<template slot-scope="scope">
|
||||
{{ carteClassFormat(scope.row.carteType) }}
|
||||
<!-- {{ scope.row.carteType }}
|
||||
<!-- {{ scope.row.carteType }}
|
||||
{{ carteClassListMap[scope.row.carteType] }} -->
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
|
@ -60,14 +57,16 @@
|
|||
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="描述" align="center" prop="description" :show-overflow-tooltip="true"/>
|
||||
<el-table-column label="描述" align="center" prop="description" :show-overflow-tooltip="true" />
|
||||
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="200px">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)">修改
|
||||
</el-button>
|
||||
<el-button size="mini" type="text" :icon="scope.row.status === '0' ? 'el-icon-circle-check' : 'el-icon-circle-close'" @click="handleDisable(scope.row)">{{
|
||||
scope.row.status === '0' ? '启用' : '停用' }}
|
||||
<el-button size="mini" type="text"
|
||||
:icon="scope.row.status === '0' ? 'el-icon-circle-check' : 'el-icon-circle-close'"
|
||||
@click="handleDisable(scope.row)">{{
|
||||
scope.row.status === '0' ? '启用' : '停用' }}
|
||||
</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)">删除
|
||||
</el-button>
|
||||
|
|
@ -81,17 +80,20 @@
|
|||
|
||||
<!-- 菜单添加标签 -->
|
||||
<el-tab-pane :label="activeLabel" name="add">
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="100px" style="width: 600px" v-if="activeTab=='add'">
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="100px" style="width: 600px"
|
||||
v-if="activeTab == 'add'">
|
||||
<el-form-item label="食堂:" prop="carteenId">
|
||||
<!-- <el-input v-model="form.carteenName" disabled/> -->
|
||||
<el-select v-model="form.carteenId" placeholder="请选择食堂" >
|
||||
<el-option v-for="item in canteenList" :key="item.id" :label="item.name" :value="item.id" @click.native="handleSelectCanteen(item)">
|
||||
<el-select v-model="form.carteenId" placeholder="请选择食堂">
|
||||
<el-option v-for="item in canteenList" :key="item.id" :label="item.name" :value="item.id"
|
||||
@click.native="handleSelectCanteen(item)">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="名称:" prop="name">
|
||||
<el-input v-model="form.name" style="width: 300px" />
|
||||
<el-input v-model="form.name" style="width: 300px" /> <el-button @click="handleInputClick"
|
||||
type="primary">选择图片</el-button>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="餐点:" prop="tags1">
|
||||
|
|
@ -110,20 +112,23 @@
|
|||
</el-form-item>
|
||||
|
||||
<el-form-item label="价格:" prop="cartePrice">
|
||||
<el-input v-model.trim="form.cartePrice" placeholder="" style="width: 217px" @input="formatInportData($event,'6,2','cartePrice',form)"/>
|
||||
<el-input v-model.trim="form.cartePrice" placeholder="" style="width: 217px"
|
||||
@input="formatInportData($event, '6,2', 'cartePrice', form)" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="排序:" prop="carteSort">
|
||||
<el-input v-model="form.carteSort" style="width: 217px" @input="formatInportData($event,'6','carteSort',form)"/>
|
||||
<el-input v-model="form.carteSort" style="width: 217px"
|
||||
@input="formatInportData($event, '6', 'carteSort', form)" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="描述:" prop="description">
|
||||
<el-input v-model="form.description" type="textarea" :rows="2"/>
|
||||
<el-input v-model="form.description" type="textarea" :rows="2" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="上传图片:">
|
||||
<upload-file v-model="fileArr" layoutMode="horizontal" :limit="1" :isDelBtn="true" :maxFileNum="99" fileType="image" tipText="图片大小不能超过20M"
|
||||
pathField="filePath" nameField="fileName" class="upload-file" moduleName="canteen" ref="uploadFile" :key="uploadKey"/>
|
||||
<upload-file v-model="fileArr" layoutMode="horizontal" :limit="1" :isDelBtn="true" :maxFileNum="99"
|
||||
fileType="image" tipText="图片大小不能超过20M" pathField="filePath" nameField="fileName" class="upload-file"
|
||||
moduleName="canteen" ref="uploadFile" :key="uploadKey"/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
|
|
@ -137,11 +142,11 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import {listCarte, getCarte, delCarte, addCarte, findDict, getCanteenList} from "@/api/canteen/carte";
|
||||
import { listCarte, getCarte, delCarte, addCarte, findDict, getCanteenList, getCarteImgUrl } from "@/api/canteen/carte";
|
||||
import menuList from "@/views/canteen/publishMenu/menuList.vue";
|
||||
import UploadFile from "@/components/yjCanteen/common/uploadFile/upload-file.vue";
|
||||
// 获取文件名
|
||||
import {formatInportData, getFileName} from '@/utils/yjCanteen/common.js'
|
||||
import { formatInportData, getFileName } from '@/utils/yjCanteen/common.js'
|
||||
|
||||
export default {
|
||||
name: "Carte",
|
||||
|
|
@ -166,12 +171,12 @@ export default {
|
|||
carteList: [],
|
||||
// 菜品
|
||||
carteClassList: [],
|
||||
carteClassListMap:{},
|
||||
carteClassListMap: {},
|
||||
uploadKey: Date.now(), // 动态 key 值
|
||||
// 餐点
|
||||
mealList: [],
|
||||
// 食堂选择列表
|
||||
canteenList:[],
|
||||
canteenList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
|
|
@ -214,13 +219,13 @@ export default {
|
|||
cartePrice: [
|
||||
{ required: true, message: "价格不能为空", trigger: "blur" }
|
||||
],
|
||||
carteenId:[
|
||||
carteenId: [
|
||||
{ required: true, message: "请选择食堂", trigger: "change" }
|
||||
]
|
||||
},
|
||||
// 附件前缀
|
||||
prefix_url: this.$store.state.yjUser.configItem.file_server_address,
|
||||
fileArr:[] // 附件上传
|
||||
fileArr: [] // 附件上传
|
||||
};
|
||||
},
|
||||
created() {
|
||||
|
|
@ -258,7 +263,7 @@ export default {
|
|||
findDict(dict).then(res => {
|
||||
this.carteClassList = res.data;
|
||||
this.carteClassList.forEach(item => {
|
||||
this.carteClassListMap[item.dictValue+''] = item.dictLabel;
|
||||
this.carteClassListMap[item.dictValue + ''] = item.dictLabel;
|
||||
})
|
||||
})
|
||||
},
|
||||
|
|
@ -272,7 +277,7 @@ export default {
|
|||
});
|
||||
},
|
||||
// 选择食堂
|
||||
handleSelectCanteen(item){
|
||||
handleSelectCanteen(item) {
|
||||
this.form.carteenId = item.id;
|
||||
this.form.carteenName = item.name;
|
||||
},
|
||||
|
|
@ -303,7 +308,7 @@ export default {
|
|||
tags1: [],
|
||||
};
|
||||
this.resetForm("form");
|
||||
this.fileArr=[];
|
||||
this.fileArr = [];
|
||||
},
|
||||
listClick(tab) {
|
||||
this.activeTab = tab.name;
|
||||
|
|
@ -362,7 +367,7 @@ export default {
|
|||
url: this.form.pic
|
||||
}
|
||||
this.fileArr = [picObj]
|
||||
}else{
|
||||
} else {
|
||||
this.fileArr = []
|
||||
}
|
||||
this.open = true;
|
||||
|
|
@ -379,9 +384,9 @@ export default {
|
|||
}
|
||||
this.form.tags = this.form.tags1.join(',');
|
||||
// 将图片转为字json格式
|
||||
if (this.fileArr.length>0) {
|
||||
if (this.fileArr.length > 0) {
|
||||
this.form.pic = this.fileArr[0]?.filePath
|
||||
}else{
|
||||
} else {
|
||||
this.form.pic = '';
|
||||
}
|
||||
addCarte(this.form).then(response => {
|
||||
|
|
@ -419,6 +424,37 @@ export default {
|
|||
this.download('bonus/carte/export', {
|
||||
...this.queryParams
|
||||
}, `carte_${new Date().getTime()}.xlsx`)
|
||||
},
|
||||
|
||||
// 点击获取图片
|
||||
handleInputClick() {
|
||||
if (this.form.name && this.form.name.length > 0) {
|
||||
this.handleGetPic(this.form.name)
|
||||
} else {
|
||||
this.$message.warning('请输入名称')
|
||||
}
|
||||
},
|
||||
|
||||
// 获取匹配的图片
|
||||
handleGetPic(name) {
|
||||
getCarteImgUrl({ carteName: name }).then(res => {
|
||||
if (res.code === 200) {
|
||||
if (res.data && res.data.length > 0) {
|
||||
this.form.pic = res.data
|
||||
let picObj = {
|
||||
fileName: getFileName(this.form.pic),
|
||||
filePath: this.form.pic,
|
||||
url: this.form.pic
|
||||
}
|
||||
this.fileArr = [picObj]
|
||||
}else{
|
||||
this.$message.warning('未找到匹配的图片')
|
||||
this.form.pic = ''
|
||||
this.fileArr = []
|
||||
this.$refs.uploadFile.clearFile()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
|
|
@ -438,4 +474,5 @@ export default {
|
|||
height: calc(100vh - 200px); !* 根据页面高度自适应调整 *!
|
||||
overflow-y: auto; !* 确保内容溢出时显示滚动条 *!
|
||||
}*/
|
||||
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
</el-form>
|
||||
<ImportFile ref="importRef" :show-popup="showPopup" @update:showPopup="showPopup = $event" textTip="导入文件不能超过5M"
|
||||
key="odAlarmOrderRecordFile" @uploadFinish="handleQuery" uploadUrl="/canteen/cmPersonAccount/importData"
|
||||
localDownloadTemplateUrl="/yjCanteen-template/UserFoodAllowance_template.xlsx"
|
||||
localDownloadTemplateUrl="glweb/yjCanteen-template/UserFoodAllowance_template.xlsx"
|
||||
errorUrl="canteen/cmPersonAccount/importExport" template-file-name="用户餐补数据模板"
|
||||
export-error-file-name="用户餐补数据.xls" title="用户餐补数据" />
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue