apply_examine.vue 9.4 KB

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