Browse Source

no message

linwenxin 7 tháng trước cách đây
mục cha
commit
33c53755ed

+ 327 - 0
src/views/partsManagement/accessoryWebsite/website-old-parts-shop-refund/index.vue

@@ -0,0 +1,327 @@
+<template>
+  <template-page
+    ref="pageRef"
+    :getList="getList"
+    :exportList="exportList"
+    :columnParsing="columnParsing"
+    :optionsEvensGroup="optionsEvensGroup"
+    :tableAttributes="tableAttributes"
+    :tableEvents="tableEvents"
+  >
+    <el-dialog
+      title=""
+      width="600px"
+      :modal="true"
+      :visible.sync="formDialog"
+      :show-close="true"
+      :close-on-click-modal="false"
+      :modal-append-to-body="false"
+      append-to-body
+      :before-close="formCancel"
+    >
+      <zj-form-container ref="formRef" :form-data="formData" :styleSwitch="false">
+        <zj-form-module title="新增" label-width="90px" :form-data="formData" :form-items="formItems"> </zj-form-module>
+      </zj-form-container>
+      <div slot="footer" class="dialog-footer">
+        <el-button size="mini" @click="formCancel">取 消</el-button>
+        <el-button size="mini" @click="formConfirm" type="primary">确 定</el-button>
+      </div>
+    </el-dialog>
+  </template-page>
+</template>
+
+<script>
+import TemplatePage from '@/components/template/template-page-1.vue'
+import {
+  partsOldOutList,
+  partsOldOutExport,
+  partsOldOutAdd
+} from '@/api/material-system/center/center-old-parts-shop-out'
+import { getWebsit } from '@/api/customerManagement.js'
+import { getGoodsList } from '@/api/auxiliaryFittings/auxiliarySalesReturnOrder'
+import operation_mixin from '@/components/template/operation_mixin.js'
+export default {
+  components: { TemplatePage },
+  mixins: [operation_mixin],
+  data() {
+    return {
+      // 表格属性
+      tableAttributes: {},
+      // 表格事件
+      tableEvents: {},
+      // 事物类型
+      objectTypeList: [
+        { label: '退旧件', value: '退旧件' },
+        { label: '无件返回', value: '无件返回' },
+        { label: '新件退库', value: '新件退库' }
+      ],
+      websitList: [],
+      partsList: [],
+      formDialog: false,
+      formData: {
+        objectType: '',
+        objectTypeName: '',
+        partsName: '',
+        partsNumber: '',
+        qty: '',
+        applyNo: '',
+        materialGroupId: '',
+        materialGroupName: '',
+        remark: '',
+        unitId: '',
+        unitName: '',
+        voucherNo: '',
+        totalNumber: 0,
+        websitId: '',
+        websitName: '',
+        partsWebsitId: ''
+      }
+    }
+  },
+  computed: {
+    optionsEvensGroup() {
+      return [
+        [
+          [
+            this.optionsEvensAuth('add', {
+              click: () => {
+                getWebsit({ type: 'C', status: true, queryPartsWebsit: true }).then(res => {
+                  this.websitList = res.data.map(item => ({ label: item.name, value: item.websitId, ...item }))
+                  this.formDialog = true
+                })
+              }
+            })
+          ]
+        ]
+      ]
+    },
+    formItems() {
+      return [
+        {
+          name: 'el-select',
+          md: 24,
+          options: this.objectTypeList,
+          attributes: {
+            placeholder: '请选择',
+            clearable: true,
+            filterable: true
+          },
+          formItemAttributes: {
+            label: '事物类型',
+            prop: 'objectType',
+            rules: [{ required: true, message: '请选择', trigger: 'blur' }]
+          },
+          events: {
+            change: val => {
+              this.formData.partsNumber = ''
+              this.formData.partsName = ''
+              this.formData.materialGroupId = ''
+              this.formData.materialGroupName = ''
+              this.formData.unitId = ''
+              this.formData.unitName = ''
+              this.formData.totalNumber = ''
+              if (val) {
+                this.formData.objectTypeName = this.objectTypeList.find(item => item.value === val)?.label || ''
+              } else {
+                this.formData.objectTypeName = ''
+              }
+            }
+          }
+        },
+        {
+          name: 'el-select',
+          md: 24,
+          options: this.websitList,
+          attributes: {
+            placeholder: '请选择',
+            clearable: true,
+            filterable: true
+          },
+          formItemAttributes: {
+            label: '网点',
+            prop: 'websitId',
+            rules: [{ required: true, message: '请选择', trigger: 'blur' }]
+          },
+          events: {
+            change: v => {
+              var data = this.websitList.find(item => item.websitId === v)
+              if (data) {
+                this.formData.websitName = data?.name
+                this.formData.partsWebsitId = data?.partsWebsitId
+              } else {
+                this.formData.websitName = ''
+                this.formData.partsWebsitId = ''
+              }
+              this.getOptions(v)
+            }
+          }
+        },
+
+        {
+          name: 'el-select',
+          md: 24,
+          options: this.partsList,
+          attributes: {
+            placeholder: '请选择',
+            clearable: true,
+            filterable: true
+          },
+          formItemAttributes: {
+            label: '配件名称',
+            prop: 'partsNumber',
+            rules: [{ required: true, message: '请选择', trigger: 'blur' }]
+          },
+          events: {
+            change: async val => {
+              if (val) {
+                var item = this.partsList.find(item => item.value === val)
+                if (item) {
+                  this.formData.partsName = item?.label
+                  this.formData.materialGroupId = item.data.materialGroupId
+                  this.formData.materialGroupName = item.data.materialGroupName
+                  this.formData.unitId = item.data.unitId
+                  this.formData.unitName = item.data.unitName
+                  this.formData.totalNumber = (() => {
+                    if (!!~['新件退库'].indexOf(this.formData.objectType)) {
+                      return item.data.newQty
+                    } else if (!!~['退旧件', '无件返回'].indexOf(this.formData.objectType)) {
+                      return item.data.oldQty
+                    } else {
+                      return 0
+                    }
+                  })()
+                  return
+                }
+              }
+              this.formData.partsName = ''
+              this.formData.materialGroupId = ''
+              this.formData.materialGroupName = ''
+              this.formData.unitId = ''
+              this.formData.unitName = ''
+              this.formData.totalNumber = 0
+            }
+          }
+        },
+
+        {
+          name: 'el-input',
+          md: 24,
+          attributes: { placeholder: '请输入', disabled: true },
+          formItemAttributes: { label: '物料组名称', prop: 'materialGroupName' }
+        },
+        {
+          name: 'el-input',
+          md: 24,
+          attributes: { placeholder: '请输入', disabled: true },
+          formItemAttributes: { label: '单位名称', prop: 'unitName' }
+        },
+        {
+          name: 'el-input',
+          md: 12,
+          attributes: { placeholder: '请输入', type: 'number' },
+          formItemAttributes: {
+            label: '数量',
+            prop: 'qty',
+            rules: [
+              { required: true, message: '请输入', trigger: 'blur' },
+              {
+                validator: (rule, value, callback) => {
+                  console.log(value)
+                  if (value && value > this.formData.totalNumber) {
+                    callback(new Error('值不能大于剩余数量'))
+                  } else {
+                    callback()
+                  }
+                },
+                trigger: 'blur'
+              }
+            ]
+          }
+        },
+        {
+          name: 'el-input',
+          md: 12,
+          attributes: { placeholder: '请输入', type: 'number', disabled: true },
+          formItemAttributes: { label: '剩余数量', prop: 'totalNumber' }
+        },
+        {
+          name: 'el-input',
+          md: 24,
+          attributes: { placeholder: '请输入' },
+          formItemAttributes: { label: '申请单号', prop: 'applyNo' }
+        },
+        {
+          name: 'el-input',
+          md: 24,
+          attributes: { placeholder: '请输入' },
+          formItemAttributes: { label: '凭证号', prop: 'voucherNo' }
+        },
+        {
+          name: 'el-input',
+          md: 24,
+          attributes: { placeholder: '请输入', type: 'textarea', rows: 3 },
+          formItemAttributes: { label: '开单备注', prop: 'remark' }
+        }
+      ]
+    }
+  },
+  methods: {
+    // 列表请求函数
+    getList: partsOldOutList,
+    // 列表导出函数
+    exportList: partsOldOutExport,
+    // 表格列解析渲染数据更改
+    columnParsing(item, defaultData) {
+      return defaultData
+    },
+    // 获取选择下拉
+    getOptions(websitId) {
+      if (websitId) {
+        getGoodsList({
+          type: 'P',
+          websitId: websitId
+        }).then(res => {
+          this.partsList = res.data.map(item => ({ label: item.partsNumber, value: item.id, data: item }))
+        })
+      } else {
+        this.partsList = []
+      }
+    },
+    formCancel() {
+      this.formData = {
+        objectType: '',
+        objectTypeName: '',
+        partsName: '',
+        partsNumber: '',
+        qty: '',
+        applyNo: '',
+        materialGroupId: '',
+        materialGroupName: '',
+        remark: '',
+        unitId: '',
+        unitName: '',
+        voucherNo: '',
+        totalNumber: 0
+      }
+      this.$refs.formRef.$refs['inlineForm'].clearValidate()
+      this.formDialog = false
+    },
+    formConfirm() {
+      this.$refs.formRef.validate(valid => {
+        if (valid) {
+          partsOldOutAdd([this.formData]).then(res => {
+            this.$refs.pageRef.refreshList()
+            this.$message({
+              type: 'success',
+              message: `添加成功!`
+            })
+            this.formCancel()
+          })
+        }
+      })
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped></style>

+ 1 - 1
src/views/partsManagement/accessoryWebsite/website-parts-shop-sales-manage/website-parts-shop-sales/components/website-parts-shop-sales-information.vue

@@ -475,8 +475,8 @@ import {
   partsPartssalesorderConfirmDelivery,
   partsPartssalesorderCancel
 } from '@/api/material-system/website/website-parts-shop-sales'
-import { getWebsit } from '@/api/customerManagement.js'
 import { getWorker } from '@/api/auxiliaryFittings/auxiliarySalesOrder'
+import { getWebsit } from '@/api/customerManagement.js'
 import { getGoodsList } from '@/api/auxiliaryFittings/auxiliarySalesReturnOrder'
 import PayPopupWindow from './pay-popup-window.vue'
 import applicationNewRepairParts from '@/components/payTemplate/applicationNewRepairParts'

+ 1 - 1
src/views/partsManagement/accessoryWebsite/website-parts-worker-refund-manage/website-new-parts-worker-refund/components/website-new-parts-worker-refund-information.vue

@@ -238,7 +238,7 @@
         </template>
       </div>
       <br />
-      <el-row>
+      <el-row style="text-align: right">
         <el-button v-if="!disabled" size="small" type="primary" @click="determine">提交</el-button>
         <el-button v-if="!disabled" size="small" @click="reset">重置</el-button>
       </el-row>

+ 0 - 1
src/views/partsManagement/accessoryWebsite/website-parts-worker-refund-manage/website-old-parts-worker-refund/components/website-old-parts-worker-refund-information.vue

@@ -228,7 +228,6 @@
           </el-descriptions-item>
         </el-descriptions>
       </div>
-
       <br />
       <el-row style="text-align: right">
         <el-button v-if="!disabled" size="small" type="primary" @click="determine">提交</el-button>