batchAuditNoModal.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. <template>
  2. <a-modal
  3. centered
  4. class="batchAuditModal-modal"
  5. :footer="null"
  6. :maskClosable="false"
  7. title="批量审核"
  8. v-model="isShow"
  9. @cancel="isShow=false"
  10. :width="900">
  11. <div class="batchAuditModal-con">
  12. <!-- 可导入数据 -->
  13. <p class="">可审核通过数据{{ loadData.length }}条</p>
  14. <a-table
  15. class="sTable"
  16. ref="table"
  17. size="small"
  18. :rowKey="(record) => record.allocateSn"
  19. :columns="nowColumns"
  20. :dataSource="loadData"
  21. :loading="loading"
  22. :scroll="{ y: 200 }"
  23. :pagination="false"
  24. bordered>
  25. </a-table>
  26. <a-divider />
  27. <!-- 不可导入数据 -->
  28. <p class="red">审核不通过数据{{ unLoadData.length }}条(成本价不一致)</p>
  29. <a-table
  30. class="unTable"
  31. ref="unTable"
  32. size="small"
  33. :rowKey="(record) => record.errorDesc"
  34. :columns="nowUnColumns"
  35. :dataSource="unLoadData"
  36. :loading="loading"
  37. :scroll="{ y: 200 }"
  38. :pagination="false"
  39. bordered>
  40. </a-table>
  41. <!-- 按钮 -->
  42. <div class="btn-con">
  43. <a-button
  44. type="primary"
  45. id="batchAuditModal-submit"
  46. size="large"
  47. :loading="spinning"
  48. :class="loadData.length==0?'button-grey':'button-primary'"
  49. @click="handleSubmit"
  50. style="padding: 0 40px;">确认审批</a-button>
  51. <a-button
  52. id="batchAuditModal-cancel"
  53. size="large"
  54. :loading="spinning"
  55. class="button-cancel"
  56. @click="isShow=false"
  57. style="padding: 0 40px;margin-left: 15px;">取消</a-button>
  58. <a-button
  59. type="primary"
  60. id="batchAuditModal-error"
  61. size="large"
  62. :loading="spinning"
  63. class="button-error"
  64. @click="handleError"
  65. style="padding: 0 40px;margin-left: 15px;">导出错误项</a-button>
  66. </div>
  67. </div>
  68. </a-modal>
  69. </template>
  70. <script>
  71. import { hdExportExcel } from '@/libs/exportExcel'
  72. import { sparePartsAuditVerify, sparePartsBatchAudit, sparePartsAuditFail } from '@/api/spareParts'
  73. export default {
  74. name: 'batchAudtiModal',
  75. props: {
  76. openModal: { // 弹框显示状态
  77. type: Boolean,
  78. default: false
  79. },
  80. },
  81. data () {
  82. return {
  83. isShow: this.openModal, // 是否打开弹框
  84. spinning: false,
  85. nowColumns: [
  86. { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
  87. { title: '创建时间', dataIndex: 'createDate', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
  88. { title: '入库单号', dataIndex: 'sparePartsNo', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
  89. { title: '入库类型', dataIndex: 'sparePartsTypeDictValue', width: '15%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  90. { title: '关联单号', dataIndex: 'relationNo', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
  91. { title: '金蝶单号', dataIndex: 'kingdeeNo', width: '20%', align: 'center', customRender: function (text) { return text || '--' } }
  92. ],
  93. loadData: [],
  94. nowUnColumns: [
  95. { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
  96. { title: '创建时间', dataIndex: 'createDate', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
  97. { title: '入库单号', dataIndex: 'sparePartsNo', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
  98. { title: '入库类型', dataIndex: 'sparePartsTypeDictValue', width: '15%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  99. { title: '关联单号', dataIndex: 'relationNo', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
  100. { title: '金蝶单号', dataIndex: 'kingdeeNo', width: '20%', align: 'center', customRender: function (text) { return text || '--' } }
  101. ],
  102. unLoadData: [],
  103. loading: false,
  104. snList: []
  105. }
  106. },
  107. methods: {
  108. getData (data) {
  109. if (data.okList && data.okList.length > 0) {
  110. data.okList.map((item, index) => {
  111. item.no = index + 1
  112. this.snList.push(item.sparePartsSn)
  113. })
  114. }
  115. if (data.errList && data.errList.length > 0) {
  116. data.errList.map((item, index) => {
  117. item.no = index + 1
  118. })
  119. }
  120. this.loadData = data.okList || []
  121. this.unLoadData = data.errList || []
  122. },
  123. // 确认导入
  124. handleSubmit () {
  125. if (this.loadData.length == 0) {
  126. this.$message.warning('没有可审核的数据!')
  127. } else {
  128. this.spinning = true
  129. sparePartsBatchAudit(this.snList).then(res => {
  130. if(res.status == 200){
  131. this.$emit('ok',res.message)
  132. this.isShow = false
  133. }
  134. this.spinning = false
  135. })
  136. }
  137. },
  138. // 导出
  139. handleError () {
  140. const _this = this
  141. if (_this.unLoadData.length < 1) {
  142. _this.$message.info('暂无可导出错误项~')
  143. return
  144. }
  145. _this.spinning = true
  146. hdExportExcel(sparePartsAuditFail, _this.unLoadData, '散件入库审核错误项', function () {
  147. _this.spinning = false
  148. })
  149. }
  150. },
  151. watch: {
  152. // 父页面传过来的弹框状态
  153. openModal (newValue, oldValue) {
  154. this.isShow = newValue
  155. },
  156. // 重定义的弹框状态
  157. isShow (newValue, oldValue) {
  158. if (!newValue) {
  159. this.$emit('close')
  160. this.loadData = []
  161. this.unLoadData = []
  162. this.snList = []
  163. }
  164. }
  165. }
  166. }
  167. </script>
  168. <style lang="less" scoped>
  169. .batchAuditModal-modal{
  170. .batchAuditModal-con{
  171. .red{
  172. color: #f30;
  173. }
  174. .btn-con{
  175. text-align: center;
  176. margin: 30px 0 20px;
  177. .button-cancel,.button-error{
  178. font-size: 12px;
  179. }
  180. }
  181. }
  182. }
  183. </style>