@zgfe/modules-settings 1.2.51-zhongyuan.1 → 1.2.51-zhongyuan.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -33
- package/es/components/card/index.less +87 -87
- package/es/components/pageLoading/index.less +7 -7
- package/es/components/picCircleSelect/bak/index copy 2.tsx.bak +92 -92
- package/es/components/picCircleSelect/bak/index copy 3.tsx.bak +58 -58
- package/es/components/picCircleSelect/bak/index copy 4.tsx.bak +66 -66
- package/es/components/picCircleSelect/bak/index copy 5.tsx.bak +116 -116
- package/es/components/picCircleSelect/bak/index copy 6.tsx.bak +116 -116
- package/es/components/picCircleSelect/bak/index copy.tsx.bak +41 -41
- package/es/components/picCircleSelect/bak/index.tsx.bak +48 -48
- package/es/components/picCircleSelect/bak/index1.tsx.bak +46 -46
- package/es/components/picCircleSelect/bak/index2.tsx.bak +104 -104
- package/es/components/picCircleSelect/index.less +37 -37
- package/es/components/processCanvas/styles/customNode.less +149 -149
- package/es/components/processCanvas/styles/index.less +34 -34
- package/es/components/settingTabs/index.less +51 -51
- package/es/constants/api.d.ts +13 -0
- package/es/constants/api.js +18 -1
- package/es/constants/icons/demo.css +539 -539
- package/es/constants/icons/demo_index.html +9871 -9871
- package/es/constants/icons/iconfont.css +1699 -1699
- package/es/constants/icons/iconfont.json +2956 -2956
- package/es/global.d.ts +4 -4
- package/es/modules/appSettings/dataAccessFilter/index.less +5 -5
- package/es/modules/appSettings/virtualSource/styles/index.less +28 -28
- package/es/modules/appSettings/virtualSource/styles/table.less +51 -51
- package/es/modules/companySetting/appList/index.less +126 -126
- package/es/modules/companySetting/application/index.less +126 -126
- package/es/modules/companySetting/business/index.less +92 -92
- package/es/modules/companySetting/cost/index.less +38 -38
- package/es/modules/companySetting/department/index.less +157 -157
- package/es/modules/companySetting/edit/styles/authConfig.less +3 -3
- package/es/modules/companySetting/edit/styles/authGroup.less +10 -10
- package/es/modules/companySetting/edit/styles/authModule.less +82 -82
- package/es/modules/companySetting/edit/styles/user.less +54 -54
- package/es/modules/companySetting/edit/styles/userGroup.less +44 -44
- package/es/modules/companySetting/index.less +90 -90
- package/es/modules/companySetting/info/index.less +42 -42
- package/es/modules/companySetting/mainPart/images/img2.svg +12 -12
- package/es/modules/companySetting/mainPart/index.less +239 -239
- package/es/modules/companySetting/operationLog/index.less +33 -33
- package/es/modules/companySetting/role/index.less +296 -296
- package/es/modules/companySetting/role/setDataRangeDialog/index.less +37 -37
- package/es/modules/companySetting/style/common.less +79 -79
- package/es/modules/companySetting/style/reset.less +117 -117
- package/es/modules/companySetting/user/index.js +173 -4
- package/es/modules/companySetting/user/index.less +11 -0
- package/es/modules/companySetting/virtualApp/styles/config.less +37 -37
- package/es/modules/companySetting/virtualApp/styles/index.less +21 -21
- package/es/modules/companySetting/virtualApp/styles/list.less +28 -28
- package/es/modules/companySetting/virtualApp/styles/sourceItem.less +33 -33
- package/es/modules/companySetting/virtualApp/styles/table.less +44 -44
- package/es/modules/companySetting/wechatBinding/index.less +58 -58
- package/es/modules/createDemand/styles/index.less +277 -277
- package/es/modules/createDemand_bf/styles/index.less +222 -222
- package/es/modules/createProcess/components/index.less +52 -52
- package/es/modules/createProcess/index.less +114 -114
- package/es/modules/createProcess/title/index.less +53 -53
- package/es/modules/dealDemand/styles/index.less +265 -265
- package/es/modules/demandManage/styles/index.less +210 -210
- package/es/modules/getPassword/index.less +122 -122
- package/es/modules/messageList/index.less +81 -81
- package/es/modules/personalSetting/securityLog/index.less +11 -11
- package/es/modules/personalSetting/styles/unbinding.less +73 -73
- package/es/modules/pointMap/ImportModal/styles/index.less +91 -91
- package/es/modules/pointMap/editTxt/index.less +55 -55
- package/es/modules/pointMap/styles/index.less +38 -38
- package/es/modules/pointMap/styles/pageInfo.less +244 -244
- package/es/modules/pointMap/styles/tree.css +142 -0
- package/es/modules/pointMap/styles/tree.less +29 -0
- package/es/modules/pointMap/tree.js +53 -4
- package/es/modules/systemSetting/Dictionary.d.ts +3 -0
- package/es/modules/systemSetting/Dictionary.js +383 -0
- package/es/modules/systemSetting/DictionaryType.d.ts +14 -0
- package/es/modules/systemSetting/DictionaryType.js +203 -0
- package/es/modules/systemSetting/approvalmanage/approvalStrategy/index.less +14 -14
- package/es/modules/systemSetting/approvalmanage/index.less +5 -5
- package/es/modules/systemSetting/approvalmanage/processManage/index.less +39 -39
- package/es/modules/systemSetting/authUrl.js +2 -2
- package/es/modules/systemSetting/document-setting/index.d.ts +3 -0
- package/es/modules/systemSetting/document-setting/index.js +467 -0
- package/es/modules/systemSetting/img/empty-data.png +0 -0
- package/es/modules/systemSetting/index.css +130 -0
- package/es/modules/systemSetting/index.js +13 -1
- package/es/modules/systemSetting/index.less +136 -0
- package/es/modules/systemSetting/notice/configItem/index.less +21 -21
- package/es/modules/systemSetting/notice/edit/index.less +26 -26
- package/es/types/companySetting.d.ts +1 -0
- package/package.json +6 -2
|
@@ -0,0 +1,383 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
3
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
5
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
7
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
8
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
9
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
10
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
11
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
12
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
13
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
14
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
15
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
16
|
+
import React, { useEffect, useState } from 'react';
|
|
17
|
+
import { Tabs, Button, Modal, Space, Table, Input, message, Form, Spin } from 'antd';
|
|
18
|
+
import { SettingOutlined, SearchOutlined } from '@ant-design/icons';
|
|
19
|
+
import apis from '../../constants/api';
|
|
20
|
+
import request from '../../utils/ajax';
|
|
21
|
+
import DictionaryType from './DictionaryType';
|
|
22
|
+
import moment from 'moment';
|
|
23
|
+
var pageName = 'DictionaryPage';
|
|
24
|
+
var Dictionary = function Dictionary() {
|
|
25
|
+
var _useState = useState(false),
|
|
26
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
27
|
+
isTypeModalOpen = _useState2[0],
|
|
28
|
+
setIsTypeModalOpen = _useState2[1];
|
|
29
|
+
var _useState3 = useState(false),
|
|
30
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
31
|
+
loadingStatus = _useState4[0],
|
|
32
|
+
setLoadingStatus = _useState4[1];
|
|
33
|
+
var _useState5 = useState([]),
|
|
34
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
35
|
+
dictionaryList = _useState6[0],
|
|
36
|
+
setDictionaryList = _useState6[1];
|
|
37
|
+
var _useState7 = useState(),
|
|
38
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
39
|
+
currentTypeId = _useState8[0],
|
|
40
|
+
setCurrentTypeId = _useState8[1];
|
|
41
|
+
var handleChangeTab = function handleChangeTab(id) {
|
|
42
|
+
setCurrentTypeId(id);
|
|
43
|
+
getDictionaryContentList(id, searchValue);
|
|
44
|
+
};
|
|
45
|
+
var handleCancel = function handleCancel() {
|
|
46
|
+
setIsTypeModalOpen(false);
|
|
47
|
+
getList();
|
|
48
|
+
};
|
|
49
|
+
useEffect(function () {
|
|
50
|
+
setLoadingStatus(true);
|
|
51
|
+
getList();
|
|
52
|
+
}, []);
|
|
53
|
+
var getList = function getList() {
|
|
54
|
+
request(apis.setting.getDictionaryList, {
|
|
55
|
+
method: 'get',
|
|
56
|
+
params: {
|
|
57
|
+
// typeName: searchValue,
|
|
58
|
+
}
|
|
59
|
+
}).then( /*#__PURE__*/function () {
|
|
60
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(res) {
|
|
61
|
+
var newArr;
|
|
62
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
63
|
+
while (1) switch (_context.prev = _context.next) {
|
|
64
|
+
case 0:
|
|
65
|
+
if ((res === null || res === void 0 ? void 0 : res.code) == '100000') {
|
|
66
|
+
newArr = (res === null || res === void 0 ? void 0 : res.data) && (res === null || res === void 0 ? void 0 : res.data).map(function (o) {
|
|
67
|
+
return _objectSpread({
|
|
68
|
+
label: o.name,
|
|
69
|
+
key: o.id,
|
|
70
|
+
isEdit: false
|
|
71
|
+
}, o);
|
|
72
|
+
});
|
|
73
|
+
setDictionaryList(newArr);
|
|
74
|
+
setCurrentTypeId(function () {
|
|
75
|
+
getDictionaryContentList(newArr[0].key, searchValue);
|
|
76
|
+
return newArr[0].key;
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
case 1:
|
|
80
|
+
case "end":
|
|
81
|
+
return _context.stop();
|
|
82
|
+
}
|
|
83
|
+
}, _callee);
|
|
84
|
+
}));
|
|
85
|
+
return function (_x2) {
|
|
86
|
+
return _ref.apply(this, arguments);
|
|
87
|
+
};
|
|
88
|
+
}()).finally(function () {
|
|
89
|
+
setLoadingStatus(false);
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
var _useState9 = useState(''),
|
|
93
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
94
|
+
searchValue = _useState10[0],
|
|
95
|
+
setSearchValue = _useState10[1];
|
|
96
|
+
var onSearch = function onSearch(e) {
|
|
97
|
+
setSearchValue(function () {
|
|
98
|
+
var _e$target, _e$target2;
|
|
99
|
+
getDictionaryContentList(currentTypeId, e === null || e === void 0 ? void 0 : (_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.value);
|
|
100
|
+
return e === null || e === void 0 ? void 0 : (_e$target2 = e.target) === null || _e$target2 === void 0 ? void 0 : _e$target2.value;
|
|
101
|
+
});
|
|
102
|
+
};
|
|
103
|
+
var _useState11 = useState([]),
|
|
104
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
105
|
+
dictionaryContentList = _useState12[0],
|
|
106
|
+
setDictionaryContentList = _useState12[1];
|
|
107
|
+
var _useState13 = useState(false),
|
|
108
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
|
109
|
+
tableLoading = _useState14[0],
|
|
110
|
+
setTableLoading = _useState14[1];
|
|
111
|
+
var getDictionaryContentList = function getDictionaryContentList(id) {
|
|
112
|
+
var searchContent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
113
|
+
setTableLoading(true);
|
|
114
|
+
request(apis.setting.getDictionaryContentList, {
|
|
115
|
+
method: 'get',
|
|
116
|
+
params: {
|
|
117
|
+
dictionaryId: id,
|
|
118
|
+
content: searchContent
|
|
119
|
+
}
|
|
120
|
+
}).then(function (res) {
|
|
121
|
+
if ((res === null || res === void 0 ? void 0 : res.code) == '100000') {
|
|
122
|
+
(res === null || res === void 0 ? void 0 : res.data) && setDictionaryContentList(res.data);
|
|
123
|
+
}
|
|
124
|
+
}).finally(function () {
|
|
125
|
+
setTableLoading(false);
|
|
126
|
+
});
|
|
127
|
+
};
|
|
128
|
+
var _Form$useForm = Form.useForm(),
|
|
129
|
+
_Form$useForm2 = _slicedToArray(_Form$useForm, 1),
|
|
130
|
+
form = _Form$useForm2[0];
|
|
131
|
+
var saveContent = /*#__PURE__*/function () {
|
|
132
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
133
|
+
var validateResult, resultApi;
|
|
134
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
135
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
136
|
+
case 0:
|
|
137
|
+
_context2.next = 2;
|
|
138
|
+
return form.validateFields();
|
|
139
|
+
case 2:
|
|
140
|
+
validateResult = _context2.sent;
|
|
141
|
+
resultApi = isValueEdit ? apis.setting.updateDictionaryContent : apis.setting.saveDictionaryContent;
|
|
142
|
+
request(resultApi, {
|
|
143
|
+
method: 'post',
|
|
144
|
+
data: {
|
|
145
|
+
dictionaryId: currentTypeId,
|
|
146
|
+
content: validateResult.value,
|
|
147
|
+
remarks: validateResult.valueRemark,
|
|
148
|
+
id: isValueEdit && (currentRowData === null || currentRowData === void 0 ? void 0 : currentRowData.id)
|
|
149
|
+
}
|
|
150
|
+
}).then(function (res) {
|
|
151
|
+
if ((res === null || res === void 0 ? void 0 : res.code) == '100000') {
|
|
152
|
+
message.success('保存成功');
|
|
153
|
+
form.resetFields();
|
|
154
|
+
setIsModalOpen(false);
|
|
155
|
+
getDictionaryContentList(currentTypeId, searchValue);
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
case 5:
|
|
159
|
+
case "end":
|
|
160
|
+
return _context2.stop();
|
|
161
|
+
}
|
|
162
|
+
}, _callee2);
|
|
163
|
+
}));
|
|
164
|
+
return function saveContent() {
|
|
165
|
+
return _ref2.apply(this, arguments);
|
|
166
|
+
};
|
|
167
|
+
}();
|
|
168
|
+
var _useState15 = useState([]),
|
|
169
|
+
_useState16 = _slicedToArray(_useState15, 2),
|
|
170
|
+
selectedRowKeys = _useState16[0],
|
|
171
|
+
setSelectedRowKeys = _useState16[1];
|
|
172
|
+
var _useState17 = useState(),
|
|
173
|
+
_useState18 = _slicedToArray(_useState17, 2),
|
|
174
|
+
currentRowData = _useState18[0],
|
|
175
|
+
setCurrentRowData = _useState18[1];
|
|
176
|
+
var _useState19 = useState(false),
|
|
177
|
+
_useState20 = _slicedToArray(_useState19, 2),
|
|
178
|
+
isValueEdit = _useState20[0],
|
|
179
|
+
setIsValueEdit = _useState20[1];
|
|
180
|
+
var columns = [{
|
|
181
|
+
title: '值',
|
|
182
|
+
dataIndex: 'content'
|
|
183
|
+
}, {
|
|
184
|
+
title: '值说明',
|
|
185
|
+
dataIndex: 'remarks'
|
|
186
|
+
}, {
|
|
187
|
+
title: '创建时间',
|
|
188
|
+
dataIndex: 'createdTime',
|
|
189
|
+
width: 170,
|
|
190
|
+
sorter: function sorter(a, b) {
|
|
191
|
+
return moment(b.createdTime).valueOf() - moment(a.createdTime).valueOf();
|
|
192
|
+
},
|
|
193
|
+
render: function render(createdTime) {
|
|
194
|
+
return moment(createdTime).format('YYYY-MM-DD HH:mm:ss');
|
|
195
|
+
}
|
|
196
|
+
}, {
|
|
197
|
+
title: '修改时间',
|
|
198
|
+
width: 170,
|
|
199
|
+
dataIndex: 'updatedTime',
|
|
200
|
+
sorter: function sorter(a, b) {
|
|
201
|
+
return moment(b.updatedTime).valueOf() - moment(a.updatedTime).valueOf();
|
|
202
|
+
},
|
|
203
|
+
render: function render(updatedTime) {
|
|
204
|
+
return moment(updatedTime).format('YYYY-MM-DD HH:mm:ss');
|
|
205
|
+
}
|
|
206
|
+
}, {
|
|
207
|
+
title: '操作',
|
|
208
|
+
width: 100,
|
|
209
|
+
key: 'operation',
|
|
210
|
+
render: function render(_, row) {
|
|
211
|
+
return /*#__PURE__*/React.createElement(Space, {
|
|
212
|
+
size: "middle"
|
|
213
|
+
}, /*#__PURE__*/React.createElement("a", {
|
|
214
|
+
onClick: function onClick() {
|
|
215
|
+
setIsModalOpen(true);
|
|
216
|
+
setCurrentRowData(row);
|
|
217
|
+
setIsValueEdit(true);
|
|
218
|
+
form.setFieldsValue({
|
|
219
|
+
value: row.content,
|
|
220
|
+
valueRemark: row.remarks
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
}, "\u7F16\u8F91"));
|
|
224
|
+
}
|
|
225
|
+
}];
|
|
226
|
+
var onSelectChange = function onSelectChange(newSelectedRowKeys) {
|
|
227
|
+
setSelectedRowKeys(newSelectedRowKeys);
|
|
228
|
+
};
|
|
229
|
+
var rowSelection = {
|
|
230
|
+
selectedRowKeys: selectedRowKeys,
|
|
231
|
+
onChange: onSelectChange
|
|
232
|
+
};
|
|
233
|
+
var handleDelete = function handleDelete() {
|
|
234
|
+
if (selectedRowKeys.length < 1) {
|
|
235
|
+
message.warning('请选择要删除的数据');
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
Modal.confirm({
|
|
239
|
+
title: '删除提示',
|
|
240
|
+
onOk: onOkDelete,
|
|
241
|
+
width: 450,
|
|
242
|
+
cancelText: '取消',
|
|
243
|
+
okText: '确定',
|
|
244
|
+
centered: true,
|
|
245
|
+
content: '是否确认删除?'
|
|
246
|
+
});
|
|
247
|
+
};
|
|
248
|
+
var onOkDelete = function onOkDelete() {
|
|
249
|
+
request(apis.setting.deleteDictionaryContentList, {
|
|
250
|
+
method: 'post',
|
|
251
|
+
data: {
|
|
252
|
+
ids: selectedRowKeys.join()
|
|
253
|
+
}
|
|
254
|
+
}).then(function (res) {
|
|
255
|
+
if ((res === null || res === void 0 ? void 0 : res.code) == '100000') {
|
|
256
|
+
message.success('删除成功');
|
|
257
|
+
getDictionaryContentList(currentTypeId, searchValue);
|
|
258
|
+
}
|
|
259
|
+
});
|
|
260
|
+
};
|
|
261
|
+
var _useState21 = useState(false),
|
|
262
|
+
_useState22 = _slicedToArray(_useState21, 2),
|
|
263
|
+
isModalOpen = _useState22[0],
|
|
264
|
+
setIsModalOpen = _useState22[1];
|
|
265
|
+
var handleValueCancel = function handleValueCancel() {
|
|
266
|
+
setIsModalOpen(false);
|
|
267
|
+
setIsValueEdit(false);
|
|
268
|
+
form.resetFields();
|
|
269
|
+
};
|
|
270
|
+
var renderTabBar = function renderTabBar(props, DefaultTabBar) {
|
|
271
|
+
var getButton = function getButton() {
|
|
272
|
+
return /*#__PURE__*/React.createElement(DefaultTabBar, _objectSpread(_objectSpread({}, props), {}, {
|
|
273
|
+
className: "site-custom-tab-bar"
|
|
274
|
+
}));
|
|
275
|
+
};
|
|
276
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, getButton());
|
|
277
|
+
};
|
|
278
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
279
|
+
className: "".concat(pageName),
|
|
280
|
+
style: {
|
|
281
|
+
padding: '16px'
|
|
282
|
+
}
|
|
283
|
+
}, dictionaryList.length < 1 && !loadingStatus && /*#__PURE__*/React.createElement("div", {
|
|
284
|
+
className: "".concat(pageName, "-emptyDom")
|
|
285
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
286
|
+
className: "".concat(pageName, "-emptyDom-img")
|
|
287
|
+
}), /*#__PURE__*/React.createElement("p", {
|
|
288
|
+
className: "".concat(pageName, "-emptyDom-tip")
|
|
289
|
+
}, "\u8BF7\u5148\u6DFB\u52A0\u5B57\u5178\u7C7B\u578B"), /*#__PURE__*/React.createElement(Button, {
|
|
290
|
+
type: "primary",
|
|
291
|
+
onClick: function onClick() {
|
|
292
|
+
return setIsTypeModalOpen(true);
|
|
293
|
+
}
|
|
294
|
+
}, "\u6DFB\u52A0\u5B57\u5178\u7C7B\u578B")), loadingStatus && /*#__PURE__*/React.createElement(Spin, {
|
|
295
|
+
tip: "\u52A0\u8F7D\u4E2D"
|
|
296
|
+
}), dictionaryList.length > 0 && /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
297
|
+
className: "".concat(pageName, "-header")
|
|
298
|
+
}, /*#__PURE__*/React.createElement(Tabs, {
|
|
299
|
+
items: dictionaryList,
|
|
300
|
+
renderTabBar: renderTabBar,
|
|
301
|
+
activeKey: currentTypeId,
|
|
302
|
+
onTabClick: handleChangeTab
|
|
303
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
304
|
+
className: "".concat(pageName, "-tabsRight-text"),
|
|
305
|
+
onClick: function onClick() {
|
|
306
|
+
return setIsTypeModalOpen(true);
|
|
307
|
+
}
|
|
308
|
+
}, /*#__PURE__*/React.createElement(SettingOutlined, {
|
|
309
|
+
style: {
|
|
310
|
+
marginRight: '8px'
|
|
311
|
+
}
|
|
312
|
+
}), "\u7C7B\u578B\u7BA1\u7406")), /*#__PURE__*/React.createElement("div", {
|
|
313
|
+
className: "".concat(pageName, "-header-search")
|
|
314
|
+
}, /*#__PURE__*/React.createElement(Input, {
|
|
315
|
+
bordered: false,
|
|
316
|
+
prefix: /*#__PURE__*/React.createElement(SearchOutlined, null),
|
|
317
|
+
placeholder: "\u641C\u7D22\u503C/\u503C\u8BF4\u660E",
|
|
318
|
+
onChange: onSearch,
|
|
319
|
+
style: {
|
|
320
|
+
width: 200
|
|
321
|
+
}
|
|
322
|
+
}), /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement(Button, {
|
|
323
|
+
onClick: function onClick() {
|
|
324
|
+
return setIsModalOpen(true);
|
|
325
|
+
}
|
|
326
|
+
}, "\u6DFB\u52A0"), /*#__PURE__*/React.createElement(Button, {
|
|
327
|
+
onClick: handleDelete
|
|
328
|
+
}, "\u6279\u91CF\u5220\u9664"))), /*#__PURE__*/React.createElement(Table, {
|
|
329
|
+
rowKey: 'id',
|
|
330
|
+
rowSelection: rowSelection,
|
|
331
|
+
dataSource: dictionaryContentList,
|
|
332
|
+
columns: columns,
|
|
333
|
+
pagination: false,
|
|
334
|
+
loading: tableLoading
|
|
335
|
+
})), /*#__PURE__*/React.createElement(Modal, {
|
|
336
|
+
title: "\u5B57\u5178\u7C7B\u578B\u7BA1\u7406",
|
|
337
|
+
open: isTypeModalOpen,
|
|
338
|
+
footer: null,
|
|
339
|
+
onCancel: handleCancel
|
|
340
|
+
}, /*#__PURE__*/React.createElement(DictionaryType, {
|
|
341
|
+
dictionaryListArr: dictionaryList
|
|
342
|
+
})), /*#__PURE__*/React.createElement(Modal, {
|
|
343
|
+
title: "".concat(isValueEdit ? '修改值,值说明' : '添加值,值说明'),
|
|
344
|
+
okText: "\u786E\u5B9A",
|
|
345
|
+
cancelText: "\u53D6\u6D88",
|
|
346
|
+
open: isModalOpen,
|
|
347
|
+
onCancel: handleValueCancel,
|
|
348
|
+
onOk: saveContent
|
|
349
|
+
}, /*#__PURE__*/React.createElement(Form, {
|
|
350
|
+
name: "basic",
|
|
351
|
+
labelCol: {
|
|
352
|
+
span: 3
|
|
353
|
+
},
|
|
354
|
+
form: form,
|
|
355
|
+
wrapperCol: {
|
|
356
|
+
span: 21
|
|
357
|
+
},
|
|
358
|
+
initialValues: {
|
|
359
|
+
value: '',
|
|
360
|
+
valueRemark: ''
|
|
361
|
+
},
|
|
362
|
+
labelAlign: "left"
|
|
363
|
+
}, /*#__PURE__*/React.createElement(Form.Item, {
|
|
364
|
+
label: "\u503C",
|
|
365
|
+
name: "value",
|
|
366
|
+
rules: [{
|
|
367
|
+
required: true,
|
|
368
|
+
message: '值不可为空'
|
|
369
|
+
}]
|
|
370
|
+
}, /*#__PURE__*/React.createElement(Input, {
|
|
371
|
+
showCount: true,
|
|
372
|
+
maxLength: 20,
|
|
373
|
+
placeholder: "\u8BF7\u8F93\u5165\u503C"
|
|
374
|
+
})), /*#__PURE__*/React.createElement(Form.Item, {
|
|
375
|
+
label: "\u503C\u8BF4\u660E",
|
|
376
|
+
name: "valueRemark"
|
|
377
|
+
}, /*#__PURE__*/React.createElement(Input.TextArea, {
|
|
378
|
+
showCount: true,
|
|
379
|
+
maxLength: 50,
|
|
380
|
+
placeholder: "\u8BF7\u8F93\u5165\u503C\u8BF4\u660E"
|
|
381
|
+
})))));
|
|
382
|
+
};
|
|
383
|
+
export default Dictionary;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface dictionaryType {
|
|
3
|
+
createdTime?: string;
|
|
4
|
+
name: string;
|
|
5
|
+
key?: number;
|
|
6
|
+
label?: string;
|
|
7
|
+
id: number;
|
|
8
|
+
updatedTime?: string;
|
|
9
|
+
isEdit: boolean;
|
|
10
|
+
}
|
|
11
|
+
declare const Dictionary: React.FC<{
|
|
12
|
+
dictionaryListArr: dictionaryType[];
|
|
13
|
+
}>;
|
|
14
|
+
export default Dictionary;
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
3
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
5
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
6
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
7
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
8
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
9
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
10
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
11
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
12
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
13
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
14
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
15
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
16
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
17
|
+
import React, { useState, useRef } from 'react';
|
|
18
|
+
import { Button, Space, Input, message } from 'antd';
|
|
19
|
+
import { PlusOutlined } from '@ant-design/icons';
|
|
20
|
+
import apis from '../../constants/api';
|
|
21
|
+
import request from '../../utils/ajax';
|
|
22
|
+
var pageName = 'DictionaryPage';
|
|
23
|
+
var Dictionary = function Dictionary(props) {
|
|
24
|
+
var _useState = useState(props.dictionaryListArr),
|
|
25
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
26
|
+
dictionaryList = _useState2[0],
|
|
27
|
+
setDictionaryList = _useState2[1];
|
|
28
|
+
var _useState3 = useState(),
|
|
29
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
30
|
+
editValue = _useState4[0],
|
|
31
|
+
setEditValue = _useState4[1]; // 当前编辑的数据
|
|
32
|
+
var refObj = useRef();
|
|
33
|
+
// 字典类型保存
|
|
34
|
+
var _useState5 = useState(false),
|
|
35
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
36
|
+
verifyValue = _useState6[0],
|
|
37
|
+
setVerifyValue = _useState6[1]; // 判断当前字典类型是否为空
|
|
38
|
+
var _useState7 = useState(false),
|
|
39
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
40
|
+
verifyIdentical = _useState8[0],
|
|
41
|
+
setVerifyIdentical = _useState8[1]; // 判断当前字典值是否有相同的
|
|
42
|
+
var handleOk = function handleOk(index) {
|
|
43
|
+
setVerifyValue(false); // 先关闭之前的提示
|
|
44
|
+
if (!dictionaryList[index].name) {
|
|
45
|
+
setVerifyValue(true);
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
var verifyResult = isVerify(dictionaryList[index].name, index);
|
|
49
|
+
if (verifyResult) {
|
|
50
|
+
setVerifyIdentical(verifyResult);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
var api = editValue && editValue.id == -1 ? apis.setting.saveDictionaryType : apis.setting.updateDictionary;
|
|
54
|
+
request(api, {
|
|
55
|
+
method: 'post',
|
|
56
|
+
data: {
|
|
57
|
+
name: dictionaryList[index].name,
|
|
58
|
+
id: editValue && editValue.id == -1 ? null : editValue === null || editValue === void 0 ? void 0 : editValue.id
|
|
59
|
+
}
|
|
60
|
+
}).then(function (res) {
|
|
61
|
+
if ((res === null || res === void 0 ? void 0 : res.code) == '100000') {
|
|
62
|
+
message.success('保存成功');
|
|
63
|
+
setDictionaryList(dictionaryList.map(function (o) {
|
|
64
|
+
return _objectSpread(_objectSpread({}, o), {}, {
|
|
65
|
+
isEdit: false
|
|
66
|
+
});
|
|
67
|
+
}));
|
|
68
|
+
}
|
|
69
|
+
}).finally(function () {
|
|
70
|
+
// setIsTypeModalOpen(false);
|
|
71
|
+
});
|
|
72
|
+
};
|
|
73
|
+
var handleAddType = function handleAddType() {
|
|
74
|
+
setDictionaryList(function (pre) {
|
|
75
|
+
return [].concat(_toConsumableArray(pre), [{
|
|
76
|
+
name: '',
|
|
77
|
+
isEdit: true,
|
|
78
|
+
id: -1
|
|
79
|
+
}]);
|
|
80
|
+
});
|
|
81
|
+
setEditValue({
|
|
82
|
+
name: '',
|
|
83
|
+
isEdit: true,
|
|
84
|
+
id: -1
|
|
85
|
+
});
|
|
86
|
+
// 选中input
|
|
87
|
+
setTimeout(function () {
|
|
88
|
+
refObj.current && refObj.current[-1].focus({
|
|
89
|
+
cursor: 'end'
|
|
90
|
+
});
|
|
91
|
+
}, 0);
|
|
92
|
+
};
|
|
93
|
+
var handleDictionaryTypeEdit = function handleDictionaryTypeEdit(index) {
|
|
94
|
+
setEditValue(dictionaryList[index]);
|
|
95
|
+
var newArr = dictionaryList.map(function (o, oIndex) {
|
|
96
|
+
return oIndex == index ? _objectSpread(_objectSpread({}, o), {}, {
|
|
97
|
+
isEdit: true
|
|
98
|
+
}) : _objectSpread(_objectSpread({}, o), {}, {
|
|
99
|
+
isEdit: false
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
setDictionaryList(newArr);
|
|
103
|
+
// 选中input
|
|
104
|
+
setTimeout(function () {
|
|
105
|
+
refObj.current && refObj.current[dictionaryList[index].id].focus({
|
|
106
|
+
cursor: 'end'
|
|
107
|
+
});
|
|
108
|
+
}, 0);
|
|
109
|
+
};
|
|
110
|
+
var handleChangeDictionaryTypeValue = function handleChangeDictionaryTypeValue(value, index) {
|
|
111
|
+
var newArr = dictionaryList.map(function (o, oIndex) {
|
|
112
|
+
return oIndex == index ? _objectSpread(_objectSpread({}, o), {}, {
|
|
113
|
+
name: value,
|
|
114
|
+
isEdit: true
|
|
115
|
+
}) : o;
|
|
116
|
+
});
|
|
117
|
+
setDictionaryList(newArr);
|
|
118
|
+
};
|
|
119
|
+
var isVerify = function isVerify(value, saveIndex) {
|
|
120
|
+
// 判断是否跟其他字典名称有重复
|
|
121
|
+
var result = dictionaryList.filter(function (o, index) {
|
|
122
|
+
return index != saveIndex ? o.name == value : false;
|
|
123
|
+
});
|
|
124
|
+
return result.length > 0 ? true : false;
|
|
125
|
+
};
|
|
126
|
+
var handleDictionaryTypeBlurValue = function handleDictionaryTypeBlurValue() {
|
|
127
|
+
setVerifyValue(false);
|
|
128
|
+
setVerifyIdentical(false);
|
|
129
|
+
if ((editValue === null || editValue === void 0 ? void 0 : editValue.id) == -1) {
|
|
130
|
+
setDictionaryList(dictionaryList.filter(function (o) {
|
|
131
|
+
return o.id != -1;
|
|
132
|
+
}));
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
var arr = dictionaryList && dictionaryList.map(function (o) {
|
|
136
|
+
if (o.id == (editValue === null || editValue === void 0 ? void 0 : editValue.id)) {
|
|
137
|
+
return editValue;
|
|
138
|
+
}
|
|
139
|
+
return o;
|
|
140
|
+
});
|
|
141
|
+
setDictionaryList(arr);
|
|
142
|
+
};
|
|
143
|
+
// const [editableStrWithSuffixStartPart, editableStrWithSuffixSuffixPart] = useMemo(
|
|
144
|
+
// () => [editableStrWithSuffix.slice(0, -9), editableStrWithSuffix.slice(-9)],
|
|
145
|
+
// [editableStrWithSuffix],
|
|
146
|
+
// );
|
|
147
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
148
|
+
className: "".concat(pageName, "-modal")
|
|
149
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
150
|
+
className: "".concat(pageName, "-modal-header")
|
|
151
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
152
|
+
className: "".concat(pageName, "-modal-header-left")
|
|
153
|
+
}, "\u7C7B\u578B\u540D\u79F0"), /*#__PURE__*/React.createElement("div", {
|
|
154
|
+
className: "".concat(pageName, "-modal-header-operation")
|
|
155
|
+
}, "\u64CD\u4F5C")), /*#__PURE__*/React.createElement("div", {
|
|
156
|
+
className: "".concat(pageName, "-modal-content")
|
|
157
|
+
}, dictionaryList.map(function (o, index) {
|
|
158
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
159
|
+
className: "".concat(pageName, "-modal-content-item"),
|
|
160
|
+
key: o.id
|
|
161
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
162
|
+
className: "".concat(pageName, "-modal-content-itemLeft")
|
|
163
|
+
}, o.isEdit ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Input, {
|
|
164
|
+
ref: function ref(r) {
|
|
165
|
+
if (refObj.current) {
|
|
166
|
+
refObj.current[o.id] = r;
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
showCount: true,
|
|
170
|
+
maxLength: 10,
|
|
171
|
+
value: o.name,
|
|
172
|
+
status: "".concat(o.isEdit ? verifyValue ? 'error' : verifyIdentical ? 'error' : '' : ''),
|
|
173
|
+
onChange: function onChange(e) {
|
|
174
|
+
return handleChangeDictionaryTypeValue(e.target.value, index);
|
|
175
|
+
}
|
|
176
|
+
}), o.isEdit ? verifyValue ? /*#__PURE__*/React.createElement("span", {
|
|
177
|
+
className: "error-tip"
|
|
178
|
+
}, "\u8BF7\u8F93\u5165\u7C7B\u578B") : verifyIdentical ? /*#__PURE__*/React.createElement("span", {
|
|
179
|
+
className: "error-tip"
|
|
180
|
+
}, "\u7C7B\u578B\u540D\u79F0\u91CD\u590D") : '' : '') : o.name), o.isEdit ? /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement("span", {
|
|
181
|
+
className: "".concat(pageName, "-modal-content-itemRight"),
|
|
182
|
+
onClick: handleDictionaryTypeBlurValue
|
|
183
|
+
}, "\u53D6\u6D88"), /*#__PURE__*/React.createElement("span", {
|
|
184
|
+
className: "".concat(pageName, "-modal-content-itemRight"),
|
|
185
|
+
onClick: function onClick() {
|
|
186
|
+
return handleOk(index);
|
|
187
|
+
}
|
|
188
|
+
}, "\u4FDD\u5B58")) : /*#__PURE__*/React.createElement("span", {
|
|
189
|
+
className: "".concat(pageName, "-modal-content-itemRight"),
|
|
190
|
+
onClick: function onClick() {
|
|
191
|
+
return handleDictionaryTypeEdit(index);
|
|
192
|
+
}
|
|
193
|
+
}, "\u7F16\u8F91"));
|
|
194
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
195
|
+
className: "".concat(pageName, "-modal-footer")
|
|
196
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
197
|
+
type: "primary",
|
|
198
|
+
disabled: dictionaryList.length > 20,
|
|
199
|
+
icon: /*#__PURE__*/React.createElement(PlusOutlined, null),
|
|
200
|
+
onClick: handleAddType
|
|
201
|
+
}, "\u65B0\u589E\u5B57\u5178\u7C7B\u578B")));
|
|
202
|
+
};
|
|
203
|
+
export default Dictionary;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
.system-setting-approval-approval-content {
|
|
2
|
-
padding: 0 24px 16px;
|
|
3
|
-
.ant-table table {
|
|
4
|
-
width: auto;
|
|
5
|
-
}
|
|
6
|
-
}
|
|
7
|
-
.system-setting-approval-approval-content-dialog {
|
|
8
|
-
.ant-form-item-label > label::after {
|
|
9
|
-
content: '';
|
|
10
|
-
}
|
|
11
|
-
.ant-form-item:last-child {
|
|
12
|
-
margin-bottom: 0;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
1
|
+
.system-setting-approval-approval-content {
|
|
2
|
+
padding: 0 24px 16px;
|
|
3
|
+
.ant-table table {
|
|
4
|
+
width: auto;
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
.system-setting-approval-approval-content-dialog {
|
|
8
|
+
.ant-form-item-label > label::after {
|
|
9
|
+
content: '';
|
|
10
|
+
}
|
|
11
|
+
.ant-form-item:last-child {
|
|
12
|
+
margin-bottom: 0;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
.system-setting-approval-tabs {
|
|
2
|
-
.ant-tabs-nav-wrap {
|
|
3
|
-
margin: 0 24px;
|
|
4
|
-
}
|
|
5
|
-
}
|
|
1
|
+
.system-setting-approval-tabs {
|
|
2
|
+
.ant-tabs-nav-wrap {
|
|
3
|
+
margin: 0 24px;
|
|
4
|
+
}
|
|
5
|
+
}
|