运检食堂代码修改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
|
||||
|
|
|
|||
|
|
@ -23,11 +23,7 @@
|
|||
</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-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" />
|
||||
|
|
@ -66,7 +63,9 @@
|
|||
<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)">{{
|
||||
<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)">删除
|
||||
|
|
@ -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-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,11 +112,13 @@
|
|||
</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">
|
||||
|
|
@ -122,8 +126,9 @@
|
|||
</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,7 +142,7 @@
|
|||
</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";
|
||||
// 获取文件名
|
||||
|
|
@ -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