detailsPageEdit.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329
  1. <template>
  2. <div class="borderless">
  3. <div class="customer-head">
  4. <div class="customer-back">
  5. <el-button type="danger" style="border: none;background: none;color: red" icon="el-icon-arrow-left"
  6. @click="backToList">返回列表
  7. </el-button>
  8. </div>
  9. <el-button
  10. class="el-button--small-yh add-customer-btn"
  11. type="primary"
  12. :disabled="disabled"
  13. @click="editProductInfo"
  14. size="small"
  15. >{{ form.id ? '确认修改' : '确认新增' }}
  16. </el-button>
  17. </div>
  18. <div style="margin-top: 60px">
  19. <containerTitle title="基础信息"></containerTitle>
  20. <basic-container style="margin-bottom: 10px">
  21. <avue-form ref="form" v-model="form" :option="option">
  22. <template slot="goodsTypeId" slot-scope="scope">
  23. <avue-input-tree
  24. v-model="form.goodsTypeId"
  25. :props="{ label: 'title', value: 'id' }"
  26. multiple
  27. placeholder=" "
  28. type="tree"
  29. :dic="dicData"/>
  30. </template>
  31. <template slot="corpId" slot-scope="scope">
  32. <selectComponent v-model="form.corpId"
  33. :configuration="configuration" style="width: 100%"/>
  34. </template>
  35. <template slot="a" slot-scope="scope">
  36. <el-input
  37. v-input-limit="2"
  38. v-model="form.a"
  39. clearable
  40. placeholder="请输入 箱立方"
  41. ></el-input>
  42. </template>
  43. </avue-form>
  44. </basic-container>
  45. </div>
  46. </div>
  47. </template>
  48. <script>
  49. import {getDetail, updateDetail, getDeptTree, priceDelete} from "@/api/basicData/commodityType";
  50. export default {
  51. name: "detailsPage",
  52. data() {
  53. return {
  54. configuration: {
  55. multipleChoices: false,
  56. multiple: false,
  57. collapseTags: false,
  58. placeholder: '请点击右边按钮选择',
  59. dicData: []
  60. },
  61. form: {},
  62. disabled: false,
  63. userDialog: false,//供应商导入窗口
  64. dicData: [],
  65. detailsSelect: {},
  66. option: {
  67. menuBtn: false,
  68. labelWidth: 100,
  69. column: [
  70. {
  71. label: "产品编码",
  72. prop: "code",
  73. span: 8,
  74. rules: [
  75. {
  76. required: true,
  77. message: " ",
  78. trigger: "blur"
  79. }
  80. ],
  81. },
  82. {
  83. label: "产品名称",
  84. prop: "cname",
  85. span: 8,
  86. rules: [
  87. {
  88. required: true,
  89. message: " ",
  90. trigger: "blur"
  91. }
  92. ],
  93. slot: true
  94. },
  95. {
  96. label: "产品分类",
  97. prop: "goodsTypeId",
  98. span: 8,
  99. rules: [
  100. {
  101. required: true,
  102. message: " ",
  103. trigger: "blur"
  104. }
  105. ],
  106. },
  107. {
  108. label: "花纹",
  109. prop: "brandItem",
  110. span: 8,
  111. rules: [
  112. {
  113. required: true,
  114. message: " ",
  115. trigger: "blur"
  116. }
  117. ],
  118. },
  119. {
  120. label: "品牌",
  121. prop: "brand",
  122. span: 8,
  123. rules: [
  124. {
  125. required: true,
  126. message: " ",
  127. trigger: "blur"
  128. }
  129. ],
  130. },
  131. {
  132. label: "状态",
  133. prop: "status",
  134. span: 8,
  135. type: 'select',
  136. dicData: [{
  137. label: '正常',
  138. value: 0
  139. }, {
  140. label: '停用',
  141. value: 1
  142. }],
  143. },
  144. {
  145. label: "规格",
  146. prop: "typeno", //specs
  147. span: 8,
  148. rules: [
  149. {
  150. required: true,
  151. message: " ",
  152. trigger: "blur"
  153. }
  154. ],
  155. },
  156. {
  157. label: "规格1",
  158. prop: "specsOne",
  159. span: 8,
  160. rules: [
  161. {
  162. required: true,
  163. message: " ",
  164. trigger: "blur"
  165. }
  166. ],
  167. },
  168. {
  169. label: "规格2",
  170. prop: "specsTwo",
  171. span: 8,
  172. rules: [
  173. {
  174. required: true,
  175. message: " ",
  176. trigger: "blur"
  177. }
  178. ],
  179. },
  180. {
  181. label: "级别",
  182. prop: "level",
  183. span: 8,
  184. rules: [
  185. {
  186. required: true,
  187. message: " ",
  188. trigger: "blur"
  189. }
  190. ],
  191. },
  192. {
  193. label: "产地",
  194. prop: "placeProduction",
  195. span: 8,
  196. rules: [
  197. {
  198. required: true,
  199. message: " ",
  200. trigger: "blur"
  201. }
  202. ],
  203. },
  204. {
  205. label: "三包",
  206. prop: "threeGuarantees",
  207. span: 8,
  208. },
  209. {
  210. label: "供应商",
  211. prop: "corpId",
  212. span: 8,
  213. rules: [
  214. {
  215. required: true,
  216. message: " ",
  217. trigger: "blur"
  218. }
  219. ],
  220. },
  221. {
  222. label: "箱立方",
  223. prop: "a",
  224. span: 8,
  225. rules: [
  226. {
  227. required: true,
  228. message: " ",
  229. trigger: "blur"
  230. }
  231. ],
  232. },
  233. {
  234. label: "备注",
  235. prop: "remarks",
  236. type: "textarea",
  237. minRows: 2,
  238. span: 24
  239. }
  240. ]
  241. },
  242. }
  243. },
  244. //初始化查询
  245. created() {
  246. getDeptTree().then(res => {
  247. this.dicData = res.data.data;
  248. });
  249. if (this.$route.query.id) {
  250. getDetail(JSON.parse(this.$route.query.id)).then(res => {
  251. this.form = res.data.data
  252. })
  253. } else {
  254. this.$set(this.form, "goodsTypeId", this.$route.query.treeDeptId)
  255. }
  256. },
  257. methods: {
  258. addSftRow() {
  259. this.sftData.push({
  260. $cellEdit: true,
  261. cname: null,
  262. texture: null,
  263. colour: null,
  264. describe: null,
  265. remarks: null
  266. });
  267. },
  268. rowContactCell(row, index) {
  269. this.$refs.crudContact.rowCell(row, index)
  270. },
  271. rowPurchaseCell(row, index) {
  272. this.$refs.crudPurchase.rowCell(row, index)
  273. },
  274. //修改提交触发
  275. editProductInfo() {
  276. this.$refs["form"].validate((valid) => {
  277. //校验明细列表
  278. if (valid) {
  279. const params = {
  280. ...this.form,
  281. type: 0,
  282. }
  283. updateDetail(params).then(res => {
  284. if (res.data.success) {
  285. this.$message.success("操作成功!")
  286. }
  287. })
  288. } else {
  289. return false;
  290. }
  291. });
  292. },
  293. //返回列表
  294. backToList() {
  295. this.$router.$avueRouter.closeTag();
  296. this.$router.push({
  297. path: '/basicData/productInformation/index',
  298. query: {}
  299. });
  300. }
  301. }
  302. }
  303. </script>
  304. <style lang="scss" scoped>
  305. .back-icon {
  306. line-height: 64px;
  307. font-size: 20px;
  308. margin-right: 8px;
  309. }
  310. ::v-deep .el-form-item {
  311. margin-bottom: 0;
  312. }
  313. .el-dialogDeep {
  314. ::v-deep .el-dialog {
  315. margin: 1vh auto 0 !important;
  316. padding-bottom: 10px !important;
  317. .el-dialog__body, .el-dialog__footer {
  318. padding-bottom: 0 !important;
  319. padding-top: 0 !important;
  320. }
  321. }
  322. }
  323. </style>