|
@@ -3,6 +3,7 @@ import { zipItemAction, sectionItemAction, judgeItemAction, transferItemAction }
|
|
|
import Item from '../../components/item'
|
|
|
import Dialog from '../../components/Dialog'
|
|
|
import styles from './index.module.css'
|
|
|
+import { useRouteMatch } from 'react-router-dom'
|
|
|
|
|
|
const JUDGEING = 1, JUGESUCCESS = 2, JUGEERR = 3
|
|
|
const SECTIONING = 4, SECTIONSUCCESS = 5, SECTIONEERR = 6
|
|
@@ -12,6 +13,9 @@ const TRANSFERING = 13, TRANSFERSUCCESS = 14, TRANSFEREERR = 15
|
|
|
|
|
|
|
|
|
export default function Grent({ setItemStaus, modelDispatch, referData, delHandle, api, region }: any) {
|
|
|
+ const match = useRouteMatch()
|
|
|
+ const sid = (match?.params as any).sid
|
|
|
+
|
|
|
let [identity, setIdentity] = ['', (dom: HTMLSelectElement) => { identity = dom.value }]
|
|
|
let [text, setText] = ['', (dom: HTMLInputElement) => { text = dom.value }]
|
|
|
let [min, setMin] = ['9', (dom: HTMLInputElement) => {
|
|
@@ -35,7 +39,7 @@ export default function Grent({ setItemStaus, modelDispatch, referData, delHandl
|
|
|
|
|
|
const judge = async (model: Model) => {
|
|
|
model = setItemStaus(model, JUDGEING)
|
|
|
- let data = await judgeItemAction(modelDispatch, api.judge + model.id + '/', model)
|
|
|
+ let data = await judgeItemAction(modelDispatch, sid, api.judge + model.id + '/', model)
|
|
|
|
|
|
if (data.status !== 200) {
|
|
|
alert(data.message)
|
|
@@ -47,7 +51,7 @@ export default function Grent({ setItemStaus, modelDispatch, referData, delHandl
|
|
|
}
|
|
|
const zipHandle = async (model: Model) => {
|
|
|
model = setItemStaus(model, ZIPING)
|
|
|
- let data = await zipItemAction(modelDispatch, api.zip + model.id + '/', model)
|
|
|
+ let data = await zipItemAction(modelDispatch, sid, api.zip + model.id + '/', model)
|
|
|
if (data.status !== 200) {
|
|
|
alert(data.message)
|
|
|
setItemStaus(model, ZIPEERR)
|
|
@@ -60,7 +64,7 @@ export default function Grent({ setItemStaus, modelDispatch, referData, delHandl
|
|
|
const section = async (model: Model) => {
|
|
|
let param = region ? (min + '/' + max + '/') : ''
|
|
|
model = setItemStaus(model, SECTIONING)
|
|
|
- sectionItemAction(modelDispatch, api.section + model.id + '/' + param, model)
|
|
|
+ sectionItemAction(modelDispatch, sid, api.section + model.id + '/' + param, model)
|
|
|
.then(data => {
|
|
|
if (data.status !== 200) {
|
|
|
model = setItemStaus(model, SECTIONEERR)
|
|
@@ -74,7 +78,7 @@ export default function Grent({ setItemStaus, modelDispatch, referData, delHandl
|
|
|
|
|
|
const transform = async (model: Model) => {
|
|
|
model = setItemStaus(model, TRANING)
|
|
|
- sectionItemAction(modelDispatch, api.transform + model.id + '/', model)
|
|
|
+ sectionItemAction(modelDispatch, sid, api.transform + model.id + '/', model)
|
|
|
.then(data => {
|
|
|
if (data.status !== 200) {
|
|
|
model = setItemStaus(model, TRANEERR)
|
|
@@ -88,7 +92,7 @@ export default function Grent({ setItemStaus, modelDispatch, referData, delHandl
|
|
|
|
|
|
const transfer = async (model: Model) => {
|
|
|
model = setItemStaus(model, TRANSFERING)
|
|
|
- transferItemAction(modelDispatch, api.transfer + model.id + '/', model, { text: text, role: identity })
|
|
|
+ transferItemAction(modelDispatch, sid, api.transfer + model.id + '/', model, { text: text, role: identity })
|
|
|
.then(data => {
|
|
|
if (data.status !== 200) {
|
|
|
model = setItemStaus(model, TRANSFEREERR)
|