SyCarryModal.vue 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823
  1. <template>
  2. <div class="reply" ref = "replyModal">
  3. <a-modal
  4. :title="(defultMethods == 'add')?'新增':'编辑'"
  5. width="85%"
  6. :visible="visible"
  7. :confirmLoading="confirmLoading"
  8. :getContainer ='()=>$refs.replyModal'
  9. @cancel="handleCancel"
  10. destroyOnClose
  11. >
  12. <template #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. <a-button type="primary" @click="handleOk" :disabled="buttonLoading">保存</a-button>
  18. </template>
  19. <div class="table-page-search-wrapper">
  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" />
  25. </a-form-model-item>
  26. </a-col> -->
  27. <a-col :md="6" :sm="8">
  28. <a-form-model-item label="名称" prop="name">
  29. <a-input placeholder="请输入名称" v-model="formState.name"/>
  30. </a-form-model-item>
  31. </a-col>
  32. <a-col :md="6" :sm="8">
  33. <a-form-model-item label="合计" prop="totalNum">
  34. <a-input placeholder="" v-model="formState.totalNum" disabled="false"/>
  35. </a-form-model-item>
  36. </a-col>
  37. <a-col :md="12" :sm="8">
  38. <a-form-model-item label="合计大写" >
  39. <a-input placeholder="请输入" v-model="formState.totalText" disabled="false"/>
  40. </a-form-model-item>
  41. </a-col>
  42. </a-row>
  43. <a-row :gutter="24">
  44. <a-col :md="24" :sm="8">
  45. <a-form-model-item label="备注" >
  46. <a-input placeholder="请输入" v-model="formState.remarks"/>
  47. </a-form-model-item>
  48. </a-col>
  49. </a-row>
  50. <a-row :gutter="24">
  51. <a-col :md="24" :sm="8">
  52. <a-form-model-item label="账户信息" class="nresume" style="height:100px !important">
  53. <a-input type="textarea" placeholder="请输入" v-model="formState.demo"/>
  54. </a-form-model-item>
  55. </a-col>
  56. </a-row>
  57. </a-form-model>
  58. <!-- 主表单区域 -->
  59. <!-- <a-form :model="form">
  60. <a-form-item
  61. :labelCol="labelCol"
  62. :wrapperCol="wrapperCol"
  63. label="编号">
  64. <a-input placeholder="请输入编号" v-decorator="['code', {}]"/>
  65. </a-form-item>
  66. <a-form-item
  67. :labelCol="labelCol"
  68. :wrapperCol="wrapperCol"
  69. label="名称">
  70. <a-input placeholder="请输入名称" v-decorator="['name', {}]"/>
  71. </a-form-item>
  72. <a-form-item label="合计" :labelCol="labelCol" :wrapperCol="wrapperCol" >
  73. <a-input placeholder="请输入" v-decorator="['total_num', {}] "/>
  74. </a-form-item>
  75. <a-form-item
  76. :labelCol="labelCol"
  77. :wrapperCol="wrapperCol"
  78. class="nresume" style="height:100px !important"
  79. label="备注">
  80. <a-input type="textarea" placeholder="请输入备注" v-decorator="['demo', {}]"/>
  81. </a-form-item>
  82. </a-form> -->
  83. <!-- 子表单区域 -->
  84. <a-tabs v-model="activeKey" @change="handleChangeTabs">
  85. <a-tab-pane tab="搬运工对账单" :key="refKeys[0]" :forceRender="true">
  86. <a-button type="primary" @click="addList" style="margin-bottom: 1%;">增行</a-button>
  87. <a-form-model ref="formRef" >
  88. <a-table
  89. bordered
  90. :columns="syCarryBTable.columns"
  91. :data-source="syCarryBTable.dataSource"
  92. :loading="syCarryBTable.loading"
  93. :scroll="{x: 2000,y:220 }"
  94. :pagination="false"
  95. >
  96. <!-- 表头--日期 -->
  97. <span slot="orderDateTitle" class="form-table-heard">
  98. 日期
  99. </span>
  100. <!-- 表头--集装箱号 -->
  101. <span slot="containerNoTitle" class="form-table-heard">
  102. 集装箱号
  103. </span>
  104. <!-- 表头--单价 -->
  105. <span slot="priceTitle" class="form-table-heard">
  106. 单价
  107. </span>
  108. <!-- 表头--计划员 -->
  109. <span slot="jhyByDataTitle" class="form-table-heard">
  110. 计划员
  111. </span>
  112. <!-- 表头--总价 -->
  113. <span slot="totalPriceTitle" class="form-table-heard">
  114. 总价
  115. </span>
  116. <!-- 日期 -->
  117. <span slot="orderDate" slot-scope="text, record,index" >
  118. <a-date-picker
  119. placeholder="请选择"
  120. v-model="record.orderDate"
  121. format="YYYY-MM-DD"
  122. show-time
  123. />
  124. </span>
  125. <!-- 总件数 -->
  126. <span slot="allNum" slot-scope="text, record, index">
  127. <!-- <a-form-model-item prop="remarks2"> -->
  128. <a-input placeholder="请输入" v-model="record.allNum" />
  129. <!-- </a-form-model-item> -->
  130. </span>
  131. <!-- 柜子数量 -->
  132. <span slot="cabinets" slot-scope="text, record, index">
  133. <!-- <a-form-model-item prop="remarks2"> -->
  134. <a-input placeholder="请输入" v-model="record.cabinets" />
  135. <!-- </a-form-model-item> -->
  136. </span>
  137. <!-- 明细 -->
  138. <span slot="detailedNum" slot-scope="text, record, index">
  139. <!-- <a-form-model-item prop="remarks2"> -->
  140. <a-input placeholder="请输入" v-model="record.detailedNum" @blur="handleChangePrice(record)"/>
  141. <!-- </a-form-model-item> -->
  142. </span>
  143. <!-- 衣架/吨数 -->
  144. <span slot="coatHanger" slot-scope="text, record, index">
  145. <!-- <a-form-model-item prop="remarks2"> -->
  146. <a-input placeholder="请输入" v-model="record.coatHanger" @blur="handleChangePrice(record)"/>
  147. <!-- </a-form-model-item> -->
  148. </span>
  149. <!-- 集装箱号 -->
  150. <span slot="containerNo" slot-scope="text, record, index">
  151. <!-- <a-form-model-item prop="remarks2"> -->
  152. <a-input placeholder="请输入" v-model="record.containerNo" />
  153. <!-- </a-form-model-item> -->
  154. </span>
  155. <!-- 入库单号/发票号 -->
  156. <span slot="invoiceNo" slot-scope="text, record, index">
  157. <!-- <a-form-model-item prop="remarks2"> -->
  158. <a-input placeholder="请输入" v-model="record.invoiceNo" />
  159. <!-- </a-form-model-item> -->
  160. </span>
  161. <!-- 外销发票号 -->
  162. <span slot="saleInvoiceNo" slot-scope="text, record, index">
  163. <!-- <a-form-model-item prop="remarks2"> -->
  164. <a-input placeholder="请输入" v-model="record.saleInvoiceNo" />
  165. <!-- </a-form-model-item> -->
  166. </span>
  167. <!-- 价格 -->
  168. <span slot="price" slot-scope="text, record, index">
  169. <!-- <a-form-model-item prop="remarks2"> -->
  170. <a-input placeholder="请输入" v-model="record.price" @blur="handleChangePrice(record)"/>
  171. <!-- </a-form-model-item> -->
  172. </span>
  173. <!-- 总价 -->
  174. <span slot="totalPrice" slot-scope="text, record, index">
  175. <!-- <a-form-model-item prop="remarks2"> -->
  176. <a-input placeholder="请输入" v-model="record.totalPrice" @blur="handleChangetotalPrice()"/>
  177. <!-- </a-form-model-item> -->
  178. </span>
  179. <!-- 计划员 -->
  180. <span slot="jhyByData" slot-scope="text, record, index">
  181. <!-- <a-form-model-item prop="remarks2"> -->
  182. <a-select v-model="record.jhyByData" style="width:100%" mode="multiple"
  183. show-search :filterOption="filterOption" @change="handleChange(record)">
  184. <a-select-option
  185. v-for="(item,index) in jhyNameOption"
  186. :key="index"
  187. :value="item.value"
  188. >
  189. {{item.label}}
  190. </a-select-option>
  191. </a-select>
  192. <!-- </a-form-model-item> -->
  193. </span>
  194. <!-- 原因 -->
  195. <span slot="reason" slot-scope="text, record, index">
  196. <!-- <a-form-model-item prop="remarks2"> -->
  197. <a-input placeholder="请输入" v-model="record.reason" />
  198. <!-- </a-form-model-item> -->
  199. </span>
  200. <!-- 备注 -->
  201. <span slot="demo" slot-scope="text, record, index">
  202. <!-- <a-form-model-item prop="remarks2"> -->
  203. <a-input placeholder="请输入" v-model="record.demo" />
  204. <!-- </a-form-model-item> -->
  205. </span>
  206. <span slot="option" slot-scope="text, record, index">
  207. <!-- <a-form-model-item prop="remarks2"> -->
  208. <a @click="copyRow(record)">复制</a>
  209. <a-divider type="vertical" />
  210. <a @click="deleteRow(record,index)" style="color:red">删行</a>
  211. <!-- </a-form-model-item> -->
  212. </span>
  213. </a-table>
  214. </a-form-model>
  215. <!-- <j-editable-table
  216. :ref="refKeys[0]"
  217. :loading="syCarryBTable.loading"
  218. :columns="syCarryBTable.columns"
  219. :dataSource="syCarryBTable.dataSource"
  220. :maxHeight="300"
  221. :minWidth="2000"
  222. :rowNumber="false"
  223. :rowSelection="true"
  224. :actionButton="true">
  225. <template v-slot:action="props">
  226. <a @click="handleAutograph(props)">签名</a>
  227. </template> -->
  228. <!-- <template v-slot:jhyName="props">
  229. <a-select @change='changeJhy(props)' >
  230. <a-select-option
  231. v-for="(item,index) in jhyNameOption"
  232. :key="index"
  233. :value="item.value">
  234. {{item.label}}
  235. </a-select-option>
  236. </a-select>
  237. </template> -->
  238. <!-- </j-editable-table> -->
  239. </a-tab-pane>
  240. </a-tabs>
  241. </div>
  242. </a-modal>
  243. </div>
  244. </template>
  245. <script>
  246. import moment from 'moment'
  247. import pick from 'lodash.pick'
  248. import { FormTypes } from '@/utils/JEditableTableUtil'
  249. import { JEditableTableMixin } from '@/mixins/JEditableTableMixin'
  250. import {personList,subimtList} from '@api/oa/cd-personnel-files'
  251. import {fileDetail} from '@api/oa/cd-sy-carry'
  252. import { putAction,getAction } from '@/api/manage'
  253. import {Arabia_to_Chinese} from '@api/converNumbers'
  254. export default {
  255. name: 'SyCarryModal',
  256. mixins: [JEditableTableMixin],
  257. components: {
  258. moment,
  259. },
  260. data() {
  261. return {
  262. // 新增时子表默认添加几行空数据
  263. addDefaultRowNum: 1,
  264. validatorRules: {
  265. },
  266. formState:{},
  267. refKeys: ['syCarryB', ],
  268. activeKey: 'syCarryB',
  269. jhyNameOption:[],
  270. dateFormat: 'YYYY-MM-DD',
  271. passVerification:'yes',
  272. buttonLoading:false,
  273. validatorRules: {
  274. name:[{required: true, message: '名称不能为空!'}],
  275. code:[{required: true, message: '编号不能为空!'}],
  276. },
  277. // 搬运装卸费用-搬运工对账单-子表
  278. syCarryBTable: {
  279. loading: false,
  280. dataSource: [],
  281. columns: [
  282. {
  283. // title: '日期',
  284. align: "center",
  285. dataIndex: 'orderDate',
  286. width: 150,
  287. ellipsis: true,
  288. scopedSlots: { customRender: 'orderDate' },
  289. slots:{title:'orderDateTitle'}
  290. },
  291. {
  292. title: '入库单号/发票号',
  293. align: "center",
  294. dataIndex: 'invoiceNo',
  295. width: 140,
  296. ellipsis: true,
  297. scopedSlots: { customRender: 'invoiceNo' },
  298. },
  299. {
  300. title: '外销发票号',
  301. dataIndex: 'saleInvoiceNo',
  302. width: 140,
  303. ellipsis: true,
  304. scopedSlots: { customRender: 'saleInvoiceNo' },
  305. className: 'replacecolor',
  306. // slots:{title:'invoiceNoTitle'}
  307. },
  308. {
  309. title: '总件数',
  310. dataIndex: 'allNum',
  311. width: 120,
  312. ellipsis: true,
  313. scopedSlots: { customRender: 'allNum' },
  314. className: 'replacecolor',
  315. // slots:{title:'allNumTitle'}
  316. },
  317. {
  318. title: '柜子数量',
  319. dataIndex: 'cabinets',
  320. width: 120,
  321. ellipsis: true,
  322. scopedSlots: { customRender: 'cabinets' },
  323. className: 'replacecolor'
  324. },
  325. {
  326. title: '明细',
  327. dataIndex: 'detailedNum',
  328. width: 120,
  329. ellipsis: true,
  330. scopedSlots: { customRender: 'detailedNum' },
  331. className: 'replacecolor',
  332. // slots:{title:'detailedNumTitle'}
  333. },
  334. {
  335. title: '衣架/吨数',
  336. dataIndex: 'coatHanger',
  337. width:120,
  338. ellipsis: true,
  339. scopedSlots: { customRender: 'coatHanger' },
  340. className: 'replacecolor'
  341. },
  342. {
  343. // title: '集装箱号',
  344. dataIndex: 'containerNo',
  345. width: 330,
  346. ellipsis: true,
  347. scopedSlots: { customRender: 'containerNo' },
  348. className: 'replacecolor',
  349. slots:{title:'containerNoTitle'}
  350. },
  351. {
  352. // title: '单价',
  353. dataIndex: 'price',
  354. width: 100,
  355. ellipsis: true,
  356. scopedSlots: { customRender: 'price' },
  357. className: 'replacecolor',
  358. slots:{title:'priceTitle'}
  359. },
  360. {
  361. // title: '总价',
  362. dataIndex: 'totalPrice',
  363. width: 100,
  364. ellipsis: true,
  365. scopedSlots: { customRender: 'totalPrice' },
  366. className: 'replacecolor',
  367. slots:{title:'totalPriceTitle'}
  368. },
  369. {
  370. title: '原因',
  371. dataIndex: 'reason',
  372. width: 180,
  373. ellipsis: true,
  374. scopedSlots: { customRender: 'reason' },
  375. className: 'replacecolor',
  376. // slots:{title:'reasonTitle'}
  377. },
  378. {
  379. title: '备注',
  380. dataIndex: 'demo',
  381. width: 200,
  382. ellipsis: true,
  383. scopedSlots: { customRender: 'demo' },
  384. className: 'replacecolor'
  385. } ,
  386. {
  387. // title: '计划员',
  388. dataIndex: 'jhyByData',
  389. width: 240,
  390. ellipsis: true,
  391. scopedSlots: { customRender: 'jhyByData' },
  392. className: 'replacecolor',
  393. fixed:'right',
  394. slots:{title:'jhyByDataTitle'}
  395. },
  396. {
  397. title: '签名',
  398. dataIndex: 'jhyName',
  399. width: 100,
  400. fixed:'right',
  401. ellipsis: true,
  402. className: 'replacecolor'
  403. },
  404. {
  405. title: '操作',
  406. dataIndex: 'option',
  407. width: 180,
  408. fixed:'right',
  409. scopedSlots: { customRender: 'option' },
  410. className: 'replacecolor'
  411. }
  412. ]
  413. },
  414. defultMethods:'add',
  415. url: {
  416. add: "/oa/syCarry/add",
  417. edit: "/oa/syCarry/edit",
  418. syCarryB: {
  419. list: '/oa/syCarry/querySyCarryBByMainId'
  420. },
  421. }
  422. }
  423. },
  424. created(){
  425. this.getOption()
  426. this.getRemarks()
  427. },
  428. watch: {
  429. formState: {
  430. immediate: true,
  431. deep:true,
  432. handler(newVal) {
  433. newVal.totalNum = newVal.totalNum.toString()
  434. if(newVal.totalNum!=='' && newVal.totalNum){
  435. this.changeNumber(newVal.totalNum)
  436. }
  437. }
  438. },
  439. },
  440. methods: {
  441. // 获取表头信息
  442. getHeaderList(id){
  443. getAction('/oa/syCarry/queryById', {id:id}).then((res) => {
  444. if(res.success){
  445. var zhuId = '' //主表id
  446. this.formState=res.result //详情
  447. zhuId = res.result.id
  448. this.getTable(zhuId)
  449. }else{
  450. this.$message.warning(res.message)
  451. }
  452. })
  453. },
  454. getTable(id){
  455. getAction('/oa/syCarry/querySyCarryBByMainId', {id:id}).then((res) => {
  456. if(res.success){
  457. res.result.map(item =>{
  458. if(item.jhyByData !==''&& item.jhyByData){
  459. item.jhyByData = item.jhyByData.split(",")
  460. }
  461. if(item.orderDate !==''&& item.orderDate){
  462. item.orderDate = moment(item.orderDate)
  463. }
  464. })
  465. this.syCarryBTable.dataSource = res.result
  466. }else{
  467. this.$message.warning(res.message)
  468. }
  469. })
  470. },
  471. getRemarks(){
  472. getAction('/sys/dict/getByCodeDict', {table:'sys_dict',text:'description',code:'dict_code',key:'remarks'}).then((res) => {
  473. var arr = res.split(' ')
  474. var c = ''
  475. arr.map((item,index)=>{
  476. if(index !== arr.length-1){
  477. c += item+'\n'
  478. }else{
  479. c+=item
  480. }
  481. })
  482. this.formState.demo = c
  483. })
  484. },
  485. // 计划员模糊查询
  486. filterOption(input, option) {
  487. return (
  488. option.componentOptions.children[0].text
  489. .toLowerCase()
  490. .indexOf(input.toLowerCase()) >= 0
  491. )},
  492. //增行
  493. addList(){
  494. this.syCarryBTable.dataSource.push({
  495. orderDate:'',
  496. allNum:'',
  497. detailedNum:'',
  498. coatHanger:'',
  499. containerNo:'',
  500. cabinets:'',
  501. invoiceNo:'',
  502. price:'',
  503. jhyName:'',
  504. jhyNameData:[],
  505. demo:'',
  506. name:''
  507. })
  508. },
  509. //获取计划员
  510. getOption(){
  511. personList({pageSize:'9999'}).then(res => {
  512. if (res.success) {
  513. res.result.records.map(item =>{
  514. this.jhyNameOption.push({label:item.realname,value:item.username})
  515. })
  516. }else{
  517. this.$message.error(res.message);
  518. }
  519. })
  520. },
  521. //改变计划员
  522. handleChange(record){
  523. this.jhyNameOption.map(item=>{
  524. if(item.value == record.jhyByData){
  525. record.jhyNameData.push(item.label)
  526. }
  527. })
  528. },
  529. // 复制行
  530. copyRow(record){
  531. var newObj = {...record}
  532. newObj.id = ''
  533. this.syCarryBTable.dataSource.push(newObj)
  534. this.formState.totalNum =(Number(this.formState.totalNum) +Number(record.totalPrice)).toFixed(2)
  535. if( this.formState.totalNum!=='' && this.formState.totalNum){
  536. this.changeNumber( this.formState.totalNum)
  537. }
  538. this.$forceUpdate()
  539. },
  540. //删行
  541. deleteRow(record,index){
  542. this.syCarryBTable.dataSource.splice(index,1)
  543. this.formState.totalNum =(Number(this.formState.totalNum) -Number(record.totalPrice)).toFixed(2)
  544. if( this.formState.totalNum!=='' && this.formState.totalNum){
  545. this.changeNumber( this.formState.totalNum)
  546. }
  547. },
  548. changeJhy(props){
  549. console.log(this.syCarryBTable.columns[7].options)
  550. },
  551. /** 整理成formData */
  552. classifyIntoFormData(allValues) {
  553. let main = Object.assign(this.model, allValues.formValue)
  554. //时间格式化
  555. // main.ckTime = main.ckTime ? main.ckTime.format('YYYY-MM-DD HH:mm:ss') : null;
  556. // main.rsxzTime = main.rsxzTime ? main.rsxzTime.format('YYYY-MM-DD HH:mm:ss') : null;
  557. // main.cwjlTime = main.cwjlTime ? main.cwjlTime.format('YYYY-MM-DD HH:mm:ss') : null;
  558. return {
  559. ...main, // 展开
  560. syCarryBList: allValues.tablesValue[0].values,
  561. }
  562. },
  563. //保存
  564. handleOk(){
  565. this.$refs.form.validate(async valid => {
  566. if(valid){
  567. var obj = this.formState
  568. this.syCarryBTable.dataSource.map(item=>{
  569. // console.log('ssssssssssss',item.jhyByData.toString());
  570. if(item.jhyByData.length!==0&&item.jhyByData){
  571. item.jhyByData = item.jhyByData.toString();
  572. }
  573. if(item.jhyNameData.length!==0&&item.jhyNameData){
  574. item.jhyNameData = item.jhyNameData.toString();
  575. }
  576. if(item.orderDate!==''&&item.orderDate){
  577. item.orderDate = moment(item.orderDate).format('YYYY-MM-DD HH:mm:ss');
  578. }
  579. })
  580. obj.syCarryBList = this.syCarryBTable.dataSource
  581. await this.judageTablez(obj.syCarryBList)
  582. if(this.defultMethods == 'add' && this.passVerification == 'yes'){
  583. this.buttonLoading = true
  584. subimtList(obj).then(res => {
  585. if (res.success) {
  586. this.$message.success('新增成功')
  587. this.handleCancel()
  588. this.$emit('close')
  589. this.buttonLoading = false
  590. }else{
  591. this.$message.error(res.message);
  592. this.buttonLoading = false
  593. }
  594. })
  595. }else if(this.passVerification == 'yes'){
  596. this.buttonLoading = true
  597. putAction('/oa/syCarry/edit', obj).then((res) => {
  598. if(res.success){
  599. this.$message.success('编辑成功')
  600. this.handleCancel()
  601. this.$emit('close')
  602. this.buttonLoading = false
  603. }else{
  604. this.$message.warning(res.message)
  605. this.buttonLoading = false
  606. }
  607. })
  608. }
  609. }
  610. })
  611. },
  612. judageTablez(data){
  613. this.passVerification = 'yes'
  614. if(data.length == 0){
  615. this.$message.error('请添加子表数据!');
  616. this.passVerification = 'no'
  617. }else{
  618. for (var i=0; i<data.length;i++){
  619. var tableRow = data[i];
  620. var required = [
  621. {key:'orderDate',value:'日期'},
  622. {key:'price',value:'单价'},
  623. {key:'containerNo',value:'集装箱号'},
  624. {key:'totalPrice',value:'总价'},
  625. {key:'jhyNameData',value:'计划员'},
  626. ]
  627. for(var j=0 ; j<required.length;j++){
  628. if(required.key == 'jhyNameData' && (!tableRow[jhyNameData]|| tableRow[jhyNameData].length==0)){
  629. this.$message.error('第'+(i+1)+'行'+'计划员'+'无值,无法保存');
  630. this.passVerification = 'no'
  631. return
  632. }else if(tableRow[required[j].key] == null || tableRow[required[j].key] == "" || tableRow[required[j].key] == undefined){
  633. this.$message.error('第'+(i+1)+'行'+required[j].value+'无值,无法保存');
  634. this.passVerification = 'no'
  635. return
  636. }
  637. }
  638. }
  639. }
  640. },
  641. // 导入
  642. implementImport(file) {
  643. const formData = new FormData()
  644. formData.append('file', file.file)
  645. fileDetail(formData).then(res => {
  646. // this.loading = false
  647. if (res.success) {
  648. this.formState = res.result
  649. this.syCarryBTable.dataSource = res.result.syCarryBList
  650. this.syCarryBTable.dataSource.map(item=>{
  651. item.orderDate = moment(item.orderDate)
  652. item.jhyByData=item.jhyByData.split(',')
  653. item.jhyNameData= item.jhyNameData.split('/')
  654. })
  655. this.getRemarks()
  656. // this.handleChangePrice()
  657. this.$message.success('导入成功')
  658. // this.
  659. }else{
  660. this.$message.error(res.message);
  661. }
  662. })
  663. },
  664. //关闭
  665. handleCancel(){
  666. this.syCarryBTable.dataSource=[]
  667. this.formState = {}
  668. this.visible = false
  669. this.defultMethods='add'
  670. this.getRemarks()
  671. this.$emit('close')
  672. },
  673. changeNumber(data){
  674. var dd = Arabia_to_Chinese(data)
  675. if(dd == 'notAllNumber'){
  676. this.$message.error("请检查金额是否正确");
  677. }else{
  678. this.formState.totalText = dd
  679. }
  680. },
  681. // 价格改变
  682. handleChangePrice(record){
  683. if(!parseFloat(parseFloat(record.detailedNum))){
  684. record.detailedNum = 0
  685. }
  686. if(!parseFloat(parseFloat(record.price))){
  687. record.price = 0.00
  688. }
  689. if(!parseFloat(parseFloat(record.price))){
  690. record.price = 0.00
  691. }
  692. if(record.price && record.coatHanger){
  693. record.totalPrice = Number(record.coatHanger)* Number(record.price)+ Number((record.detailedNum?record.detailedNum:0))
  694. this.$forceUpdate()
  695. }else{
  696. record.totalPrice = record.detailedNum
  697. }
  698. var Hj = 0
  699. this.syCarryBTable.dataSource.map(item=>{
  700. item.coatHanger = Number(item.coatHanger).toFixed(4)
  701. item.totalPrice = Number(item.totalPrice).toFixed(2)
  702. item.price = Number(item.price).toFixed(2)
  703. item.allNum = Number(item.allNum).toFixed(0)
  704. item.cabinets = Number(item.cabinets).toFixed(0)
  705. item.detailedNum = Number(item.detailedNum).toFixed(0)
  706. // if(item.price=='8'&&item.totalPrice>500){
  707. // item.coatHanger = ''
  708. // item.detailedNum = ''
  709. // item.price = ''
  710. // item.totalPrice = ''
  711. // this.$message.error('单价为8的行总价不能超过500,请重新输入单价,衣架/吨数,明细!!');
  712. // }
  713. Hj+= Number(item.totalPrice)
  714. })
  715. this.formState.totalNum = Hj.toFixed(2)
  716. if( this.formState.totalNum!=='' && this.formState.totalNum){
  717. this.changeNumber( this.formState.totalNum)
  718. }
  719. this.$forceUpdate()
  720. },
  721. handleChangetotalPrice(){
  722. var Hj = 0
  723. this.syCarryBTable.dataSource.map(item=>{
  724. Hj+= Number(item.totalPrice)
  725. })
  726. this.formState.totalNum = Hj.toFixed(2)
  727. this.$forceUpdate()
  728. }
  729. }
  730. }
  731. </script>
  732. <style scoped lang="less">
  733. /deep/ .nresume .ant-input{
  734. height: 100px !important;
  735. }
  736. /deep/ .td{
  737. text-align:center;
  738. }
  739. // /deep/.ant-form-item{
  740. // width: 31%;
  741. // }
  742. // /deep/.ant-form-horizontal{
  743. // display: flex;
  744. // width: 100%;
  745. // flex-wrap: wrap;
  746. // }
  747. // .nresume{
  748. // width: 100% !important;
  749. // }
  750. // /deep/ .nresume .ant-form-item-label{
  751. // width: 3% !important;
  752. // }
  753. // /deep/ .nresume .ant-form-item-control-wrapper{
  754. // width: 85% !important;
  755. // }
  756. // /deep/ .nresume .ant-input{
  757. // height: 100px !important;
  758. // }
  759. // /deep/ .ant-col-sm-6{
  760. // width: 10%;
  761. // }
  762. /deep/ .ant-select{
  763. width: 100%;
  764. }
  765. /deep/ .input-table .thead .td{
  766. text-align: center;
  767. }
  768. /deep/ .input-table .tbody .td{
  769. text-align: center;
  770. }
  771. /deep/ .ant-table-thead > tr > th {
  772. text-align: center;
  773. // font-weight: 700;
  774. }
  775. /deep/ .ant-table-tbody {
  776. text-align: center;
  777. }
  778. .form-table-heard:before {
  779. content: '*';
  780. color: red;
  781. }
  782. /deep/ .ant-calendar-picker{
  783. width: 113px !important;
  784. }
  785. // /deep/ .ant-table-fixed-left table,.ant-table-fixed-right table{
  786. // width: min-content;
  787. // }
  788. // /deep/ .ant-table-fixed-left table,.ant-table-fixed-right table{
  789. // width: min-content;
  790. // }
  791. // /deep/.ant-table-fixed-header .ant-table-scroll .ant-table-header{
  792. // width: calc(100% - 8px);//减去滚动条的宽度
  793. // }
  794. /deep/ .ant-table-tbody .ant-table-row td {
  795. padding-top: 6px;
  796. padding-bottom: 5px;
  797. }
  798. /deep/ .ant-table-thead > tr > th, .ant-table-tbody > tr > td {
  799. padding: 10px 16px;
  800. }
  801. /deep/ .table-page-search-wrapper .ant-form-inline .ant-form-item > .ant-form-item-label {
  802. width: 118px;
  803. }
  804. </style>