123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204 |
- <template>
- <template-page
- ref="pageRef"
- :get-list="getList"
- :exportList="exportList"
- :table-attributes="tableAttributes"
- :table-events="tableEvents"
- :options-evens-group="optionsEvensGroup"
- :moreParameters="moreParameters"
- :column-parsing="columnParsing"
- :operation="operation()"
- :replaceOrNotMap="false"
- >
- <div class="cartographer">
- <el-dialog
- :title="{ M: '辅材退货单', P: '配件退货单' }[storageType]"
- width="100%"
- :modal="false"
- :visible.sync="formDialog"
- :before-close="formCancel"
- >
- <zj-form-container v-if="formDialog" ref="formRef" :form-data="formData" :styleSwitch="false">
- <zj-form-module
- title="单据信息"
- label-width="120px"
- :showPackUp="false"
- :form-data="formData"
- :form-items="formItems1"
- >
- </zj-form-module>
- <zj-form-module
- :title="{ M: '辅材信息', P: '配件信息' }[storageType]"
- label-width="120px"
- :showPackUp="false"
- :form-data="formData"
- :form-items="formItems2"
- >
- </zj-form-module>
- </zj-form-container>
- <div slot="footer" class="dialog-footer">
- <el-button size="mini" @click="formCancel">取 消</el-button>
- <el-button v-if="~[0, 1].indexOf(formDialogType)" size="mini" @click="formConfirm" type="primary"
- >确 定</el-button
- >
- <el-button v-if="~[3].indexOf(formDialogType)" size="mini" @click="passExamination('OK')" type="primary"
- >审核通过</el-button
- >
- <el-button v-if="~[3].indexOf(formDialogType)" size="mini" @click="passExamination('FAIL')" type="primary"
- >驳回</el-button
- >
- </div>
- </el-dialog>
- </div>
- </template-page>
- </template>
- <script>
- import TemplatePage from '@/components/template/template-page-1.vue'
- import import_mixin from '@/components/template/import_mixin.js'
- import form_tpl from '../mixins/form_tpl.js'
- import operation_mixin from '@/components/template/operation_mixin.js'
- import {
- websitPurchaseRetList,
- websitPurchaseRetListExport,
- websitPurchaseRetAdd,
- websitPurchaseRetEdit,
- websitPurchaseRetConfirm,
- websitPurchaseRetDetail
- } from '@/api/purchasingManagement.js'
- export default {
- props: {
- storageType: {
- type: String,
- default: ''
- }
- },
- components: { TemplatePage },
- mixins: [import_mixin, form_tpl, operation_mixin],
- data() {
- return {
- formData: {
- companyWechatName: JSON.parse(localStorage.getItem('greemall_user')).companyName,
- companyWechatId: '',
- confirmBy: '',
- confirmTime: '',
- createBy: '',
- createTime: '',
- flag: '',
- goodsType: this.storageType,
- purchaseId: '',
- purchaseRetId: '',
- remark: '',
- retTime: '',
- retTotalAmount: 0,
- retTotalQty: 0,
- updateBy: '',
- updateTime: '',
- venderId: '',
- venderName: '',
- storageId: '',
- websitId: '',
- websitName: '',
- items: [],
- imageUrl: []
- }
- }
- },
- methods: {
- // 列表请求函数
- getList(p, cb) {
- var pam = JSON.parse(JSON.stringify(p))
- pam.params.push({ param: 'a.goods_type', compare: '=', value: this.storageType })
- if (pam.flag) {
- pam.params.push({ param: 'a.flag', compare: '=', value: pam.flag })
- }
- cb && cb(pam)
- return websitPurchaseRetList(pam)
- },
- // 列表导出函数
- exportList: websitPurchaseRetListExport,
- operation() {
- return this.operationBtn({
- edit: {
- conditions: ({ row, index, column }) => {
- return row.flag == 'SAVE'
- },
- click: ({ row, index, column }) => {
- this.getDetail(row.purchaseRetId, 1)
- }
- },
- detail: {
- click: ({ row, index, column }) => {
- this.getDetail(row.purchaseRetId, 2)
- }
- },
- examine: {
- conditions: ({ row, index, column }) => {
- return row.flag == 'SAVE'
- },
- click: ({ row, index, column }) => {
- this.getDetail(row.purchaseRetId, 3)
- }
- }
- })
- },
- getDetail(purchaseRetId, type) {
- websitPurchaseRetDetail({ purchaseRetId }).then(res => {
- Object.assign(this.formData, res.data, {
- imageUrl: res.data.imageUrl ? [{ url: res.data.imageUrl }] : [],
- items: res.data.items.map(item => ({
- ...item,
- isEditRow: false
- }))
- })
- this.formDialogType = type
- this.openForm()
- })
- },
- formConfirm() {
- this.$refs.formRef.validate((valid, invalidFields, errLabels) => {
- if (valid) {
- ;[websitPurchaseRetAdd, websitPurchaseRetEdit]
- [this.formDialogType]({
- ...this.formData,
- goodsType: this.storageType,
- imageUrl: this.formData.imageUrl.map(item => item.url).join(',')
- })
- .then(res => {
- this.$message({ type: 'success', message: `${this.formDialogTitles[this.formDialogType]}成功!` })
- this.formCancel()
- this.$refs.pageRef.refreshList()
- })
- }
- })
- },
- passExamination(flag) {
- this.$refs.formRef.validate((valid, invalidFields, errLabels) => {
- if (valid) {
- websitPurchaseRetConfirm({
- purchaseRetId: this.formData.purchaseRetId,
- flag: flag,
- storageId: this?.formData?.storageId
- }).then(res => {
- this.$message({ type: 'success', message: flag == 'OK' ? `审核通过!` : '驳回通过' })
- this.formCancel()
- this.$refs.pageRef.refreshList()
- })
- }
- })
- }
- }
- }
- </script>
- <style lang="scss">
- .redbordererr {
- .el-form-item {
- margin: 0 !important;
- overflow: hidden;
- }
- }
- </style>
|