index.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
  4. <el-form-item label="企业名称" prop="enterpriseName" label-width="200">
  5. <el-input
  6. v-model="queryParams.enterpriseName"
  7. placeholder="请输入企业名称"
  8. clearable
  9. @keyup.enter="handleQuery"
  10. />
  11. </el-form-item>
  12. <el-form-item label="统一社会信用代码" prop="unifiedSocialCreditCode" label-width="200">
  13. <el-input
  14. v-model="queryParams.unifiedSocialCreditCode"
  15. placeholder="请输入统一社会信用代码"
  16. clearable
  17. @keyup.enter="handleQuery"
  18. />
  19. </el-form-item>
  20. <el-form-item>
  21. <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
  22. <el-button icon="Refresh" @click="resetQuery">重置</el-button>
  23. </el-form-item>
  24. </el-form>
  25. <el-row :gutter="10" class="mb8">
  26. <el-col :span="1.5">
  27. <el-popconfirm
  28. title="你确定清除所有数据?"
  29. confirm-button-text="是的"
  30. cancel-button-text="不是"
  31. :icon="InfoFilled"
  32. icon-color="#626AEF"
  33. @confirm="handleDelete"
  34. >
  35. <template #reference>
  36. <el-button
  37. type="danger"
  38. plain
  39. icon="Delete"
  40. v-hasPermi="['basicData:ggxyjl:xzjgxx:xzcfxx:fwdy:remove']"
  41. >清除全表
  42. </el-button>
  43. </template>
  44. </el-popconfirm>
  45. </el-col>
  46. <el-col :span="1.5">
  47. <el-button
  48. type="danger"
  49. plain
  50. icon="Delete"
  51. @click="batchDelete"
  52. v-hasPermi="['basicData:ggxyjl:xzjgxx:xzcfxx:fwdy:remove']"
  53. :disabled="ids.length === 0"
  54. >批量删除
  55. </el-button>
  56. </el-col>
  57. <el-col :span="1.5">
  58. <el-button
  59. type="warning"
  60. plain
  61. icon="Download"
  62. @click="handleExport"
  63. :disabled="!mortgageList.length"
  64. v-hasPermi="['basicData:ggxyjl:xzjgxx:xzcfxx:fwdy:export']"
  65. >导出
  66. </el-button>
  67. </el-col>
  68. <el-col :span="1.5">
  69. <el-button type="info" plain icon="Upload" @click="handleImport"
  70. v-hasPermi="['basicData:ggxyjl:xzjgxx:xzcfxx:fwdy:import']">导入
  71. </el-button>
  72. </el-col>
  73. <el-col :span="1.5">
  74. <el-button type="success" plain icon="Download" @click="downloadTemplate" v-hasPermi="['basicData:ggxyjl:xzjgxx:xzcfxx:fwdy:download']">
  75. 下载导入模版
  76. </el-button>
  77. </el-col>
  78. </el-row>
  79. <el-table v-loading="loading" :data="mortgageList" height="650" @selection-change="handleSelectionChange">
  80. <el-table-column type="selection" width="55" align="center"/>
  81. <el-table-column label="企业名称" align="center" prop="enterpriseName" :show-overflow-tooltip='true'/>
  82. <el-table-column label="统一社会信用代码" align="center" prop="unifiedSocialCreditCode" width="200"/>
  83. <el-table-column label="房间号" align="center" prop="roomNumber" :show-overflow-tooltip='true'/>
  84. <el-table-column label="不动产单元号" align="center" prop="propertyUnitNumber" :show-overflow-tooltip='true'/>
  85. <el-table-column label="权证号码" align="center" prop="certificateNumber" :show-overflow-tooltip='true'/>
  86. <el-table-column label="抵押权人" align="center" prop="mortgagee" :show-overflow-tooltip='true'/>
  87. <el-table-column label="抵押面积" align="center" prop="mortgageArea" :show-overflow-tooltip='true'/>
  88. <el-table-column label="债权数额" align="center" prop="debtAmount" :show-overflow-tooltip='true'/>
  89. <el-table-column label="登记证明号" align="center" prop="registrationCertificateNumber" :show-overflow-tooltip='true'/>
  90. <el-table-column label="抵押方式" align="center" prop="mortgageType" :show-overflow-tooltip='true'/>
  91. <el-table-column label="抵押权人证件号码" align="center" prop="mortgageeIdNumber" :show-overflow-tooltip='true'/>
  92. <el-table-column label="是否注销" align="center" prop="isCancelled" :show-overflow-tooltip='true'/>
  93. </el-table>
  94. <div style="position: fixed;bottom: 20px;right: 10px;">
  95. <pagination
  96. v-show="total>0"
  97. :total="total"
  98. v-model:page="queryParams.pageNum"
  99. v-model:limit="queryParams.pageSize"
  100. @pagination="getList"
  101. />
  102. </div>
  103. <el-dialog :title="upload.title" v-model="upload.open" width="400px" append-to-body>
  104. <el-upload ref="uploadRef" :limit="1" accept=".xlsx, .xls" :headers="upload.headers"
  105. :action="upload.url + '?updateSupport=' + upload.updateSupport" :disabled="upload.isUploading"
  106. :on-progress="handleFileUploadProgress" :on-success="handleFileSuccess" :auto-upload="false" drag>
  107. <el-icon class="el-icon--upload">
  108. <upload-filled/>
  109. </el-icon>
  110. <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
  111. <template #tip>
  112. <div class="el-upload__tip text-center">
  113. <span>仅允许导入xls、xlsx格式文件。</span>
  114. </div>
  115. </template>
  116. </el-upload>
  117. <template #footer>
  118. <div class="dialog-footer">
  119. <el-button type="primary" @click="submitFileForm">确 定</el-button>
  120. <el-button @click="upload.open = false">取 消</el-button>
  121. </div>
  122. </template>
  123. </el-dialog>
  124. <!-- 添加或修改房屋抵押信息对话框 -->
  125. </div>
  126. </template>
  127. <script setup name="Mortgage">
  128. import {
  129. listMortgage,
  130. getMortgage,
  131. delMortgage,
  132. delMortgageBatch
  133. } from "@/api/basicData/mortgage2";
  134. import {reactive, ref, toRaw} from "vue";
  135. import {getToken} from "@/utils/auth";
  136. import {ElMessage} from "element-plus";
  137. import {likeQueryMethod} from "@/utils/likeQueryMethod";
  138. const {proxy} = getCurrentInstance();
  139. const mortgageList = ref([]);
  140. const open = ref(false);
  141. const loading = ref(true);
  142. const showSearch = ref(true);
  143. const ids = ref([]);
  144. const single = ref(true);
  145. const multiple = ref(true);
  146. const total = ref(0);
  147. const title = ref("");
  148. const upload = reactive({
  149. // 是否显示弹出层(用户导入)
  150. open: false,
  151. // 弹出层标题(用户导入)
  152. title: '',
  153. // 是否禁用上传
  154. isUploading: false,
  155. // 设置上传的请求头部
  156. headers: {Authorization: getToken()},
  157. // 上传的地址
  158. url: import.meta.env.VITE_APP_BASE_API + '/crmHouseMortgage/importData'
  159. })
  160. const handleFileSuccess = (e) => {
  161. if (e.code == 200) {
  162. ElMessage({
  163. type: "success",
  164. message: e.msg
  165. })
  166. getList()
  167. proxy.$refs['uploadRef']?.clearFiles()
  168. } else {
  169. ElMessage({
  170. type: "error",
  171. message: e.msg
  172. })
  173. proxy.$refs['uploadRef']?.clearFiles()
  174. }
  175. }
  176. function submitFileForm() {
  177. proxy.$refs['uploadRef']?.submit();
  178. upload.open = false;
  179. }
  180. function handleImport() {
  181. upload.open = true
  182. }
  183. const data = reactive({
  184. form: {},
  185. queryParams: {
  186. pageNum: 1,
  187. pageSize: 20,
  188. enterpriseName: null,
  189. unifiedSocialCreditCode: '',
  190. roomNumber: null,
  191. propertyUnitNumber: null,
  192. certificateNumber: null,
  193. mortgagee: null,
  194. mortgageArea: null,
  195. debtAmount: null,
  196. registrationCertificateNumber: null,
  197. mortgageType: null,
  198. mortgageeIdNumber: null,
  199. isCancelled: null
  200. },
  201. rules: {
  202. }
  203. });
  204. const {queryParams, form, rules} = toRefs(data);
  205. /** 查询房屋抵押信息列表 */
  206. function getList() {
  207. loading.value = true;
  208. let toServerObj = likeQueryMethod('unified_social_credit_code', queryParams.value.unifiedSocialCreditCode, queryParams.value.pageNum, queryParams.value.pageSize,'enterprise_name',queryParams.value.enterpriseName);
  209. listMortgage(toServerObj).then(response => {
  210. mortgageList.value = response.records;
  211. total.value = response.total;
  212. loading.value = false;
  213. });
  214. }
  215. // 表单重置
  216. function reset() {
  217. form.value = {
  218. id: null,
  219. enterpriseName: null,
  220. unifiedSocialCreditCode: '',
  221. roomNumber: null,
  222. propertyUnitNumber: null,
  223. certificateNumber: null,
  224. mortgagee: null,
  225. mortgageArea: null,
  226. debtAmount: null,
  227. registrationCertificateNumber: null,
  228. mortgageType: null,
  229. mortgageeIdNumber: null,
  230. isCancelled: null
  231. };
  232. proxy.resetForm("mortgageRef");
  233. }
  234. /** 搜索按钮操作 */
  235. function handleQuery() {
  236. queryParams.value.pageNum = 1;
  237. getList();
  238. }
  239. /** 重置按钮操作 */
  240. function resetQuery() {
  241. proxy.resetForm("queryRef");
  242. handleQuery();
  243. }
  244. // 多选框选中数据
  245. function handleSelectionChange(selection) {
  246. ids.value = selection.map(item => item.id);
  247. single.value = selection.length != 1;
  248. multiple.value = !selection.length;
  249. }
  250. /** 删除按钮操作 */
  251. async function handleDelete(row) {
  252. const res = await delMortgage();
  253. if(res.code == 200){
  254. ElMessage({
  255. type:'success',
  256. message:'删除成功'
  257. })
  258. getList();
  259. }
  260. }
  261. /** 批量删除*/
  262. const batchDelete = (row)=>{
  263. const idsToS = row.id || ids.value;
  264. (proxy.$modal).confirm('是否确认删除这' + idsToS.length+'条的数据项?').then(function() {
  265. return delMortgageBatch(toRaw(idsToS));
  266. }).then(() => {
  267. getList();
  268. proxy.$modal.msgSuccess("删除成功");
  269. }).catch(() => {});
  270. }
  271. /** 导出按钮操作 */
  272. function handleExport() {
  273. proxy.download('crmHouseMortgage/exportData', {
  274. ...queryParams.value
  275. }, `房屋抵押信息_${new Date().getTime()}.xlsx`)
  276. }
  277. const downloadTemplate = ()=>{
  278. proxy.download('crmHouseMortgage/getUploadTemplate',{}, `房屋抵押信息模板.xlsx`)
  279. }
  280. getList();
  281. </script>