InsuranceContractForm.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473
  1. <template>
  2. <div>
  3. <zj-form-container v-if="formDialog" ref="formRef" :form-data="formData" :form-attributes="{ size: 'mini' }">
  4. <zj-form-module
  5. v-if="formData.pgOrderBase"
  6. title="工单信息"
  7. label-width="110px"
  8. :formData="formData.pgOrderBase"
  9. :formItems="formItems"
  10. :column="3"
  11. >
  12. </zj-form-module>
  13. <zj-form-module title="申请信息" label-width="110px" :formData="formData" :formItems="formItems2" :column="3">
  14. </zj-form-module>
  15. <template
  16. v-if="[3].includes(type) && formData.workerInvolveApplyItems && formData.workerInvolveApplyItems.length"
  17. >
  18. <template v-for="(item, index) in formData.workerInvolveApplyItems">
  19. <zj-form-module
  20. :key="`${index}1`"
  21. :title="`网点审核`"
  22. label-width="100px"
  23. :form-data="item"
  24. :form-items="formItems3"
  25. :column="3"
  26. >
  27. </zj-form-module>
  28. <zj-form-module
  29. v-if="!!item.status"
  30. :key="`${index}2`"
  31. :title="`中心审核`"
  32. label-width="100px"
  33. :form-data="item"
  34. :form-items="formItems4"
  35. :column="3"
  36. >
  37. </zj-form-module>
  38. </template>
  39. </template>
  40. </zj-form-container>
  41. <zj-form-container
  42. v-if="formDialog && [1, 2].includes(type)"
  43. ref="formRef1"
  44. :form-data="formData1"
  45. :form-attributes="{ size: 'mini' }"
  46. :styleSwitch="false"
  47. >
  48. <zj-form-module title="网点审核" label-width="100px" :form-data="formData1" :form-items="formItems3" :column="3">
  49. </zj-form-module>
  50. </zj-form-container>
  51. <zj-form-container
  52. v-if="formDialog && [2].includes(type)"
  53. ref="formRef2"
  54. :form-data="formData2"
  55. :form-attributes="{ size: 'mini' }"
  56. :styleSwitch="false"
  57. >
  58. <zj-form-module title="中心审核" label-width="100px" :form-data="formData2" :form-items="formItems4" :column="3">
  59. </zj-form-module>
  60. </zj-form-container>
  61. <div v-if="[0, 1, 2].includes(type)" style="text-align: right">
  62. <el-button
  63. size="mini"
  64. @click="
  65. () => {
  66. $emit('success')
  67. }
  68. "
  69. >
  70. 取消
  71. </el-button>
  72. <el-button v-if="type == 1" size="mini" type="primary" @click="networkAudit">网点审批</el-button>
  73. <el-button v-if="type == 2" size="mini" type="primary" @click="centralAudit">中心审批</el-button>
  74. </div>
  75. </div>
  76. </template>
  77. <script>
  78. import { workerApplyDetail, workerApplyWebsitAppeal, workerApplyAppeal } from '@/api/difficultyExpenseApproval.js'
  79. import { required } from '@/components/template/rules_verify.js'
  80. import ImageUpload from '@/components/file-upload'
  81. export default {
  82. components: { ImageUpload },
  83. props: {
  84. type: {
  85. type: Number,
  86. default: null
  87. },
  88. item: {
  89. type: Object,
  90. default: null
  91. }
  92. },
  93. data() {
  94. return {
  95. formDialog: false,
  96. formData: {
  97. applyWorkerName: '',
  98. applyWorkerNumber: '',
  99. applyWorkerPhone: '',
  100. auditTime: '',
  101. companyWechatId: '',
  102. companyWechatName: '',
  103. createBy: '',
  104. createTime: '',
  105. id: '',
  106. image: [],
  107. maintenancePricePass: '',
  108. orderBaseId: '',
  109. pgOrderBase: {},
  110. principal: '',
  111. problemDescription: '',
  112. reason: '',
  113. remark: '',
  114. status: '',
  115. updateBy: '',
  116. updateTime: '',
  117. userId: '',
  118. websitAuditTime: '',
  119. websitCustomerCharges: '',
  120. websitId: '',
  121. websitMaintenancePricePass: '',
  122. websitName: '',
  123. websitPrincipal: '',
  124. websitRemark: '',
  125. workerInvolveApplyItems: []
  126. },
  127. formData1: {
  128. auditTime: '',
  129. involveApplyId: '',
  130. maintenancePricePass: '',
  131. principal: '',
  132. remark: '',
  133. status: '',
  134. websitAuditTime: '',
  135. websitCustomerCharges: '',
  136. websitMaintenancePricePass: '',
  137. websitPrincipal: '',
  138. websitRemark: '',
  139. websitStatus: ''
  140. },
  141. formData2: {
  142. auditTime: '',
  143. maintenancePricePass: '',
  144. principal: '',
  145. remark: '',
  146. status: ''
  147. },
  148. formRules: {}
  149. }
  150. },
  151. computed: {
  152. formItems() {
  153. return [
  154. {
  155. md: 6,
  156. name: 'el-input',
  157. attributes: { disabled: true },
  158. formItemAttributes: { label: '工单单号', prop: 'id' }
  159. },
  160. {
  161. md: 6,
  162. name: 'el-input',
  163. attributes: { disabled: true },
  164. formItemAttributes: { label: '工单类型', prop: 'orderSmallTypeText' }
  165. },
  166. {
  167. md: 6,
  168. name: 'el-input',
  169. attributes: { disabled: true },
  170. formItemAttributes: { label: '客户姓名', prop: 'userName' }
  171. },
  172. {
  173. md: 6,
  174. name: 'el-input',
  175. attributes: { disabled: true },
  176. formItemAttributes: { label: '客户电话', prop: 'userMobile' }
  177. },
  178. {
  179. md: 12,
  180. name: 'el-input',
  181. attributes: { disabled: true },
  182. formItemAttributes: { label: '客户地址', prop: 'address' }
  183. },
  184. {
  185. md: 6,
  186. name: 'el-input',
  187. attributes: { disabled: true },
  188. formItemAttributes: { label: '主要工程师', prop: 'workerName' }
  189. },
  190. {
  191. md: 6,
  192. name: 'el-input',
  193. attributes: { disabled: true },
  194. formItemAttributes: { label: '完工时间', prop: 'overTime' }
  195. }
  196. ]
  197. },
  198. formItems2() {
  199. return [
  200. {
  201. name: 'slot-component',
  202. md: 12,
  203. attributes: { disabled: true },
  204. formItemAttributes: { label: '所属网点', prop: 'websitName' },
  205. render: (h, { props, onInput }) => {
  206. var { formData } = props
  207. return (
  208. <el-input
  209. value={`(${formData.websitId || ''})${formData.websitName || ''}`}
  210. disabled={true}
  211. size="mini"
  212. placeholder=""
  213. ></el-input>
  214. )
  215. }
  216. },
  217. {
  218. md: 6,
  219. name: 'el-input',
  220. attributes: { disabled: true },
  221. formItemAttributes: { label: '申请人', prop: 'applyWorkerName' }
  222. },
  223. {
  224. md: 6,
  225. name: 'el-input',
  226. attributes: { disabled: true },
  227. formItemAttributes: { label: '申请时间', prop: 'createTime' }
  228. },
  229. {
  230. name: 'el-input',
  231. md: 24,
  232. attributes: {
  233. disabled: [2, 3].includes(this.type),
  234. type: 'textarea',
  235. rows: 3,
  236. placeholder: '请输入'
  237. },
  238. formItemAttributes: {
  239. label: '申请理由',
  240. prop: 'reason',
  241. rules: [...required]
  242. }
  243. },
  244. {
  245. name: 'el-input',
  246. md: 24,
  247. attributes: {
  248. disabled: [2, 3].includes(this.type),
  249. type: 'textarea',
  250. rows: 3,
  251. placeholder: '请输入'
  252. },
  253. formItemAttributes: {
  254. label: '问题描述',
  255. prop: 'problemDescription',
  256. rules: [...required]
  257. }
  258. },
  259. {
  260. md: 24,
  261. isShow: true,
  262. name: 'slot-component',
  263. formItemAttributes: {
  264. label: '环境照片',
  265. prop: 'image',
  266. rules: [...required]
  267. },
  268. render: (h, { props, onInput }) => {
  269. return (
  270. <div>
  271. <ImageUpload fileList={this.formData.image} limit={100} isEdit={[0, 1].includes(this.type)} />
  272. <div style="color:orange">可以上传最多15个文件,图片或者视频</div>
  273. </div>
  274. )
  275. }
  276. }
  277. ]
  278. },
  279. formItems3() {
  280. return [
  281. {
  282. md: 12,
  283. name: 'el-radio',
  284. options: [
  285. { label: '通过审核', value: 3 },
  286. { label: '驳回可重申', value: 2 },
  287. { label: '驳回不可申诉', value: 4 }
  288. ],
  289. attributes: {
  290. disabled: [2, 3].includes(this.type)
  291. },
  292. formItemAttributes: {
  293. label: '网点审批',
  294. prop: 'websitStatus',
  295. rules: [...required]
  296. }
  297. },
  298. {
  299. md: 6,
  300. name: 'el-input',
  301. attributes: { disabled: [2, 3].includes(this.type), type: 'number' },
  302. formItemAttributes: { label: '申请费用', prop: 'websitMaintenancePricePass', rules: [...required] }
  303. },
  304. {
  305. md: 6,
  306. name: 'el-radio',
  307. options: [
  308. { label: '是', value: 1 },
  309. { label: '否', value: 2 }
  310. ],
  311. attributes: {
  312. disabled: [2, 3].includes(this.type)
  313. },
  314. formItemAttributes: {
  315. 'label-width': '120px',
  316. label: '是否向客户收费',
  317. prop: 'websitCustomerCharges',
  318. rules: [...required]
  319. }
  320. },
  321. {
  322. md: 6,
  323. name: 'el-input',
  324. attributes: { disabled: true },
  325. formItemAttributes: { label: '网点审核人', prop: 'websitPrincipal' }
  326. },
  327. {
  328. md: 6,
  329. name: 'el-input',
  330. attributes: { disabled: true },
  331. formItemAttributes: { label: '网点审核时间', prop: 'websitAuditTime' }
  332. },
  333. {
  334. name: 'el-input',
  335. md: 24,
  336. attributes: {
  337. disabled: [2, 3].includes(this.type),
  338. type: 'textarea',
  339. rows: 3,
  340. placeholder: '请输入'
  341. },
  342. formItemAttributes: {
  343. label: '审核备注',
  344. prop: 'websitRemark',
  345. rules: [...required]
  346. }
  347. }
  348. ]
  349. },
  350. formItems4() {
  351. return [
  352. {
  353. md: 12,
  354. name: 'el-radio',
  355. options: [
  356. { label: '通过审核', value: 5 },
  357. { label: '驳回可重申', value: 2 },
  358. { label: '驳回不可申诉', value: 4 }
  359. ],
  360. attributes: {
  361. disabled: [3].includes(this.type)
  362. },
  363. formItemAttributes: {
  364. label: '中心审批',
  365. prop: 'status',
  366. rules: [...required]
  367. }
  368. },
  369. {
  370. md: 6,
  371. name: 'el-input',
  372. attributes: { disabled: true },
  373. formItemAttributes: { label: '中心审核人', prop: 'principal' }
  374. },
  375. {
  376. md: 6,
  377. name: 'el-input',
  378. attributes: { disabled: true },
  379. formItemAttributes: { label: '中心审核时间', prop: 'auditTime' }
  380. },
  381. {
  382. md: 6,
  383. name: 'el-input',
  384. attributes: {
  385. disabled: [3].includes(this.type),
  386. type: 'number'
  387. },
  388. formItemAttributes: {
  389. label: '审批费用',
  390. prop: 'maintenancePricePass',
  391. rules: [...required]
  392. }
  393. },
  394. {
  395. name: 'el-input',
  396. md: 24,
  397. attributes: {
  398. disabled: [3].includes(this.type),
  399. type: 'textarea',
  400. rows: 3,
  401. placeholder: '请输入'
  402. },
  403. formItemAttributes: {
  404. label: '审核备注',
  405. prop: 'remark',
  406. rules: [...required]
  407. }
  408. }
  409. ]
  410. }
  411. },
  412. created() {
  413. workerApplyDetail({
  414. orderBaseId: this.item.orderBaseId
  415. }).then(res => {
  416. this.formData = {
  417. ...res.data,
  418. image: res.data?.image ? res.data?.image?.split(',').map(url => ({ url })) : []
  419. }
  420. this.formDialog = true
  421. if ([2].includes(this.type)) {
  422. this.formData1 = {
  423. ...this.formData?.workerInvolveApplyItems?.[0]
  424. }
  425. }
  426. })
  427. },
  428. methods: {
  429. networkAudit() {
  430. this.$refs.formRef.validate(valid0 => {
  431. if (valid0) {
  432. this.$refs.formRef1.validate((valid, invalidFields, errLabels) => {
  433. if (valid) {
  434. workerApplyWebsitAppeal({
  435. ...this.formData,
  436. image: this.formData.image.map(item => item.url).join(','),
  437. workerInvolveApplyItem: { ...this.formData1 }
  438. }).then(res => {
  439. this.$message({
  440. type: 'success',
  441. message: '审核成功'
  442. })
  443. this.$emit('success')
  444. })
  445. }
  446. })
  447. }
  448. })
  449. },
  450. centralAudit() {
  451. this.$refs.formRef2.validate((valid, invalidFields, errLabels) => {
  452. if (valid) {
  453. workerApplyAppeal({
  454. ...this.formData?.workerInvolveApplyItems?.[0],
  455. ...this.formData2
  456. }).then(res => {
  457. this.$message({
  458. type: 'success',
  459. message: '审核成功'
  460. })
  461. this.$emit('success')
  462. })
  463. }
  464. })
  465. }
  466. }
  467. }
  468. </script>
  469. <style lang="scss" scoped></style>