a.html 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport"
  6. content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no" />
  7. <link rel="stylesheet" href="./resource/vantIndex.css" />
  8. <link rel="stylesheet" href="./vue-form-making/index.css">
  9. </head>
  10. <body>
  11. <style>
  12. :root:root {
  13. --van-nav-bar-background: rgb(21, 122, 44);
  14. --van-nav-bar-title-text-color: rgb(255, 255, 255);
  15. --van-nav-bar-icon-color: rgb(255, 255, 255);
  16. }
  17. .blank_adopzrdd {
  18. display: flex;
  19. align-items: center;
  20. margin-bottom: 10px;
  21. }
  22. .blank_adopzrdd>span {
  23. display: inline-block;
  24. width: 80px;
  25. }
  26. .seal-form-row {
  27. display: flex; align-items: center; padding: 10px 16px;
  28. border-bottom: 1px solid #ebedf0; background: #fff;
  29. }
  30. .seal-form-label { width: 100px; font-size: 14px; color: #646566; flex-shrink: 0; }
  31. .seal-form-val { flex: 1; font-size: 14px; color: #333; text-align: right; }
  32. .seal-form-arrow { font-size: 20px; color: #c8c9cc; margin-left: 8px; }
  33. .seal-form-input { flex: 1; border: none; font-size: 14px; text-align: right; outline: none; background: transparent; }
  34. .seal-card { background: #fff; border-radius: 8px; margin-bottom: 10px; overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
  35. .seal-card-header { display: flex; align-items: center; padding: 10px 12px; background: #f7f8fa; border-bottom: 1px solid #ebedf0; }
  36. .seal-card-index { font-size: 14px; font-weight: bold; color: #157A2C; margin-right: 8px; }
  37. .seal-card-type { flex: 1; font-size: 15px; font-weight: bold; color: #323233; }
  38. .seal-card-actions { display: flex; gap: 6px; flex-shrink: 0; }
  39. .seal-card-body { padding: 8px 12px; }
  40. .seal-card-row { display: flex; padding: 6px 0; font-size: 13px; }
  41. .seal-card-label { width: 42px; color: #969799; flex-shrink: 0; }
  42. .seal-card-value { flex: 1; color: #323233; word-break: break-all; }
  43. :root#app {
  44. background: #4298fd0d;
  45. }
  46. ::v-deep.fm-form-item {
  47. margin-bottom: 10px !important;
  48. }
  49. </style>
  50. <div id="app">
  51. <van-nav-bar height='100rpx;margin-top:100rpx' @click-left="onClickLeft"
  52. style="background-color: rgb(21, 122, 44);color: rgb(255, 255, 255);" :title="title" left-arrow
  53. :safe-area-inset-top='true' :placeholder='true' :fixed='true'></van-nav-bar>
  54. <fm-generate-vant-form style='height: 81vh !important;overflow: auto;background: #a3a6ad1c;margin-top:44px'
  55. v-if='isFlag' :data="jsonData" :value="form.valueJson" ref="generateForm" :edit='isEdit' @on-upload-local="handleUploadLocal">
  56. <!-- 费用报销 -->
  57. <template v-slot:blank_adopzrdd="scope">
  58. <div style="width: 100%;">
  59. <van-button type="primary" size="small" @click="addNewRow('blank_adopzrdd')"
  60. style="margin-bottom: 10px">添加报销事项</van-button>
  61. <div v-for="(item, index) in scope.model.blank_adopzrdd" :key="index" style="width: 100%;">
  62. <div class="blank_adopzrdd">
  63. <span>{{ index + 1 }}报销事项:</span>
  64. <van-field rows="1" v-model="scope.model.blank_adopzrdd[index].remark" type="textarea"
  65. autosize style="width: calc(100% - 80px)"></van-field>
  66. </div>
  67. <div class="blank_adopzrdd">
  68. <span>
  69. <!-- <van-icon @click="delNewRow('blank_adopzrdd', index)" name="delete"
  70. style="color: #f56c6c;"></van-icon> -->
  71. 金额:</span>
  72. <van-field v-model="scope.model.blank_adopzrdd[index].price" type="number"
  73. style="width: calc(100% - 80px)"
  74. @change="changePrice(scope.model.blank_adopzrdd)"></van-field>
  75. </div>
  76. <div class="blank_adopzrdd">
  77. <span>
  78. <van-icon @click="delNewRow('blank_adopzrdd', index, true)" name="delete"
  79. style="color: #f56c6c;"></van-icon>
  80. 附件:</span>
  81. <template v-if="item.files && item.files.length">
  82. <van-badge :content="item.files.length">
  83. <van-button type="primary" size="mini" @click="handleUploadLocal('blank_adopzrdd', index)">上传附件</van-button>
  84. </van-badge>
  85. </template>
  86. <van-button v-else type="primary" size="mini" @click="handleUploadLocal('blank_adopzrdd', index)">上传附件</van-button>
  87. </div>
  88. </div>
  89. </div>
  90. </template>
  91. <template v-slot:manage_workorder="scope">
  92. <van-field v-model="scope.model.manage_workorder.code" readonly @click="addWorkOrder()"></van-field>
  93. </template>
  94. <template v-slot:blank_use_seal="scope">
  95. <div style="width: 100%;">
  96. <!-- 列表项 -->
  97. <view v-for="(item, index) in scope.model.blank_use_seal" :key="index" class="seal-card">
  98. <div class="seal-card-header">
  99. <span class="seal-card-index">{{ index + 1 }}.</span>
  100. <span class="seal-card-type">{{ item.useSealType || '未选择类型' }}</span>
  101. <div class="seal-card-actions">
  102. <van-button size="mini" type="primary" plain @click="openSealEditDialog(scope, 'edit', index)">编辑</van-button>
  103. <van-button size="mini" type="danger" plain @click="delNewRow('blank_use_seal', index)">删除</van-button>
  104. </div>
  105. </div>
  106. <div class="seal-card-body">
  107. <div class="seal-card-row">
  108. <span class="seal-card-label">事由</span>
  109. <span class="seal-card-value">{{ item.useSealRemark || '未填写' }}</span>
  110. </div>
  111. <div class="seal-card-row">
  112. <span class="seal-card-label">印章</span>
  113. <span class="seal-card-value">{{ item.useSealName || '未选择' }}</span>
  114. </div>
  115. </div>
  116. </view>
  117. <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>
  118. </div>
  119. </template>
  120. <template v-slot:blank_use_qualification="scope">
  121. <div style="width: 100%;">
  122. <view v-for="(item, index) in scope.model.blank_use_qualification" :key="index" class="seal-card">
  123. <div class="seal-card-header">
  124. <span class="seal-card-index">{{ index + 1 }}.</span>
  125. <span class="seal-card-type">{{ item.useQualificationType || '未选择类型' }}</span>
  126. <div class="seal-card-actions">
  127. <van-button size="mini" type="primary" plain @click="openQualEditDialog(scope, 'edit', index)">编辑</van-button>
  128. <van-button size="mini" type="danger" plain @click="delNewRow('blank_use_qualification', index)">删除</van-button>
  129. </div>
  130. </div>
  131. <div class="seal-card-body">
  132. <div class="seal-card-row">
  133. <span class="seal-card-label">事由</span>
  134. <span class="seal-card-value">{{ item.useQualificationRemark || '未填写' }}</span>
  135. </div>
  136. <div class="seal-card-row">
  137. <span class="seal-card-label">名称</span>
  138. <span class="seal-card-value">{{ item.useQualificationName || '未选择' }}</span>
  139. </div>
  140. </div>
  141. </view>
  142. <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>
  143. </div>
  144. </template>
  145. </fm-generate-vant-form>
  146. <!-- 印章选择弹窗(根层级,避免被 form overflow 裁剪) -->
  147. <van-popup v-model:show="sealPopVisible" position="bottom" :style="{ height: '30%' }" teleport="body">
  148. <van-picker
  149. show-toolbar
  150. :title="sealPopType === 'type' ? '印章使用类型' : '印章名称'"
  151. :columns="sealPopType === 'type' ? useSealTypeList : useSealNameList"
  152. @confirm="onSealPopConfirm"
  153. @cancel="sealPopVisible = false"
  154. />
  155. </van-popup>
  156. <!-- 印章编辑弹窗 -->
  157. <van-popup v-model:show="sealEditVisible" position="bottom" :style="{ height: '55%' }" round>
  158. <div style="padding:16px">
  159. <h4 style="text-align:center;margin-bottom:12px">{{ sealEditTitle }}</h4>
  160. <!-- 印章使用类型 -->
  161. <div class="seal-form-row" @click="openSealPickerInEdit('type')">
  162. <span class="seal-form-label">印章使用类型</span>
  163. <span class="seal-form-val">{{ sealEditForm.useSealType || '请选择' }}</span>
  164. <span class="seal-form-arrow">›</span>
  165. </div>
  166. <!-- 印章使用事由 -->
  167. <div class="seal-form-row">
  168. <span class="seal-form-label">印章使用事由</span>
  169. <input class="seal-form-input" v-model="sealEditForm.useSealRemark" placeholder="请输入" />
  170. </div>
  171. <!-- 印章名称 -->
  172. <div class="seal-form-row" @click="openSealPickerInEdit('name')">
  173. <span class="seal-form-label">印章名称</span>
  174. <span class="seal-form-val">{{ sealEditForm.useSealName || '请选择' }}</span>
  175. <span class="seal-form-arrow">›</span>
  176. </div>
  177. <div style="display:flex;justify-content:space-between;padding:20px 0">
  178. <van-button style="width:48%" @click="sealEditVisible = false">取消</van-button>
  179. <van-button style="width:48%" type="primary" @click="onSealEditSave">保存</van-button>
  180. </div>
  181. </div>
  182. </van-popup>
  183. <!-- 资质选择弹窗 -->
  184. <van-popup v-model:show="qualPopVisible" position="bottom" :style="{ height: '30%' }">
  185. <van-picker
  186. show-toolbar
  187. :title="qualPopType === 'type' ? '资质类型' : '使用资质名称'"
  188. :columns="qualPopType === 'type' ? useQualificationTypeList : useQualificationNameList"
  189. @confirm="onQualPopConfirm"
  190. @cancel="qualPopVisible = false"
  191. />
  192. </van-popup>
  193. <!-- 资质编辑弹窗 -->
  194. <van-popup v-model:show="qualEditVisible" position="bottom" :style="{ height: '55%' }" round>
  195. <div style="padding:16px">
  196. <h4 style="text-align:center;margin-bottom:12px">{{ qualEditTitle }}</h4>
  197. <div class="seal-form-row" @click="openQualPickerInEdit('type')">
  198. <span class="seal-form-label">资质类型</span>
  199. <span class="seal-form-val">{{ qualEditForm.useQualificationType || '请选择' }}</span>
  200. <span class="seal-form-arrow">›</span>
  201. </div>
  202. <div class="seal-form-row">
  203. <span class="seal-form-label">资质使用事由</span>
  204. <input class="seal-form-input" v-model="qualEditForm.useQualificationRemark" placeholder="请输入" />
  205. </div>
  206. <div class="seal-form-row" @click="openQualPickerInEdit('name')">
  207. <span class="seal-form-label">使用资质名称</span>
  208. <span class="seal-form-val">{{ qualEditForm.useQualificationName || '请选择' }}</span>
  209. <span class="seal-form-arrow">›</span>
  210. </div>
  211. <div style="display:flex;justify-content:space-between;padding:20px 0">
  212. <van-button style="width:48%" @click="qualEditVisible = false">取消</van-button>
  213. <van-button style="width:48%" type="primary" @click="onQualEditSave">保存</van-button>
  214. </div>
  215. </div>
  216. </van-popup>
  217. <div>
  218. <div v-if='isEdit'
  219. style="display: flex;justify-content: space-between; padding: 30px 30px; position: fixed; bottom: 0; width: 100%; height: 80px;">
  220. <van-button style="width:48%" type="primary" :loading="loading" @click="handleAudit(1)">提交
  221. </van-button>
  222. <van-button style="width:48%" type="danger" :loading="loading" @click="onClickLeft">取消
  223. </van-button>
  224. </div>
  225. </div>
  226. </div>
  227. <script src="./resource/vue.global.prod.js"></script>
  228. <script src="./resource/vant.min.js"></script>
  229. <script src="./resource/axios.min.js"></script>
  230. <script src="./resource/uni.webview.js"></script>
  231. <script src="./vue-form-making/form-making-v3.umd.js"></script>
  232. <script>
  233. let EnvObj = {}
  234. uni.getEnv(function(res) {
  235. EnvObj = res;
  236. console.log('当前环境:' + JSON.stringify(res));
  237. });
  238. Vue.createApp({
  239. data() {
  240. return {
  241. loading: false,
  242. isFlag: false,
  243. isEdit: true,
  244. title: '',
  245. jsonData: {},
  246. editData: {},
  247. form: {},
  248. headers: {},
  249. APIUrl: '',
  250. type: 'add',
  251. selectFilesField: null,
  252. selectFilesRowIndex: null,
  253. // useSealTypeList: ['杭州', '宁波', '温州', '绍兴', '湖州', '嘉兴', '金华', '衢州'],
  254. // useSealNameList: ['公章', '合同章', '财务章', '法人章', '发票章', '部门章'],
  255. sealPopVisible: false, // 印章选择弹窗
  256. sealPopType: 'type', // 'type' | 'name'
  257. sealPopScope: null, // 弹窗对应的 scope(编辑模式为空)
  258. sealPopIndex: null, // 弹窗对应的行索引(编辑模式为当前行)
  259. sealPopIsEdit: false, // 是否来自编辑弹窗
  260. sealEditVisible: false, // 印章编辑弹窗
  261. sealEditTitle: '添加印章使用', // 编辑弹窗标题
  262. sealEditForm: { useSealType: '', useSealRemark: '', useSealName: '' },
  263. sealEditMode: 'add', // 'add' | 'edit'
  264. sealEditScope: null,
  265. sealEditIndex: null,
  266. useSealTypeList: [
  267. {
  268. value: '加盖',
  269. text: '加盖'
  270. },
  271. {
  272. value: '借用',
  273. text: '借用'
  274. },
  275. {
  276. value: '无',
  277. text: '无'
  278. },
  279. ],
  280. useSealNameList: [
  281. {
  282. value: '总公司公章',
  283. text: '总公司公章'
  284. },
  285. {
  286. value: '合同专用章',
  287. text: '合同专用章'
  288. },
  289. {
  290. value: '法人章',
  291. text: '法人章'
  292. },
  293. {
  294. value: '财务专用章',
  295. text: '财务专用章'
  296. },
  297. {
  298. value: '发票专用章',
  299. text: '发票专用章'
  300. },
  301. {
  302. value: '质检专用章',
  303. text: '质检专用章'
  304. },
  305. {
  306. value: '业务专用章',
  307. text: '业务专用章'
  308. },
  309. {
  310. value: '出库专用章',
  311. text: '出库专用章'
  312. },
  313. {
  314. value: '无',
  315. text: '无'
  316. },
  317. ],
  318. // 资质使用
  319. useQualificationTypeList: [
  320. { value: '原件', text: '原件' },
  321. { value: '复印件', text: '复印件' },
  322. { value: '扫描件', text: '扫描件' },
  323. { value: '无', text: '无' },
  324. ],
  325. useQualificationNameList: [
  326. { value: '营业执照正本', text: '营业执照正本' },
  327. { value: '营业执照副本', text: '营业执照副本' },
  328. { value: '第一类医疗器械生产备案凭证', text: '第一类医疗器械生产备案凭证' },
  329. { value: '开户许可证', text: '开户许可证' },
  330. { value: '医疗器械生产许可证', text: '医疗器械生产许可证' },
  331. { value: '医疗器械生产产品登记表', text: '医疗器械生产产品登记表' },
  332. { value: '专利证书', text: '专利证书' },
  333. { value: '二类注册证', text: '二类注册证' },
  334. { value: '无', text: '无' },
  335. ],
  336. qualPopVisible: false,
  337. qualPopType: 'type',
  338. qualEditVisible: false,
  339. qualEditTitle: '添加资质使用',
  340. qualEditForm: { useQualificationType: '', useQualificationRemark: '', useQualificationName: '' },
  341. qualEditMode: 'add',
  342. qualEditScope: null,
  343. qualEditIndex: null,
  344. qualPopIsEdit: true,
  345. }
  346. },
  347. created() {
  348. let _this = this
  349. window.x_sun = (e) => {
  350. _this.setSalesServiceWork(JSON.parse(e))
  351. }
  352. // 接收文件选择后的回调
  353. window.x_selectFiles = async (e) => {
  354. let data = JSON.parse(e)
  355. console.log('收到选中的文件:', data)
  356. if (_this.$refs.generateForm) {
  357. if (_this.selectFilesRowIndex != null && _this.selectFilesField) {
  358. // 数组行附件:更新 blank_adopzrdd[index].files
  359. let formData = await _this.$refs.generateForm.getData(false);
  360. var arr = formData[_this.selectFilesField] || []
  361. var row = arr[_this.selectFilesRowIndex]
  362. if (row) {
  363. row.files = data.files || []
  364. _this.$refs.generateForm.setData({
  365. [_this.selectFilesField]: arr
  366. })
  367. }
  368. _this.selectFilesRowIndex = null
  369. } else {
  370. // 普通表单字段
  371. _this.$refs.generateForm.setData({
  372. [data.field]: data.files
  373. })
  374. }
  375. }
  376. }
  377. this.headers = this.getQueryParams('headers');
  378. let params = this.getQueryParams('params');
  379. this.isEdit = params.isEdit || true
  380. this.type = params.type || 'add'
  381. this.APIUrl = this.headers.serverInfo || 'http://192.168.1.105:18086'
  382. axios({
  383. method: 'get',
  384. url: this.APIUrl + `/flowable/bpmcustomform/getById/${params.id}`,
  385. headers: this.headers,
  386. }).then((res) => {
  387. if (res.data.code != '-1') {
  388. this.form = res.data.data
  389. this.form.formId = res.data.data.id
  390. this.form.id = ''
  391. this.form.valueJson = {}
  392. this.title = this.form.name
  393. this.jsonData = JSON.parse(res.data.data.formJson.makingJson);
  394. this.jsonData.list.forEach(item => {
  395. item.options.headers = [{
  396. key: 'Authorization',
  397. value: this.headers.Authorization
  398. }]
  399. item.options.action = item.options.action && item.options.action.replace(
  400. '/api', this.APIUrl)
  401. if (item.type == "deptAndUserCascader") {
  402. item.type = 'cascader'
  403. }
  404. if (item.type == "deptCascader") {
  405. item.type = 'cascader'
  406. /* item.isPathValue = false */
  407. if (item.options.isDefaultLoginUser) {
  408. /* this.form.valueJson[item.model] = [1,1765997946953797633]; */
  409. this.form.valueJson[item.model] = params.userInfo.groupIdList;
  410. }
  411. }
  412. if (item.type == "userSelect") {
  413. item.type = 'select'
  414. if (item.options.isDefaultLoginUser) {
  415. this.form.valueJson[item.model] = params.userInfo.userId;
  416. }
  417. }
  418. })
  419. this.jsonData.config.dataSource && this.jsonData.config.dataSource.forEach(item => {
  420. item.headers = {
  421. Authorization: this.headers.Authorization
  422. }
  423. item.url = item.url && item.url.replace('/api', this.APIUrl)
  424. })
  425. this.isFlag = true
  426. this.$nextTick(() => {
  427. if (params.manage_workorder) {
  428. this.setSalesServiceWork(params.manage_workorder)
  429. }
  430. })
  431. }
  432. });
  433. // axios({
  434. // method: 'get',
  435. // url: this.APIUrl + `/bpm/task/list-by-process-instance-id?processInstanceId=${params.id}`,
  436. // headers: this.headers,
  437. // }).then((res) => {
  438. // console.log(res)
  439. // if (res.data.code != '-1') {
  440. // }
  441. // });
  442. },
  443. methods: {
  444. // ===== 印章编辑弹窗 =====
  445. openSealEditDialog(scope, mode, index) {
  446. this.sealEditVisible = true
  447. this.sealEditScope = scope
  448. this.sealEditIndex = index
  449. this.sealEditMode = mode
  450. if (mode === 'edit' && scope.model.blank_use_seal[index]) {
  451. var row = scope.model.blank_use_seal[index]
  452. this.sealEditForm = { useSealType: row.useSealType||'', useSealRemark: row.useSealRemark||'', useSealName: row.useSealName||'' }
  453. this.sealEditTitle = '编辑印章使用'
  454. } else {
  455. this.sealEditForm = { useSealType: '', useSealRemark: '', useSealName: '' }
  456. this.sealEditTitle = '添加印章使用'
  457. }
  458. },
  459. async onSealEditSave() {
  460. var scope = this.sealEditScope
  461. var idx = this.sealEditIndex
  462. var key = 'blank_use_seal'
  463. var data = await this.$refs.generateForm.getData(false);
  464. if (!data[key]) data[key] = []
  465. if (this.sealEditMode === 'edit') {
  466. data[key][idx] = JSON.parse(JSON.stringify(this.sealEditForm))
  467. } else {
  468. data[key].push(JSON.parse(JSON.stringify(this.sealEditForm)))
  469. }
  470. this.$refs.generateForm.setData({ [key]: data[key] })
  471. this.sealEditVisible = false
  472. },
  473. openSealPickerInEdit(fieldType) {
  474. this.sealPopType = fieldType
  475. this.sealPopScope = null
  476. this.sealPopIndex = null
  477. this.sealPopIsEdit = true
  478. this.sealPopVisible = true
  479. },
  480. openSealPicker(scope, index, fieldType) {
  481. this.sealPopScope = scope
  482. this.sealPopIndex = index
  483. this.sealPopType = fieldType || 'type'
  484. this.sealPopIsEdit = false
  485. this.sealPopVisible = true
  486. },
  487. onSealPopConfirm(picker) {
  488. var sel = (picker && picker.selectedOptions && picker.selectedOptions[0]) ? picker.selectedOptions[0].text : picker
  489. var field = this.sealPopType === 'name' ? 'useSealName' : 'useSealType'
  490. if (this.sealPopIsEdit) {
  491. // 编辑弹窗模式:回写到 sealEditForm
  492. this.sealEditForm[field] = sel
  493. } else {
  494. // 列表内联模式
  495. var scope = this.sealPopScope
  496. var idx = this.sealPopIndex
  497. if (scope && scope.model && scope.model.blank_use_seal && scope.model.blank_use_seal[idx]) {
  498. scope.model.blank_use_seal[idx][field] = sel
  499. }
  500. }
  501. this.sealPopVisible = false
  502. },
  503. // ===== 资质使用 =====
  504. openQualEditDialog(scope, mode, index) {
  505. this.qualEditScope = scope
  506. this.qualEditIndex = index
  507. this.qualEditMode = mode
  508. if (mode === 'edit' && scope.model.blank_use_qualification[index]) {
  509. var r = scope.model.blank_use_qualification[index]
  510. this.qualEditForm = { useQualificationType: r.useQualificationType||'', useQualificationRemark: r.useQualificationRemark||'', useQualificationName: r.useQualificationName||'' }
  511. this.qualEditTitle = '编辑资质使用'
  512. } else {
  513. this.qualEditForm = { useQualificationType: '', useQualificationRemark: '', useQualificationName: '' }
  514. this.qualEditTitle = '添加资质使用'
  515. }
  516. this.qualEditVisible = true
  517. },
  518. async onQualEditSave() {
  519. var scope = this.qualEditScope
  520. var idx = this.qualEditIndex
  521. var key = 'blank_use_qualification'
  522. var data = await this.$refs.generateForm.getData(false);
  523. if (!data[key]) data[key] = []
  524. if (this.qualEditMode === 'edit') {
  525. data[key][idx] = JSON.parse(JSON.stringify(this.qualEditForm))
  526. } else {
  527. data[key].push(JSON.parse(JSON.stringify(this.qualEditForm)))
  528. }
  529. this.$refs.generateForm.setData({ [key]: data[key] })
  530. this.qualEditVisible = false
  531. },
  532. openQualPickerInEdit(fieldType) {
  533. this.qualPopType = fieldType
  534. this.qualPopIsEdit = true
  535. this.qualPopVisible = true
  536. },
  537. onQualPopConfirm(picker) {
  538. var sel = (picker && picker.selectedOptions && picker.selectedOptions[0]) ? picker.selectedOptions[0].text : picker
  539. var field = this.qualPopType === 'name' ? 'useQualificationName' : 'useQualificationType'
  540. this.qualEditForm[field] = sel
  541. this.qualPopVisible = false
  542. },
  543. async handleUploadLocal (model, rowIndex) {
  544. console.log('上传本地文件按钮被点击,字段模型:', model, '行索引:', rowIndex)
  545. let data = await this.$refs.generateForm.getData(false);
  546. let files = rowIndex != null && data[model] && data[model][rowIndex] ? (data[model][rowIndex].files || []) : (data[model] || [])
  547. this.selectFilesField = model
  548. this.selectFilesRowIndex = rowIndex != null ? rowIndex : null
  549. uni.postMessage({
  550. data: {
  551. type: 'selectFiles',
  552. field: model,
  553. files: files,
  554. isEdit: this.type || 'add'
  555. }
  556. });
  557. },
  558. addWorkOrder() {
  559. uni.postMessage({
  560. data: {
  561. type: 'selectWork',
  562. }
  563. });
  564. },
  565. async addNewRow(key) {
  566. console.log(key);
  567. let data = await this.$refs.generateForm.getData(false);
  568. data[key].push({
  569. price: '',
  570. remark: ''
  571. });
  572. this.$refs.generateForm.setData({
  573. key: data[key]
  574. });
  575. },
  576. async delNewRow(key, index, isChange) {
  577. let data = await this.$refs.generateForm.getData(false);
  578. data[key] = data[key].filter((item, index1) => index1 != index);
  579. this.$refs.generateForm.setData({
  580. [key]: data[key]
  581. });
  582. if (isChange) {
  583. this.changePrice(data[key])
  584. }
  585. },
  586. changePrice(data) {
  587. let num = 0;
  588. data.forEach((item) => {
  589. num += Number(item.price);
  590. });
  591. this.$refs.generateForm.setData({
  592. input_jd9ouzyh: num
  593. });
  594. },
  595. setSalesServiceWork(data) {
  596. this.$refs.generateForm.setData({
  597. manage_workorder: data
  598. });
  599. this.$refs.generateForm.setRules('manage_workorder', [{
  600. required: false,
  601. message: '必须填写'
  602. }])
  603. setTimeout(() => {
  604. this.$refs.generateForm.validate(['manage_workorder'])
  605. })
  606. },
  607. getQueryParams(queryName) {
  608. const urlSearchParams = new URLSearchParams(window.location.search);
  609. const query = urlSearchParams.get(queryName);
  610. console.log(query, 'query')
  611. return JSON.parse(query);
  612. },
  613. generateFormValid(validate = true) {
  614. return this.$refs.generateForm.getData(validate).then((data) => { //清空content
  615. for (key in data) {
  616. if (key.includes('fileupload')) {
  617. data[key].forEach(item => {
  618. item['content'] = ''
  619. })
  620. }
  621. }
  622. return data;
  623. });
  624. },
  625. async handleAudit(status) {
  626. this.loading = true;
  627. try {
  628. this.form.valueJson = await this.generateFormValid();
  629. } catch (error) {
  630. this.loading = false;
  631. return;
  632. }
  633. console.log(this.form.valueJson)
  634. this.form.processType = '1';
  635. let API = this.APIUrl + '/bpm/process-instance/create'
  636. axios({
  637. method: 'post',
  638. url: API,
  639. headers: this.headers,
  640. data: {
  641. ...this.form,
  642. }
  643. }).then((res) => {
  644. this.loading = false;
  645. if (res.data.code != '-1') {
  646. vant.showNotify({
  647. type: 'success',
  648. message: `提交成功!`,
  649. duration: 1000,
  650. });
  651. setTimeout(() => {
  652. this.onClickLeft()
  653. }, 1000)
  654. } else {
  655. vant.showNotify({
  656. type: 'danger',
  657. message: `提交失败!${res.data.message}`,
  658. duration: 1000,
  659. });
  660. }
  661. }).catch((err) => {
  662. vant.showNotify({
  663. type: 'danger',
  664. message: `提交失败!${err.message}`,
  665. duration: 1000,
  666. });
  667. this.loading = false;
  668. });
  669. },
  670. onClickLeft() {
  671. uni.navigateBack({
  672. delta: 1
  673. });
  674. }
  675. }
  676. }).use(vant).use(FormMakingV3).mount('#app')
  677. </script>
  678. </body>
  679. </html>