123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180 |
- <template>
- <el-card class="box-card">
- <el-form :model="queryParams" ref="queryForm" :inline="true" @submit.native.prevent>
- <el-form-item label="名称" prop="name">
- <el-input v-model="queryParams.name" placeholder="请输入名称" size="small" @keyup.enter.native="handleQuery" />
- </el-form-item>
- <el-form-item label="风格" prop="style">
- <el-select v-model="queryParams.style" placeholder="请选择风格" size="small" style="width: 100%" @change="handleQuery">
- <el-option v-for="item in style" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey" />
- </el-select>
- </el-form-item>
- <el-form-item>
- <el-button size="small" @click="handleQuery" class="searchBtn">搜索</el-button>
- <el-button size="small" @click="resetQuery">重置</el-button>
- </el-form-item>
- </el-form>
- <el-row :gutter="10" style="margin-bottom: 10px">
- <el-col :span="1.5">
- <el-button type="primary" size="mini" @click="handleAdd" v-db-click>新增</el-button>
- </el-col>
- </el-row>
- <el-table :data="tableList" :cell-style="{ padding: '0' }" :row-style="{ height: '35px' }" v-loading="loading" header-row-class-name="tableHeader">
- <el-table-column label="名称" prop="name" />
- <el-table-column label="素材图片" align="center">
- <template slot-scope="scope">
- <div style="padding: 4px 0">
- <img
- v-if="scope.row.mags"
- style="width: 80px; height: 80px; border: none"
- :src="pathPrefix + scope.row.mags"
- @click="openPicture(pathPrefix + scope.row.mags)"
- />
- </div>
- </template>
- </el-table-column>
- <el-table-column label="风格" align="center" :formatter="styleFormat" />
- <el-table-column label="操作" align="center" width="140" fixed="right">
- <template slot-scope="scope">
- <el-button type="text" @click="clickUpdate(scope.row)" v-db-click>修改</el-button>
- <el-button type="text" @click="clickRemove(scope.row)" v-db-click>删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
- <!-- 添加或修改 -->
- <el-dialog :title="title" v-if="open" :visible.sync="open" width="30%" append-to-body>
- <AddOrModified :rowData="rowData" @clickCancel="clickCancel"></AddOrModified>
- </el-dialog>
- </el-card>
- </template>
- <script>
- import * as API from '@/api/shengde/group/material/lineDraft'
- import AddOrModified from './addOrModified'
- import { mapGetters } from 'vuex'
- export default {
- name: 'lineDraft',
- components: { AddOrModified },
- data() {
- return {
- pathPrefix: process.env.VUE_APP_IMG_URL,
- queryParams: {
- pageNum: 1,
- pageSize: 10,
- name: '',
- style: '',
- },
- loading: false,
- tableList: [],
- total: 0,
- title: '',
- rowData: {},
- open: '',
- style: [],
- }
- },
- created() {
- this.style = this.dictData.filter((item) => item.code === 'style')[0].children
- },
- mounted() {
- this.getList()
- },
- computed: mapGetters(['dictData']),
- methods: {
- getList() {
- this.loading = true
- API.lineList(this.queryParams).then(
- (res) => {
- this.tableList = res.data.data.records
- this.total = res.data.data.total
- this.loading = false
- },
- (err) => {
- console.log('lineList: ' + err)
- this.loading = false
- }
- )
- },
- /** 搜索按钮操作 */
- handleQuery() {
- this.queryParams.pageNum = 1
- this.getList()
- },
- /** 重置按钮操作 */
- resetQuery() {
- this.resetForm('queryForm')
- this.handleQuery()
- },
- handleAdd() {
- this.title = '新增线稿素材'
- this.rowData = {}
- this.open = true
- },
- clickUpdate(row) {
- this.title = '修改线稿素材'
- this.rowData = row
- this.open = true
- },
- clickRemove(row) {
- this.$confirm('是否确认删除此条数据项?', '警告', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning',
- })
- .then(() => {
- API.lineDelete({ id: row.id }).then(() => {
- this.msgSuccess('删除成功!')
- this.getList()
- })
- })
- .catch(() => {})
- },
- clickCancel(status) {
- this.open = false
- if (status) {
- this.getList()
- }
- },
- styleFormat(row) {
- return this.selectConstantsLabel(this.style, row.style)
- },
- openPicture(path) {
- window.open(path)
- },
- },
- }
- </script>
- <style lang="scss" scoped>
- * {
- font-size: 12px;
- }
- .box-card {
- height: calc(100vh - 110px);
- overflow-y: auto;
- }
- .searchBtn {
- background: #20b2aa;
- color: #fff;
- border: 1px solid #20b2aa;
- }
- ::v-deep {
- .el-input__inner {
- border-radius: 1px;
- }
- .el-button--small {
- border-radius: 1px;
- }
- .tableHeader th {
- background-color: #edf0f5;
- height: 35px;
- padding: 0;
- }
- }
- </style>
|