123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282 |
- import {
- processStatus,
- liquidationStatus,
- approvedState,
- newOrderStatus,
- invoiceStatus,
- post,
- patternOrganization,
- station,
- conditionOrganization,
- addressList,
- categoryState,
- gameState,
- } from './dataDic';
- // 流程状态
- const getProcessStatus =(e) => {
- if (e || e === 0) {
- let theType = "";
- processStatus.forEach((item) => {
- if (item.value === e.toString()) {
- theType = item.key;
- }
- });
- return theType;
- }
- return '';
- }
- // 结算状态
- const getLiquidationStatus = (e) => {
- if (e || e === 0) {
- let theType = "";
- liquidationStatus.forEach((item) => {
- if (item.value === e.toString()) {
- theType = item.key;
- }
- });
- return theType;
- }
- return '';
- }
- // 特批状态
- const getApprovedState = (e) => {
- if (e || e === 0) {
- let theType = "";
- approvedState.forEach((item) => {
- if (item.value === e.toString()) {
- theType = item.key;
- }
- });
- return theType;
- }
- return '';
- }
- // 订单状态
- const getNewOrderStatus = (e) => {
- if (e || e === 0) {
- let theType = "";
- newOrderStatus.forEach((item) => {
- if (item.value === e.toString()) {
- theType = item.key;
- }
- });
- return theType;
- }
- return '';
- }
- // 开票状态
- const getInvoiceStatus = (e, record) => {
- if (record && record.approval === 1) {
- return "特批待审核";
- }else{
- if (e || e === 0) {
- let theType = "";
- invoiceStatus.forEach((item) => {
- if (item.value === e.toString()) {
- theType = item.key;
- }
- });
- return theType;
- }
- }
- }
- // 职务
- const getPost = (e) => {
- if (e) {
- let theType = "";
- post.map((item) => {
- if (item.value === e) {
- theType = item.key;
- }
- });
- return theType;
- }
- }
- // 岗位
- const getStation = (e) => {
- if (e) {
- let theType = "";
- station.map((item) => {
- if (item.value === e) {
- theType = item.key;
- }
- });
- return theType;
- }
- }
- // 组织类型
- const getPattern = (e) => {
- if (e) {
- let theType = "";
- patternOrganization.map((item) => {
- if (item.value === e) {
- theType = item.key;
- }
- });
- return theType;
- }
- }
- // 组织状态
- const getCondition = (e) => {
- if (e) {
- let theType = "";
- conditionOrganization.map((item) => {
- if (item.value === e) {
- theType = item.label;
- }
- });
- return theType;
- }
- }
- // 品类状态
- const getCategoryState = (e) => {
- if (e) {
- let theType = "";
- categoryState.map((item) => {
- if (item.value === e) {
- theType = item.key;
- }
- });
- return theType;
- }
- }
- // 处理图片地址
- const splitUrl = (string, i, url) => {
- let theList = [];
- let theArr = [];
- if (string && string.length) {
- theArr = string.split(i);
- theArr.map((item, i) => {
- let name = item.substring(item.lastIndexOf("_") + 1);
- theList.push({
- uid: -i - 1,
- name: name,
- url: url + item,
- response: {
- data: item,
- },
- });
- });
- }
- return {fileList:theList};
- }
- // 品类状态
- const getGameState = (index) => {
- let e = index ? index.toString() : "";
- if (e) {
- let theType = "";
- gameState.map((item) => {
- if (item.value === e) {
- theType = item.key;
- }
- });
- return theType;
- }
- }
- const citySelect = () => {
- let option = [];
- addressList.map((item, i) => {
- if (item.cityList.length) {
- let cityArr = [];
- item.cityList.map((city, n) => {
- cityArr.push({
- value: city.id,
- label: city.name
- });
- });
- option.push({
- value: item.id,
- label: item.name,
- });
- } else {
- option.push({
- value: item.id,
- label: item.name
- });
- };
- });
- return option;
- }
- // 地区选择 省市区
- const getAddressSelect = (arr = addressList) => {
- arr.map((v) =>{
- v.label = v.name;
- v.value = v.id;
- if(v.cityList){
- v.children = v.cityList;
- getAddressSelect(v.children);
- }
- if(v.areaList){
- v.children = v.areaList;
- getAddressSelect(v.children);
- }
- })
- return arr.filter(v=>v.id)
- }
- // 省份转换
- const getprovince = (e) => {
- let nub = parseInt(e);
- let theType = "";
- if (nub <= 34) {
- addressList.map((item) => {
- if (item.id === nub) {
- theType = item.name;
- }
- });
- }
- if (nub > 34 && nub < 380) {
- addressList.map((item) => {
- item.cityList && item.cityList.map((city) => {
- if (city.id === nub) {
- theType = city.name;
- }
- });
- });
- }
- if (nub >= 380) {
- addressList.map((item) => {
- item.cityList && item.cityList.map((city) => {
- city.areaList && city.areaList.map((areas) => {
- if (areas.id === nub) {
- theType = areas.name;
- }
- });
- });
- });
- }
- return theType;
- }
- export {
- getProcessStatus,
- getLiquidationStatus,
- getApprovedState,
- getNewOrderStatus,
- getInvoiceStatus,
- getPost,
- getPattern,
- getStation,
- splitUrl,
- getCondition,
- citySelect,
- getCategoryState,
- getGameState,
- getprovince,
- getAddressSelect,
- };
|