diff --git a/README.md b/README.md index ba382c0c..28ecef0b 100644 --- a/README.md +++ b/README.md @@ -43,3 +43,6 @@ npm run dev ##### 2、样式系列 * 获取当前主体的高度:import { mainHeight } from '@/utils/layout' +#### 依赖变更记录 + +* 2024-04-25新增vform3,by洪圣文,用于页面表单设计保存为json,命令:pnpm i vform3-builds diff --git a/package.json b/package.json index 603f609b..ffffa5a3 100644 --- a/package.json +++ b/package.json @@ -43,6 +43,7 @@ "splitpanes": "^3.1.5", "steady-xml": "0.1.0", "use-element-plus-theme": "^0.0.5", + "vform3-builds": "^3.0.10", "vue": "^3.3.11", "vue-baidu-map-3x": "^1.0.35", "vue-baidu-map-offline": "^1.0.7", diff --git a/src/api/process-boot/workflow/category.ts b/src/api/process-boot/workflow/form.ts similarity index 54% rename from src/api/process-boot/workflow/category.ts rename to src/api/process-boot/workflow/form.ts index 20166f25..0d048887 100644 --- a/src/api/process-boot/workflow/category.ts +++ b/src/api/process-boot/workflow/form.ts @@ -2,12 +2,12 @@ import createAxios from '@/utils/request' import { PROCESS_BOOT } from '@/utils/constantRequest' -const MAPPING_PATH = PROCESS_BOOT +'/workflow/category' +const MAPPING_PATH = PROCESS_BOOT + '/workflow/wfForm' /** - * 查询流程分类数据 + * 查询流程表单数据 */ -export const listCategory = (data: any) => { +export const listWFForm = (data: any) => { return createAxios({ url: MAPPING_PATH + '/list', method: 'POST', @@ -15,11 +15,21 @@ export const listCategory = (data: any) => { }) } +/** + * 根据id查询表单详细信息 + */ +export const getFormById = (id: string) => { + return createAxios({ + url: MAPPING_PATH + '/getFormById?id=' + id, + method: 'GET' + }) +} + /** - * 新增流程分类 + * 新增流程表单 */ -export const addCategory = (data: any) => { +export const addWFForm = (data: any) => { return createAxios({ url: MAPPING_PATH + '/add', method: 'POST', @@ -29,9 +39,9 @@ export const addCategory = (data: any) => { /** - * 更新流程分类 + * 更新流程表单 */ -export const updateCategory = (data: any) => { +export const updateWFForm = (data: any) => { return createAxios({ url: MAPPING_PATH + '/update', method: 'POST', @@ -41,9 +51,9 @@ export const updateCategory = (data: any) => { /** - * 删除流程分类 + * 删除流程表单 */ -export const deleteCategory = (data: any) => { +export const deleteWFForm = (data: any) => { let ids = [data] return createAxios({ url: MAPPING_PATH + '/delete', diff --git a/src/api/process-boot/workflow/model.ts b/src/api/process-boot/workflow/model.ts new file mode 100644 index 00000000..6149f476 --- /dev/null +++ b/src/api/process-boot/workflow/model.ts @@ -0,0 +1,118 @@ +import createAxios from '@/utils/request' + +import { PROCESS_BOOT } from '@/utils/constantRequest' + +const MAPPING_PATH = PROCESS_BOOT + '/workflow/model' + +/** + * 查询流程模型数据 + */ +export const listWFModel = (data: any) => { + return createAxios({ + url: MAPPING_PATH + '/list', + method: 'POST', + data: data + }) +} + +/** + * 查询流程模型的历史数据 + */ +export const listHistoryWFModel = (data: any) => { + return createAxios({ + url: MAPPING_PATH + '/historyList', + method: 'POST', + data: data + }) +} + +/** + * 根据id查询模型详细信息 + */ +export const getModelById = (id: string) => { + return createAxios({ + url: MAPPING_PATH + '/getModelById?id=' + id, + method: 'GET' + }) +} + + +/** + * 根据id查询模型bpmn的xml + */ +export const getBpmnXmlById = (id: string) => { + return createAxios({ + url: MAPPING_PATH + '/getBpmnXmlById?id=' + id, + method: 'GET' + }) +} + + +/** + * 新增流程模型 + */ +export const addWFModel = (data: any) => { + return createAxios({ + url: MAPPING_PATH + '/add', + method: 'POST', + data: data + }) +} + + +/** + * 更新流程模型 + */ +export const updateWFModel = (data: any) => { + return createAxios({ + url: MAPPING_PATH + '/update', + method: 'POST', + data: data + }) +} + +/** + * 保存模型中的bpmn模型 + */ +export const saveBpmnXml = (data: any) => { + return createAxios({ + url: MAPPING_PATH + '/saveBpmnXml', + method: 'POST', + data: data + }) +} + + +/** + * 设为最新流程模型 + */ +export const latestModel = (id: string) => { + return createAxios({ + url: MAPPING_PATH + '/latest?id=' + id, + method: 'GET' + }) +} + +/** + * 部署流程模型 + */ +export const deployModel = (id: string) => { + return createAxios({ + url: MAPPING_PATH + '/deploy?id=' + id, + method: 'GET' + }) +} + + + +/** + * 删除流程模型 + */ +export const deleteWFModel = (data: any) => { + let ids = [data] + return createAxios({ + url: MAPPING_PATH + '/delete', + method: 'POST', + data: ids + }) +} diff --git a/src/main.ts b/src/main.ts index 867565de..322ed6bc 100644 --- a/src/main.ts +++ b/src/main.ts @@ -34,10 +34,16 @@ app.use(BaiduMap, { ak: 'Yp57V71dkOPiXjiN8VdcFRsVELzlVNKK', v: '3.0', }); + + +import VForm3 from 'vform3-builds' //引入VForm3库 +import 'vform3-builds/dist/designer.style.css' //引入VForm3样式 + app.use(router) app.use(pinia) app.use(ElementPlus) app.use(VXETable) +app.use(VForm3); ;(app._context.components.ElDialog as typeof ElDialog).props.closeOnClickModal.default = false registerIcons(app) // icons diff --git a/src/router/static.ts b/src/router/static.ts index 67ab29dd..fee57f7a 100644 --- a/src/router/static.ts +++ b/src/router/static.ts @@ -83,10 +83,50 @@ export const adminBaseRoute = { component: () => import('@/views/pqs/voltageSags/sagGovern/scheme/history/index.vue'), name: '治理方案结果详情', meta: { - title: pageTitle('router.schemeCalc') + title: pageTitle('router.schemeHistory') } }, ] + }, + { + path: 'form', + name: '表单', + meta: { + title: pageTitle('form'), + icon: 'ep:management', + alwaysShow: true + }, + children: [ + { + path: 'formDesigner', + component: () => import('@/views/system/workflow/form/formDesigner.vue'), + name: '表单设计器页面', + meta: { + title: pageTitle('router.formDesigner') + } + } + + ] + }, + { + path: 'model', + name: '模型', + meta: { + title: pageTitle('model'), + icon: 'ep:management', + alwaysShow: true + }, + children: [ + { + path: 'processDesigner', + component: () => import('@/views/system/workflow/model/processDesigner.vue'), + name: '模型设计器页面', + meta: { + title: pageTitle('router.formDesigner') + } + } + + ] } ] } diff --git a/src/utils/min-dash.js b/src/utils/min-dash.js new file mode 100644 index 00000000..ab8b4e06 --- /dev/null +++ b/src/utils/min-dash.js @@ -0,0 +1,694 @@ +/* eslint-disable no-func-assign */ +/** + * Flatten array, one level deep. + * + * @param {Array} arr + * + * @return {Array} + */ +function flatten(arr) { + return Array.prototype.concat.apply([], arr); +} + +var nativeToString = Object.prototype.toString; +var nativeHasOwnProperty = Object.prototype.hasOwnProperty; +function isUndefined(obj) { + return obj === undefined; +} +function isDefined(obj) { + return obj !== undefined; +} +function isNil(obj) { + return obj == null; +} +function isArray(obj) { + return nativeToString.call(obj) === '[object Array]'; +} +function isObject(obj) { + return nativeToString.call(obj) === '[object Object]'; +} +function isNumber(obj) { + return nativeToString.call(obj) === '[object Number]'; +} +function isFunction(obj) { + var tag = nativeToString.call(obj); + return tag === '[object Function]' || tag === '[object AsyncFunction]' || tag === '[object GeneratorFunction]' || tag === '[object AsyncGeneratorFunction]' || tag === '[object Proxy]'; +} +function isString(obj) { + return nativeToString.call(obj) === '[object String]'; +} +/** + * Ensure collection is an array. + * + * @param {Object} obj + */ + +function ensureArray(obj) { + if (isArray(obj)) { + return; + } + + throw new Error('must supply array'); +} +/** + * Return true, if target owns a property with the given key. + * + * @param {Object} target + * @param {String} key + * + * @return {Boolean} + */ + +function has(target, key) { + return nativeHasOwnProperty.call(target, key); +} + +/** + * Find element in collection. + * + * @param {Array|Object} collection + * @param {Function|Object} matcher + * + * @return {Object} + */ + +function find(collection, matcher) { + matcher = toMatcher(matcher); + var match; + forEach(collection, function(val, key) { + if (matcher(val, key)) { + match = val; + return false; + } + }); + return match; +} +/** + * Find element index in collection. + * + * @param {Array|Object} collection + * @param {Function} matcher + * + * @return {Object} + */ + +function findIndex(collection, matcher) { + matcher = toMatcher(matcher); + var idx = isArray(collection) ? -1 : undefined; + forEach(collection, function(val, key) { + if (matcher(val, key)) { + idx = key; + return false; + } + }); + return idx; +} +/** + * Find element in collection. + * + * @param {Array|Object} collection + * @param {Function} matcher + * + * @return {Array} result + */ + +function filter(collection, matcher) { + var result = []; + forEach(collection, function(val, key) { + if (matcher(val, key)) { + result.push(val); + } + }); + return result; +} +/** + * Iterate over collection; returning something + * (non-undefined) will stop iteration. + * + * @param {Array|Object} collection + * @param {Function} iterator + * + * @return {Object} return result that stopped the iteration + */ + +function forEach(collection, iterator) { + var val, result; + + if (isUndefined(collection)) { + return; + } + + var convertKey = isArray(collection) ? toNum : identity; + + for (var key in collection) { + if (has(collection, key)) { + val = collection[key]; + result = iterator(val, convertKey(key)); + + if (result === false) { + return val; + } + } + } +} +/** + * Return collection without element. + * + * @param {Array} arr + * @param {Function} matcher + * + * @return {Array} + */ + +function without(arr, matcher) { + if (isUndefined(arr)) { + return []; + } + + ensureArray(arr); + matcher = toMatcher(matcher); + return arr.filter(function(el, idx) { + return !matcher(el, idx); + }); +} +/** + * Reduce collection, returning a single result. + * + * @param {Object|Array} collection + * @param {Function} iterator + * @param {Any} result + * + * @return {Any} result returned from last iterator + */ + +function reduce(collection, iterator, result) { + forEach(collection, function(value, idx) { + result = iterator(result, value, idx); + }); + return result; +} +/** + * Return true if every element in the collection + * matches the criteria. + * + * @param {Object|Array} collection + * @param {Function} matcher + * + * @return {Boolean} + */ + +function every(collection, matcher) { + return !!reduce(collection, function(matches, val, key) { + return matches && matcher(val, key); + }, true); +} +/** + * Return true if some elements in the collection + * match the criteria. + * + * @param {Object|Array} collection + * @param {Function} matcher + * + * @return {Boolean} + */ + +function some(collection, matcher) { + return !!find(collection, matcher); +} +/** + * Transform a collection into another collection + * by piping each member through the given fn. + * + * @param {Object|Array} collection + * @param {Function} fn + * + * @return {Array} transformed collection + */ + +function map(collection, fn) { + var result = []; + forEach(collection, function(val, key) { + result.push(fn(val, key)); + }); + return result; +} +/** + * Get the collections keys. + * + * @param {Object|Array} collection + * + * @return {Array} + */ + +function keys(collection) { + return collection && Object.keys(collection) || []; +} +/** + * Shorthand for `keys(o).length`. + * + * @param {Object|Array} collection + * + * @return {Number} + */ + +function size(collection) { + return keys(collection).length; +} +/** + * Get the values in the collection. + * + * @param {Object|Array} collection + * + * @return {Array} + */ + +function values(collection) { + return map(collection, function(val) { + return val; + }); +} +/** + * Group collection members by attribute. + * + * @param {Object|Array} collection + * @param {Function} extractor + * + * @return {Object} map with { attrValue => [ a, b, c ] } + */ + +function groupBy(collection, extractor) { + var grouped = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; + extractor = toExtractor(extractor); + forEach(collection, function(val) { + var discriminator = extractor(val) || '_'; + var group = grouped[discriminator]; + + if (!group) { + group = grouped[discriminator] = []; + } + + group.push(val); + }); + return grouped; +} +function uniqueBy(extractor) { + extractor = toExtractor(extractor); + var grouped = {}; + + for (var _len = arguments.length, collections = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + collections[_key - 1] = arguments[_key]; + } + + forEach(collections, function(c) { + return groupBy(c, extractor, grouped); + }); + var result = map(grouped, function(val, key) { + return val[0]; + }); + return result; +} +var unionBy = uniqueBy; +/** + * Sort collection by criteria. + * + * @param {Object|Array} collection + * @param {String|Function} extractor + * + * @return {Array} + */ + +function sortBy(collection, extractor) { + extractor = toExtractor(extractor); + var sorted = []; + forEach(collection, function(value, key) { + var disc = extractor(value, key); + var entry = { + d: disc, + v: value + }; + + for (var idx = 0; idx < sorted.length; idx++) { + var d = sorted[idx].d; + + if (disc < d) { + sorted.splice(idx, 0, entry); + return; + } + } // not inserted, append (!) + + sorted.push(entry); + }); + return map(sorted, function(e) { + return e.v; + }); +} +/** + * Create an object pattern matcher. + * + * @example + * + * const matcher = matchPattern({ id: 1 }); + * + * let element = find(elements, matcher); + * + * @param {Object} pattern + * + * @return {Function} matcherFn + */ + +function matchPattern(pattern) { + return function(el) { + return every(pattern, function(val, key) { + return el[key] === val; + }); + }; +} + +function toExtractor(extractor) { + return isFunction(extractor) ? extractor : function(e) { + return e[extractor]; + }; +} + +function toMatcher(matcher) { + return isFunction(matcher) ? matcher : function(e) { + return e === matcher; + }; +} + +function identity(arg) { + return arg; +} + +function toNum(arg) { + return Number(arg); +} + +/** + * Debounce fn, calling it only once if the given time + * elapsed between calls. + * + * Lodash-style the function exposes methods to `#clear` + * and `#flush` to control internal behavior. + * + * @param {Function} fn + * @param {Number} timeout + * + * @return {Function} debounced function + */ +function debounce(fn, timeout) { + var timer; + var lastArgs; + var lastThis; + var lastNow; + + function fire(force) { + var now = Date.now(); + var scheduledDiff = force ? 0 : lastNow + timeout - now; + + if (scheduledDiff > 0) { + return schedule(scheduledDiff); + } + + fn.apply(lastThis, lastArgs); + clear(); + } + + function schedule(timeout) { + timer = setTimeout(fire, timeout); + } + + function clear() { + if (timer) { + clearTimeout(timer); + } + + timer = lastNow = lastArgs = lastThis = undefined; + } + + function flush() { + if (timer) { + fire(true); + } + + clear(); + } + + function callback() { + lastNow = Date.now(); + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + lastArgs = args; + lastThis = this; // ensure an execution is scheduled + + if (!timer) { + schedule(timeout); + } + } + + callback.flush = flush; + callback.cancel = clear; + return callback; +} +/** + * Throttle fn, calling at most once + * in the given interval. + * + * @param {Function} fn + * @param {Number} interval + * + * @return {Function} throttled function + */ + +function throttle(fn, interval) { + var throttling = false; + return function() { + if (throttling) { + return; + } + + fn.apply(void 0, arguments); + throttling = true; + setTimeout(function() { + throttling = false; + }, interval); + }; +} +/** + * Bind function against target . + * + * @param {Function} fn + * @param {Object} target + * + * @return {Function} bound function + */ + +function bind(fn, target) { + return fn.bind(target); +} + +function _typeof(obj) { + '@babel/helpers - typeof'; + + if (typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol') { + _typeof = function(obj) { + return typeof obj; + }; + } else { + _typeof = function(obj) { + return obj && typeof Symbol === 'function' && obj.constructor === Symbol && obj !== Symbol.prototype ? 'symbol' : typeof obj; + }; + } + + return _typeof(obj); +} + +function _extends() { + _extends = Object.assign || function(target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i]; + + for (var key in source) { + if (Object.prototype.hasOwnProperty.call(source, key)) { + target[key] = source[key]; + } + } + } + + return target; + }; + + return _extends.apply(this, arguments); +} + +/** + * Convenience wrapper for `Object.assign`. + * + * @param {Object} target + * @param {...Object} others + * + * @return {Object} the target + */ + +function assign(target) { + for (var _len = arguments.length, others = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + others[_key - 1] = arguments[_key]; + } + + return _extends.apply(void 0, [target].concat(others)); +} +/** + * Sets a nested property of a given object to the specified value. + * + * This mutates the object and returns it. + * + * @param {Object} target The target of the set operation. + * @param {(string|number)[]} path The path to the nested value. + * @param {any} value The value to set. + */ + +function set(target, path, value) { + var currentTarget = target; + forEach(path, function(key, idx) { + if (typeof key !== 'number' && typeof key !== 'string') { + throw new Error('illegal key type: ' + _typeof(key) + '. Key should be of type number or string.'); + } + + if (key === 'constructor') { + throw new Error('illegal key: constructor'); + } + + if (key === '__proto__') { + throw new Error('illegal key: __proto__'); + } + + var nextKey = path[idx + 1]; + var nextTarget = currentTarget[key]; + + if (isDefined(nextKey) && isNil(nextTarget)) { + nextTarget = currentTarget[key] = isNaN(+nextKey) ? {} : []; + } + + if (isUndefined(nextKey)) { + if (isUndefined(value)) { + delete currentTarget[key]; + } else { + currentTarget[key] = value; + } + } else { + currentTarget = nextTarget; + } + }); + return target; +} +/** + * Gets a nested property of a given object. + * + * @param {Object} target The target of the get operation. + * @param {(string|number)[]} path The path to the nested value. + * @param {any} [defaultValue] The value to return if no value exists. + */ + +function get(target, path, defaultValue) { + var currentTarget = target; + forEach(path, function(key) { + // accessing nil property yields + if (isNil(currentTarget)) { + currentTarget = undefined; + return false; + } + + currentTarget = currentTarget[key]; + }); + return isUndefined(currentTarget) ? defaultValue : currentTarget; +} +/** + * Pick given properties from the target object. + * + * @param {Object} target + * @param {Array} properties + * + * @return {Object} target + */ + +function pick(target, properties) { + var result = {}; + var obj = Object(target); + forEach(properties, function(prop) { + if (prop in obj) { + result[prop] = target[prop]; + } + }); + return result; +} +/** + * Pick all target properties, excluding the given ones. + * + * @param {Object} target + * @param {Array} properties + * + * @return {Object} target + */ + +function omit(target, properties) { + var result = {}; + var obj = Object(target); + forEach(obj, function(prop, key) { + if (properties.indexOf(key) === -1) { + result[key] = prop; + } + }); + return result; +} +/** + * Recursively merge `...sources` into given target. + * + * Does support merging objects; does not support merging arrays. + * + * @param {Object} target + * @param {...Object} sources + * + * @return {Object} the target + */ + +function merge(target) { + for (var _len2 = arguments.length, sources = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { + sources[_key2 - 1] = arguments[_key2]; + } + + if (!sources.length) { + return target; + } + + forEach(sources, function(source) { + // skip non-obj sources, i.e. null + if (!source || !isObject(source)) { + return; + } + + forEach(source, function(sourceVal, key) { + if (key === '__proto__') { + return; + } + + var targetVal = target[key]; + + if (isObject(sourceVal)) { + if (!isObject(targetVal)) { + // override target[key] with object + targetVal = {}; + } + + target[key] = merge(targetVal, sourceVal); + } else { + target[key] = sourceVal; + } + }); + }); + return target; +} + +export { assign, bind, debounce, ensureArray, every, filter, find, findIndex, flatten, forEach, get, groupBy, has, isArray, isDefined, isFunction, isNil, isNumber, isObject, isString, isUndefined, keys, map, matchPattern, merge, omit, pick, reduce, set, size, some, sortBy, throttle, unionBy, uniqueBy, values, without }; diff --git a/src/views/pqs/voltageSags/sagGovern/businessUser/productLine/index.vue b/src/views/pqs/voltageSags/sagGovern/businessUser/productLine/index.vue index 23281cbe..bcd9ebe4 100644 --- a/src/views/pqs/voltageSags/sagGovern/businessUser/productLine/index.vue +++ b/src/views/pqs/voltageSags/sagGovern/businessUser/productLine/index.vue @@ -1,4 +1,4 @@ - +