shipOwnerWeappConfig.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409
  1. <template>
  2. <div>
  3. <el-card class="mb20">
  4. <template #header>
  5. <div class="card-header">
  6. <span>证书办理服务介绍</span>
  7. </div>
  8. </template>
  9. <div class="df">
  10. <div>
  11. <el-image
  12. v-if="certOperationIntroduce.imageUrl"
  13. class="mb10"
  14. style="width: 200px; height: 200px"
  15. fit="cover"
  16. :preview-src-list="[certOperationIntroduce.imageUrl]"
  17. :src="certOperationIntroduce.imageUrl"
  18. ></el-image>
  19. <el-upload
  20. class="df aic jcfe"
  21. :action="
  22. store.state.baseurl +
  23. '/sys/basic/config/ship/upload/introduce/img'
  24. "
  25. :show-file-list="false"
  26. :data="{ configType: 1 }"
  27. :on-success="
  28. (res) => uploadCertSuccess(res, certOperationIntroduce)
  29. "
  30. >
  31. <el-button type="primary">
  32. {{ certOperationIntroduce.imageUrl ? "重新" : "" }}上传图片
  33. </el-button>
  34. </el-upload>
  35. </div>
  36. <div class="ml20">
  37. <div style="margin-bottom: 15px">
  38. <el-input
  39. type="textarea"
  40. v-model="certOperationIntroduce.textContent"
  41. placeholder="请输入证书办理服务介绍"
  42. style="width: 400px; height: 200px"
  43. ></el-input>
  44. </div>
  45. <div class="df jcfe">
  46. <el-button
  47. type="primary"
  48. @click="updateShipIntroduceContent(1, certOperationIntroduce)"
  49. >
  50. 更新证书办理服务介绍
  51. </el-button>
  52. </div>
  53. </div>
  54. </div>
  55. </el-card>
  56. <el-card class="mb20">
  57. <template #header>
  58. <div class="card-header df aic">
  59. <span class="mr10">证书办理联系人</span>
  60. <el-button type="primary" @click="addShipContact">
  61. 添加联系人
  62. </el-button>
  63. </div>
  64. <el-dialog v-model="showModifyDialog" title="修改联系人" width="500px">
  65. <el-form
  66. class="ml20 mt20"
  67. :model="modifyForm"
  68. :rules="formRules"
  69. label-width="100px"
  70. >
  71. <el-form-item class="mb20" label="办事处" prop="officeName">
  72. <el-input class="w300" v-model="modifyForm.officeName" />
  73. </el-form-item>
  74. <el-form-item class="mb20" label="联系人" prop="contactPerson">
  75. <el-input class="w300" v-model="modifyForm.contactPerson" />
  76. </el-form-item>
  77. <el-form-item class="mb20" label="手机号" prop="contactPhone">
  78. <el-input class="w300" v-model="modifyForm.contactPhone" />
  79. </el-form-item>
  80. </el-form>
  81. <template #footer>
  82. <div class="df aic jcfe mb10" style="padding-right: 50px">
  83. <el-button @click="showModifyDialog = false">取消</el-button>
  84. <el-button type="primary" @click="submitModifyForm">
  85. 确定
  86. </el-button>
  87. </div>
  88. </template>
  89. </el-dialog>
  90. </template>
  91. <el-table :data="shipCertOperationList" style="width: 800px" border>
  92. <el-table-column type="index" label="序号" width="60" align="center" />
  93. <el-table-column prop="officeName" label="办事处" align="center" />
  94. <el-table-column
  95. prop="contactPerson"
  96. label="联系人"
  97. width="160"
  98. align="center"
  99. />
  100. <el-table-column
  101. prop="contactPhone"
  102. label="手机号"
  103. width="160"
  104. align="center"
  105. />
  106. <el-table-column label="操作" width="180" align="center">
  107. <template #default="scope">
  108. <el-button
  109. type="primary"
  110. size="small"
  111. @click="modifyShipCertOperation(scope.row)"
  112. >
  113. 修改
  114. </el-button>
  115. <el-button
  116. type="danger"
  117. size="small"
  118. @click="deleteShipCertOperation(scope.row)"
  119. >
  120. 删除
  121. </el-button>
  122. </template>
  123. </el-table-column>
  124. </el-table>
  125. </el-card>
  126. <el-card class="mb20">
  127. <template #header>
  128. <div class="card-header">
  129. <span>法律援助服务介绍</span>
  130. </div>
  131. </template>
  132. <div class="df">
  133. <div>
  134. <el-image
  135. v-if="legalAidIntroduce.imageUrl"
  136. class="mb10"
  137. style="width: 200px; height: 200px"
  138. fit="cover"
  139. :preview-src-list="[legalAidIntroduce.imageUrl]"
  140. :src="legalAidIntroduce.imageUrl"
  141. ></el-image>
  142. <el-upload
  143. class="df aic jcfe"
  144. :action="
  145. store.state.baseurl +
  146. '/sys/basic/config/ship/upload/introduce/img'
  147. "
  148. :show-file-list="false"
  149. :data="{ configType: 2 }"
  150. :on-success="(res) => uploadCertSuccess(res, legalAidIntroduce)"
  151. >
  152. <el-button type="primary">
  153. {{ legalAidIntroduce.imageUrl ? "重新" : "" }}上传图片
  154. </el-button>
  155. </el-upload>
  156. </div>
  157. <div class="ml20">
  158. <div style="margin-bottom: 15px">
  159. <el-input
  160. type="textarea"
  161. v-model="legalAidIntroduce.textContent"
  162. placeholder="请输入法律援助服务介绍"
  163. style="width: 400px; height: 200px"
  164. ></el-input>
  165. </div>
  166. <div class="df jcfe">
  167. <el-button
  168. type="primary"
  169. @click="updateShipIntroduceContent(2, legalAidIntroduce)"
  170. >
  171. 更新法律援助服务介绍
  172. </el-button>
  173. </div>
  174. </div>
  175. </div>
  176. </el-card>
  177. <el-card class="mb20">
  178. <template #header>
  179. <div class="card-header">
  180. <span>法律援助律师/团队介绍</span>
  181. </div>
  182. </template>
  183. <div class="df">
  184. <div>
  185. <el-image
  186. v-if="lawyerIntroduce.imageUrl"
  187. class="mb10"
  188. style="width: 200px; height: 200px"
  189. fit="cover"
  190. :preview-src-list="[lawyerIntroduce.imageUrl]"
  191. :src="lawyerIntroduce.imageUrl"
  192. ></el-image>
  193. <el-upload
  194. class="df aic jcfe"
  195. :action="
  196. store.state.baseurl +
  197. '/sys/basic/config/ship/upload/introduce/img'
  198. "
  199. :show-file-list="false"
  200. :data="{ configType: 3 }"
  201. :on-success="(res) => uploadCertSuccess(res, lawyerIntroduce)"
  202. >
  203. <el-button type="primary">
  204. {{ lawyerIntroduce.imageUrl ? "重新" : "" }}上传图片
  205. </el-button>
  206. </el-upload>
  207. </div>
  208. <div class="ml20">
  209. <div style="margin-bottom: 15px">
  210. <el-input
  211. type="textarea"
  212. v-model="lawyerIntroduce.textContent"
  213. placeholder="请输入法律援助律师/团队介绍
  214. "
  215. style="width: 400px; height: 200px"
  216. ></el-input>
  217. </div>
  218. <div class="df jcfe">
  219. <el-button
  220. type="primary"
  221. @click="updateShipIntroduceContent(3, lawyerIntroduce)"
  222. >
  223. 更新律师/团队介绍
  224. </el-button>
  225. </div>
  226. </div>
  227. </div>
  228. </el-card>
  229. </div>
  230. </template>
  231. <script setup>
  232. import { onMounted, ref } from "vue";
  233. import api from "apis/fetch";
  234. import store from "store";
  235. import { ElNotification } from "element-plus";
  236. const baseurl = import.meta.env.VITE_BASEURL;
  237. import _ from "lodash";
  238. const certOperationIntroduce = ref({});
  239. const lawyerIntroduce = ref({});
  240. const legalAidIntroduce = ref({});
  241. const shipCertOperationList = ref([]);
  242. async function getShipIntroduceInfo() {
  243. let { data } = await api.getShipIntroduceInfo();
  244. if (data.status === 0) {
  245. certOperationIntroduce.value = data.result.certOperationIntroduce;
  246. lawyerIntroduce.value = data.result.lawyerIntroduce;
  247. legalAidIntroduce.value = data.result.legalAidIntroduce;
  248. } else {
  249. certOperationIntroduce.value = {};
  250. lawyerIntroduce.value = {};
  251. legalAidIntroduce.value = {};
  252. }
  253. }
  254. async function getShipCertOperationList() {
  255. let { data } = await api.getShipCertOperationList({
  256. currentPage: 1,
  257. size: 100,
  258. });
  259. if (data.status === 0) {
  260. shipCertOperationList.value = data.result;
  261. } else {
  262. shipCertOperationList.value = [];
  263. }
  264. }
  265. function uploadCertSuccess(res, target) {
  266. if (res.status === 0) {
  267. target.imageUrl = res.result;
  268. ElNotification.success({
  269. title: "成功",
  270. message: res.msg,
  271. });
  272. } else {
  273. ElNotification.error({
  274. title: "失败",
  275. message: res.msg,
  276. });
  277. }
  278. }
  279. async function deleteShipCertOperation(row) {
  280. try {
  281. await ElMessageBox.confirm("确定要删除该联系人吗?", "警告", {
  282. confirmButtonText: "确定",
  283. cancelButtonText: "取消",
  284. type: "warning",
  285. });
  286. const { data } = await api.deleteShipCertOperation({
  287. certOperationId: row.id,
  288. });
  289. if (data.status === 0) {
  290. ElNotification.success({
  291. title: "成功",
  292. message: data.msg,
  293. });
  294. await getShipCertOperationList();
  295. }
  296. } catch (error) {}
  297. }
  298. const isEditMode = ref(false);
  299. function addShipContact() {
  300. isEditMode.value = false;
  301. modifyForm.value = { officeName: "", contactPerson: "", contactPhone: "" };
  302. showModifyDialog.value = true;
  303. }
  304. const showModifyDialog = ref(false);
  305. const modifyForm = ref({
  306. id: 0,
  307. officeName: "",
  308. contactPerson: "",
  309. contactPhone: "",
  310. });
  311. const formRules = {
  312. officeName: [
  313. { required: true, message: "请输入办事处名称", trigger: "blur" },
  314. ],
  315. contactPerson: [{ required: true, message: "请输入联系人", trigger: "blur" }],
  316. contactPhone: [
  317. { required: true, message: "请输入手机号", trigger: "blur" },
  318. { pattern: /^1[3-9]\d{9}$/, message: "手机号格式不正确", trigger: "blur" },
  319. ],
  320. };
  321. async function modifyShipCertOperation(row) {
  322. try {
  323. isEditMode.value = true;
  324. modifyForm.value = _.cloneDeep(row);
  325. showModifyDialog.value = true;
  326. const apiMethod = isEditMode.value
  327. ? api.updateShipCertOperation({
  328. id: modifyForm.value.id,
  329. ...modifyForm.value,
  330. })
  331. : api.addShipCertOperation(modifyForm.value);
  332. const { data } = await apiMethod;
  333. if (data.status === 0) {
  334. ElNotification.success({
  335. title: "成功",
  336. message: data.msg,
  337. });
  338. await getShipCertOperationList();
  339. }
  340. } catch (error) {}
  341. }
  342. async function submitModifyForm() {
  343. try {
  344. await ElMessageBox.confirm("确定要保存修改吗?", "警告", {
  345. confirmButtonText: "确定",
  346. cancelButtonText: "取消",
  347. type: "warning",
  348. });
  349. const { data } = await api.modifyShipCertOperation({
  350. ...modifyForm.value,
  351. certOperationId: modifyForm.value.id,
  352. });
  353. if (data.status === 0) {
  354. ElNotification.success({
  355. title: "成功",
  356. message: data.msg,
  357. });
  358. await getShipCertOperationList();
  359. } else {
  360. ElNotification.error({
  361. title: "失败",
  362. message: data.msg,
  363. });
  364. }
  365. showModifyDialog.value = false;
  366. } catch (error) {}
  367. }
  368. async function updateShipIntroduceContent(configType, target) {
  369. let { data } = await api.updateShipIntroduceContent({
  370. configType,
  371. textContent: target.textContent,
  372. });
  373. if (data.status === 0) {
  374. ElNotification.success({
  375. title: "成功",
  376. message: data.msg,
  377. });
  378. } else {
  379. ElNotification.error({
  380. title: "失败",
  381. message: data.msg,
  382. });
  383. }
  384. }
  385. onMounted(() => {
  386. getShipIntroduceInfo();
  387. getShipCertOperationList();
  388. });
  389. </script>
  390. <style scoped>
  391. /* */
  392. :deep() .el-textarea__inner {
  393. height: 200px;
  394. }
  395. .w300 {
  396. width: 300px;
  397. }
  398. </style>