materialProcurementAdd.vue 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866
  1. <template>
  2. <a-modal
  3. :title="defaultMethod=='add'?'新增':'编辑'"
  4. width="95%"
  5. :visible="visible"
  6. :maskClosable="false"
  7. switchFullscreen
  8. @cancel="handleCancel"
  9. @ok='handleOk'
  10. >
  11. <a-card :bordered="false" class="top" style="margin-bottom:1%;margin-top:1%" :loading = 'loading'>
  12. <div class="table-page-search-wrapper">
  13. <a-form-model layout="inline" @keyup.enter.native="searchQuery" :model="form" :rules="rules" ref="form">
  14. <a-row :gutter="24">
  15. <a-col :md="4" :sm="24">
  16. <a-form-model-item label="生产组织" prop='orgName'>
  17. <a-input-search placeholder="请选择" v-model="form.orgName" @search="onSearchPlanOrg" readOnly></a-input-search>
  18. </a-form-model-item>
  19. </a-col>
  20. <a-col :md="4" :sm="24">
  21. <a-form-model-item label="单据号">
  22. <a-input placeholder="自动生成" v-model="form.orderCode" disabled></a-input>
  23. </a-form-model-item>
  24. </a-col>
  25. <a-col :md="4" :sm="24">
  26. <a-form-model-item label="单据日期" prop='orderDate'>
  27. <a-date-picker showTime valueFormat="YYYY-MM-DD" format = "YYYY-MM-DD" v-model="form.orderDate" style="width:100%"/>
  28. </a-form-model-item>
  29. </a-col>
  30. <a-col :md="4" :sm="24">
  31. <a-form-model-item label="单据状态">
  32. <a-select v-model="form.state" style='width:100%' disabled>
  33. <a-select-option value='开立'> 开立</a-select-option>
  34. <a-select-option value='审核'> 审核</a-select-option>
  35. <a-select-option value='已运算'> 已运算</a-select-option>
  36. <a-select-option value='关闭'> 关闭</a-select-option>
  37. </a-select>
  38. </a-form-model-item>
  39. </a-col>
  40. <a-col :md="4" :sm="24">
  41. <a-form-model-item label="业务员">
  42. <a-input-search placeholder="请选择" v-model="form.salesperson" @search="onSearchPerson" readOnly></a-input-search>
  43. </a-form-model-item>
  44. </a-col>
  45. <a-col :md="4" :sm="24">
  46. <a-form-model-item label="计划部门">
  47. <a-input-search placeholder="请选择" v-model="form.planDept" @search="onSearchDept" readOnly></a-input-search>
  48. </a-form-model-item>
  49. </a-col>
  50. <a-col :md="4" :sm="24">
  51. <a-form-model-item label="项目名称" prop='projectName'>
  52. <a-input-search placeholder="请选择" v-model="form.projectName" @search="onSearchProject" readOnly></a-input-search>
  53. </a-form-model-item>
  54. </a-col>
  55. <a-col :md="4" :sm="24">
  56. <a-form-model-item label="项目编码" prop='projectCode'>
  57. <a-input placeholder="请选择" v-model="form.projectCode" disabled></a-input>
  58. </a-form-model-item>
  59. </a-col>
  60. <a-col :md="4" :sm="24">
  61. <a-form-model-item label="业务类型" prop='type'>
  62. <a-select v-model="form.type" style='width:100%' >
  63. <a-select-option value='家装'>家装</a-select-option>
  64. <a-select-option value='工装'>工装</a-select-option>
  65. </a-select>
  66. </a-form-model-item>
  67. </a-col>
  68. <a-col :md="4" :sm="24">
  69. <a-form-model-item label="制单人">
  70. <a-input placeholder="自动" v-model="form.createBy" disabled></a-input>
  71. </a-form-model-item>
  72. </a-col>
  73. <a-col :md="4" :sm="24">
  74. <a-form-model-item label="审批人">
  75. <a-input placeholder="自动" v-model="form.reviewer" disabled></a-input>
  76. </a-form-model-item>
  77. </a-col>
  78. <a-col :md="4" :sm="24">
  79. <a-form-model-item label="工单号" prop='workNo'>
  80. <a-input placeholder="请输入" v-model="form.workNo"></a-input>
  81. </a-form-model-item>
  82. </a-col>
  83. </a-row>
  84. </a-form-model>
  85. </div>
  86. </a-card>
  87. <a-card :bordered="false" class="three" style="margin-bottom:1%" :loading = 'loading'>
  88. <div class="table-operator">
  89. <a-button type="danger" size="small" @click="addList">增行</a-button>
  90. <a-button size="small" @click="delectRow">删行</a-button>
  91. </div>
  92. <a-form-model ref="formRef" :model="formTable">
  93. <a-table
  94. ref="table"
  95. size="middle"
  96. bordered
  97. id='sonList'
  98. :columns="columns"
  99. rowKey="rowNo"
  100. :dataSource="formTable.dataSource"
  101. :pagination="false"
  102. :scroll="{ x: 4500, y: 300 }"
  103. :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
  104. @change="handleTableChange"
  105. >
  106. <span slot="quantityTitle" class="form-table-heard">
  107. 主数量
  108. </span>
  109. <span slot="unQuantityTitle" class="form-table-heard">
  110. 辅数量
  111. </span>
  112. <span slot="inventoryNameTitle" class="form-table-heard">
  113. 料品名称
  114. </span>
  115. <template slot="batch" slot-scope="text, record, index">
  116. <a-form-model-item prop="batch" class='sonItem'>
  117. <a-input placeholder="请输入" v-model="record.batch"></a-input>
  118. </a-form-model-item>
  119. </template>
  120. <template slot="inventoryName" slot-scope="text, record, index">
  121. <a-form-model-item :prop="'dataSource.'+index+'.inventoryName'" class='sonItem' :rules="rules1.inventoryName">
  122. <a-input-search placeholder="请选择" v-model="record.inventoryName" @search="onSearchInventory(record)" readOnly></a-input-search>
  123. </a-form-model-item>
  124. </template>
  125. <template slot="inventoryCode" slot-scope="text, record, index">
  126. <a-form-model-item prop="inventoryCode" class='sonItem'>
  127. <a-input placeholder="请输入" v-model="record.inventoryCode"></a-input>
  128. </a-form-model-item>
  129. </template>
  130. <template slot="attribute" slot-scope="text, record, index">
  131. <a-form-model-item prop="attribute" class='sonItem'>
  132. <a-input placeholder="请输入" v-model="record.attribute"></a-input>
  133. </a-form-model-item>
  134. </template>
  135. <template slot="unit" slot-scope="text, record, index">
  136. <a-form-model-item prop="unit" class='sonItem'>
  137. <a-input placeholder="请输入" v-model="record.unit"></a-input>
  138. </a-form-model-item>
  139. </template>
  140. <template slot="auxiliaryUnit" slot-scope="text, record, index">
  141. <a-form-model-item prop="auxiliaryUnit" class='sonItem'>
  142. <a-input placeholder="请输入" v-model="record.auxiliaryUnit"></a-input>
  143. </a-form-model-item>
  144. </template>
  145. <template slot="quantity" slot-scope="text, record, index">
  146. <a-form-model-item :prop="'dataSource.'+index+'.quantity'" class='sonItem' :rules="rules1.quantity">
  147. <a-input placeholder="请输入" v-model="record.quantity" @blur="chengQuantity(record)"></a-input>
  148. </a-form-model-item>
  149. </template>
  150. <template slot="unQuantity" slot-scope="text, record, index">
  151. <a-form-model-item :prop="'dataSource.'+index+'.unQuantity'" class='sonItem' :rules="rules1.unQuantity">
  152. <a-input placeholder="请输入" v-model="record.unQuantity" @blur="chengQuantity(record)"></a-input>
  153. </a-form-model-item>
  154. </template>
  155. <template slot="rate" slot-scope="text, record, index">
  156. <a-form-model-item prop="rate" class='sonItem'>
  157. <a-input placeholder="请输入" v-model="record.rate"></a-input>
  158. </a-form-model-item>
  159. </template>
  160. <template slot="specs" slot-scope="text, record, index">
  161. <a-form-model-item prop="specs" class='sonItem'>
  162. <a-input placeholder="请输入" v-model="record.specs"></a-input>
  163. </a-form-model-item>
  164. </template>
  165. <template slot="model" slot-scope="text, record, index">
  166. <a-form-model-item prop="model" class='sonItem'>
  167. <a-input placeholder="请输入" v-model="record.model"></a-input>
  168. </a-form-model-item>
  169. </template>
  170. <template slot="color" slot-scope="text, record, index">
  171. <a-form-model-item prop="color" class='sonItem'>
  172. <a-input placeholder="请输入" v-model="record.color"></a-input>
  173. </a-form-model-item>
  174. </template>
  175. <template slot="fixedNum" slot-scope="text, record, index">
  176. <a-form-model-item prop="fixedNum" class='sonItem'>
  177. <a-input placeholder="请输入" v-model="record.fixedNum"></a-input>
  178. </a-form-model-item>
  179. </template>
  180. <template slot="fixedLength" slot-scope="text, record, index">
  181. <a-form-model-item prop="fixedLength" class='sonItem'>
  182. <a-input placeholder="请输入" v-model="record.fixedLength"></a-input>
  183. </a-form-model-item>
  184. </template>
  185. <template slot="widthHeight" slot-scope="text, record, index">
  186. <a-form-model-item prop="widthHeight" class='sonItem'>
  187. <a-input placeholder="请输入" v-model="record.widthHeight"></a-input>
  188. </a-form-model-item>
  189. </template>
  190. <template slot="pieces" slot-scope="text, record, index">
  191. <a-form-model-item prop="pieces" class='sonItem'>
  192. <a-input placeholder="请输入" v-model="record.pieces"></a-input>
  193. </a-form-model-item>
  194. </template>
  195. <template slot="meterWeight" slot-scope="text, record, index">
  196. <a-form-model-item prop="meterWeight" class='sonItem'>
  197. <a-input placeholder="请输入" v-model="record.meterWeight"></a-input>
  198. </a-form-model-item>
  199. </template>
  200. <template slot="decorationLength" slot-scope="text, record, index">
  201. <a-form-model-item prop="decorationLength" class='sonItem'>
  202. <a-input placeholder="请输入" v-model="record.decorationLength"></a-input>
  203. </a-form-model-item>
  204. </template>
  205. <template slot="windowNo" slot-scope="text, record, index">
  206. <a-form-model-item prop="windowNo" class='sonItem'>
  207. <a-input placeholder="请输入" v-model="record.windowNo"></a-input>
  208. </a-form-model-item>
  209. </template>
  210. <template slot="exclusiveZone" slot-scope="text, record, index">
  211. <a-form-model-item prop="exclusiveZone" class='sonItem'>
  212. <a-input placeholder="请输入" v-model="record.exclusiveZone"></a-input>
  213. </a-form-model-item>
  214. </template>
  215. <template slot="widthLength" slot-scope="text, record, index">
  216. <a-form-model-item prop="widthLength" class='sonItem'>
  217. <a-input placeholder="请输入" v-model="record.widthLength"></a-input>
  218. </a-form-model-item>
  219. </template>
  220. <template slot="height" slot-scope="text, record, index">
  221. <a-form-model-item prop="height" class='sonItem'>
  222. <a-input placeholder="请输入" v-model="record.height"></a-input>
  223. </a-form-model-item>
  224. </template>
  225. <template slot="buildingNumber" slot-scope="text, record, index">
  226. <a-form-model-item prop="buildingNumber" class='sonItem'>
  227. <a-input placeholder="请输入" v-model="record.buildingNumber"></a-input>
  228. </a-form-model-item>
  229. </template>
  230. <template slot="framesTang" slot-scope="text, record, index">
  231. <a-form-model-item prop="framesTang" class='sonItem'>
  232. <a-input placeholder="请输入" v-model="record.framesTang"></a-input>
  233. </a-form-model-item>
  234. </template>
  235. <template slot="framesCount" slot-scope="text, record, index">
  236. <a-form-model-item prop="framesCount" class='sonItem'>
  237. <a-input placeholder="请输入" v-model="record.framesCount"></a-input>
  238. </a-form-model-item>
  239. </template>
  240. <template slot="leafCount" slot-scope="text, record, index">
  241. <a-form-model-item prop="leafCount" class='sonItem'>
  242. <a-input placeholder="请输入" v-model="record.leafCount"></a-input>
  243. </a-form-model-item>
  244. </template>
  245. <template slot="semiClass" slot-scope="text, record, index">
  246. <a-form-model-item prop="semiClass" class='sonItem'>
  247. <a-input placeholder="请输入" v-model="record.semiClass"></a-input>
  248. </a-form-model-item>
  249. </template>
  250. <template slot="area" slot-scope="text, record, index">
  251. <a-form-model-item prop="area" class='sonItem'>
  252. <a-input placeholder="请输入" v-model="record.area"></a-input>
  253. </a-form-model-item>
  254. </template>
  255. <template slot="cuttingLength" slot-scope="text, record, index">
  256. <a-form-model-item prop="cuttingLength" class='sonItem'>
  257. <a-input placeholder="请输入" v-model="record.cuttingLength"></a-input>
  258. </a-form-model-item>
  259. </template>
  260. <template slot="cuttingLeftDown" slot-scope="text, record, index">
  261. <a-form-model-item prop="cuttingLeftDown" class='sonItem'>
  262. <a-input placeholder="请输入" v-model="record.cuttingLeftDown"></a-input>
  263. </a-form-model-item>
  264. </template>
  265. <template slot="cuttingRightTop" slot-scope="text, record, index">
  266. <a-form-model-item prop="cuttingRightTop" class='sonItem'>
  267. <a-input placeholder="请输入" v-model="record.cuttingRightTop"></a-input>
  268. </a-form-model-item>
  269. </template>
  270. <template slot="series" slot-scope="text, record, index">
  271. <a-form-model-item prop="series" class='sonItem'>
  272. <a-input placeholder="请输入" v-model="record.series"></a-input>
  273. </a-form-model-item>
  274. </template>
  275. <template slot="glassNumber" slot-scope="text, record, index">
  276. <a-form-model-item prop="glassNumber" class='sonItem'>
  277. <a-input placeholder="请输入" v-model="record.glassNumber"></a-input>
  278. </a-form-model-item>
  279. </template>
  280. </a-table>
  281. </a-form-model>
  282. </a-card>
  283. <projectPopup ref="projectPopup" @okData="okData"></projectPopup>
  284. <inventoryPopup ref="inventoryPopup" @okData="okDataInvent"></inventoryPopup>
  285. <deparmentPopup ref="deparmentPopup" @okData="okDataDeparment"></deparmentPopup>
  286. <OperatorsPopup ref="OperatorsPopup" @okData="okDataOperators"></OperatorsPopup>
  287. <organizationPopup ref="organizationPopup" @okData="okDataOrganization"></organizationPopup>
  288. </a-modal>
  289. </template>
  290. <script>
  291. import { FormTypes } from '@/utils/JEditableTableUtil'
  292. import { JEditableTableModelMixin } from '@/mixins/JEditableTableModelMixin'
  293. import moment from "moment"
  294. import { httpAction ,getAction,postAction,putAction} from '@/api/manage'
  295. import projectPopup from '../../Popup/projectPopup'
  296. import inventoryPopup from '../../Popup/inventoryPopup.vue'
  297. import deparmentPopup from '../../Popup/deparmentPopup.vue'
  298. import OperatorsPopup from '../../Popup/OperatorsPopup.vue'
  299. import organizationPopup from '../../Popup/organizationPopup.vue'
  300. export default {
  301. name: 'materialProcurementAdd',
  302. mixins: [JEditableTableModelMixin],
  303. components: {
  304. projectPopup,
  305. inventoryPopup,
  306. deparmentPopup,
  307. OperatorsPopup,
  308. organizationPopup
  309. },
  310. data() {
  311. return {
  312. visible:false,
  313. form:{state:"开立"},
  314. defaultMethod:'add',
  315. formTable:{
  316. dataSource:[],
  317. },
  318. rules:{
  319. orgName: [
  320. { required: true, trigger: 'change' },
  321. ],
  322. orderDate:[
  323. { required: true, trigger: 'change' },
  324. ],
  325. projectName:[
  326. { required: true, trigger: 'change' },
  327. ],
  328. projectCode:[
  329. { required: true, trigger: 'change' },
  330. ],
  331. type:[
  332. { required: true, trigger: 'change' },
  333. ],
  334. workNo:[
  335. { required: true, trigger: 'change' },
  336. ],
  337. },
  338. rules1:{
  339. quantity:{required:true,message:"不可为空"},
  340. unQuantity:{required:true,message:"不可为空"},
  341. inventoryName:{required:true,message:"不可为空"},
  342. },
  343. loading:false,
  344. // ipagination:{},
  345. selectedRowKeys:[],
  346. selectedRows:[],
  347. columns: [
  348. {
  349. title: '#',
  350. dataIndex: '',
  351. key: 'rowIndex',
  352. width: 60,
  353. align: "center",
  354. customRender:function (t, r, index) {
  355. return parseInt(index)+1;
  356. }
  357. },
  358. {
  359. title: '批次',
  360. align:"center",
  361. dataIndex: 'batch',
  362. ellipsis: true,
  363. scopedSlots: { customRender: 'batch' }
  364. },
  365. {
  366. title: '项目编码',
  367. align:"center",
  368. dataIndex: 'projectCode',
  369. ellipsis: true,
  370. },
  371. {
  372. title: '项目名称',
  373. align:"center",
  374. dataIndex: 'projectName',
  375. ellipsis: true,
  376. },
  377. {
  378. // title: '料品名称',
  379. align:"center",
  380. dataIndex: 'inventoryName',
  381. ellipsis: true,
  382. scopedSlots: { customRender: 'inventoryName' } ,
  383. slots:{title:'inventoryNameTitle'},
  384. },
  385. {
  386. title: '料品编码',
  387. align:"center",
  388. dataIndex: 'inventoryCode',
  389. ellipsis: true,
  390. },
  391. {
  392. title: '料品属性',
  393. align:"center",
  394. dataIndex: 'attribute',
  395. ellipsis: true,
  396. },
  397. {
  398. title: '计量单位',
  399. align:"center",
  400. dataIndex: 'unit',
  401. ellipsis: true,
  402. },
  403. {
  404. title: '辅计量单位',
  405. align:"center",
  406. dataIndex: 'auxiliaryUnit',
  407. ellipsis: true,
  408. },
  409. {
  410. // title: '主数量',
  411. align:"center",
  412. dataIndex: 'quantity',
  413. ellipsis: true,
  414. scopedSlots: { customRender: 'quantity' } ,
  415. slots:{title:'quantityTitle'},
  416. },
  417. {
  418. // title: '辅数量',
  419. align:"center",
  420. dataIndex: 'unQuantity',
  421. ellipsis: true,
  422. scopedSlots: { customRender: 'unQuantity' } ,
  423. slots:{title:'unQuantityTitle'},
  424. },
  425. {
  426. title: '换算率',
  427. align:"center",
  428. dataIndex: 'rate',
  429. ellipsis: true,
  430. },
  431. {
  432. title: '规格',
  433. align:"center",
  434. dataIndex: 'specs',
  435. ellipsis: true,
  436. },
  437. {
  438. title: '型号',
  439. align:"center",
  440. dataIndex: 'model',
  441. ellipsis: true,
  442. },
  443. {
  444. title: '颜色',
  445. align:"center",
  446. dataIndex: 'color',
  447. ellipsis: true,
  448. scopedSlots: { customRender: 'color' }
  449. },
  450. {
  451. title: '支数',
  452. align:"center",
  453. dataIndex: 'fixedNum',
  454. ellipsis: true,
  455. scopedSlots: { customRender: 'fixedNum' }
  456. },
  457. {
  458. title: '定尺',
  459. align:"center",
  460. dataIndex: 'fixedLength',
  461. ellipsis: true,
  462. scopedSlots: { customRender: 'fixedLength' }
  463. },
  464. {
  465. title: '宽/高',
  466. align:"center",
  467. dataIndex: 'widthHeight',
  468. ellipsis: true,
  469. scopedSlots: { customRender: 'widthHeight' }
  470. },
  471. {
  472. title: '片数',
  473. align:"center",
  474. dataIndex: 'pieces',
  475. ellipsis: true,
  476. scopedSlots: { customRender: 'pieces' }
  477. },
  478. {
  479. title: '米重',
  480. align:"center",
  481. dataIndex: 'meterWeight',
  482. ellipsis: true,
  483. scopedSlots: { customRender: 'meterWeight' }
  484. },
  485. {
  486. title: '装饰面周长',
  487. align:"center",
  488. dataIndex: 'decorationLength',
  489. ellipsis: true,
  490. scopedSlots: { customRender: 'decorationLength' }
  491. },
  492. {
  493. title: '窗号',
  494. align:"center",
  495. dataIndex: 'windowNo',
  496. ellipsis: true,
  497. scopedSlots: { customRender: 'windowNo' }
  498. },
  499. {
  500. title: '专用区',
  501. align:"center",
  502. dataIndex: 'exclusiveZone',
  503. ellipsis: true,
  504. scopedSlots: { customRender: 'exclusiveZone' }
  505. },
  506. {
  507. title: '宽度/长度',
  508. align:"center",
  509. dataIndex: 'widthLength',
  510. ellipsis: true,
  511. scopedSlots: { customRender: 'widthLength' }
  512. },
  513. {
  514. title: '高度',
  515. align:"center",
  516. dataIndex: 'height',
  517. ellipsis: true,
  518. scopedSlots: { customRender: 'height' }
  519. },
  520. {
  521. title: '楼号楼层',
  522. align:"center",
  523. dataIndex: 'buildingNumber',
  524. ellipsis: true,
  525. scopedSlots: { customRender: 'buildingNumber' }
  526. },
  527. {
  528. title: '樘数',
  529. align:"center",
  530. dataIndex: 'framesTang',
  531. ellipsis: true,
  532. scopedSlots: { customRender: 'framesTang' }
  533. },
  534. {
  535. title: '框数量',
  536. align:"center",
  537. dataIndex: 'framesCount',
  538. ellipsis: true,
  539. scopedSlots: { customRender: 'framesCount' }
  540. },
  541. {
  542. title: '扇数量',
  543. align:"center",
  544. dataIndex: 'leafCount',
  545. ellipsis: true,
  546. scopedSlots: { customRender: 'leafCount' }
  547. },
  548. {
  549. title: '半成品分类',
  550. align:"center",
  551. dataIndex: 'semiClass',
  552. ellipsis: true,
  553. scopedSlots: { customRender: 'semiClass' }
  554. },
  555. {
  556. title: '面积',
  557. align:"center",
  558. dataIndex: 'area',
  559. ellipsis: true,
  560. scopedSlots: { customRender: 'area' }
  561. },
  562. {
  563. title: '切割长度',
  564. align:"center",
  565. dataIndex: 'cuttingLength',
  566. ellipsis: true,
  567. scopedSlots: { customRender: 'cuttingLength' }
  568. },
  569. {
  570. title: '切割角度左下',
  571. align:"center",
  572. dataIndex: 'cuttingLeftDown',
  573. ellipsis: true,
  574. scopedSlots: { customRender: 'cuttingLeftDown' }
  575. },
  576. {
  577. title: '切割角度右上',
  578. align:"center",
  579. dataIndex: 'cuttingRightTop',
  580. ellipsis: true,
  581. scopedSlots: { customRender: 'cuttingRightTop' }
  582. },
  583. {
  584. title: '系列',
  585. align:"center",
  586. dataIndex: 'series',
  587. ellipsis: true,
  588. scopedSlots: { customRender: 'series' }
  589. },
  590. {
  591. title: '玻璃编号',
  592. align:"center",
  593. dataIndex: 'glassNumber',
  594. ellipsis: true,
  595. scopedSlots: { customRender: 'glassNumber' }
  596. },
  597. ],
  598. }
  599. },
  600. created() {
  601. },
  602. methods: {
  603. handleCancel(){
  604. this.visible=false
  605. this.defaultMethod='add'
  606. this.formTable.dataSource = []
  607. this.form={}
  608. },
  609. handleOk(){
  610. this.$refs.form.validate(success => {
  611. if (success) {
  612. this.$refs.formRef.validate(val => {
  613. if (val) {
  614. var mergedObj = this.form
  615. mergedObj.madeMaterialRequisitionDetailList = this.formTable.dataSource
  616. if(this.formTable.dataSource.length==0){
  617. this.$message.warning('请添加子表数据!')
  618. }else{
  619. this.loading = true
  620. if(this.defaultMethod=='add'){
  621. postAction('/materialRequisition/madeMaterialRequisition/add', mergedObj).then((res) => {
  622. if (res.success) {
  623. this.$message.success('添加成功!');
  624. this.handleCancel()
  625. this.$emit('ok')
  626. } else {
  627. this.$message.error(res.message);
  628. }
  629. }).finally(() => {
  630. this.loading = false
  631. })
  632. }else{
  633. postAction('/materialRequisition/madeMaterialRequisition/edit', mergedObj).then((res) => {
  634. if (res.success) {
  635. this.$message.success('编辑成功!');
  636. this.handleCancel()
  637. this.$emit('ok')
  638. } else {
  639. this.$message.error(res.message);
  640. }
  641. }).finally(() => {
  642. this.loading = false
  643. })
  644. }
  645. }
  646. }
  647. })
  648. }
  649. })
  650. },
  651. onSelectChange(selectedRowKeys, selectionRows) {
  652. this.selectedRowKeys = selectedRowKeys;
  653. this.selectedRows = selectionRows;
  654. },
  655. handleTableChange(){
  656. },
  657. onSearchPlanOrg(){
  658. this.$refs.organizationPopup.visible = true
  659. this.$refs.organizationPopup.getData()
  660. },
  661. //获取主表信息
  662. getMainData(id){
  663. getAction('/materialRequisition/madeMaterialRequisition/queryById',{id:id}).then(res=>{
  664. if(res.success){
  665. this.form=res.result
  666. this.getSonData(this.form.id)
  667. }else{
  668. this.$message.error(res.message);
  669. }
  670. })
  671. },
  672. //获取子表信息
  673. getSonData(id){
  674. getAction('/materialRequisition/madeMaterialRequisition/querymadeMaterialRequisitionDetailByMainId',{id:id}).then(res=>{
  675. if(res.success){
  676. this.formTable.dataSource =res.result
  677. this.formTable.dataSource.map((item,index)=>{
  678. item.rowNo =index+1
  679. })
  680. }else{
  681. this.$message.error(res.message);
  682. }
  683. })
  684. },
  685. addList(){
  686. this.formTable.dataSource.unshift({rowNo: this.formTable.dataSource.length+1,projectCode:this.form.projectCode,projectName:this.form.projectName,rate:''})
  687. },
  688. onSearchProject(){
  689. if(this.form.orgName&&this.form.orgName!==''){
  690. this.$refs.projectPopup.visible = true
  691. this.$refs.projectPopup.getData(this.form.planOrg)
  692. }else{
  693. this.$message.warning("请选择组织!")
  694. }
  695. },
  696. onSearchDept(){
  697. if(this.form.orgName&&this.form.orgName!==''){
  698. this.$refs.deparmentPopup.visible = true
  699. this.$refs.deparmentPopup.getData(this.form.planOrg)
  700. }else{
  701. this.$message.warning("请选择组织!")
  702. }
  703. },
  704. onSearchPerson(){
  705. if(this.form.orgName&&this.form.orgName!==''){
  706. this.$refs.OperatorsPopup.visible = true
  707. this.$refs.OperatorsPopup.getData(this.form.planOrg)
  708. }else{
  709. this.$message.warning("请选择组织!")
  710. }
  711. },
  712. onSearchInventory(record){
  713. if(this.form.orgName&&this.form.orgName!==''){
  714. this.$refs.inventoryPopup.visible = true
  715. this.$refs.inventoryPopup.getData(this.form.planOrg )
  716. this.$refs.inventoryPopup.record=record
  717. }else{
  718. this.$message.warning("请选择组织!")
  719. }
  720. },
  721. okData(data){
  722. this.$set(this.form,'projectCode',data.Code)
  723. this.$set(this.form,'projectName',data.Name)
  724. this.$set(this.form,'project',data.ID)
  725. this.formTable.dataSource.map(item=>{
  726. item.projectCode = data.Code
  727. item.projectName = data.Name
  728. })
  729. if(this.form.projectName&&this.form.projectName!==''){
  730. this.$refs.form.clearValidate(['projectName']);
  731. }
  732. if(this.form.projectCode&&this.form.projectCode!==''){
  733. this.$refs.form.clearValidate(['projectCode']);
  734. }
  735. },
  736. chengQuantity(record){
  737. if(record.quantity&&record.quantity!==''&&record.unQuantity&&record.unQuantity!==''){
  738. record.rate = ''
  739. var num = (Number(record.unQuantity)/Number(record.quantity)).toFixed(2)
  740. this.$set(record,'rate',num)
  741. }else{
  742. record.rate = ''
  743. }
  744. },
  745. okDataInvent(data,recoerd){
  746. this.$set(recoerd,'inventoryCode',data.Code)
  747. this.$set(recoerd,'inventoryName',data.Name)
  748. this.$set(recoerd,'specs',data.SPECS)
  749. this.$set(recoerd,'attribute',data.Code1 )
  750. this.$set(recoerd,'unit',data.unit )
  751. this.$set(recoerd,'auxiliaryUnit',data.auxiliaryUnit )
  752. this.$set(recoerd,'inventory',data.ID )
  753. this.$refs.formRef.clearValidate(['inventoryName']);
  754. },
  755. okDataDeparment(data){
  756. this.$set(this.form,'planDept',data.Name)
  757. this.$set(this.form,'planDeptId',data.ID)
  758. },
  759. okDataOperators(data){
  760. this.$set(this.form,'salesperson',data.Name)
  761. this.$set(this.form,'salespersonId',data.ID)
  762. },
  763. okDataOrganization(data){
  764. this.$set(this.form,'orgName',data.Name)
  765. this.$set(this.form,'orgCode',data.Code)
  766. this.$set(this.form,'planOrg',data.ID)
  767. if(this.form.orgName&&this.form.orgName!==''){
  768. this.$refs.form.clearValidate(['orgName']);
  769. }
  770. },
  771. delectRow(){
  772. if( this.selectedRowKeys.length==0){
  773. this.$message.warning('请勾选子表数据!')
  774. }else{
  775. this.selectedRowKeys.map(event=>{
  776. this.formTable.dataSource = this.formTable.dataSource.filter( (x)=> {return x.rowNo !== event});
  777. })
  778. }
  779. },
  780. }
  781. }
  782. </script>
  783. <style scoped lang="less">
  784. /* @import '~@assets/less/common.less' */
  785. /deep/.ant-input{
  786. height:29px;
  787. }
  788. /deep/.ant-select-selection--single {
  789. height: 29px;
  790. }
  791. /deep/.ant-select{
  792. font-size: 12px;
  793. }
  794. /deep/.ant-form label{
  795. font-size: 12px;
  796. }
  797. /deep/.table-page-search-wrapper .ant-form-inline .ant-form-item{
  798. margin-bottom:9px
  799. }
  800. /deep/.moddle>.ant-card-body{
  801. padding-bottom:0px;
  802. padding-top: 12px;
  803. }
  804. /deep/.top>.ant-card-body{
  805. padding-bottom:0px;
  806. padding-top: 12px;
  807. }
  808. /deep/.ant-btn{
  809. height:28px
  810. }
  811. /deep/.ant-modal-body{
  812. padding-bottom: 0px;
  813. padding-top: 0px;
  814. }
  815. // /deep/.ant-modal-body{
  816. // background: #f0f2f5;
  817. // }
  818. /deep/.ant-modal-content{
  819. background: #f0f2f5;
  820. }
  821. /deep/.ant-card-body .table-operator {
  822. margin-bottom: 0px;
  823. }
  824. /deep/.three>.ant-card-body{
  825. padding-bottom:12px;
  826. padding-top: 12px;
  827. }
  828. /deep/.bottom>.ant-card-body{
  829. padding-bottom:0px;
  830. padding-top: 12px;
  831. }
  832. /deep/.ant-calendar-picker{
  833. min-width: 0px !important;
  834. }
  835. /deep/.sonItem {
  836. margin-bottom:0px !important
  837. }
  838. /deep/#sonList>.ant-spin-nested-loading>.ant-spin-container>.ant-table>.ant-table-content>.ant-table-scroll>.ant-table-body>.ant-table-fixed>.ant-table-tbody > tr > td {
  839. padding: 0px 8px !important;
  840. }
  841. // 表单校验隐藏提示文字
  842. // /deep/.ant-form-explain{
  843. // display:none
  844. // }
  845. .form-table-heard:before {
  846. content:'*';
  847. color:red
  848. }
  849. /deep/.ant-form-explain, .ant-form-split {
  850. display: none;
  851. }
  852. </style>