add.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  1. <!-- @desc:工序撤销 @auth:寇珊珊 @time:2023年3月21日15:21:08 -->
  2. <template>
  3. <div class="main-div">
  4. <DkPaxeButton :total="editKeys?editKeys.length:0"
  5. :current="editIndex"
  6. v-if="editKeys && editKeys.length > 1"
  7. @pageChange="editPageChange"></DkPaxeButton>
  8. <DkCollapse>
  9. <DkPanel prop="essentialInformation">
  10. <!--添加行按钮-->
  11. <DkButton slot="content" type="success" @click="addRow" size="small"
  12. style="float: left;position: absolute; top: 9px;left: 120px;">{{ $v('add') }}
  13. </DkButton>
  14. <div style="clear:both"></div>
  15. <!-- 下拉区域 -->
  16. <DkForm slot="content" ref="formInline" v-model="formData" style="width: 95%">
  17. <!--产品条码-->
  18. <DkFormItem :required="true" prop="barCode">
  19. <InputPop ref="barCode" v-model="formData.barCode" @on-enter="onBarCode"
  20. @on-blur="onBarCode"/>
  21. </DkFormItem>
  22. <!--产品型号-->
  23. <DkFormItem prop="modelCode">
  24. <InputPop ref="modelCode" v-model="formData.modelCode" :readonly="true"/>
  25. </DkFormItem>
  26. <!--注浆日期-->
  27. <DkFormItem prop="moldingDate">
  28. <InputPop ref="moldingDate" v-model="formData.moldingDate" :readonly="true"/>
  29. </DkFormItem>
  30. <!--完成工序-->
  31. <DkFormItem prop="pdtFlowNodeName" :label="$t('reasonPdtFlowNodeName')">
  32. <InputPop ref="pdtFlowNodeName" v-model="formData.pdtFlowNodeName" :readonly="true"/>
  33. </DkFormItem>
  34. <!--完成时间-->
  35. <DkFormItem prop="finishTime">
  36. <InputPop ref="finishTime" v-model="formData.finishTime" :readonly="true"/>
  37. </DkFormItem>
  38. <!--所在载具-->
  39. <DkFormItem prop="carrierCode" :label="$t('reasonCarrierCode')">
  40. <InputPop ref="carrierCode" v-model="formData.carrierCode" :readonly="true"/>
  41. </DkFormItem>
  42. <!--商标-->
  43. <DkFormItem prop="logoName">
  44. <InputPop ref="logoName" v-model="formData.logoName" :readonly="true"/>
  45. </DkFormItem>
  46. <!--釉色-->
  47. <DkFormItem prop="colourName">
  48. <InputPop ref="colourName" v-model="formData.colourName" :readonly="true"/>
  49. </DkFormItem>
  50. <!--编码-->
  51. <DkFormItem prop="productCode">
  52. <InputPop ref="productCode" v-model="formData.productCode" :readonly="true"/>
  53. </DkFormItem>
  54. <!--名称-->
  55. <DkFormItem prop="productName">
  56. <InputPop ref="productName" v-model="formData.productName" :readonly="true"/>
  57. </DkFormItem>
  58. <!--撤销原因-->
  59. <DkFormItem :required="true" prop="undoReason">
  60. <InputPop ref="undoReason" v-model="formData.undoReason"/>
  61. </DkFormItem>
  62. </DkForm>
  63. </DkPanel>
  64. <div>
  65. <!--明细-->
  66. <DkPanel prop="details">
  67. <div slot="content" :style="'height: ' + tableHeight + 'px'">
  68. <!--撤销信息-->
  69. <EditTable slot="left" ref="submitTable" :data="detailList"
  70. :columns="detailColumns"
  71. :height="tableHeight-120"
  72. :freeze="false"
  73. :add-flag="false"
  74. @delRow="delSubmitTable"
  75. ></EditTable>
  76. </div>
  77. </DkPanel>
  78. </div>
  79. </DkCollapse>
  80. <!-- 下部分按钮区域-->
  81. <DkSaveButton ref="saveButton" :loading="loading" @save="save" @close="close"></DkSaveButton>
  82. </div>
  83. </template>
  84. <script>
  85. import { formMixin } from '@/mixins/form'
  86. export default {
  87. name: 'process-node-reverse-add',
  88. mixins: [formMixin],
  89. data() {
  90. let self = this
  91. return {
  92. tableData: [],
  93. loading: false,
  94. tableHeight: 620,
  95. barCodeList: [],//产品条码集合
  96. // 画面表单数据
  97. formData: {
  98. barCode: '',
  99. ftyId: this.$store.state.user.ftyId,
  100. undoReason: null,//撤销原因
  101. productId: null,
  102. productCode: null,
  103. productName: null,
  104. logoName: null,//商标
  105. colourName: null,//釉色
  106. moldingDate: null,//成型日期
  107. modelCode: null,//产品型号
  108. finishTime: null,//完成时间
  109. pdtFlowNodeName: null,//完成工序
  110. carrierCode: null,//所在载具
  111. },
  112. // 明细列表
  113. detailColumns: [
  114. // 产品条码
  115. { field: 'barCode', type: 'disabled', width: 'auto' },
  116. //产品型号
  117. { field: 'modelCode', type: 'disabled', width: 'auto' },
  118. // 成型日期
  119. { field: 'moldingDate', type: 'disabled', width: 'auto' },
  120. //完成时间
  121. { field: 'finishTime', type: 'disabled', width: 'auto' },
  122. //完成工序
  123. { field: 'pdtFlowNodeName', title: self.$t('reasonPdtFlowNodeName'), type: 'disabled', width: 'auto' },
  124. //所在载具
  125. { field: 'carrierCode', title: self.$t('reasonCarrierCode'), type: 'disabled', width: 'auto' },
  126. //商标
  127. { field: 'logoName', type: 'disabled', width: 'auto' },
  128. //釉色
  129. { field: 'colourName', type: 'disabled', width: 'auto' },
  130. //产品编码
  131. { field: 'productCode', type: 'disabled', width: 'auto' },
  132. //产品名称
  133. { field: 'productName', type: 'disabled', width: 'auto' },
  134. ],
  135. detailList: [],
  136. }
  137. },
  138. methods: {
  139. /**
  140. * @desc : 产品条码失焦事件
  141. * @date : 2023/2/28 9:28
  142. * @author : 寇珊珊
  143. */
  144. onBarCode() {
  145. if (this.formData.barCode) {
  146. this.excuteNoParam(this.$service.collectService, this.$service.collectService.checkBarCodeNodeUndo, [this.formData.barCode]).then(res => {
  147. if (res.code === this.$config.SUCCESS_CODE) {
  148. this.formData.productId = res.data.uniqueId
  149. this.formData.productCode = res.data.modelCode
  150. this.formData.productName = res.data.modelName
  151. this.formData.logoName = res.data.logoName
  152. this.formData.colourName = res.data.colourName
  153. this.formData.moldingDate = res.data.moldingDate
  154. this.formData.modelCode = res.data.modelMouldCode
  155. this.formData.finishTime = res.data.finishTime
  156. this.formData.pdtFlowNodeName = res.data.pdtFlowNodeName
  157. this.formData.carrierCode = res.data.carrierCode
  158. } else {
  159. this.$Message.error(res.message)
  160. }
  161. })
  162. }
  163. },
  164. /**
  165. * @desc : 删除提交行数据
  166. * @date : 2023/3/10 11:26
  167. * @author : 寇珊珊
  168. */
  169. delSubmitTable(row, rowIndex) {
  170. this.detailList.splice(rowIndex, 1)
  171. },
  172. /**
  173. * @desc : 添加行
  174. * @date : 2023/3/10 8:54
  175. * @author : 寇珊珊
  176. */
  177. addRow() {
  178. if(this.formData.barCode){
  179. //校验名称是否重复
  180. if (!this.validData()) {
  181. return
  182. }
  183. this.barCodeList.push(this.formData.barCode)
  184. let list = []
  185. list.splice(0, 0, {})
  186. list[0].barCode = this.formData.barCode
  187. list[0].productId = this.formData.productId
  188. list[0].productCode = this.formData.productCode
  189. list[0].productName = this.formData.productName
  190. list[0].logoName = this.formData.logoName
  191. list[0].colourName = this.formData.colourName
  192. list[0].moldingDate = this.formData.moldingDate
  193. list[0].modelCode = this.formData.modelCode
  194. list[0].finishTime = this.formData.finishTime
  195. list[0].pdtFlowNodeName = this.formData.pdtFlowNodeName
  196. list[0].carrierCode = this.formData.carrierCode
  197. this.detailList.push(list[0])
  198. //清空表单
  199. this.clear(true)
  200. }
  201. },
  202. /**
  203. * @desc : 设置传参
  204. * @date : 2023/2/28 11:29
  205. * @author : 寇珊珊
  206. */
  207. setParams() {
  208. this.params = {
  209. barCodeList: this.barCodeList,
  210. undoReason: this.formData.undoReason,
  211. }
  212. },
  213. /**
  214. * @desc : 校验重复数据
  215. * @date : 2023/3/8 8:45
  216. * @author : 寇珊珊
  217. */
  218. validData() {
  219. if (this.detailList.length > 0) {
  220. if (this.detailList.filter(it => it.barCode == this.formData.barCode).length > 0) {
  221. this.$Message.error(this.$t('W_120'))
  222. return false
  223. }
  224. }
  225. return true
  226. },
  227. /**
  228. * @desc : 保存数据
  229. * @date : 2023/3/16 13:28
  230. * @author : 寇珊珊
  231. */
  232. saveData() {
  233. return this.excute(this.$service.collectService, this.$service.collectService.scrapUndo, this.params)
  234. },
  235. /**
  236. * @desc : 清空
  237. * @date : 2023/3/8 10:48
  238. * @author : 寇珊珊
  239. */
  240. clear(value) {
  241. if (!value) {
  242. this.detailList = []
  243. this.barCodeList = []
  244. this.formData.undoReason = null
  245. }
  246. this.formData.barCode = null
  247. this.formData.productId = null
  248. this.formData.productCode = null
  249. this.formData.productName = null
  250. this.formData.logoName = null
  251. this.formData.colourName = null
  252. this.formData.moldingDate = null
  253. this.formData.modelCode = null
  254. this.formData.finishTime = null
  255. this.formData.pdtFlowNodeName = null
  256. this.formData.carrierCode = null
  257. },
  258. },
  259. created() {
  260. },
  261. }
  262. </script>
  263. <style scoped>
  264. </style>