Blame view

src/views/system/sqywgz/components/clgzsd.vue 6.21 KB
1 2 3 4
<!--
  功能:登记情形设定
-->
<template>
任超 committed
5 6
  <div>
    <el-form :model="ruleForm">
7 8 9 10
      <el-row>
        <el-col :span="5">
          <el-form-item label="登记业务编码">
            {{ ruleForm.djywbm }}
11 12
          </el-form-item>
        </el-col>
13 14 15
        <el-col :span="12">
          <el-form-item label="登记业务名称">
            {{ ruleForm.djywmc }}
16 17 18 19
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
任超 committed
20
    <lb-table :column="column" border :key="key" heightNumSetting :pagination="false" :data="tableData">
21 22 23 24
    </lb-table>
  </div>
</template>
<script>
任超 committed
25
import { mapGetters } from 'vuex'
任超 committed
26
import { upward, down } from '@/utils/operation'
27
export default {
28 29 30
  props: {
    ruleForm: {
      type: Object, default: {}
任超 committed
31
    },
任超 committed
32 33 34 35 36 37 38 39
    clzt: {
      type: Array, default: () => {
        return []
      }
    },
    djqx: {
      type: Array, default: () => {
        return []
任超 committed
40
      }
41 42
    }
  },
任超 committed
43 44 45
  computed: {
    ...mapGetters(['dictData'])
  },
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
  data () {
    return {
      key: 0,
      column: [
        {
          width: '60',
          renderHeader: (h, scope) => {
            return <i class="el-icon-plus pointer" onClick={() => { this.handleAdd() }} style="color:#409EFF"></i>
          },
          render: (h, scope) => {
            return (
              <i class="el-icon-minus pointer" onClick={() => { this.handleMinus(scope.$index, scope.row) }}></i>
            )
          }
        },
        {
          width: '60',
          label: '序号',
          type: 'index'
        },
        {
任超 committed
67
          label: '是否必填',
任超 committed
68
          width: '130',
69 70
          render: (h, scope) => {
            return (
任超 committed
71 72 73 74
              <el-radio-group v-model={scope.row.isrequired} onChange={(val) => { scope.row[scope.column.property] = val }}>
                <el-radio label={'1'}></el-radio>
                <el-radio label={'0'}></el-radio>
              </el-radio-group>
75 76 77 78 79 80
            )
          }
        },
        {
          prop: 'clbm',
          label: '材料编码',
任超 committed
81
          width: '100',
82 83 84
          render: (h, scope) => {
            return (
              <el-input placeholder="材料编码" value={scope.row[scope.column.property]}
任超 committed
85
                onInput={(val) => { scope.row[scope.column.property] = val }} maxlength="8"></el-input>
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
            )
          }
        },
        {
          prop: 'clmc',
          label: '材料名称',
          render: (h, scope) => {
            return (
              <el-input placeholder="材料名称" value={scope.row[scope.column.property]}
                onInput={(val) => { scope.row[scope.column.property] = val }}></el-input>
            )
          }
        },
        {
          prop: 'cllx',
          label: '材料类型',
任超 committed
102
          width: '115',
103 104 105
          render: (h, scope) => {
            return (
              <el-select value={scope.row[scope.column.property]}
任超 committed
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137
                onChange={(val) => { scope.row[scope.column.property] = val }} clearable>
                {
                  this.dictData['A40'].map(option => {
                    return (
                      <el-option label={option.dname} value={option.dcode}></el-option>
                    )
                  })
                }
              </el-select>
            )
          }
        },
        {
          label: '是否公共材料',
          width: '100',
          render: (h, scope) => {
            return (
              <el-radio-group v-model={scope.row.sfggcl} onChange={(val) => { scope.row[scope.column.property] = val; this.handleSelectGgcl(scope.row) }}>
                <el-radio label={'1'}></el-radio>
                <el-radio label={'0'}></el-radio>
              </el-radio-group>
            )
          }
        },
        {
          prop: 'djqxbm',
          label: '登记情形',
          width: '180',
          render: (h, scope) => {
            return (
              <el-select disabled={scope.row.sfggcl == '1'} value={scope.row[scope.column.property]}
                onChange={(val) => { scope.row[scope.column.property] = val }} clearable>
138
                {
任超 committed
139
                  this.djqx.map(option => {
140
                    return (
任超 committed
141
                      <el-option label={option.nodename} value={option.nodecode}></el-option>
142 143 144 145 146 147 148 149 150 151 152 153 154
                    )
                  })
                }
              </el-select>
            )
          }
        },
        {
          label: '移动',
          width: '90',
          render: (h, scope) => {
            return (
              <div>
155 156
                <el-button type='text' disabled={scope.$index == 0} onClick={() => { this.moveUpward(scope.$index, scope.row) }}>上移</el-button>
                <el-button type='text' disabled={(scope.$index + 1) == this.tableData.length} onClick={() => { this.moveDown(scope.$index, scope.row) }}>下移</el-button >
157 158 159 160 161
              </div>
            )
          }
        }
      ],
任超 committed
162
      tableData: []
163 164 165 166 167
    }
  },
  watch: {
    tableData: {
      handler (newValue, oldValue) {
任超 committed
168
        if (!_.isEqual(newValue, this.clzt)) {
169 170
          this.$emit('updateValue', newValue)
        }
171 172
      },
      deep: true
任超 committed
173
    },
任超 committed
174
    clzt: {
任超 committed
175
      handler: function (newValue) {
任超 committed
176
        this.tableData = _.cloneDeep(newValue)
任超 committed
177 178 179
      },
      deep: true
    },
180 181 182 183 184
  },
  methods: {
    handleAdd () {
      this.tableData.push(
        {
任超 committed
185 186
          isrequired: '1',
          djqxbm: '',
187 188
          clbm: '',
          clmc: '',
任超 committed
189 190
          cllx: '',
          sfggcl: '1'
191 192
        }
      )
193
      this.key++
194
    },
任超 committed
195 196 197 198 199
    handleSelectGgcl (item) {
      if (item.sfggcl == '1') {
        item.djqxbm = ''
      }
    },
任超 committed
200
    handleMinus (index, row) {
201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216
      this.$confirm('此操作将永久删除, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.tableData.splice(index, 1)
        this.$message({
          type: 'success',
          message: '删除成功!'
        });
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消删除'
        });
      });
任超 committed
217
    },
218 219
    // 上移下移
    moveUpward (index, row) {
任超 committed
220
      upward(index, this.tableData)
221 222
    },
    moveDown (index, row) {
任超 committed
223 224
      down(index, this.tableData)
    },
225 226 227 228
  }
}
</script>
<style scoped lang='scss'>
229

230
</style>