plan-submit.vue 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326
  1. <template>
  2. <div>
  3. <div class="my-title">处理</div>
  4. <el-form
  5. :model="dataForm"
  6. :rules="dataRule"
  7. ref="dataForm"
  8. label-width="auto"
  9. >
  10. <el-row class="my-row">
  11. <el-col :span="6">
  12. <el-form-item label="项目名称:" prop="projectName">
  13. <span>{{dataForm.projectName}}</span>
  14. </el-form-item>
  15. </el-col>
  16. <el-col :span="6">
  17. <el-form-item label="任务号:" prop="orderCode">
  18. <span>{{dataForm.orderCode}}</span>
  19. </el-form-item>
  20. </el-col>
  21. <el-col :span="6">
  22. <el-form-item label="技术协议:" prop="attachList1">
  23. <span class="attch-file" @click="attachDetail(dataForm.attachList1)">{{dataForm.attachList1 == null ? '' : dataForm.attachList1[0].fileName}}</span>
  24. </el-form-item>
  25. </el-col>
  26. <el-col :span="6">
  27. <el-form-item label="资料:" prop="attachList2">
  28. <span class="attch-file" @click="attachDetail(dataForm.attachList2)">{{dataForm.attachList2 == null ? '' : dataForm.attachList2[0].fileName}}</span>
  29. </el-form-item>
  30. </el-col>
  31. </el-row>
  32. <el-table
  33. :data="dataForm.proProductList"
  34. border
  35. v-loading="dataListLoading"
  36. style="width: 100%;">
  37. <el-table-column
  38. label="序号"
  39. type="index"
  40. width="100"
  41. align="center">
  42. </el-table-column>
  43. <el-table-column
  44. prop="productName"
  45. header-align="center"
  46. align="center"
  47. min-width="140"
  48. :show-tooltip-when-overflow="true"
  49. label="名称">
  50. </el-table-column>
  51. <el-table-column
  52. prop="mapNumber"
  53. header-align="center"
  54. align="center"
  55. min-width="140"
  56. :show-tooltip-when-overflow="true"
  57. label="图号">
  58. </el-table-column>
  59. <el-table-column
  60. prop="versionNumber"
  61. header-align="center"
  62. align="center"
  63. min-width="140"
  64. :show-tooltip-when-overflow="true"
  65. label="版本号">
  66. </el-table-column>
  67. <el-table-column
  68. prop="attachList2"
  69. header-align="center"
  70. align="center"
  71. min-width="140"
  72. :show-tooltip-when-overflow="true"
  73. label="简图">
  74. <template slot-scope="scope">
  75. <el-button :disabled="!scope.row.attachList2 || scope.row.attachList2.length === 0" type="text" size="small" @click="attachDetail(scope.row.attachList2)">查看</el-button>
  76. </template>
  77. </el-table-column>
  78. <el-table-column
  79. prop="unit"
  80. header-align="center"
  81. align="center"
  82. min-width="140"
  83. :show-tooltip-when-overflow="true"
  84. label="单位">
  85. </el-table-column>
  86. <el-table-column
  87. prop="cnt"
  88. header-align="center"
  89. align="center"
  90. min-width="140"
  91. :show-tooltip-when-overflow="true"
  92. label="单套数量">
  93. </el-table-column>
  94. <el-table-column
  95. prop="productSpec"
  96. header-align="center"
  97. align="center"
  98. min-width="140"
  99. :show-tooltip-when-overflow="true"
  100. label="材料规格">
  101. </el-table-column>
  102. <el-table-column
  103. prop="size"
  104. header-align="center"
  105. align="center"
  106. min-width="140"
  107. :show-tooltip-when-overflow="true"
  108. label="净尺寸">
  109. </el-table-column>
  110. <el-table-column
  111. prop="projectName"
  112. header-align="center"
  113. align="center"
  114. min-width="140"
  115. :show-tooltip-when-overflow="true"
  116. label="表处理">
  117. </el-table-column>
  118. <el-table-column
  119. prop="heatTreatment"
  120. header-align="center"
  121. align="center"
  122. min-width="140"
  123. :show-tooltip-when-overflow="true"
  124. label="热处理">
  125. </el-table-column>
  126. <el-table-column
  127. prop="projectName"
  128. header-align="center"
  129. align="center"
  130. min-width="140"
  131. :show-tooltip-when-overflow="true"
  132. label="关重性">
  133. </el-table-column>
  134. <el-table-column
  135. prop="notes"
  136. header-align="center"
  137. align="center"
  138. min-width="140"
  139. :show-tooltip-when-overflow="true"
  140. label="备注">
  141. </el-table-column>
  142. <el-table-column
  143. fixed="right"
  144. prop="materialCnt"
  145. header-align="center"
  146. align="center"
  147. width="70"
  148. :show-tooltip-when-overflow="true"
  149. label="库存数">
  150. </el-table-column>
  151. <el-table-column
  152. fixed="right"
  153. prop="planCnt"
  154. header-align="center"
  155. align="center"
  156. width="100"
  157. :show-tooltip-when-overflow="true"
  158. label="计划数量">
  159. <template slot-scope="scope">
  160. <el-form-item :prop="'proProductList.' + scope.$index + '.planCnt'" :rules="dataRule.planCnt" label-width="0">
  161. <el-input v-model="scope.row.planCnt" style="width:80px" :disabled="disabled" @input="scope.row.planCnt = scope.row.planCnt.replace(/[^\d]/g, '')"/>
  162. </el-form-item>
  163. </template>
  164. </el-table-column>
  165. <el-table-column
  166. fixed="right"
  167. prop="disposal"
  168. header-align="center"
  169. align="center"
  170. width="90"
  171. :show-tooltip-when-overflow="true"
  172. label="处置">
  173. <template slot-scope="scope">
  174. <div class="radio-wrapper">
  175. <el-form-item :prop="'proProductList.' + scope.$index + '.disposal'" :rules="dataRule.disposal" label-width="0">
  176. <el-radio-group v-model="scope.row.disposal" class="radio-group-wrap" :disabled="disabled">
  177. <el-radio :label="2" style="margin-left:0">采购件</el-radio>
  178. <el-radio :label="3" style="margin-left:0">委外件</el-radio>
  179. <el-radio :label="1" style="margin-left:0">自制件</el-radio>
  180. </el-radio-group>
  181. </el-form-item>
  182. </div>
  183. </template>
  184. </el-table-column>
  185. <el-table-column
  186. fixed="right"
  187. prop="isTechnology"
  188. header-align="center"
  189. align="center"
  190. width="90"
  191. :show-tooltip-when-overflow="true"
  192. label="工艺">
  193. <template slot-scope="scope">
  194. <el-form-item :prop="'proProductList.' + scope.$index + '.isTechnology'" :rules="dataRule.isTechnology" label-width="0">
  195. <el-radio-group v-model="scope.row.isTechnology" class="radio-group-wrap" :disabled="disabled">
  196. <el-radio :label="1" style="margin-left:0">需要</el-radio>
  197. <el-radio :label="2" style="margin-left:0">不需要</el-radio>
  198. </el-radio-group>
  199. </el-form-item>
  200. </template>
  201. </el-table-column>
  202. </el-table>
  203. </el-form>
  204. <span slot="footer" class="dialog-footer">
  205. <el-button @click="onChose">取消</el-button>
  206. <el-button
  207. v-if="!disabled"
  208. type="primary"
  209. @click="dataFormSubmit()"
  210. v-reClick
  211. >提交</el-button
  212. >
  213. </span>
  214. <attach-detail-dialog ref="attachDetail"/>
  215. </div>
  216. </template>
  217. <script>
  218. import AttachDetailDialog from '../common/attach-detail-dialog'
  219. export default {
  220. name: 'plan-submit',
  221. components: { AttachDetailDialog },
  222. computed: {},
  223. data () {
  224. return {
  225. disabled: false,
  226. id: 0,
  227. dataForm: {
  228. proProductList: []
  229. },
  230. dataRule: {
  231. planCnt: [{required: true, message: '请输入', trigger: 'blur'}],
  232. disposal: [{required: true, message: '请选择', trigger: 'change'}],
  233. isTechnology: [{required: true, message: '请选择', trigger: 'change'}]
  234. },
  235. dataList: [],
  236. dataListLoading: false
  237. }
  238. },
  239. created () {},
  240. beforeDestroy () {},
  241. methods: {
  242. onChose () {
  243. this.$emit('onChose')
  244. },
  245. async init (item, readonly) {
  246. let id = item.productionManagementId
  247. if (readonly) {
  248. this.disabled = true
  249. }
  250. this.$http({
  251. url: this.$http.adornUrl(`/biz-service/projProduction/info/${id}`),
  252. method: 'get'
  253. }).then(({data}) => {
  254. if (data && data.code === '200') {
  255. this.dataForm = data.data
  256. } else {
  257. this.$message.error(data.msg)
  258. }
  259. })
  260. },
  261. validateField (type) {
  262. this.$refs.dataForm.validateField(type)
  263. },
  264. attachDetail (attachList) {
  265. this.$nextTick(() => {
  266. this.$refs.attachDetail.init(attachList)
  267. })
  268. },
  269. // 表单提交
  270. dataFormSubmit () {
  271. this.$refs['dataForm'].validate((valid) => {
  272. if (valid) {
  273. let data = {
  274. orderCode: this.dataForm.orderCode,
  275. proProductList: this.dataForm.proProductList
  276. }
  277. console.log('data', data)
  278. this.$http({
  279. url: this.$http.adornUrl(`/biz-service/projProduction/submitPlan`),
  280. method: 'post',
  281. data: this.$http.adornData(data)
  282. }).then(({ data }) => {
  283. if (data && data.code === '200') {
  284. this.$message({
  285. message: '操作成功',
  286. type: 'success',
  287. duration: 1500,
  288. onClose: () => {
  289. this.onChose()
  290. this.$emit('refreshDataList')
  291. }
  292. })
  293. } else {
  294. this.$message.error(data.msg)
  295. }
  296. })
  297. }
  298. })
  299. }
  300. }
  301. }
  302. </script>
  303. <style>
  304. .my-row {
  305. margin-bottom: 20px;
  306. }
  307. .radio-group-wrap {
  308. display: flex;
  309. align-items: flex-start;
  310. flex-direction: column;
  311. gap: 10px 0px; /* 行列间距控制 */
  312. }
  313. .attch-file {
  314. cursor: pointer;
  315. color: #3e8ef7;
  316. }
  317. </style>