调解系统PC端服务

editTemplate.vue 9.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. <template>
  2. <div>
  3. <el-dialog title="修改模板" :visible="editVisable" v-if="editVisable" @close="cancel" width="600px" center>
  4. <el-form :model="ruleForm" label-position="left" :rules="rules" ref="ruleForm" label-width="170px"
  5. class="demo-ruleForm">
  6. <el-form-item label="模板名称" prop="temName">
  7. <el-input v-model="ruleForm.temName"></el-input>
  8. </el-form-item>
  9. <!-- <el-form-item label="模板类型" prop="temType">
  10. <el-select v-model="ruleForm.temType" placeholder="请选择">
  11. <el-option v-for="dict in dict.type.template_type" :key="dict.value" :label="dict.label"
  12. :value="dict.value"></el-option>
  13. </el-select>
  14. </el-form-item> -->
  15. <el-form-item label="自然人调解申请书模板" v-if="ruleForm.personApplicationFile && ruleForm.personApplicationFile.fileName">
  16. <span style="color: #0e5ce3;cursor:pointer" @click="openUrl(ruleForm.personApplicationFile.temOrigPath)">{{
  17. ruleForm.personApplicationFile.fileName ? ruleForm.personApplicationFile.fileName : ""
  18. }}</span>
  19. </el-form-item>
  20. <el-form-item label="机构调解申请书模板" v-if="ruleForm.applicationFile.fileName">
  21. <span style="color: #0e5ce3;cursor:pointer" @click="openUrl(ruleForm.applicationFile.temOrigPath)">{{
  22. ruleForm.applicationFile.fileName ? ruleForm.applicationFile.fileName : ""
  23. }}</span>
  24. </el-form-item>
  25. <el-form-item label="和解协议模板" v-if="ruleForm.agreementFile.fileName">
  26. <!-- <span style="color: #0e5ce3;cursor:pointer" @click="openUrl(editData.temOrigPath)">{{ editData.fileName
  27. }}</span> -->
  28. <span style="color: #0e5ce3;cursor:pointer" @click="openUrl(ruleForm.agreementFile.temOrigPath)">{{
  29. ruleForm.agreementFile.fileName ? ruleForm.agreementFile.fileName : ""
  30. }}</span>
  31. </el-form-item>
  32. <el-form-item label="调解书模板" v-if="ruleForm.bookFile.fileName">
  33. <span style="color: #0e5ce3;cursor:pointer" @click="openUrl(ruleForm.bookFile.temOrigPath)">{{
  34. ruleForm.bookFile.fileName ? ruleForm.bookFile.fileName : ""
  35. }}</span>
  36. </el-form-item>
  37. </el-form>
  38. <el-upload class="avatar-uploader" :on-success="handleSuccessC" ref="upload" :action="UploadUrl()"
  39. :headers="headers" :data="filedataC" :on-remove="handleRemoveC" :on-change="handleChangeC" accept=".doc,.docx"
  40. :file-list="fileListC" :limit="1">
  41. <el-button size="small" type="primary">选择自然人调解申请书模板</el-button>
  42. </el-upload>
  43. <el-upload class="avatar-uploader" :on-success="handleSuccess" ref="upload" :action="UploadUrl()"
  44. :headers="headers" :data="filedata" :on-remove="handleRemove" :on-change="handleChange" accept=".doc,.docx"
  45. :file-list="fileList" :limit="1">
  46. <el-button size="small" type="primary">选择机构调解申请书模板</el-button>
  47. </el-upload>
  48. <el-upload class="avatar-uploader" :on-success="handleSuccessA" ref="uploadA" :action="UploadUrl()"
  49. :headers="headers" :data="filedataA" :on-remove="handleRemoveA" :on-change="handleChangeA"
  50. accept=".doc,.docx" :file-list="fileListA" :limit="1">
  51. <el-button size="small" type="primary">选择和解协议模板</el-button>
  52. </el-upload>
  53. <el-upload class="avatar-uploader" :on-success="handleSuccessB" ref="upload" :action="UploadUrl()"
  54. :headers="headers" :data="filedataB" :on-remove="handleRemoveB" :on-change="handleChangeB"
  55. accept=".doc,.docx" :file-list="fileListB" :limit="1">
  56. <el-button size="small" type="primary">选择调解书模板</el-button>
  57. </el-upload>
  58. <div slot="footer" class="dialog-footer">
  59. <el-button @click="cancel" class="endbutton"><span>取 消</span></el-button>
  60. <el-button type="primary" @click="submitUpload" class="endbutton"><span>确认</span></el-button>
  61. </div>
  62. </el-dialog>
  63. </div>
  64. </template>
  65. <script>
  66. import { getToken } from "@/utils/auth";
  67. import { updateTemplate, getTemplateDetail } from "@/api/officialSeal/officialSeal"
  68. export default {
  69. props: ["editVisable", "editData", "queryParams"],
  70. dicts: ["template_type"],
  71. data() {
  72. return {
  73. fileList: [],
  74. fileListA: [],
  75. fileListB: [],
  76. fileListC: [],
  77. data: [],
  78. headers: {
  79. Authorization: "Bearer " + getToken(),
  80. },
  81. isImg: true,
  82. filedata: {
  83. annexType: 1
  84. },
  85. filedataA: {
  86. annexType: 2
  87. },
  88. filedataB: {
  89. annexType: 3
  90. },
  91. filedataC: {
  92. annexType: 4
  93. },
  94. flagBtn: false,
  95. ruleForm: {
  96. agreementFile:{},
  97. applicationFile:{},
  98. bookFile:{}
  99. },
  100. rules: {
  101. temName: [
  102. { required: true, message: '请输入模板名称', trigger: 'blur' },
  103. ],
  104. },
  105. submitForm: {
  106. annexIds: []
  107. }
  108. };
  109. },
  110. watch: {
  111. editData(val) {
  112. if (val) {
  113. this.fileList = [];
  114. }
  115. },
  116. editVisable(val){
  117. if(val){
  118. this.getTemplateDetailFn({ id: this.editData.id });
  119. this.submitForm.annexIds = []
  120. }
  121. }
  122. },
  123. created() {
  124. },
  125. methods: {
  126. // 打开链接
  127. openUrl(urlTemp) {
  128. let headPath = window.location.origin + "/API/";
  129. window.open(headPath + urlTemp);
  130. },
  131. cancel() {
  132. this.$emit("cancelEdit");
  133. },
  134. UploadUrl() {
  135. return window.location.origin + "/API/deptIdentify/updateTemplate";
  136. },
  137. /**根据id查看详情*/
  138. getTemplateDetailFn(data) {
  139. getTemplateDetail(data).then(res => {
  140. this.ruleForm = res;
  141. // this.submitForm.annexIds = [this.ruleForm.agreementFile.fileId,this.ruleForm.applicationFile.fileId,this.ruleForm.bookFile.fileId]
  142. })
  143. },
  144. submitUpload() {
  145. this.$refs['ruleForm'].validate((valid) => {
  146. if (valid) {
  147. this.$refs['ruleForm'].validate((valid) => {
  148. if (valid) {
  149. this.submitForm.identifyId = this.ruleForm.identifyId;
  150. this.submitForm.temName = this.ruleForm.temName;
  151. this.submitForm.id = this.ruleForm.id;
  152. console.log(this.submitForm,'ooooooooooooooooooooooooooooo');
  153. updateTemplate(this.submitForm).then(res => {
  154. this.$message.success('修改成功');
  155. this.$emit("cancelEdit");
  156. this.$emit('getList', this.queryParams);
  157. })
  158. }
  159. });
  160. }
  161. });
  162. },
  163. handleChange(file, fileList) {
  164. this.isImg = file.type === '.doc' || '.docx'
  165. },
  166. UploadUrl() {
  167. return window.location.origin + "/API/deptIdentify/upload";
  168. },
  169. handleRemove(file, fileList) {
  170. console.log(file, fileList);
  171. },
  172. // 机构
  173. handleSuccess(res) {
  174. console.log(res,'机构上传成功');
  175. this.$message.success('上传成功');
  176. // this.submitForm.annexIds.push(res.annexId);
  177. this.submitForm.annexIds.push(res.annexId);
  178. },
  179. // 自然人
  180. handleSuccessC(res) {
  181. console.log(res,'自然人上传成功');
  182. this.$message.success('上传成功');
  183. this.submitForm.annexIds.push(res.annexId);
  184. },
  185. handleRemoveC(file, fileList) {
  186. console.log(file, fileList);
  187. },
  188. handleChangeC(file, fileList) {
  189. this.isImg = file.type === '.doc' || '.docx'
  190. },
  191. handleChangeA(file, fileList) {
  192. this.isImg = file.type === '.doc' || '.docx'
  193. },
  194. UploadUrl() {
  195. return window.location.origin + "/API/deptIdentify/upload";
  196. },
  197. handleRemoveA(file, fileList) {
  198. console.log(file, fileList);
  199. },
  200. // 和解协议
  201. handleSuccessA(res) {
  202. this.$message.success('上传成功');
  203. // this.submitForm.annexIds.push(res.annexId);
  204. this.submitForm.annexIds.push(res.annexId);
  205. },
  206. handleChangeB(file, fileList) {
  207. this.isImg = file.type === '.doc' || '.docx'
  208. },
  209. UploadUrl() {
  210. return window.location.origin + "/API/deptIdentify/upload";
  211. },
  212. handleRemoveB(file, fileList) {
  213. console.log(file, fileList);
  214. },
  215. // 调解书
  216. handleSuccessB(res) {
  217. this.$message.success('上传成功');
  218. // this.submitForm.annexIds.push(res.annexId);
  219. this.submitForm.annexIds.push(res.annexId);
  220. },
  221. // handleSuccess() {
  222. // this.$message.success('修改成功');
  223. // this.$emit("cancelEdit");
  224. // this.$emit('getList', this.queryParams);
  225. // }
  226. },
  227. };
  228. </script>
  229. <style lang="scss" scoped>
  230. .avatar-uploader {
  231. margin-bottom: 20px;
  232. }</style>