| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216 |
- <!DOCTYPE html>
- <html lang="zh-CN">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
- <title>确认提交</title>
- <script src="/js/mp_base/base.js"></script>
- <style>
- [v-cloak] {
- display: none !important;
- }
- #app {
- min-height: 100vh;
- background: #f5f5f5;
- box-sizing: border-box;
- }
- .form-wrap {
- background: #fff;
- }
- .table th {
- width: 140px;
- max-width: 170px;
- }
- .desc-editor {
- width: 100%;
- }
- </style>
- </head>
- <body>
- <div id="app" v-cloak>
- <form id="tjform" class="form-wrap" @submit.prevent>
- <table class="table">
- <tr v-if="showPostRow">
- <th>岗位</th>
- <td>
- <!-- 功能说明:岗位下拉使用组件内置 cb 拉取(对齐PC addSure 的 objp.ss cb=bpmtjgwid) by xu 2026-02-28 -->
- <ss-select
- v-model="formData.bpmtjgwid"
- cb="bpmtjgwid"
- :auto-select-first="true"
- placeholder="请选择提交岗位"
- @loaded="handlePostOptionsLoaded"
- >
- </ss-select>
- </td>
- </tr>
- <tr>
- <th>{{ descLabel }}</th>
- <td>
- <!-- 功能说明:addSure 说明区改用 ss-editor(对齐PC editor.ss),提交时仍回写 sqms/sqmswj by xu 2026-02-28 -->
- <ss-editor
- class="desc-editor"
- name="sqmswj"
- :model-value="formData.sqmswj"
- placeholder="请输入说明"
- :height="220"
- @change="handleEditorChange"
- />
- </td>
- </tr>
- </table>
- </form>
- <ss-bottom
- :buttons="bottomButtons"
- @button-click="handleBottomAction"
- >
- </ss-bottom>
- </div>
- <script>
- window.SS.ready(function () {
- window.SS.dom.initializeFormApp({
- el: '#app',
- data() {
- return {
- pageParams: {},
- submitting: false,
- showPostRow: true,
- descLabel: '说明',
- formData: {
- bpmtjgwid: '',
- sqms: '',
- sqmswj: '',
- sqfjid: '',
- },
- bottomButtons: [
- {
- text: '确定',
- action: 'confirm',
- backgroundColor: '#575d6d',
- color: '#fff'
- }
- ]
- }
- },
- mounted() {
- this.pageParams = this.getUrlParams()
- // 功能说明:addSure 说明预填走通用字段优先级(sqms/sqmswj/ms),避免仅适配某个业务 by xu 2026-02-28
- const presetDesc = this.pageParams.sqms || this.pageParams.sqmswj || this.pageParams.ms || ''
- if (presetDesc) {
- this.formData.sqms = String(presetDesc)
- this.formData.sqmswj = String(presetDesc)
- }
- // 功能说明:对齐PC addSure:ssObjName=ws 时标题为“拟办意见”,否则为“说明” by xu 2026-02-28
- this.descLabel = String(this.pageParams.ssObjName || '').trim() === 'ws' ? '拟办意见' : '说明'
- // 功能说明:对齐PC addSure:print 非空时显示打印按钮 by xu 2026-02-28
- if (this.pageParams.print !== undefined && this.pageParams.print !== null && this.pageParams.print !== '') {
- this.bottomButtons = [
- { text: '打印', action: 'print' },
- {
- text: '确定',
- action: 'confirm',
- backgroundColor: '#575d6d',
- color: '#fff'
- }
- ]
- }
- },
- methods: {
- getUrlParams() {
- const params = {}
- const urlSearchParams = new URLSearchParams(window.location.search)
- for (const [key, value] of urlSearchParams) {
- params[key] = decodeURIComponent(value)
- }
- return params
- },
- goBack(refreshParent = false) {
- if (window.NavigationManager && typeof window.NavigationManager.goBack === 'function') {
- window.NavigationManager.goBack({ refreshParent })
- } else {
- window.history.back()
- }
- },
- // 功能说明:对齐PC addSure:岗位下拉无选项时隐藏整行 by xu 2026-02-28
- handlePostOptionsLoaded(options) {
- const arr = Array.isArray(options) ? options : []
- this.showPostRow = arr.length > 0
- },
- // 功能说明:富文本内容同步回 sqms/sqmswj,保持与后端参数兼容 by xu 2026-02-28
- handleEditorChange(content) {
- const text = String(content || '')
- this.formData.sqms = text
- this.formData.sqmswj = text
- },
- handlePrint() {
- try {
- window.print()
- } catch (_) {}
- },
- // 功能说明:移动端 addSure “确定”提交 tjform 对应参数到 sureAdd 接口 by xu 2026-02-28
- async submitTjForm() {
- if (this.submitting) return
- const ssObjName = String(this.pageParams.ssObjName || '').trim()
- const ssObjIdName = String(this.pageParams.ssObjIdName || 'ssObjId').trim()
- const ssObjId = String(this.pageParams.ssObjId || '').trim()
- if (!ssObjName || !ssObjId) {
- if (typeof showToastEffect === 'function') showToastEffect('缺少对象参数,无法确认提交', 2200, 'error')
- return
- }
- this.submitting = true
- try {
- const payload = {
- ssObjName,
- [ssObjIdName]: ssObjId,
- bpmtjgwid: this.formData.bpmtjgwid || '',
- sqms: this.formData.sqms || '',
- sqmswj: this.formData.sqmswj || this.formData.sqms || '',
- sqfjid: this.formData.sqfjid || '',
- }
- const response = await request.post(
- '/service?ssServ=sureAdd',
- payload,
- { loading: true, formData: true }
- )
- console.log('[mp_addSure] sureAdd响应', response)
- if (typeof showToastEffect === 'function') {
- showToastEffect('确认提交成功', 1500, 'success')
- }
- setTimeout(() => this.goBack(true), 600)
- } catch (error) {
- console.error('[mp_addSure] sureAdd提交失败', error)
- if (typeof showToastEffect === 'function') {
- showToastEffect('确认提交失败,请稍后重试', 2200, 'error')
- }
- } finally {
- this.submitting = false
- }
- },
- handleBottomAction(payload) {
- if (!payload || !payload.action) return
- if (payload.action === 'print') {
- this.handlePrint()
- return
- }
- if (payload.action === 'confirm') {
- this.submitTjForm()
- }
- }
- }
- })
- })
- </script>
- </body>
- </html>
|