Merge branch 'master' of codeup.aliyun.com:5f9118049cffa29cfdd3be1c/marketing/frontend

This commit is contained in:
姜棚 2021-11-24 18:02:59 +08:00
commit 931fa8de57
6 changed files with 96 additions and 50 deletions

5
package-lock.json generated
View File

@ -10611,6 +10611,11 @@
"minimist": "^1.2.5"
}
},
"moment": {
"version": "2.29.1",
"resolved": "https://registry.npmjs.org/moment/-/moment-2.29.1.tgz",
"integrity": "sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ=="
},
"move-concurrently": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/move-concurrently/-/move-concurrently-1.0.1.tgz",

View File

@ -47,6 +47,7 @@
"less-loader": "^4.1.0",
"lodash": "^4.17.21",
"mini-css-extract-plugin": "0.11.3",
"moment": "^2.29.1",
"optimize-css-assets-webpack-plugin": "5.0.4",
"pnp-webpack-plugin": "1.6.4",
"postcss-flexbugs-fixes": "4.2.1",

View File

@ -30,8 +30,7 @@ const upload = (method, url, params, responseType) => {
}
}
let http = fetch(url, obj).then(res =>{
window.timeshow=res.headers.get('Date-Time');
return res.json()
return res.blob()
} );
return http.then(response => response).catch(error => console.error('Error:', error));
}

View File

