apply_examine.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  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.examineStatus | 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="16" 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="16" class="item">
  34. <div class="label">备注</div>
  35. <div class="value">{{detailData.remark}}</div>
  36. </el-col>
  37. <el-col :span="24" class="item file">
  38. <div class="label">附件</div>
  39. <div class="value">
  40. <div class="file-list" v-if="detailData.fileUrl">
  41. <div class="file-item">
  42. <el-image v-if="checkFileType(detailData.fileUrl) == 'image'" class="img" :src="imageURL + detailData.fileUrl" :preview-src-list="[imageURL + detailData.fileUrl]"></el-image>
  43. <div v-else class="box2" @click="openLink(detailData.fileUrl)">
  44. <img src="@/assets/common/word.png" v-if="checkFileType(detailData.fileUrl) == 'word'" />
  45. <img src="@/assets/common/excel.png" v-if="checkFileType(detailData.fileUrl) == 'excel'" />
  46. <img src="@/assets/common/ppt.png" v-if="checkFileType(detailData.fileUrl) == 'ppt'" />
  47. <img src="@/assets/common/pdf.png" v-if="checkFileType(detailData.fileUrl) == 'pdf'" />
  48. <div class="name ellipsis-3">{{ detailData.fileName }}</div>
  49. </div>
  50. </div>
  51. </div>
  52. </div>
  53. </el-col>
  54. <el-col :span="8" class="item">
  55. <div class="label">制单人</div>
  56. <div class="value">{{detailData.createBy}}</div>
  57. </el-col>
  58. <el-col :span="8" class="item">
  59. <div class="label">制单日期</div>
  60. <div class="value">{{detailData.createTime}}</div>
  61. </el-col>
  62. <el-col :span="8" class="item">
  63. <div class="label"></div>
  64. <div class="value"></div>
  65. </el-col>
  66. </el-row>
  67. </div>
  68. <div class="main-title">
  69. <div class="title">货品信息</div>
  70. </div>
  71. <div class="table" style="margin-top: 20px">
  72. <el-table :data="goodsList" element-loading-text="Loading" border fit highlight-current-row stripe max-height="400">
  73. <el-table-column align="center" label="序号" type="index" width="50"></el-table-column>
  74. <el-table-column align="center" label="销售类型" prop="saleTypeName" min-width="100" show-overflow-tooltip></el-table-column>
  75. <el-table-column align="center" label="销售订单号" prop="mainOrderId" min-width="140" show-overflow-tooltip></el-table-column>
  76. <el-table-column align="center" label="物料编码" prop="materialCode" min-width="120" show-overflow-tooltip></el-table-column>
  77. <el-table-column align="center" label="产品编码" prop="materialOldNumber" min-width="120" show-overflow-tooltip></el-table-column>
  78. <el-table-column align="center" label="产品名称" prop="materialName" min-width="160" show-overflow-tooltip></el-table-column>
  79. <el-table-column align="center" label="规格型号" prop="specification" min-width="160" show-overflow-tooltip></el-table-column>
  80. <el-table-column align="center" label="计量单位" prop="unit" min-width="100" show-overflow-tooltip></el-table-column>
  81. <el-table-column align="center" label="申请数量" prop="invoiceNum" min-width="100" show-overflow-tooltip></el-table-column>
  82. <el-table-column align="center" label="审批数量" prop="approvalNumber" min-width="100" show-overflow-tooltip>
  83. <template slot-scope="scope">
  84. <el-input v-model="scope.row.approvalNumber" size="small" type="number"></el-input>
  85. </template>
  86. </el-table-column>
  87. <el-table-column align="center" label="已退数量" prop="retiredQty" min-width="100" show-overflow-tooltip></el-table-column>
  88. <el-table-column align="center" label="备注" prop="remark" min-width="160" show-overflow-tooltip>
  89. <template slot-scope="scope">
  90. <el-input v-model="scope.row.remark" size="small"></el-input>
  91. </template>
  92. </el-table-column>
  93. </el-table>
  94. </div>
  95. <div class="main-title">
  96. <div class="title">审批信息</div>
  97. </div>
  98. <div class="diy-table-1">
  99. <el-row :gutter="0">
  100. <el-col :span="12" class="item">
  101. <div class="label">审批人</div>
  102. <div class="value">{{userName}}</div>
  103. </el-col>
  104. <el-col :span="12" class="item">
  105. <div class="label">审批结果</div>
  106. <div class="value">
  107. <el-radio-group v-model="examineForm.status">
  108. <el-radio :label="true">通过</el-radio>
  109. <el-radio :label="false">驳回</el-radio>
  110. </el-radio-group>
  111. </div>
  112. </el-col>
  113. <el-col :span="24" class="item">
  114. <div class="label">审批说明</div>
  115. <div class="value"><el-input v-model="examineForm.remark" placeholder="请输入内容"></el-input></div>
  116. </el-col>
  117. </el-row>
  118. </div>
  119. <div class="page-footer">
  120. <div class="footer">
  121. <el-button type="primary" @click="clickSubmitForm" :loading="formLoading">{{ formLoading ? '提交中 ...' : '提 交' }}</el-button>
  122. <el-popconfirm
  123. title="确定关闭吗?"
  124. @onConfirm="goBack"
  125. style="margin-left: 10px;"
  126. >
  127. <el-button slot="reference">关 闭</el-button>
  128. </el-popconfirm>
  129. </div>
  130. </div>
  131. </div>
  132. </template>
  133. <script>
  134. import { getApplyDetail, examineApply } from "@/api/supply/apply";
  135. export default {
  136. name: 'ApplyExamine',
  137. componentName: 'ApplyExamine',
  138. props: ['listItem'],
  139. filters: {
  140. statusFilter(val) {
  141. const statusList = [
  142. { label: '已保存', value: 'SAVE' },
  143. { label: '待审核', value: 'WAIT' },
  144. { label: '审核通过', value: 'OK' },
  145. { label: '审核驳回', value: 'FAIL' },
  146. { label: '已关闭', value: 'CLOSE' },
  147. ];
  148. let obj = statusList.find(o => o.value == val);
  149. return obj ? obj.label : ''
  150. }
  151. },
  152. data() {
  153. return {
  154. imageURL: this.$imageUrl,
  155. detailData: {},
  156. goodsList: [],
  157. userName: JSON.parse(localStorage.getItem("supply_user")).nickName,
  158. formLoading: false,
  159. examineForm: {
  160. status: true,
  161. remark: '',
  162. },
  163. }
  164. },
  165. created() {
  166. this.getDetail();
  167. },
  168. methods: {
  169. // 返回列表
  170. goBack() {
  171. this.$emit('backListFormDetail');
  172. },
  173. // 获取详情
  174. getDetail() {
  175. getApplyDetail({id: this.listItem.id}).then(res => {
  176. this.detailData = res.data;
  177. res.data.orders.forEach((item, index) => {
  178. item.approvalNumber = item.invoiceNum;
  179. });
  180. this.goodsList = res.data.orders;
  181. })
  182. },
  183. // 检查文件类型
  184. checkFileType(url) {
  185. if(!url) return '';
  186. const fileSuffix = url.substring(url.lastIndexOf(".") + 1);
  187. if (['jpg', 'jpeg', 'png'].includes(fileSuffix)) {
  188. return 'image';
  189. }else if (['doc', 'docx', 'dot', 'wps', 'wpt'].includes(fileSuffix)) {
  190. return 'word';
  191. }else if(['xls', 'xlsx', 'xlt', 'et', 'ett'].includes(fileSuffix)) {
  192. return 'excel';
  193. }else if(['ppt', 'pptx', 'dps', 'dpt', 'pot', 'pps'].includes(fileSuffix)) {
  194. return 'ppt';
  195. }else if(['pdf'].includes(fileSuffix)) {
  196. return 'pdf';
  197. }else {
  198. return '';
  199. }
  200. },
  201. // 打开链接
  202. openLink(url) {
  203. getFileUrl({key: url}).then(res => {
  204. window.open(res.data);
  205. })
  206. },
  207. // 提交审批
  208. clickSubmitForm() {
  209. for(let i=0; i<this.goodsList.length; i++) {
  210. if(this.goodsList[i].approvalNumber > this.goodsList[i].invoiceNum) {
  211. this.$errorMsg('审批数量不可大于申请数量');
  212. return;
  213. }
  214. }
  215. this.formLoading = true;
  216. examineApply({
  217. id: this.listItem.id,
  218. examineStatus: this.examineForm.status ? 'OK' : 'FAIL',
  219. approvalRemark: this.examineForm.remark,
  220. orders: this.goodsList
  221. }).then(res => {
  222. this.$successMsg('审批成功');
  223. this.goBack();
  224. this.$parent.getList();
  225. }).finally(res => {
  226. this.formLoading = false;
  227. })
  228. },
  229. }
  230. }
  231. </script>
  232. <style scoped lang="scss">
  233. .detail-container {
  234. width: 100%;
  235. height: 100%;
  236. }
  237. .main-title {
  238. display: flex;
  239. justify-content: space-between;
  240. align-items: center;
  241. margin-top: 20px;
  242. height: 60px;
  243. border-bottom: 1px solid #DCDFE6;
  244. margin-bottom: 20px;
  245. .title {
  246. font-size: 16px;
  247. font-weight: 600;
  248. padding-left: 10px;
  249. }
  250. }
  251. ::v-deep input::-webkit-outer-spin-button,
  252. ::v-deep input::-webkit-inner-spin-button {
  253. -webkit-appearance: none;
  254. }
  255. ::v-deep input[type='number'] {
  256. -moz-appearance: textfield;
  257. }
  258. </style>