Commit d146a050 authored by krysent's avatar krysent

ccc

parent 480ef123
......@@ -41,7 +41,7 @@ const EditTable = (props) => {
}
const result = await doFetch({ url: path, params: newparams });
//分页结果
let data = result?.data?.page?.list,
let data = result?.data?.page?.records,
success = true,
total = result?.data?.page?.total;
//不带分页获取结果
......
......@@ -85,8 +85,8 @@ let FormRender = memo(({ fields = [], colProps, proformRef }) => {
function InitForm({
formRef,
onFinish = (vals,extra) => {
console.log(vals,extra);
onFinish = (vals, extra) => {
console.log(vals, extra);
},
formKey,
params = {},
......@@ -115,6 +115,7 @@ function InitForm({
? submitter
: {
render: (props, doms) => {
console.log("submitterProps", props);
return [
<Button
type="reset"
......@@ -127,7 +128,10 @@ function InitForm({
type="submit"
key="submit"
variant="contained"
onClick={() => props.form?.submit?.()}
onClick={(e) => {
e.preventDefault();
return props.form?.submit?.()
}}
>
提交
</Button>,
......
......@@ -39,7 +39,7 @@ ShopProductCard.propTypes = {
product: PropTypes.object,
};
export default function ShopProductCard({ product, remove, edit, publish }) {
export default function ShopProductCard({ product, remove, edit, publish,authorized }) {
const { courseName, picUrl, createTime, statusName, type } = product;
const [confirm, setconfirm] = useState(false);
const [shut, setshut] = useState(false);
......@@ -143,7 +143,11 @@ export default function ShopProductCard({ product, remove, edit, publish }) {
</IconButton>
</Tooltip>
<Tooltip title="授权">
<IconButton>
<IconButton
onClick={() => {
authorized(product)
}}
>
<IconFont
type="icon-shouquanguanli"
style={{ fontSize: 20, color: "#ffffff" }}
......
This diff is collapsed.
This diff is collapsed.
......@@ -608,3 +608,15 @@ h4 {
}
}
}
.selecttable {
.ant-pro-table-list-toolbar-container{
margin-bottom: 24px!important;
}
.ant-pagination-options {
>div{
width: auto!important;
}
}
}
\ No newline at end of file
This diff is collapsed.
......@@ -9,11 +9,10 @@ import PRODUCTS from "@/_mock/products";
import { Box, Container, Grid, Stack, Typography } from "@mui/material";
import { useRequest } from "ahooks";
import { Empty, message } from "antd";
import { useMemo, useRef, useState } from "react";
import { useMemo, useState } from "react";
import "./index.less";
function Lessons() {
const actionRef = useRef();
const [dialogprops, setdialogprops] = useState({
open: false,
});
......@@ -59,6 +58,24 @@ function Lessons() {
});
};
const authorized = (row) => {
doFetch({
url: "/sysCourseTeacher/queryRelationTeacher",
params: { courseId: row?.id },
}).then((res) => {
if (res.code === "0000") {
console.log(res?.data?.dataList);
setdialogprops({
open: true,
maxWidth: "xl",
defaultFormValue: { ...row },
teacherIdList: res?.data?.dataList,
title: "授权",
});
}
});
};
const remove = (row) => {
runAsync({
url: "/sysCourse/delete",
......@@ -109,29 +126,88 @@ function Lessons() {
dialogprops={dialogprops}
maxWidth={dialogprops?.maxWidth ?? "xs"}
>
<InitForm
fields={columns}
defaultFormValue={dialogprops?.defaultFormValue}
onFinish={(val, extra) => {
let postdata = { ...val };
switch (dialogprops?.title) {
case "编辑":
postdata = {
...val,
id: dialogprops?.defaultFormValue?.id,
};
break;
default:
break;
}
runAsync({
url: "/sysCourse/saveOrUpdate",
params: postdata,
});
}}
></InitForm>
{dialogprops?.title === "编辑" ? (
<InitForm
fields={columns}
defaultFormValue={dialogprops?.defaultFormValue}
onFinish={(val, extra) => {
let postdata = { ...val };
switch (dialogprops?.title) {
case "编辑":
postdata = {
...val,
id: dialogprops?.defaultFormValue?.id,
};
break;
default:
break;
}
runAsync({
url: "/sysCourse/saveOrUpdate",
params: postdata,
});
}}
></InitForm>
) : (
<InitForm
// defaultFormValue={{
// teacherIdList: dialogprops?.teacherIdList,
// }}
fields={[
{
rowKey: "id",
rowName: "id",
valueType: "FormSelectList",
dataIndex: "teacherIdList",
colProps: {
span: 24,
},
columns: [
{
title: "账号",
key: "userAccount",
dataIndex: "userAccount",
readonly: true,
},
{
title: "教师姓名",
key: "name",
dataIndex: "name",
readonly: true,
},
{
title: "学校名称",
key: "schoolName",
dataIndex: "schoolName",
readonly: true,
},
{
title: "院系名称",
key: "departmentName",
dataIndex: "departmentName",
readonly: true,
},
],
path: "/user/page",
params: {
type: "2",
},
},
]}
onFinish={(val) => {
console.log(val);
const teacherIdList = val?.teacherIdList?.map((it) => it?.id);
runAsync({
url: "/sysCourseTeacher/relationCourseTeacher",
params: {
teacherIdList,
courseId: dialogprops?.defaultFormValue?.id,
},
});
}}
/>
)}
</DraggableDialog>
<Box
display={"flex"}
justifyContent={"space-between"}
......@@ -183,6 +259,7 @@ function Lessons() {
edit={edit}
remove={remove}
publish={publish}
authorized={authorized}
/>
</Grid>
))
......
// 传入富文本内容 string , 判断当前富文本是否有输入内容
export default (content) => {
let filterContent = content.replace(/<[^<>]+>/g, "").replace(/&nbsp;/gi, "");
if (filterContent == "") return true;
let regu = "^[ ]+$";
let re = new RegExp(regu);
return re.test(filterContent);
};
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