You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

133 lines
4.1 KiB

3 years ago
  1. <template>
  2. <el-dialog
  3. v-drag
  4. width="200px"
  5. :title="!dataForm.id ? buttons.add :buttons.edit"
  6. :close-on-click-modal="false"
  7. :visible.sync="visible">
  8. <el-form label-position="top" ref="dataForm"
  9. label-width="80px">
  10. <el-form-item :label="buttons.site || '工厂编号'" prop="baseData">
  11. <el-input v-model="dataForm.baseData" style="width: 160px"></el-input>
  12. </el-form-item>
  13. <el-form-item :label="buttons.siteDesc || '工厂描述'" prop="baseDesc">
  14. <el-input v-model="dataForm.baseDesc" style="width: 160px"></el-input>
  15. </el-form-item>
  16. <el-form-item :label="buttons.siteRemark || '工厂备注'" prop="remark">
  17. <el-input v-model="dataForm.remark" style="width: 160px"></el-input>
  18. </el-form-item>
  19. </el-form>
  20. <span slot="footer" class="dialog-footer">
  21. <el-button type="primary" @click="dataFormSubmit()">{{buttons.submit ||'确定'}}</el-button>
  22. <el-button type="primary" @click="visible = false">{{ buttons.close|| '关闭' }}</el-button>
  23. </span>
  24. </el-dialog>
  25. </template>
  26. <script>
  27. import {
  28. searchSysLanguageParam,
  29. searchFunctionButtonList,
  30. saveButtonList,
  31. } from "@/api/sysLanguage.js"
  32. export default {
  33. data() {
  34. return {
  35. visible: false,
  36. dataForm: {
  37. id: 0,
  38. site: 'ALL',
  39. type: '',
  40. secondType: 'site_code',
  41. baseData: '',
  42. baseDesc: '',
  43. status: '1',
  44. sortNo: '',
  45. remark: '',
  46. },
  47. buttons: {
  48. submit: '确定',
  49. add: '添加',
  50. edit: '添加',
  51. close: '关闭',
  52. site:'工厂编号',
  53. siteDesc:'工厂描述',
  54. siteRemark:'工厂备注',
  55. },
  56. }
  57. },
  58. methods: {
  59. init(id, baseColumns) {
  60. this.dataForm.id = id || 0
  61. this.visible = true
  62. this.$nextTick(() => {
  63. this.$refs['dataForm'].resetFields()
  64. if (this.dataForm.id) {
  65. this.$http({
  66. url: this.$http.adornUrl(`/factory/tblbasedata/info/` + this.dataForm.id),
  67. method: 'get',
  68. params: this.$http.adornParams()
  69. }).then(({data}) => {
  70. if (data && data.code === 0) {
  71. this.dataForm.site = data.data.site
  72. this.dataForm.type = data.data.type
  73. this.dataForm.secondType = data.data.secondType
  74. this.dataForm.baseData = data.data.baseData
  75. this.dataForm.baseDesc = data.data.baseDesc
  76. this.dataForm.status = data.data.status
  77. this.dataForm.sortNo = data.data.sortNo
  78. this.dataForm.remark = data.data.remark
  79. }
  80. })
  81. }
  82. })
  83. },
  84. // 表单提交
  85. dataFormSubmit() {
  86. if (!this.dataForm.baseData) this.$message.error('工厂编号不能为空'); return
  87. if (!this.dataForm.baseDesc) this.$message.error('工厂描述不能空'); return
  88. this.$http({
  89. url: this.$http.adornUrl(`/factory/tblbasedata/${!this.dataForm.id ? 'save' : 'update'}`),
  90. method: 'post',
  91. data: this.$http.adornData({
  92. 'id': this.dataForm.id || undefined,
  93. 'site': this.dataForm.site,
  94. 'type': this.dataForm.type,
  95. 'secondType': this.dataForm.secondType,
  96. 'baseData': this.dataForm.baseData,
  97. 'baseDesc': this.dataForm.baseDesc,
  98. 'status': this.dataForm.status,
  99. 'sortNo': this.dataForm.sortNo,
  100. 'remark': this.dataForm.remark
  101. })
  102. }).then(({data}) => {
  103. if (data && data.code === 0) {
  104. this.$message.success( '操作成功')
  105. this.visible = false
  106. this.$emit('refreshDataList')
  107. } else {
  108. this.$message.error(data.msg)
  109. }
  110. })
  111. },
  112. getFunctionButtonList() {
  113. let queryButton = {
  114. functionId: '998001',
  115. tableId: '*',
  116. languageCode: this.$i18n.locale,
  117. objectType: 'button'
  118. }
  119. searchFunctionButtonList(queryButton).then(({data}) => {
  120. if (data.code == 0 && data.data) {
  121. this.buttons = data.data
  122. }
  123. })
  124. },
  125. },
  126. created() {
  127. this.getFunctionButtonList()
  128. }
  129. }
  130. </script>