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" "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": { "move-concurrently": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/move-concurrently/-/move-concurrently-1.0.1.tgz", "resolved": "https://registry.npmjs.org/move-concurrently/-/move-concurrently-1.0.1.tgz",

View File

@ -47,6 +47,7 @@
"less-loader": "^4.1.0", "less-loader": "^4.1.0",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"mini-css-extract-plugin": "0.11.3", "mini-css-extract-plugin": "0.11.3",
"moment": "^2.29.1",
"optimize-css-assets-webpack-plugin": "5.0.4", "optimize-css-assets-webpack-plugin": "5.0.4",
"pnp-webpack-plugin": "1.6.4", "pnp-webpack-plugin": "1.6.4",
"postcss-flexbugs-fixes": "4.2.1", "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 =>{ let http = fetch(url, obj).then(res =>{
window.timeshow=res.headers.get('Date-Time'); return res.blob()
return res.json()
} ); } );
return http.then(response => response).catch(error => console.error('Error:', error)); 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=>{ getPersonnel().then(res=>{
handelResponse(res,(response,msg)=>{ handelResponse(res,(response,msg)=>{
let personnelList=response.map(item=>{ let personnelList=response.map(item=>{
return {key:item.id,text:item.user_name} return {key:item.id,text:item.real_name}
}); });
_self.setState({personnelList}); _self.setState({personnelList});
},(err)=>{ },(err)=>{

View File

@ -10,10 +10,10 @@ import TabPage from "../../../components/tabPage/main.js"
import Filterbar from "../../../components/filterbar/main.js" import Filterbar from "../../../components/filterbar/main.js"
import menu from "../../../assets/enum.js" import menu from "../../../assets/enum.js"
import { nowMonth, nowDay } from "../../../assets/comm.js"; import { nowMonth, nowDay } from "../../../assets/comm.js";
import {getOrderList,handelResponse,putOrderSuccess,putOrderCancel} from "../../../assets/api.js" import {getOrderList,getOrderExport,handelResponse,putOrderSuccess,putOrderCancel} from "../../../assets/api.js"
// var moment = require("moment"); var moment = require("moment");
// let day = moment(nowDay()).format("YYYY-MM-DD"); let day = moment(nowDay()).format("YYYY-MM-DD");
// let tomonth = moment(nowMonth()).format("YYYY-MM-DD"); let tomonth = moment(nowMonth()).format("YYYY-MM-DD");
const Column = [ const Column = [
{ {
title: '订单号', title: '订单号',
@ -135,6 +135,7 @@ export default class orderlist extends React.Component{
key_word:'', key_word:'',
officialprice:0,contractprice:0,costprice:0,totalprice:0 officialprice:0,contractprice:0,costprice:0,totalprice:0
} }
this.onChangeCombinedDate=this.onChangeCombinedDate.bind(this);
} }
//选中表格的选框 //选中表格的选框
selection(selection){ selection(selection){
@ -193,8 +194,8 @@ export default class orderlist extends React.Component{
//导出订单 //导出订单
exportFn(){ exportFn(){
let _self=this; let _self=this;
let {page,limit,key_word}=_self.state; let {key_word}=_self.state;
let data={page,limit} let data={}
if(this.state.combinedValue&&this.state.combinedValue[0]){ if(this.state.combinedValue&&this.state.combinedValue[0]){
data.begin_time=this.state.combinedValue[0]; data.begin_time=this.state.combinedValue[0];
data.end_time=this.state.combinedValue[1]; data.end_time=this.state.combinedValue[1];
@ -209,12 +210,29 @@ export default class orderlist extends React.Component{
title:'确认操作', title:'确认操作',
content: <p>是否导出订单</p>, content: <p>是否导出订单</p>,
onConfirm(){ onConfirm(){
if(data.key_word){ getOrderExport(data).then(res=>{
window.location.href=window.baseurl+'/order/export?page='+data.page+'&limit='+data.limit+'&key_word='+data.key_word; 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{ }else{
window.location.href=window.baseurl+'/order/export?page='+data.page+'&limit='+data.limit; 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(){ onCancel(){
console.log('点击了取消按钮'); console.log('点击了取消按钮');
}, },
@ -222,8 +240,24 @@ export default class orderlist extends React.Component{
parentComponent: this 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(){ componentWillMount(){
window.time='2021-11-14 15:02:02'
this.setState({tableHeight:window.innerHeight-430}); this.setState({tableHeight:window.innerHeight-430});
} }
@ -308,23 +342,7 @@ export default class orderlist extends React.Component{
this.setState({allcheck:false}) this.setState({allcheck:false})
this.setState({itemcheck: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){ onChangeCombinedDate(e){
this.setState({combinedValue:e}); this.setState({combinedValue:e});
@ -366,10 +384,9 @@ export default class orderlist extends React.Component{
data.key_word=key_word; data.key_word=key_word;
} }
if(time&&time[0]==null&&time.length>1){ if(time&&time[0]==null&&time.length>1){
if( data.begin_time){ delete data.begin_time;
delete data.begin_time; delete data.end_time;
delete data.end_time;
}
} }
getOrderList(data).then(res=>{ getOrderList(data).then(res=>{
@ -386,12 +403,12 @@ export default class orderlist extends React.Component{
}); });
} }
componentWillMount(){ componentWillMount(){
// let datetime = [ let datetime = [
// tomonth + " " + "00:00:00", tomonth + " " + "00:00:00",
// day + " " + "23:59:59" day + " " + "23:59:59"
// ]; ];
// this.setState({combinedValue:datetime}); this.setState({combinedValue:datetime});
this.getOrderFn(); this.getOrderFn(datetime);
} }
// 监听组件内部状态的变化: // 监听组件内部状态的变化:
componentDidUpdate(prevProps,prevState){ componentDidUpdate(prevProps,prevState){
@ -403,16 +420,18 @@ componentDidUpdate(prevProps,prevState){
//过滤表格枚举状态 //过滤表格枚举状态
render(){ render(){
const date = <CombinedDateRangePicker const date = <CombinedDateRangePicker
className="zent-datepicker-demo" className="zent-datepicker-demo"
value={this.state.combinedValue} value={this.state.combinedValue}
showTime={{ showTime={{
format: 'HH:mm:ss', 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" format="YYYY-MM-DD HH:mm:ss"
onChange={(e)=>{this.onChangeCombinedDate(e)}} onChange={this.onChangeCombinedDate}
/> />
const { current, pageSize } = this.state; const { current, pageSize } = this.state;
return( return(
<div id="dislist"> <div id="dislist">
@ -421,7 +440,7 @@ componentDidUpdate(prevProps,prevState){
<p> <p>
{/* <Button type="primary" icon="plus" onClick={this.clickFn.bind(this)}></Button> {/* <Button type="primary" icon="plus" onClick={this.clickFn.bind(this)}></Button>
<Button type="danger" onClick={this.batchdelFn.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> </p>
{/* <Button type="info">批量操作</Button> */} {/* <Button type="info">批量操作</Button> */}

View File

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