inStorage.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <template>
  2. <template-page ref="pageRef" :get-list="getList" :exportList="exportList" :table-attributes="tableAttributes"
  3. :table-events="tableEvents" :options-evens-group="optionsEvensGroup" :moreParameters="moreParameters"
  4. :column-parsing="columnParsing" :operation="operation" :replaceOrNotMap="false">
  5. <div class="cartographer">
  6. <el-dialog :title="({ M: '辅材入库单', P: '配件入库单' })[storageType]" width="100%" :modal="false" :visible.sync="formDialog"
  7. :before-close="formCancel">
  8. <zj-form-container v-if="formDialog" ref="formRef" :form-data="formData" :styleSwitch="false">
  9. <zj-form-module title="单据信息" label-width="120px" :showPackUp="false" :form-data="formData"
  10. :form-items="formItems1">
  11. </zj-form-module>
  12. <zj-form-module :title="({ M: '辅材信息', P: '配件信息' })[storageType]" label-width="120px" :showPackUp="false"
  13. :form-data="formData" :form-items="formItems2">
  14. </zj-form-module>
  15. </zj-form-container>
  16. <div slot="footer" class="dialog-footer">
  17. <el-button size="mini" @click="formCancel">取 消</el-button>
  18. <el-button size="mini" @click="formConfirm" type="primary">确 定</el-button>
  19. </div>
  20. </el-dialog>
  21. </div>
  22. </template-page>
  23. </template>
  24. <script>
  25. import TemplatePage from '@/components/template/template-page-1.vue'
  26. import import_mixin from '@/components/template/import_mixin.js'
  27. import form_tpl from "../mixins/form_tpl.js"
  28. import { websitPurchaseInList, websitPurchaseInListExport, websitPurchaseInAdd, websitPurchaseInEdit, websitPurchaseInConfirm, websitPurchaseInDetail } from "@/api/purchasingManagement.js"
  29. export default {
  30. props: {
  31. storageType: {
  32. type: String,
  33. default: ""
  34. }
  35. },
  36. components: { TemplatePage },
  37. mixins: [import_mixin, form_tpl],
  38. data() {
  39. return {
  40. formData: {
  41. items: []
  42. },
  43. }
  44. },
  45. methods: {
  46. // 列表请求函数
  47. getList(p, cb) {
  48. var pam = JSON.parse(JSON.stringify(p))
  49. pam.params.push({ "param": "a.goods_type", "compare": "=", "value": this.storageType })
  50. if (pam.flag) {
  51. pam.params.push({ "param": "a.flag", "compare": "=", "value": pam.flag })
  52. }
  53. cb && cb(pam)
  54. return websitPurchaseInList(pam)
  55. },
  56. // 列表导出函数
  57. exportList: websitPurchaseInListExport,
  58. // 操作按钮
  59. operation(h, { row, index, column }) {
  60. return (
  61. <div class='operation-btns'>
  62. <el-button type="text" onClick={() => {
  63. Object.assign(this.formData, row)
  64. this.formDialogType = 1
  65. this.openForm()
  66. }}>编辑</el-button>
  67. <el-button type="text" onClick={() => {
  68. Object.assign(this.formData, row)
  69. this.formDialogType = 2
  70. this.openForm()
  71. }}>详情</el-button>
  72. <el-button type="text" onClick={() => {
  73. Object.assign(this.formData, row)
  74. this.formDialogType = 3
  75. this.openForm()
  76. }}>审核</el-button>
  77. </div>
  78. )
  79. },
  80. formConfirm() {
  81. this.$refs.formRef.validate((valid, invalidFields, errLabels) => {
  82. if (valid) {
  83. ([websitPurchaseInAdd, websitPurchaseInEdit][this.formDialogType])(this.formData).then(res => {
  84. this.$message({ type: 'success', message: `${this.formDialogTitles[this.formDialogType]}成功!` })
  85. this.formCancel()
  86. this.$refs.pageRef.refreshList()
  87. })
  88. }
  89. })
  90. }
  91. }
  92. }
  93. </script>
  94. <style lang="scss" scoped></style>