Commit ad838d3a by chengming

增加上下移动投票

parent bdba67bb
......@@ -960,13 +960,13 @@ class homePage extends Component {
<img src={img4} alt="" />
行为分析
</p>
<Button
{/* <Button
type="primary"
onClick={this.handleDownload}
className={styles.downloadBtn}
>
下载Excel
</Button>
</Button> */}
</div>
<div className={styles.box}>
{/* 顶部四个栏目 */}
......
......@@ -33,6 +33,7 @@ import {
getSeeEdit,
postUpdata,
nullSeeEdit,
readExport
} from "./redux/action";
import moment from "moment";
import Styles from "./index.less";
......@@ -551,6 +552,10 @@ class Information extends React.Component {
}
);
};
readExportDown = (id) => {
const { readExport } = this.props;
readExport({ informationId: id });
};
//关闭评论管理
hideComment = () => {
this.setState({
......@@ -1075,6 +1080,12 @@ class Information extends React.Component {
>
评论管理
</a>
<a
className={Styles.marr10}
onClick={() => this.readExportDown(record.id, record.name)}
>
阅读明细导出
</a>
{record.state == "2" ? (
<div style={{ display: "inline" }}>
<a
......@@ -1322,6 +1333,7 @@ function mapDispatchToProps(dispatch) {
getSeeEdit: (obj, callback) => dispatch(getSeeEdit(obj, callback)),
postUpdata: (obj, callback) => dispatch(postUpdata(obj, callback)),
nullSeeEdit: (obj, callback) => dispatch(nullSeeEdit(obj, callback)),
readExport: (obj, callback) => dispatch(readExport(obj, callback)),
};
}
......
......@@ -16,6 +16,7 @@ const {
getSeeEditApi,
postUpdataApi,
getMenuApi,
readExportApi
} = apis;
//资讯管理
......@@ -239,3 +240,15 @@ export function getMenu(data, callback) {
});
};
}
export function readExport(param) {
return dispatch => {
return request({
url: readExportApi,
data: param,
}).then(res => {
// message.success(res.data);
message.loading("数据导出中..", 5).then(() => window.open(res.data));
});
};
}
\ No newline at end of file
......@@ -13,6 +13,7 @@ export default {
getSeeEditApi: `GET ${services.webManage}/site/classify/info/view`,
postUpdataApi: `POST ${services.webManage}/site/classify/info/update`,
getMenuApi: `GET ${services.base}/system/dictionary/child/listByCode`,
readExportApi: `GET ${services.webManage}/site/classify/info/readExport`,
comment: {
getCommentsList: `GET ${services.webManage}/tpComment/list`,
getRepCommentList: `GET ${services.webManage}/tpCommentReply/list`,
......
......@@ -24,6 +24,7 @@ import {
insertTestFetch,
updateFetch,
getDelete,
moveTestFetch,
} from "../redux/actions";
// import Remind from '../../../../common/remind'
import TestModal from "../Create/TestModal";
......@@ -164,11 +165,11 @@ class Details extends Component {
console.log("跳转", this.props);
this.props.history.push(
"/" +
companyCode +
"/" +
siteCode +
"/index/tool/survey/survey-management?tab=" +
(this.state.isupdata == 1 ? "2" : "1")
companyCode +
"/" +
siteCode +
"/index/tool/survey/survey-management?tab=" +
(this.state.isupdata == 1 ? "2" : "1")
);
}
});
......@@ -195,6 +196,18 @@ class Details extends Component {
canEdit: false,
});
}
//上移下移 1下移 2上移
handleMove(record, type) {
let newNo = type == 2 ? record.no - 1 : record.no + 1;
const { surid } = this.props;
this.props.move(
{ questionId: record.id, no: newNo },
surid,
this.state.pageNo,
this.state.pageSize
);
}
handleOk() {
const { surid } = this.props;
const { editstate, editid } = this.state;
......@@ -222,7 +235,11 @@ class Details extends Component {
type: values.type,
content: values.content,
logoSrc: values.logoSrc,
contentAppendixUrl: this.state.fileUrl ? this.state.fileUrl : this.state.testItem.contentAppendixUrl ? this.state.testItem.contentAppendixUrl : "",
contentAppendixUrl: this.state.fileUrl
? this.state.fileUrl
: this.state.testItem.contentAppendixUrl
? this.state.testItem.contentAppendixUrl
: "",
needAnswer: values.needAnswer ? 1 : 0,
questionOptions: objs,
maxSelectItem: values.needAnswer2 ? values.maxSelectItem : "",
......@@ -296,13 +313,13 @@ class Details extends Component {
},
defaultUrl: this.state.testItem.contentAppendixUrl
? [
{
uid: 1,
status: "done",
url: this.state.testItem.contentAppendixUrl,
name: this.state.testItem.contentAppendixUrl.split("prefix=")[1],
},
]
{
uid: 1,
status: "done",
url: this.state.testItem.contentAppendixUrl,
name: this.state.testItem.contentAppendixUrl.split("prefix=")[1],
},
]
: [],
};
const formItemLayout = {
......@@ -313,9 +330,9 @@ class Details extends Component {
const columns = [
{
title: "序号",
dataIndex: "no",
key: "no",
key: "index",
width: 150,
render: (text, record, index) => index + 1,
},
{
title: "问题内容",
......@@ -337,16 +354,33 @@ class Details extends Component {
</div>
),
},
// 在 d:\工作\虹桥智慧党建\sass-admin\src\pages\TrainingTools\Survey\Details\index.jsx 中修改操作栏配置
{
title: "操作",
dataIndex: "operation",
key: "operation",
width: 100,
render: (text, record) => (
width: 200, // 增加宽度以容纳更多按钮
render: (text, record, index) => (
<div style={{ display: "inline" }}>
{this.state.isupdata == 1 && (
<div>
<a onClick={() => this.handleTestView(record)}>编辑</a>
{/* 添加上移按钮 */}
<a
style={{ marginLeft: "10px" }}
onClick={() => this.handleMove(record, 2)}
disabled={index === 0}
>
上移
</a>
{/* 添加下移按钮 */}
<a
style={{ marginLeft: "10px" }}
onClick={() => this.handleMove(record, 1)}
disabled={index === this.props.tlist.list.length - 1}
>
下移
</a>
<Popconfirm
title="是否删除?"
onConfirm={() => this.onDelete(record.id)}
......@@ -428,25 +462,25 @@ class Details extends Component {
<Input defaultValue={details.point} disabled />
</FormItem>
{// 修改
details.remind ? (
<MessageRemind
formItemLayout={formItemLayout}
style={{ marginLeft: "170px" }}
relationId={this.id}
remind={details.remind}
usable={true}
relationType={3}
wrappedComponentRef={form => (this.messageRemind = form)}
/>
) : (
<MessageRemind
formItemLayout={formItemLayout}
style={{ marginLeft: "170px" }}
relationType={3}
usable={true}
wrappedComponentRef={form => (this.messageRemind = form)}
/>
)}
details.remind ? (
<MessageRemind
formItemLayout={formItemLayout}
style={{ marginLeft: "170px" }}
relationId={this.id}
remind={details.remind}
usable={true}
relationType={3}
wrappedComponentRef={form => (this.messageRemind = form)}
/>
) : (
<MessageRemind
formItemLayout={formItemLayout}
style={{ marginLeft: "170px" }}
relationType={3}
usable={true}
wrappedComponentRef={form => (this.messageRemind = form)}
/>
)}
<div
style={{
width: "96%",
......@@ -522,7 +556,7 @@ class Details extends Component {
<LinkUser
type={this.type == "2" ? "look" : ""}
invisible={false}
getData={() => { }}
getData={() => {}}
initData={details.authorizes}
types={"research"}
groupTypes={"research"}
......@@ -588,6 +622,7 @@ function mapDispatchToProps(dispatch) {
edit: (obj, id, no, size) => dispatch(editTestFetch(obj, id, no, size)),
insert: (obj, no, size) => dispatch(insertTestFetch(obj, no, size)),
getDelete: (obj, callback) => dispatch(getDelete(obj, callback)),
move: (obj, callback) => dispatch(moveTestFetch(obj, callback)),
};
}
......
......@@ -495,3 +495,25 @@ export function exana(param) {
// })
};
}
//移动问题
export function moveTestFetch(params, surid, no, size) {
console.log(surid);
let param = { ...params, researchId: surid };
let url = api.moveTestFetch;
return dispatch => {
return request({
url: url,
data: param,
}).then(res => {
if (res.code === "1000") {
dispatch({ type: Types.EDIT_TEST, data: res.data });
dispatch(
getTestListFetch({ researchId: surid, pageNo: no, pageSize: size })
);
message.success("操作成功");
} else {
message.success("操作失败");
}
});
};
}
\ No newline at end of file
......@@ -40,4 +40,6 @@ export default {
jump_ques: `POST ${services.webManage}/researchQuestion/jump/question/update`,
chooses: `GET ${services.webManage}/researchQuestion/option/get`,
moveTestFetch: `POST ${services.webManage}/researchQuestion/batch/updateNo`,
};
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