detailsPageEdit.vue 8.6 KB

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