SyCarryDetailModal.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554
  1. <template>
  2. <div class="reply" ref = "replyModal">
  3. <a-modal
  4. title="详情"
  5. width="85%"
  6. :visible="visible"
  7. :confirmLoading="confirmLoading"
  8. :getContainer ='()=>$refs.replyModal'
  9. @cancel="handleCancel"
  10. >
  11. <template slot="footer">
  12. <!-- <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" @change="handleImportExcel" :customRequest="implementImport" >
  13. <a-button type="primary">导入</a-button>
  14. </a-upload> -->
  15. <a-button @click="handleCancel" style="margin-left: 8px;">关闭</a-button>
  16. <a-button @click="handlePrint" style="margin-left: 8px;">打印</a-button>
  17. </template>
  18. <div class="table-page-search-wrapper">
  19. <a-form-model layout="inline" ref="form" :model="formState" :rules="validatorRules">
  20. <a-row :gutter="24">
  21. <!-- <a-col :md="8" :sm="8">
  22. <a-form-model-item label="编号" prop="code">
  23. <a-input placeholder="请输入" v-model="formState.code" readOnly/>
  24. </a-form-model-item>
  25. </a-col> -->
  26. <a-col :md="6" :sm="8">
  27. <a-form-model-item label="名称" prop="userId">
  28. <a-input placeholder="请输入名称" v-model="formState.name" readOnly/>
  29. </a-form-model-item>
  30. </a-col>
  31. <a-col :md="6" :sm="8">
  32. <a-form-model-item label="合计" prop="code">
  33. <a-input placeholder="请输入" v-model="formState.totalNum" disabled="false"/>
  34. </a-form-model-item>
  35. </a-col>
  36. <a-col :md="12" :sm="8">
  37. <a-form-model-item label="合计大写" prop="code">
  38. <a-input placeholder="请输入" v-model="formState.totalText" disabled="false"/>
  39. </a-form-model-item>
  40. </a-col>
  41. </a-row>
  42. <a-row :gutter="24">
  43. <a-col :md="24" :sm="8">
  44. <a-form-model-item label="备注" prop="code">
  45. <a-input placeholder="请输入" v-model="formState.remarks" readOnly/>
  46. </a-form-model-item>
  47. </a-col>
  48. </a-row>
  49. <a-row :gutter="24">
  50. <a-col :md="24" :sm="8">
  51. <a-form-model-item label="账户信息" class="nresume" style="height:100px !important">
  52. <a-input type="textarea" placeholder="请输入" v-model="formState.demo" readOnly/>
  53. </a-form-model-item>
  54. </a-col>
  55. </a-row>
  56. </a-form-model>
  57. <!-- 主表单区域 -->
  58. <!-- <a-form :model="form">
  59. <a-form-item
  60. :labelCol="labelCol"
  61. :wrapperCol="wrapperCol"
  62. label="编号">
  63. <a-input placeholder="请输入编号" v-decorator="['code', {}]"/>
  64. </a-form-item>
  65. <a-form-item
  66. :labelCol="labelCol"
  67. :wrapperCol="wrapperCol"
  68. label="名称">
  69. <a-input placeholder="请输入名称" v-decorator="['name', {}]"/>
  70. </a-form-item>
  71. <a-form-item label="合计" :labelCol="labelCol" :wrapperCol="wrapperCol" >
  72. <a-input placeholder="请输入" v-decorator="['total_num', {}] "/>
  73. </a-form-item>
  74. <a-form-item
  75. :labelCol="labelCol"
  76. :wrapperCol="wrapperCol"
  77. class="nresume" style="height:100px !important"
  78. label="备注">
  79. <a-input type="textarea" placeholder="请输入备注" v-decorator="['demo', {}]"/>
  80. </a-form-item>
  81. </a-form> -->
  82. <!-- 子表单区域 -->
  83. <a-tabs v-model="activeKey" @change="handleChangeTabs">
  84. <a-tab-pane tab="搬运工对账单" :key="refKeys[0]" :forceRender="true">
  85. <!-- <a-button type="primary" @click="addList">增行</a-button> -->
  86. <div id="fabricLossTable">
  87. <a-table
  88. bordered
  89. :columns="syCarryBTable.columns"
  90. :data-source="syCarryBTable.dataSource"
  91. :loading="syCarryBTable.loading"
  92. :scroll="{x: 2000, y:220}"
  93. :pagination="false"
  94. >
  95. <div :title="record.containerNo" :style="{maxWidth: '250px',whiteSpace: 'nowrap',textOverflow: 'ellipsis',overflow: 'hidden', wordWrap: 'break-word', wordBreak: 'break-all' }" slot="containerNo" slot-scope="text, record">
  96. {{record.containerNo}}
  97. </div>
  98. <!-- 操作 -->
  99. <span slot="option" slot-scope="text, record, index">
  100. <a-popconfirm title="确定签字?" @confirm="handelAutograph(record)" okText="确定" cancelText="取消">
  101. <a href="">签名</a>
  102. </a-popconfirm>
  103. </span>
  104. </a-table>
  105. </div>
  106. <!-- <j-editable-table
  107. :ref="refKeys[0]"
  108. :loading="syCarryBTable.loading"
  109. :columns="syCarryBTable.columns"
  110. :dataSource="syCarryBTable.dataSource"
  111. :maxHeight="300"
  112. :minWidth="2000"
  113. :rowNumber="false"
  114. :rowSelection="true"
  115. :actionButton="true">
  116. <template v-slot:action="props">
  117. <a @click="handleAutograph(props)">签名</a>
  118. </template> -->
  119. <!-- <template v-slot:jhyName="props">
  120. <a-select @change='changeJhy(props)' >
  121. <a-select-option
  122. v-for="(item,index) in jhyNameOption"
  123. :key="index"
  124. :value="item.value">
  125. {{item.label}}
  126. </a-select-option>
  127. </a-select>
  128. </template> -->
  129. <!-- </j-editable-table> -->
  130. </a-tab-pane>
  131. </a-tabs>
  132. </div>
  133. </a-modal>
  134. </div>
  135. </template>
  136. <script>
  137. import moment from 'moment'
  138. import pick from 'lodash.pick'
  139. import { FormTypes } from '@/utils/JEditableTableUtil'
  140. import { JEditableTableMixin } from '@/mixins/JEditableTableMixin'
  141. import { getAction } from '@/api/manage'
  142. import {fileDetail} from '@api/oa/cd-sy-carry'
  143. import JEllipsis from '@/components/jeecg/JEllipsis'
  144. export default {
  145. name: 'SyCarryDetailModa',
  146. mixins: [JEditableTableMixin],
  147. components: {
  148. moment,
  149. JEllipsis
  150. },
  151. data() {
  152. let ellipsis = (v, l) => <j-ellipsis value={v} length={l} /> // 省略
  153. return {
  154. // 新增时子表默认添加几行空数据
  155. addDefaultRowNum: 1,
  156. validatorRules: {
  157. },
  158. formState:{},
  159. refKeys: ['syCarryB', ],
  160. activeKey: 'syCarryB',
  161. jhyNameOption:[],
  162. dateFormat: 'YYYY-MM-DD',
  163. zhuId:'',
  164. // 搬运装卸费用-搬运工对账单-子表
  165. syCarryBTable: {
  166. loading: false,
  167. dataSource: [],
  168. columns: [
  169. {
  170. title: '日期',
  171. align: "center",
  172. dataIndex: 'orderDate',
  173. width: 150,
  174. ellipsis: true,
  175. },
  176. {
  177. title: '入库单号/发票号',
  178. align: "center",
  179. dataIndex: 'invoiceNo',
  180. width: 140,
  181. ellipsis: true,
  182. },
  183. {
  184. title: '外销发票号',
  185. dataIndex: 'saleInvoiceNo',
  186. width: 140,
  187. ellipsis: true,
  188. scopedSlots: { customRender: 'saleInvoiceNo' },
  189. className: 'replacecolor',
  190. // slots:{title:'invoiceNoTitle'}
  191. },
  192. {
  193. title: '总件数',
  194. dataIndex: 'allNum',
  195. width: 120,
  196. ellipsis: true,
  197. className: 'replacecolor',
  198. },
  199. {
  200. title: '柜子数量',
  201. dataIndex: 'cabinets',
  202. width: 120,
  203. ellipsis: true,
  204. className: 'replacecolor'
  205. },
  206. {
  207. title: '明细',
  208. dataIndex: 'detailedNum',
  209. width: 120,
  210. ellipsis: true,
  211. className: 'replacecolor',
  212. // slots:{title:'detailedNumTitle'}
  213. },
  214. {
  215. title: '衣架/吨数',
  216. dataIndex: 'coatHanger',
  217. width:120,
  218. ellipsis: true,
  219. className: 'replacecolor'
  220. },
  221. {
  222. title: '集装箱号',
  223. dataIndex: 'containerNo',
  224. width: 290,
  225. className: 'replacecolor',
  226. // customRender: (t) => ellipsis(t,30),
  227. scopedSlots: { customRender: 'containerNo' },
  228. },
  229. {
  230. title: '单价',
  231. dataIndex: 'price',
  232. width: 100,
  233. ellipsis: true,
  234. className: 'replacecolor',
  235. },
  236. {
  237. title: '总价',
  238. dataIndex: 'totalPrice',
  239. width: 100,
  240. ellipsis: true,
  241. className: 'replacecolor',
  242. },
  243. {
  244. title: '原因',
  245. dataIndex: 'reason',
  246. width: 180,
  247. ellipsis: true,
  248. className: 'replacecolor',
  249. },
  250. {
  251. title: '备注',
  252. dataIndex: 'demo',
  253. width: 180,
  254. ellipsis: true,
  255. className: 'replacecolor'
  256. } ,
  257. {
  258. title: '计划员',
  259. dataIndex: 'jhyNameData',
  260. width: 240,
  261. fixed:'right',
  262. ellipsis: true,
  263. className: 'replacecolor',
  264. },
  265. {
  266. title: '签名',
  267. dataIndex: 'jhyName',
  268. width: 100,
  269. fixed:'right',
  270. ellipsis: true,
  271. className: 'replacecolor'
  272. },
  273. {
  274. title: '操作',
  275. dataIndex: 'option',
  276. width: 100,
  277. ellipsis: true,
  278. fixed:'right',
  279. scopedSlots: { customRender: 'option' },
  280. className: 'replacecolor'
  281. }
  282. ]
  283. },
  284. url: {
  285. add: "/oa/syCarry/add",
  286. edit: "/oa/syCarry/edit",
  287. syCarryB: {
  288. list: '/oa/syCarry/querySyCarryBByMainId'
  289. },
  290. }
  291. }
  292. },
  293. created(){
  294. },
  295. methods: {
  296. // 获取表头信息
  297. getHeaderList(id){
  298. this.zhuId = id
  299. getAction('/oa/syCarry/queryById', {id:id}).then((res) => {
  300. if(res.success){
  301. var zhuId = '' //主表id
  302. this.formState=res.result //详情
  303. zhuId = res.result.id
  304. this.getTable(zhuId)
  305. }else{
  306. this.$message.warning(res.message)
  307. }
  308. })
  309. },
  310. getTable(id){
  311. getAction('/oa/syCarry/querySyCarryBByMainId', {id:id}).then((res) => {
  312. if(res.success){
  313. res.result.map(item =>{
  314. if(item.orderDate !==''&& item.orderDate){
  315. item.orderDate = moment(item.orderDate).format('YYYY-MM-DD')
  316. }
  317. })
  318. this.syCarryBTable.dataSource = res.result
  319. }else{
  320. this.$message.warning(res.message)
  321. }
  322. })
  323. },
  324. handelAutograph(record){
  325. getAction('/oa/syCarry/signPlan', {id:record.id}).then((res) => {
  326. if(res.success){
  327. this.getHeaderList(this.zhuId)
  328. this.$message.success('签名成功');
  329. }else{
  330. this.$message.warning(res.message)
  331. }
  332. })
  333. // if(record.jhyNameData == this.$store.getters.nickname){
  334. // record.jhyName = record.jhyNameData
  335. // }else{
  336. // this.$message.error('不可签名');
  337. // }
  338. },
  339. // 导入
  340. implementImport(file) {
  341. const formData = new FormData()
  342. formData.append('file', file.file)
  343. fileDetail(formData).then(res => {
  344. // this.loading = false
  345. if (res.success) {
  346. // this.visible = true
  347. this.message = res.message.split(';').filter((element) => {
  348. return element !== "";
  349. });
  350. this.file = file
  351. this.$message.success('导入成功')
  352. }else{
  353. this.$message.error(res.message);
  354. }
  355. })
  356. },
  357. //关闭
  358. handleCancel(){
  359. this.syCarryBTable.dataSource=[]
  360. this.formState = {}
  361. this.visible = false
  362. this.zhuId = ''
  363. this.$emit('close')
  364. },
  365. randomNumber() {
  366. return parseInt(Math.random() * 101);
  367. },
  368. tableNumber(n, m,win) {
  369. win.document.write("<table>");
  370. for (var j = 1; j <= n; j++) {
  371. win.document.write("<tr>");
  372. for (var i = 1; i <= m; i++) {
  373. win.document.write("<td>" + this.randomNumber() + "</td>");
  374. }
  375. win.document.write("</tr>");
  376. win.document.write("</table>");
  377. }
  378. },
  379. handlePrint(){
  380. const cloumn = this.syCarryBTable.columns
  381. var data = [...this.syCarryBTable.dataSource]
  382. var obj = {
  383. orderDate:'合计',
  384. invoiceNo:'',
  385. saleInvoiceNo:'',
  386. allNum:'',
  387. cabinets:'',
  388. detailedNum:'合计大写',
  389. totalPrice:'',
  390. coatHanger:'',
  391. price:'',
  392. reason:'',
  393. demo:'',
  394. jhyName:'',
  395. containerNo:this.formState.totalText,
  396. jhyNameData:this.formState.totalNum
  397. }
  398. //增加合计行
  399. data.push(obj)
  400. data.splice(0,0,obj)
  401. const win = window.open();
  402. win.document.write("<span class='work'>");
  403. win.document.write(this.formState.demo);
  404. win.document.write("</span>");
  405. win.document.write("<h1>");
  406. win.document.write('宁波马菲羊纺织科技有限公司名称');
  407. win.document.write("</h1>");
  408. win.document.write("<h2>");
  409. win.document.write(this.formState.name);
  410. win.document.write("</h2>");
  411. // 给table头
  412. win.document.write("<table>");
  413. for (var i = 0; i <data.length ; i++) { //外层循环 作用行
  414. // 给表的行rows 头
  415. if(i==0){
  416. win.document.write("<tr>");
  417. for (var j = 0; j < cloumn.length; j++) { //内层循环 作用列
  418. // 给表的列columns 头
  419. if(j !== cloumn.length-1){
  420. if(cloumn[j].title == '集装箱号'){
  421. win.document.write("<td style='width:15%'>");
  422. }else{
  423. win.document.write("<td>");
  424. }
  425. win.document.write(cloumn[j].title);
  426. // 给表的列columns 尾
  427. win.document.write("</td>");
  428. }
  429. }
  430. }else{
  431. for (var j = 0; j < cloumn.length-1; j++) { //内层循环 作用列
  432. var cc = cloumn[j].dataIndex
  433. var dd = data[i][cc] ?data[i][cc]:''
  434. win.document.write("<td>");
  435. win.document.write(dd);
  436. // 给表的列columns 尾
  437. win.document.write("</td>");
  438. }
  439. }
  440. // 给表的行rows 尾
  441. win.document.write("</tr>");
  442. }
  443. // 给table尾
  444. win.document.write("</table>");
  445. win.document.write("<span class='workFooter'>");
  446. var remarks = this.formState.remarks?this.formState.remarks:''
  447. win.document.write('备注:'+remarks);
  448. win.document.write("</span>");
  449. win.document.write("<div class='workFooter1'>");
  450. win.document.write('审批:');
  451. win.document.write("</div>");
  452. const style = '<style>\n'
  453. +'.noprint{display:none}'
  454. + 'table{width: 100% !important;border-collapse: collapse;border-spacing: 0;overflow-x:hidden;}\n'
  455. + 'th,td{width:5%;border: 1px solid;text-align: center;word-break: break-all;}\n'
  456. + 'h1{text-align: center}\n'
  457. + 'h2{text-align: center}\n'
  458. + '.work{display: block;text-align: center}\n'
  459. + '.workFooter{display: block;margin-top: 2%;}\n'
  460. + '.workFooter1{width: 10%;float: right;margin-top: 2%;}\n'
  461. // +'@media print{@page {size:landscape}}'
  462. + '</style>';
  463. win.document.write(style);
  464. win.focus();
  465. win.print();
  466. win.close();
  467. }
  468. }
  469. }
  470. </script>
  471. <style scoped lang="less">
  472. /deep/ .nresume .ant-input{
  473. height: 100px !important;
  474. }
  475. /deep/ .td{
  476. text-align:center;
  477. }
  478. // /deep/.ant-form-item{
  479. // width: 31%;
  480. // }
  481. // /deep/.ant-form-horizontal{
  482. // display: flex;
  483. // width: 100%;
  484. // flex-wrap: wrap;
  485. // }
  486. // .nresume{
  487. // width: 100% !important;
  488. // }
  489. // /deep/ .nresume .ant-form-item-label{
  490. // width: 3% !important;
  491. // }
  492. // /deep/ .nresume .ant-form-item-control-wrapper{
  493. // width: 85% !important;
  494. // }
  495. // /deep/ .nresume .ant-input{
  496. // height: 100px !important;
  497. // }
  498. // /deep/ .ant-col-sm-6{
  499. // width: 10%;
  500. // }
  501. /deep/ .ant-select{
  502. width: 100%;
  503. }
  504. /deep/ .input-table .thead .td{
  505. text-align: center;
  506. }
  507. /deep/ .input-table .tbody .td{
  508. text-align: center;
  509. }
  510. /deep/ .ant-table-thead > tr > th {
  511. text-align: center;
  512. // font-weight: 700;
  513. }
  514. /deep/ .ant-table-tbody {
  515. text-align: center;
  516. }
  517. /deep/.ant-table-tbody>tr>td{
  518. white-space: break-spaces;
  519. }
  520. /deep/ .ant-calendar-picker{
  521. width: 113px !important;
  522. }
  523. /deep/ .ant-table-fixed-left table,.ant-table-fixed-right table{
  524. width: min-content;
  525. }
  526. /deep/ .ant-table-fixed-left table,.ant-table-fixed-right table{
  527. width: min-content;
  528. }
  529. /deep/ .ant-table-tbody .ant-table-row td {
  530. padding-top: 7px !important;
  531. padding-bottom: 7px !important;
  532. }
  533. /deep/ .ant-table-thead > tr > th, .ant-table-tbody > tr > td {
  534. padding: 7px 16px;
  535. }
  536. /deep/ .table-page-search-wrapper .ant-form-inline .ant-form-item > .ant-form-item-label {
  537. width: 118px;
  538. }
  539. </style>