03c3c71f1aad05f593fc36d13670a8fd903af880.svn-base 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512
  1. # JDate 日期组件 使用文档
  2. ###### 说明: antd-vue日期组件需要用moment中转一下,用起来不是很方便,特二次封装,使用时只需要传字符串即可
  3. ## 参数配置
  4. | 参数 | 类型 | 必填 |说明|
  5. |--------------|---------|----|---------|
  6. | placeholder |string | | placeholder |
  7. | readOnly | boolean | | true/false 默认false |
  8. | value | string | | 绑定v-model或是v-decorator后不需要设置 |
  9. | showTime | boolean | | 是否展示时间true/false 默认false |
  10. | dateFormat | string | |日期格式 默认'YYYY-MM-DD' 若showTime设置为true则需要将其设置成对应的时间格式(如:YYYY-MM-DD HH:mm:ss) |
  11. | triggerChange | string | |触发组件值改变的事件是否是change,当使用v-decorator时且没有设置decorator的option.trigger为input需要设置该值为true |
  12. 使用示例
  13. ----
  14. 1.组件带有v-model的使用方法
  15. ```vue
  16. <j-date v-model="dateStr"></j-date>
  17. ```
  18. 2.组件带有v-decorator的使用方法
  19. a).设置trigger-change属性为true
  20. ```vue
  21. <j-date :trigger-change="true" v-decorator="['dateStr',{}]"></j-date>
  22. ```
  23. b).设置decorator的option.trigger为input
  24. ```vue
  25. <j-date v-decorator="['dateStr',{trigger:'input'}]"></j-date>
  26. ```
  27. 3.其他使用
  28. 添加style
  29. ```vue
  30. <j-date v-model="dateStr" style="width:100%"></j-date>
  31. ```
  32. 添加placeholder
  33. ```vue
  34. <j-date v-model="dateStr" placeholder="请输入dateStr"></j-date>
  35. ```
  36. 添加readOnly
  37. ```vue
  38. <j-date v-model="dateStr" :read-only="true"></j-date>
  39. ```
  40. 备注:
  41. script内需引入jdate
  42. ```vue
  43. <script>
  44. import JDate from '@/components/jeecg/JDate'
  45. export default {
  46. name: "demo",
  47. components: {
  48. JDate
  49. }
  50. //...
  51. }
  52. </script>
  53. ```
  54. ---
  55. # JSuperQuery 高级查询 使用文档
  56. ## 参数配置
  57. | 参数 | 类型 | 必填 | 说明 |
  58. |--------------|---------|----|----------------------|
  59. | fieldList | array |✔| 需要查询的列集合示例如下,type类型有:date/datetime/string/int/number |
  60. | callback | array | | 回调函数名称(非必须)默认handleSuperQuery |
  61. fieldList结构示例:
  62. ```vue
  63. const superQueryFieldList=[{
  64. type:"date",
  65. value:"birthday",
  66. text:"生日"
  67. },{
  68. type:"string",
  69. value:"name",
  70. text:"用户名"
  71. },{
  72. type:"int",
  73. value:"age",
  74. text:"年龄"
  75. }]
  76. ```
  77. 页面代码概述:
  78. ----
  79. 1.import之后再components之内声明
  80. ```vue
  81. import JSuperQuery from '@/components/jeecg/JSuperQuery.vue';
  82. export default {
  83. name: "JeecgDemoList",
  84. components: {
  85. JSuperQuery
  86. },
  87. ```
  88. 2.页面引用
  89. ```vue
  90. <!-- 高级查询区域 -->
  91. <j-super-query :fieldList="fieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>
  92. ```
  93. 3.list页面data中需要定义三个属性:
  94. ```vue
  95. fieldList:superQueryFieldList,
  96. superQueryFlag:false,
  97. superQueryParams:""
  98. ```
  99. 4.list页面声明回调事件handleSuperQuery(与组件的callback对应即可)
  100. ```vue
  101. //高级查询方法
  102. handleSuperQuery(arg) {
  103. if(!arg){
  104. this.superQueryParams=''
  105. this.superQueryFlag = false
  106. }else{
  107. this.superQueryFlag = true
  108. this.superQueryParams=JSON.stringify(arg)
  109. }
  110. this.loadData()
  111. },
  112. ```
  113. 5.改造list页面方法
  114. ```vue
  115. // 获取查询条件
  116. getQueryParams() {
  117. let sqp = {}
  118. if(this.superQueryParams){
  119. sqp['superQueryParams']=encodeURI(this.superQueryParams)
  120. }
  121. var param = Object.assign(sqp, this.queryParam, this.isorter);
  122. param.field = this.getQueryField();
  123. param.pageNo = this.ipagination.current;
  124. param.pageSize = this.ipagination.pageSize;
  125. return filterObj(param);
  126. },
  127. ```
  128. 6.打开弹框调用show方法:
  129. ```vue
  130. this.$refs.superQueryModal.show();
  131. ```
  132. # JEllipsis 字符串超长截取省略号显示
  133. ###### 说明: 遇到超长文本展示,通过此标签可以截取省略号显示,鼠标放置会提示全文本
  134. ## 参数配置
  135. | 参数 | 类型 | 必填 | 说明 |
  136. |--------|---------|----|----------------|
  137. | value |string | 必填 | 字符串文本|
  138. | length | number | 非必填 | 默认25 |
  139. 使用示例
  140. ----
  141. 1.组件带有v-model的使用方法
  142. ```vue
  143. <j-ellipsis :value="text"/>
  144. # Modal弹框实现最大化功能
  145. 1.定义modal的宽度:
  146. ```vue
  147. <a-modal
  148. :width="modalWidth"
  149. />
  150. ```
  151. 2.自定义modal的title,居右显示切换图标
  152. ```vue
  153. <template slot="title">
  154. <div style="width: 100%;">
  155. <span>{{ title }}</span>
  156. <span style="display:inline-block;width:calc(100% - 51px);padding-right:10px;text-align: right">
  157. <a-button @click="toggleScreen" icon="appstore" style="height:20px;width:20px;border:0px"></a-button>
  158. </span>
  159. </div>
  160. </template>
  161. ```
  162. 3.定义toggleScreen事件,用于切换modal宽度
  163. ```vue
  164. toggleScreen(){
  165. if(this.modaltoggleFlag){
  166. this.modalWidth = window.innerWidth;
  167. }else{
  168. this.modalWidth = 800;
  169. }
  170. this.modaltoggleFlag = !this.modaltoggleFlag;
  171. },
  172. ```
  173. 4.data中声明上述用到的属性
  174. ```vue
  175. data () {
  176. return {
  177. modalWidth:800,
  178. modaltoggleFlag:true,
  179. ```
  180. # <a-select/> 下拉选项滚动错位的解决方法
  181. ## 问题描述
  182. 当使用了 `a-modal` 或其他带有滚动条的组件时,使用`a-select`组件并打开下拉框时滚动滚动条,就会导致错位的问题产生。
  183. ## 解决方法
  184. 大多数情况下,在 `a-select` 上添加一个 `getPopupContainer` 属性,值为`node => node.parentNode`即可解决。
  185. 但是如果遇到 `a-select` 标签层级过深的情况,可能仍然会显示异常,只需要多加几个`.parentNode` (例:node => node.parentNode.parentNode.parentNode)多尝试几次直到解决问题即可。
  186. ### 代码示例
  187. ```html
  188. <a-select
  189. placeholder="请选择展示模板"
  190. :options="dicts.displayTemplate"
  191. :getPopupContainer="node => node.parentNode"
  192. />
  193. ```
  194. # JAsyncTreeList 异步数列表组件使用说明
  195. ## 引入组件
  196. ```js
  197. import JTreeTable from '@/components/jeecg/JTreeTable'
  198. export default {
  199. components: { JTreeTable }
  200. }
  201. ```
  202. ## 所需参数
  203. | 参数 | 类型 | 必填 | 说明 |
  204. |-------------|--------|--------|--------------------------------------------------------------|
  205. | rowKey | String | 非必填 | 表格行 key 的取值,默认为"id" |
  206. | columns | Array | 必填 | 表格列的配置描述,具体见Antd官方文档 |
  207. | url | String | 必填 | 数据查询url |
  208. | childrenUrl | String | 非必填 | 查询子级时的url,若不填则使用url参数查询子级 |
  209. | queryKey | String | 非必填 | 根据某个字段查询,如果传递 id 就根据 id 查询,默认为parentId |
  210. | queryParams | Object | 非必填 | 查询参数,当查询参数改变的时候会自动重新查询,默认为{} |
  211. | topValue | String | 非必填 | 查询顶级时的值,如果顶级为0,则传0,默认为null |
  212. | tableProps | Object | 非必填 | 自定义给内部table绑定的props |
  213. ## 代码示例
  214. ```html
  215. <template>
  216. <a-card :bordered="false">
  217. <j-tree-table :url="url" :columns="columns" :tableProps="tableProps"/>
  218. </a-card>
  219. </template>
  220. <script>
  221. import JTreeTable from '@/components/jeecg/JTreeTable'
  222. export default {
  223. name: 'AsyncTreeTable',
  224. components: { JTreeTable },
  225. data() {
  226. return {
  227. url: '/mock/api/asynTreeList',
  228. columns: [
  229. { title: '菜单名称', dataIndex: 'name' },
  230. { title: '组件', dataIndex: 'component' },
  231. { title: '排序', dataIndex: 'orderNum' }
  232. ],
  233. selectedRowKeys: []
  234. }
  235. },
  236. computed: {
  237. tableProps() {
  238. let _this = this
  239. return {
  240. // 列表项是否可选择
  241. // 配置项见:https://vue.ant.design/components/table-cn/#rowSelection
  242. rowSelection: {
  243. selectedRowKeys: _this.selectedRowKeys,
  244. onChange: (selectedRowKeys) => _this.selectedRowKeys = selectedRowKeys
  245. }
  246. }
  247. }
  248. }
  249. }
  250. </script>
  251. ```
  252. # JCheckbox 使用文档
  253. ###### 说明: antd-vue checkbox组件处理的是数组,用起来不是很方便,特二次封装,使用时只需处理字符串即可
  254. ## 参数配置
  255. | 参数 | 类型 | 必填 |说明|
  256. |--------------|---------|----|---------|
  257. | options |array |✔| checkbox需要配置的项,是个数组,数组中每个对象包含两个属性:label(用于显示)和value(用于存储) |
  258. 使用示例
  259. ----
  260. ```vue
  261. <template>
  262. <a-form :form="form">
  263. <a-form-item label="v-model式用法">
  264. <j-checkbox v-model="sport" :options="sportOptions"></j-checkbox><span>{{ sport }}</span>
  265. </a-form-item>
  266. <a-form-item label="v-decorator式用法">
  267. <j-checkbox v-decorator="['sport']" :options="sportOptions"></j-checkbox><span>{{ getFormFieldValue('sport') }}</span>
  268. </a-form-item>
  269. </a-form>
  270. </template>
  271. <script>
  272. import JCheckbox from '@/components/jeecg/JCheckbox'
  273. export default {
  274. components: {JCheckbox},
  275. data() {
  276. return {
  277. form: this.$form.createForm(this),
  278. sport:'',
  279. sportOptions:[
  280. {
  281. label:"足球",
  282. value:"1"
  283. },{
  284. label:"篮球",
  285. value:"2"
  286. },{
  287. label:"乒乓球",
  288. value:"3"
  289. }]
  290. }
  291. },
  292. methods: {
  293. getFormFieldValue(field){
  294. return this.form.getFieldValue(field)
  295. }
  296. }
  297. }
  298. </script>
  299. ```
  300. # JCodeEditor 使用文档
  301. ###### 说明: 一个简易版的代码编辑器,支持语法高亮
  302. ## 参数配置
  303. | 参数 | 类型 | 必填 |说明|
  304. |--------------|---------|----|---------|
  305. | language |string | | 表示当前编写代码的类型 javascript/html/css/sql |
  306. | placeholder |string | | placeholder |
  307. | lineNumbers |Boolean | | 是否显示行号 |
  308. | fullScreen |Boolean | | 是否显示全屏按钮 |
  309. | zIndex |string | | 全屏以后的z-index |
  310. 使用示例
  311. ----
  312. ```vue
  313. <template>
  314. <div>
  315. <j-code-editor
  316. language="javascript"
  317. v-model="editorValue"
  318. :fullScreen="true"
  319. style="min-height: 100px"/>
  320. {{ editorValue }}
  321. </div>
  322. </template>
  323. <script>
  324. import JCodeEditor from '@/components/jeecg/JCodeEditor'
  325. export default {
  326. components: {JCodeEditor},
  327. data() {
  328. return {
  329. form: this.$form.createForm(this),
  330. editorValue:'',
  331. }
  332. }
  333. }
  334. </script>
  335. ```
  336. # JFormContainer 使用文档
  337. ###### 说明: 暂用于表单禁用
  338. 使用示例
  339. ----
  340. ```vue
  341. <!-- 在form下直接写这个组件,设置disabled为true就能将此form中的控件禁用 -->
  342. <a-form layout="inline" :form="form" >
  343. <j-form-container disabled>
  344. <!-- 表单内容省略..... -->
  345. </j-form-container>
  346. </a-form>
  347. ```
  348. # JImportModal 使用文档
  349. ###### 说明: 用于列表页面导入excel功能
  350. 使用示例
  351. ----
  352. ```vue
  353. <template>
  354. <!-- 此处省略部分代码...... -->
  355. <a-button @click="handleImportXls" type="primary" icon="upload">导入</a-button>
  356. <!-- 此处省略部分代码...... -->
  357. <j-import-modal ref="importModal" :url="getImportUrl()" @ok="importOk"></j-import-modal>
  358. <!-- 此处省略部分代码...... -->
  359. </template>
  360. <script>
  361. import JCodeEditor from '@/components/jeecg/JCodeEditor'
  362. export default {
  363. components: {JCodeEditor},
  364. data() {
  365. return {
  366. //省略代码......
  367. }
  368. },
  369. methods:{
  370. //省略部分代码......
  371. handleImportXls(){
  372. this.$refs.importModal.show()
  373. },
  374. getImportUrl(){
  375. return '你自己处理上传业务的后台地址'
  376. },
  377. importOk(){
  378. this.loadData(1)
  379. }
  380. }
  381. }
  382. </script>
  383. ```
  384. # JSelectMultiple 多选下拉组件
  385. online用 实际开发请使用components/dict/JMultiSelectTag
  386. # JSlider 滑块验证码
  387. 使用示例
  388. ----
  389. ```vue
  390. <template>
  391. <div style="width: 300px">
  392. <j-slider @onSuccess="sliderSuccess"></j-slider>
  393. </div>
  394. </template>
  395. <script>
  396. import JSlider from '@/components/jeecg/JSlider'
  397. export default {
  398. components: {JSlider},
  399. data() {
  400. return {
  401. form: this.$form.createForm(this),
  402. editorValue:'',
  403. }
  404. },
  405. methods:{
  406. sliderSuccess(){
  407. console.log("验证完成")
  408. }
  409. }
  410. }
  411. </script>
  412. ```
  413. # JTreeSelect 树形下拉组件
  414. 异步加载的树形下拉组件
  415. ## 参数配置
  416. | 参数 | 类型 | 必填 |说明|
  417. |--------------|---------|----|---------|
  418. | placeholder |string | | placeholder |
  419. | dict |string | ✔| 表名,显示字段名,存储字段名拼接的字符串 |
  420. | pidField |string | ✔| 父ID的字段名 |
  421. | pidValue |string | | 根节点父ID的值 默认'0' 不可以设置为空,如果想使用此组件,而数据库根节点父ID为空,请修改之 |
  422. | multiple |boolean | |是否支持多选 |
  423. 使用示例
  424. ----
  425. ```vue
  426. <template>
  427. <a-form>
  428. <a-form-item label="树形下拉测试" style="width: 300px">
  429. <j-tree-select
  430. v-model="departId"
  431. placeholder="请选择部门"
  432. dict="sys_depart,depart_name,id"
  433. pidField="parent_id">
  434. </j-tree-select>
  435. {{ departId }}
  436. </a-form-item>
  437. </a-form >
  438. </template>
  439. <script>
  440. import JTreeSelect from '@/components/jeecg/JTreeSelect'
  441. export default {
  442. components: {JTreeSelect},
  443. data() {
  444. return {
  445. departId:""
  446. }
  447. }
  448. }
  449. </script>
  450. ```