|
|
@@ -1,19 +1,47 @@
|
|
|
<template>
|
|
|
- <div class="list-view">
|
|
|
+ <div class="list-view" v-loading="tableLoading">
|
|
|
<div class="filters-container">
|
|
|
- <el-input placeholder="输入关键字" v-model="search" clearable class="filter-item"></el-input>
|
|
|
- <el-button @click="getData" type="primary" icon="el-icon-search" class="filter-item">搜索 </el-button>
|
|
|
- <el-button @click="addRow" v-if="canEdit" type="primary" icon="el-icon-plus" class="filter-item"
|
|
|
- >添加
|
|
|
- </el-button>
|
|
|
- <el-button
|
|
|
- @click="download"
|
|
|
- type="primary"
|
|
|
- icon="el-icon-download"
|
|
|
- :loading="downloading"
|
|
|
- class="filter-item"
|
|
|
- >导出EXCEL
|
|
|
- </el-button>
|
|
|
+ <div class="filter-item">
|
|
|
+ <span class="radio-label">计划开工时间:</span>
|
|
|
+ <el-radio-group v-model="planStartRadio" size="small">
|
|
|
+ <el-radio label="1" border>全部</el-radio>
|
|
|
+ <el-radio label="2" border>今天</el-radio>
|
|
|
+ <el-radio label="3" border>昨天</el-radio>
|
|
|
+ <el-radio label="4" border>本周</el-radio>
|
|
|
+ <el-radio label="5" border>本月</el-radio>
|
|
|
+ <el-radio label="6" border>自定义时间</el-radio>
|
|
|
+ </el-radio-group>
|
|
|
+ <el-date-picker
|
|
|
+ value-format="yyyy-MM-dd"
|
|
|
+ type="daterange"
|
|
|
+ v-model="planStart"
|
|
|
+ style="margin-left:10px;position:relative;top:1px;"
|
|
|
+ :disabled="planStartRadio !== '6'"
|
|
|
+ start-placeholder="请选择"
|
|
|
+ end-placeholder="请选择"
|
|
|
+ ></el-date-picker>
|
|
|
+ </div>
|
|
|
+ <div class="filter-item">
|
|
|
+ <span class="radio-label">计划完工时间:</span>
|
|
|
+ <el-radio-group v-model="planEndRadio" size="small">
|
|
|
+ <el-radio label="1" border>全部</el-radio>
|
|
|
+ <el-radio label="2" border>今天</el-radio>
|
|
|
+ <el-radio label="3" border>昨天</el-radio>
|
|
|
+ <el-radio label="4" border>本周</el-radio>
|
|
|
+ <el-radio label="5" border>本月</el-radio>
|
|
|
+ <el-radio label="6" border>自定义时间</el-radio>
|
|
|
+ </el-radio-group>
|
|
|
+ <el-date-picker
|
|
|
+ value-format="yyyy-MM-dd"
|
|
|
+ type="daterange"
|
|
|
+ v-model="planEnd"
|
|
|
+ d
|
|
|
+ style="margin-left:10px;position:relative;top:1px;"
|
|
|
+ :disabled="planEndRadio !== '6'"
|
|
|
+ start-placeholder="请选择"
|
|
|
+ end-placeholder="请选择"
|
|
|
+ ></el-date-picker>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
<el-table
|
|
|
:data="tableData"
|
|
|
@@ -27,7 +55,7 @@
|
|
|
>
|
|
|
<el-table-column v-if="multipleMode" align="center" type="selection" width="50"> </el-table-column>
|
|
|
<el-table-column prop="id" label="ID" width="100"> </el-table-column>
|
|
|
- <el-table-column prop="constructionId" label="项目"> </el-table-column>
|
|
|
+ <el-table-column prop="constructionId" label="项目" :formatter="constructionFormatter"> </el-table-column>
|
|
|
<el-table-column prop="name" label="工序名称"> </el-table-column>
|
|
|
<el-table-column prop="planStart" label="计划开工"> </el-table-column>
|
|
|
<el-table-column prop="planEnd" label="计划结束"> </el-table-column>
|
|
|
@@ -35,12 +63,11 @@
|
|
|
<el-table-column prop="principal" label="负责人"> </el-table-column>
|
|
|
<el-table-column prop="start" label="开工时间"> </el-table-column>
|
|
|
<el-table-column prop="end" label="结束时间"> </el-table-column>
|
|
|
- <el-table-column prop="remark" label="模版"> </el-table-column>
|
|
|
+ <el-table-column prop="remark" label="备注"> </el-table-column>
|
|
|
<el-table-column prop="status" label="状态" :formatter="statusFormatter"> </el-table-column>
|
|
|
- <el-table-column label="操作" v-if="canEdit" align="center" fixed="right" min-width="150">
|
|
|
+ <el-table-column label="操作" align="center" fixed="right" width="150">
|
|
|
<template slot-scope="{ row }">
|
|
|
- <el-button @click="editRow(row)" type="primary" size="mini" plain>编辑</el-button>
|
|
|
- <el-button @click="deleteRow(row)" type="danger" size="mini" plain>删除</el-button>
|
|
|
+ <el-button @click="editRow(row)" type="primary" size="mini" plain>查看</el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
@@ -70,17 +97,28 @@
|
|
|
<script>
|
|
|
import { mapState } from 'vuex';
|
|
|
import pageableTable from '@/mixins/pageableTable';
|
|
|
-
|
|
|
+import { format, parse, startOfWeek, endOfWeek, startOfMonth, endOfMonth, addDays } from 'date-fns';
|
|
|
+import { ca } from 'date-fns/locale';
|
|
|
+const f = (d, fmt) => {
|
|
|
+ return format(d, fmt || 'yyyy-MM-dd');
|
|
|
+};
|
|
|
+const p = (s, fmt) => {
|
|
|
+ return parse(s, fmt || 'yyyy-MM-dd', new Date());
|
|
|
+};
|
|
|
export default {
|
|
|
name: 'ConstructionProcessList',
|
|
|
mixins: [pageableTable],
|
|
|
created() {
|
|
|
this.getData();
|
|
|
+ this.$http.get('/construction/all', { size: 10000 }).then(res => {
|
|
|
+ this.constructions = res.content;
|
|
|
+ });
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
multipleMode: false,
|
|
|
search: '',
|
|
|
+ sortStr: 'createdAt,desc',
|
|
|
url: '/constructionProcess/all',
|
|
|
downloading: false,
|
|
|
statusOptions: [
|
|
|
@@ -88,7 +126,12 @@ export default {
|
|
|
{ label: '已开工', value: 'IN_PROGRESS' },
|
|
|
{ label: '已暂停', value: 'PAUSE' },
|
|
|
{ label: '已完工', value: 'FINISH' }
|
|
|
- ]
|
|
|
+ ],
|
|
|
+ constructions: [],
|
|
|
+ planStartRadio: '1',
|
|
|
+ planEndRadio: '1',
|
|
|
+ planStart: [],
|
|
|
+ planEnd: []
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
@@ -105,9 +148,14 @@ export default {
|
|
|
return '';
|
|
|
},
|
|
|
beforeGetData() {
|
|
|
- if (this.search) {
|
|
|
- return { search: this.search };
|
|
|
+ let data = { search: this.search, query: {} };
|
|
|
+ if (this.planStartRadio !== '1') {
|
|
|
+ data.query.planStart = this.planStart.join();
|
|
|
}
|
|
|
+ if (this.planEndRadio !== '1') {
|
|
|
+ data.query.planEnd = this.planEnd.join();
|
|
|
+ }
|
|
|
+ return data;
|
|
|
},
|
|
|
toggleMultipleMode(multipleMode) {
|
|
|
this.multipleMode = multipleMode;
|
|
|
@@ -125,9 +173,9 @@ export default {
|
|
|
},
|
|
|
editRow(row) {
|
|
|
this.$router.push({
|
|
|
- path: '/constructionProcessEdit',
|
|
|
+ path: '/constructionGantt',
|
|
|
query: {
|
|
|
- id: row.id
|
|
|
+ id: row.constructionId
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
@@ -180,8 +228,58 @@ export default {
|
|
|
this.$message.error('删除失败');
|
|
|
}
|
|
|
});
|
|
|
+ },
|
|
|
+ constructionFormatter(row, column, value, index) {
|
|
|
+ return (this.constructions.find(i => i.id === value) || {}).name;
|
|
|
+ },
|
|
|
+ getRange(type) {
|
|
|
+ let d = new Date();
|
|
|
+ switch (type) {
|
|
|
+ case '1':
|
|
|
+ return [];
|
|
|
+ case '2':
|
|
|
+ return [f(d), f(d)];
|
|
|
+ case '3':
|
|
|
+ d = addDays(d, -1);
|
|
|
+ return [f(d), f(d)];
|
|
|
+ case '4':
|
|
|
+ return [f(startOfWeek(d)), f(endOfWeek(d))];
|
|
|
+ case '5':
|
|
|
+ return [f(startOfMonth(d)), f(endOfMonth(d))];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ planStartRadio(val) {
|
|
|
+ if (val !== '6') {
|
|
|
+ this.planStart = this.getRange(val);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ planEndRadio(val) {
|
|
|
+ if (val !== '6') {
|
|
|
+ this.planEnd = this.getRange(val);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ planStart(val) {
|
|
|
+ if ((val && val.length === 2) || this.planStartRadio === '1') {
|
|
|
+ this.getData();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ planEnd(val) {
|
|
|
+ if ((val && val.length === 2) || this.planEndRadio === '1') {
|
|
|
+ this.getData();
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
</script>
|
|
|
-<style lang="less" scoped></style>
|
|
|
+<style lang="less" scoped>
|
|
|
+.radio-label {
|
|
|
+ color: #666;
|
|
|
+ font-weight: bold;
|
|
|
+ font-size: 13px;
|
|
|
+}
|
|
|
+.el-radio.is-bordered {
|
|
|
+ margin-right: 0;
|
|
|
+}
|
|
|
+</style>
|