inventory-add.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <template>
  2. <el-dialog
  3. title="新增盘点"
  4. width="70%"
  5. :close-on-click-modal="false"
  6. :visible.sync="visible">
  7. <el-form :model="dataForm" :rules="dataRule" ref="dataForm" label-width="auto">
  8. <el-row class="my-row">
  9. <el-col :span="8">
  10. <el-form-item label="盘点编码" prop="inventoryCode">
  11. <el-input v-model="dataForm.inventoryCode" :disabled="true" placeholder="系统自动生成"></el-input>
  12. </el-form-item>
  13. </el-col>
  14. <el-col :span="8" style="padding-left: 20px">
  15. <el-form-item label="盘点员" prop="checkerId">
  16. <user-component v-model="dataForm.checkerId" :user-id="dataForm.checkerId"/>
  17. </el-form-item>
  18. </el-col>
  19. <el-col :span="8" style="padding-left: 20px">
  20. <el-form-item label="复核员" prop="dcheckerId">
  21. <user-component v-model="dataForm.dcheckerId" :user-id="dataForm.dcheckerId"/>
  22. </el-form-item>
  23. </el-col>
  24. </el-row>
  25. <el-row class="my-row">
  26. <el-form-item label="备注说明">
  27. <el-input v-model="dataForm.notes" placeholder="备注说明"></el-input>
  28. </el-form-item>
  29. </el-row>
  30. </el-form>
  31. <span slot="footer" class="dialog-footer">
  32. <el-button @click="visible = false">取消</el-button>
  33. <el-button type="primary" @click="dataFormSubmit()">确定</el-button>
  34. </span>
  35. </el-dialog>
  36. </template>
  37. <script>
  38. import UserComponent from '../common/user-component'
  39. import DictSelect from '../sys/dict-select'
  40. export default {
  41. name: 'inventory-add',
  42. components: {DictSelect, UserComponent},
  43. data () {
  44. return {
  45. visible: false,
  46. dataForm: { },
  47. dataRule: {
  48. checkerId: [{ required: true, message: '盘点员不能为空', trigger: 'change' }],
  49. dcheckerId: [{ required: true, message: '复核员不能为空', trigger: 'change' }]
  50. }
  51. }
  52. },
  53. methods: {
  54. init () {
  55. this.visible = true
  56. this.dataForm = {}
  57. },
  58. // 表单提交
  59. dataFormSubmit () {
  60. this.$refs['dataForm'].validate((valid) => {
  61. if (valid) {
  62. this.$http({
  63. url: this.$http.adornUrl(`/biz-service/inventory-checking-ctl/save`),
  64. method: 'post',
  65. data: this.$http.adornData({
  66. 'checkerId': this.dataForm.checkerId,
  67. 'dcheckerId': this.dataForm.dcheckerId,
  68. 'notes': this.dataForm.notes,
  69. 'creatorId': this.$store.state.user.id,
  70. 'orgId': this.$store.state.user.orgId
  71. })
  72. }).then(({data}) => {
  73. if (data && data.code === '200') {
  74. this.$message({
  75. message: '操作成功',
  76. type: 'success',
  77. duration: 1500,
  78. onClose: () => {
  79. this.visible = false
  80. this.$emit('refreshDataList')
  81. }
  82. })
  83. } else {
  84. this.$message.error(data.msg)
  85. }
  86. })
  87. }
  88. })
  89. },
  90. validateField (type) {
  91. this.$refs.dataForm.validateField(type)
  92. }
  93. }
  94. }
  95. </script>
  96. <style scoped>
  97. .my-line{
  98. border-bottom: 1px solid #c0c4cc;
  99. margin-bottom: 10px;
  100. }
  101. </style>