Commit 0c1c9338 authored by menglingjun's avatar menglingjun

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

parents dbadb4d9 a43d1b10
......@@ -28,3 +28,16 @@ export function getAuxiliaryInfo(month) {
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 @@
:title="modalTitle"
v-model="visible"
@ok="handleOk"
@cancel="clearData"
:maskClosable="false"
:width="modalWidth"
class="cust-modal"
......@@ -12,7 +13,7 @@
<a-row>
<a-col :span="12">
<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-col>
<a-col :span="12">
......@@ -33,8 +34,8 @@
</a-form-item>
<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="['假期范围', {rules: [{ required: true, message: '请选择假期范围' }]}]" :disabled-date="disabledDate" v-else @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="['dayRange', {rules: [{ required: true, message: '请选择假期范围' }]}]" :disabled-date="disabledDate" v-else @change="onChange" />
</a-form-item>
</a-col>
<a-col :span="12">
......@@ -71,8 +72,11 @@ export default {
},
watch:{
detailData(){
this.form.setFieldsValue({
name: this.detailData.name,
dayRange: [moment(this.detailData.startDate), moment(this.detailData.endDate)]
})
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.dateTime = moment(this.detailData.startDate)
}
......@@ -84,6 +88,7 @@ export default {
addHoliday(this.detailInfo).then(response => {
if (response && response.code == SYS_CONST.REQUEST.SUCCEED) {
this.visible = false;
this.clearData()
this.$emit('flushData')
}
})
......@@ -107,6 +112,12 @@ export default {
},
disabledDate(current){
return (current.year() !== this.detailData.year)
},
clearData(){
this.form.setFieldsValue({
name: '',
dayRange: []
})
}
},
}
......
......@@ -13,6 +13,19 @@
<!-- <div class="q-mt-md" />-->
<!-- <q-btn @click="addTask" icon="mdi-plus" label="Add tas k" />-->
<!-- </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>
</template>
<script>
......@@ -148,7 +161,9 @@ export default {
tasks,
options,
dynamicStyle: {},
lastId: 16
lastId: 16,
defaultPageSize: 10,
total: 20
}
},
methods: {
......@@ -166,43 +181,44 @@ export default {
if (response && response.code == SYS_CONST.REQUEST.SUCCEED) {
let respData = response.data;
let taskList = [];
console.log(respData)
// for (const respDataKey in respData) {
// let day = this.GetNumberOfDays(new Date(),respDataKey.begin);
// let duration = this.GetNumberOfDays(respDataKey.begin,respDataKey.end);
// // 父元素
// if(respDataKey.parentId == null){
// taskList.push({
// id: respDataKey.id,
// name: respDataKey.name,
// user: '',
// start: getDate(24 * day),
// duration: duration * 24 * 60 * 60 * 1000,
// percent: 85,
// type: "project"
// })
// // 子元素
// }else {
// taskList.push({
// id: respDataKey.id,
// name: "",
// user:'<span style=\'color:#1eb0bc\'>'+respDataKey.name+'</span>',
// parentId: respDataKey.parentId,
// start: getDate(24 * day),
// duration: duration * 24 * 60 * 60 * 1000,
// percent: 50,
// type: "milestone",
// collapsed: true,
// style: {
// base: {
// fill: "#1EBC61",
// stroke: "#0EAC51"
// }
// }
// })
// }
//
// }
respData = respData.splice(0,30)
for (const respDataKey in respData) {
let day = this.GetNumberOfDays(new Date(),respData[respDataKey].begin);
let duration = this.GetNumberOfDays(respData[respDataKey].begin,respData[respDataKey].end);
// 父元素
if(respData[respDataKey].parentId === null){
taskList.push({
id: respData[respDataKey].id,
name: respData[respDataKey].name,
user: '',
start: getDate(24 * day),
duration: duration * 24 * 60 * 60 * 1000,
percent: 85,
type: "project"
})
// 子元素
}else {
taskList.push({
id: respData[respDataKey].id,
name: "",
user:'<span style=\'color:#1eb0bc\'>'+respData[respDataKey].name+'</span>',
parentId: respData[respDataKey].parentId,
start: getDate(24 * day),
duration: duration * 24 * 60 * 60 * 1000,
percent: 50,
type: "milestone",
collapsed: true,
style: {
base: {
fill: "#1EBC61",
stroke: "#0EAC51"
}
}
})
}
}
this.tasks = taskList
}
});
},
......@@ -212,6 +228,12 @@ export default {
let a2 = Date.parse(new Date(date2));
let day = parseInt((a2-a1)/ (1000 * 60 * 60 * 24));//核心:时间戳相减,然后除以天数
return day
},
pageChange(){
},
sizeChange(){
}
},
mounted() {
......
......@@ -71,6 +71,9 @@
</span>
<div class="cust-table-operator">
<a-button-group>
<a-button type="primary" @click="exportExcel" ghost>
导出
</a-button>
<a-button type="primary" @click="search">查询</a-button>
<a-button @click="reset">重置</a-button>
</a-button-group>
......@@ -98,7 +101,7 @@
</template>
<script>
import { getPage, getAuxiliaryInfo } from "@/api/task/task";
import { getPage, getAuxiliaryInfo, exportExcel } from "@/api/task/task";
import { getSelectableProjects } from "@/api/project/project";
import { humpToLine, setOrder } from "@/util/util";
import moment from "moment";
......@@ -234,6 +237,7 @@ export default {
this.loadData();
},
projectChange() {
this.query.page = 1;
this.loadData();
},
pageChange(page) {
......@@ -291,6 +295,14 @@ export default {
// 重新计算当月天数
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() {
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