|
@@ -1,164 +1,126 @@
|
|
|
-
|
|
|
<template>
|
|
|
- <div>
|
|
|
- <div v-if="!openDetail">
|
|
|
- <el-card>
|
|
|
- <el-form size="mini" class="search_area" label-width="120px">
|
|
|
- <el-row :gutter="10">
|
|
|
- <el-col :span="1.5">
|
|
|
- <el-form-item label="年度">
|
|
|
- <el-date-picker
|
|
|
- v-model="queryParams.params.year"
|
|
|
- type="year"
|
|
|
- value-format="yyyy-MM-dd"
|
|
|
- clearable
|
|
|
- >
|
|
|
- </el-date-picker>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="1.5">
|
|
|
- <el-form-item label="模板名称">
|
|
|
- <el-input
|
|
|
- v-model="queryParams.name"
|
|
|
- clearable
|
|
|
- />
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="1.5">
|
|
|
- <el-form-item label="开始日期">
|
|
|
- <el-date-picker
|
|
|
- size="mini"
|
|
|
- v-model="dateRange"
|
|
|
- style="width: 240px"
|
|
|
- value-format="yyyy-MM-dd"
|
|
|
- type="daterange"
|
|
|
- range-separator="-"
|
|
|
- start-placeholder="开始"
|
|
|
- end-placeholder="结束"
|
|
|
- ></el-date-picker>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="1.5">
|
|
|
- <el-form-item label="" label-width="20px">
|
|
|
- <el-button type="primary" size="mini" icon="el-icon-search" plain @click="useSearch">搜索</el-button>
|
|
|
- <el-button size="mini" icon="el-icon-refresh" plain @click="useReset">重置</el-button>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- </el-form>
|
|
|
- <el-divider></el-divider>
|
|
|
- <div class="btn_grooup">
|
|
|
- <el-button type="primary" size="mini" @click="useAdd">新增</el-button>
|
|
|
- </div>
|
|
|
+ <el-card
|
|
|
+ v-loading="loading"
|
|
|
+ :body-style="{
|
|
|
+ height: '100%',
|
|
|
+ padding: 0,
|
|
|
+ display: 'flex',
|
|
|
+ 'flex-direction': 'column',
|
|
|
+ }"
|
|
|
+ >
|
|
|
+ <el-super-search
|
|
|
+ v-model="params"
|
|
|
+ :size="size"
|
|
|
+ :dict="dict"
|
|
|
+ :columns="SearchColumns"
|
|
|
+ @reset="useReset"
|
|
|
+ @submit="getList(params, page)"
|
|
|
+ ></el-super-search>
|
|
|
|
|
|
- <el-table
|
|
|
- :data="tableList"
|
|
|
- @row-dblclick="useDoubleClick"
|
|
|
- height="600px"
|
|
|
- v-horizontal-scroll
|
|
|
- >
|
|
|
- <el-table-column label="序号" type="index" width="50" align="center" fixed/>
|
|
|
- <el-table-column show-overflow-tooltip label="年度" align="center" width="200" prop="year">
|
|
|
- <template slot-scope="scope">
|
|
|
- {{scope.row.year.substring(0,4)}}
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column show-overflow-tooltip label="模板名称" align="center" width="200" prop="name"/>
|
|
|
- <el-table-column show-overflow-tooltip label="开始日期" align="center" width="200" prop="startTime"/>
|
|
|
- <el-table-column show-overflow-tooltip label="结束日期" align="center" width="200" prop="deadlineTime"/>
|
|
|
- <el-table-column show-overflow-tooltip label="周期" align="center" width="200" prop="cycle">
|
|
|
- <template slot-scope="scope">
|
|
|
- <dict-tag
|
|
|
- :options="dict.type.mk_periodic_unit"
|
|
|
- :value="scope.row.cycle"
|
|
|
- />
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column show-overflow-tooltip label="按列展开" align="center" width="200" prop="unfold">
|
|
|
- <template slot-scope="scope">
|
|
|
- <dict-tag
|
|
|
- :options="dict.type.mk_expansion_mode"
|
|
|
- :value="scope.row.unfold"
|
|
|
- />
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column show-overflow-tooltip label="创建人" align="center" width="200" prop="createByName" />
|
|
|
- <el-table-column show-overflow-tooltip label="创建时间" align="center" width="200" prop="createTime" />
|
|
|
- <el-table-column show-overflow-tooltip label="修改人" align="center" width="200" prop="updateByName" />
|
|
|
- <el-table-column show-overflow-tooltip label="修改时间" align="center" width="200" prop="updateTime" />
|
|
|
- <el-table-column fixed="right" label="操作" align="center" width="150">
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-button type="text" size="mini" @click="useDoubleClick(scope.row)">查看</el-button>
|
|
|
- <el-button type="text" size="mini" @click="useEdit(scope.row)">编辑</el-button>
|
|
|
- <el-button type="text" size="mini" @click="useDel(scope.row)">删除</el-button>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- </el-table>
|
|
|
+ <el-row
|
|
|
+ :gutter="10"
|
|
|
+ class="mb10"
|
|
|
+ type="flex"
|
|
|
+ justify="end"
|
|
|
+ style="margin-top: 20px"
|
|
|
+ >
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <el-button type="primary" :size="size" @click="useAdd">新增</el-button>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
|
|
|
- <el-pagination
|
|
|
- background
|
|
|
- @size-change="useChangePageSize"
|
|
|
- @current-change="useCurrentChange"
|
|
|
- :current-page="queryParams.pageNum"
|
|
|
- :page-sizes="[10, 20, 50, 100]"
|
|
|
- :page-size="10"
|
|
|
- layout="total, sizes, prev, pager, next, jumper"
|
|
|
- :total=total>
|
|
|
- </el-pagination>
|
|
|
- </el-card>
|
|
|
- </div>
|
|
|
- <Detail v-if="openDetail" :openMode="openMode" :row="row"/>
|
|
|
- </div>
|
|
|
+ <el-super-ux-table
|
|
|
+ v-model="tableList"
|
|
|
+ :size="size"
|
|
|
+ :dict="dict"
|
|
|
+ :page="page"
|
|
|
+ :columns="TableColumns"
|
|
|
+ index
|
|
|
+ pagination
|
|
|
+ convenitentOperation
|
|
|
+ highlight-current-row
|
|
|
+ storage-key="targetTemplateSuperTable"
|
|
|
+ @row-dblclick="useDoubleClick"
|
|
|
+ @pagination="getList({ ...page, ...params })"
|
|
|
+ style="margin: 16px 0 0"
|
|
|
+ >
|
|
|
+ <!-- 模板 -->
|
|
|
+ <template slot="year" slot-scope="scope">
|
|
|
+ {{ scope.row.year.substring(0, 4) }}
|
|
|
+ </template>
|
|
|
+ <ux-table-column fixed="right" title="操作" align="center" width="120">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button type="text" :size="size" @click="useDoubleClick(scope.row)"
|
|
|
+ >查看</el-button
|
|
|
+ >
|
|
|
+ <el-button type="text" :size="size" @click="useEdit(scope.row)"
|
|
|
+ >编辑</el-button
|
|
|
+ >
|
|
|
+ <el-button type="text" :size="size" @click="useDel(scope.row)"
|
|
|
+ >删除</el-button
|
|
|
+ >
|
|
|
+ </template>
|
|
|
+ </ux-table-column>
|
|
|
+ </el-super-ux-table>
|
|
|
+ <Detail
|
|
|
+ ref="targetTemplateDetail"
|
|
|
+ :row="row"
|
|
|
+ :size="size"
|
|
|
+ :dict="dict"
|
|
|
+ :openMode="openMode"
|
|
|
+ @success="getList({ ...page, ...params })"
|
|
|
+ />
|
|
|
+ </el-card>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import Detail from './detail.vue'
|
|
|
-import { listTargetTemplate,delTargetTemplate,checkQuote, } from "@/api/business/spd/starget/targetTemplate";
|
|
|
+import useColumns from "./columns";
|
|
|
+import { dicts } from "./dicts";
|
|
|
+import {
|
|
|
+ listTargetTemplate,
|
|
|
+ delTargetTemplate,
|
|
|
+ checkQuote,
|
|
|
+} from "@/api/business/spd/starget/targetTemplate";
|
|
|
|
|
|
export default {
|
|
|
name: "targettemplate",
|
|
|
- dicts: ["mk_periodic_unit","mk_expansion_mode"],
|
|
|
- components: {Detail},
|
|
|
+ dicts: [...dicts],
|
|
|
+ components: {
|
|
|
+ Detail: () => import("./details/index.vue"),
|
|
|
+ ElSuperSearch: () => import("@/components/super-search/index.vue"),
|
|
|
+ ElSuperUxTable: () => import("@/components/super-ux-table/index.vue"),
|
|
|
+ },
|
|
|
data() {
|
|
|
+ const { SearchColumns, TableColumns } = useColumns();
|
|
|
+ const params = this.$init.params(SearchColumns);
|
|
|
+ const page = this.$init.page();
|
|
|
return {
|
|
|
- // 搜索框参数
|
|
|
- queryParams: {
|
|
|
- name:null,
|
|
|
- pageNum: 1,
|
|
|
- pageSize: 10,
|
|
|
- params:{
|
|
|
- year: '',
|
|
|
- }
|
|
|
- },
|
|
|
- // 查询日期范围
|
|
|
- dateRange: [],
|
|
|
- //总条数
|
|
|
- total: 0,
|
|
|
+ page,
|
|
|
+ params,
|
|
|
+ SearchColumns,
|
|
|
+ TableColumns,
|
|
|
+ size: "mini",
|
|
|
+ loading: false,
|
|
|
//列表数据
|
|
|
- tableList:[],
|
|
|
- //是否打开详情页面
|
|
|
- openDetail:false,
|
|
|
+ tableList: [],
|
|
|
//编辑页面打开方式,add或edit或see
|
|
|
- openMode:'',
|
|
|
+ openMode: "",
|
|
|
//行数据
|
|
|
- row:{},
|
|
|
+ row: {},
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
|
- this.getList(this.queryParams);
|
|
|
+ this.getList(this.params, this.page);
|
|
|
},
|
|
|
methods: {
|
|
|
- //是否打开详情页面
|
|
|
- useOpenDetail(){
|
|
|
- this.openDetail = !this.openDetail;
|
|
|
- },
|
|
|
//新增
|
|
|
- useAdd(){
|
|
|
- this.openMode = 'add';
|
|
|
- this.openDetail = true;
|
|
|
+ useAdd() {
|
|
|
+ this.openMode = "add";
|
|
|
+ let { setVisible } = this.$refs.targetTemplateDetail;
|
|
|
+ setVisible(true);
|
|
|
},
|
|
|
//编辑
|
|
|
- async useEdit(row){
|
|
|
+ async useEdit(row) {
|
|
|
const { code, data } = await checkQuote(row.id);
|
|
|
if (code == "200") {
|
|
|
if (data) {
|
|
@@ -171,12 +133,13 @@ export default {
|
|
|
this.visible = false;
|
|
|
return;
|
|
|
}
|
|
|
- this.openMode = 'edit';
|
|
|
+ this.openMode = "edit";
|
|
|
this.row = row;
|
|
|
- this.openDetail = true;
|
|
|
+ let { setVisible } = this.$refs.targetTemplateDetail;
|
|
|
+ setVisible(true);
|
|
|
},
|
|
|
//删除
|
|
|
- async useDel(row){
|
|
|
+ async useDel(row) {
|
|
|
const { code, data } = await checkQuote(row.id);
|
|
|
if (code == "200") {
|
|
|
if (data) {
|
|
@@ -189,58 +152,54 @@ export default {
|
|
|
this.visible = false;
|
|
|
return;
|
|
|
}
|
|
|
- this.$modal.confirm('确认删除选择数据').then(() => {
|
|
|
- delTargetTemplate(row.id).then(res => {
|
|
|
- if (res.code === 200) {
|
|
|
- this.$modal.msgSuccess("删除成功");
|
|
|
- this.getList(this.queryParams)
|
|
|
- }
|
|
|
+ this.$modal
|
|
|
+ .confirm("确认删除选择数据")
|
|
|
+ .then(() => {
|
|
|
+ delTargetTemplate(row.id).then((res) => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ this.$modal.msgSuccess("删除成功");
|
|
|
+ this.getList(this.params, this.page);
|
|
|
+ }
|
|
|
+ });
|
|
|
})
|
|
|
- }).catch(() => {})
|
|
|
+ .catch(() => {});
|
|
|
},
|
|
|
//查询列表
|
|
|
- getList(params){
|
|
|
- listTargetTemplate(this.addDateRange(params, this.dateRange)).then(res => {
|
|
|
- if (res.code === 200) {
|
|
|
- this.tableList = res.rows
|
|
|
- this.total = res.total
|
|
|
- console.log(res, 'res---------')
|
|
|
+ async getList(prop, page) {
|
|
|
+ try {
|
|
|
+ this.loading = true;
|
|
|
+ let params = {
|
|
|
+ ...prop,
|
|
|
+ ...page,
|
|
|
+ params: {
|
|
|
+ beginTime: prop["dateRange"] ? prop["dateRange"][0] : "",
|
|
|
+ endTime: prop["dateRange"] ? prop["dateRange"][1] : "",
|
|
|
+ },
|
|
|
+ };
|
|
|
+ delete params.dateRange;
|
|
|
+ let { code, rows, total } = await listTargetTemplate(params);
|
|
|
+ if (code === 200) {
|
|
|
+ this.tableList = rows;
|
|
|
+ this.page.total = total;
|
|
|
}
|
|
|
- })
|
|
|
+ } catch (error) {
|
|
|
+ } finally {
|
|
|
+ this.loading = false;
|
|
|
+ }
|
|
|
},
|
|
|
//双击
|
|
|
- useDoubleClick(row){
|
|
|
- this.openMode = 'see';
|
|
|
+ useDoubleClick(row) {
|
|
|
+ this.openMode = "see";
|
|
|
this.row = row;
|
|
|
- this.openDetail = true;
|
|
|
- },
|
|
|
- //改变一页显示条数
|
|
|
- useChangePageSize(val){
|
|
|
- this.queryParams.pageSize = val
|
|
|
- this.getList(this.queryParams)
|
|
|
- },
|
|
|
- //翻页
|
|
|
- useCurrentChange(val){
|
|
|
- this.queryParams.pageNum = val
|
|
|
- this.getList(this.queryParams)
|
|
|
- },
|
|
|
- //搜索
|
|
|
- useSearch() {
|
|
|
- console.log(this.queryParams, 'this.queryParams');
|
|
|
- this.getList(this.queryParams);
|
|
|
+ let { setVisible } = this.$refs.targetTemplateDetail;
|
|
|
+ setVisible(true);
|
|
|
},
|
|
|
+
|
|
|
//重置
|
|
|
- useReset(){
|
|
|
- this.dateRange = [];
|
|
|
- this.queryParams = {
|
|
|
- name: '',
|
|
|
- pageNum: 1,
|
|
|
- pageSize: 10,
|
|
|
- params:{
|
|
|
- year:'',
|
|
|
- },
|
|
|
- }
|
|
|
- this.getList(this.queryParams);
|
|
|
+ useReset() {
|
|
|
+ this.params = this.$init.params(this.SearchColumns);
|
|
|
+ this.page = this.$init.page();
|
|
|
+ this.getList(this.params, this.page);
|
|
|
},
|
|
|
},
|
|
|
};
|
|
@@ -248,21 +207,16 @@ export default {
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
.el-card {
|
|
|
- width: calc(100% - 20px);
|
|
|
- height: 100%;
|
|
|
- margin: 10px;
|
|
|
- padding: 20px;
|
|
|
+ width: calc(100% - 32px);
|
|
|
+ height: calc(100vh - 32px);
|
|
|
+ margin: 16px;
|
|
|
+ padding: 16px;
|
|
|
+ border-radius: 8px;
|
|
|
+ overflow-y: auto;
|
|
|
+ overflow-x: hidden;
|
|
|
}
|
|
|
+
|
|
|
.el-button-group + .el-button-group {
|
|
|
- margin: 0 0 0 10px;
|
|
|
-}
|
|
|
-.btn_grooup {
|
|
|
- margin-bottom: 10px;
|
|
|
- display: flex;
|
|
|
- justify-content: flex-end;
|
|
|
-}
|
|
|
-.el-pagination {
|
|
|
- margin-top: 10px;
|
|
|
- text-align: right;
|
|
|
+ margin: 0 0 0 8px;
|
|
|
}
|
|
|
</style>
|