-
Notifications
You must be signed in to change notification settings - Fork 4
添加审核模板 #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
BingBlog
merged 1 commit into
JSON-Drived-Configurable-Platform:master
from
xiaomiCat:master
Mar 19, 2020
Merged
添加审核模板 #10
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| import index from './index.vue'; | ||
|
|
||
| export default index; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,337 @@ | ||
| <template> | ||
| <div class="audit-detail-example-demo"> | ||
| <!-- <div class="go-back" v-if="pageConfig.pageGoBackUrl"> | ||
| <Button type="primary" @click="$router.push(pageConfig.pageGoBackUrl)">返回</Button> | ||
| </div> --> | ||
| <!-- <DetailSteps class="ivu-steps"> | ||
| </DetailSteps> --> | ||
| <div | ||
| v-for="config in pageConfig.tableList" | ||
| :key="config.title" | ||
| class="audit-detail-example-demo-section" | ||
| > | ||
| <h3 class="audit-detail-example-demo-header"> | ||
| {{ config.title }} | ||
| </h3> | ||
| <div class="audit-detail-example-demo-tool-bar"> | ||
| <a :href="downLoadUrl" v-if="downLoadUrl && config.needShowDownLoadButton">下载全部</a> | ||
| </div> | ||
| <Table | ||
| :class="[config.changeFormStyle ? 'audit-detail-example-demo-table audit-detail-example-demo-form' | ||
| : 'audit-detail-example-demo-table']" | ||
| :columns="config.table.columns" | ||
| :data="config.table.data" | ||
| :show-header="config.showTableHeader" | ||
| v-if="config.type==='table'" | ||
| > | ||
| <template | ||
| v-for="column in config.table.columns" | ||
| :slot="column.slot" | ||
| :ref="column.slot" | ||
| slot-scope="{ row, index }" | ||
| > | ||
| <div v-if="column.htmlKey" :key="column.slot"> | ||
| <div v-if="row.key===config.htmlKey"> | ||
| <a class="download-wrapper" :href="item.url" v-for="(item, key) in row.value" :key="key"> | ||
| {{item.name}}</a> | ||
| </div> | ||
| <div v-else>{{row.value}}</div> | ||
| </div> | ||
| <Form | ||
| v-if="!row.hideForm && column.formFields | ||
| ? (config.hideFormKey ? config.hideFormKey === row.key : true) : false" | ||
| :key="column.slot" | ||
| :ref="column.slot + row.key" | ||
| :model="row" | ||
| > | ||
| <!-- column.slot + row.key. eg: 'imgList' + 'action' or 'action' + 'name' --> | ||
| <FieldGenerator | ||
| v-for="(field, i) in column.formFields" | ||
| :key="i" | ||
| :field="field" | ||
| @on-field-change="handleFieldChange($event, row, column.slot + row.key)" | ||
| @on-button-event="handleButtonEvent($event, row, index)" | ||
| @on-list-item-click="handleListItemClick" | ||
| /> | ||
| </Form> | ||
| </template> | ||
| </Table> | ||
| </div> | ||
| <div class="audit-detail-example-footer-actions" v-if="pageConfig.showButton && pageData.isCheck"> | ||
| <Button type="primary" @click="handleSave(pageConfig.formVaildAction)">提交保存</Button> | ||
| </div> | ||
| <Modal v-model="modalOpen" :width="800"> | ||
| <img | ||
| class="audit-detail-example-demo-modal-img" | ||
| :src="modalImgUrl" | ||
| alt="" | ||
| > | ||
| </Modal> | ||
| <Modal | ||
| v-model="dialogShow" | ||
| :title="dialogsConfig.title" | ||
| > | ||
| <div>{{dialogsConfig.content}}</div> | ||
| <div slot="footer"> | ||
| <Button type="text" size="large" @click="cancel">取消</Button> | ||
| <Button type="primary" size="large" @click="confirm(submitApi)">确定</Button> | ||
| </div> | ||
| </Modal> | ||
| </div> | ||
| </template> | ||
| <script> | ||
| /* eslint-disable no-console */ | ||
| import {mapState} from 'vuex'; | ||
| import axios from '../../libs/api.request'; | ||
|
|
||
| export default { | ||
| data() { | ||
| return { | ||
| formModel: {}, | ||
| modalOpen: false, | ||
| modalImgUrl: '', | ||
| model: { | ||
| step: 2 | ||
| }, | ||
| dialogShow: false, | ||
| dialogTitle: '', | ||
| dialogContent: '', | ||
| dialogContentType: '', | ||
| formData: {}, | ||
| dialogFooterHide: false, | ||
| isChange: false, | ||
| dilogsOpen: {}, | ||
| dilogsModel: {}, | ||
| pageData: { | ||
| isCheck: true | ||
| }, | ||
| downLoadUrl: '', | ||
| pageConfig: {} | ||
| }; | ||
| }, | ||
| computed: { | ||
| pageRequestInfo() { | ||
| return this.pageConfig && this.pageConfig.request; | ||
| }, | ||
| ...mapState({ | ||
| keyToLabel: state => state.page.keyToLabel, | ||
| pagePath: state => state.page.pagePath, | ||
| keyList: state => state.page.keyList | ||
| }), | ||
| submitApi() { | ||
| return this.pageConfig.submitApi && this.pageConfig.submitApi; | ||
| }, | ||
| dialogsConfig() { | ||
| return this.pageConfig.dialogs || {}; | ||
| }, | ||
| needDealUploadData() { | ||
| return this.pageConfig.needDealUploadData || false; | ||
| } | ||
| }, | ||
| watch: { | ||
| pagePath() { | ||
| this.getPageConfig(); | ||
| } | ||
| }, | ||
| mounted() { | ||
| this.getPageConfig(); | ||
| }, | ||
| methods: { | ||
| getPageConfig() { | ||
| axios | ||
| .request({ | ||
| url: `/api${this.pagePath}/page-config`, | ||
| method: "get", | ||
| params: { | ||
| pagePath: this.pagePath | ||
| } | ||
| }) | ||
| .then(res => { | ||
| this.pageConfig = res.data; | ||
| this.getPageDetail(); | ||
| }); | ||
| }, | ||
| handleButtonEvent($event, row, index) { | ||
| const {name} = $event; | ||
| if (/dialog-/.test(name)) { | ||
| const dialogName = name.replace(/dialog-/, ''); | ||
| this.$set(this.dilogsOpen, dialogName, true); | ||
| } else { | ||
| this[$event.name](row, index); | ||
| } | ||
| }, | ||
| /** | ||
| * When the field value changed, sync the value to this.formModel | ||
| * Notice there may be more than form in the per line in the table. | ||
| * | ||
| * @param ($event, row, refKey) | ||
| * @param {String} $event.model the changed field's model, eg: auditStatus | ||
| * @param {String} $event.value the change field's value, eg: 1 (one value of auditStatus's options) | ||
| * @param {String} row.key the changed field' identifier, eg: name | ||
| * @param {String} refKey the ref of the changed field's form, eg: actionname. | ||
| */ | ||
| handleFieldChange({model, value}, row, refKey) { | ||
| const key = row.key; | ||
| // eslint-disable-next-line no-console | ||
| this.$refs[refKey][0].validate(); | ||
| if (!this.formModel[key]) { | ||
| this.$set(this.formModel, key, {}); | ||
| } | ||
| this.$set(this.formModel[key], model, value); | ||
| }, | ||
| handleSave(action) { | ||
| let validCount = 0; | ||
| const refKeys = Object.keys(this.$refs); | ||
| refKeys.forEach(form => { | ||
| this.$refs[form][0].validate().then(valid => { | ||
| if (valid) { | ||
| validCount++; | ||
| } | ||
| // All validate success | ||
| if (validCount === refKeys.length) { | ||
| this.dialogTitle = this.pageConfig.dialogs.title; | ||
| this.dialogContent = this.pageConfig.dialogs.content; | ||
| this.dialogShow = true; | ||
| } | ||
| }).catch(err => { | ||
| console.log(err); | ||
| }); | ||
| }); | ||
| }, | ||
| handleImgClick(imgUrl) { | ||
| this.modalOpen = true; | ||
| this.modalImgUrl = imgUrl; | ||
| }, | ||
| handleListItemClick({url}) { | ||
| this.modalOpen = true; | ||
| this.modalImgUrl = url; | ||
| }, | ||
| getPageDetail() { | ||
| // 先清数据避免上一个页面的数据在当前页面展示 | ||
| this.resetPageData(); | ||
| const {api, method} = this.pageRequestInfo; | ||
| axios | ||
| .request({ | ||
| method, | ||
| url: api, | ||
| params: { | ||
| applyNo: this.$route.query.applyNo || 0 | ||
| } | ||
| }) | ||
| .then(res => { | ||
| if (res && res.data) { | ||
| this.downLoadUrl = res.data.downLoadUrl; | ||
| this.mergePageInfoFromApi(this.pageConfig, this.keyToLabel, res.data.info); | ||
| } | ||
| }).catch(err => { | ||
| }); | ||
| }, | ||
| mergePageInfoFromApi(pageConfig, keyToLabel, pageData) { | ||
| pageConfig.tableList = pageConfig.tableList.map(sectionConfig => { | ||
| const {sectionKey} = sectionConfig; | ||
| const sectionLabel = keyToLabel[sectionKey]; | ||
| const sectionData = pageData[sectionKey]; | ||
| const isTableArray = sectionConfig.isTableArray; | ||
| if (!isTableArray) { | ||
| if (sectionLabel && sectionData) { | ||
| sectionConfig.table.data = Object.keys(sectionData).map(key => { | ||
| let obj = ''; | ||
| if (sectionLabel[key]) { | ||
| obj = { | ||
| key, | ||
| label: sectionLabel[key], | ||
| value: sectionData[key] | ||
| }; | ||
| } | ||
| return obj; | ||
| }); | ||
| sectionConfig.table.data = sectionConfig.table.data.filter(item => item); | ||
| } | ||
| } else { | ||
| sectionConfig.table.data = sectionData; | ||
| } | ||
| return sectionConfig; | ||
| }); | ||
| }, | ||
| cancel() { | ||
| this.dialogShow = false; | ||
| }, | ||
| confirm(requestApi) { | ||
| const {api, method} = requestApi; | ||
| const data = {...this.formModel, ...{applyNo: this.$route.query.applyNo}}; | ||
| axios | ||
| .request({ | ||
| method, | ||
| url: api, | ||
| data | ||
| }) | ||
| .then(res => { | ||
| if (+res.errno === 0) { | ||
| this.$Message.success({ | ||
| background: true, | ||
| content: '提交成功' | ||
| }); | ||
| } else { | ||
| this.$Message.error({ | ||
| background: true, | ||
| content: '系统异常' | ||
| }); | ||
| } | ||
| }); | ||
| this.dialogShow = false; | ||
| }, | ||
| resetPageData() { | ||
| this.pageConfig.tableList = this.pageConfig.tableList.map(item => { | ||
| if (item.needClearData) { | ||
| item.table.data = []; | ||
| } | ||
| return item; | ||
| }); | ||
| } | ||
| } | ||
| }; | ||
| </script> | ||
| <style lang="less"> | ||
| .audit-detail-example-demo { | ||
| &-table { | ||
| &-td-img { | ||
| width: 100%; | ||
| } | ||
| } | ||
| &-modal-img { | ||
| width: 100%; | ||
| } | ||
| &-section { | ||
| margin: 30px auto; | ||
| } | ||
| &-header { | ||
| margin-bottom: 10px; | ||
| font-size: 16px; | ||
| } | ||
| &-tool-bar { | ||
| text-align: right; | ||
| padding: 10px | ||
| } | ||
| .ivu-form-item { | ||
| margin-top: 20px | ||
| } | ||
| .ivu-table, .ivu-table-wrapper, .ivu-table-cell { | ||
| overflow: visible; | ||
| } | ||
| .download-wrapper { | ||
| padding: 0 20px; | ||
| } | ||
| &-form { | ||
| .ivu-form-item { | ||
| margin-top: 0px; | ||
| margin-bottom: 0px | ||
| } | ||
| } | ||
| } | ||
| .go-back { | ||
| width: 100%; | ||
| padding-bottom: 20px; | ||
| text-align: right | ||
| } | ||
|
|
||
| </style> | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
可参考的规范