@ -227,8 +227,9 @@ export default class adduserinfo extends React.Component{
getPersonnel().then(res=>{
handelResponse(res,(response,msg)=>{
let personnelList=response.map(item=>{
return {key:item.id,text:item.user_name}
return {key:item.id,text:item.real_name}
});
_self.setState({personnelList});
},(err)=>{

View File

@ -10,10 +10,10 @@ import TabPage from "../../../components/tabPage/main.js"
import Filterbar from "../../../components/filterbar/main.js"
import menu from "../../../assets/enum.js"
import { nowMonth, nowDay } from "../../../assets/comm.js";
import {getOrderList,handelResponse,putOrderSuccess,putOrderCancel} from "../../../assets/api.js"
// var moment = require("moment");
// let day = moment(nowDay()).format("YYYY-MM-DD");
// let tomonth = moment(nowMonth()).format("YYYY-MM-DD");
import {getOrderList,getOrderExport,handelResponse,putOrderSuccess,putOrderCancel} from "../../../assets/api.js"
var moment = require("moment");
let day = moment(nowDay()).format("YYYY-MM-DD");
let tomonth = moment(nowMonth()).format("YYYY-MM-DD");
const Column = [
{
title: '订单号',
@ -135,6 +135,7 @@ export default class orderlist extends React.Component{
key_word:'',
officialprice:0,contractprice:0,costprice:0,totalprice:0
}
this.onChangeCombinedDate=this.onChangeCombinedDate.bind(this);
}
//选中表格的选框
selection(selection){
@ -193,8 +194,8 @@ export default class orderlist extends React.Component{
//导出订单
exportFn(){
let _self=this;
let {page,limit,key_word}=_self.state;
let data={page,limit}
let {key_word}=_self.state;
let data={}
if(this.state.combinedValue&&this.state.combinedValue[0]){
data.begin_time=this.state.combinedValue[0];
data.end_time=this.state.combinedValue[1];
@ -209,21 +210,54 @@ export default class orderlist extends React.Component{
title:'确认操作',
content: <p>是否导出订单</p>,
onConfirm(){
if(data.key_word){
window.location.href=window.baseurl+'/order/export?page='+data.page+'&limit='+data.limit+'&key_word='+data.key_word;
}else{
window.location.href=window.baseurl+'/order/export?page='+data.page+'&limit='+data.limit;
getOrderExport(data).then(res=>{
if(res.type=='application/json'){
const reader = new FileReader(); //创建一个FileReader实例
reader.readAsText(res, 'utf-8'); //读取文件,结果用字符串形式表示
reader.onload=function(){
const obj = JSON.parse(reader.result);
Notify.clear()
Notify.error(obj.message)
}
}else{
let bl = new Blob([res]);
console.log(bl);
let fileName = '订单管理'+_self.getnow()+ ".xlsx"; //设置文件名
var link = document.createElement('a');//创建<a>标签
link.href = window.URL.createObjectURL(bl);
link.download = fileName;//下载的文件名
link.click();
window.URL.revokeObjectURL(link.href);//清除URL
}
}).catch(err=>{
});
},
onCancel(){
console.log('点击了取消按钮');
},
className:'questModal',
parentComponent: this
});
}
//获取当前时间
getnow() {
var now = new Date();
var year = now.getFullYear();
var month =
now.getMonth() + 1 <= 9
? "0" + (now.getMonth() + 1)
: now.getMonth() + 1;
var day = now.getDate() <= 9 ? "0" + now.getDate() : now.getDate();
var tt = now.getHours() <= 9 ? "0" + now.getHours() : now.getHours();
var mm =
now.getMinutes() <= 9 ? "0" + now.getMinutes() : now.getMinutes();
var ss =
now.getSeconds() <= 9 ? "0" + now.getSeconds() : now.getSeconds();
let datelist = [year, month, day, tt, mm, ss];
return datelist.join("");
}
componentWillMount(){
window.time='2021-11-14 15:02:02'
this.setState({tableHeight:window.innerHeight-430});
}
@ -308,23 +342,7 @@ export default class orderlist extends React.Component{
this.setState({allcheck:false})
this.setState({itemcheck:false})
}
//获取当前时间
getnow() {
var now = new Date();
var year = now.getFullYear();
var month =
now.getMonth() + 1 <= 9
? "0" + (now.getMonth() + 1)
: now.getMonth() + 1;
var day = now.getDate() <= 9 ? "0" + now.getDate() : now.getDate();
var tt = now.getHours() <= 9 ? "0" + now.getHours() : now.getHours();
var mm =
now.getMinutes() <= 9 ? "0" + now.getMinutes() : now.getMinutes();
var ss =
now.getSeconds() <= 9 ? "0" + now.getSeconds() : now.getSeconds();
let datelist = [year, month, day, tt, mm, ss];
return datelist.join("");
}
//选择时间
onChangeCombinedDate(e){
this.setState({combinedValue:e});
@ -366,10 +384,9 @@ export default class orderlist extends React.Component{
data.key_word=key_word;
}
if(time&&time[0]==null&&time.length>1){
if( data.begin_time){
delete data.begin_time;
delete data.end_time;
}
}
getOrderList(data).then(res=>{
@ -386,12 +403,12 @@ export default class orderlist extends React.Component{
});
}
componentWillMount(){
// let datetime = [
// tomonth + " " + "00:00:00",
// day + " " + "23:59:59"
// ];
// this.setState({combinedValue:datetime});
this.getOrderFn();
let datetime = [
tomonth + " " + "00:00:00",
day + " " + "23:59:59"
];
this.setState({combinedValue:datetime});
this.getOrderFn(datetime);
}
// 监听组件内部状态的变化:
componentDidUpdate(prevProps,prevState){
@ -408,11 +425,13 @@ componentDidUpdate(prevProps,prevState){
value={this.state.combinedValue}
showTime={{
format: 'HH:mm:ss',
defaultTime: ['00:00:00', '23:59:59'],
defaultTime: ['12:00:00', '23:59:59'],
}}
format="YYYY-MM-DD HH:mm:ss"
onChange={(e)=>{this.onChangeCombinedDate(e)}}
onChange={this.onChangeCombinedDate}
/>
const { current, pageSize } = this.state;
return(
<div id="dislist">
@ -421,7 +440,7 @@ componentDidUpdate(prevProps,prevState){
<p>
{/* <Button type="primary" icon="plus" onClick={this.clickFn.bind(this)}></Button>
<Button type="danger" onClick={this.batchdelFn.bind(this)}>批量作废</Button> */}
<Button type="info" icon="download" onClick={this.exportFn.bind(this)}>导出订单</Button>
<Button type="default" icon="download" onClick={this.exportFn.bind(this)}>导出订单</Button>
</p>
{/* <Button type="info">批量操作</Button> */}

View File

@ -38,6 +38,7 @@ export default class adduserinfo extends React.Component{
componentDidMount(e){
}
componentWillMount(){
console.log(this.state);
let _self=this;
let companys=JSON.parse(sessionStorage.getItem('company'));
this.getCompanyFn();//获取公司
@ -192,10 +193,18 @@ export default class adduserinfo extends React.Component{
});
//调部门的数据
if(e){
let model3=this.state.model;
model3.deparment=""
model3.post=""
_self.setState({departmentList:[]});
_self.setState({departmentJob:[]});
_self.setState({model:model3});
getDepartment({company_id:e.key}).then(res=>{
handelResponse(res,(response,msg)=>{
let departmentList=response.map(item=>{
return {key:item.id,text:item.department_name}
_self.setState({deparment:''});
});
_self.setState({departmentList});
},(err)=>{
@ -205,6 +214,7 @@ export default class adduserinfo extends React.Component{
});
}else{
_self.setState({departmentList:[]});
_self.setState({departmentJob:[]});
}
};
onDepartmentChange(e){
@ -222,6 +232,7 @@ export default class adduserinfo extends React.Component{
this.setState({
model:model2
});
_self.setState({departmentJob:[]});
if(e){
//调岗位
getDepartmentJob({department_id:e.key}).then(res=>{
@ -230,6 +241,9 @@ export default class adduserinfo extends React.Component{
return {key:item.id,text:item.job_name}
});
_self.setState({departmentJob});
let model3=this.state.model;
model3.post=""
_self.setState({model:model3});
},(err)=>{
})
@ -301,6 +315,13 @@ export default class adduserinfo extends React.Component{
parentComponent: this
});
}
// 监听组件内部状态的变化:
// componentDidUpdate(prevProps,prevState){
// // 参数分别为改变之前的数据状态对象
// if(prevState.department!=this.state.department){
// this.setState({post:{}});
// }
// }
render(){
//校验规则
const rules = {