Commit 0c1c9338 authored by menglingjun's avatar menglingjun

Merge remote-tracking branch 'origin/dev' into dev

parents dbadb4d9 a43d1b10
...@@ -27,4 +27,17 @@ export function getAuxiliaryInfo(month) { ...@@ -27,4 +27,17 @@ export function getAuxiliaryInfo(month) {
url: `${baseUrl.taskEstimate}/auxiliary-info/${month}`, url: `${baseUrl.taskEstimate}/auxiliary-info/${month}`,
method: 'get' method: 'get'
}); });
}
/*
* 导出工时表
*/
export function exportExcel(parameter) {
return axios({
responseType: 'blob',
headers: {'Accept': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'},
url: `${baseUrl.taskEstimate}/export`,
method: 'post',
data: parameter,
})
} }
\ No newline at end of file
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
:title="modalTitle" :title="modalTitle"
v-model="visible" v-model="visible"
@ok="handleOk" @ok="handleOk"
@cancel="clearData"
:maskClosable="false" :maskClosable="false"
:width="modalWidth" :width="modalWidth"
class="cust-modal" class="cust-modal"
...@@ -12,7 +13,7 @@ ...@@ -12,7 +13,7 @@
<a-row> <a-row>
<a-col :span="12"> <a-col :span="12">
<a-form-item label='假期名称' :labelCol="{ span: 5 }" :wrapperCol="{ span: 17 }" > <a-form-item label='假期名称' :labelCol="{ span: 5 }" :wrapperCol="{ span: 17 }" >
<a-input v-model="detailInfo.name" v-decorator="['假期名称', {initialValue: detailInfo.name,rules: [{ required: true, message: '请输入假期名称' }]}]" placeholder="双休日请输入星期六或星期日" /> <a-input v-model="detailInfo.name" v-decorator="['name', {initialValue: detailInfo.name,rules: [{ required: true, message: '请输入假期名称' }]}]" placeholder="双休日请输入星期六或星期日" />
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="12"> <a-col :span="12">
...@@ -33,8 +34,8 @@ ...@@ -33,8 +34,8 @@
</a-form-item> </a-form-item>
<a-form-item v-else label='假期范围' :labelCol="{ span: 5 }" :wrapperCol="{ span: 17 }"> <a-form-item v-else label='假期范围' :labelCol="{ span: 5 }" :wrapperCol="{ span: 17 }">
<a-range-picker v-decorator="['假期范围', { initialValue: dateRange,rules: [{ required: true, message: '请选择假期范围' }]}]" :disabled-date="disabledDate" v-if="isEdit" v-model="dateRange" @change="onChange" /> <a-range-picker v-decorator="['dayRange', { initialValue: dateRange,rules: [{ required: true, message: '请选择假期范围' }]}]" :disabled-date="disabledDate" v-if="isEdit" v-model="dateRange" @change="onChange" />
<a-range-picker v-decorator="['假期范围', {rules: [{ required: true, message: '请选择假期范围' }]}]" :disabled-date="disabledDate" v-else @change="onChange" /> <a-range-picker v-decorator="['dayRange', {rules: [{ required: true, message: '请选择假期范围' }]}]" :disabled-date="disabledDate" v-else @change="onChange" />
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="12"> <a-col :span="12">
...@@ -71,8 +72,11 @@ export default { ...@@ -71,8 +72,11 @@ export default {
}, },
watch:{ watch:{
detailData(){ detailData(){
this.form.setFieldsValue({
name: this.detailData.name,
dayRange: [moment(this.detailData.startDate), moment(this.detailData.endDate)]
})
this.detailInfo = this.detailData this.detailInfo = this.detailData
this.dateRange = [moment(this.detailData.startDate), moment(this.detailData.endDate)]
this.durationInput = this.detailData.dayCode === SYS_CONST.HOLIDAY_TYPE.WEEKEND this.durationInput = this.detailData.dayCode === SYS_CONST.HOLIDAY_TYPE.WEEKEND
this.dateTime = moment(this.detailData.startDate) this.dateTime = moment(this.detailData.startDate)
} }
...@@ -84,6 +88,7 @@ export default { ...@@ -84,6 +88,7 @@ export default {
addHoliday(this.detailInfo).then(response => { addHoliday(this.detailInfo).then(response => {
if (response && response.code == SYS_CONST.REQUEST.SUCCEED) { if (response && response.code == SYS_CONST.REQUEST.SUCCEED) {
this.visible = false; this.visible = false;
this.clearData()
this.$emit('flushData') this.$emit('flushData')
} }
}) })
...@@ -107,6 +112,12 @@ export default { ...@@ -107,6 +112,12 @@ export default {
}, },
disabledDate(current){ disabledDate(current){
return (current.year() !== this.detailData.year) return (current.year() !== this.detailData.year)
},
clearData(){
this.form.setFieldsValue({
name: '',
dayRange: []
})
} }
}, },
} }
......
...@@ -13,6 +13,19 @@ ...@@ -13,6 +13,19 @@
<!-- <div class="q-mt-md" />--> <!-- <div class="q-mt-md" />-->
<!-- <q-btn @click="addTask" icon="mdi-plus" label="Add tas k" />--> <!-- <q-btn @click="addTask" icon="mdi-plus" label="Add tas k" />-->
<!-- </q-page>--> <!-- </q-page>-->
<div style="margin-top: 20px">
<a-pagination
@change="pageChange"
:defaultPageSize="defaultPageSize"
@showSizeChange="sizeChange"
class="cust-pagination"
size="small"
:total="total"
showSizeChanger
showQuickJumper
:showTotal="$showTotal"/>
</div>
</a-card> </a-card>
</template> </template>
<script> <script>
...@@ -148,7 +161,9 @@ export default { ...@@ -148,7 +161,9 @@ export default {
tasks, tasks,
options, options,
dynamicStyle: {}, dynamicStyle: {},
lastId: 16 lastId: 16,
defaultPageSize: 10,
total: 20
} }
}, },
methods: { methods: {
...@@ -166,43 +181,44 @@ export default { ...@@ -166,43 +181,44 @@ export default {
if (response && response.code == SYS_CONST.REQUEST.SUCCEED) { if (response && response.code == SYS_CONST.REQUEST.SUCCEED) {
let respData = response.data; let respData = response.data;
let taskList = []; let taskList = [];
console.log(respData) respData = respData.splice(0,30)
// for (const respDataKey in respData) { for (const respDataKey in respData) {
// let day = this.GetNumberOfDays(new Date(),respDataKey.begin); let day = this.GetNumberOfDays(new Date(),respData[respDataKey].begin);
// let duration = this.GetNumberOfDays(respDataKey.begin,respDataKey.end); let duration = this.GetNumberOfDays(respData[respDataKey].begin,respData[respDataKey].end);
// // 父元素 // 父元素
// if(respDataKey.parentId == null){ if(respData[respDataKey].parentId === null){
// taskList.push({ taskList.push({
// id: respDataKey.id, id: respData[respDataKey].id,
// name: respDataKey.name, name: respData[respDataKey].name,
// user: '', user: '',
// start: getDate(24 * day), start: getDate(24 * day),
// duration: duration * 24 * 60 * 60 * 1000, duration: duration * 24 * 60 * 60 * 1000,
// percent: 85, percent: 85,
// type: "project" type: "project"
// }) })
// // 子元素 // 子元素
// }else { }else {
// taskList.push({ taskList.push({
// id: respDataKey.id, id: respData[respDataKey].id,
// name: "", name: "",
// user:'<span style=\'color:#1eb0bc\'>'+respDataKey.name+'</span>', user:'<span style=\'color:#1eb0bc\'>'+respData[respDataKey].name+'</span>',
// parentId: respDataKey.parentId, parentId: respData[respDataKey].parentId,
// start: getDate(24 * day), start: getDate(24 * day),
// duration: duration * 24 * 60 * 60 * 1000, duration: duration * 24 * 60 * 60 * 1000,
// percent: 50, percent: 50,
// type: "milestone", type: "milestone",
// collapsed: true, collapsed: true,
// style: { style: {
// base: { base: {
// fill: "#1EBC61", fill: "#1EBC61",
// stroke: "#0EAC51" stroke: "#0EAC51"
// } }
// } }
// }) })
// } }
//
// } }
this.tasks = taskList
} }
}); });
}, },
...@@ -212,6 +228,12 @@ export default { ...@@ -212,6 +228,12 @@ export default {
let a2 = Date.parse(new Date(date2)); let a2 = Date.parse(new Date(date2));
let day = parseInt((a2-a1)/ (1000 * 60 * 60 * 24));//核心:时间戳相减,然后除以天数 let day = parseInt((a2-a1)/ (1000 * 60 * 60 * 24));//核心:时间戳相减,然后除以天数
return day return day
},
pageChange(){
},
sizeChange(){
} }
}, },
mounted() { mounted() {
......
...@@ -71,6 +71,9 @@ ...@@ -71,6 +71,9 @@
</span> </span>
<div class="cust-table-operator"> <div class="cust-table-operator">
<a-button-group> <a-button-group>
<a-button type="primary" @click="exportExcel" ghost>
导出
</a-button>
<a-button type="primary" @click="search">查询</a-button> <a-button type="primary" @click="search">查询</a-button>
<a-button @click="reset">重置</a-button> <a-button @click="reset">重置</a-button>
</a-button-group> </a-button-group>
...@@ -98,7 +101,7 @@ ...@@ -98,7 +101,7 @@
</template> </template>
<script> <script>
import { getPage, getAuxiliaryInfo } from "@/api/task/task"; import { getPage, getAuxiliaryInfo, exportExcel } from "@/api/task/task";
import { getSelectableProjects } from "@/api/project/project"; import { getSelectableProjects } from "@/api/project/project";
import { humpToLine, setOrder } from "@/util/util"; import { humpToLine, setOrder } from "@/util/util";
import moment from "moment"; import moment from "moment";
...@@ -234,6 +237,7 @@ export default { ...@@ -234,6 +237,7 @@ export default {
this.loadData(); this.loadData();
}, },
projectChange() { projectChange() {
this.query.page = 1;
this.loadData(); this.loadData();
}, },
pageChange(page) { pageChange(page) {
...@@ -291,6 +295,14 @@ export default { ...@@ -291,6 +295,14 @@ export default {
// 重新计算当月天数 // 重新计算当月天数
this.dayOfTheMonth = date.daysInMonth(); this.dayOfTheMonth = date.daysInMonth();
}, },
exportExcel() {
exportExcel(this.query).then((response) => {
let fileDownload = require("js-file-download");
fileDownload(response.data, `${this.query.month}${
this.query.projectId? this.projectOptions.filter(p => p.value == this.query.projectId)[0].title : ''}工时明细.xlsx`);
this.loading = false;
});
},
}, },
mounted() { mounted() {
getSelectableProjects().then(({ data }) => { getSelectableProjects().then(({ data }) => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment