Merge branch 'feature/new-sys' into 'master'
支持传入主题色 See merge request workbench/y-code!25
This commit is contained in:
		
						commit
						272df4bbe0
					
				
							
								
								
									
										5
									
								
								src/assets/styles/variable.less
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								src/assets/styles/variable.less
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,5 @@ | |||||||
|  | @primary-color: var(--primary-color); // 主题色 | ||||||
|  | @primary-light-color: var(--primary-light-color); // 主题色 - 浅色 | ||||||
|  | @table-head-bg-color: var(--table-head-bg-color); // 表头背景色 | ||||||
|  | @table-head-font-color: var(--table-head-font-color); // 表头字体颜色 | ||||||
|  | @primary-bg-color: #f8f8f8; | ||||||
| @ -39,7 +39,14 @@ | |||||||
|         :scroll="{ x: 1000, y: `calc(100vh - 280px)` }" |         :scroll="{ x: 1000, y: `calc(100vh - 280px)` }" | ||||||
|         size="small" |         size="small" | ||||||
|         bordered |         bordered | ||||||
|       ></a-table> |       > | ||||||
|  |         <template #bodyCell="{ column, record }"> | ||||||
|  |           <a-image v-if="column.show_type === 'img'" :src="record[column.dataIndex]" :width="160" /> | ||||||
|  |           <a v-else-if="column.show_type === 'link'" target="_blank" :href="record[column.dataIndex]">{{ record[column.dataIndex] }}</a> | ||||||
|  |           <div v-else-if="column.show_type === 'richText'" v-html="record[column.dataIndex]"></div> | ||||||
|  |           <template v-else>{{ record[column.dataIndex] }}</template> | ||||||
|  |         </template> | ||||||
|  |       </a-table> | ||||||
|       <a-pagination |       <a-pagination | ||||||
|         v-model:current="pageState.page" |         v-model:current="pageState.page" | ||||||
|         :total="total" |         :total="total" | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| @primary-bg-color: #f8f8f8; | // @primary-bg-color: #f8f8f8; | ||||||
|  | @import '../src/assets/styles/variable.less'; | ||||||
| 
 | 
 | ||||||
