| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010 |
- <!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>
- <template v-slot:blank_application_component="scope">
- <div style="width: 100%;">
- <view v-for="(item, index) in scope.model.blank_application_component" :key="index" class="seal-card">
- <div class="seal-card-header">
- <span class="seal-card-index">{{ index + 1 }}.</span>
- <span class="seal-card-type">{{ item.productName || '未选择产品' }}</span>
- <div class="seal-card-actions">
- <van-button size="mini" type="primary" plain @click="openAppEditDialog(scope, 'edit', index)">编辑</van-button>
- <van-button size="mini" type="danger" plain @click="delNewRow('blank_application_component', 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.quantity || '未填写' }}</span>
- </div>
- <div class="seal-card-row">
- <span class="seal-card-label">规格</span>
- <span class="seal-card-value">{{ item.specification || '未填写' }}</span>
- </div>
- </div>
- </view>
- <van-button type="primary" size="small" block @click="openAppEditDialog(scope, 'add', scope.model.blank_application_component?scope.model.blank_application_component.length:0)" style="margin-bottom:10px">+ 添加产品</van-button>
- </div>
- </template>
- <template v-slot:blank_business_trip="scope">
- <div style="width: 100%;">
- <view v-for="(item, index) in scope.model.blank_business_trip" :key="index" class="seal-card">
- <div class="seal-card-header">
- <span class="seal-card-index">{{ index + 1 }}.</span>
- <span class="seal-card-type">{{ item.transportation || '未知交通' }} {{ item.departureCity || '?' }}→{{ item.destinationCity || '?' }}</span>
- <div class="seal-card-actions">
- <van-button size="mini" type="primary" plain @click="openTripEditDialog(scope, 'edit', index)">编辑</van-button>
- <van-button size="mini" type="danger" plain @click="delNewRow('blank_business_trip', index);calcTripTotal(scope)">删除</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.isRoundTrip || '未填写' }}</span>
- </div>
- <div class="seal-card-row">
- <span class="seal-card-label">时间</span>
- <span class="seal-card-value">{{ item.startTime || '-' }} ~ {{ item.endTime || '-' }}</span>
- </div>
- <div class="seal-card-row">
- <span class="seal-card-label">时长</span>
- <span class="seal-card-value">{{ item.duration || '-' }}</span>
- </div>
- </div>
- </view>
- <van-button type="primary" size="small" block @click="openTripEditDialog(scope, 'add', scope.model.blank_business_trip?scope.model.blank_business_trip.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>
- <!-- 产品选择弹窗 -->
- <van-popup v-model:show="appPopVisible" position="bottom" :style="{ height: '45%' }">
- <van-picker
- show-toolbar
- title="选择产品名称"
- :columns="productNameList"
- @confirm="onAppPopConfirm"
- @cancel="appPopVisible = false"
- />
- </van-popup>
- <!-- 产品编辑弹窗 -->
- <van-popup v-model:show="appEditVisible" position="bottom" :style="{ height: '55%' }" round>
- <div style="padding:16px">
- <h4 style="text-align:center;margin-bottom:12px">{{ appEditTitle }}</h4>
- <div class="seal-form-row" @click="openAppPickerInEdit">
- <span class="seal-form-label">产品名称</span>
- <span class="seal-form-val">{{ appEditForm.productName || '请选择' }}</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="appEditForm.quantity" type="number" placeholder="请输入" />
- </div>
- <div class="seal-form-row">
- <span class="seal-form-label">规格型号</span>
- <input class="seal-form-input" v-model="appEditForm.specification" placeholder="请输入" />
- </div>
- <div style="display:flex;justify-content:space-between;padding:20px 0">
- <van-button style="width:48%" @click="appEditVisible = false">取消</van-button>
- <van-button style="width:48%" type="primary" @click="onAppEditSave">保存</van-button>
- </div>
- </div>
- </van-popup>
- <!-- 行程编辑弹窗 -->
- <van-popup v-model:show="tripEditVisible" position="bottom" :style="{ height: '70%' }" round>
- <div style="padding:16px">
- <h4 style="text-align:center;margin-bottom:12px">{{ tripEditTitle }}</h4>
- <div class="seal-form-row">
- <span class="seal-form-label">交通工具</span>
- <input class="seal-form-input" v-model="tripEditForm.transportation" placeholder="飞机/高铁/汽车" />
- </div>
- <div class="seal-form-row">
- <span class="seal-form-label">单程往返</span>
- <input class="seal-form-input" v-model="tripEditForm.isRoundTrip" placeholder="单程/往返" />
- </div>
- <div class="seal-form-row">
- <span class="seal-form-label">出发城市</span>
- <input class="seal-form-input" v-model="tripEditForm.departureCity" placeholder="请输入" />
- </div>
- <div class="seal-form-row">
- <span class="seal-form-label">目的城市</span>
- <input class="seal-form-input" v-model="tripEditForm.destinationCity" placeholder="请输入" />
- </div>
- <div class="seal-form-row">
- <span class="seal-form-label">开始时间</span>
- <input class="seal-form-input" type="datetime-local" v-model="tripEditForm.startTime" @change="calcTripDuration" />
- </div>
- <div class="seal-form-row">
- <span class="seal-form-label">结束时间</span>
- <input class="seal-form-input" type="datetime-local" v-model="tripEditForm.endTime" @change="calcTripDuration" />
- </div>
- <div class="seal-form-row">
- <span class="seal-form-label">时长</span>
- <span class="seal-form-val">{{ tripEditForm.duration || '自动计算' }}</span>
- </div>
- <div style="display:flex;justify-content:space-between;padding:20px 0">
- <van-button style="width:48%" @click="tripEditVisible = false">取消</van-button>
- <van-button style="width:48%" type="primary" @click="onTripEditSave">保存</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,
- // 产品申请
- productNameList: [
- { value: '一次性使用刀头', text: '一次性使用刀头' },
- { value: '一次性使用多功能引流管', text: '一次性使用多功能引流管' },
- { value: '强光手电筒+变径接头', text: '强光手电筒+变径接头' },
- { value: '手电筒充电器', text: '手电筒充电器' },
- { value: '医用冷敷贴疼痛型', text: '医用冷敷贴疼痛型' },
- { value: '医用冷敷凝胶防脱育发型', text: '医用冷敷凝胶防脱育发型' },
- { value: '医用冷敷凝胶痔疮型', text: '医用冷敷凝胶痔疮型' },
- { value: '医用冷敷凝胶皮肤瘙痒型', text: '医用冷敷凝胶皮肤瘙痒型' },
- { value: '医用透明质酸钠修复贴', text: '医用透明质酸钠修复贴' },
- { value: '一次性射频等离子手术电极', text: '一次性射频等离子手术电极' },
- { value: '一次性冲冼吸引器', text: '一次性冲冼吸引器' },
- { value: '一次性使用胃管', text: '一次性使用胃管' },
- { value: '笔记本套装', text: '笔记本套装' },
- ],
- appPopVisible: false,
- appEditVisible: false,
- appEditTitle: '添加产品',
- appEditForm: { productName: '', quantity: '', specification: '' },
- appEditMode: 'add',
- appEditScope: null,
- appEditIndex: null,
- // 行程出差
- tripEditVisible: false,
- tripEditTitle: '添加行程',
- tripEditForm: { transportation: '', isRoundTrip: '', departureCity: '', destinationCity: '', startTime: '', endTime: '', duration: '' },
- tripEditMode: 'add',
- tripEditScope: null,
- tripEditIndex: null,
- }
- },
- 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
- },
- // ===== 产品申请 =====
- openAppEditDialog(scope, mode, index) {
- this.appEditScope = scope
- this.appEditIndex = index
- this.appEditMode = mode
- if (mode === 'edit' && scope.model.blank_application_component[index]) {
- var r = scope.model.blank_application_component[index]
- this.appEditForm = { productName: r.productName||'', quantity: r.quantity||'', specification: r.specification||'' }
- this.appEditTitle = '编辑产品'
- } else {
- this.appEditForm = { productName: '', quantity: '', specification: '' }
- this.appEditTitle = '添加产品'
- }
- this.appEditVisible = true
- },
- async onAppEditSave() {
- var scope = this.appEditScope
- var idx = this.appEditIndex
- var key = 'blank_application_component'
- var data = await this.$refs.generateForm.getData(false);
- if (!data[key]) data[key] = []
- if (this.appEditMode === 'edit') {
- data[key][idx] = JSON.parse(JSON.stringify(this.appEditForm))
- } else {
- data[key].push(JSON.parse(JSON.stringify(this.appEditForm)))
- }
- this.$refs.generateForm.setData({ [key]: data[key] })
- this.appEditVisible = false
- },
- openAppPickerInEdit() {
- this.appPopVisible = true
- },
- onAppPopConfirm(picker) {
- var sel = (picker && picker.selectedOptions && picker.selectedOptions[0]) ? picker.selectedOptions[0].text : picker
- this.appEditForm.productName = sel
- this.appPopVisible = false
- },
- // ===== 行程出差 =====
- openTripEditDialog(scope, mode, index) {
- this.tripEditScope = scope
- this.tripEditIndex = index
- this.tripEditMode = mode
- if (mode === 'edit' && scope.model.blank_business_trip[index]) {
- var r = scope.model.blank_business_trip[index]
- this.tripEditForm = {
- transportation: r.transportation||'', isRoundTrip: r.isRoundTrip||'',
- departureCity: r.departureCity||'', destinationCity: r.destinationCity||'',
- startTime: r.startTime||'', endTime: r.endTime||'', duration: r.duration||''
- }
- this.tripEditTitle = '编辑行程'
- } else {
- this.tripEditForm = { transportation: '', isRoundTrip: '', departureCity: '', destinationCity: '', startTime: '', endTime: '', duration: '' }
- this.tripEditTitle = '添加行程'
- }
- this.tripEditVisible = true
- },
- calcTripDuration() {
- var s = this.tripEditForm.startTime, e = this.tripEditForm.endTime
- if (!s || !e) { this.tripEditForm.duration = ''; return }
- var ds = new Date(s).getTime(), de = new Date(e).getTime()
- if (isNaN(ds) || isNaN(de) || de <= ds) { this.tripEditForm.duration = ''; return }
- var diff = Math.floor((de - ds) / 1000)
- var d = Math.floor(diff / 86400), h = Math.floor((diff % 86400) / 3600), m = Math.floor((diff % 3600) / 60), sec = diff % 60
- var parts = []
- if (d) parts.push(d + '天'); if (h) parts.push(h + '时'); if (m) parts.push(m + '分'); if (sec || !parts.length) parts.push(sec + '秒')
- this.tripEditForm.duration = parts.join('')
- },
- async onTripEditSave() {
- var scope = this.tripEditScope
- var idx = this.tripEditIndex
- var key = 'blank_business_trip'
- var data = await this.$refs.generateForm.getData(false);
- if (!data[key]) data[key] = []
- if (this.tripEditMode === 'edit') {
- data[key][idx] = JSON.parse(JSON.stringify(this.tripEditForm))
- } else {
- data[key].push(JSON.parse(JSON.stringify(this.tripEditForm)))
- }
- this.$refs.generateForm.setData({ [key]: data[key] })
- this.tripEditVisible = false
- this.calcTripTotal(scope)
- },
- calcTripTotal(scope) {
- var list = scope.model.blank_business_trip || []
- var totalSec = 0
- list.forEach(function(it) {
- var d = it.duration
- if (!d) return
- var match = { days: d.match(/(\d+)天/), hours: d.match(/(\d+)时/), minutes: d.match(/(\d+)分/), seconds: d.match(/(\d+)秒/) }
- totalSec += (parseInt(match.days&&match.days[1])||0)*86400 + (parseInt(match.hours&&match.hours[1])||0)*3600 + (parseInt(match.minutes&&match.minutes[1])||0)*60 + (parseInt(match.seconds&&match.seconds[1])||0)
- })
- if (totalSec > 0) {
- var dy = Math.floor(totalSec/86400), hr = Math.floor((totalSec%86400)/3600), mn = Math.floor((totalSec%3600)/60), sc = totalSec%60
- var parts = []
- if (dy) parts.push(dy+'天'); if (hr) parts.push(hr+'时'); if (mn) parts.push(mn+'分'); if (sc||!parts.length) parts.push(sc+'秒')
- this.$refs.generateForm.setData({ input_if1cav3p: parts.join('') })
- }
- },
- 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>
|