SyCottonYarnDetailModal.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  1. <template>
  2. <div class="reply" ref = "replyModal">
  3. <a-modal
  4. title="详情"
  5. width="85%"
  6. :visible="visible"
  7. :maskClosable="false"
  8. :confirmLoading="confirmLoading"
  9. :getContainer ='()=>$refs.replyModal'
  10. @ok="handleOk"
  11. @cancel="handleCancel">
  12. <template slot="footer">
  13. <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" @change="handleImportExcel" :customRequest="implementImport" >
  14. <a-button type="primary">导入</a-button>
  15. </a-upload>
  16. <a-button @click="handleCancel" style="margin-left: 8px;">关闭</a-button>
  17. </template>
  18. <div class="table-page-search-wrapper">
  19. <!-- 主表单区域 -->
  20. <a-form-model layout="inline" ref="form" :model="formState" :rules="validatorRules">
  21. <a-row :gutter="24">
  22. <a-col :md="8" :sm="8">
  23. <a-form-model-item label="编号" prop="code">
  24. <a-input placeholder="请输入" v-model="formState.code" readOnly/>
  25. </a-form-model-item>
  26. </a-col>
  27. <a-col :md="8" :sm="8">
  28. <a-form-model-item label="名称" prop="userId">
  29. <a-input placeholder="请输入名称" v-model="formState.name" readOnly/>
  30. </a-form-model-item>
  31. </a-col>
  32. <a-col :md="8" :sm="8">
  33. <a-form-model-item label="合计" prop="code">
  34. <a-input placeholder="请输入" v-model="formState.totalNum" readOnly/>
  35. </a-form-model-item>
  36. </a-col>
  37. </a-row>
  38. <a-row :gutter="24">
  39. <a-col :md="24" :sm="8">
  40. <a-form-model-item label="备注信息" class="nresume" style="height:100px !important">
  41. <a-input type="textarea" placeholder="请输入" v-model="formState.demo" readOnly/>
  42. </a-form-model-item>
  43. </a-col>
  44. </a-row>
  45. </a-form-model>
  46. <!-- 子表单区域 -->
  47. <a-tabs v-model="activeKey" @change="handleChangeTabs">
  48. <a-tab-pane tab="棉纱" :key="refKeys[0]" :forceRender="true">
  49. <a-table
  50. bordered
  51. :columns="syCottonYarnBTable.columns"
  52. :data-source="syCottonYarnBTable.dataSource"
  53. :loading="syCottonYarnBTable.loading"
  54. :scroll="{x: 1800,y:300 }"
  55. :pagination="false"
  56. >
  57. <!-- 操作 -->
  58. <span slot="option" slot-scope="text, record, index">
  59. <a-popconfirm title="确定签字?" @confirm="handelAutograph(record)" okText="确定" cancelText="取消" >
  60. <a href="">签名</a>
  61. </a-popconfirm>
  62. </span>
  63. </a-table>
  64. <!-- <j-editable-table
  65. :ref="refKeys[0]"
  66. :loading="syCottonYarnBTable.loading"
  67. :columns="syCottonYarnBTable.columns"
  68. :dataSource="syCottonYarnBTable.dataSource"
  69. :maxHeight="300"
  70. :rowNumber="true"
  71. :rowSelection="true"
  72. :actionButton="true"/> -->
  73. </a-tab-pane>
  74. </a-tabs>
  75. </div>
  76. </a-modal>
  77. </div>
  78. </template>
  79. <script>
  80. import moment from 'moment'
  81. import pick from 'lodash.pick'
  82. import { FormTypes } from '@/utils/JEditableTableUtil'
  83. import { JEditableTableMixin } from '@/mixins/JEditableTableMixin'
  84. import { putAction,postAction,getAction } from '@/api/manage'
  85. import {fileDetail} from '@api/oa/cd-sy-cotton'
  86. export default {
  87. name: 'SyCottonYarnDetailModal',
  88. mixins: [JEditableTableMixin],
  89. data() {
  90. return {
  91. // 新增时子表默认添加几行空数据
  92. addDefaultRowNum: 1,
  93. validatorRules: {
  94. },
  95. refKeys: ['syCottonYarnB', ],
  96. activeKey: 'syCottonYarnB',
  97. formState:{},
  98. zhuId:'',
  99. // 搬运装卸费用-棉纱-子表
  100. syCottonYarnBTable: {
  101. loading: false,
  102. dataSource: [],
  103. columns: [
  104. {
  105. title: '日期',
  106. align: "center",
  107. dataIndex: 'orderDate',
  108. width: '9%',
  109. // scopedSlots: { customRender: 'orderDate' },
  110. },
  111. {
  112. title: '入库单号',
  113. align: "center",
  114. dataIndex: 'receiptNo',
  115. width: '9%',
  116. // scopedSlots: { customRender: 'receiptNo' },
  117. },
  118. {
  119. title: '吨数',
  120. align: "center",
  121. dataIndex: 'tonnage',
  122. width: '9%',
  123. // scopedSlots: { customRender: 'tonnage' },
  124. },
  125. {
  126. title: '柜子数量',
  127. align: "center",
  128. dataIndex: 'cabinets',
  129. width: '9%',
  130. // scopedSlots: { customRender: 'cabinets' },
  131. },
  132. {
  133. title: '每吨纱价格',
  134. align: "center",
  135. dataIndex: 'price',
  136. width: '9%',
  137. // scopedSlots: { customRender: 'price' },
  138. },
  139. {
  140. title: '集装箱号',
  141. align: "center",
  142. dataIndex: 'containerNo',
  143. width: '9%',
  144. // scopedSlots: { customRender: 'containerNo' },
  145. },
  146. {
  147. title: '原因',
  148. align: "center",
  149. dataIndex: 'reason',
  150. width: '9%',
  151. // scopedSlots: { customRender: 'reason' },
  152. },
  153. {
  154. title: '总价',
  155. align: "center",
  156. dataIndex: 'totalPrice',
  157. width: '9%',
  158. // scopedSlots: { customRender: 'totalPrice' },
  159. },
  160. {
  161. title: '签字',
  162. align: "center",
  163. dataIndex: 'jhyName',
  164. width: '9%',
  165. // scopedSlots: { customRender: 'jhyName' },
  166. },
  167. {
  168. title: '备注',
  169. align: "center",
  170. dataIndex: 'demo',
  171. width: '9%',
  172. // scopedSlots: { customRender: 'demo' },
  173. },
  174. {
  175. title: '操作',
  176. dataIndex: 'option',
  177. width: '9%',
  178. ellipsis: true,
  179. scopedSlots: { customRender: 'option' },
  180. className: 'replacecolor'
  181. }
  182. ]
  183. },
  184. url: {
  185. add: "/oa/syCottonYarn/add",
  186. edit: "/oa/syCottonYarn/edit",
  187. syCottonYarnB: {
  188. list: '/oa/syCottonYarn/querySyCottonYarnBByMainId'
  189. },
  190. }
  191. }
  192. },
  193. methods: {
  194. // 获取表头信息
  195. getHeaderList(id){
  196. this.zhuId = id
  197. getAction('/oa/syCottonYarn/queryById', {id:id}).then((res) => {
  198. if(res.success){
  199. var zhuId
  200. this.formState=res.result //详情
  201. zhuId = res.result.id
  202. this.getTable(zhuId)
  203. }else{
  204. this.$message.warning(res.message)
  205. }
  206. })
  207. },
  208. getTable(id){
  209. getAction('/oa/syCottonYarn/querySyCottonYarnBByMainId', {id:id}).then((res) => {
  210. if(res.success){
  211. res.result.map(item =>{
  212. if(item.orderDate !==''&& item.orderDate){
  213. item.orderDate = moment(item.orderDate)
  214. }
  215. })
  216. this.syCottonYarnBTable.dataSource = res.result
  217. }else{
  218. this.$message.warning(res.message)
  219. }
  220. })
  221. },
  222. handelAutograph(record){
  223. getAction('/oa/syCottonYarn/signPlan', {id:record.id}).then((res) => {
  224. if(res.success){
  225. this.getHeaderList(this.zhuId)
  226. this.$message.success('签名成功');
  227. }else{
  228. this.$message.warning(res.message)
  229. }
  230. })
  231. },
  232. // 导入
  233. implementImport(file) {
  234. const formData = new FormData()
  235. formData.append('file', file.file)
  236. fileDetail(formData).then(res => {
  237. // this.loading = false
  238. if (res.success) {
  239. // this.visible = true
  240. this.message = res.message.split(';').filter((element) => {
  241. return element !== "";
  242. });
  243. this.file = file
  244. this.$message.success('导入成功')
  245. }else{
  246. this.$message.error(res.message);
  247. }
  248. })
  249. },
  250. //关闭
  251. handleCancel(){
  252. this.syCottonYarnBTable.dataSource=[]
  253. this.formState = {}
  254. this.visible = false
  255. this.zhuId = ''
  256. this.$emit('close')
  257. },
  258. }
  259. }
  260. </script>
  261. <style scoped lang="less">
  262. /deep/ .nresume .ant-input{
  263. height: 100px !important;
  264. }
  265. /deep/ .td{
  266. text-align:center;
  267. }
  268. /deep/ .ant-table-thead > tr > th {
  269. text-align: center;
  270. // font-weight: 700;
  271. }
  272. /deep/ .ant-table-tbody {
  273. text-align: center;
  274. }
  275. </style>