SyCarryModal.vue 28 KB

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