Browse Source

fix():修改计费规则

tags/PMS_Frontend_v1.0.6-develop
guoxin 1 year ago
parent
commit
a802103243
  1. 404
      src/pages/InRoadMgm/BusinessMgm/ChargeRules/EditModal.jsx
  2. 162
      src/pages/InRoadMgm/BusinessMgm/ChargeRules/FormModal.jsx
  3. 9
      src/pages/InRoadMgm/Stuff/CategroyConf/loadable.jsx
  4. 69
      src/pages/InRoadMgm/Stuff/StuffMgm/loadable.jsx
  5. 3
      src/pages/OperationCenter/CustomerServieMgm/CallbackSuggestion/loadable.jsx
  6. 9
      src/services/search.js

404
src/pages/InRoadMgm/BusinessMgm/ChargeRules/EditModal.jsx

@ -1,9 +1,10 @@
import React, { useState, useRef, useEffect } from "react";
import { Select, Input, Button, Modal, Checkbox, DatePicker, Space, TimePicker, Form, Popover, message } from 'antd'
import { MinusCircleOutlined, PlusCircleOutlined } from "@ant-design/icons";
import { MinusCircleOutlined, PlusCircleOutlined, QuestionCircleOutlined } from "@ant-design/icons";
import "./index.scss";
import ajax from '@/services'
import moment from 'moment';
import { set } from "js-cookie";
const { TextArea } = Input;
const format = 'HH:mm';
@ -79,6 +80,7 @@ const FormModal = (props) => {
const [open, setOpen] = useState(false);
const [previousValueEnd, setPreviousValueEnd] = useState(null);
const [formData, setFormData] = useState(defaultData)
const [startTime, setStartTime] = useState([]);
const [endTime, setEndTime] = useState([]);
const [previousValueStart, setPreviousValueStart] = useState(null);
const [getNewCar, setGetNewCar] = useState(false)
@ -211,12 +213,15 @@ const FormModal = (props) => {
//
const onFinish = (data) => {
let newData = handelDate(data, 1)
ajax.deleteChangeRules(newData).then(res => {
if (res.status === 20000) {
editVisible = false
}
})
//
if(handleFormValidation(data,0)&&handleFormValidation(data,1)){
let newData = handelDate(data, 1)
ajax.deleteChangeRules(newData).then(res => {
if (res.status === 20000) {
editVisible = false
}
})
}
};
useEffect(() => {
@ -225,17 +230,11 @@ const FormModal = (props) => {
if (JSON.stringify(yisaData) != "{}") {
newObj = handelDate(yisaData, 2)
}
// console.log("1111",newObj);
newObj.rules = newObj?.source?.rules
//
if(newObj.rules!=null){
for (let i = 0; i < newObj.rules[0].details.length; i++) {
for (let z = 0; z < newObj.rules[0].details[i].items.length; z++) {
handleOptionsProcessing(i, z, options);
}
}
}
delete newObj.source
//
init(newObj);
form.setFieldsValue(newObj);
}, [yisaData]);
@ -313,18 +312,78 @@ const FormModal = (props) => {
key: 0
}
]
//
const init = (newObj) => {
console.log("11111111111newObj",newObj)
if(newObj.rules==null){
return;
}
if(newObj.rules[0].holiday.length>0){
setGetValueData(2)
}else{
newObj.rules[0].holiday = defaultData.rules[0].holiday;
}
if(newObj.rules[0].details.length>0){
for (let i = 0; i < newObj.rules[0].details.length; i++) {
for (let z = 0; z < newObj.rules[0].details[i].items.length; z++) {
handleOptionsProcessing(i, z, options,0);
}
}
}
if(newObj.rules[0].holiday.length>0){
for (let i = 0; i < newObj.rules[0].holiday.length; i++) {
for (let z = 0; z < newObj.rules[0].holiday[i].items.length; z++) {
handleOptionsProcessing(i, z, options,1);
}
}
}
}
//
const handleFormValidation = (data,type) => {
const validationData = type == 0 ? data.rules[0].details : data.rules[0].holiday
let flag = false;
let totalMinutes = 0; // 0
validationData.forEach((isData) => {
if (isData.end == null || isData.start == null) {
message.error("时间字段不能为空");
flag = false;
return;
}
const endTime = moment(isData.end, "HH:mm");
const startTime = moment(isData.start, "HH:mm");
const duration = Math.ceil(endTime.diff(startTime, "seconds") / 60);
console.log("endTime:"+ endTime + "-- startTime:" + startTime+"-- duration:"+duration); // details
totalMinutes += duration; //
});
const totalHours = Math.floor(totalMinutes / 60);
const remainingMinutes = totalMinutes % 60;
console.log("当前区间时间总和", totalHours + ":" + remainingMinutes); // details
if (totalHours === 23 && remainingMinutes === 59) {
flag = true;
} else {
message.error("时间区间总和需要为23:59,请完善区间");
}
//holiday
if(getValueData !=2 ){
data.rules[0].holiday = [];
}
return flag;
};
//
const [selectOptions, setSelectOptions] = useState({ "00": options });
const [selectHolidayOptions, setSelectHolidayOptions] = useState({ "00": options });
//&&
const handleAddRulesClick = (type) => {
const currentFormValues = form.getFieldsValue();
const data = type == 0 ? currentFormValues.rules[0].details : currentFormValues.rules[0].holiday
//
if (!handleValidation(data)) {
if (!handleValidation(data,type)) {
return;
}
//
type == 0 ? newDetails.start = moment(data[data.length - 1].end) : newHoliday.start = moment(data[data.length - 1].end)
newDetails.start = moment(data[data.length - 1].end);
newHoliday.start = moment(data[data.length - 1].end);
//
const updatedDetailsOrHoliday = [...data, type == 0 ? newDetails : newHoliday];
form.setFieldsValue({
@ -332,85 +391,105 @@ const FormModal = (props) => {
rules: [type == 0 ? { ...currentFormValues.rules[0], details: updatedDetailsOrHoliday } : { ...currentFormValues.rules[0], holiday: updatedDetailsOrHoliday }]
});
//-
handleOptionsProcessing(data.length, 0, options);
handleOptionsProcessing(data.length, 0, options,type);
console.log("当前表单", currentFormValues);
}
//&&-
const handleValidation = (data) => {
const handleValidation = (data,type) => {
let flag = true;
//24,,
const totalTimes = data.reduce((total, isData) => {
let totalMinutes = 0; // 0
data.forEach((isData) => {
if (isData.end == null || isData.start == null) {
message.error('时间字段不能为空');
message.error("时间字段不能为空");
flag = false;
return;
}
if (isData.end) {
const endTime = moment(isData.end); // end Moment
const startTime = moment(isData.start); // start Moment
const duration = moment.duration(endTime.diff(startTime)); //
return total + duration.asMilliseconds(); //
} else {
return total;
}
}, 0);
const totalHours = Math.ceil(moment.duration(totalTimes).asHours());
console.log("当前区间时间总和", totalHours); // details
if (totalHours > 24) {
message.error('当前时间区间大于24小时,不能再添加');
const endTime = moment(isData.end, "HH:mm");
const startTime = moment(isData.start, "HH:mm");
const duration = Math.ceil(endTime.diff(startTime, "seconds") / 60);
console.log("endTime:"+ endTime + "-- startTime:" + startTime+"-- duration:"+duration); // details
totalMinutes += duration; //
});
const totalHours = Math.floor(totalMinutes / 60);
const remainingMinutes = totalMinutes % 60;
console.log("当前区间时间总和", totalHours + ":" + remainingMinutes); // details
if (totalHours > 23 && totalMinutes > 59) {
message.error('时间区间总和需要为23:59,请完善区间');
flag = false;
}
return flag;
}
//
const handleAddItemsClick = (i, z) => {
const handleAddItemsClick = (i, z,type) => {
const currentFormValues = form.getFieldsValue();
const data = type == 0 ? currentFormValues.rules[0].details : currentFormValues.rules[0].holiday
//
newItems.type = data[i].items[0].type==0?2:0
//
const updatedItems = [
...currentFormValues.rules[0].details.slice(0, i),
...data.slice(0, i),
{
...currentFormValues.rules[0].details[i],
items: [...currentFormValues.rules[0].details[i].items, newItems]
...data[i],
items: [...data[i].items, newItems]
},
...currentFormValues.rules[0].details.slice(i + 1)
...data.slice(i + 1)
];
form.setFieldsValue({
...currentFormValues,
rules: [{
...currentFormValues.rules[0],
details: updatedItems
}]
});
if(type==0){
form.setFieldsValue({
...currentFormValues,
rules: [{
...currentFormValues.rules[0],
details:updatedItems,
}]
});
}else{
form.setFieldsValue({
...currentFormValues,
rules: [{
...currentFormValues.rules[0],
holiday:updatedItems,
}]
});
}
//
if (!handleItemsValidation(i, z)) {
if (!handleItemsValidation(i, z,data[i].items[0].type,type)) {
return;
}
}
//-
const handleItemsValidation = (i, z, value) => {
const handleItemsValidation = (i, z, value,type) => {
const currentFormValues = form.getFieldsValue();
// 1.
// 2.
// 3.
// 4.
const data = value == 1 || value == 2 ? options.filter(op => op.value == value) : options;
handleOptionsProcessing(i, z, data)//
handleOptionsProcessing(i, z, data,type)//
console.log("表单数据", currentFormValues);
return true;
}
//-
const handleOptionsProcessing = (i, z, data) => {
const handleOptionsProcessing = (i, z, data,type) => {
const key = i + '' + z;
console.log(key, data);
setSelectOptions(prevOptions => ({
...prevOptions,
[key]: data
}));
if(type==0){
setSelectOptions(prevOptions => ({
...prevOptions,
[key]: data
}));
}else{
setSelectHolidayOptions(prevOptions => ({
...prevOptions,
[key]: data
}));
}
};
//--value
const getOptionsValueByIndex = (i, z) => {
const getOptionsValueByIndex = (i, z,type) => {
const key = i + '' + z;
const value = selectOptions[key][z].value;
const value = type==0?selectOptions[key][z].value:selectHolidayOptions[key][z].value;
console.log("getOptionsValueByIndex", value);
return value;
};
@ -785,10 +864,10 @@ const FormModal = (props) => {
className="btm-box"
>
{
fields.length < 2 && getOptionsValueByIndex(i, z) != 1 && getOptionsValueByIndex(i, z) != 2 ?
fields.length < 2 && getOptionsValueByIndex(i, z,0) != 1 && getOptionsValueByIndex(i, z,0) != 2 ?
<PlusCircleOutlined
onClick={() =>
handleAddItemsClick(i, fields.length)
handleAddItemsClick(i, fields.length,0)
}
/> : fields.length > 1 ?
@ -852,12 +931,11 @@ const FormModal = (props) => {
<Form.List name={[name, "holiday"]}>
{(fields, { add, remove }) => (
<>
{fields.map(({ key, name, ...restField }, j) => {
// console.log(fields);
{fields.map(({ key, name, ...restField }, i) => {
return (
<div key={key}>
<div key={'holiday-' + key}>
<div className="row">
<Form.Item>
<Form.Item>
<Popover open={open}
content={'时段: 时段总和必须为24小时,例如: 时段1+时段2 = 24小时'}>
<QuestionCircleOutlined />
@ -867,22 +945,26 @@ const FormModal = (props) => {
{...restField}
name={[name, "start"]}
label="时段"
className="yisa-label"
>
<TimePicker format={format} style={{ marginLeft: 10 }} onChange={handleChangeStartTime} />
<TimePicker format={format} style={{ marginLeft: 10 }}
onChange={handleChangeStartTime} />
</Form.Item>
to
<label className="mid">to</label>
<Form.Item
{...restField}
name={[name, "end"]}
label=""
>
<TimePicker format={format} onChange={handleChangeEndTime} />
<TimePicker format={format}
onChange={handleChangeEndTime} />
</Form.Item>
<Form.Item
className="btm-box"
label=""
>
{
{
!i ?
<PlusCircleOutlined onClick={() => { handleAddRulesClick(1); }} />
:
@ -890,13 +972,13 @@ const FormModal = (props) => {
}
</Form.Item>
</div>
<Form.List name={[name, "items"]}>
{(fields, { add, remove }) => (
<>
{fields.map(({ key, name, ...restField }, z) => {
// console.log(fields);
return (
<div className="row-line" key={'items-' + i + '' + z}>
<div className="row-line" key={'holidayItems-' + i + '' + z}>
<div className="row">
<Form.Item
name={[name, "type"]}
@ -905,15 +987,16 @@ const FormModal = (props) => {
>
<Select
onChange={(value) => {
handleItemsValidation(i, z, value);
handleItemsValidation(i, z, value,1);
}}
style={{ width: 100, marginLeft: 10 }}
options={selectOptions[i + '' + z].map((option, index) => ({
options={selectHolidayOptions[i + '' + z].map((option, index) => ({
value: option.value,
label: option.label,
key: index
}))}
/>
</Form.Item>
<Form.Item
noStyle
@ -965,11 +1048,11 @@ const FormModal = (props) => {
className="btm-box"
>
{
fields.length < 2 && getOptionsValueByIndex(i, z) != 1 && getOptionsValueByIndex(i, z) != 2 ?
<PlusCircleOutlined
onClick={() =>
handleAddItemsClick(i, fields.length)
}
fields.length < 2 && getOptionsValueByIndex(i, z,1) != 1 && getOptionsValueByIndex(i, z,1) != 2 ?
<PlusCircleOutlined
onClick={() =>
handleAddItemsClick(i, fields.length,1)
}
/> : fields.length > 1 ?
<MinusCircleOutlined
onClick={() => {
@ -1005,6 +1088,173 @@ const FormModal = (props) => {
</>
)}
</Form.List>
{/* <Form.List name={[name, "holiday"]}>
{(fields, { add, remove }) => (
<>
{fields.map(({ key, name, ...restField }, j) => {
// console.log(fields);
return (
<div key={key}>
<div className="row">
<Form.Item
{...restField}
name={[name, "start"]}
label="时段"
>
<TimePicker format={format} style={{ marginLeft: 10 }} />
</Form.Item>
to
<Form.Item
{...restField}
name={[name, "end"]}
label=""
>
<TimePicker format={format} />
</Form.Item>
<Form.Item
className="btm-box"
label=""
>
{
!j ?
<PlusCircleOutlined
onClick={() =>
add({
"start": null,
"end": null,
"limit": "",
"items": [
{
"type": 0,
"segment": 0,
"threshold": 0,
"period": 0,
"unit": 0
}
]
})
}
/>
:
<MinusCircleOutlined
onClick={() => {
remove(name);
}}
/>
}
</Form.Item>
</div>
<Form.List name={[name, "items"]}>
{(fields, { add, remove }) => (
<>
{fields.map(({ key, name, ...restField }, j) => {
// console.log(fields);
return (
<div className="row-line" key={key}>
<div className="row">
<Form.Item
name={[name, "type"]}
label={"区间" + (name + 1)}
>
<Select
onChange={(v) => { setGetValue2(v) }}
style={{ width: 100, marginLeft: 10 }}
options={[
{
value: 0,
label: '基础时段',
},
{
value: 2,
label: '周期计划',
},
{
value: 1,
label: '按次收费',
},
]}
/>
</Form.Item>
{
getValue2 == 1 ?
<div className="row">
<Form.Item
{...restField}
name={[name, "unit"]}
label=""
>
<Input style={{ width: 50, marginLeft: 10 }} />
</Form.Item>
<label>/</label>
</div>
:
<div className="row">
<Form.Item
{...restField}
name={[name, "segment"]}
label=""
>
<Input style={{ width: 50, marginLeft: 10 }} />
</Form.Item>
<label>分钟</label>
<Form.Item
{...restField}
name={[name, "unit"]}
label=""
>
<Input style={{ width: 50, marginLeft: 10 }} />
</Form.Item>
<label>/</label>
<Form.Item
{...restField}
name={[name, "period"]}
label=""
>
<Input style={{ width: 50, marginLeft: 10 }} />
</Form.Item>
<label>分钟</label>
</div>
}
<Form.Item
className="btm-box"
>
{
getValue2 === 2 ?
<PlusCircleOutlined
onClick={() =>
add({
"type": 0,
"segment": 0,
"threshold": 0,
"period": 0,
"unit": 0
})
}
/> : fields.length > 1 ?
<MinusCircleOutlined
onClick={() => {
remove(name);
}}
/>
: null
}
</Form.Item>
</div>
</div>
);
})}
</>
)}
</Form.List>
</div>
);
})}
</>
)}
</Form.List> */}
</div>
</div>
</div>

162
src/pages/InRoadMgm/BusinessMgm/ChargeRules/FormModal.jsx

@ -236,8 +236,9 @@ const FormModal = (props) => {
//
const onFinish = (data) => {
//
if(handleValidation(data.rules[0].details)&&handleValidation(data.rules[0].holiday)){
ajax.addChangeRules(data).then(res => {
if(handleFormValidation(data,0)&&handleFormValidation(data,1)){
let newData = handelDate(data, 1)
ajax.addChangeRules(newData).then(res => {
if (res.status === 20000) {
setGetAddVisible(false)
}
@ -271,8 +272,7 @@ const FormModal = (props) => {
} else {
setStartTime([])
}
};
}
const handleChangeEndTime = (time, timeString) => {
setOpen(false);
@ -287,10 +287,6 @@ const FormModal = (props) => {
setEndTime([])
}
};
//
const newItems = {
"type": 0,
@ -331,8 +327,40 @@ const FormModal = (props) => {
key: 0
}
]
//
const handleFormValidation = (data,type) => {
const validationData = type == 0 ? data.rules[0].details : data.rules[0].holiday
let flag = false;
let totalMinutes = 0; // 0
validationData.forEach((isData) => {
if (isData.end == null || isData.start == null) {
message.error("时间字段不能为空");
flag = false;
return;
}
const endTime = moment(isData.end, "HH:mm");
const startTime = moment(isData.start, "HH:mm");
const duration = Math.ceil(endTime.diff(startTime, "seconds") / 60);
console.log("endTime:"+ endTime + "-- startTime:" + startTime+"-- duration:"+duration); // details
totalMinutes += duration; //
});
const totalHours = Math.floor(totalMinutes / 60);
const remainingMinutes = totalMinutes % 60;
console.log("当前区间时间总和", totalHours + ":" + remainingMinutes); // details
if (totalHours === 23 && remainingMinutes === 59) {
flag = true;
} else {
message.error("时间区间总和需要为23:59,请完善区间");
}
//holiday
if(getValueData !=2 ){
data.rules[0].holiday = [];
}
return flag;
};
//
const [selectOptions, setSelectOptions] = useState({ "00": options });
const [selectHolidayOptions, setSelectHolidayOptions] = useState({ "00": options });
//&&
const handleAddRulesClick = (type) => {
const currentFormValues = form.getFieldsValue();
@ -342,7 +370,8 @@ const FormModal = (props) => {
return;
}
//
type == 0 ? newDetails.start = moment(data[data.length - 1].end) : newHoliday.start = moment(data[data.length - 1].end)
newDetails.start = moment(data[data.length - 1].end);
newHoliday.start = moment(data[data.length - 1].end);
//
const updatedDetailsOrHoliday = [...data, type == 0 ? newDetails : newHoliday];
form.setFieldsValue({
@ -350,86 +379,105 @@ const FormModal = (props) => {
rules: [type == 0 ? { ...currentFormValues.rules[0], details: updatedDetailsOrHoliday } : { ...currentFormValues.rules[0], holiday: updatedDetailsOrHoliday }]
});
//-
handleOptionsProcessing(data.length, 0, options);
handleOptionsProcessing(data.length, 0, options,type);
console.log("当前表单", currentFormValues);
}
//&&-
const handleValidation = (data) => {
const handleValidation = (data,type) => {
let flag = true;
//24,,
const totalTimes = data.reduce((total, isData) => {
let totalMinutes = 0; // 0
data.forEach((isData) => {
if (isData.end == null || isData.start == null) {
message.error('时间字段不能为空');
message.error("时间字段不能为空");
flag = false;
return;
}
if (isData.end) {
const endTime = moment(isData.end); // end Moment
const startTime = moment(isData.start); // start Moment
const duration = moment.duration(endTime.diff(startTime)); //
return total + duration.asMinutes(); //
} else {
return total;
}
}, 0);
const totalHours = Math.floor(totalTimes/60);
const totalMinutes = Math.floor(totalTimes % 60);
console.log("当前区间时间总和", totalHours+":"+totalMinutes); // details
if (totalHours != 23 && totalMinutes !=59) {
const endTime = moment(isData.end, "HH:mm");
const startTime = moment(isData.start, "HH:mm");
const duration = Math.ceil(endTime.diff(startTime, "seconds") / 60);
console.log("endTime:"+ endTime + "-- startTime:" + startTime+"-- duration:"+duration); // details
totalMinutes += duration; //
});
const totalHours = Math.floor(totalMinutes / 60);
const remainingMinutes = totalMinutes % 60;
console.log("当前区间时间总和", totalHours + ":" + remainingMinutes); // details
if (totalHours > 23 && totalMinutes > 59) {
message.error('时间区间总和需要为23:59,请完善区间');
flag = false;
}
return flag;
}
//
const handleAddItemsClick = (i, z) => {
const handleAddItemsClick = (i, z,type) => {
const currentFormValues = form.getFieldsValue();
const data = type == 0 ? currentFormValues.rules[0].details : currentFormValues.rules[0].holiday
//
newItems.type = data[i].items[0].type==0?2:0
//
const updatedItems = [
...currentFormValues.rules[0].details.slice(0, i),
...data.slice(0, i),
{
...currentFormValues.rules[0].details[i],
items: [...currentFormValues.rules[0].details[i].items, newItems]
...data[i],
items: [...data[i].items, newItems]
},
...currentFormValues.rules[0].details.slice(i + 1)
...data.slice(i + 1)
];
form.setFieldsValue({
...currentFormValues,
rules: [{
...currentFormValues.rules[0],
details: updatedItems
}]
});
if(type==0){
form.setFieldsValue({
...currentFormValues,
rules: [{
...currentFormValues.rules[0],
details:updatedItems,
}]
});
}else{
form.setFieldsValue({
...currentFormValues,
rules: [{
...currentFormValues.rules[0],
holiday:updatedItems,
}]
});
}
//
if (!handleItemsValidation(i, z)) {
if (!handleItemsValidation(i, z,data[i].items[0].type,type)) {
return;
}
}
//-
const handleItemsValidation = (i, z, value) => {
const handleItemsValidation = (i, z, value,type) => {
const currentFormValues = form.getFieldsValue();
// 1.
// 2.
// 3.
// 4.
const data = value == 1 || value == 2 ? options.filter(op => op.value == value) : options;
handleOptionsProcessing(i, z, data)//
handleOptionsProcessing(i, z, data,type)//
console.log("表单数据", currentFormValues);
return true;
}
//-
const handleOptionsProcessing = (i, z, data) => {
const handleOptionsProcessing = (i, z, data,type) => {
const key = i + '' + z;
console.log(key, data);
setSelectOptions(prevOptions => ({
...prevOptions,
[key]: data
}));
if(type==0){
setSelectOptions(prevOptions => ({
...prevOptions,
[key]: data
}));
}else{
setSelectHolidayOptions(prevOptions => ({
...prevOptions,
[key]: data
}));
}
};
//--value
const getOptionsValueByIndex = (i, z) => {
const getOptionsValueByIndex = (i, z,type) => {
const key = i + '' + z;
const value = selectOptions[key][z].value;
const value = type==0?selectOptions[key][z].value:selectHolidayOptions[key][z].value;
console.log("getOptionsValueByIndex", value);
return value;
};
@ -748,7 +796,7 @@ const FormModal = (props) => {
>
<Select
onChange={(value) => {
handleItemsValidation(i, z, value);
handleItemsValidation(i, z, value,0);
}}
style={{ width: 100, marginLeft: 10 }}
options={selectOptions[i + '' + z].map((option, index) => ({
@ -809,10 +857,10 @@ const FormModal = (props) => {
className="btm-box"
>
{
fields.length < 2 && getOptionsValueByIndex(i, z) != 1 && getOptionsValueByIndex(i, z) != 2 ?
fields.length < 2 && getOptionsValueByIndex(i, z,0) != 1 && getOptionsValueByIndex(i, z,0) != 2 ?
<PlusCircleOutlined
onClick={() =>
handleAddItemsClick(i, fields.length)
handleAddItemsClick(i, fields.length,0)
}
/> : fields.length > 1 ?
<MinusCircleOutlined
@ -921,7 +969,7 @@ const FormModal = (props) => {
<>
{fields.map(({ key, name, ...restField }, z) => {
return (
<div className="row-line" key={'items-' + i + '' + z}>
<div className="row-line" key={'holidayItems-' + i + '' + z}>
<div className="row">
<Form.Item
name={[name, "type"]}
@ -930,10 +978,10 @@ const FormModal = (props) => {
>
<Select
onChange={(value) => {
handleItemsValidation(i, z, value);
handleItemsValidation(i, z, value,1);
}}
style={{ width: 100, marginLeft: 10 }}
options={selectOptions[i + '' + z].map((option, index) => ({
options={selectHolidayOptions[i + '' + z].map((option, index) => ({
value: option.value,
label: option.label,
key: index
@ -991,10 +1039,10 @@ const FormModal = (props) => {
className="btm-box"
>
{
fields.length < 2 && getOptionsValueByIndex(i, z) != 1 && getOptionsValueByIndex(i, z) != 2 ?
fields.length < 2 && getOptionsValueByIndex(i, z,1) != 1 && getOptionsValueByIndex(i, z,1) != 2 ?
<PlusCircleOutlined
onClick={() =>
handleAddItemsClick(i, fields.length)
handleAddItemsClick(i, fields.length,1)
}
/> : fields.length > 1 ?
<MinusCircleOutlined

9
src/pages/InRoadMgm/Stuff/CategroyConf/loadable.jsx

@ -51,9 +51,10 @@ function CategroyConf(props) {
//
const deployListColumns = [
{
title: '序号',
dataIndex: 'id',
key: 'id',
title: "序号",
width: 60,
align: "center",
render: (text, record, index) => index + 1,
},
{
title: '商户名称',
@ -253,7 +254,7 @@ function CategroyConf(props) {
} else if (checkData.brand_name == '') {
message.error('请选择物品类型')
} else {
ajax.saveData(data).then((res) => {
ajax.saveCateData(data).then((res) => {
if (res.status === 20000) {
setAddVisible(false)
getData(formData)

69
src/pages/InRoadMgm/Stuff/StuffMgm/loadable.jsx

@ -62,11 +62,11 @@ function StuffMgm(props) {
}
//
const onChangeList = (value) => {
let arr =value
let arrStr=[]
let newArr=arr[arr.length-1]
let arr = value
let arrStr = []
let newArr = arr[arr.length - 1]
arrStr.push(newArr)
setFormData({ ...formData, region_id:arrStr })
setFormData({ ...formData, region_id: arrStr })
}
//
const handleStatus = (v) => {
@ -105,9 +105,10 @@ function StuffMgm(props) {
//
const deployListColumns = [
{
title: '序号',
dataIndex: 'id',
key: 'id',
title: "序号",
width: 60,
align: "center",
render: (text, record, index) => index + 1,
},
{
title: '物品编号',
@ -187,11 +188,44 @@ function StuffMgm(props) {
uid: ''
})
const [getId, setGetId] = useState({})
function findParents(treeData, id) {
let allparents = []
if (treeData.length == 0) {
return
}
let findele = (data, id) => {
if (!id) return
data.forEach((item, index) => {
if (item.id == id) {
allparents.unshift(item.id)
findele(treeData, item.pid)
} else {
if (!!item.children) {
findele(item.children, id)
}
}
})
}
findele(treeData, id)
return allparents
}
// console.log('result', findParents(arrData, "1.3.1.1"))
const translateBtn = (record) => {
setGetId(record)
setEditVisible(true)
console.log(record);
/**
*
*/
console.log('region_id',findParents(getCanCaDer,record.region_id[0]));
setGetEditData(Object.assign({}, getEditData, {
region_id: record.region_id,
region_id: findParents(getCanCaDer,record.region_id[0]),
operatorid: record.operatorid,
code: record.code,
name: record.goods_name,
@ -345,9 +379,9 @@ function StuffMgm(props) {
}
const [checkData, setCheckData] = useState(param)
const onChange = (newValue) => {
let arr =newValue
let arrStr=[]
let newArr=arr[arr.length-1]
let arr = newValue
let arrStr = []
let newArr = arr[arr.length - 1]
arrStr.push(newArr)
setCheckData(
Object.assign({}, checkData, { region_id: newArr })
@ -415,9 +449,14 @@ function StuffMgm(props) {
}
const editBtn = () => {
let arr = getEditData.region_id
let arrStr = []
let newArr = arr[arr.length - 1]
arrStr.push(newArr)
let data = {
...getEditData,
id: getId.id,
region_id: newArr
}
if (getEditData.region_id == '') {
message.error('请选择区域')
@ -757,8 +796,8 @@ function StuffMgm(props) {
<div className="add">
<div className="yisa-search">
<label>区域</label>
<Cascader options={getCanCaDer}
changeOnSelect
<Cascader
options={getCanCaDer}
style={{ width: 180, marginLeft: 47 }}
value={getEditData.region_id}
fieldNames={{
@ -767,10 +806,6 @@ function StuffMgm(props) {
children: 'children'
}}
onChange={(newValue) => {
let arr =newValue
let arrStr=[]
let newArr=arr[arr.length-1]
arrStr.push(newArr)
setGetEditData(
Object.assign({}, getEditData, { region_id: newValue })
);

3
src/pages/OperationCenter/CustomerServieMgm/CallbackSuggestion/loadable.jsx

@ -647,12 +647,13 @@ function CallbackSuggestion(props) {
<div className="time">{res.replyTime}</div>
<div className="concent">{res.sysUserName}回复<span>{res.replyContent}</span></div>
<div className="picFlex">
{res.answerImgMap.length &&
{res.answerImgMap.length ?
res.answerImgMap.map(res => {
return (
<div className="pic"><Image src={res} /></div>
)
})
:''
}
</div>
</div>

9
src/services/search.js

@ -451,6 +451,14 @@ const saveData = (params) => {
data: params,
});
};
//物品管理--添加物品
const saveCateData = (params) => {
return ajax({
url: "/api/bpm/bpmgoodsbrand/add_brand_list",
type: "post",
data: params,
});
};
//物品管理--编辑物品
const saveGoodEditData = (params) => {
return ajax({
@ -1140,6 +1148,7 @@ export default {
editScheduling,
deleteScheduling,
saveEditData,
saveCateData,
checkGoods,
specialApproveApply,
specialDeployApply,

Loading…
Cancel
Save