| | |
| | | /> |
| | | </div> |
| | | <div |
| | | @click="handleClick(1)" |
| | | class="flex a-center j-between px--20 w--300 h--40 relative bgcolor1 picker" |
| | | @click="handleClick" |
| | | class="flex a-center j-between px--20 w--350 h--40 relative bgcolor1 picker" |
| | | > |
| | | <el-date-picker |
| | | v-model="dateTime" |
| | | ref="datetime1" |
| | | type="datetime" |
| | | v-model="monthrange" |
| | | ref="monthrangeRef" |
| | | type="daterange" |
| | | placeholder="" |
| | | > |
| | | </el-date-picker> |
| | | <div |
| | | class="absolute w100 h100 flex a-center c-fff fs--14 SHS" |
| | | style="width: calc(100% - 20px)" |
| | | v-if="dateTxt" |
| | | > |
| | | {{ dateTxt }} |
| | | <div class="absolute w100 h100 flex a-center c-fff fs--14 SHS"> |
| | | <div class="flex a-center flex1 shrink0 gap--13"> |
| | | <img |
| | | src="../../assets/img/home/Shape@2x (6).png" |
| | | class="w--13 h--13 shrink0" |
| | | /> |
| | | <div style="width: calc(100% - 20px)" v-if="dateTxt1"> |
| | | {{ dateTxt1 }} |
| | | </div> |
| | | <div v-else>请选择日期</div> |
| | | </div> |
| | | <div class="flex a-center flex1 shrink0 gap--13"> |
| | | <img |
| | | src="../../assets/img/home/Shape@2x (6).png" |
| | | class="w--13 h--13 shrink0" |
| | | /> |
| | | <div style="width: calc(100% - 20px)" v-if="dateTxt2"> |
| | | {{ dateTxt2 }} |
| | | </div> |
| | | <div v-else>请选择日期</div> |
| | | </div> |
| | | </div> |
| | | <div |
| | | v-else |
| | | class="absolute w100 h100 flex a-center c-fff fs--14 SHSR" |
| | | > |
| | | 请选择日期 |
| | | </div> |
| | | <img |
| | | src="../../assets/img/home/Shape@2x (6).png" |
| | | class="w--13 h--13 shrink0" |
| | | /> |
| | | </div> |
| | | <div |
| | | @click="handleClick(2)" |
| | | class="flex a-center j-between px--20 w--300 h--40 relative bgcolor1 picker" |
| | | > |
| | | <el-date-picker |
| | | v-model="dateTime" |
| | | ref="datetime2" |
| | | type="datetime" |
| | | placeholder="" |
| | | > |
| | | </el-date-picker> |
| | | <div |
| | | class="absolute w100 h100 flex a-center c-fff fs--14 SHS" |
| | | style="width: calc(100% - 20px)" |
| | | v-if="dateTxt" |
| | | > |
| | | {{ dateTxt }} |
| | | </div> |
| | | <div |
| | | v-else |
| | | class="absolute w100 h100 flex a-center c-fff fs--14 SHSR" |
| | | > |
| | | 请选择日期 |
| | | </div> |
| | | <img |
| | | src="../../assets/img/home/Shape@2x (6).png" |
| | | class="w--13 h--13 shrink0" |
| | | /> |
| | | </div> |
| | | <div |
| | | class="flex a-center j-between w--300 pl--20 h--40 relative bgcolor1 searchBox" |
| | | > |
| | | <el-select |
| | | <el-input |
| | | filterable |
| | | v-model="projectId" |
| | | v-model="searchParams.content" |
| | | placeholder="请输入搜索内容" |
| | | class="flex1" |
| | | > |
| | | <el-option |
| | | v-for="item in [1, 2]" |
| | | :key="item" |
| | | :label="item" |
| | | :value="item" |
| | | > |
| | | </el-option> |
| | | </el-select> |
| | | <div class="btn SHSR">搜索</div> |
| | | /> |
| | | <div @click="getlist" class="btn SHSR">搜索</div> |
| | | </div> |
| | | </div> |
| | | <div |
| | |
| | | </div> |
| | | <!-- 表格 --> |
| | | <CustomTable |
| | | :data="[{ projectName: '项目777' }, { projectName: '项目2' }]" |
| | | :data="listData" |
| | | height="800" |
| | | style="border: 2px solid #3d7fff" |
| | | > |
| | |
| | | {{ $index + 1 }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="标题" prop="projectName" /> |
| | | <el-table-column label="简介" prop="projectName" /> |
| | | <el-table-column label="图片" prop="projectName"> |
| | | <el-table-column label="标题" prop="title" /> |
| | | <el-table-column label="简介" prop="intro" /> |
| | | <el-table-column label="图片" prop="img"> |
| | | <template #default="{ row }" |
| | | ><div |
| | | class="btnColor cursor-pointer" |
| | | :class="false && 'disableColor'" |
| | | @click="previewVisible = true" |
| | | :class="!row.img && 'disableColor'" |
| | | @click="openImgDialog(row.img)" |
| | | > |
| | | 1张 |
| | | {{ row.img.split(",").length }}张 |
| | | </div> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="类型" prop="projectName" /> |
| | | <el-table-column label="上传时间" prop="projectName" /> |
| | | <el-table-column label="状态" prop="projectName" /> |
| | | <el-table-column label="类型"> |
| | | <template> 视察工作 </template> |
| | | </el-table-column> |
| | | <el-table-column label="上传时间" prop="createTime" /> |
| | | <el-table-column label="状态" prop="state"> |
| | | <template #default="{ row }"> |
| | | <div>{{ ["展示", "隐藏"][row.state - 1] }}</div> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="操作"> |
| | | <template #default="{ row }"> |
| | | <el-button type="text" class="btnColor" @click="toDetail(row)" |
| | | >详情</el-button |
| | | > |
| | | <el-button type="text" class="btnColor" @click="editForm(row)">编辑</el-button> |
| | | <el-button type="text" class="btnColor" @click="editForm(row)" |
| | | >编辑</el-button |
| | | > |
| | | <el-button type="text" class="btnColor">删除</el-button> |
| | | <el-button type="text" class="btnColor">隐藏</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </CustomTable> |
| | | <CustomPagination |
| | | @size-change="handleSizeChange" |
| | | @current-change="handleCurrentChange" |
| | | :current-page="currentPage" |
| | | :page-sizes="[100, 200, 300, 400]" |
| | | :page-size="10" |
| | | :total="400" |
| | | /> |
| | | <div v-if="totalSizes"> |
| | | <CustomPagination |
| | | @size-change="handleSizeChange" |
| | | @current-change="handleCurrentChange" |
| | | :current-page="currentPage" |
| | | :page-sizes="[100, 200, 300, 400]" |
| | | :page-size="searchParams.pageSize" |
| | | :total="totalSizes" |
| | | /> |
| | | </div> |
| | | </div> |
| | | <!-- 图片预览 --> |
| | | <CustomPreview |
| | | :show="previewVisible" |
| | | :imgArr="[]" |
| | | :imgArr="imgArr" |
| | | @close="previewVisible = false" |
| | | /> |
| | | <!-- 新增/编辑 --> |
| | |
| | | <div> |
| | | <div class="SHSR fs--16 lh--16 mb--17 color1">工作标题:</div> |
| | | <input |
| | | v-model="peopleName" |
| | | v-model="formData.title" |
| | | placeholder="请输入" |
| | | class="w100 h--60 fs--14 SHSR py--23 px--21 bgcolor5 c-fff" |
| | | /> |
| | |
| | | > |
| | | <el-select |
| | | filterable |
| | | v-model="projectId" |
| | | v-model="formData.type" |
| | | placeholder="请选择工作类型" |
| | | class="formSelect flex1" |
| | | > |
| | | <el-option |
| | | v-for="item in [1, 2]" |
| | | :key="item" |
| | | :label="item" |
| | | :value="item" |
| | | v-for="item in [{ label: '视察工作', value: 1 }]" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | > |
| | | </el-option> |
| | | </el-select> |
| | |
| | | <div class="mt--30"> |
| | | <div class="SHSR fs--16 lh--16 mb--17 color1">工作简介:</div> |
| | | <textarea |
| | | v-model="peopleName" |
| | | v-model="formData.intro" |
| | | placeholder="请输入" |
| | | class="w100 h--120 fs--14 SHSR py--23 px--21 bgcolor5 c-fff" |
| | | /> |
| | | </div> |
| | | <div class="mt--30"> |
| | | <div class="SHSR fs--16 lh--16 mb--17 color1">工作图片:</div> |
| | | <div class="flex gap--10"> |
| | | <el-image |
| | | v-for="(item, index) in fileList" |
| | | :key="index" |
| | | :src="item.url" |
| | | class="w--100 h--100 fileListBox" |
| | | :preview-src-list="[item.url]" |
| | | <div class="SHSR fs--16 lh--16 mb--17 color1">是否展示:</div> |
| | | <div |
| | | class="flex a-center j-between w100 pl--18 pr--15 h--60 SHSR fs--14 c-fff bgcolor5 searchBox" |
| | | > |
| | | <el-select |
| | | filterable |
| | | v-model="formData.state" |
| | | placeholder="请选择是否展示" |
| | | class="formSelect flex1" |
| | | > |
| | | <el-option |
| | | v-for="item in [ |
| | | { label: '展示', value: 1 }, |
| | | { label: '隐藏', value: 2 }, |
| | | ]" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | > |
| | | </el-option> |
| | | </el-select> |
| | | <img |
| | | src="../../assets/img/down-circle@2x.png" |
| | | class="w--15 h--16 shrink0" |
| | | /> |
| | | </div> |
| | | </div> |
| | | <div class="mt--30"> |
| | | <div class="SHSR fs--16 lh--16 mb--17 color1">工作图片:</div> |
| | | <div class=""> |
| | | <el-upload |
| | | action="https://jsonplaceholder.typicode.com/posts/" |
| | | :action="VUE_APP_BASE_URL + '/open/file/upload'" |
| | | :headers="uploadHeaders" |
| | | :before-upload="beforeUpload" |
| | | :limit="5" |
| | | accept="image/png, image/jpeg, image/gif" |
| | | :show-file-list="false" |
| | | :on-success="handleSuccess" |
| | | :on-preview="handlePictureCardPreview" |
| | | :on-remove="handleRemove" |
| | | list-type="picture-card" |
| | | :file-list="fileList" |
| | | > |
| | | <div |
| | | class="flex a-center flex-column gap--15 px--20 py--20 border1 br--8 uploadBox" |
| | | > |
| | | <img |
| | | src="../../assets/img/home/89Combined Shape@2x.png" |
| | | class="w--18 h--18" |
| | | /> |
| | | <div class="c-fff fs--16">上传图片</div> |
| | | </div> |
| | | </el-upload> |
| | | </div> |
| | | <div class="color1 mt--10 fs--16 SHSR"> |
| | |
| | | </div> |
| | | </div> |
| | | </CustomDialog> |
| | | <el-dialog :visible.sync="dialogVisible"> |
| | | <img width="100%" :src="dialogImageUrl" alt="" /> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import HeaderBox from "../header/index.vue"; |
| | | import moment from "moment"; |
| | | import { getWorkPresentationList, addWorkPresentation } from "./service"; |
| | | export default { |
| | | components: { HeaderBox }, |
| | | props: {}, |
| | | data() { |
| | | return { |
| | | dateTime: null, |
| | | VUE_APP_BASE_URL: process.env.VUE_APP_BASE_URL, |
| | | uploadHeaders: { |
| | | Authorization: localStorage.getItem("token"), |
| | | }, |
| | | monthrange: null, |
| | | dateTxt1: "", |
| | | dateTxt2: "", |
| | | projectId: null, |
| | | dateTxt: "", |
| | | currentPage: 1, |
| | | previewVisible: false, |
| | | imgArr: [], |
| | | formVisible: false, |
| | | peopleName: "", |
| | | fileList: [], |
| | | totalSizes: null, |
| | | searchParams: { |
| | | pageNum: 1, |
| | | pageSize: 10, |
| | | state: "", |
| | | time: "", |
| | | type: "", |
| | | clientId: localStorage.getItem("clientId"), |
| | | content: "", |
| | | }, |
| | | formData: {}, |
| | | listData: [], |
| | | dialogImageUrl: "", |
| | | dialogVisible: false, |
| | | }; |
| | | }, |
| | | computed: {}, |
| | | watch: { |
| | | dateTime: { |
| | | monthrange: { |
| | | handler(newVal, oldVal) { |
| | | if (newVal) { |
| | | this.dateTxt = moment(newVal).format("YYYY年MM月DD日 HH:mm:ss"); |
| | | if (newVal && newVal.length === 2) { |
| | | this.dateTxt1 = moment(newVal[0]).format("YYYY年MM月DD日"); |
| | | this.dateTxt2 = moment(newVal[1]).format("YYYY年MM月DD日"); |
| | | this.searchParams.time = |
| | | moment(newVal[0]).format("YYYY-MM-DD") + |
| | | " - " + |
| | | moment(newVal[1]).format("YYYY-MM-DD"); |
| | | } else { |
| | | this.dateTxt1 = ""; |
| | | this.dateTxt2 = ""; |
| | | this.searchParams.time = ""; |
| | | } |
| | | }, |
| | | immediate: true, |
| | | }, |
| | | }, |
| | | created() {}, |
| | | created() { |
| | | this.getlist(); |
| | | }, |
| | | mounted() {}, |
| | | methods: { |
| | | openImgDialog(img) { |
| | | this.imgArr = img.split(","); |
| | | this.previewVisible = true; |
| | | }, |
| | | |
| | | saveForm() { |
| | | if (!this.formData.title) { |
| | | Message({ |
| | | message: "请输入工作标题", |
| | | type: "warning", |
| | | duration: 1500, |
| | | }); |
| | | return; |
| | | } |
| | | if (!this.formData.type) { |
| | | Message({ |
| | | message: "请选择工作类型", |
| | | type: "warning", |
| | | duration: 1500, |
| | | }); |
| | | return; |
| | | } |
| | | if (!this.formData.intro) { |
| | | Message({ |
| | | message: "请输入工作标简介", |
| | | type: "warning", |
| | | duration: 1500, |
| | | }); |
| | | return; |
| | | } |
| | | if (!this.formData.state) { |
| | | Message({ |
| | | message: "请选择展示状态", |
| | | type: "warning", |
| | | duration: 1500, |
| | | }); |
| | | return; |
| | | } |
| | | if (!this.fileList.length) { |
| | | Message({ |
| | | message: "请上传工作图片", |
| | | type: "warning", |
| | | duration: 1500, |
| | | }); |
| | | return; |
| | | } |
| | | |
| | | let obj = { |
| | | ...this.formData, |
| | | clientId: localStorage.getItem("clientId"), |
| | | }; |
| | | obj.img = this.fileList.map((item) => item.url).join(","); |
| | | addWorkPresentation(obj).then((res) => { |
| | | this.closeForm(); |
| | | this.getlist(); |
| | | }); |
| | | }, |
| | | |
| | | getlist() { |
| | | getWorkPresentationList(this.searchParams).then((res) => { |
| | | this.totalSizes = res.total; |
| | | this.listData = res.records; |
| | | }); |
| | | }, |
| | | |
| | | handleRemove(file, fileList) { |
| | | console.log(file, fileList); |
| | | this.fileList = this.fileList.filter((item) => { |
| | | return item.url != file.url; |
| | | }); |
| | | }, |
| | | |
| | | handlePictureCardPreview(file) { |
| | | this.dialogImageUrl = file.url; |
| | | this.dialogVisible = true; |
| | | }, |
| | | |
| | | handleSuccess(response, file, fileList) { |
| | | console.log(response, file, fileList); |
| | | this.fileList = fileList; |
| | | this.fileList.push({ |
| | | url: process.env.VUE_APP_IMAGE_BASE_URL + response.data, |
| | | }); |
| | | this.$message.success("上传成功"); |
| | | }, |
| | | |
| | |
| | | }, |
| | | |
| | | editForm(row) { |
| | | this.formData = { ...row }; |
| | | this.fileList = row.img.split(",").map((item) => { |
| | | return { |
| | | url: item, |
| | | }; |
| | | }); |
| | | this.formVisible = true; |
| | | }, |
| | | |
| | | closeForm() { |
| | | this.formVisible = false; |
| | | }, |
| | | |
| | | saveForm() { |
| | | this.closeForm(); |
| | | this.formData = {}; |
| | | this.fileList = []; |
| | | }, |
| | | |
| | | toDetail(row) { |
| | |
| | | }, |
| | | |
| | | handleSizeChange(val) { |
| | | console.log(`每页 ${val} 条`); |
| | | this.searchParams.pageSize = val; |
| | | }, |
| | | |
| | | handleCurrentChange(val) { |
| | | console.log(`当前页: ${val}`); |
| | | this.searchParams.pageNum = val; |
| | | }, |
| | | |
| | | handleClick(type) { |
| | | this.$refs[`datetime${type}`].focus(); |
| | | this.$refs.monthrangeRef.focus(); |
| | | }, |
| | | |
| | | backFun() { |
| | |
| | | }; |
| | | </script> |
| | | <style scoped lang="less"> |
| | | // <div |
| | | // class="flex a-center flex-column gap--15 px--20 py--20 border1 br--8 uploadBox" |
| | | // > |
| | | // <img |
| | | // src="../../assets/img/home/89Combined Shape@2x.png" |
| | | // class="w--18 h--18" |
| | | // /> |
| | | // <div class="c-fff fs--16">上传图片</div> |
| | | // </div> |
| | | |
| | | ::v-deep .el-upload--picture-card { |
| | | border: 2px dashed #8c939d; |
| | | background-color: transparent; |
| | | |
| | | &:hover { |
| | | border-color: #00ebfc !important; |
| | | } |
| | | |
| | | &::after { |
| | | content: "上传图片"; |
| | | color: #fff; |
| | | font-size: 16px; |
| | | line-height: 16px; |
| | | } |
| | | } |
| | | .border1 { |
| | | border: 2px dashed #8c939d; |
| | | } |