diff --git a/app/controller/admin/system/ConfigController.php b/app/controller/admin/system/ConfigController.php
index 8d1fe16..fa0ab23 100644
--- a/app/controller/admin/system/ConfigController.php
+++ b/app/controller/admin/system/ConfigController.php
@@ -16,9 +16,9 @@ class ConfigController extends BaseController
'group'=> $this->request->get('group/s','')
]);
- $paginate = CurdService::getPaginate($this->request, $model);
+ $data = CurdService::getList($this->request, $model);
- return $this->writeSuccess('success', $paginate);
+ return $this->writeSuccess('success', $data);
}
public function data(string $name)
@@ -38,7 +38,8 @@ class ConfigController extends BaseController
'options' => '',
'name' => '',
'comments' => '',
- 'group'=> ''
+ 'group'=> '',
+ 'bind'=>''
]);
$user = new SysConfig();
$user->save($data);
@@ -57,7 +58,8 @@ class ConfigController extends BaseController
'options' => '',
'name' => '',
'comments' => '',
- 'group'=> ''
+ 'group'=> '',
+ 'bind'=>''
]);
$user = SysConfig::findOrFail($data['id']);
$user->save($data);
diff --git a/z_ele/src/utils/sys-config.ts b/z_ele/src/utils/sys-config.ts
index 2449e9a..cfa5ab1 100644
--- a/z_ele/src/utils/sys-config.ts
+++ b/z_ele/src/utils/sys-config.ts
@@ -2,15 +2,64 @@ import {configData} from "@/api/system/config";
export async function getSysConfig(name) {
const config = await configData({name});
- switch (config.type) {
- case 'json':
- config.valueData = JSON.parse(config.value);
- break
- case 'int':
- config.valueData = parseInt(config.value)
- break;
- default:
- config.valueData = config.value;
- }
+ config.valueData = strToValue(config.type, config.value);
return config;
}
+
+
+export function strToValue(type: string, value: string): any {
+ switch (type) {
+ case 'json':
+ return JSON.parse(value);
+ case 'int':
+ return parseInt(value)
+ case 'switch':
+ return value == '1'
+ case 'checkbox':
+ return value.split(",");
+ case 'text':
+ case 'textarea':
+ default:
+ return value
+ }
+}
+
+export function strToOption(type: string, option: string): any {
+ try {
+ switch (type) {
+ case 'json':
+ case 'int':
+ case 'switch':
+ case 'text':
+ case 'textarea':
+ case 'checkbox':
+ default:
+ if (option) {
+ return JSON.parse(option);
+ }
+ }
+ } catch (e) {
+ console.error(e);
+ }
+ return {};
+}
+
+export function strToBind(type: string, option: string): any {
+ try {
+ switch (type) {
+ case 'json':
+ case 'int':
+ case 'switch':
+ case 'text':
+ case 'textarea':
+ case 'checkbox':
+ default:
+ if (option) {
+ return JSON.parse(option);
+ }
+ }
+ } catch (e) {
+ console.error(e);
+ }
+ return {};
+}
diff --git a/z_ele/src/views/system/config-set/components/config-form-item.vue b/z_ele/src/views/system/config-set/components/config-form-item.vue
new file mode 100644
index 0000000..7cb293f
--- /dev/null
+++ b/z_ele/src/views/system/config-set/components/config-form-item.vue
@@ -0,0 +1,73 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ updatedataValue(val)"
+ v-bind="dataBind"
+ />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/z_ele/src/views/system/config-set/index.vue b/z_ele/src/views/system/config-set/index.vue
index 6f68906..bbf3b63 100644
--- a/z_ele/src/views/system/config-set/index.vue
+++ b/z_ele/src/views/system/config-set/index.vue
@@ -1,14 +1,14 @@
-
-
-
-
+
+
+ 刷新
+
同步配置
- {{ configList }}
+
+
+
+
+
+
+
+
+
+
+ {{ config.tips }}
+
+
+
+