productionTotalOrderAdd.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434
  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. <template slot="footer">
  12. <a-button @click="handleCancel">关闭</a-button>
  13. <a-button type="primary" @click="handleOk" v-if="allowEdit=='yes'">保存</a-button>
  14. </template>
  15. <a-card :bordered="false" class="top" style="margin-bottom:1%;margin-top:1%" :loading = 'loading'>
  16. <div class="table-page-search-wrapper">
  17. <a-form layout="inline" @keyup.enter.native="searchQuery">
  18. <a-row :gutter="24">
  19. <a-col :md="4" :sm="24">
  20. <a-form-item label="生产组织">
  21. <a-input-search placeholder="请输入" v-model="form.productionOrg" @search="onSearch" :disabled="allowEdit=='no'"></a-input-search>
  22. </a-form-item>
  23. </a-col>
  24. <a-col :md="4" :sm="24">
  25. <a-form-item label="单据号">
  26. <a-input placeholder="请输入" v-model="form.orderCode" :disabled="allowEdit=='no'"></a-input>
  27. </a-form-item>
  28. </a-col>
  29. <a-col :md="4" :sm="24">
  30. <a-form-item label="单据日期">
  31. <a-date-picker showTime valueFormat="YYYY-MM-DD" format = "YYYY-MM-DD" v-model="form.orderDate" style="width:100%" :disabled="allowEdit=='no'"/>
  32. </a-form-item>
  33. </a-col>
  34. <a-col :md="4" :sm="24">
  35. <a-form-item label="单据状态">
  36. <a-select v-model="form.state" style='width:100%' :disabled="allowEdit=='no'">
  37. <a-select-option value='自由'> 自由</a-select-option>
  38. <a-select-option value='已批准'> 已批准</a-select-option>
  39. </a-select>
  40. </a-form-item>
  41. </a-col>
  42. <a-col :md="4" :sm="24">
  43. <a-form-item label="业务员">
  44. <a-input placeholder="请输入" v-model="form.salesperson" :disabled="allowEdit=='no'"></a-input>
  45. </a-form-item>
  46. </a-col>
  47. <a-col :md="4" :sm="24">
  48. <a-form-item label="计划部门">
  49. <a-input-search placeholder="请输入" v-model="form.planDept" @search="onSearch" :disabled="allowEdit=='no'"></a-input-search>
  50. </a-form-item>
  51. </a-col>
  52. <a-col :md="4" :sm="24">
  53. <a-form-item label="项目">
  54. <a-input-search placeholder="请输入" v-model="form.project" @search="onSearch" :disabled="allowEdit=='no'"></a-input-search>
  55. </a-form-item>
  56. </a-col>
  57. <a-col :md="4" :sm="24">
  58. <a-form-item label="备注">
  59. <a-input-search placeholder="请输入" v-model="form.remarks" @search="onSearch" :disabled="allowEdit=='no'"></a-input-search>
  60. </a-form-item>
  61. </a-col>
  62. <a-col :md="4" :sm="24">
  63. <a-form-item label="业务类型">
  64. <a-select v-model="form.type" style='width:100%' :disabled="allowEdit=='no'">
  65. <a-select-option value='工装'> 工装</a-select-option>
  66. <a-select-option value='家装'> 家装</a-select-option>
  67. </a-select>
  68. </a-form-item>
  69. </a-col>
  70. <a-col :md="4" :sm="24">
  71. <a-form-item label="制单人">
  72. <a-input placeholder="请输入" v-model="form.createBy" disabled></a-input>
  73. </a-form-item>
  74. </a-col>
  75. <a-col :md="4" :sm="24">
  76. <a-form-item label="审核人">
  77. <a-input placeholder="请输入" v-model="form.reviewer" disabled></a-input>
  78. </a-form-item>
  79. </a-col>
  80. <a-col :md="4" :sm="24">
  81. <a-form-item label="工单号">
  82. <a-input placeholder="请输入" v-model="form.workNo" :disabled="allowEdit=='no'"></a-input>
  83. </a-form-item>
  84. </a-col>
  85. <a-col :md="4" :sm="24">
  86. <a-form-item label="项目编码" >
  87. <a-input placeholder="请输入" v-model="form.projectCode" :disabled="allowEdit=='no'"></a-input>
  88. </a-form-item>
  89. </a-col>
  90. <a-col :md="4" :sm="24">
  91. <a-form-item label="来源标识" >
  92. <a-input placeholder="请输入" v-model="form.sourceInfo" :disabled="allowEdit=='no'"></a-input>
  93. </a-form-item>
  94. </a-col>
  95. <a-col :md="4" :sm="24">
  96. <a-form-item label="改单版本" >
  97. <a-input placeholder="请输入" v-model="form.version" :disabled="allowEdit=='no'"></a-input>
  98. </a-form-item>
  99. </a-col>
  100. </a-row>
  101. </a-form>
  102. </div>
  103. </a-card>
  104. <a-card :bordered="false" class="three" style="margin-bottom:1%" :loading = 'loading'>
  105. <div class="table-operator">
  106. <a-button type="danger" size="small" @click="addList" :disabled="allowEdit=='no'">增行</a-button>
  107. <a-button size="small" @click="delectRow" :disabled="allowEdit=='no'">删行</a-button>
  108. <a-select v-model="execute" style='width:9%' placeholder="委外" @change="changeChose">
  109. <a-select-option value='生产出入库页签' > 生产出入库页签</a-select-option>
  110. <a-select-option value='选择委外材料明细' v-if="allowEdit=='no'" > 选择委外材料明细</a-select-option>
  111. <a-select-option value='修改入库颜色' v-if="allowEdit=='no'" > 修改入库颜色</a-select-option>
  112. <a-select-option value='修改出库颜色' v-if="allowEdit=='no'" > 修改出库颜色</a-select-option>
  113. <a-select-option value='委外增行' v-if="allowEdit=='no'"> 委外增行</a-select-option>
  114. <a-select-option value='委外拆分行' v-if="allowEdit=='no'"> 委外拆分行</a-select-option>
  115. <a-select-option value='委外删行' v-if="allowEdit=='no'"> 委外删行</a-select-option>
  116. <a-select-option value='委外保存' v-if="allowEdit=='no'"> 委外保存</a-select-option>
  117. </a-select>
  118. </div>
  119. <a-tabs v-model="activeKey" @change="handleChangeTabs">
  120. <a-tab-pane tab="成品明细" :key="refKeys[0]" :forceRender="true">
  121. <productDetails ref="productDetails"></productDetails>
  122. </a-tab-pane>
  123. <a-tab-pane tab="材料明细" :key="refKeys[1]" :forceRender="true">
  124. <material ref="material" @changeEdit = 'changeEdit' @clearn="clearnExecute"></material>
  125. </a-tab-pane>
  126. <a-tab-pane tab="委外其他出库" :key="refKeys[2]" :forceRender="true">
  127. <Outbound ref='Outbound' @changeOutColor ='changeEdit'></Outbound>
  128. </a-tab-pane>
  129. <a-tab-pane tab="委外其他入库" :key="refKeys[3]" :forceRender="true">
  130. <Warehousing ref='Warehousing' @changeWareColor ='changeEdit'></Warehousing>
  131. </a-tab-pane>
  132. </a-tabs>
  133. </a-card>
  134. </a-modal>
  135. </template>
  136. <script>
  137. import { FormTypes } from '@/utils/JEditableTableUtil'
  138. import { JEditableTableModelMixin } from '@/mixins/JEditableTableModelMixin'
  139. import productDetails from './productDetails'
  140. import material from './material'
  141. import Outbound from './Outbound'
  142. import Warehousing from './Warehousing'
  143. import moment from "moment"
  144. import { httpAction ,getAction,postAction,putAction} from '@/api/manage'
  145. export default {
  146. name: 'materialProcurementAdd',
  147. mixins: [JEditableTableModelMixin],
  148. components: {
  149. productDetails,
  150. material,
  151. Outbound,
  152. Warehousing
  153. },
  154. data() {
  155. return {
  156. visible:false,
  157. form:{},
  158. form1:{},
  159. execute:'',
  160. defaultMethod:'add',
  161. allowEdit:'yes',
  162. allowEditMaterial:'no',
  163. dataSource:[],
  164. loading:false,
  165. // ipagination:{},
  166. selectedRowKeys:[],
  167. selectedRows:[],
  168. activeKey:'finishProduct',
  169. refKeys:['finishProduct','material','Outbound','Warehousing'],
  170. }
  171. },
  172. created() {
  173. },
  174. methods: {
  175. handleCancel(){
  176. this.visible=false
  177. this.defaultMethod='add'
  178. this.allowEdit = 'yes'
  179. this.activeKey='finishProduct',
  180. this.execute = ''
  181. this.dataSource = []
  182. this.form={}
  183. this.form1={}
  184. this.$refs.material.allowEditMaterial ='no'
  185. this.$refs.Warehousing.allowEditColor ='no'
  186. this.$refs.Outbound.allowEditColor ='no'
  187. this.$emit('ok')
  188. },
  189. changeChose(prop){
  190. if(prop=='选择委外材料明细'){
  191. this.$refs.material.allowEditMaterial ='yes'
  192. }else if(prop == '修改入库颜色'){
  193. this.$refs.Warehousing.allowEditColor ='yes'
  194. }else if(prop == '修改出库颜色'){
  195. this.$refs.Outbound.allowEditColor ='yes'
  196. }else if(prop == '委外增行'){
  197. this.$refs.material.addMaterial()
  198. }else if(prop =='委外拆分行'){
  199. this.$refs.material.copyRow()
  200. }else if(prop =='委外删行'){
  201. this.$refs.material.delecteCopyRow()
  202. }else if(prop =='委外保存'){
  203. this.changeEdit()
  204. }
  205. },
  206. handleOk(){
  207. var madeProductionOrdersPage = this.form
  208. madeProductionOrdersPage.madeProductionOrdersFinishedList = this.$refs.productDetails.dataSource
  209. madeProductionOrdersPage.madeProductionOrdersMaterialList = this.$refs.material.dataSource
  210. madeProductionOrdersPage.madeProductionOrdersOutList = this.$refs.Outbound.dataSource
  211. madeProductionOrdersPage.madeProductionOrdersInList = this.$refs.Warehousing.dataSource
  212. this.loading = true
  213. if(this.defaultMethod=='add'){
  214. postAction('/productionOrder/madeProductionOrders/add', madeProductionOrdersPage).then((res) => {
  215. if (res.success) {
  216. this.$message.success('添加成功!');
  217. this.handleCancel()
  218. this.$emit('ok')
  219. } else {
  220. this.$message.error(res.message);
  221. }
  222. }).finally(() => {
  223. this.loading = false
  224. })
  225. }else{
  226. postAction('/productionOrder/madeProductionOrders/edit', madeProductionOrdersPage).then((res) => {
  227. if (res.success) {
  228. this.handleCancel()
  229. this.$emit('ok')
  230. this.$message.success('编辑成功!');
  231. } else {
  232. this.$message.error(res.message);
  233. }
  234. }).finally(() => {
  235. this.loading = false
  236. })
  237. }
  238. },
  239. changeEdit(){
  240. var madeProductionOrdersPage = this.form
  241. madeProductionOrdersPage.madeProductionOrdersFinishedList = this.$refs.productDetails.dataSource
  242. madeProductionOrdersPage.madeProductionOrdersMaterialList = this.$refs.material.dataSource
  243. madeProductionOrdersPage.madeProductionOrdersOutList = this.$refs.Outbound.dataSource
  244. madeProductionOrdersPage.madeProductionOrdersInList = this.$refs.Warehousing.dataSource
  245. postAction('/productionOrder/madeProductionOrders/editChild', madeProductionOrdersPage).then((res) => {
  246. if (res.success) {
  247. console.log(res.message);
  248. this.$refs.productDetails.dataSource = madeProductionOrdersPage.madeProductionOrdersFinishedList
  249. this.$refs.material.dataSource = madeProductionOrdersPage.madeProductionOrdersMaterialList
  250. this.$refs.Outbound.dataSource = madeProductionOrdersPage.madeProductionOrdersOutList
  251. this.$refs.Warehousing.dataSource = madeProductionOrdersPage.madeProductionOrdersInList
  252. } else {
  253. this.$message.error(res.message);
  254. }
  255. }).finally(() => {
  256. })
  257. },
  258. handleTableChange(){
  259. },
  260. onSearch(){
  261. },
  262. //获取主表信息
  263. getMainData(id){
  264. getAction('/productionOrder/madeProductionOrders/queryById',{id:id}).then(res=>{
  265. if(res.success){
  266. this.form=res.result
  267. this.getProductData(this.form.id)
  268. this.getMaterialData(this.form.id)
  269. this.getOutboundData(this.form.id)
  270. this.getWarehousingData(this.form.id)
  271. }else{
  272. this.$message.error(res.message);
  273. }
  274. })
  275. },
  276. //获取子表信息
  277. getProductData(id){
  278. //成品明细
  279. this.$refs.productDetails.allowEdit = this.allowEdit
  280. getAction('/productionOrder/madeProductionOrders/queryMadeProductionOrdersFinishedByMainId',{id:id}).then(res=>{
  281. if(res.success){
  282. this.$refs.productDetails.dataSource =res.result
  283. this.$refs.productDetails.dataSource.map((item,index)=>{
  284. item.rowNo =index+1
  285. })
  286. }else{
  287. this.$message.error(res.message);
  288. }
  289. })
  290. },
  291. //获取子表信息
  292. getMaterialData(id){
  293. //材料明细
  294. this.$refs.material.allowEdit = this.allowEdit
  295. getAction('/productionOrder/madeProductionOrders/queryMadeProductionOrdersMaterialByMainId',{id:id}).then(res=>{
  296. if(res.success){
  297. this.$refs.material.dataSource =res.result
  298. this.$refs.material.dataSource.map((item,index)=>{
  299. item.rowNo =index+1
  300. })
  301. }else{
  302. this.$message.error(res.message);
  303. }
  304. })
  305. },
  306. //获取子表信息
  307. getOutboundData(id){
  308. //委外出库
  309. getAction('/productionOrder/madeProductionOrders/queryMadeProductionOrdersOutByMainId',{id:id}).then(res=>{
  310. if(res.success){
  311. this.$refs.Outbound.dataSource =res.result
  312. this.$refs.Outbound.dataSource.map((item,index)=>{
  313. item.rowNo =index+1
  314. })
  315. }else{
  316. this.$message.error(res.message);
  317. }
  318. })
  319. },
  320. //获取子表信息
  321. getWarehousingData(id){
  322. //委外入库
  323. getAction('/productionOrder/madeProductionOrders/queryMadeProductionOrdersInByMainId',{id:id}).then(res=>{
  324. if(res.success){
  325. this.$refs.Warehousing.dataSource =res.result
  326. this.$refs.Warehousing.dataSource.map((item,index)=>{
  327. item.rowNo =index+1
  328. })
  329. }else{
  330. this.$message.error(res.message);
  331. }
  332. })
  333. },
  334. addList(){
  335. if(this.activeKey=='finishProduct'){
  336. this.$refs.productDetails.addList()
  337. }else if(this.activeKey=='material'){
  338. this.$refs.material.addList()
  339. }
  340. // else if(this.activeKey=='Outbound'){
  341. // this.$refs.Outbound.addList()
  342. // }else if(this.activeKey=='Warehousing'){
  343. // this.$refs.Warehousing.addList()
  344. // }
  345. },
  346. delectRow(){
  347. if(this.activeKey=='finishProduct'){
  348. this.$refs.productDetails.delectRow()
  349. }else if(this.activeKey=='material'){
  350. this.$refs.material.delectRow()
  351. }
  352. // else if(this.activeKey=='Outbound'){
  353. // this.$refs.Outbound.delectRow()
  354. // }else if(this.activeKey=='Warehousing'){
  355. // this.$refs.Warehousing.delectRow()
  356. // }
  357. },
  358. clearnExecute(){
  359. this.execute = ''
  360. }
  361. }
  362. }
  363. </script>
  364. <style scoped lang="less">
  365. /* @import '~@assets/less/common.less' */
  366. /deep/.ant-input{
  367. height:29px;
  368. }
  369. /deep/.ant-select-selection--single {
  370. height: 29px;
  371. }
  372. /deep/.ant-select{
  373. font-size: 12px;
  374. }
  375. /deep/.ant-form label{
  376. font-size: 12px;
  377. }
  378. /deep/.table-page-search-wrapper .ant-form-inline .ant-form-item{
  379. margin-bottom:9px
  380. }
  381. /deep/.moddle>.ant-card-body{
  382. padding-bottom:0px;
  383. padding-top: 12px;
  384. }
  385. /deep/.top>.ant-card-body{
  386. padding-bottom:0px;
  387. padding-top: 12px;
  388. }
  389. /deep/.ant-btn{
  390. height:28px
  391. }
  392. /deep/.ant-modal-body{
  393. padding-bottom: 0px;
  394. padding-top: 0px;
  395. }
  396. // /deep/.ant-modal-body{
  397. // background: #f0f2f5;
  398. // }
  399. /deep/.ant-modal-content{
  400. background: #f0f2f5;
  401. }
  402. /deep/.ant-card-body .table-operator {
  403. margin-bottom: 0px;
  404. }
  405. /deep/.three>.ant-card-body{
  406. padding-bottom:12px;
  407. padding-top: 12px;
  408. }
  409. /deep/.bottom>.ant-card-body{
  410. padding-bottom:0px;
  411. padding-top: 12px;
  412. }
  413. /deep/.ant-calendar-picker{
  414. min-width: 0px !important;
  415. }
  416. /deep/.sonItem {
  417. margin-bottom:0px !important
  418. }
  419. /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 {
  420. padding: 0px 8px !important;
  421. }
  422. </style>