wishInfoUserRecord-detail.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  1. <template>
  2. <el-dialog
  3. :visible.sync="showDialog"
  4. :title="title"
  5. :modal-append-to-body="false"
  6. style="text-align: left"
  7. @close="closeDialog"
  8. :close-on-click-modal="false"
  9. width="1000px"
  10. >
  11. <div class="user-panel" v-loading="loading">
  12. <el-descriptions class="margin-top" :column="3" border>
  13. <el-descriptions-item>
  14. <template slot="label">
  15. 流水号
  16. </template>
  17. {{formModel.wishInfoUserRecord.num}}
  18. </el-descriptions-item>
  19. <el-descriptions-item>
  20. <template slot="label">
  21. 爱心人士
  22. </template>
  23. {{formModel.wishInfoUserRecord.regUserName}}
  24. </el-descriptions-item>
  25. <el-descriptions-item>
  26. <template slot="label">
  27. 是否现场互换心愿
  28. </template>
  29. <span v-if="formModel.wishInfoUserRecord.isSpot">是</span>
  30. <span v-else>否</span>
  31. </el-descriptions-item>
  32. <el-descriptions-item>
  33. <template slot="label">
  34. 学生心愿
  35. </template>
  36. 篮球
  37. </el-descriptions-item>
  38. <el-descriptions-item span="2">
  39. <template slot="label">
  40. 作品图片
  41. </template>
  42. <el-link :href="formModel.wishInfo.image" target="blank_" :underline="false">
  43. <el-image
  44. style="width: 100px; height: 100px"
  45. :src="formModel.wishInfo.image">
  46. </el-image>
  47. </el-link>
  48. </el-descriptions-item>
  49. <el-descriptions-item>
  50. <template slot="label">
  51. 学生姓名
  52. </template>
  53. {{formModel.wishInfo.studentName}}
  54. </el-descriptions-item>
  55. <el-descriptions-item>
  56. <template slot="label">
  57. 学生类型
  58. </template>
  59. {{formModel.wishInfo.studentType}}
  60. </el-descriptions-item>
  61. <el-descriptions-item>
  62. <template slot="label">
  63. 互换状态
  64. </template>
  65. {{formModel.wishInfoUserRecord.statusN}}
  66. </el-descriptions-item>
  67. <el-descriptions-item>
  68. <template slot="label">
  69. 收件人
  70. </template>
  71. {{formModel.wishInfoUserRecord.recipients}}
  72. </el-descriptions-item>
  73. <el-descriptions-item span="2">
  74. <template slot="label">
  75. 收件人电话
  76. </template>
  77. {{formModel.wishInfoUserRecord.recipientsPhone}}
  78. </el-descriptions-item>
  79. <el-descriptions-item span="3">
  80. <template slot="label">
  81. 收件人地址
  82. </template>
  83. {{formModel.wishInfoUserRecord.recipientsAddress}}
  84. </el-descriptions-item>
  85. <el-descriptions-item>
  86. <template slot="label">
  87. 寄件人
  88. </template>
  89. {{formModel.wishInfoUserRecord.sender}}
  90. </el-descriptions-item>
  91. <el-descriptions-item span="2">
  92. <template slot="label">
  93. 寄件人电话
  94. </template>
  95. {{formModel.wishInfoUserRecord.senderPhone}}
  96. </el-descriptions-item>
  97. <el-descriptions-item>
  98. <template slot="label">
  99. 寄件人地址
  100. </template>
  101. {{formModel.wishInfoUserRecord.senderAddress}}
  102. </el-descriptions-item>
  103. </el-descriptions>
  104. </div>
  105. <span slot="footer" class="dialog-footer">
  106. <el-button @click="closeDialog">取 消</el-button>
  107. </span>
  108. </el-dialog>
  109. </template>
  110. <script>
  111. import Constant from "@/constant";
  112. import { getToken } from "@/utils/auth"; // get token from cookie
  113. import wishInfoUserRecordApi from "@/api/base/wishInfoUserRecord";
  114. import dataDictionaryApi from "@/api/sys/dataDictionary";
  115. export default {
  116. props: ["businessKey", "title"],
  117. data() {
  118. return {
  119. showPwd: true,
  120. ruleValidate: {
  121. category: [
  122. { required: true, message: "类型不能为空", trigger: "blur" },
  123. ],
  124. title: [
  125. { required: true, message: "标题不能为空", trigger: "blur" },
  126. ],
  127. amount: [
  128. { required: true, message: "数量不能为空", trigger: "blur" },
  129. ],
  130. studentName: [
  131. { required: true, message: "学生姓名不能为空", trigger: "blur" },
  132. ],
  133. studentType: [
  134. { required: true, message: "学生类型不能为空", trigger: "blur" },
  135. ],
  136. },
  137. roleList: [],
  138. formModel: {
  139. wishInfoUserRecord:[],
  140. wishInfo:[]
  141. },
  142. showDialog: true,
  143. loading: false,
  144. submitting: false,
  145. categoryList:[],
  146. //上传地址
  147. uploadUrl: Constant.serverUrl + "/uploadPicture",
  148. uploadData: {
  149. subFolder: "love-donation",
  150. },
  151. fileUrl: "",
  152. fileUrl1: "",
  153. headers: {
  154. Authorization: getToken(),
  155. },
  156. uploadUrl1: Constant.serverUrl + "/tinymce/upload?token=" + getToken(),
  157. };
  158. },
  159. created() {
  160. dataDictionaryApi.findByCatalogName({catalogName: "心愿类型",})
  161. .then((response) => {
  162. var jsonData = response.data;
  163. this.categoryList = jsonData.data;
  164. });
  165. },
  166. methods: {
  167. closeDialog() {
  168. this.$emit("close", false);
  169. },
  170. handleSubmit() {
  171. var self = this;
  172. this.$refs["form"].validate((valid) => {
  173. if (valid) {
  174. (function () {
  175. var id = self.formModel.id;
  176. if (id == null || id.length == 0) {
  177. return wishInfoUserRecordApi.add(self.formModel);
  178. } else {
  179. self.formModel.password = null;
  180. return wishInfoUserRecordApi.update(self.formModel);
  181. }
  182. })().then(function (response) {
  183. var jsonData = response.data;
  184. if (jsonData.result) {
  185. self.$message({
  186. message: "保存成功!",
  187. type: "success",
  188. });
  189. self.$emit("close", true);
  190. } else {
  191. self.$message({
  192. message: jsonData.message + "",
  193. type: "warning",
  194. });
  195. self.$emit("close", false);
  196. }
  197. });
  198. }
  199. });
  200. },
  201. handleAvatarSuccess(res, file) {
  202. var self = this;
  203. self.formModel.image = res.data;
  204. self.fileUrl =
  205. res.data + "?x-oss-process=image/resize,m_lfit,h_300,w_300";
  206. },
  207. },
  208. async mounted() {
  209. var self = this;
  210. self.loading = true;
  211. (function () {
  212. if (self.businessKey != null && self.businessKey.length > 0) {
  213. return wishInfoUserRecordApi.edit(self.businessKey);
  214. } else {
  215. return wishInfoUserRecordApi.create();
  216. }
  217. })()
  218. .then((response) => {
  219. var jsonData = response.data;
  220. if (jsonData.result) {
  221. self.formModel = jsonData.data;
  222. //alert(JSON.stringify(self.formModel))
  223. self.showModal = true;
  224. let image = self.formModel.image;
  225. if (image != null) {
  226. self.fileUrl = image
  227. }
  228. if (self.formModel.introduction != null) {
  229. self.$refs.editor.setContent(self.formModel.introduction);
  230. }
  231. } else {
  232. self.$message.error(jsonData.message + "");
  233. }
  234. self.loading = false;
  235. })
  236. .catch((error) => {
  237. self.$message.error(error + "");
  238. self.loading = false;
  239. });
  240. },
  241. components: {
  242. },
  243. };
  244. </script>
  245. <style scoped>
  246. .user-panel {
  247. margin: 10px auto;
  248. }
  249. .avatar-uploader .el-upload {
  250. border: 1px dashed #d9d9d9;
  251. border-radius: 6px;
  252. cursor: pointer;
  253. position: relative;
  254. overflow: hidden;
  255. }
  256. .avatar-uploader .el-upload:hover {
  257. border-color: #409EFF;
  258. }
  259. .avatar-uploader-icon {
  260. font-size: 28px;
  261. color: #8c939d;
  262. width: 178px;
  263. height: 178px;
  264. line-height: 178px;
  265. text-align: center;
  266. }
  267. .avatar {
  268. width: 178px;
  269. height: 178px;
  270. display: block;
  271. }
  272. </style>