|
@@ -0,0 +1,372 @@
|
|
|
+<template>
|
|
|
+ <div class="app-container">
|
|
|
+ <div class="title-container">
|
|
|
+ <breadcrumb id="breadcrumb-container" class="breadcrumb-container"/>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <y-page-list-layout :page-list="pageData" :page-para="listQuery" :get-page-list="getList">
|
|
|
+ <template slot="left">
|
|
|
+ <PermissionButton
|
|
|
+ menu-code="_views_market_log_add"
|
|
|
+ class-name="filter-item"
|
|
|
+ type="primary"
|
|
|
+ round
|
|
|
+ size="mini"
|
|
|
+ @click.native="openAddLog()"
|
|
|
+ />
|
|
|
+<!-- <el-button-->
|
|
|
+<!-- class="filter-item"-->
|
|
|
+<!-- style="margin-left: 10px;float: left;"-->
|
|
|
+<!-- type="primary"-->
|
|
|
+<!-- @click="searchList"-->
|
|
|
+<!-- round-->
|
|
|
+<!-- >搜索-->
|
|
|
+<!-- </el-button>-->
|
|
|
+<!-- <el-button-->
|
|
|
+<!-- class="filter-item"-->
|
|
|
+<!-- style="float: left;"-->
|
|
|
+<!-- round-->
|
|
|
+<!-- type="warning"-->
|
|
|
+<!-- @click="resetSearch()"-->
|
|
|
+<!-- >重置-->
|
|
|
+<!-- </el-button>-->
|
|
|
+ </template>
|
|
|
+ <parentTable
|
|
|
+ v-loading="listLoading"
|
|
|
+ :data="pageData.records"
|
|
|
+ slot="table"
|
|
|
+ style="width: 100%;"
|
|
|
+ >
|
|
|
+ <el-table-column label="日志日期" align="center" width="150">
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <span>{{ row.logDate }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column label="日志内容" align="center">
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <span>{{ row.taskSituation }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="创建时间" align="center" width="180">
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <span>{{ row.created }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="操作" align="center" width="170">
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <PermissionButton
|
|
|
+ menu-code="_views_market_log_detail"
|
|
|
+ class-name="filter-item"
|
|
|
+ name=""
|
|
|
+ type="primary"
|
|
|
+ round
|
|
|
+ size="mini"
|
|
|
+ @click="detail(row.id,row.logDate,row.taskSituation)"
|
|
|
+ />
|
|
|
+ <PermissionButton
|
|
|
+ menu-code="_views_market_log_remove"
|
|
|
+ class-name="filter-item"
|
|
|
+ name=""
|
|
|
+ type="danger"
|
|
|
+ round
|
|
|
+ size="mini"
|
|
|
+ @click="deleteInfo(row.id)"
|
|
|
+ />
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </parentTable>
|
|
|
+ </y-page-list-layout>
|
|
|
+ <el-dialog
|
|
|
+ width="600px"
|
|
|
+ :title="textMap[dialogStatus]"
|
|
|
+ :visible.sync="dialogFormVisible"
|
|
|
+ :close-on-click-modal="false"
|
|
|
+ >
|
|
|
+ <el-form
|
|
|
+ ref="dataForm"
|
|
|
+ v-loading="dialogLoading"
|
|
|
+ :model="temp"
|
|
|
+ label-position="right"
|
|
|
+ label-width="110px"
|
|
|
+ style="width: 400px; margin-left:50px;"
|
|
|
+ >
|
|
|
+ <el-form-item
|
|
|
+ label="日期:"
|
|
|
+ prop="logDate"
|
|
|
+ class="filter-item"
|
|
|
+ >
|
|
|
+ <el-date-picker
|
|
|
+ v-model="temp.logDate"
|
|
|
+ type="date"
|
|
|
+ value-format="yyyy-MM-dd"
|
|
|
+ style="width: 100%"
|
|
|
+ placeholder="选择日期"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="内容:" prop="name">
|
|
|
+ <el-input v-model="temp.taskSituation" class="filter-item" type="textarea" :autosize="{ minRows: 8, maxRows: 8}"/>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="">
|
|
|
+ <el-button @click="dialogFormVisible = false">
|
|
|
+ 取消
|
|
|
+ </el-button>
|
|
|
+ <el-button type="primary" @click="dialogStatus==='create'?createData():updateData()">
|
|
|
+ 保存
|
|
|
+ </el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <!-- <div slot="footer" class="dialog-footer" style="text-align: center">-->
|
|
|
+ <!-- -->
|
|
|
+ <!-- </div>-->
|
|
|
+ </el-dialog>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+<script>
|
|
|
+ import YPageListLayout from '@/components/YPageListLayout'
|
|
|
+ import Breadcrumb from '@/components/Breadcrumb'
|
|
|
+ import PermissionButton from '@/components/PermissionButton/PermissionButton'
|
|
|
+
|
|
|
+ export default {
|
|
|
+ name: 'ViewsLogList',
|
|
|
+ components: {
|
|
|
+ Breadcrumb,
|
|
|
+ YPageListLayout,
|
|
|
+ PermissionButton,
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ isDisable:false,
|
|
|
+ tableKey: 0,
|
|
|
+ pageData: { records: [] },
|
|
|
+ total: 20,
|
|
|
+ listLoading: true,
|
|
|
+ listQuery: {
|
|
|
+ page: 1,
|
|
|
+ size: 10,
|
|
|
+ // name: '',
|
|
|
+ // staffNo: '',
|
|
|
+ descs: 'id',
|
|
|
+ me: false
|
|
|
+ },
|
|
|
+ listQueryKey: 'keyword',
|
|
|
+ importLoading: false,
|
|
|
+ dialogFormVisible: false,
|
|
|
+ dialogStatus: '',
|
|
|
+ textMap: {
|
|
|
+ update: '编辑',
|
|
|
+ create: '新增'
|
|
|
+ },
|
|
|
+ dialogLoading:false,
|
|
|
+ temp:{
|
|
|
+ id:null,
|
|
|
+ logDate:null,
|
|
|
+ taskSituation:'',
|
|
|
+ userId: this.$store.getters.userInfo.id
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ const that = this;
|
|
|
+ that.getList()
|
|
|
+ },
|
|
|
+
|
|
|
+ computed: {
|
|
|
+ timeDefault() {
|
|
|
+ const date = new Date();
|
|
|
+ const s1 = date.getFullYear() + "-" + (this.getZero(date.getMonth() + 1)) + "-" + this.getZero((date.getDate()));
|
|
|
+ return s1;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ getZero(num) {
|
|
|
+ // 单数前面加0
|
|
|
+ if (parseInt(num) < 10) {
|
|
|
+ num = '0' + num;
|
|
|
+ }
|
|
|
+ return num;
|
|
|
+ },
|
|
|
+ openAddLog() {
|
|
|
+ this.temp.id = null;
|
|
|
+ this.temp.logDate = null;
|
|
|
+ this.temp.taskSituation = null;
|
|
|
+ this.dialogStatus = 'create';
|
|
|
+ this.dialogFormVisible = true;
|
|
|
+ this.temp.logDate = this.timeDefault;
|
|
|
+ },
|
|
|
+ detail(id, logDate, taskSituation){
|
|
|
+ this.temp.id = id;
|
|
|
+ this.temp.logDate = logDate;
|
|
|
+ this.temp.taskSituation = taskSituation;
|
|
|
+ this.dialogStatus = 'update';
|
|
|
+ this.dialogFormVisible = true;
|
|
|
+ },
|
|
|
+ resetSearch() {
|
|
|
+ this.listQuery = {
|
|
|
+ current: 1,
|
|
|
+ size: 10,
|
|
|
+ descs: 'id',
|
|
|
+ }
|
|
|
+ this.getList()
|
|
|
+ },
|
|
|
+ searchList() {
|
|
|
+ // 重置分页
|
|
|
+ this.listQuery.page = 1
|
|
|
+ this.listQuery.size = 20
|
|
|
+ this.getList()
|
|
|
+ },
|
|
|
+ getList() {
|
|
|
+ const that = this;
|
|
|
+ this.listLoading = true;
|
|
|
+ const key = {}
|
|
|
+ this.$api.marketLog.list(Object.assign({}, that.listQuery, key)).then((res) => {
|
|
|
+ that.pageData = res.data
|
|
|
+ setTimeout(() => {
|
|
|
+ that.listLoading = false
|
|
|
+ }, 200)
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ that.listLoading = false
|
|
|
+ })
|
|
|
+ },
|
|
|
+ deleteInfo(id) {
|
|
|
+ const that = this
|
|
|
+ that.$confirm('请确认是否删除该数据?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning',
|
|
|
+ center: true
|
|
|
+ }).then(() => {
|
|
|
+ that.$api.marketLog.delete(id).then(data => {
|
|
|
+ that.loading = false
|
|
|
+ if (data.code === 200) {
|
|
|
+ that.getList()
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ type: 'error',
|
|
|
+ message: data.msg
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }).catch(() => {
|
|
|
+ })
|
|
|
+ },
|
|
|
+ createData() {
|
|
|
+ if (!this.temp.logDate) {
|
|
|
+ this.$notify({
|
|
|
+ title: '错误',
|
|
|
+ message: '日期不能为空',
|
|
|
+ type: 'error',
|
|
|
+ duration: 2000
|
|
|
+ });
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (!this.temp.taskSituation) {
|
|
|
+ this.$notify({
|
|
|
+ title: '错误',
|
|
|
+ message: '内容不能为空',
|
|
|
+ type: 'error',
|
|
|
+ duration: 2000
|
|
|
+ });
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.$refs['dataForm'].validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ this.dialogLoading = true;
|
|
|
+ this.$api.marketLog.add(this.temp).then(res => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ this.dialogLoading = false;
|
|
|
+ this.dialogFormVisible = false;
|
|
|
+ this.$notify({
|
|
|
+ title: '成功',
|
|
|
+ message: '创建成功',
|
|
|
+ type: 'success',
|
|
|
+ duration: 2000
|
|
|
+ });
|
|
|
+ this.getList()
|
|
|
+ }
|
|
|
+ }).catch(() => {
|
|
|
+ this.dialogLoading = false
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ updateData() {
|
|
|
+ if (!this.temp.logDate) {
|
|
|
+ this.$notify({
|
|
|
+ title: '错误',
|
|
|
+ message: '日期不能为空',
|
|
|
+ type: 'error',
|
|
|
+ duration: 2000
|
|
|
+ });
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (!this.temp.taskSituation) {
|
|
|
+ this.$notify({
|
|
|
+ title: '错误',
|
|
|
+ message: '内容不能为空',
|
|
|
+ type: 'error',
|
|
|
+ duration: 2000
|
|
|
+ });
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.$refs['dataForm'].validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ this.$api.marketLog.edit(this.temp).then(res => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ this.dialogFormVisible = false;
|
|
|
+ this.$notify({
|
|
|
+ title: '成功',
|
|
|
+ message: '编辑成功',
|
|
|
+ type: 'success',
|
|
|
+ duration: 2000
|
|
|
+ });
|
|
|
+ this.getList()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ }
|
|
|
+</script>
|
|
|
+<style lang="scss" scoped>
|
|
|
+ .right {
|
|
|
+ flex: 1;
|
|
|
+
|
|
|
+ .title {
|
|
|
+ font-size: 16px;
|
|
|
+ font-weight: 500;
|
|
|
+ color: rgba(51, 51, 51, 1);
|
|
|
+ line-height: 35px;
|
|
|
+ margin-bottom: 8px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .menu-2-box {
|
|
|
+ display: flex;
|
|
|
+ flex-wrap: wrap;
|
|
|
+ width: 100%;
|
|
|
+ }
|
|
|
+
|
|
|
+ .menu-2-item {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ color: #656565;
|
|
|
+ font-size: 12px;
|
|
|
+ width: 230px;
|
|
|
+ height: 101px;
|
|
|
+ background: rgb(255, 185, 129);
|
|
|
+ border-radius: 3px;
|
|
|
+ padding-left: 20px;
|
|
|
+ margin-right: 10px;
|
|
|
+ margin-bottom: 10px;
|
|
|
+ cursor: pointer;
|
|
|
+ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12), 0 0 6px rgba(0, 0, 0, 0.04);
|
|
|
+
|
|
|
+ .text {
|
|
|
+ margin-left: 16px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+</style>
|