detailsPage.vue 11 KB

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