applicationExamine-detail.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. <style scoped>
  2. .user-panel {
  3. margin: 10px auto;
  4. }
  5. </style>
  6. <template>
  7. <el-dialog
  8. :visible.sync="showDialog"
  9. :title="title"
  10. :modal-append-to-body="false"
  11. style="text-align: left"
  12. @close="closeDialog"
  13. :close-on-click-modal="false"
  14. >
  15. <div class="user-panel" v-loading="loading">
  16. <el-form
  17. ref="form"
  18. :model="formModel"
  19. :rules="ruleValidate"
  20. :label-width="'130px'"
  21. >
  22. <el-form-item label="申请者公司" prop="applicationCompanyId">
  23. <el-select-tree
  24. :props="props"
  25. :options="companyResult"
  26. v-model="formModel.applicationCompanyId"
  27. size=""
  28. height="200"
  29. ></el-select-tree>
  30. </el-form-item>
  31. <el-form-item label="申请者角色" prop="applicationRoleId">
  32. <el-select
  33. v-model="formModel.applicationRoleId"
  34. filterable
  35. placeholder="请选择"
  36. style="width: 280px"
  37. >
  38. <el-option
  39. v-for="role in applicationRoleResult"
  40. :key="role.id"
  41. :label="role.personRoleName"
  42. :value="role.id"
  43. ></el-option>
  44. </el-select>
  45. </el-form-item>
  46. <el-form-item label="审核人公司" prop="examineCompanyId">
  47. <el-select-tree
  48. :props="props"
  49. :options="companyResult"
  50. v-model="formModel.examineCompanyId"
  51. size=""
  52. height="200"
  53. ></el-select-tree>
  54. </el-form-item>
  55. <el-form-item label="审核人角色" prop="examineRoleId">
  56. <el-select
  57. v-model="formModel.examineRoleId"
  58. filterable
  59. placeholder="请选择"
  60. style="width: 280px"
  61. >
  62. <el-option
  63. v-for="role in examineRoleResult"
  64. :key="role.id"
  65. :label="role.personRoleName"
  66. :value="role.id"
  67. ></el-option>
  68. </el-select>
  69. </el-form-item>
  70. <el-form-item label="备注信息" prop="remark">
  71. <el-input
  72. v-model="formModel.remark"
  73. placeholder="请输入备注信息"
  74. style="width: 300px"
  75. ></el-input>
  76. </el-form-item>
  77. </el-form>
  78. </div>
  79. <span slot="footer" class="dialog-footer">
  80. <el-button @click="closeDialog">取 消</el-button>
  81. <el-button type="primary" @click="handleSubmit" :loading="submitting"
  82. >确 定</el-button
  83. >
  84. </span>
  85. </el-dialog>
  86. </template>
  87. <script>
  88. import Constant from "@/constant";
  89. import applicationExamineApi from "@/api/base/applicationExamine";
  90. import companyInfoApi from "@/api/base/companyInfo";
  91. import personRoleInfoApi from "@/api/base/personRoleInfo";
  92. import SelectTree from "@/components/SelectTree";
  93. export default {
  94. components: {
  95. "el-select-tree": SelectTree,
  96. },
  97. props: ["businessKey", "title"],
  98. data() {
  99. return {
  100. formModel: {},
  101. ruleValidate: {
  102. applicationRoleId: [
  103. { required: true, message: "申请者角色不能为空", trigger: "blur" },
  104. ],
  105. applicationCompanyId: [
  106. { required: true, message: "申请者公司不能为空", trigger: "blur" },
  107. ],
  108. examineRoleId: [
  109. { required: true, message: "审核人角色不能为空", trigger: "blur" },
  110. ],
  111. examineCompanyId: [
  112. { required: true, message: "审核人公司不能为空", trigger: "blur" },
  113. ],
  114. },
  115. showDialog: true,
  116. loading: false,
  117. submitting: false,
  118. treeData: [],
  119. props: {
  120. // 配置项(必选)
  121. value: "id",
  122. label: "name",
  123. children: "children",
  124. },
  125. applicationRoleResult:[],
  126. examineRoleResult:[],
  127. companyResult: [],
  128. };
  129. },
  130. created() {
  131. var self = this;
  132. companyInfoApi.list().then(function (response) {
  133. var jsonData = response.data;
  134. if (jsonData.result) {
  135. if (jsonData.data != null && jsonData.data != "") {
  136. self.companyResult = jsonData.data;
  137. }
  138. }
  139. });
  140. },watch: {
  141. "formModel.applicationCompanyId": function (val, oldval) {
  142. if (val != null && val != "") {
  143. var self = this;
  144. var formData = new FormData();
  145. formData.append("companyId", val);
  146. personRoleInfoApi.listByCompanyId(formData).then(function (response) {
  147. var jsonData = response.data;
  148. if (jsonData.result) {
  149. if (jsonData.data != null && jsonData.data != "") {
  150. self.applicationRoleResult = jsonData.data;
  151. // applicationCompanyId
  152. // applicationRoleId
  153. // examineCompanyId
  154. // examineRoleId
  155. }
  156. }
  157. });
  158. }
  159. },
  160. "formModel.examineCompanyId": function (val, oldval) {
  161. if (val != null && val != "") {
  162. var self = this;
  163. var formData = new FormData();
  164. formData.append("companyId", val);
  165. personRoleInfoApi.listByCompanyId(formData).then(function (response) {
  166. var jsonData = response.data;
  167. if (jsonData.result) {
  168. if (jsonData.data != null && jsonData.data != "") {
  169. self.examineRoleResult = jsonData.data;
  170. // applicationCompanyId
  171. // applicationRoleId
  172. // examineCompanyId
  173. // examineRoleId
  174. }
  175. }
  176. });
  177. }
  178. }
  179. },
  180. methods: {
  181. closeDialog() {
  182. this.$emit("close", false);
  183. },
  184. handleSubmit() {
  185. var self = this;
  186. this.$refs["form"].validate((valid) => {
  187. if (valid) {
  188. (function () {
  189. var id = self.formModel.id;
  190. if (id == null || id.length == 0) {
  191. return applicationExamineApi.add(self.formModel);
  192. } else {
  193. return applicationExamineApi.update(self.formModel);
  194. }
  195. })().then(function (response) {
  196. var jsonData = response.data;
  197. if (jsonData.result) {
  198. self.$message({
  199. message: "保存成功!",
  200. type: "success",
  201. });
  202. self.$emit("close", true);
  203. } else {
  204. self.$message({
  205. message: jsonData.message + "",
  206. type: "warning",
  207. });
  208. self.$emit("close", false);
  209. }
  210. });
  211. }
  212. });
  213. },
  214. },
  215. mounted: function () {
  216. var self = this;
  217. (function () {
  218. if (self.businessKey.length == 0) {
  219. return applicationExamineApi.create();
  220. } else {
  221. return applicationExamineApi.edit(self.businessKey);
  222. }
  223. })()
  224. .then((response) => {
  225. var jsonData = response.data;
  226. self.loading = false;
  227. if (jsonData.result) {
  228. self.formModel = jsonData.data;
  229. } else {
  230. self.$message.error(jsonData.message + "");
  231. }
  232. })
  233. .catch((error) => {
  234. self.$message.error(error + "");
  235. });
  236. },
  237. };
  238. </script>