detailsPage.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407
  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" :disabled="loadingBtn || detailData.status == 1">
  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. <template slot="corpId">
  20. <crop-select v-model="form.corpId" corpType="KH" :refresh="false" @getCorpData="getCorpData"
  21. :disabled="detailData.status == 1"></crop-select>
  22. </template>
  23. <!-- <template slot="warehouseId">
  24. <el-cascader v-model="form.warehouseId" :options="storagetreeList" :show-all-levels="false"
  25. :disabled="detailData.status == 1"
  26. :props="{ checkStrictly: true, emitPath: false, label: 'title',multiple: true }" clearable>
  27. </el-cascader>
  28. </template> -->
  29. </avue-form>
  30. </basic-container>
  31. <containerTitle title="基础明细"></containerTitle>
  32. <basic-container v-loading="loadingBtn">
  33. <avue-crud ref="crud" :option="optionList" :data="dataList" :table-loading="loading" @saveColumn="saveColumn"
  34. @resetColumn="resetColumn" :cell-style="cellStyle">
  35. <template slot="menuLeft">
  36. <el-button type="primary" @click="addRow" size="small" :disabled="detailData.status == 1">新增
  37. </el-button>
  38. </template>
  39. <template slot="feeId" slot-scope="{ row,index }">
  40. <breakdown-select v-if="row.$cellEdit" v-model="row.feeId" @selectValue="value => selectValue(value,row)"
  41. :configuration="breakConfiguration">
  42. </breakdown-select>
  43. <span v-else>{{ row.feeName }}</span>
  44. </template>
  45. <template slot="menu" slot-scope="{ row, index }">
  46. <el-button size="small" type="text" @click="rowCell(row, index)" :disabled="detailData.status == 1">{{
  47. row.$cellEdit ? "保存" : "修改" }}</el-button>
  48. <el-button size="small" type="text" @click="rowDel(row, index)" :disabled="detailData.status == 1">删除
  49. </el-button>
  50. </template>
  51. </avue-crud>
  52. </basic-container>
  53. <upload-file ref="uploadFile" title="合同附件" :disabled="detailData.status == 1" :orderFilesList="orderFilesList"
  54. delUrl="" />
  55. </div>
  56. </div>
  57. </template>
  58. <script>
  59. import { optionList } from "./js/optionList";
  60. import { getDetail, submit, getStoragetree, getAllgoodstype, getLazylist } from "@/api/basicData/agreement";
  61. export default {
  62. name: "index",
  63. data() {
  64. return {
  65. loadingBtn: false,
  66. form: {},
  67. dataList: [],
  68. option: {
  69. menuBtn: false,
  70. labelWidth: 130,
  71. column: [
  72. {
  73. label: "合同编号",
  74. prop: "contractNo",
  75. rules: [
  76. {
  77. required: true,
  78. message: "",
  79. trigger: "blur"
  80. }
  81. ],
  82. span: 6,
  83. },
  84. {
  85. label: "制单部门",
  86. prop: "deptId",
  87. rules: [
  88. {
  89. required: true,
  90. message: "",
  91. trigger: "blur"
  92. }
  93. ],
  94. type: "select",
  95. dataType: "string",
  96. props: {
  97. label: "deptName",
  98. value: "id"
  99. },
  100. dicData: [],
  101. span: 6,
  102. },
  103. {
  104. label: "客户名称",
  105. prop: "corpId",
  106. rules: [
  107. {
  108. required: true,
  109. message: "",
  110. trigger: "blur"
  111. }
  112. ],
  113. span: 6,
  114. },
  115. {
  116. label: "贸易方式",
  117. prop: "billType",
  118. type: "select",
  119. dataType: "string",
  120. props: {
  121. label: "dictValue",
  122. value: "dictKey"
  123. },
  124. dicData: [],
  125. multiple: true,
  126. span: 6,
  127. },
  128. {
  129. label: "有效期起",
  130. prop: "beginDate",
  131. type: "date",
  132. format: "yyyy-MM-dd",
  133. valueFormat: "yyyy-MM-dd",
  134. span: 6,
  135. },
  136. {
  137. label: "有效期至",
  138. prop: "endDate",
  139. type: "date",
  140. format: "yyyy-MM-dd",
  141. valueFormat: "yyyy-MM-dd",
  142. span: 6,
  143. },
  144. {
  145. label: "商品分类",
  146. prop: "goodsId",
  147. type: "select",
  148. dataType: "string",
  149. props: {
  150. label: "cname",
  151. value: "id"
  152. },
  153. dicData: [],
  154. multiple: true,
  155. span: 6,
  156. },
  157. {
  158. label: "仓库",
  159. prop: "warehouseId",
  160. type: "cascader",
  161. dataType: "string",
  162. dicData: [],
  163. props: {
  164. label: 'title',
  165. value: 'id'
  166. },
  167. multiple: true,
  168. span: 6,
  169. },
  170. {
  171. label: "状态",
  172. prop: "billStatus",
  173. type: "select",
  174. props: {
  175. label: "dictValue",
  176. value: "dictKey"
  177. },
  178. dicData: [],
  179. disabled: true,
  180. span: 6,
  181. },
  182. {
  183. label: "备注",
  184. prop: "remark",
  185. type: "textarea",
  186. minRows: 2,
  187. width: 120,
  188. span: 18,
  189. },
  190. ]
  191. },
  192. optionList: {},
  193. resultList: [],
  194. normTypeList: [],
  195. jobTitleList: [],
  196. jobLevelList: [],
  197. occupationalLevelList: [],
  198. maritalList: [],
  199. orderFilesList: [],
  200. storagetreeList: [],
  201. breakConfiguration: {
  202. multipleChoices: false,
  203. multiple: false,
  204. disabled: false,
  205. searchShow: true,
  206. collapseTags: false,
  207. clearable: true,
  208. placeholder: "请点击右边按钮选择",
  209. dicData: []
  210. },
  211. };
  212. },
  213. props: {
  214. detailData: {
  215. type: Object
  216. }
  217. },
  218. async created() {
  219. this.optionList = await this.getColumnData(
  220. this.getColumnName(193),
  221. optionList
  222. );
  223. if (this.detailData.id) {
  224. this.getDetail(this.detailData.id);
  225. }
  226. if (this.detailData.status == 1) {
  227. this.option.disabled = true;
  228. }
  229. this.getWorkDicts("result_type").then(res => {
  230. this.resultList = res.data.data;
  231. });
  232. this.getWorkDicts("trading_type").then(res => {
  233. this.findObject(this.option.column, "billType").dicData =
  234. res.data.data;
  235. });
  236. this.getWorkDicts("unit").then(res => {
  237. this.findObject(this.optionList.column, "feeUnitId").dicData =
  238. res.data.data;
  239. });
  240. this.getWorkDicts("bill_status").then(res => {
  241. this.findObject(this.option.column, "billSdtatus").dicData = res.data.data;
  242. });
  243. getStoragetree().then(res => {
  244. this.findObject(this.option.column, "warehouseId").dicData = res.data.data;
  245. })
  246. getAllgoodstype().then(res => {
  247. this.findObject(this.option.column, "goodsId").dicData =
  248. res.data.data;
  249. })
  250. getLazylist().then(res => {
  251. this.findObject(this.option.column, "deptId").dicData =
  252. res.data.data;
  253. })
  254. },
  255. methods: {
  256. cellStyle() {
  257. return "padding:0;height:40px;";
  258. },
  259. selectValue(value,row) {
  260. console.log(value,row)
  261. if(row.feeId){
  262. row.feeName=value.cname
  263. }else{
  264. row.feeName=""
  265. }
  266. },
  267. getDetail(id) {
  268. this.loadingBtn=true
  269. getDetail(id)
  270. .then(res => {
  271. // if (res.data.data.warehouseId) {
  272. // res.data.data.warehouseId = res.data.data.warehouseId.split(',')
  273. // }
  274. this.form = res.data.data;
  275. this.dataList = res.data.data.agreementitemsList;
  276. this.orderFilesList = res.data.data.orderFilesList
  277. })
  278. .finally(() => {
  279. // this.loading = false;
  280. // this.showBut = true;
  281. this.loadingBtn = false;
  282. });
  283. },
  284. getCorpData(row) {
  285. this.form.corpName = row.cname
  286. },
  287. addRow() {
  288. this.dataList.push({ $cellEdit: true });
  289. },
  290. rowCell(row, index) {
  291. if (row.$cellEdit == true) {
  292. this.editCustomer();
  293. this.$set(row, "$cellEdit", false);
  294. } else {
  295. this.$set(row, "$cellEdit", true);
  296. }
  297. },
  298. rowDel(row, index) {
  299. this.$confirm("确定删除数据?", {
  300. confirmButtonText: "确定",
  301. cancelButtonText: "取消",
  302. type: "warning"
  303. }).then(() => {
  304. if (row.id) {
  305. // delItem(row.id).then(res => {
  306. // this.$message({
  307. // type: "success",
  308. // message: "删除成功!"
  309. // });
  310. // this.dataList.splice(index, 1);
  311. // });
  312. } else {
  313. this.$message({
  314. type: "success",
  315. message: "删除成功!"
  316. });
  317. this.dataList.splice(index, 1);
  318. }
  319. });
  320. },
  321. //修改提交触发
  322. editCustomer() {
  323. this.$refs["form"].validate((valid, done) => {
  324. done();
  325. if (valid) {
  326. // if (this.form.warehouseId) {
  327. // this.form.warehouseId = this.form.warehouseId.join(',')
  328. // }
  329. this.loadingBtn = true;
  330. submit({ ...this.form, agreementitemsList: this.dataList })
  331. .then(res => {
  332. this.$message.success("保存成功");
  333. // if (res.data.data.data.warehouseId) {
  334. // res.data.data.data.warehouseId = res.data.data.data.warehouseId.split(',')
  335. // }
  336. console.log()
  337. this.form = res.data.data.data;
  338. this.dataList = res.data.data.data.agreementitemsList;
  339. this.orderFilesList = res.data.data.orderFilesList
  340. })
  341. .finally(() => {
  342. this.loadingBtn = false;
  343. });
  344. } else {
  345. return false;
  346. }
  347. });
  348. },
  349. async saveColumn() {
  350. const inSave = await this.saveColumnData(
  351. this.getColumnName(193),
  352. this.optionList
  353. );
  354. if (inSave) {
  355. this.$nextTick(() => {
  356. this.$refs.crud.doLayout();
  357. });
  358. this.$message.success("保存成功");
  359. //关闭窗口
  360. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  361. }
  362. },
  363. async resetColumn() {
  364. this.optionList = optionList;
  365. const inSave = await this.delColumnData(
  366. this.getColumnName(193),
  367. optionList
  368. );
  369. if (inSave) {
  370. this.$nextTick(() => {
  371. this.$refs.crud.doLayout();
  372. });
  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-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. </style>