| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8">
- <meta name="viewport"
- content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no" />
- <link rel="stylesheet" href="./resource/vantIndex.css" />
- <link rel="stylesheet" href="./vue-form-making/index.css">
- </head>
- <body>
- <style>
- :root:root {
- --van-nav-bar-background: rgb(21, 122, 44);
- --van-nav-bar-title-text-color: rgb(255, 255, 255);
- --van-nav-bar-icon-color: rgb(255, 255, 255);
- }
- .blank_adopzrdd {
- display: flex;
- align-items: center;
- margin-bottom: 10px;
- }
- .blank_adopzrdd>span {
- display: inline-block;
- width: 80px;
- }
- .seal-form-row {
- display: flex; align-items: center; padding: 10px 16px;
- border-bottom: 1px solid #ebedf0; background: #fff;
- }
- .seal-form-label { width: 100px; font-size: 14px; color: #646566; flex-shrink: 0; }
- .seal-form-val { flex: 1; font-size: 14px; color: #333; text-align: right; }
- .seal-form-arrow { font-size: 20px; color: #c8c9cc; margin-left: 8px; }
- .seal-form-input { flex: 1; border: none; font-size: 14px; text-align: right; outline: none; background: transparent; }
- .seal-card { background: #fff; border-radius: 8px; margin-bottom: 10px; overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
- .seal-card-header { display: flex; align-items: center; padding: 10px 12px; background: #f7f8fa; border-bottom: 1px solid #ebedf0; }
- .seal-card-index { font-size: 14px; font-weight: bold; color: #157A2C; margin-right: 8px; }
- .seal-card-type { flex: 1; font-size: 15px; font-weight: bold; color: #323233; }
- .seal-card-actions { display: flex; gap: 6px; flex-shrink: 0; }
- .seal-card-body { padding: 8px 12px; }
- .seal-card-row { display: flex; padding: 6px 0; font-size: 13px; }
- .seal-card-label { width: 42px; color: #969799; flex-shrink: 0; }
- .seal-card-value { flex: 1; color: #323233; word-break: break-all; }
- :root#app {
- background: #4298fd0d;
- }
- ::v-deep.fm-form-item {
- margin-bottom: 10px !important;
- }
- </style>
- <div id="app">
- <van-nav-bar height='100rpx;margin-top:100rpx' @click-left="onClickLeft"
- style="background-color: rgb(21, 122, 44);color: rgb(255, 255, 255);" :title="title" left-arrow
- :safe-area-inset-top='true' :placeholder='true' :fixed='true'></van-nav-bar>
- <fm-generate-vant-form style='height: 81vh !important;overflow: auto;background: #a3a6ad1c;margin-top:44px'
- v-if='isFlag' :data="jsonData" :value="form.valueJson" ref="generateForm" :edit='isEdit' @on-upload-local="handleUploadLocal">
- <!-- 费用报销 -->
- <template v-slot:blank_adopzrdd="scope">
- <div style="width: 100%;">
- <van-button type="primary" size="small" @click="addNewRow('blank_adopzrdd')"
- style="margin-bottom: 10px">添加报销事项</van-button>
- <div v-for="(item, index) in scope.model.blank_adopzrdd" :key="index" style="width: 100%;">
- <div class="blank_adopzrdd">
- <span>{{ index + 1 }}报销事项:</span>
- <van-field rows="1" v-model="scope.model.blank_adopzrdd[index].remark" type="textarea"
- autosize style="width: calc(100% - 80px)"></van-field>
- </div>
- <div class="blank_adopzrdd">
- <span>
- <!-- <van-icon @click="delNewRow('blank_adopzrdd', index)" name="delete"
- style="color: #f56c6c;"></van-icon> -->
- 金额:</span>
- <van-field v-model="scope.model.blank_adopzrdd[index].price" type="number"
- style="width: calc(100% - 80px)"
- @change="changePrice(scope.model.blank_adopzrdd)"></van-field>
- </div>
- <div class="blank_adopzrdd">
- <span>
- <van-icon @click="delNewRow('blank_adopzrdd', index, true)" name="delete"
- style="color: #f56c6c;"></van-icon>
- 附件:</span>
- <template v-if="item.files && item.files.length">
- <van-badge :content="item.files.length">
- <van-button type="primary" size="mini" @click="handleUploadLocal('blank_adopzrdd', index)">上传附件</van-button>
- </van-badge>
- </template>
- <van-button v-else type="primary" size="mini" @click="handleUploadLocal('blank_adopzrdd', index)">上传附件</van-button>
- </div>
- </div>
- </div>
- </template>
- <template v-slot:manage_workorder="scope">
- <van-field v-model="scope.model.manage_workorder.code" readonly @click="addWorkOrder()"></van-field>
- </template>
- <template v-slot:blank_use_seal="scope">
- <div style="width: 100%;">
- <!-- 列表项 -->
- <view v-for="(item, index) in scope.model.blank_use_seal" :key="index" class="seal-card">
- <div class="seal-card-header">
- <span class="seal-card-index">{{ index + 1 }}.</span>
- <span class="seal-card-type">{{ item.useSealType || '未选择类型' }}</span>
- <div class="seal-card-actions">
- <van-button size="mini" type="primary" plain @click="openSealEditDialog(scope, 'edit', index)">编辑</van-button>
- <van-button size="mini" type="danger" plain @click="delNewRow('blank_use_seal', index)">删除</van-button>
- </div>
- </div>
- <div class="seal-card-body">
- <div class="seal-card-row">
- <span class="seal-card-label">事由</span>
- <span class="seal-card-value">{{ item.useSealRemark || '未填写' }}</span>
- </div>
- <div class="seal-card-row">
- <span class="seal-card-label">印章</span>
- <span class="seal-card-value">{{ item.useSealName || '未选择' }}</span>
- </div>
- </div>
- </view>
- <van-button type="primary" size="small" block @click="openSealEditDialog(scope, 'add', scope.model.blank_use_seal?scope.model.blank_use_seal.length:0)" style="margin-bottom:10px">+ 添加印章使用</van-button>
- </div>
- </template>
- <template v-slot:blank_use_qualification="scope">
- <div style="width: 100%;">
- <view v-for="(item, index) in scope.model.blank_use_qualification" :key="index" class="seal-card">
- <div class="seal-card-header">
- <span class="seal-card-index">{{ index + 1 }}.</span>
- <span class="seal-card-type">{{ item.useQualificationType || '未选择类型' }}</span>
- <div class="seal-card-actions">
- <van-button size="mini" type="primary" plain @click="openQualEditDialog(scope, 'edit', index)">编辑</van-button>
- <van-button size="mini" type="danger" plain @click="delNewRow('blank_use_qualification', index)">删除</van-button>
- </div>
- </div>
- <div class="seal-card-body">
- <div class="seal-card-row">
- <span class="seal-card-label">事由</span>
- <span class="seal-card-value">{{ item.useQualificationRemark || '未填写' }}</span>
- </div>
- <div class="seal-card-row">
- <span class="seal-card-label">名称</span>
- <span class="seal-card-value">{{ item.useQualificationName || '未选择' }}</span>
- </div>
- </div>
- </view>
- <van-button type="primary" size="small" block @click="openQualEditDialog(scope, 'add', scope.model.blank_use_qualification?scope.model.blank_use_qualification.length:0)" style="margin-bottom:10px">+ 添加资质使用</van-button>
- </div>
- </template>
- </fm-generate-vant-form>
- <!-- 印章选择弹窗(根层级,避免被 form overflow 裁剪) -->
- <van-popup v-model:show="sealPopVisible" position="bottom" :style="{ height: '30%' }" teleport="body">
- <van-picker
- show-toolbar
- :title="sealPopType === 'type' ? '印章使用类型' : '印章名称'"
- :columns="sealPopType === 'type' ? useSealTypeList : useSealNameList"
- @confirm="onSealPopConfirm"
- @cancel="sealPopVisible = false"
- />
- </van-popup>
- <!-- 印章编辑弹窗 -->
- <van-popup v-model:show="sealEditVisible" position="bottom" :style="{ height: '55%' }" round>
- <div style="padding:16px">
- <h4 style="text-align:center;margin-bottom:12px">{{ sealEditTitle }}</h4>
- <!-- 印章使用类型 -->
- <div class="seal-form-row" @click="openSealPickerInEdit('type')">
- <span class="seal-form-label">印章使用类型</span>
- <span class="seal-form-val">{{ sealEditForm.useSealType || '请选择' }}</span>
- <span class="seal-form-arrow">›</span>
- </div>
- <!-- 印章使用事由 -->
- <div class="seal-form-row">
- <span class="seal-form-label">印章使用事由</span>
- <input class="seal-form-input" v-model="sealEditForm.useSealRemark" placeholder="请输入" />
- </div>
- <!-- 印章名称 -->
- <div class="seal-form-row" @click="openSealPickerInEdit('name')">
- <span class="seal-form-label">印章名称</span>
- <span class="seal-form-val">{{ sealEditForm.useSealName || '请选择' }}</span>
- <span class="seal-form-arrow">›</span>
- </div>
- <div style="display:flex;justify-content:space-between;padding:20px 0">
- <van-button style="width:48%" @click="sealEditVisible = false">取消</van-button>
- <van-button style="width:48%" type="primary" @click="onSealEditSave">保存</van-button>
- </div>
- </div>
- </van-popup>
- <!-- 资质选择弹窗 -->
- <van-popup v-model:show="qualPopVisible" position="bottom" :style="{ height: '30%' }">
- <van-picker
- show-toolbar
- :title="qualPopType === 'type' ? '资质类型' : '使用资质名称'"
- :columns="qualPopType === 'type' ? useQualificationTypeList : useQualificationNameList"
- @confirm="onQualPopConfirm"
- @cancel="qualPopVisible = false"
- />
- </van-popup>
- <!-- 资质编辑弹窗 -->
- <van-popup v-model:show="qualEditVisible" position="bottom" :style="{ height: '55%' }" round>
- <div style="padding:16px">
- <h4 style="text-align:center;margin-bottom:12px">{{ qualEditTitle }}</h4>
- <div class="seal-form-row" @click="openQualPickerInEdit('type')">
- <span class="seal-form-label">资质类型</span>
- <span class="seal-form-val">{{ qualEditForm.useQualificationType || '请选择' }}</span>
- <span class="seal-form-arrow">›</span>
- </div>
- <div class="seal-form-row">
- <span class="seal-form-label">资质使用事由</span>
- <input class="seal-form-input" v-model="qualEditForm.useQualificationRemark" placeholder="请输入" />
- </div>
- <div class="seal-form-row" @click="openQualPickerInEdit('name')">
- <span class="seal-form-label">使用资质名称</span>
- <span class="seal-form-val">{{ qualEditForm.useQualificationName || '请选择' }}</span>
- <span class="seal-form-arrow">›</span>
- </div>
- <div style="display:flex;justify-content:space-between;padding:20px 0">
- <van-button style="width:48%" @click="qualEditVisible = false">取消</van-button>
- <van-button style="width:48%" type="primary" @click="onQualEditSave">保存</van-button>
- </div>
- </div>
- </van-popup>
- <div>
- <div v-if='isEdit'
- style="display: flex;justify-content: space-between; padding: 30px 30px; position: fixed; bottom: 0; width: 100%; height: 80px;">
- <van-button style="width:48%" type="primary" :loading="loading" @click="handleAudit(1)">提交
- </van-button>
- <van-button style="width:48%" type="danger" :loading="loading" @click="onClickLeft">取消
- </van-button>
- </div>
- </div>
- </div>
- <script src="./resource/vue.global.prod.js"></script>
- <script src="./resource/vant.min.js"></script>
- <script src="./resource/axios.min.js"></script>
- <script src="./resource/uni.webview.js"></script>
- <script src="./vue-form-making/form-making-v3.umd.js"></script>
- <script>
- let EnvObj = {}
- uni.getEnv(function(res) {
- EnvObj = res;
- console.log('当前环境:' + JSON.stringify(res));
- });
- Vue.createApp({
- data() {
- return {
- loading: false,
- isFlag: false,
- isEdit: true,
- title: '',
- jsonData: {},
- editData: {},
- form: {},
- headers: {},
- APIUrl: '',
- type: 'add',
- selectFilesField: null,
- selectFilesRowIndex: null,
- // useSealTypeList: ['杭州', '宁波', '温州', '绍兴', '湖州', '嘉兴', '金华', '衢州'],
- // useSealNameList: ['公章', '合同章', '财务章', '法人章', '发票章', '部门章'],
- sealPopVisible: false, // 印章选择弹窗
- sealPopType: 'type', // 'type' | 'name'
- sealPopScope: null, // 弹窗对应的 scope(编辑模式为空)
- sealPopIndex: null, // 弹窗对应的行索引(编辑模式为当前行)
- sealPopIsEdit: false, // 是否来自编辑弹窗
- sealEditVisible: false, // 印章编辑弹窗
- sealEditTitle: '添加印章使用', // 编辑弹窗标题
- sealEditForm: { useSealType: '', useSealRemark: '', useSealName: '' },
- sealEditMode: 'add', // 'add' | 'edit'
- sealEditScope: null,
- sealEditIndex: null,
- useSealTypeList: [
- {
- value: '加盖',
- text: '加盖'
- },
- {
- value: '借用',
- text: '借用'
- },
- {
- value: '无',
- text: '无'
- },
- ],
- useSealNameList: [
- {
- value: '总公司公章',
- text: '总公司公章'
- },
- {
- value: '合同专用章',
- text: '合同专用章'
- },
- {
- value: '法人章',
- text: '法人章'
- },
- {
- value: '财务专用章',
- text: '财务专用章'
- },
- {
- value: '发票专用章',
- text: '发票专用章'
- },
- {
- value: '质检专用章',
- text: '质检专用章'
- },
- {
- value: '业务专用章',
- text: '业务专用章'
- },
- {
- value: '出库专用章',
- text: '出库专用章'
- },
- {
- value: '无',
- text: '无'
- },
- ],
- // 资质使用
- useQualificationTypeList: [
- { value: '原件', text: '原件' },
- { value: '复印件', text: '复印件' },
- { value: '扫描件', text: '扫描件' },
- { value: '无', text: '无' },
- ],
- useQualificationNameList: [
- { value: '营业执照正本', text: '营业执照正本' },
- { value: '营业执照副本', text: '营业执照副本' },
- { value: '第一类医疗器械生产备案凭证', text: '第一类医疗器械生产备案凭证' },
- { value: '开户许可证', text: '开户许可证' },
- { value: '医疗器械生产许可证', text: '医疗器械生产许可证' },
- { value: '医疗器械生产产品登记表', text: '医疗器械生产产品登记表' },
- { value: '专利证书', text: '专利证书' },
- { value: '二类注册证', text: '二类注册证' },
- { value: '无', text: '无' },
- ],
- qualPopVisible: false,
- qualPopType: 'type',
- qualEditVisible: false,
- qualEditTitle: '添加资质使用',
- qualEditForm: { useQualificationType: '', useQualificationRemark: '', useQualificationName: '' },
- qualEditMode: 'add',
- qualEditScope: null,
- qualEditIndex: null,
- qualPopIsEdit: true,
- }
- },
- created() {
- let _this = this
- window.x_sun = (e) => {
- _this.setSalesServiceWork(JSON.parse(e))
- }
- // 接收文件选择后的回调
- window.x_selectFiles = async (e) => {
- let data = JSON.parse(e)
- console.log('收到选中的文件:', data)
- if (_this.$refs.generateForm) {
- if (_this.selectFilesRowIndex != null && _this.selectFilesField) {
- // 数组行附件:更新 blank_adopzrdd[index].files
- let formData = await _this.$refs.generateForm.getData(false);
- var arr = formData[_this.selectFilesField] || []
- var row = arr[_this.selectFilesRowIndex]
- if (row) {
- row.files = data.files || []
- _this.$refs.generateForm.setData({
- [_this.selectFilesField]: arr
- })
- }
- _this.selectFilesRowIndex = null
- } else {
- // 普通表单字段
- _this.$refs.generateForm.setData({
- [data.field]: data.files
- })
- }
- }
- }
- this.headers = this.getQueryParams('headers');
- let params = this.getQueryParams('params');
- this.isEdit = params.isEdit || true
- this.type = params.type || 'add'
- this.APIUrl = this.headers.serverInfo || 'http://192.168.1.105:18086'
- axios({
- method: 'get',
- url: this.APIUrl + `/flowable/bpmcustomform/getById/${params.id}`,
- headers: this.headers,
- }).then((res) => {
- if (res.data.code != '-1') {
- this.form = res.data.data
- this.form.formId = res.data.data.id
- this.form.id = ''
- this.form.valueJson = {}
- this.title = this.form.name
- this.jsonData = JSON.parse(res.data.data.formJson.makingJson);
- this.jsonData.list.forEach(item => {
- item.options.headers = [{
- key: 'Authorization',
- value: this.headers.Authorization
- }]
- item.options.action = item.options.action && item.options.action.replace(
- '/api', this.APIUrl)
- if (item.type == "deptAndUserCascader") {
- item.type = 'cascader'
- }
- if (item.type == "deptCascader") {
- item.type = 'cascader'
- /* item.isPathValue = false */
- if (item.options.isDefaultLoginUser) {
- /* this.form.valueJson[item.model] = [1,1765997946953797633]; */
- this.form.valueJson[item.model] = params.userInfo.groupIdList;
- }
- }
- if (item.type == "userSelect") {
- item.type = 'select'
- if (item.options.isDefaultLoginUser) {
- this.form.valueJson[item.model] = params.userInfo.userId;
- }
- }
- })
- this.jsonData.config.dataSource && this.jsonData.config.dataSource.forEach(item => {
- item.headers = {
- Authorization: this.headers.Authorization
- }
- item.url = item.url && item.url.replace('/api', this.APIUrl)
- })
- this.isFlag = true
- this.$nextTick(() => {
- if (params.manage_workorder) {
- this.setSalesServiceWork(params.manage_workorder)
- }
- })
- }
- });
- // axios({
- // method: 'get',
- // url: this.APIUrl + `/bpm/task/list-by-process-instance-id?processInstanceId=${params.id}`,
- // headers: this.headers,
- // }).then((res) => {
- // console.log(res)
- // if (res.data.code != '-1') {
- // }
- // });
- },
- methods: {
- // ===== 印章编辑弹窗 =====
- openSealEditDialog(scope, mode, index) {
- this.sealEditVisible = true
- this.sealEditScope = scope
- this.sealEditIndex = index
- this.sealEditMode = mode
- if (mode === 'edit' && scope.model.blank_use_seal[index]) {
- var row = scope.model.blank_use_seal[index]
- this.sealEditForm = { useSealType: row.useSealType||'', useSealRemark: row.useSealRemark||'', useSealName: row.useSealName||'' }
- this.sealEditTitle = '编辑印章使用'
- } else {
- this.sealEditForm = { useSealType: '', useSealRemark: '', useSealName: '' }
- this.sealEditTitle = '添加印章使用'
- }
- },
- async onSealEditSave() {
- var scope = this.sealEditScope
- var idx = this.sealEditIndex
- var key = 'blank_use_seal'
- var data = await this.$refs.generateForm.getData(false);
- if (!data[key]) data[key] = []
- if (this.sealEditMode === 'edit') {
- data[key][idx] = JSON.parse(JSON.stringify(this.sealEditForm))
- } else {
- data[key].push(JSON.parse(JSON.stringify(this.sealEditForm)))
- }
- this.$refs.generateForm.setData({ [key]: data[key] })
- this.sealEditVisible = false
- },
- openSealPickerInEdit(fieldType) {
- this.sealPopType = fieldType
- this.sealPopScope = null
- this.sealPopIndex = null
- this.sealPopIsEdit = true
- this.sealPopVisible = true
- },
- openSealPicker(scope, index, fieldType) {
- this.sealPopScope = scope
- this.sealPopIndex = index
- this.sealPopType = fieldType || 'type'
- this.sealPopIsEdit = false
- this.sealPopVisible = true
- },
- onSealPopConfirm(picker) {
- var sel = (picker && picker.selectedOptions && picker.selectedOptions[0]) ? picker.selectedOptions[0].text : picker
- var field = this.sealPopType === 'name' ? 'useSealName' : 'useSealType'
- if (this.sealPopIsEdit) {
- // 编辑弹窗模式:回写到 sealEditForm
- this.sealEditForm[field] = sel
- } else {
- // 列表内联模式
- var scope = this.sealPopScope
- var idx = this.sealPopIndex
- if (scope && scope.model && scope.model.blank_use_seal && scope.model.blank_use_seal[idx]) {
- scope.model.blank_use_seal[idx][field] = sel
- }
- }
- this.sealPopVisible = false
- },
- // ===== 资质使用 =====
- openQualEditDialog(scope, mode, index) {
- this.qualEditScope = scope
- this.qualEditIndex = index
- this.qualEditMode = mode
- if (mode === 'edit' && scope.model.blank_use_qualification[index]) {
- var r = scope.model.blank_use_qualification[index]
- this.qualEditForm = { useQualificationType: r.useQualificationType||'', useQualificationRemark: r.useQualificationRemark||'', useQualificationName: r.useQualificationName||'' }
- this.qualEditTitle = '编辑资质使用'
- } else {
- this.qualEditForm = { useQualificationType: '', useQualificationRemark: '', useQualificationName: '' }
- this.qualEditTitle = '添加资质使用'
- }
- this.qualEditVisible = true
- },
- async onQualEditSave() {
- var scope = this.qualEditScope
- var idx = this.qualEditIndex
- var key = 'blank_use_qualification'
- var data = await this.$refs.generateForm.getData(false);
- if (!data[key]) data[key] = []
- if (this.qualEditMode === 'edit') {
- data[key][idx] = JSON.parse(JSON.stringify(this.qualEditForm))
- } else {
- data[key].push(JSON.parse(JSON.stringify(this.qualEditForm)))
- }
- this.$refs.generateForm.setData({ [key]: data[key] })
- this.qualEditVisible = false
- },
- openQualPickerInEdit(fieldType) {
- this.qualPopType = fieldType
- this.qualPopIsEdit = true
- this.qualPopVisible = true
- },
- onQualPopConfirm(picker) {
- var sel = (picker && picker.selectedOptions && picker.selectedOptions[0]) ? picker.selectedOptions[0].text : picker
- var field = this.qualPopType === 'name' ? 'useQualificationName' : 'useQualificationType'
- this.qualEditForm[field] = sel
- this.qualPopVisible = false
- },
- async handleUploadLocal (model, rowIndex) {
- console.log('上传本地文件按钮被点击,字段模型:', model, '行索引:', rowIndex)
- let data = await this.$refs.generateForm.getData(false);
- let files = rowIndex != null && data[model] && data[model][rowIndex] ? (data[model][rowIndex].files || []) : (data[model] || [])
- this.selectFilesField = model
- this.selectFilesRowIndex = rowIndex != null ? rowIndex : null
- uni.postMessage({
- data: {
- type: 'selectFiles',
- field: model,
- files: files,
- isEdit: this.type || 'add'
- }
- });
- },
- addWorkOrder() {
- uni.postMessage({
- data: {
- type: 'selectWork',
- }
- });
- },
- async addNewRow(key) {
- console.log(key);
- let data = await this.$refs.generateForm.getData(false);
- data[key].push({
- price: '',
- remark: ''
- });
- this.$refs.generateForm.setData({
- key: data[key]
- });
- },
- async delNewRow(key, index, isChange) {
- let data = await this.$refs.generateForm.getData(false);
- data[key] = data[key].filter((item, index1) => index1 != index);
- this.$refs.generateForm.setData({
- [key]: data[key]
- });
- if (isChange) {
- this.changePrice(data[key])
- }
- },
- changePrice(data) {
- let num = 0;
- data.forEach((item) => {
- num += Number(item.price);
- });
- this.$refs.generateForm.setData({
- input_jd9ouzyh: num
- });
- },
- setSalesServiceWork(data) {
- this.$refs.generateForm.setData({
- manage_workorder: data
- });
- this.$refs.generateForm.setRules('manage_workorder', [{
- required: false,
- message: '必须填写'
- }])
- setTimeout(() => {
- this.$refs.generateForm.validate(['manage_workorder'])
- })
- },
- getQueryParams(queryName) {
- const urlSearchParams = new URLSearchParams(window.location.search);
- const query = urlSearchParams.get(queryName);
- console.log(query, 'query')
- return JSON.parse(query);
- },
- generateFormValid(validate = true) {
- return this.$refs.generateForm.getData(validate).then((data) => { //清空content
- for (key in data) {
- if (key.includes('fileupload')) {
- data[key].forEach(item => {
- item['content'] = ''
- })
- }
- }
- return data;
- });
- },
- async handleAudit(status) {
- this.loading = true;
- try {
- this.form.valueJson = await this.generateFormValid();
- } catch (error) {
- this.loading = false;
- return;
- }
- console.log(this.form.valueJson)
- this.form.processType = '1';
- let API = this.APIUrl + '/bpm/process-instance/create'
- axios({
- method: 'post',
- url: API,
- headers: this.headers,
- data: {
- ...this.form,
- }
- }).then((res) => {
- this.loading = false;
- if (res.data.code != '-1') {
- vant.showNotify({
- type: 'success',
- message: `提交成功!`,
- duration: 1000,
- });
- setTimeout(() => {
- this.onClickLeft()
- }, 1000)
- } else {
- vant.showNotify({
- type: 'danger',
- message: `提交失败!${res.data.message}`,
- duration: 1000,
- });
- }
- }).catch((err) => {
- vant.showNotify({
- type: 'danger',
- message: `提交失败!${err.message}`,
- duration: 1000,
- });
- this.loading = false;
- });
- },
- onClickLeft() {
- uni.navigateBack({
- delta: 1
- });
- }
- }
- }).use(vant).use(FormMakingV3).mount('#app')
- </script>
- </body>
- </html>
|