engin_detail.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452
  1. <template>
  2. <div class="detail-container">
  3. <div v-show="!isShowPrint">
  4. <el-page-header @back="goBack" content="详情"></el-page-header>
  5. <div class="main-title">
  6. <div class="title">工程发货申请单信息</div>
  7. </div>
  8. <div class="diy-table-1">
  9. <el-row>
  10. <el-col :span="8" class="item">
  11. <div class="label">发货申请单号</div>
  12. <div class="value">{{detailData.id}}</div>
  13. </el-col>
  14. <el-col :span="8" class="item">
  15. <div class="label">申请日期</div>
  16. <div class="value">{{detailData.createTime}}</div>
  17. </el-col>
  18. <el-col :span="8" class="item">
  19. <div class="label">单据状态</div>
  20. <div class="value">{{detailData.examineStatus | statusFilter}}</div>
  21. </el-col>
  22. <el-col :span="8" class="item">
  23. <div class="label">经销商编号</div>
  24. <div class="value">{{detailData.customerNumber}}</div>
  25. </el-col>
  26. <el-col :span="16" class="item">
  27. <div class="label">经销商名称</div>
  28. <div class="value">{{detailData.customerName}}</div>
  29. </el-col>
  30. <el-col :span="8" class="item">
  31. <div class="label">工程登录编号</div>
  32. <div class="value">{{detailData.refEnginRecordNo}}</div>
  33. </el-col>
  34. <el-col :span="8" class="item">
  35. <div class="label">项目类别</div>
  36. <div class="value">{{detailData.refProjectCategory}}</div>
  37. </el-col>
  38. <el-col :span="8" class="item">
  39. <div class="label">项目名称</div>
  40. <div class="value">{{detailData.refProjectName}}</div>
  41. </el-col>
  42. <el-col :span="8" class="item" v-if="!isCustomer">
  43. <div class="label">文件编号</div>
  44. <div class="value">{{detailData.fileNo}}</div>
  45. </el-col>
  46. <el-col :span="8" class="item">
  47. <div class="label">工程登录类型</div>
  48. <div class="value">{{detailData.enginOrderType | enginTypeFilter}}</div>
  49. </el-col>
  50. <el-col :span="8" class="item">
  51. <div class="label">跨厂区编号</div>
  52. <div class="value">{{detailData.refFactoryNo}}</div>
  53. </el-col>
  54. <el-col :span="8" class="item">
  55. <div class="label">使用单位</div>
  56. <div class="value">{{detailData.refUseUnit}}</div>
  57. </el-col>
  58. <el-col :span="24" class="item">
  59. <div class="label">行业类别</div>
  60. <div class="value">{{detailData.refTradeCategory}}</div>
  61. </el-col>
  62. <el-col :span="8" class="item">
  63. <div class="label">联系人</div>
  64. <div class="value">{{detailData.refLinkman}}</div>
  65. </el-col>
  66. <el-col :span="8" class="item">
  67. <div class="label">固定电话</div>
  68. <div class="value">{{detailData.refTel}}</div>
  69. </el-col>
  70. <el-col :span="8" class="item">
  71. <div class="label">移动电话</div>
  72. <div class="value">{{detailData.refPhone}}</div>
  73. </el-col>
  74. <el-col :span="24" class="item">
  75. <div class="label">安装地址</div>
  76. <div class="value">{{detailData.refInstallAddress}}</div>
  77. </el-col>
  78. <el-col :span="24" class="item">
  79. <div class="label">备注</div>
  80. <div class="value">{{detailData.remark}}</div>
  81. </el-col>
  82. <el-col :span="24" class="item file">
  83. <div class="label">附件</div>
  84. <div class="value">
  85. <div class="file-list" v-if="detailData.fileUrl">
  86. <div class="file-item">
  87. <el-image v-if="checkFileType(detailData.fileUrl) == 'image'" class="img" :src="imageURL + detailData.fileUrl" :preview-src-list="[imageURL + detailData.fileUrl]"></el-image>
  88. <div v-else class="box2" @click="openLink(detailData.fileUrl)">
  89. <img src="@/assets/common/word.png" v-if="checkFileType(detailData.fileUrl) == 'word'" />
  90. <img src="@/assets/common/excel.png" v-if="checkFileType(detailData.fileUrl) == 'excel'" />
  91. <img src="@/assets/common/ppt.png" v-if="checkFileType(detailData.fileUrl) == 'ppt'" />
  92. <img src="@/assets/common/pdf.png" v-if="checkFileType(detailData.fileUrl) == 'pdf'" />
  93. <div class="name ellipsis-3">{{ detailData.fileName }}</div>
  94. </div>
  95. </div>
  96. </div>
  97. </div>
  98. </el-col>
  99. <el-col :span="6" class="item">
  100. <div class="label">制单人</div>
  101. <div class="value">{{detailData.createBy}}</div>
  102. </el-col>
  103. <el-col :span="6" class="item">
  104. <div class="label">制单日期</div>
  105. <div class="value">{{detailData.createTime}}</div>
  106. </el-col>
  107. <el-col :span="6" class="item">
  108. <div class="label">审核人</div>
  109. <div class="value">{{detailData.approvalName}}</div>
  110. </el-col>
  111. <el-col :span="6" class="item">
  112. <div class="label">审核日期</div>
  113. <div class="value">{{detailData.approvalTime}}</div>
  114. </el-col>
  115. <el-col :span="24" class="item">
  116. <div class="label">审批说明</div>
  117. <div class="value">{{detailData.approvalRemark}}</div>
  118. </el-col>
  119. </el-row>
  120. </div>
  121. <div class="main-title">
  122. <div class="title">货品信息</div>
  123. </div>
  124. <div class="table" style="margin-top: 20px">
  125. <el-table
  126. :data="detailData.orders"
  127. element-loading-text="Loading"
  128. border
  129. fit
  130. highlight-current-row
  131. stripe
  132. show-summary
  133. :summary-method="$getSummaries">
  134. <el-table-column align="center" label="序号" type="index" width="50"></el-table-column>
  135. <el-table-column align="left" label="销售类型" prop="saleTypeName" min-width="100" show-overflow-tooltip></el-table-column>
  136. <el-table-column align="left" label="订单日期" prop="theTime" min-width="160" show-overflow-tooltip></el-table-column>
  137. <el-table-column align="left" label="销售订单号" prop="enginOrderNo" min-width="120" show-overflow-tooltip></el-table-column>
  138. <el-table-column align="left" label="物料编码" prop="materialCode" min-width="120" show-overflow-tooltip></el-table-column>
  139. <el-table-column align="left" label="产品编码" prop="materialOldNumber" min-width="120" show-overflow-tooltip></el-table-column>
  140. <el-table-column align="left" label="产品名称" prop="materialName" min-width="160" show-overflow-tooltip></el-table-column>
  141. <el-table-column align="left" label="规格型号" prop="specification" min-width="350" show-overflow-tooltip></el-table-column>
  142. <el-table-column align="left" label="单位" prop="unit" min-width="100" show-overflow-tooltip></el-table-column>
  143. <!-- <el-table-column align="left" label="文件编号" prop="itemFileNo" min-width="200" show-overflow-tooltip>
  144. </el-table-column> -->
  145. <el-table-column align="right" label="含税单价" prop="singlePayPrice" min-width="100" show-overflow-tooltip>
  146. <template slot-scope="scope">
  147. {{scope.row.singlePayPrice | numToFixed}}
  148. </template>
  149. </el-table-column>
  150. <el-table-column align="right" label="价税合计" prop="payAmount" min-width="100" show-overflow-tooltip>
  151. <template slot-scope="scope">
  152. {{scope.row.payAmount | numToFixed}}
  153. </template>
  154. </el-table-column>
  155. <el-table-column align="right" label="返利金额" prop="payRebateAmount" min-width="100" show-overflow-tooltip>
  156. <template slot-scope="scope">
  157. {{scope.row.payRebateAmount | numToFixed}}
  158. </template>
  159. </el-table-column>
  160. <el-table-column align="right" label="格力折扣" prop="totalDiscAmount" min-width="100" show-overflow-tooltip>
  161. <template slot-scope="scope">
  162. {{scope.row.totalDiscAmount | numToFixed}}
  163. </template>
  164. </el-table-column>
  165. <el-table-column align="right" label="申请数量" prop="refundableQty" min-width="100" show-overflow-tooltip></el-table-column>
  166. <el-table-column align="right" label="审批数量" prop="approvalNumber" min-width="100" show-overflow-tooltip></el-table-column>
  167. <el-table-column align="left" label="表体备注" prop="headerRemark" min-width="160" show-overflow-tooltip></el-table-column>
  168. <!-- <el-table-column align="left" label="发货申请备注" prop="remark" min-width="160" show-overflow-tooltip></el-table-column> -->
  169. <el-table-column align="left" label="表体备注" prop="invoiceRemark" min-width="160" show-overflow-tooltip></el-table-column>
  170. <el-table-column align="left" label="业务员" prop="serviceName" min-width="100" show-overflow-tooltip></el-table-column>
  171. <el-table-column align="left" label="表头业务员" prop="k3ServiceName" min-width="100" show-overflow-tooltip></el-table-column>
  172. </el-table>
  173. </div>
  174. <div v-if="isExamine">
  175. <div class="main-title">
  176. <div class="title">审批记录</div>
  177. </div>
  178. <div class="diy-table-1">
  179. <el-row :gutter="0">
  180. <el-col :span="12" class="item">
  181. <div class="label">审批人</div>
  182. <div class="value">{{detailData.approvalName}}</div>
  183. </el-col>
  184. <el-col :span="12" class="item">
  185. <div class="label">审批结果</div>
  186. <div class="value">{{detailData.examineStatus | statusFilter}}</div>
  187. </el-col>
  188. <el-col :span="24" class="item">
  189. <div class="label">审批说明</div>
  190. <div class="value">{{detailData.approvalRemark}}</div>
  191. </el-col>
  192. </el-row>
  193. </div>
  194. </div>
  195. <div class="page-footer">
  196. <div class="footer">
  197. <el-button type="primary" icon="el-icon-printer" @click="toPrint" :disabled="detailData.examineStatus !== 'OK'">打 印</el-button>
  198. <el-popconfirm title="确定关闭吗?" @onConfirm="goBack" style="margin-left: 10px;">
  199. <el-button slot="reference">关 闭</el-button>
  200. </el-popconfirm>
  201. </div>
  202. </div>
  203. </div>
  204. <!-- <print-preview ref="preView" /> -->
  205. <CommonPrint :printId="printId" :printType="printType" v-if="isShowPrint" @backDetail="backDetail" />
  206. </div>
  207. </template>
  208. <script>
  209. import { getEnginDetail } from "@/api/supply/apply";
  210. import { getFileUrl } from '@/api/common';
  211. import { disAutoConnect, hiprint, defaultElementTypeProvider } from 'vue-plugin-hiprint'
  212. disAutoConnect();
  213. import panel from './design/panel'
  214. import { getDetail, detailArr } from './design/print-data'
  215. import printPreview from './design/preview.vue'
  216. import CommonPrint from "@/views/supply/deliver/components/common_print";
  217. export default {
  218. name: 'EnginDetail',
  219. componentName: 'EnginDetail',
  220. props: ['listItem'],
  221. components: {
  222. CommonPrint,
  223. printPreview
  224. },
  225. filters: {
  226. statusFilter(val) {
  227. const statusList = [
  228. { label: '已保存', value: 'SAVE' },
  229. { label: '待审核', value: 'WAIT' },
  230. { label: '审核通过', value: 'OK' },
  231. // { label: '审核驳回', value: 'FAIL' },,
  232. { label: '已关闭', value: 'CLOSE' },
  233. ];
  234. let obj = statusList.find(o => o.value == val);
  235. return obj ? obj.label : ''
  236. },
  237. enginTypeFilter(val) {
  238. const MAP = {
  239. HOME: '家用',
  240. TRADE: '商用',
  241. }
  242. return MAP[val];
  243. }
  244. },
  245. data() {
  246. return {
  247. imageURL: this.$imageUrl,
  248. detailData: {},
  249. printType: 1,
  250. printId: '',
  251. isShowPrint: false,
  252. isCustomer: JSON.parse(localStorage.getItem("supply_user")).isCustomer,
  253. curPaper: {
  254. type: 'A5',
  255. width: 500,
  256. height: 147.6
  257. },
  258. paperTypes: {
  259. 'A3': {
  260. width: 420,
  261. height: 296.6
  262. },
  263. 'A4': {
  264. width: 210,
  265. height: 296.6
  266. },
  267. 'A5': {
  268. width: 210,
  269. height: 147.6
  270. },
  271. 'B3': {
  272. width: 500,
  273. height: 352.6
  274. },
  275. 'B4': {
  276. width: 250,
  277. height: 352.6
  278. },
  279. 'B5': {
  280. width: 250,
  281. height: 175.6
  282. }
  283. },
  284. scaleValue: 1,
  285. scaleMax: 5,
  286. scaleMin: 0.5,
  287. hiprintTemplate:'',
  288. }
  289. },
  290. computed: {
  291. isExamine() {
  292. return this.detailData.examineStatus === 'OK' || this.detailData.examineStatus === "FAIL"
  293. },
  294. curPaperType() {
  295. let type = 'other'
  296. let types = this.paperTypes
  297. for (const key in types) {
  298. let item = types[key]
  299. let { width, height } = this.curPaper
  300. if (item.width === width && item.height === height) {
  301. type = key
  302. }
  303. }
  304. return type
  305. }
  306. },
  307. created() {
  308. this.getDetail();
  309. },
  310. mounted() {
  311. this.initPrint()
  312. },
  313. activated(){
  314. this.initPrint()
  315. },
  316. methods: {
  317. // 返回列表
  318. goBack() {
  319. this.$emit('backListFormDetail');
  320. },
  321. initPrint(){
  322. hiprint.init({
  323. providers: [new defaultElementTypeProvider()]
  324. });
  325. // 还原配置
  326. hiprint.setConfig()
  327. // 替换配置
  328. hiprint.setConfig({
  329. movingDistance: 2.5,
  330. text: {
  331. supportOptions: [
  332. {
  333. name: 'styler',
  334. hidden: true
  335. },
  336. {
  337. name: 'formatter',
  338. hidden: true
  339. },
  340. ]
  341. }
  342. })
  343. // eslint-disable-next-line no-undef
  344. hiprint.PrintElementTypeManager.buildByHtml($('.ep-draggable-item'));
  345. this.hiprintTemplate = new hiprint.PrintTemplate({
  346. template: panel,
  347. settingContainer: '#PrintElementOptionSetting',
  348. paginationContainer: '.hiprint-printPagination'
  349. });
  350. this.hiprintTemplate.design('#hiprint-printTemplate');
  351. // 获取当前放大比例, 当zoom时传true 才会有
  352. // this.scaleValue = hiprintTemplate.editingPanel.scale || 1;
  353. }
  354. ,
  355. // 获取详情
  356. getDetail() {
  357. getEnginDetail({id: this.listItem.id}).then(res => {
  358. if(res.data.orders) {
  359. res.data.orders.forEach(item => {
  360. item.sums1 = ['refundableQty', 'approvalNumber'];
  361. item.sums2 = ['singlePayPrice', 'payAmount', 'payRebateAmount', 'totalDiscAmount'];
  362. })
  363. }
  364. this.detailData = res.data;
  365. })
  366. },
  367. // 检查文件类型
  368. checkFileType(url) {
  369. if(!url) return '';
  370. const fileSuffix = url.substring(url.lastIndexOf(".") + 1);
  371. if (['jpg', 'jpeg', 'png'].includes(fileSuffix)) {
  372. return 'image';
  373. }else if (['doc', 'docx', 'dot', 'wps', 'wpt'].includes(fileSuffix)) {
  374. return 'word';
  375. }else if(['xls', 'xlsx', 'xlt', 'et', 'ett'].includes(fileSuffix)) {
  376. return 'excel';
  377. }else if(['ppt', 'pptx', 'dps', 'dpt', 'pot', 'pps'].includes(fileSuffix)) {
  378. return 'ppt';
  379. }else if(['pdf'].includes(fileSuffix)) {
  380. return 'pdf';
  381. }else {
  382. return '';
  383. }
  384. },
  385. // 打开链接
  386. openLink(url) {
  387. getFileUrl({key: url}).then(res => {
  388. window.open(res.data);
  389. })
  390. },
  391. // 点击打印
  392. toPrint() {
  393. this.initPrint()
  394. this.printId = this.listItem.id;
  395. // getDetail(this.tableSelection)
  396. // this.$refs.preView.show(this.hiprintTemplate, detailArr)
  397. this.isShowPrint = true;
  398. },
  399. backDetail() {
  400. this.printId = '';
  401. this.isShowPrint = false;
  402. },
  403. }
  404. }
  405. </script>
  406. <style scoped lang="scss">
  407. .detail-container {
  408. width: 100%;
  409. height: 100%;
  410. }
  411. .main-title {
  412. display: flex;
  413. justify-content: space-between;
  414. align-items: center;
  415. margin-top: 20px;
  416. height: 60px;
  417. border-bottom: 1px solid #DCDFE6;
  418. margin-bottom: 20px;
  419. .title {
  420. font-size: 16px;
  421. font-weight: 600;
  422. padding-left: 10px;
  423. }
  424. }
  425. </style>