|
|
@@ -1,5 +1,15 @@
|
|
|
<template>
|
|
|
<basic-container>
|
|
|
+
|
|
|
+ <el-tabs type="card" v-model="cycle" @tab-click="handleClick">
|
|
|
+ <el-tab-pane label="每日報表" name="day">
|
|
|
+ </el-tab-pane>
|
|
|
+ <el-tab-pane label="每週報表" name="week">
|
|
|
+ </el-tab-pane>
|
|
|
+ <el-tab-pane label="每月報表" name="month">
|
|
|
+ </el-tab-pane>
|
|
|
+ </el-tabs>
|
|
|
+
|
|
|
<avue-crud :option="option"
|
|
|
:table-loading="loading"
|
|
|
:data="data"
|
|
|
@@ -26,8 +36,27 @@
|
|
|
v-if="permission.checklist_delete"
|
|
|
@click="handleDelete">删 除
|
|
|
</el-button>
|
|
|
+ <el-button type="primary"
|
|
|
+ size="small"
|
|
|
+ icon="el-icon-download"
|
|
|
+ plain
|
|
|
+ v-if="permission.checklist_download"
|
|
|
+ @click="handleDownload">下載
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <template slot="isChecked" slot-scope="{row, index}">
|
|
|
+ <el-tag size="small " type="primary" plain v-if="row.isChecked == 1">√</el-tag>
|
|
|
</template>
|
|
|
+
|
|
|
+ <template slot="isCheckedForm" slot-scope="{row, index}">
|
|
|
+ <el-checkbox v-model="row.isChecked"></el-checkbox>
|
|
|
+ <el-tag size="small " type="success" plain v-if="row.isChecked">已核對</el-tag>
|
|
|
+ <el-tag size="small " type="danger" plain v-if="!row.isChecked">未核對</el-tag>
|
|
|
+ </template>
|
|
|
+
|
|
|
</avue-crud>
|
|
|
+
|
|
|
</basic-container>
|
|
|
</template>
|
|
|
|
|
|
@@ -42,6 +71,7 @@
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
+ cycle: "day",
|
|
|
form: {},
|
|
|
query: {},
|
|
|
loading: true,
|
|
|
@@ -52,7 +82,10 @@
|
|
|
},
|
|
|
selectionList: [],
|
|
|
option: {
|
|
|
- height:'auto',
|
|
|
+ /*addTitle: '新增【每日】',
|
|
|
+ editTitle: '編輯【每日】',
|
|
|
+ viewTitle: '查看【每日】',*/
|
|
|
+ height: 'auto',
|
|
|
calcHeight: 30,
|
|
|
tip: false,
|
|
|
searchShow: true,
|
|
|
@@ -188,13 +221,10 @@
|
|
|
},
|
|
|
{
|
|
|
label: "已核對",
|
|
|
- prop: "checked",
|
|
|
- type: "checkbox",
|
|
|
- dicData: [{
|
|
|
- value: 1
|
|
|
- }],
|
|
|
+ prop: "isChecked",
|
|
|
+ formslot: true,
|
|
|
rules: [{
|
|
|
- required: true,
|
|
|
+ required: false,
|
|
|
message: "請勾選已核對",
|
|
|
trigger: "blur"
|
|
|
}]
|
|
|
@@ -271,7 +301,7 @@
|
|
|
});
|
|
|
getStandardByCode("checklist").then(res => {
|
|
|
const data = res.data.data;
|
|
|
- if (data){
|
|
|
+ if (Object.keys(data).length > 0){
|
|
|
this.option.addTitle = data.content;
|
|
|
this.option.editTitle = data.content;
|
|
|
this.option.viewTitle = data.content;
|
|
|
@@ -279,8 +309,49 @@
|
|
|
});
|
|
|
},
|
|
|
methods: {
|
|
|
+ handleDownload(){
|
|
|
+ if (this.selectionList.length === 0) {
|
|
|
+ this.$message.warning("请选择至少一条数据");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ let columns = this.deepClone(this.option.column);
|
|
|
+ for (let i = 0; i < columns.length; i++) {
|
|
|
+ let item = columns[i];
|
|
|
+ if (item.hide || item.prop == 'process'){
|
|
|
+ columns.splice(i, 1);
|
|
|
+ i--;
|
|
|
+ }
|
|
|
+ if (item.type == 'select' || item.type == 'tree'){
|
|
|
+ item.prop = '$' + item.prop;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.$Export.excel({
|
|
|
+ title: "核對記錄表" || new Date().getTime(),
|
|
|
+ columns: columns,
|
|
|
+ data: this.selectionList
|
|
|
+ });
|
|
|
+ },
|
|
|
+ handleClick(tab, event) {
|
|
|
+ if (!this.option.addTitle){
|
|
|
+ if (this.cycle == 'day'){
|
|
|
+ this.option.addTitle = '新增【每日】';
|
|
|
+ this.option.editTitle = '編輯【每日】';
|
|
|
+ this.option.viewTitle = '查看【每日】';
|
|
|
+ }else if (this.cycle == 'week'){
|
|
|
+ this.option.addTitle = '新增【每週】';
|
|
|
+ this.option.editTitle = '編輯【每週】';
|
|
|
+ this.option.viewTitle = '查看【每週】';
|
|
|
+ }else{
|
|
|
+ this.option.addTitle = '新增【每月】';
|
|
|
+ this.option.editTitle = '編輯【每月】';
|
|
|
+ this.option.viewTitle = '查看【每月】';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.cycle = tab.name;
|
|
|
+ this.onLoad(this.page);
|
|
|
+ },
|
|
|
rowSave(row, done, loading) {
|
|
|
- row.isChecked = row.checked[0];
|
|
|
+ row.isChecked = !row.isChecked ? 0 : 1;
|
|
|
add(row).then(() => {
|
|
|
this.onLoad(this.page);
|
|
|
this.$message({
|
|
|
@@ -294,6 +365,7 @@
|
|
|
});
|
|
|
},
|
|
|
rowUpdate(row, index, done, loading) {
|
|
|
+ row.isChecked = !row.isChecked ? 0 : 1;
|
|
|
update(row).then(() => {
|
|
|
this.onLoad(this.page);
|
|
|
this.$message({
|
|
|
@@ -346,9 +418,6 @@
|
|
|
});
|
|
|
},
|
|
|
beforeOpen(done, type) {
|
|
|
- let arr = [];
|
|
|
- arr.push(this.form.isChecked)
|
|
|
- this.form.checked = arr;
|
|
|
if (type === 'add'){
|
|
|
let userInfoStr = localStorage.getItem("saber-userInfo");
|
|
|
let userInfo = JSON.parse(userInfoStr);
|
|
|
@@ -364,17 +433,10 @@
|
|
|
});
|
|
|
}
|
|
|
if (["edit", "view"].includes(type)) {
|
|
|
- if (type == "view"){
|
|
|
- this.findObject(this.option.column, "content").tip = this.form.$content;
|
|
|
- console.log(this.form)
|
|
|
- }
|
|
|
- getDetail(this.form.id).then(res => {
|
|
|
+ this.form.isChecked = this.form.isChecked == 1;
|
|
|
+ /*getDetail(this.form.id).then(res => {
|
|
|
this.form = res.data.data;
|
|
|
- if (type == "view"){
|
|
|
- this.findObject(this.option.column, "content").tip = "this.form.$content";
|
|
|
- console.log(this.form)
|
|
|
- }
|
|
|
- });
|
|
|
+ });*/
|
|
|
|
|
|
}
|
|
|
done();
|
|
|
@@ -422,6 +484,7 @@
|
|
|
},
|
|
|
onLoad(page, params = {}) {
|
|
|
this.loading = true;
|
|
|
+ params.cycle = this.cycle;
|
|
|
getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
|
|
|
const data = res.data.data;
|
|
|
this.page.total = data.total;
|