From 10964ea959757a6cc2871ae769bd4687595eac80 Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Fri, 15 Dec 2023 17:58:01 +0800
Subject: [PATCH] 首页更换,部分菜单,操作栏调整,部分样式调整
---
src/views/grid/gridWorkLog/index.vue | 604 ++++++++++++++++++++++++++----------------------------
1 files changed, 292 insertions(+), 312 deletions(-)
diff --git a/src/views/grid/gridWorkLog/index.vue b/src/views/grid/gridWorkLog/index.vue
index 67071df..703165d 100644
--- a/src/views/grid/gridWorkLog/index.vue
+++ b/src/views/grid/gridWorkLog/index.vue
@@ -1,333 +1,313 @@
-<!-- 工作日志 -->
+<!-- 走访日志 -->
<template>
- <basic-container>
- <avue-crud
- :option="option"
- :table-loading="loading"
- :data="data"
- :page.sync="page"
- ref="crud"
- @row-del="rowDel"
- v-model="form"
- :permission="permissionList"
- @row-update="rowUpdate"
- @row-save="rowSave"
- :before-open="beforeOpen"
- @search-change="searchChange"
- @search-reset="searchReset"
- @selection-change="selectionChange"
- @current-change="currentChange"
- @size-change="sizeChange"
- @refresh-change="refreshChange"
- @on-load="onLoad"
- >
- <template slot="menuLeft">
- <el-button
- size="small"
- icon="el-icon-delete"
- plain
- v-if="permission.gridWorkLog_delete"
- @click="handleDelete"
- >删 除
- </el-button>
- </template>
- </avue-crud>
- </basic-container>
+ <basic-container>
+ <avue-crud :option="option" :table-loading="loading" :data="data" :page.sync="page" ref="crud" @row-del="rowDel"
+ v-model="form" :permission="permissionList" @row-update="rowUpdate" @row-save="rowSave"
+ :before-open="beforeOpen" @search-change="searchChange" @search-reset="searchReset"
+ @selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange"
+ @refresh-change="refreshChange" @on-load="onLoad">
+ <template slot="menuLeft">
+ <el-button size="small" icon="el-icon-delete" plain v-if="permission.gridWorkLog_delete"
+ @click="handleDelete">删 除
+ </el-button>
+ </template>
+ </avue-crud>
+ </basic-container>
</template>
<script>
- import {getList, remove, update, add, getGridWorkLog} from "@/api/grid/gridWorkLog";
- import {mapGetters} from "vuex";
- import website from '@/config/website';
+import { getList, remove, update, add, getGridWorkLog } from "@/api/grid/gridWorkLog"
+import { mapGetters } from "vuex"
+import website from '@/config/website'
- export default {
- data() {
- return {
- form: {},
- query: {},
- loading: true,
- page: {
- pageSize: 10,
- currentPage: 1,
- total: 0,
- },
- datetime: "",
- selectionList: [],
- option: {
- height: "auto",
- calcHeight: 54,
- dialogWidth: 950,
- tip: false,
- searchShow: true,
- searchMenuSpan: 3,
- menuWidth: 350,
- border: false,
- //stripe:true,
- index: true,
- viewBtn: true,
- selection: true,
- excelBtn: true,
- dialogClickModal: false,
- column: [
- {
- label: "走访人员姓名",
- prop: "name",
- span: 12,
- labelWidth:120,
- searchLabelWidth:120,
- searchSpan: 5,
- search:true,
- rules: [
- {
- required: true,
- message: "请输入走访人员姓名",
- trigger: "blur",
- },
- ],
+export default {
+ data () {
+ return {
+ form: {},
+ query: {},
+ loading: true,
+ page: {
+ pageSize: 10,
+ currentPage: 1,
+ total: 0,
},
- {
- label: "走访人员电话",
- prop: "phone",
- span: 12,
- labelWidth:120,
- searchLabelWidth:120,
- searchSpan: 5,
- search:true,
+ datetime: "",
+ selectionList: [],
+ option: {
+ height: "auto",
+ calcHeight: 54,
+ dialogWidth: 950,
+ tip: false,
+ searchShow: true,
+ searchMenuSpan: 3,
+ menuWidth: 350,
+ border: false,
+ //stripe:true,
+ index: true,
+ viewBtn: true,
+ selection: true,
+ excelBtn: true,
+ dialogClickModal: false,
+ column: [
+ {
+ label: "走访人员姓名",
+ prop: "name",
+ span: 12,
+ labelWidth: 120,
+ searchLabelWidth: 120,
+ searchSpan: 5,
+ search: true,
+ rules: [
+ {
+ required: true,
+ message: "请输入走访人员姓名",
+ trigger: "blur",
+ },
+ ],
+ },
+ {
+ label: "走访人员电话",
+ prop: "phone",
+ span: 12,
+ labelWidth: 120,
+ searchLabelWidth: 120,
+ searchSpan: 5,
+ search: true,
+ },
+ {
+ label: "内容",
+ labelWidth: 120,
+ prop: "context",
+ type: "textarea",
+ span: 24,
+ },
+ {
+ label: "图片",
+ prop: "url",
+ type: "upload",
+ labelWidth: 120,
+ width: 80,
+ listType: "picture-img",
+ action: "/api/blade-resource/oss/endpoint/put-file",
+ propsHttp: {
+ res: "data",
+ name: 'name',
+ url: "link",
+ },
+ span: 24,
+ },
+ {
+ label: "走访时间",
+ prop: "workTime",
+ width: 160,
+ type: "date",
+ format: "yyyy-MM-dd HH:mm:ss",
+ valueFormat: "yyyy-MM-dd HH:mm:ss",
+ rules: [
+ {
+ required: true,
+ message: "请输入走访时间",
+ trigger: "blur",
+ },
+ ],
+ }
+ ],
},
- {
- label: "内容",
- labelWidth:120,
- prop: "context",
- type: "textarea",
- span: 24,
- },
- {
- label: "图片",
- prop: "url",
- type: "upload",
- labelWidth:120,
- width:80,
- listType: "picture-img",
- action: "/api/blade-resource/oss/endpoint/put-file",
- propsHttp: {
- res: "data",
- name: 'name',
- url: "link",
- },
- span: 24,
- },
- {
- label: "走访时间",
- prop: "workTime",
- width:160,
- type: "date",
- format: "yyyy-MM-dd HH:mm:ss",
- valueFormat: "yyyy-MM-dd HH:mm:ss",
- rules: [
- {
- required: true,
- message: "请输入走访时间",
- trigger: "blur",
- },
- ],
- }
- ],
- },
- data: [],
- };
+ data: [],
+ }
},
watch: {
},
computed: {
- ...mapGetters(["permission","userInfo"]),
- permissionList() {
- return {
- addBtn: this.vaildData(this.permission.gridWorkLog_add, true),
- viewBtn: this.vaildData(this.permission.gridWorkLog_view, true),
- delBtn: this.vaildData(this.permission.gridWorkLog_delete, true),
- editBtn: this.vaildData(this.permission.gridWorkLog_edit, true),
- };
- },
- ids() {
- let ids = [];
- this.selectionList.forEach((ele) => {
- ids.push(ele.id);
- });
- return ids.join(",");
- },
+ ...mapGetters(["permission", "userInfo"]),
+ permissionList () {
+ return {
+ addBtn: this.vaildData(this.permission.gridWorkLog_add, true),
+ viewBtn: this.vaildData(this.permission.gridWorkLog_view, true),
+ delBtn: this.vaildData(this.permission.gridWorkLog_delete, true),
+ editBtn: this.vaildData(this.permission.gridWorkLog_edit, true),
+ }
+ },
+ ids () {
+ let ids = []
+ this.selectionList.forEach((ele) => {
+ ids.push(ele.id)
+ })
+ return ids.join(",")
+ },
},
methods: {
- rowSave(row, done, loading) {
- if(row.url.length>0){
- var urls = []
- var split = row.url.split(",");
- split.forEach(url=>{
- var names = url.split("jczz/");
- urls.push(names[1])
- })
- row.url = urls.join(",")
- }
- add(row).then(
- () => {
- this.onLoad(this.page);
- this.$message({
- type: "success",
- message: "操作成功!",
- });
- done();
- },
- (error) => {
- window.console.log(error);
- loading();
- }
- );
- },
- rowUpdate(row, index, done, loading) {
- if(row.url.length>0){
- var urls = []
- var split = row.url.split(",");
- split.forEach(url=>{
- var names = url.split("jczz/");
- urls.push(names[1])
- })
- row.url = urls.join(",")
- }
- update(row).then(
- () => {
- this.onLoad(this.page);
- this.$message({
- type: "success",
- message: "操作成功!",
- });
- done();
- },
- (error) => {
- window.console.log(error);
- loading();
- }
- );
- },
- rowDel(row) {
- this.$confirm("确定将选择数据删除?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- })
- .then(() => {
- return remove(row.id);
- })
- .then(() => {
- this.onLoad(this.page);
- this.$message({
- type: "success",
- message: "操作成功!",
- });
- });
- },
- searchReset() {
- this.query = {};
- this.onLoad(this.page);
- },
- searchChange(params, done) {
- this.query = params;
- this.page.currentPage = 1;
- this.onLoad(this.page, params);
- done();
- },
- selectionChange(list) {
- this.selectionList = list;
- },
- selectionClear() {
- this.selectionList = [];
- this.$refs.crud.toggleSelection();
- },
- handleDelete() {
- if (this.selectionList.length === 0) {
- this.$message.warning("请选择至少一条数据");
- return;
- }
- this.$confirm("确定将选择数据删除?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- })
- .then(() => {
- return remove(this.ids);
- })
- .then(() => {
- this.onLoad(this.page);
- this.$message({
- type: "success",
- message: "操作成功!",
- });
- this.$refs.crud.toggleSelection();
- });
- },
- beforeOpen(done, type) {
- if (["edit", "view"].includes(type)) {
- getGridWorkLog(this.form.id).then((res) => {
- this.form = res.data.data;
- if(this.form.url.length>0){
- var urls = []
- var names = this.form.url.split(",");
- names.forEach(name=>{
- urls.push(website.minioUrl + name)
- })
- this.form.url = urls.join(",")
+ rowSave (row, done, loading) {
+ if (row.url.length > 0) {
+ var urls = []
+ var split = row.url.split(",")
+ split.forEach(url => {
+ var names = url.split("jczz/")
+ urls.push(names[1])
+ })
+ row.url = urls.join(",")
}
- });
- }
- // con
- done();
- },
- currentChange(currentPage) {
- this.page.currentPage = currentPage;
- },
- sizeChange(pageSize) {
- this.page.pageSize = pageSize;
- },
- refreshChange() {
- this.onLoad(this.page, this.query);
- },
- onLoad(page, params = {}) {
- const {dateTime} = this.query;
- let values = {
- ...params,
- };
- if (dateTime) {
- values = {
- ...params,
- startTime: dateTime[0],
- endTime: dateTime[1],
- ...this.query,
- };
- values.dateTime = null;
- }
- this.loading = true;
- getList(page.currentPage, page.pageSize, values).then((res) => {
- const data = res.data.data;
- this.page.total = data.total;
- this.data = data.records;
- this.data.forEach(item=>{
- if(item.url.length>0){
- var urls = []
- var names = item.url.split(",");
- names.forEach(name=>{
- urls.push(website.minioUrl + name)
- })
- item.url = urls.join(",")
+ add(row).then(
+ () => {
+ this.onLoad(this.page)
+ this.$message({
+ type: "success",
+ message: "操作成功!",
+ })
+ done()
+ },
+ (error) => {
+ window.console.log(error)
+ loading()
+ }
+ )
+ },
+ rowUpdate (row, index, done, loading) {
+ if (row.url.length > 0) {
+ var urls = []
+ var split = row.url.split(",")
+ split.forEach(url => {
+ var names = url.split("jczz/")
+ urls.push(names[1])
+ })
+ row.url = urls.join(",")
}
- })
- this.loading = false;
- this.selectionClear();
- });
- }
+ update(row).then(
+ () => {
+ this.onLoad(this.page)
+ this.$message({
+ type: "success",
+ message: "操作成功!",
+ })
+ done()
+ },
+ (error) => {
+ window.console.log(error)
+ loading()
+ }
+ )
+ },
+ rowDel (row) {
+ this.$confirm("确定将选择数据删除?", {
+ confirmButtonText: "确定",
+ cancelButtonText: "取消",
+ type: "warning",
+ })
+ .then(() => {
+ return remove(row.id)
+ })
+ .then(() => {
+ this.onLoad(this.page)
+ this.$message({
+ type: "success",
+ message: "操作成功!",
+ })
+ })
+ },
+ searchReset () {
+ this.query = {}
+ this.onLoad(this.page)
+ },
+ searchChange (params, done) {
+ this.query = params
+ this.page.currentPage = 1
+ this.onLoad(this.page, params)
+ done()
+ },
+ selectionChange (list) {
+ this.selectionList = list
+ },
+ selectionClear () {
+ this.selectionList = []
+ this.$refs.crud.toggleSelection()
+ },
+ handleDelete () {
+ if (this.selectionList.length === 0) {
+ this.$message.warning("请选择至少一条数据")
+ return
+ }
+ this.$confirm("确定将选择数据删除?", {
+ confirmButtonText: "确定",
+ cancelButtonText: "取消",
+ type: "warning",
+ })
+ .then(() => {
+ return remove(this.ids)
+ })
+ .then(() => {
+ this.onLoad(this.page)
+ this.$message({
+ type: "success",
+ message: "操作成功!",
+ })
+ this.$refs.crud.toggleSelection()
+ })
+ },
+ beforeOpen (done, type) {
+ if (["edit", "view"].includes(type)) {
+ getGridWorkLog(this.form.id).then((res) => {
+ this.form = res.data.data
+ if (this.form.url.length > 0) {
+ var urls = []
+ var names = this.form.url.split(",")
+ names.forEach(name => {
+ urls.push(website.minioUrl + name)
+ })
+ this.form.url = urls.join(",")
+ }
+ })
+ }
+ // con
+ done()
+ },
+ currentChange (currentPage) {
+ this.page.currentPage = currentPage
+ },
+ sizeChange (pageSize) {
+ this.page.pageSize = pageSize
+ },
+ refreshChange () {
+ this.onLoad(this.page, this.query)
+ },
+ onLoad (page, params = {}) {
+ const { dateTime } = this.query
+ let values = {
+ ...params,
+ }
+ if (dateTime) {
+ values = {
+ ...params,
+ startTime: dateTime[0],
+ endTime: dateTime[1],
+ ...this.query,
+ }
+ values.dateTime = null
+ }
+ this.loading = true
+ getList(page.currentPage, page.pageSize, values).then((res) => {
+ const data = res.data.data
+ this.page.total = data.total
+ this.data = data.records
+ this.data.forEach(item => {
+ if (item.url.length > 0) {
+ var urls = []
+ var names = item.url.split(",")
+ names.forEach(name => {
+ urls.push(website.minioUrl + name)
+ })
+ item.url = urls.join(",")
+ }
+ })
+ this.loading = false
+ this.selectionClear()
+ })
+ }
},
- };
+}
</script>
<style>
- .avue-upload__icon {
+.avue-upload__icon {
line-height: 6;
- }
+}
</style>
--
Gitblit v1.9.3