detailsPage.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429
  1. <template>
  2. <div>
  3. <div class="borderless">
  4. <div class="customer-head">
  5. <div class="customer-back">
  6. <el-button type="danger" style="border: none;background: none;color: red" icon="el-icon-arrow-left"
  7. @click="backToList">返回列表
  8. </el-button>
  9. </div>
  10. <div class="add-customer-btn">
  11. <el-button type="primary" size="small" @click="editCustomer">
  12. 保存数据
  13. </el-button>
  14. </div>
  15. </div>
  16. <trade-card title="基础资料" style="margin-top: 60px">
  17. <avue-form ref="form" class="trading-form" v-model="form" :option="option">
  18. </avue-form>
  19. </trade-card>
  20. <trade-card title="地址管理">
  21. <avue-crud ref="crud" :option="optionList" :data="data" :table-loading="loading" @saveColumn="saveColumn"
  22. @resetColumn="resetColumn" :cell-style="cellStyle" @row-save="rowSave" @row-update="addUpdate">
  23. <template slot="menuLeft">
  24. <el-button type="primary" @click="addRow" size="mini" :disabled="detailData.status == 1">新建地址
  25. </el-button>
  26. </template>
  27. <template slot="menu" slot-scope="{ row, index }">
  28. <el-button size="small" type="text" @click="rowCell(row, index)">{{
  29. row.$cellEdit ? "保存" : "修改" }}</el-button>
  30. <el-button size="small" type="text" @click="rowDel(row, index)">删除
  31. </el-button>
  32. </template>
  33. </avue-crud>
  34. </trade-card>
  35. <containerTitle title="上传附件"></containerTitle>
  36. <c-upload typeUpload="CD" deleteUrl="/api/trade-purchase/woodHarvestingCloud/removeByFileId"
  37. :data="orderFilesList" display :enumerationValue="35.1" :disabled="detailData.status == 1"></c-upload>
  38. <el-dialog :title="addressTitle" v-dialogDrag :visible.sync="addressVisible" class="avue-dialog avue-dialog--top"
  39. width="50%" append-to-body>
  40. <span>
  41. <el-tabs v-model="activeName">
  42. <el-tab-pane label="客户地址" name="first">
  43. <avue-form class="trading-form" v-model="form2" :option="option2"></avue-form>
  44. </el-tab-pane>
  45. <el-tab-pane label="物流地址" name="second">
  46. <avue-form class="trading-form" v-model="form3" :option="option3"></avue-form>
  47. </el-tab-pane>
  48. </el-tabs>
  49. </span>
  50. <div class="avue-dialog__footer">
  51. <el-button @click="addressVisible=false">取 消</el-button>
  52. <el-button @click="addressVisible=false" type="primary">确 定</el-button>
  53. </div>
  54. </el-dialog>
  55. </div>
  56. </div>
  57. </template>
  58. <script>
  59. import { optionList } from "./js/optionList";
  60. import { getDetails } from "@/api/basicData/client";
  61. import { areaTypeTree } from "@/api/basicData/customerInformation";
  62. import { getCode } from "@/api/basicData/customerInquiry";
  63. export default {
  64. name: "index",
  65. data() {
  66. return {
  67. activeName: 'first',
  68. loadingBtn: false,
  69. addressTitle: null,
  70. addressVisible: false,
  71. form: {},
  72. form2: {
  73. },
  74. form3: {
  75. },
  76. data: [],
  77. option: {
  78. menuBtn: false,
  79. labelWidth: 130,
  80. column: [
  81. {
  82. label: "客户名称",
  83. prop: "id",
  84. type: "select",
  85. rules: [
  86. {
  87. required: true,
  88. message: "",
  89. trigger: "blur"
  90. }
  91. ],
  92. span: 8,
  93. },
  94. {
  95. label: "客户分类",
  96. prop: "corpsTypeId",
  97. type: "select",
  98. span: 8,
  99. },
  100. {
  101. label: "期初欠款",
  102. prop: "arrears",
  103. span: 8,
  104. },
  105. {
  106. label: "电话",
  107. prop: "tel",
  108. span: 8,
  109. },
  110. {
  111. label: "备用电话",
  112. prop: "telephone",
  113. span: 8,
  114. },
  115. {
  116. label: "传真",
  117. prop: "Fax",
  118. span: 8,
  119. },
  120. {
  121. label: "邮箱",
  122. prop: "mailbox",
  123. span: 8,
  124. },
  125. {
  126. label: "备注",
  127. prop: "remarks",
  128. type: "textarea",
  129. minRows: 2,
  130. span: 24,
  131. }
  132. ]
  133. },
  134. option2: {
  135. menuBtn: false,
  136. labelWidth: 90,
  137. column: [
  138. {
  139. label: "简称",
  140. prop: "a",
  141. type: "select",
  142. span: 24,
  143. },
  144. {
  145. label: "地址",
  146. prop: "b",
  147. type: "select",
  148. span: 24,
  149. },
  150. {
  151. label: "详细地址",
  152. prop: "c",
  153. span: 24,
  154. },
  155. {
  156. label: "邮编",
  157. prop: "d",
  158. span: 24,
  159. },
  160. {
  161. label: "备注",
  162. prop: "e",
  163. type: 'textarea',
  164. minRows: 3,
  165. span: 24,
  166. },
  167. {
  168. label: "地址智能识别",
  169. prop: "ad",
  170. placeholder:"例:上海市徐汇区枫林街道斜土路100号",
  171. type: "textarea",
  172. minRows: 3,
  173. span: 24,
  174. }
  175. ]
  176. },
  177. option3: {
  178. menuBtn: false,
  179. labelWidth: 80,
  180. column: [
  181. {
  182. label: "目的地",
  183. prop: "a",
  184. type: "select",
  185. rules: [
  186. {
  187. required: true,
  188. message: "",
  189. trigger: "blur"
  190. }
  191. ],
  192. span: 24,
  193. },
  194. {
  195. label: "物流公司",
  196. prop: "b",
  197. span: 24,
  198. },
  199. {
  200. label: "电话",
  201. prop: "c",
  202. span: 24,
  203. },
  204. {
  205. label: "地址",
  206. prop: "d",
  207. span: 24,
  208. },
  209. {
  210. label: "详细地址",
  211. prop: "e",
  212. span: 24,
  213. },
  214. {
  215. label: "邮编",
  216. prop: "f",
  217. span: 24,
  218. },
  219. {
  220. label: "备注",
  221. prop: "remarks",
  222. type: "textarea",
  223. minRows: 3,
  224. span: 24,
  225. },
  226. {
  227. label: "地址智能识别",
  228. prop: "g",
  229. type: "textarea",
  230. minRows: 3,
  231. span: 24,
  232. }
  233. ]
  234. },
  235. optionList: {},
  236. };
  237. },
  238. props: {
  239. detailData: {
  240. type: Object
  241. }
  242. },
  243. async created() {
  244. this.optionList = await this.getColumnData(
  245. this.getColumnName(208),
  246. optionList
  247. );
  248. if (this.detailData.id) {
  249. this.getDetail(this.detailData.id);
  250. }
  251. if (this.detailData.status == 1) {
  252. this.option.disabled = true;
  253. }
  254. this.getAllWorkDicts()
  255. },
  256. methods: {
  257. getAllWorkDicts() {
  258. this.findObject(this.optionList.column, "departureId").dicData = JSON.parse(localStorage.getItem('areaTypeTree'));
  259. },
  260. cellStyle() {
  261. return "padding:0;height:40px;";
  262. },
  263. selectValue(value, row) {
  264. console.log(value, row)
  265. if (row.feesId) {
  266. row.feesName = value.cname
  267. } else {
  268. row.feesName = ""
  269. }
  270. },
  271. getDetail(id) {
  272. this.loadingBtn = true
  273. getDetails({id:id})
  274. .then(res => {
  275. this.form = res.data.data;
  276. this.data = res.data.data.orderCostItemList;
  277. })
  278. .finally(() => {
  279. this.loadingBtn = false;
  280. });
  281. },
  282. getCorpData(row) {
  283. this.form.corpName = row.cname
  284. },
  285. addRow() {
  286. this.addressTitle = '新增地址'
  287. this.addressVisible = true
  288. },
  289. rowCell(row, index) {
  290. this.$refs.crud.rowCell(row, index)
  291. },
  292. rowSave(form, done) {
  293. done()
  294. },
  295. addUpdate(form, index, done, loading) {
  296. done()
  297. },
  298. rowDel(row, index) {
  299. this.$confirm("确定删除数据?", {
  300. confirmButtonText: "确定",
  301. cancelButtonText: "取消",
  302. type: "warning"
  303. }).then(() => {
  304. if (row.id) {
  305. // itemDel(row.id).then(res => {
  306. // this.$message({
  307. // type: "success",
  308. // message: "删除成功!"
  309. // });
  310. // this.data.splice(index, 1);
  311. // });
  312. } else {
  313. this.$message({
  314. type: "success",
  315. message: "删除成功!"
  316. });
  317. this.data.splice(index, 1);
  318. }
  319. });
  320. },
  321. //修改提交触发
  322. editCustomer() {
  323. this.$refs["form"].validate((valid, done) => {
  324. done();
  325. if (valid) {
  326. this.data.forEach(e => {
  327. e.departure = e.departureId ? e.departureId.replace(/,/g, "/") : ''
  328. })
  329. this.loadingBtn = true;
  330. // submit({ ...this.form, feesType: 1, orderCostItemList: this.data })
  331. // .then(res => {
  332. // this.$message.success("保存成功");
  333. // this.form = res.data.data;
  334. // this.data = res.data.data.orderCostItemList;
  335. // })
  336. // .finally(() => {
  337. // this.loadingBtn = false;
  338. // });
  339. } else {
  340. return false;
  341. }
  342. });
  343. },
  344. async saveColumn() {
  345. const inSave = await this.saveColumnData(
  346. this.getColumnName(208),
  347. this.optionList
  348. );
  349. if (inSave) {
  350. this.$nextTick(() => {
  351. this.$refs.crud.doLayout();
  352. });
  353. this.$message.success("保存成功");
  354. //关闭窗口
  355. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  356. }
  357. },
  358. async resetColumn() {
  359. this.optionList = optionList;
  360. const inSave = await this.delColumnData(
  361. this.getColumnName(208),
  362. optionList
  363. );
  364. if (inSave) {
  365. this.$nextTick(() => {
  366. this.$refs.crud.doLayout();
  367. });
  368. this.getAllWorkDicts()
  369. this.$message.success("重置成功");
  370. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  371. }
  372. },
  373. //返回列表
  374. backToList() {
  375. this.$emit("goBack");
  376. console.log(11111)
  377. }
  378. }
  379. };
  380. </script>
  381. <style lang="scss" scoped>
  382. .trading-form ::v-deep .el-form-item {
  383. margin-bottom: 8px !important;
  384. }
  385. ::v-deep .el-dialog__body {
  386. padding: 0px 20px 15px 20px;
  387. }
  388. ::v-deep .el-form-item__error {
  389. display: none !important;
  390. }
  391. .img-form ::v-deep .el-form-item {
  392. height: 150px;
  393. line-height: 150px;
  394. margin-bottom: 8px !important;
  395. }
  396. .img-form ::v-deep .avue-upload__icon {
  397. font-size: 20px;
  398. width: 150px;
  399. height: 150px;
  400. line-height: 150px;
  401. }
  402. ::v-deep .el-table .cell {
  403. padding: 0 2px !important;
  404. }
  405. ::v-deep .avue-crud .el-table .el-form-item__label {
  406. left: -1px;
  407. }
  408. .addressTabs {
  409. display: flex;
  410. justify-content: center;
  411. span {
  412. width: 100px;
  413. font-size: 18px;
  414. font-weight: 600;
  415. text-align: center;
  416. }
  417. }
  418. </style>