123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185 |
- <template>
- <a-modal
- centered
- class="batchAuditModal-modal"
- :footer="null"
- :maskClosable="false"
- title="批量审核"
- v-model="isShow"
- @cancel="isShow=false"
- :width="900">
- <div class="batchAuditModal-con">
- <!-- 可导入数据 -->
- <p class="">可审核通过数据{{ loadData.length }}条</p>
- <a-table
- class="sTable"
- ref="table"
- size="small"
- :rowKey="(record) => record.allocateSn"
- :columns="nowColumns"
- :dataSource="loadData"
- :loading="loading"
- :scroll="{ y: 200 }"
- :pagination="false"
- bordered>
- </a-table>
- <a-divider />
- <!-- 不可导入数据 -->
- <p class="red">审核不通过数据{{ unLoadData.length }}条(成本价不一致)</p>
- <a-table
- class="unTable"
- ref="unTable"
- size="small"
- :rowKey="(record) => record.errorDesc"
- :columns="nowUnColumns"
- :dataSource="unLoadData"
- :loading="loading"
- :scroll="{ y: 200 }"
- :pagination="false"
- bordered>
- </a-table>
- <!-- 按钮 -->
- <div class="btn-con">
- <a-button
- type="primary"
- id="batchAuditModal-submit"
- size="large"
- :loading="spinning"
- :class="loadData.length==0?'button-grey':'button-primary'"
- @click="handleSubmit"
- style="padding: 0 40px;">确认审批</a-button>
- <a-button
- id="batchAuditModal-cancel"
- size="large"
- :loading="spinning"
- class="button-cancel"
- @click="isShow=false"
- style="padding: 0 40px;margin-left: 15px;">取消</a-button>
- <a-button
- type="primary"
- id="batchAuditModal-error"
- size="large"
- :loading="spinning"
- class="button-error"
- @click="handleError"
- style="padding: 0 40px;margin-left: 15px;">导出错误项</a-button>
- </div>
- </div>
- </a-modal>
- </template>
- <script>
- import { hdExportExcel } from '@/libs/exportExcel'
- import { sparePartsAuditVerify, sparePartsBatchAudit, sparePartsAuditFail } from '@/api/spareParts'
- export default {
- name: 'batchAudtiModal',
- props: {
- openModal: { // 弹框显示状态
- type: Boolean,
- default: false
- },
- },
- data () {
- return {
- isShow: this.openModal, // 是否打开弹框
- spinning: false,
- nowColumns: [
- { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
- { title: '创建时间', dataIndex: 'createDate', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '入库单号', dataIndex: 'sparePartsNo', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '入库类型', dataIndex: 'sparePartsTypeDictValue', width: '15%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '关联单号', dataIndex: 'relationNo', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '金蝶单号', dataIndex: 'kingdeeNo', width: '20%', align: 'center', customRender: function (text) { return text || '--' } }
- ],
- loadData: [],
- nowUnColumns: [
- { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
- { title: '创建时间', dataIndex: 'createDate', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '入库单号', dataIndex: 'sparePartsNo', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '入库类型', dataIndex: 'sparePartsTypeDictValue', width: '15%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '关联单号', dataIndex: 'relationNo', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '金蝶单号', dataIndex: 'kingdeeNo', width: '20%', align: 'center', customRender: function (text) { return text || '--' } }
- ],
- unLoadData: [],
- loading: false,
- snList: []
- }
- },
- methods: {
- getData (data) {
- if (data.okList && data.okList.length > 0) {
- data.okList.map((item, index) => {
- item.no = index + 1
- this.snList.push(item.sparePartsSn)
- })
- }
- if (data.errList && data.errList.length > 0) {
- data.errList.map((item, index) => {
- item.no = index + 1
- })
- }
- this.loadData = data.okList || []
- this.unLoadData = data.errList || []
- },
- // 确认导入
- handleSubmit () {
- if (this.loadData.length == 0) {
- this.$message.warning('没有可审核的数据!')
- } else {
- this.spinning = true
- sparePartsBatchAudit(this.snList).then(res => {
- if(res.status == 200){
- this.$emit('ok',res.message)
- this.isShow = false
- }
- this.spinning = false
- })
- }
- },
- // 导出
- handleError () {
- const _this = this
- if (_this.unLoadData.length < 1) {
- _this.$message.info('暂无可导出错误项~')
- return
- }
- _this.spinning = true
- hdExportExcel(sparePartsAuditFail, _this.unLoadData, '散件入库审核错误项', function () {
- _this.spinning = false
- })
- }
- },
- watch: {
- // 父页面传过来的弹框状态
- openModal (newValue, oldValue) {
- this.isShow = newValue
- },
- // 重定义的弹框状态
- isShow (newValue, oldValue) {
- if (!newValue) {
- this.$emit('close')
- this.loadData = []
- this.unLoadData = []
- this.snList = []
- }
- }
- }
- }
- </script>
- <style lang="less" scoped>
- .batchAuditModal-modal{
- .batchAuditModal-con{
- .red{
- color: #f30;
- }
- .btn-con{
- text-align: center;
- margin: 30px 0 20px;
- .button-cancel,.button-error{
- font-size: 12px;
- }
- }
- }
- }
- </style>
|