|
@@ -13,119 +13,58 @@
|
|
|
>
|
|
|
</template-page>
|
|
|
</div>
|
|
|
- <template v-if="purchaseArea && purchaseAreaParam.openType === 'add'">
|
|
|
- <el-page-header class="pdt" content="新增采购订单" @back="backUpdPage" />
|
|
|
- <el-divider />
|
|
|
+ <template v-if="purchaseArea">
|
|
|
+ <div style="box-sizing: border-box; padding: 20px">
|
|
|
+ <el-page-header
|
|
|
+ :content="
|
|
|
+ purchaseAreaParam.openType === 'add'
|
|
|
+ ? '新增采购订单'
|
|
|
+ : purchaseAreaParam.openType === 'view'
|
|
|
+ ? '查看采购订单'
|
|
|
+ : '编辑采购订单'
|
|
|
+ "
|
|
|
+ @back="backUpdPage"
|
|
|
+ />
|
|
|
+ <el-divider />
|
|
|
+ <!-- 新增编辑单据 -->
|
|
|
+ <purchase-area
|
|
|
+ v-if="purchaseArea"
|
|
|
+ :is-open.sync="purchaseArea"
|
|
|
+ :input-param="purchaseAreaParam"
|
|
|
+ @getList="$refs.pageRef.refreshList()"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
</template>
|
|
|
- <template v-else-if="purchaseArea && purchaseAreaParam.openType !== 'add'">
|
|
|
- <el-page-header
|
|
|
- class="pdt"
|
|
|
- :content="purchaseAreaParam.openType === 'view' ? '查看采购订单' : '编辑采购订单'"
|
|
|
- @back="backUpdPage"
|
|
|
- />
|
|
|
- <el-divider />
|
|
|
- </template>
|
|
|
- <!-- 新增编辑单据 -->
|
|
|
- <purchase-area
|
|
|
- v-if="purchaseArea"
|
|
|
- :is-open.sync="purchaseArea"
|
|
|
- :input-param="purchaseAreaParam"
|
|
|
- @getList="$refs.pageRef.refreshList()"
|
|
|
- />
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import {
|
|
|
confirmPurchaseSheet,
|
|
|
- unAuditPurchaseSheet,
|
|
|
- pushPurchaseSheet,
|
|
|
- delPurchaseSheet,
|
|
|
- copyPurchaseSheet,
|
|
|
- getPurchaseSheetList,
|
|
|
revokePurchaseSheet,
|
|
|
getNewPurchaseSheetList,
|
|
|
exportNewPurchaseSheetList
|
|
|
} from '@/api/material-system/shop/purchase-sheet'
|
|
|
-import { downloadFiles, handleImport } from '@/utils/util'
|
|
|
-import { getToken } from '@/utils/auth'
|
|
|
import PurchaseArea from '../components/PurchaseArea'
|
|
|
import TemplatePage from '@/components/template/template-page-1.vue'
|
|
|
import import_mixin from '@/components/template/import_mixin.js'
|
|
|
+import operation_mixin from '@/components/template/operation_mixin.js'
|
|
|
export default {
|
|
|
name: 'PurchaseSheet',
|
|
|
components: { PurchaseArea, TemplatePage },
|
|
|
- mixins: [import_mixin],
|
|
|
-
|
|
|
- filters: {
|
|
|
- syncFilter(value) {
|
|
|
- const syncMap = {
|
|
|
- 0: '待处理',
|
|
|
- 1: '待同步',
|
|
|
- 2: '非同步',
|
|
|
- 3: '已同步',
|
|
|
- 99: '取消同步'
|
|
|
- }
|
|
|
- return syncMap[value]
|
|
|
- }
|
|
|
- },
|
|
|
+ mixins: [import_mixin, operation_mixin],
|
|
|
data() {
|
|
|
return {
|
|
|
purchaseArea: false,
|
|
|
purchaseAreaParam: {
|
|
|
openType: 'add',
|
|
|
- sheetId: ''
|
|
|
+ purchaseId: ''
|
|
|
},
|
|
|
- baseURL: process.env.VUE_APP_BASE_API,
|
|
|
- myHeaders: { 'x-token': getToken() },
|
|
|
- dataList: null, // 列表数据
|
|
|
listLoading: false, // 列表加载loading
|
|
|
- currentPage: 1, // 当前页码
|
|
|
- pageSize: 10, // 每页数量
|
|
|
- listTotal: 0, // 列表总数
|
|
|
- screenForm: {
|
|
|
- // 筛选表单数据
|
|
|
- verifyTime: '', // 创建时间
|
|
|
- flag: '', // 状态
|
|
|
- keyword: '', // 关键词
|
|
|
- sheetId: '', // 单据编号
|
|
|
- shopId: ''
|
|
|
- },
|
|
|
- importLoading: false, // 导入加载loading
|
|
|
- importResult: null, // 导入结果
|
|
|
- importFileList: [], // 导入列表
|
|
|
- // 事件组合
|
|
|
- optionsEvensGroup: [
|
|
|
- [
|
|
|
- [
|
|
|
- {
|
|
|
- name: '新增单据',
|
|
|
- click: () => {
|
|
|
- this.addOrEdit('add')
|
|
|
- },
|
|
|
- isRole: this.checkBtnRole('add')
|
|
|
- }
|
|
|
- ]
|
|
|
- ]
|
|
|
- ],
|
|
|
// 表格属性
|
|
|
tableAttributes: {
|
|
|
// 启用勾选列
|
|
|
- selectColumn: true,
|
|
|
- columnExpand: (h, { row, index, columm }) => {
|
|
|
- return (
|
|
|
- <div style="padding-left:95px">
|
|
|
- <el-form label-position="left" inline class="demo-table-expand">
|
|
|
- <el-form-item label="执行信息">
|
|
|
- <span>{row.remark}</span>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="备注">
|
|
|
- <span>{row.notes}</span>
|
|
|
- </el-form-item>
|
|
|
- </el-form>
|
|
|
- </div>
|
|
|
- )
|
|
|
- }
|
|
|
+ selectColumn: false
|
|
|
},
|
|
|
// 表格事件
|
|
|
tableEvents: {
|
|
@@ -134,101 +73,38 @@ export default {
|
|
|
recordSelected: []
|
|
|
}
|
|
|
},
|
|
|
- created() {
|
|
|
- // this.$refs.screenForm.resetFields();
|
|
|
- },
|
|
|
methods: {
|
|
|
- // 查询列表
|
|
|
- // getList() {
|
|
|
- // this.listLoading = true;
|
|
|
-
|
|
|
- // const params = {
|
|
|
- // shopId: this.screenForm.shopId,
|
|
|
- // flag: this.screenForm.flag,
|
|
|
- // venderName: this.screenForm.keyword,
|
|
|
- // sheetId: this.screenForm.sheetId,
|
|
|
- // startTime: this.screenForm.createTime
|
|
|
- // ? this.screenForm.createTime[0]
|
|
|
- // : "",
|
|
|
- // endTime: this.screenForm.createTime
|
|
|
- // ? this.screenForm.createTime[1]
|
|
|
- // : "",
|
|
|
- // pageNum: this.currentPage,
|
|
|
- // pageSize: this.pageSize
|
|
|
- // };
|
|
|
- // getPurchaseSheetList(params).then(res => {
|
|
|
- // this.dataList = res.data.records;
|
|
|
- // this.listTotal = res.data.total;
|
|
|
- // this.listLoading = false;
|
|
|
- // });
|
|
|
- // },
|
|
|
- // 更改每页数量
|
|
|
- handleSizeChange(val) {
|
|
|
- this.pageSize = val
|
|
|
- this.currentPage = 1
|
|
|
- this.$refs.pageRef.refreshList()
|
|
|
- },
|
|
|
- // 更改当前页
|
|
|
- handleCurrentChange(val) {
|
|
|
- this.currentPage = val
|
|
|
- this.$refs.pageRef.refreshList()
|
|
|
- },
|
|
|
- // 重置筛选表单
|
|
|
- resetScreenForm() {
|
|
|
- this.currentPage = 1
|
|
|
- this.$refs.pageRef.refreshList()
|
|
|
- },
|
|
|
- // 提交筛选表单
|
|
|
- submitScreenForm() {
|
|
|
- this.currentPage = 1
|
|
|
- this.$refs.pageRef.refreshList()
|
|
|
- },
|
|
|
// 新增编辑 采购入库单
|
|
|
addOrEdit(type, id) {
|
|
|
this.purchaseArea = true
|
|
|
this.purchaseAreaParam.openType = type
|
|
|
- this.purchaseAreaParam.sheetId = id
|
|
|
+ this.purchaseAreaParam.purchaseId = id
|
|
|
},
|
|
|
// 删除单据
|
|
|
- revokeSheet(sheetId) {
|
|
|
- this.$confirm(`此操作将作废 ${sheetId} 单据, 是否继续?`, '提示', {
|
|
|
+ revokeSheet(purchaseId) {
|
|
|
+ this.$confirm(`此操作将作废 ${purchaseId} 单据, 是否继续?`, '提示', {
|
|
|
confirmButtonText: '确定',
|
|
|
cancelButtonText: '取消',
|
|
|
type: 'warning'
|
|
|
})
|
|
|
.then(() => {
|
|
|
- revokePurchaseSheet({ sheetId: sheetId }).then(() => {
|
|
|
+ revokePurchaseSheet({ purchaseId: purchaseId }).then(() => {
|
|
|
this.$refs.pageRef.refreshList()
|
|
|
this.$successMsg('作废成功')
|
|
|
})
|
|
|
})
|
|
|
.catch(() => console.log('取消'))
|
|
|
},
|
|
|
- // 删除单据
|
|
|
- delSheet(sheetId) {
|
|
|
- this.$confirm(`此操作将删除 ${sheetId} 单据, 是否继续?`, '提示', {
|
|
|
- confirmButtonText: '确定',
|
|
|
- cancelButtonText: '取消',
|
|
|
- type: 'warning'
|
|
|
- })
|
|
|
- .then(() => {
|
|
|
- delPurchaseSheet({ sheetId: sheetId }).then(() => {
|
|
|
- this.$refs.pageRef.refreshList()
|
|
|
- this.$successMsg('删除成功')
|
|
|
- })
|
|
|
- })
|
|
|
- .catch(() => console.log('取消'))
|
|
|
- },
|
|
|
// 审核 采购入库单
|
|
|
- confirmSheet(sheetId) {
|
|
|
- this.$confirm(`此操作将审核 ${sheetId} 单据, 是否继续?`, '提示', {
|
|
|
+ confirmSheet(purchaseId) {
|
|
|
+ this.$confirm(`此操作将审核 ${purchaseId} 单据, 是否继续?`, '提示', {
|
|
|
confirmButtonText: '确定',
|
|
|
cancelButtonText: '取消',
|
|
|
type: 'warning'
|
|
|
})
|
|
|
.then(() => {
|
|
|
this.listLoading = true
|
|
|
- confirmPurchaseSheet({ sheetId: sheetId }).then(
|
|
|
+ confirmPurchaseSheet({ purchaseId: purchaseId }).then(
|
|
|
() => {
|
|
|
setTimeout(() => {
|
|
|
this.$refs.pageRef.refreshList()
|
|
@@ -243,127 +119,12 @@ export default {
|
|
|
})
|
|
|
.catch(() => console.log('取消'))
|
|
|
},
|
|
|
-
|
|
|
- // 反审 采购入库单
|
|
|
- unAuditSheet(sheetId) {
|
|
|
- this.$confirm(`此操作将反审 ${sheetId} 单据, 是否继续?`, '提示', {
|
|
|
- confirmButtonText: '确定',
|
|
|
- cancelButtonText: '取消',
|
|
|
- type: 'warning'
|
|
|
- })
|
|
|
- .then(() => {
|
|
|
- this.listLoading = true
|
|
|
- unAuditPurchaseSheet({ sheetId: sheetId }).then(
|
|
|
- () => {
|
|
|
- setTimeout(() => {
|
|
|
- this.$refs.pageRef.refreshList()
|
|
|
- this.$successMsg('反审成功')
|
|
|
- this.listLoading = false
|
|
|
- }, 2000)
|
|
|
- },
|
|
|
- () => {
|
|
|
- this.listLoading = false
|
|
|
- }
|
|
|
- )
|
|
|
- })
|
|
|
- .catch(() => console.log('取消'))
|
|
|
- },
|
|
|
-
|
|
|
- // 下推 采购入库单
|
|
|
- pushSheet(sheetId) {
|
|
|
- this.$confirm(`此操作将下推 ${sheetId} 单据, 是否继续?`, '提示', {
|
|
|
- confirmButtonText: '确定',
|
|
|
- cancelButtonText: '取消',
|
|
|
- type: 'warning'
|
|
|
- })
|
|
|
- .then(() => {
|
|
|
- this.listLoading = true
|
|
|
- pushPurchaseSheet({ sheetId: sheetId }).then(
|
|
|
- () => {
|
|
|
- setTimeout(() => {
|
|
|
- // this.$successMsg('下推成功')
|
|
|
- this.$confirm(`是否跳转到采购入库单 ${sheetId} 单据,是否继续?`, '下推成功', {
|
|
|
- confirmButtonText: '确定',
|
|
|
- cancelButtonText: '取消',
|
|
|
- type: 'success'
|
|
|
- })
|
|
|
- .then(() => {
|
|
|
- this.$router.push({
|
|
|
- name: 'purchase-in-stock-sheet',
|
|
|
- params: {
|
|
|
- sheetId
|
|
|
- }
|
|
|
- })
|
|
|
- })
|
|
|
- .catch(() => this.getList())
|
|
|
- this.listLoading = false
|
|
|
- }, 2000)
|
|
|
- },
|
|
|
- () => {
|
|
|
- this.listLoading = false
|
|
|
- }
|
|
|
- )
|
|
|
- })
|
|
|
- .catch(() => console.log('取消'))
|
|
|
- },
|
|
|
-
|
|
|
- // 导出
|
|
|
- exportSheet() {
|
|
|
- const screenData = {
|
|
|
- flag: this.screenForm.flag,
|
|
|
- venderName: this.screenForm.keyword,
|
|
|
- sheetId: this.screenForm.sheetId,
|
|
|
- startTime: this.screenForm.createTime ? this.screenForm.createTime[0] : '',
|
|
|
- endTime: this.screenForm.createTime ? this.screenForm.createTime[1] : ''
|
|
|
- }
|
|
|
- downloadFiles('shop/purchase/export', screenData)
|
|
|
- },
|
|
|
- // 下载导入模版
|
|
|
- handleDownload() {
|
|
|
- downloadFiles('shop/purchase/template/download')
|
|
|
- },
|
|
|
- // 导入
|
|
|
- async handleImport(param) {
|
|
|
- this.importLoading = true
|
|
|
- const file = param.file
|
|
|
- const formData = new FormData()
|
|
|
- formData.append('file', file)
|
|
|
- const result = await handleImport('shop/purchase/import', formData)
|
|
|
- this.importLoading = false
|
|
|
- this.importFileList = []
|
|
|
- if (result.code === 1) {
|
|
|
- this.$successMsg('导入成功')
|
|
|
- this.$refs.pageRef.refreshList()
|
|
|
- } else {
|
|
|
- await this.$alert(result.message, '导入失败', {
|
|
|
- confirmButtonText: '确定'
|
|
|
- })
|
|
|
- }
|
|
|
- },
|
|
|
- // 复制 采购入库单
|
|
|
- copySheet(sheetId) {
|
|
|
- copyPurchaseSheet({ sheetId: sheetId }).then(() => {
|
|
|
- this.$refs.pageRef.refreshList()
|
|
|
- this.$successMsg('复制成功')
|
|
|
- })
|
|
|
- },
|
|
|
- // 操作事件
|
|
|
- handleCommand(param) {
|
|
|
- if (param[1] === 'view' || param[1] === 'edit') {
|
|
|
- this.addOrEdit(param[1], param[0])
|
|
|
- } else {
|
|
|
- this[param[1] + 'Sheet'](param[0])
|
|
|
- }
|
|
|
- },
|
|
|
backUpdPage() {
|
|
|
this.$refs.pageRef.refreshList()
|
|
|
this.purchaseArea = false
|
|
|
},
|
|
|
// 列表请求函数
|
|
|
- getList(...p) {
|
|
|
- this.recordSelected = []
|
|
|
- return getNewPurchaseSheetList(...p)
|
|
|
- },
|
|
|
+ getList: getNewPurchaseSheetList,
|
|
|
// 列表导出函数
|
|
|
exportList: exportNewPurchaseSheetList,
|
|
|
// 表格列解析渲染数据更改
|
|
@@ -374,72 +135,44 @@ export default {
|
|
|
selectionChange(data) {
|
|
|
this.recordSelected = data
|
|
|
},
|
|
|
- operation() {
|
|
|
- return (h, { row, index, column }) => {
|
|
|
- return (
|
|
|
- <div class="operation-btns">
|
|
|
- <el-dropdown
|
|
|
- onCommand={p => {
|
|
|
- this.handleCommand(p)
|
|
|
- }}
|
|
|
- >
|
|
|
- <el-button type="text">
|
|
|
- 更多
|
|
|
- <i class="el-icon-arrow-down el-icon--right" />
|
|
|
- </el-button>
|
|
|
- <el-dropdown-menu slot="dropdown">
|
|
|
- {this.checkBtnRole('view') ? (
|
|
|
- <el-dropdown-item icon="el-icon-view" command={[row.sheetId, 'view']}>
|
|
|
- 查看
|
|
|
- </el-dropdown-item>
|
|
|
- ) : null}
|
|
|
- {row.flag === 2 ? (
|
|
|
- <div>
|
|
|
- {this.checkBtnRole('edit') ? (
|
|
|
- <el-dropdown-item icon="el-icon-edit" command={[row.sheetId, 'edit']}>
|
|
|
- 编辑
|
|
|
- </el-dropdown-item>
|
|
|
- ) : null}
|
|
|
|
|
|
- {this.checkBtnRole('confirm') ? (
|
|
|
- <el-dropdown-item icon="el-icon-circle-check" command={[row.sheetId, 'confirm']}>
|
|
|
- 审核
|
|
|
- </el-dropdown-item>
|
|
|
- ) : null}
|
|
|
- {this.checkBtnRole('revoke') ? (
|
|
|
- <el-dropdown-item icon="el-icon-unlock" command={[row.sheetId, 'revoke']}>
|
|
|
- 作废
|
|
|
- </el-dropdown-item>
|
|
|
- ) : null}
|
|
|
- </div>
|
|
|
- ) : null}
|
|
|
- {row.flag === 100 ? (
|
|
|
- <div>
|
|
|
- {this.checkBtnRole('unAudit') &&
|
|
|
- (row.execFlag === 1 || (row.execFlag === 3 && row.kingDeePosition === 1)) ? (
|
|
|
- <el-dropdown-item icon="el-icon-circle-check" command={[row.sheetId, 'unAudit']}>
|
|
|
- 反审
|
|
|
- </el-dropdown-item>
|
|
|
- ) : null}
|
|
|
- </div>
|
|
|
- ) : null}
|
|
|
- {this.checkBtnRole('push') && row.execFlag === 3 && row.kingDeePosition === 1 ? (
|
|
|
- <el-dropdown-item icon="el-icon-download" command={[row.sheetId, 'push']}>
|
|
|
- 下推
|
|
|
- </el-dropdown-item>
|
|
|
- ) : null}
|
|
|
- </el-dropdown-menu>
|
|
|
- </el-dropdown>
|
|
|
- </div>
|
|
|
- )
|
|
|
- }
|
|
|
+ operation() {
|
|
|
+ return this.operationBtn({
|
|
|
+ view: {
|
|
|
+ click: ({ row, index, column }) => {
|
|
|
+ this.addOrEdit('view', row.purchaseId)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ edit: {
|
|
|
+ conditions: ({ row, index, column }) => {
|
|
|
+ return row.flag === 'SAVE' && row.isRecheck === 'ON'
|
|
|
+ },
|
|
|
+ click: ({ row, index, column }) => {
|
|
|
+ this.addOrEdit('edit', row.purchaseId)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ confirm: {
|
|
|
+ prompt: '确定审核吗?',
|
|
|
+ conditions: ({ row, index, column }) => {
|
|
|
+ return row.flag === 'SUBMIT' && row.isRecheck === 'ON'
|
|
|
+ },
|
|
|
+ click: ({ row, index, column }) => {
|
|
|
+ this.confirmSheet(row.purchaseId)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ revoke: {
|
|
|
+ prompt: '确定撤消吗?',
|
|
|
+ conditions: ({ row, index, column }) => {
|
|
|
+ return row.flag === 'SUBMIT' && row.isRecheck === 'ON'
|
|
|
+ },
|
|
|
+ click: ({ row, index, column }) => {
|
|
|
+ this.revokeSheet(row.purchaseId)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
-<style scoped>
|
|
|
-.pdt {
|
|
|
- padding: 20px 20px 0 20px;
|
|
|
-}
|
|
|
-</style>
|
|
|
+<style scoped></style>
|