| html, body { | html, body { | ||||||
|   background-color: @primary-bg-color; |   background-color: @primary-bg-color; | ||||||
|  | |||||||
							
								
								
									
										26
									
								
								src/main.ts
									
									
									
									
									
								
							
							
						
						
									
										26
									
								
								src/main.ts
									
									
									
									
									
								
							| @ -9,22 +9,26 @@ import { renderWithQiankun, qiankunWindow } from 'vite-plugin-qiankun/dist/helpe | |||||||
| let app | let app | ||||||
| function render(props: Object = {}) { | function render(props: Object = {}) { | ||||||
|   app = createApp(App); |   app = createApp(App); | ||||||
|  |   setStyleSheet(props.styles) | ||||||
|   const router = createProjectRouter(props.base) |   const router = createProjectRouter(props.base) | ||||||
|   app.use(router) |   app.use(router) | ||||||
|   app.use(VueGridLayout); |   app.use(VueGridLayout); | ||||||
|   app.use(createPinia()) |   app.use(createPinia()) | ||||||
|   app.mount("#y-code-app") |   app.mount("#y-code-app") | ||||||
|   // const getContainer = () => {
 | } | ||||||
|   //   props.container ? props.container.querySelector('#y-code-container') : document.getElementById('y-code-container')
 | 
 | ||||||
|   // }
 | function setStyleSheet(styles: Object = {}) { | ||||||
|   // const container = getContainer()
 |   const styleEle = document.createElement('style') | ||||||
|   // if (container) {
 |   styleEle.type = 'text/css' | ||||||
|   //   app.mount(container)
 |   styleEle.innerHTML = ` | ||||||
|   // } else {
 |   :root { | ||||||
|   //   window.addEventListener("DOMContentLoaded", () => {
 |     --primary-color: ${styles.primaryColor || '#1677ff'}; | ||||||
|   //     app.mount(getContainer())
 |     --primary-light-color: ${styles.primaryLightColor || '#4096ff'}; | ||||||
|   //   })
 |     --table-head-bg-color: ${styles.tableHeadBgColor || '#fafafa'}; | ||||||
|   // }
 |     --table-head-font-color: ${styles.tableHeadFontColor || '#191919'}; | ||||||
|  |   } | ||||||
|  |   ` | ||||||
|  |   document.head.appendChild(styleEle) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| const __POWERED_BY_QIANKUN__ = qiankunWindow.__POWERED_BY_QIANKUN__ || window.proxy?.__POWERED_BY_QIANKUN__ | const __POWERED_BY_QIANKUN__ = qiankunWindow.__POWERED_BY_QIANKUN__ || window.proxy?.__POWERED_BY_QIANKUN__ | ||||||
|  | |||||||
| @ -54,6 +54,19 @@ | |||||||
|               {{ record.field_numerical_name }} |               {{ record.field_numerical_name }} | ||||||
|             </template> |             </template> | ||||||
|           </template> |           </template> | ||||||
|  |           <template v-if="column.dataIndex === 'show_type'"> | ||||||
|  |             <a-select  | ||||||
|  |               v-if="editableData[record.field_id]"  | ||||||
|  |               v-model:value="record.show_type"  | ||||||
|  |               :options="showTypeOpts"  | ||||||
|  |               placeholder="请选择" | ||||||
|  |               allow-clear | ||||||
|  |               style="width: 120px"> | ||||||
|  |             </a-select> | ||||||
|  |             <template v-else> | ||||||
|  |               {{ record.show_type }} | ||||||
|  |             </template> | ||||||
|  |           </template> | ||||||
|           <template v-if="column.dataIndex === 'field_type_name'"> |           <template v-if="column.dataIndex === 'field_type_name'"> | ||||||
|             <a-select |             <a-select | ||||||
|               v-if="editableData[record.field_id]" |               v-if="editableData[record.field_id]" | ||||||
| @ -159,7 +172,7 @@ | |||||||
| 
 | 
 | ||||||
| <script setup> | <script setup> | ||||||
| import { onMounted, reactive, ref, watch } from "vue"; | import { onMounted, reactive, ref, watch } from "vue"; | ||||||
| import { viewCfgCols, originalTypes } from "@/views/config-manage/module-cfg/config"; | import { viewCfgCols, originalTypes, showTypeOpts } from "@/views/config-manage/module-cfg/config"; | ||||||
| import { | import { | ||||||
|   getFieldTypeSelect, |   getFieldTypeSelect, | ||||||
|   getFieldNumSelect, |   getFieldNumSelect, | ||||||
| @ -332,6 +345,7 @@ const handleSave = (record) => { | |||||||
|     { field: 'field_name', msg: "请填写字段名称" }, |     { field: 'field_name', msg: "请填写字段名称" }, | ||||||
|     { field: 'field_numerical_type_id', msg: "请选择字段类型" }, |     { field: 'field_numerical_type_id', msg: "请选择字段类型" }, | ||||||
|     { field: 'belong_to_table', msg: "请填写关联表" }, |     { field: 'belong_to_table', msg: "请填写关联表" }, | ||||||
|  |     { field: 'show_type', msg: "请选择展示类型" }, | ||||||
|   ] |   ] | ||||||
|   for(let i = 0; i < validateFields.length; i++) { |   for(let i = 0; i < validateFields.length; i++) { | ||||||
|     const curr = validateFields[i]; |     const curr = validateFields[i]; | ||||||
|  | |||||||
| @ -12,6 +12,7 @@ export const viewCfgCols = [ | |||||||
|   { dataIndex: 'field_name', title: '字段名称', align: 'center'}, |   { dataIndex: 'field_name', title: '字段名称', align: 'center'}, | ||||||
|   { dataIndex: 'field_title', title: '字段标题', align: 'center'}, |   { dataIndex: 'field_title', title: '字段标题', align: 'center'}, | ||||||
|   { dataIndex: 'field_numerical_name', title: '字段类型', align: 'center', width: 120}, |   { dataIndex: 'field_numerical_name', title: '字段类型', align: 'center', width: 120}, | ||||||
|  |   { dataIndex: 'show_type', title: '展示类型', align: 'center', width: 120}, | ||||||
|   { dataIndex: 'field_type_name', title: '搜索类型', align: 'center'}, |   { dataIndex: 'field_type_name', title: '搜索类型', align: 'center'}, | ||||||
|   { dataIndex: 'is_search', title: '是否可搜索', align: 'center'}, |   { dataIndex: 'is_search', title: '是否可搜索', align: 'center'}, | ||||||
|   { dataIndex: 'sort', title: '排序', align: 'center'}, |   { dataIndex: 'sort', title: '排序', align: 'center'}, | ||||||
| @ -26,3 +27,10 @@ export const originalTypes = [ | |||||||
|   { label: 'sql', value: 1 }, |   { label: 'sql', value: 1 }, | ||||||
|   { label: 'json', value: 2 }, |   { label: 'json', value: 2 }, | ||||||
| ] | ] | ||||||
|  | 
 | ||||||
|  | export const showTypeOpts = [ | ||||||
|  |   { label: '文本', value: 'text' }, | ||||||
|  |   { label: '图片', value: 'img' }, | ||||||
|  |   { label: '链接', value: 'link' }, | ||||||
|  |   { label: '富文本', value: 'richText' }, | ||||||
|  | ] | ||||||
|  | |||||||
| @ -302,6 +302,8 @@ const getAllCardsData = async () => { | |||||||
| }; | }; | ||||||
| </script> | </script> | ||||||
| <style lang="less" scoped> | <style lang="less" scoped> | ||||||
|  | @import './style.less'; | ||||||
|  | 
 | ||||||
| .view-box { | .view-box { | ||||||
|   height: 100%; |   height: 100%; | ||||||
|   width: 100%; |   width: 100%; | ||||||
| @ -338,4 +340,5 @@ const getAllCardsData = async () => { | |||||||
| .vue-grid-item { | .vue-grid-item { | ||||||
|   height: auto; |   height: auto; | ||||||
| } | } | ||||||
|  | 
 | ||||||
| </style> | </style> | ||||||
|  | |||||||
							
								
								
									
										55
									
								
								src/views/page-show-info/page-info/style.less
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										55
									
								
								src/views/page-show-info/page-info/style.less
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,55 @@ | |||||||
|  | @import '@/assets/styles/variable.less'; | ||||||
|  | 
 | ||||||
|  | // 设置按钮 | ||||||
|  | :deep(.@{ant-prefix}-btn-primary) { | ||||||
|  |   background-color: @primary-color !important; | ||||||
|  |   &:hover { | ||||||
|  |     background-color: @primary-light-color !important; | ||||||
|  |   } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | // 设置输入框 | ||||||
|  | :deep(.@{ant-prefix}-input-affix-wrapper:not(.@{ant-prefix}-input-affix-wrapper-disabled):hover) { | ||||||
|  |   border-color: @primary-light-color !important; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | // 设置选择框 | ||||||
|  | :deep(.@{ant-prefix}-select-selector:hover) { | ||||||
|  |   border-color: @primary-light-color !important; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | :deep(.@{ant-prefix}-select-focused) { | ||||||
|  |   .@{ant-prefix}-select-selector { | ||||||
|  |     border-color: @primary-light-color !important; | ||||||
|  |   } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | // 设置日期框 | ||||||
|  | :deep(.@{ant-prefix}-picker) { | ||||||
|  |   &:hover, &-focused { | ||||||
|  |     border-color: @primary-light-color !important; | ||||||
|  |   } | ||||||
|  |   &-active-bar { | ||||||
|  |     background-color: @primary-light-color !important; | ||||||
|  |   } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | // 设置表格 | ||||||
|  | :deep(.@{ant-prefix}-table-thead > tr > th) { | ||||||
|  |   background-color: @table-head-bg-color !important; | ||||||
|  |   color: @table-head-font-color !important; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | // 设置分页器 | ||||||
|  | :deep(.@{ant-prefix}-pagination-item) { | ||||||
|  |   &-active { | ||||||
|  |     border-color: @primary-color !important; | ||||||
|  |     a { | ||||||
|  |       color: @primary-color !important; | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  |   &-link-icon { | ||||||
|  |     color: @primary-color !important; | ||||||
|  |   } | ||||||
|  | } | ||||||
| @ -99,7 +99,14 @@ | |||||||
|               :scroll="{ x: 1000, y: `calc(100vh - 260px)` }" |               :scroll="{ x: 1000, y: `calc(100vh - 260px)` }" | ||||||
|               size="small" |               size="small" | ||||||
|               bordered |               bordered | ||||||
|             ></a-table> |             > | ||||||
|  |               <template #bodyCell="{ column, record }"> | ||||||
|  |                 <a-image v-if="column.show_type === 'img'" :src="record[column.dataIndex]" :width="160" /> | ||||||
|  |                 <a v-else-if="column.show_type === 'link'" target="_blank" :href="record[column.dataIndex]">{{ record[column.dataIndex] }}</a> | ||||||
|  |                 <div v-else-if="column.show_type === 'richText'" v-html="record[column.dataIndex]"></div> | ||||||
|  |                 <template v-else>{{ record[column.dataIndex] }}</template> | ||||||
|  |               </template> | ||||||
|  |             </a-table> | ||||||
|             <a-pagination |             <a-pagination | ||||||
|               v-model:current="previewData.page" |               v-model:current="previewData.page" | ||||||
|               :total="previewData.total" |               :total="previewData.total" | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| export const viewListCols = [ | export const viewListCols = [ | ||||||
|  |   { dataIndex: 'preview_id', title: 'id', align: 'center' }, | ||||||
|   { dataIndex: 'preview_name', title: '视图名称', align: 'center' }, |   { dataIndex: 'preview_name', title: '视图名称', align: 'center' }, | ||||||
|   { dataIndex: 'created_at', title: '创建时间', align: 'center' }, |   { dataIndex: 'created_at', title: '创建时间', align: 'center' }, | ||||||
|   { dataIndex: 'action', title: '操作', align: 'center' }, |   { dataIndex: 'action', title: '操作', align: 'center' }, | ||||||
|  | |||||||
| @ -132,6 +132,10 @@ onMounted(() => { | |||||||
| const toGetProModular = () => { | const toGetProModular = () => { | ||||||
|   getProModular().then((res) => { |   getProModular().then((res) => { | ||||||
|     projectSel.value = res.data; |     projectSel.value = res.data; | ||||||
|  |     if (res.data.length) { | ||||||
|  |       projectId.value = res.data[0].value; | ||||||
|  |       onProjectChange(projectId.value) | ||||||
|  |     } | ||||||
|   }); |   }); | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 林梓阳
						林梓阳