detailsPageEdit.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396
  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. props:{
  76. detailData:Object
  77. },
  78. name: "detailsPage",
  79. data() {
  80. return {
  81. configuration: {
  82. multipleChoices: false,
  83. multiple: false,
  84. collapseTags: false,
  85. placeholder: "请点击右边按钮选择",
  86. dicData: []
  87. },
  88. form: {},
  89. disabled: false,
  90. userDialog: false, //供应商导入窗口
  91. dicData: [],
  92. detailsSelect: {},
  93. option: {
  94. menuBtn: false,
  95. labelWidth: 100,
  96. column: [
  97. {
  98. label: "产品编码",
  99. prop: "code",
  100. span: 8,
  101. rules: [
  102. {
  103. required: true,
  104. message: " ",
  105. trigger: "blur"
  106. }
  107. ]
  108. },
  109. {
  110. label: "产品名称",
  111. prop: "cname",
  112. span: 8,
  113. rules: [
  114. {
  115. required: true,
  116. message: " ",
  117. trigger: "blur"
  118. }
  119. ],
  120. slot: true
  121. },
  122. {
  123. label: "产品分类",
  124. prop: "goodsTypeId",
  125. span: 8,
  126. rules: [
  127. {
  128. required: true,
  129. message: " ",
  130. trigger: "blur"
  131. }
  132. ]
  133. },
  134. {
  135. label: "花纹",
  136. prop: "brandItem",
  137. span: 8,
  138. rules: [
  139. {
  140. required: true,
  141. message: " ",
  142. trigger: "blur"
  143. }
  144. ]
  145. },
  146. {
  147. label: "品牌",
  148. prop: "brand",
  149. span: 8,
  150. rules: [
  151. {
  152. required: true,
  153. message: " ",
  154. trigger: "blur"
  155. }
  156. ]
  157. },
  158. {
  159. label: "状态",
  160. prop: "status",
  161. span: 8,
  162. type: "select",
  163. dicData: [
  164. {
  165. label: "正常",
  166. value: 0
  167. },
  168. {
  169. label: "停用",
  170. value: 1
  171. }
  172. ]
  173. },
  174. {
  175. label: "规格",
  176. prop: "typeno", //specs
  177. span: 8,
  178. rules: [
  179. {
  180. required: true,
  181. message: " ",
  182. trigger: "blur"
  183. }
  184. ]
  185. },
  186. {
  187. label: "规格1",
  188. prop: "specsOne",
  189. span: 8,
  190. rules: [
  191. {
  192. required: true,
  193. message: " ",
  194. trigger: "blur"
  195. }
  196. ]
  197. },
  198. {
  199. label: "规格2",
  200. prop: "specsTwo",
  201. span: 8,
  202. rules: [
  203. {
  204. required: true,
  205. message: " ",
  206. trigger: "blur"
  207. }
  208. ]
  209. },
  210. {
  211. label: "级别",
  212. prop: "level",
  213. span: 8,
  214. rules: [
  215. {
  216. required: true,
  217. message: " ",
  218. trigger: "blur"
  219. }
  220. ]
  221. },
  222. {
  223. label: "产地",
  224. prop: "placeProduction",
  225. span: 8,
  226. rules: [
  227. {
  228. required: true,
  229. message: " ",
  230. trigger: "blur"
  231. }
  232. ]
  233. },
  234. {
  235. label: "箱立方",
  236. prop: "cntrVolumn",
  237. span: 8,
  238. rules: [
  239. {
  240. required: true,
  241. message: " ",
  242. trigger: "blur"
  243. }
  244. ]
  245. },
  246. {
  247. label: "箱重量",
  248. prop: "cartonWeight",
  249. span: 8,
  250. rules: [
  251. {
  252. required: true,
  253. message: " ",
  254. trigger: "blur"
  255. }
  256. ]
  257. },
  258. {
  259. label: "供应商",
  260. prop: "corpId",
  261. span:16,
  262. rules: [
  263. {
  264. required: true,
  265. message: " ",
  266. trigger: "blur"
  267. }
  268. ]
  269. },
  270. {
  271. label: "三包",
  272. prop: "threeGuarantees",
  273. span: 8
  274. },
  275. {
  276. label: "积分倍数",
  277. prop: "a",
  278. span: 8
  279. },
  280. {
  281. label: "备注",
  282. prop: "remarks",
  283. type: "textarea",
  284. minRows: 2,
  285. span: 24
  286. }
  287. ]
  288. }
  289. };
  290. },
  291. //初始化查询
  292. created() {
  293. getDeptTree().then(res => {
  294. this.dicData = res.data.data;
  295. });
  296. if (this.detailData.id) {
  297. this.queryData(this.detailData.id)
  298. } else {
  299. this.$set(this.form, "goodsTypeId", this.$route.query.treeDeptId);
  300. }
  301. },
  302. methods: {
  303. queryData(id) {
  304. this.openFullScreen(false, '正在努力的加载...');
  305. getDetail(id).then(res => {
  306. this.form = res.data.data;
  307. }).finally(() => {
  308. this.openFullScreen(true);
  309. });
  310. },
  311. addSftRow() {
  312. this.sftData.push({
  313. $cellEdit: true,
  314. cname: null,
  315. texture: null,
  316. colour: null,
  317. describe: null,
  318. remarks: null
  319. });
  320. },
  321. rowContactCell(row, index) {
  322. this.$refs.crudContact.rowCell(row, index);
  323. },
  324. rowPurchaseCell(row, index) {
  325. this.$refs.crudPurchase.rowCell(row, index);
  326. },
  327. //修改提交触发
  328. editProductInfo() {
  329. this.$refs["form"].validate(valid => {
  330. //校验明细列表
  331. if (valid) {
  332. this.configuration.dicData.forEach(e => {
  333. if (e.id == this.form.corpId) {
  334. this.form.corpName = e.cname;
  335. }
  336. });
  337. const params = {
  338. ...this.form,
  339. type: 0
  340. };
  341. this.openFullScreen(false, '正在努力的加载...');
  342. updateDetail(params).then(res => {
  343. if (res.data.success) {
  344. this.$message.success("操作成功!");
  345. }
  346. this.form = res.data.data
  347. this.queryData(res.data.data.id)
  348. });
  349. } else {
  350. return false;
  351. }
  352. });
  353. },
  354. //返回列表
  355. backToList() {
  356. this.$emit("goBack");
  357. },
  358. //遮罩层
  359. openFullScreen(res, text) {
  360. const loading = this.$loading({
  361. lock: true,
  362. text: text,
  363. spinner: 'el-icon-loading',
  364. background: 'rgba(0, 0, 0, 0.7)'
  365. });
  366. if (res === true) loading.close();
  367. },
  368. }
  369. };
  370. </script>
  371. <style lang="scss" scoped>
  372. .back-icon {
  373. line-height: 64px;
  374. font-size: 20px;
  375. margin-right: 8px;
  376. }
  377. ::v-deep .el-form-item {
  378. margin-bottom: 8px;
  379. }
  380. .el-dialogDeep {
  381. ::v-deep .el-dialog {
  382. margin: 1vh auto 0 !important;
  383. padding-bottom: 10px !important;
  384. .el-dialog__body,
  385. .el-dialog__footer {
  386. padding-bottom: 0 !important;
  387. padding-top: 0 !important;
  388. }
  389. }
  390. }
  391. </style>