PreviewForm.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <template>
  2. <a-modal
  3. :title="modalTitle"
  4. :width="800"
  5. :visible="visible"
  6. :confirmLoading="confirmLoading"
  7. @cancel="handleCancel"
  8. >
  9. <div style='text-align: center;'>
  10. <h1>数字工厂巡检记录填报</h1>
  11. </div>
  12. <a-form :form="form">
  13. <row-list :col="1">
  14. <row-item v-for="(item, index) in data" :key="index">
  15. <a-form-item
  16. :label="item.name"
  17. :labelCol="BaseTool.Constant.labelCol"
  18. :wrapperCol="BaseTool.Constant.wrapperCol"
  19. >
  20. <a-input v-if="item.type === 1" :placeholder='item.remark' />
  21. <a-select
  22. v-if="item.type === 2"
  23. style="width: 120px"
  24. >
  25. <a-select-option
  26. v-for="option in item.selectValue"
  27. :key="option.value"
  28. :label="option.value"
  29. :value="option.value">{{ option.value }}</a-select-option>
  30. </a-select>
  31. <a-span v-if="item.type === 2" style='padding-left: 15%;'>填报备注:{{ item.remark }}</a-span>
  32. </a-form-item>
  33. </row-item>
  34. </row-list>
  35. </a-form>
  36. <template slot="footer">
  37. <a-button :loading="confirmLoading" type="primary" @click="handleCancel()">返回</a-button>
  38. </template>
  39. </a-modal>
  40. </template>
  41. <script>
  42. export default {
  43. name: 'PreviewForm',
  44. data () {
  45. return {
  46. confirmLoading: false,
  47. modalTitle: null,
  48. form: this.$form.createForm(this),
  49. isDictType: false,
  50. visible: false,
  51. selectFlag: false,
  52. // 下拉框map
  53. useTypeMap: {},
  54. typeMap: {},
  55. codeValueMap: {},
  56. natureMap: {},
  57. data: []
  58. }
  59. },
  60. props: {},
  61. created () {
  62. },
  63. methods: {
  64. base (record) {
  65. this.visible = true
  66. this.data = []
  67. for (let i = 0; i < record.length; i++) {
  68. if (record[i].type === 2) {
  69. if (typeof record[i].selectValue !== 'object') {
  70. record[i].selectValue = JSON.parse(record[i].selectValue)
  71. }
  72. }
  73. this.data.push(record[i])
  74. }
  75. },
  76. handleCancel (values) {
  77. this.visible = false
  78. this.confirmLoading = false
  79. this.form.resetFields()
  80. if (this.BaseTool.Object.isNotBlank(values)) {
  81. this.$emit('ok', values)
  82. }
  83. }
  84. }
  85. }
  86. </script>