apply_examine.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294
  1. <template>
  2. <div class="detail-container">
  3. <el-page-header @back="goBack" content="审批"></el-page-header>
  4. <div class="main-title">
  5. <div class="title">发货申请单信息</div>
  6. </div>
  7. <div class="diy-table-1">
  8. <el-row>
  9. <el-col :span="8" class="item">
  10. <div class="label">发货申请单号</div>
  11. <div class="value">{{detailData.id}}</div>
  12. </el-col>
  13. <el-col :span="8" class="item">
  14. <div class="label">申请日期</div>
  15. <div class="value">{{detailData.createTime}}</div>
  16. </el-col>
  17. <el-col :span="8" class="item">
  18. <div class="label">单据状态</div>
  19. <div class="value">{{detailData.status | statusFilter}}</div>
  20. </el-col>
  21. <el-col :span="8" class="item">
  22. <div class="label">经销商编号</div>
  23. <div class="value">{{detailData.customerNumber}}</div>
  24. </el-col>
  25. <el-col :span="8" class="item">
  26. <div class="label">经销商名称</div>
  27. <div class="value">{{detailData.customerName}}</div>
  28. </el-col>
  29. <el-col :span="8" class="item">
  30. <div class="label">仓库</div>
  31. <div class="value">{{detailData.correspondName}}</div>
  32. </el-col>
  33. <el-col :span="24" class="item">
  34. <div class="label">备注</div>
  35. <div class="value">{{detailData.remark}}</div>
  36. </el-col>
  37. <el-col :span="8" class="item">
  38. <div class="label">制单人</div>
  39. <div class="value">{{detailData.createBy}}</div>
  40. </el-col>
  41. <el-col :span="8" class="item">
  42. <div class="label">制单日期</div>
  43. <div class="value">{{detailData.createTime}}</div>
  44. </el-col>
  45. <el-col :span="8" class="item">
  46. <div class="label"></div>
  47. <div class="value"></div>
  48. </el-col>
  49. </el-row>
  50. </div>
  51. <div class="main-title">
  52. <div class="title">货品信息</div>
  53. </div>
  54. <div class="table" style="margin-top: 20px">
  55. <el-table :data="goodsList" element-loading-text="Loading" border fit highlight-current-row stripe max-height="400">
  56. <el-table-column align="center" label="序号" type="index" width="50"></el-table-column>
  57. <el-table-column align="center" label="销售类型" prop="saleTypeName" min-width="100" show-overflow-tooltip></el-table-column>
  58. <el-table-column align="center" label="发货仓库" prop="stockIds" min-width="160" show-overflow-tooltip>
  59. <template slot-scope="scope">
  60. <el-select v-model="scope.row.stockIds" placeholder="请选择发货仓库" size="small" multiple filterable @change="changeWarehouse(scope.$index)">
  61. <el-option :label="item.name" :value="item.id" v-for="(item, index) in positionList" :key="index"></el-option>
  62. </el-select>
  63. </template>
  64. </el-table-column>
  65. <el-table-column align="center" label="库存数" prop="stockNumber" min-width="100" show-overflow-tooltip></el-table-column>
  66. <el-table-column align="center" label="销售订单号" prop="retailOrderId" min-width="180" show-overflow-tooltip></el-table-column>
  67. <el-table-column align="center" label="产品编码" prop="materialCode" min-width="120" show-overflow-tooltip></el-table-column>
  68. <el-table-column align="center" label="产品名称" prop="materialName" min-width="160" show-overflow-tooltip></el-table-column>
  69. <el-table-column align="center" label="规格型号" prop="specification" min-width="160" show-overflow-tooltip></el-table-column>
  70. <el-table-column align="center" label="计量单位" prop="unit" min-width="100" show-overflow-tooltip></el-table-column>
  71. <el-table-column align="center" label="申请数量" prop="invoiceNum" min-width="100" show-overflow-tooltip></el-table-column>
  72. <el-table-column align="center" label="审批数量" prop="approvalNumber" min-width="100" show-overflow-tooltip>
  73. <template slot-scope="scope">
  74. <el-input v-model="scope.row.approvalNumber" size="small" type="number"></el-input>
  75. </template>
  76. </el-table-column>
  77. <el-table-column align="center" label="备注" prop="remark" min-width="160" show-overflow-tooltip>
  78. <template slot-scope="scope">
  79. <el-input v-model="scope.row.remark" size="small"></el-input>
  80. </template>
  81. </el-table-column>
  82. </el-table>
  83. </div>
  84. <div class="main-title">
  85. <div class="title">审批信息</div>
  86. </div>
  87. <div class="diy-table-1">
  88. <el-row :gutter="0">
  89. <el-col :span="12" class="item">
  90. <div class="label">审批人</div>
  91. <div class="value">{{userName}}</div>
  92. </el-col>
  93. <el-col :span="12" class="item">
  94. <div class="label">审批结果</div>
  95. <div class="value">
  96. <el-radio-group v-model="examineForm.status">
  97. <el-radio :label="true">通过</el-radio>
  98. <el-radio :label="false">驳回</el-radio>
  99. </el-radio-group>
  100. </div>
  101. </el-col>
  102. <el-col :span="24" class="item">
  103. <div class="label">审批说明</div>
  104. <div class="value"><el-input v-model="examineForm.remark" placeholder="请输入内容"></el-input></div>
  105. </el-col>
  106. </el-row>
  107. </div>
  108. <div class="page-footer">
  109. <div class="footer" :class="classObj">
  110. <el-button type="primary" @click="clickSubmitForm" :loading="formLoading">{{ formLoading ? '提交中 ...' : '提 交' }}</el-button>
  111. <el-popconfirm
  112. title="确定关闭吗?"
  113. @onConfirm="goBack"
  114. style="margin-left: 10px;"
  115. >
  116. <el-button slot="reference">关 闭</el-button>
  117. </el-popconfirm>
  118. </div>
  119. </div>
  120. </div>
  121. </template>
  122. <script>
  123. import { getApplyDetail, examineApply, getPositionList, checkStock } from "@/api/supply/apply";
  124. export default {
  125. name: 'ApplyExamine',
  126. componentName: 'ApplyExamine',
  127. props: ['listItem'],
  128. filters: {
  129. statusFilter(val) {
  130. const statusList = [
  131. { label: '已保存', value: 1 },
  132. { label: '待审核', value: 2 },
  133. { label: '审核通过', value: 3 },
  134. { label: '审核驳回', value: 4 },
  135. ];
  136. let obj = statusList.find(o => o.value == val);
  137. return obj ? obj.label : ''
  138. }
  139. },
  140. data() {
  141. return {
  142. detailData: {},
  143. goodsList: [],
  144. userName: JSON.parse(localStorage.getItem("supply_user")).nickName,
  145. formLoading: false,
  146. examineForm: {
  147. status: true,
  148. remark: '',
  149. },
  150. positionList: [],
  151. }
  152. },
  153. computed: {
  154. sidebar() {
  155. return this.$store.state.app.sidebar
  156. },
  157. classObj() {
  158. return {
  159. hideSidebar: !this.sidebar.opened,
  160. openSidebar: this.sidebar.opened
  161. }
  162. },
  163. },
  164. created() {
  165. this.getDetail();
  166. },
  167. methods: {
  168. // 返回列表
  169. goBack() {
  170. this.$emit('backListFormDetail');
  171. },
  172. // 获取详情
  173. getDetail() {
  174. getApplyDetail({id: this.listItem.id}).then(res => {
  175. this.detailData = res.data;
  176. res.data.orders.forEach((item, index) => {
  177. if(item.stockIds && item.stockIds.length > 0) {
  178. item.stockIds = item.stockIds.map((it, idx) => {
  179. return it.id;
  180. });
  181. }
  182. });
  183. this.goodsList = res.data.orders;
  184. this.getPositionList();
  185. })
  186. },
  187. // 获取仓位列表
  188. getPositionList() {
  189. getPositionList({
  190. correspondId: this.detailData.correspondId
  191. }).then((res) => {
  192. this.positionList = res.data;
  193. })
  194. },
  195. // 修改仓位
  196. changeWarehouse(index) {
  197. if(this.goodsList[index].stockIds && this.goodsList[index].stockIds.length > 0) {
  198. checkStock({
  199. materialId: this.goodsList[index].materialId,
  200. StockIds: this.goodsList[index].stockIds.join(',')
  201. }).then(res => {
  202. this.goodsList[index].stockNumber = res.data;
  203. })
  204. }else {
  205. this.goodsList[index].stockNumber = 0;
  206. }
  207. },
  208. // 提交审批
  209. clickSubmitForm() {
  210. for(let i=0; i<this.goodsList.length; i++) {
  211. if(this.goodsList[i].stockIds && this.goodsList[i].stockIds.length < 1) {
  212. this.$errorMsg('请选择发货仓库');
  213. return;
  214. }
  215. if(this.goodsList[i].stockNumber < 1) {
  216. this.$errorMsg('库存不足');
  217. return;
  218. }
  219. if(this.goodsList[i].approvalNumber > this.goodsList[i].stockNumber) {
  220. this.$errorMsg('审批数量不可大于库存数');
  221. return;
  222. }
  223. if(this.goodsList[i].approvalNumber > this.goodsList[i].invoiceNum) {
  224. this.$errorMsg('审批数量不可大于申请数量');
  225. return;
  226. }
  227. }
  228. this.formLoading = true;
  229. examineApply({
  230. id: this.listItem.id,
  231. status: this.examineForm.status ? 3 : 4,
  232. approvalRemark: this.examineForm.remark,
  233. orders: this.goodsList
  234. }).then(res => {
  235. this.$successMsg('审批成功');
  236. this.goBack();
  237. this.$parent.getList();
  238. }).finally(res => {
  239. this.formLoading = false;
  240. })
  241. },
  242. }
  243. }
  244. </script>
  245. <style scoped lang="scss">
  246. .detail-container {
  247. width: 100%;
  248. height: 100%;
  249. }
  250. .main-title {
  251. display: flex;
  252. justify-content: space-between;
  253. align-items: center;
  254. margin-top: 20px;
  255. height: 60px;
  256. border-bottom: 1px solid #DCDFE6;
  257. margin-bottom: 20px;
  258. .title {
  259. font-size: 16px;
  260. font-weight: 600;
  261. padding-left: 10px;
  262. }
  263. }
  264. ::v-deep input::-webkit-outer-spin-button,
  265. ::v-deep input::-webkit-inner-spin-button {
  266. -webkit-appearance: none;
  267. }
  268. ::v-deep input[type='number'] {
  269. -moz-appearance: textfield;
  270. }
  271. </style>