您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971
  1. <template>
  2. <div>
  3. <crud-template ref="crudRef" class="as-weight" :submit-state="false" :home-data="field" :tableData="tableData"
  4. @btnSearch="btnSearch" @CurrentChange="handleCurrentChange" @importData="importData" @refreshLeft="refreshLeft"
  5. @add="handleAdd" @cancel="cancel" @download="downloadHandle">
  6. <template #search>
  7. <el-input maxlength="60" v-trim clearable v-model="searchForm.name" style="width: 200px"
  8. placeholder="请输入网点名称" />
  9. <el-input maxlength="60" v-trim clearable v-model="searchForm.serviceHallId" style="width: 200px"
  10. placeholder="请输入网点编号" />
  11. <el-input maxlength="60" v-trim clearable v-model="searchForm.agencyId" style="width: 200px"
  12. placeholder="请输入渠道编号" />
  13. </template>
  14. <template #searchCustomButton>
  15. <el-upload style="display: inline-block; margin: 0 10px" v-if="IsPermission(route, 'BRANCH_IMPORT')"
  16. ref="upload" :data="data" :action="BaseService.getFileUploadUrl()" @success="onSuccess($event)" accept=".xlsx" :limit="1"
  17. :on-exceed="handleExceed" :show-file-list="false" :multiple="false">
  18. <el-button type="primary" class="btn" icon="Upload">导入网点</el-button>
  19. </el-upload>
  20. <el-button type="warning" v-if="IsPermission(route, 'BRANCH_TMP')" icon="Download" @click="handleFileName(1)" class="btn">网点模板下载</el-button>
  21. <el-button type="warning" v-if="IsPermission(route, 'BLD_TMP')" icon="Download" @click="handleFileName(2)">办理点模板下载</el-button>
  22. </template>
  23. <template #CustomButton>
  24. <el-button v-if="IsPermission(route, 'AGENCY_MANAGE')" type="success" @click="getItmeLiet()">
  25. 报备部中心网点管理
  26. </el-button>
  27. <!-- <el-button type="primary" @click="getItmeLiet()">-->
  28. <!-- 导入网点-->
  29. <!-- </el-button>-->
  30. <!-- <el-button type="warning" @click="getItmeLiet()">-->
  31. <!-- 网点模板下载-->
  32. <!-- </el-button>-->
  33. </template>
  34. <template #operation="{ scope }">
  35. <el-button v-if="IsPermission(route, 'EDIT_LIST')" type="primary" @click="handleEdit(scope.row)" size="small">
  36. 编辑
  37. </el-button>
  38. <!-- <el-button v-if="IsPermission(route, 'EDIT_LIST')" type="primary" @click="handleImport(scope.row)" size="small">
  39. 导入
  40. </el-button> -->
  41. <el-upload style="display: inline-block; margin: 0 10px;vertical-align: middle;" ref="upload" :data="data" v-if="IsPermission(route, 'BLD_IMPORT')"
  42. :action="BaseService.getFileUploadUrl()" :on-success="handleAvatarSuccess" accept=".xls, .xlsx" :limit="1"
  43. :on-exceed="handleExceed" :show-file-list="false" :multiple="false">
  44. <el-button type="primary" class="btn" icon="Upload" @click="handleImport(scope.row)" size="small">
  45. 导入办理点
  46. </el-button>
  47. </el-upload>
  48. <!-- <el-button v-if="IsPermission(route, 'EDIT_LIST')" type="primary" @click="handleFileName()" size="small">-->
  49. <!-- 下载模板-->
  50. <!-- </el-button>-->
  51. <el-button v-if="IsPermission(route, 'STAET_LIST')" :type="scope.row.state === 'ENABLE' ? 'danger' : 'success'"
  52. @click="handleDetele(scope.row)" size="small">
  53. {{ scope.row.state === 'ENABLE' ? '禁用' : '启用' }}
  54. </el-button>
  55. </template>
  56. <template #dialog>
  57. <el-form label-position="right" label-width="150px" :model="addForm" :rules="rules"
  58. :ref="(el) => (dataFormRef = el)" :hide-required-asterisk="typeOption === 'view'"
  59. v-loading="formLoding">
  60. <el-row>
  61. <el-col :span="12">
  62. <el-form-item label="所属渠道:" prop="agencyId">
  63. <el-select clearable filterable v-model="addForm.agencyId" style="width: 100%"
  64. @change="agencyIdChange" :disabled="typeOption === 'edit'"
  65. placeholder="请选择所属渠道">
  66. <el-option v-for="item in agencyList" :key="item.value" :label="item.label" :value="item.value"/>
  67. </el-select>
  68. </el-form-item>
  69. </el-col>
  70. <el-col :span="12">
  71. <el-form-item label="渠道编号:" prop="agencyId">
  72. <el-select clearable filterable v-model="addForm.agencyId" style="width: 100%" placeholder="请选择所属渠道"
  73. :disabled="true">
  74. <el-option v-for="item in agencyList" :key="item.value" :label="item.value" :value="item.value"/>
  75. </el-select>
  76. </el-form-item>
  77. </el-col>
  78. <el-col :span="12" v-if="!isFirstDot">
  79. <el-form-item v-if="!isFirstDot" label="上级网点:" prop="superServiceHallId">
  80. <el-tree-select :load="load" lazy filterable style="width: 100%" placeholder="请选择上级网点编号"
  81. v-model="addForm.superServiceHallId" :props="{
  82. label: 'servicehallName',
  83. children: 'childrens',
  84. value: 'servicehallId',
  85. isLeaf: 'isLeaf',
  86. }" value-key="servicehallId" :check-strictly="true" :render-after-expand="false"
  87. node-key="servicehallId" show-checkbox/>
  88. </el-form-item>
  89. </el-col>
  90. <el-col :span="12">
  91. <el-form-item label="网点编号:" prop="serviceHallId">
  92. <el-input maxlength="60" v-trim clearable v-model="addForm.serviceHallId" placeholder="请输入网点编号"/>
  93. </el-form-item>
  94. </el-col>
  95. <el-col :span="12">
  96. <el-form-item label="网点名称:" prop="name">
  97. <el-input maxlength="60" v-trim clearable v-model="addForm.name" placeholder="请输入网点名称"/>
  98. </el-form-item>
  99. </el-col>
  100. <el-col :span="12">
  101. <el-form-item label="中心网点编号:" prop="mapChannelId">
  102. <el-select clearable filterable v-model="addForm.mapChannelId" style="width: 100%"
  103. @change="centerServiceHallIdChange" placeholder="请选择中心网点编号">
  104. <el-option v-for="item in centerServiceHallIdList" :key="item.centerServiceHallId"
  105. :label="item.centerServicehallName" :value="item.centerServiceHallId"/>
  106. </el-select>
  107. </el-form-item>
  108. </el-col>
  109. <el-col :span="12">
  110. <el-form-item label="地址:" prop="address">
  111. <el-input maxlength="60" v-trim clearable v-model="addForm.address" placeholder="请输入地址"/>
  112. </el-form-item>
  113. </el-col>
  114. <el-col :span="12">
  115. <el-form-item label="联系人电话:" prop="tel">
  116. <el-input maxlength="60" v-trim clearable v-model="addForm.tel" placeholder="请输入联系人电话"/>
  117. </el-form-item>
  118. </el-col>
  119. <el-col :span="12">
  120. <el-form-item label="联系人:" prop="contact">
  121. <el-input maxlength="60" v-trim clearable v-model="addForm.contact" placeholder="请输入联系人"/>
  122. </el-form-item>
  123. </el-col>
  124. <el-col :span="12">
  125. <el-form-item label="半径距离(单位:米):" prop="radial">
  126. <el-input maxlength="60" v-trim clearable v-model="addForm.radial" placeholder="请输入半径距离(单位:米)"/>
  127. </el-form-item>
  128. </el-col>
  129. <el-col :span="12">
  130. <el-form-item label="经度:" prop="longitude">
  131. <el-input maxlength="60" v-trim clearable v-model="addForm.longitude" placeholder="请输入经度"/>
  132. </el-form-item>
  133. </el-col>
  134. <el-col :span="12">
  135. <el-form-item label="纬度:" prop="latitude">
  136. <el-input maxlength="60" v-trim clearable v-model="addForm.latitude" placeholder="请输入纬度"/>
  137. </el-form-item>
  138. </el-col>
  139. </el-row>
  140. </el-form>
  141. <div style="text-align: left">
  142. <div class="as-bold">办理点信息</div>
  143. <el-button type="success" icon="Plus" @click="addBtn" style="margin-bottom: 10px;">添加办理点信息</el-button>
  144. <div style="padding: 10px 50px;text-align: left;font-weight: 700;" v-if="addForm.locationModels.length > 0"></div>
  145. <el-form style="width: 45%;display: inline-block;margin: 0 0 30px 20px" v-for="(item, index) in addForm.locationModels" :key="index" label-width="150" :rules="rules" :model="item">
  146. <el-form-item label="名称:" prop="name">
  147. <el-input maxlength="60" v-trim clearable v-model="item.name" placeholder="请输入办理点名称"/>
  148. </el-form-item>
  149. <el-form-item label="地址:" prop="address">
  150. <el-input maxlength="60" v-trim clearable v-model="item.address" placeholder="请输入地址"/>
  151. </el-form-item>
  152. <el-form-item label="经度:" prop="longitude">
  153. <el-input maxlength="60" v-trim clearable v-model="item.longitude" placeholder="请输入经度"/>
  154. </el-form-item>
  155. <el-form-item label="纬度:" prop="latitude">
  156. <el-input maxlength="60" v-trim clearable v-model="item.latitude" placeholder="请输入纬度"/>
  157. </el-form-item>
  158. <el-form-item label="半径距离(单位:米):" prop="radial">
  159. <el-input maxlength="60" v-trim clearable v-model="item.radial" placeholder="请输入半径距离(单位:米)"/>
  160. </el-form-item>
  161. <el-button class="op-btn" type="danger" @click="deleteHandle(index)">删除</el-button>
  162. </el-form>
  163. </div>
  164. </template>
  165. <template #footer>
  166. <el-button type="default" @click="cancel" v-if="typeOption !== 'view'">取消</el-button>
  167. <el-button type="primary" @click="submitHandle()" v-if="typeOption !== 'view'">确定</el-button>
  168. </template>
  169. </crud-template>
  170. <el-dialog title="报备部中心网点管理" v-model="vShowDoalog">
  171. <crud-template ref="crudRefTwo" :home-data="zxqdFind" @submit="itemAdd" @handleEdit="itemEdit" @add="Adds"
  172. :searchForm="searchForm2" @btnSearch="btnSearch2" @CurrentChange="handleCurrentChangeTwo" @handleDelete="itemDelete"
  173. :tableData="tableItemData" @refreshLeft="refreshLeft2">
  174. <template #search>
  175. <el-input maxlength="60" v-trim clearable v-model="searchForm2.id" style="width: 200px"
  176. placeholder="请输入中心网点编号" />
  177. <el-input maxlength="60" v-trim clearable v-model="searchForm2.name" style="width: 200px"
  178. placeholder="请输入中心网点名称" />
  179. </template>
  180. </crud-template>
  181. </el-dialog>
  182. </div>
  183. </template>
  184. <script setup lang="ts">
  185. import { ref, reactive, toRaw, onMounted, computed } from 'vue'
  186. // @ts-ignore crudFrom模板
  187. import CrudTemplate from '@/crud/index.vue'
  188. import BaseService from '@/utils/baseService' //引入接口请求
  189. import {
  190. ElMessage, ElMessageBox, UploadInstance, UploadProps,
  191. UploadRawFile,
  192. genFileId,
  193. } from 'element-plus' //提示
  194. import { getCache } from '@/utils/cache'
  195. import { IObject } from '@/types/interface'
  196. import { useDebounce } from '@/utils/utils'
  197. import { useRoute } from 'vue-router'
  198. import { IsPermission } from '@/router/routerUtil'
  199. import { getZxqdFindConfig } from "./data.js";
  200. import {exportFn} from "@/views/settlement/exportFn";
  201. const crudRef = ref()
  202. const agencyIdC = ref()
  203. const dataFormRef = ref()
  204. const url = ref()
  205. const serviceHallId = ref()
  206. const data = { bucket: '' }
  207. const parentSelectList = ref([] as IObject[])
  208. const upload = ref<UploadInstance>()
  209. //或取路由传入过来的对象数据
  210. const route = useRoute()
  211. const zxqdFind = ref(getZxqdFindConfig(route));;
  212. const vShowDoalog = ref(false);
  213. const crudRefTwo = ref();
  214. const searchForm2 = ref({});
  215. const tableItemData = ref([]);
  216. let orderStep = ref('')
  217. const itemStartValue = ref("1")
  218. //查询参数
  219. const searchForm = ref({
  220. name: '', //网点名称
  221. serviceHallId: '', //网点编号
  222. agencyId: '', //渠道编号
  223. agencyName: '', //机构
  224. orderSource: 'WEB',
  225. })
  226. let tableData: any = ref([])
  227. const initItem = {
  228. name: '',
  229. superServiceHallId: '',
  230. serviceHallId: '',
  231. address: '',
  232. contact: '',
  233. mapChannelId: '',
  234. tel: '',
  235. orderSource: 'WEB',
  236. agencyId: '',
  237. locationModels: [
  238. ]
  239. }
  240. const addForm: any = ref(initItem)
  241. const formLoding = ref(false)
  242. const rules = reactive({
  243. // superServiceHallId: [{ required: true, message: '请输入', trigger: 'blur' }],
  244. serviceHallId: [{ required: true, message: '请输入', trigger: 'blur' }],
  245. name: [{ required: true, message: '请输入', trigger: 'blur' }],
  246. address: [{ required: true, message: '请输入', trigger: 'blur' }],
  247. tel: [{ required: true, message: '请输入', trigger: 'blur' }],
  248. contact: [{ required: true, message: '请输入', trigger: 'blur' }],
  249. longitude: [{ required: false, message: '请输入', trigger: 'blur' }],
  250. latitude: [{ required: false, message: '请输入', trigger: 'blur' }],
  251. radial: [{ required: false, message: '请输入', trigger: 'blur' }],
  252. agencyId: [{ required: true, message: '请选择', trigger: 'blur' }],
  253. mapChannelId: [{ required: true, message: '请输入', trigger: 'blur' }],
  254. })
  255. const typeOption = ref('')
  256. const agencyId = computed(() => {
  257. let cacheAccessToken = getCache(
  258. 'cacheAccessToken',
  259. { isSessionStorage: false },
  260. {}
  261. )
  262. return cacheAccessToken['agencyId']
  263. })
  264. onMounted(() => {
  265. getList()
  266. getAgencyList()
  267. })
  268. //新增
  269. const itemAdd = (data: any) => {
  270. request(data, itemStartValue.value)
  271. }
  272. const Adds = () => {
  273. // console.log(zxqdFind.value.field[0].form);
  274. zxqdFind.value.field[0].form.hideEdit = false;
  275. itemStartValue.value = 1
  276. }
  277. //表单编辑按钮
  278. function itemEdit(idx: any, row: any) {
  279. // console.log("我是编辑事件", idx, row);
  280. // request(row, 2)
  281. zxqdFind.value.field[0].form.hideEdit = true;
  282. itemStartValue.value = 2
  283. }
  284. //表单删除按钮
  285. function itemDelete(idx: any, row: any) {
  286. // console.log("删除事件", idx, row);
  287. BaseService.postN('/userw/centerServiceHall/delete', row).then((res: any) => {
  288. if (res && res.code === 0) {
  289. getItmeLiet()
  290. crudRefTwo.value.reset();
  291. crudRefTwo.value.dialogFormVisible = false;
  292. } else {
  293. ElMessage.error(res.message)
  294. }
  295. })
  296. }
  297. const request = (data: any, type: any) => {
  298. data.optType = type //操作类型 1新增 2修改
  299. BaseService.postN('/userw/centerServiceHall/addOrUpDate', data).then((res: any) => {
  300. if (res && res.code === 0) {
  301. getItmeLiet()
  302. ElMessage.success('操作成功')
  303. crudRefTwo.value.reset();
  304. crudRefTwo.value.dialogFormVisible = false;
  305. }
  306. }).catch((error) => {
  307. crudRefTwo.value.dialogFormVisible = false;
  308. })
  309. }
  310. function handleCurrentChangeTwo(val: number) {
  311. // console.log(val + '===');
  312. zxqdFind.value.paging.currentPage = val;
  313. getItmeLiet();
  314. }
  315. const getItmeLiet = () => {
  316. vShowDoalog.value = true
  317. if (crudRefTwo.value) {
  318. crudRefTwo.value.tableLoding = true;
  319. }
  320. let params: any = {
  321. methods: "page",
  322. pageNo: zxqdFind.value.paging.currentPage,
  323. pageSize: zxqdFind.value.paging.pageSize,
  324. }
  325. // console.log(searchForm2.value + '---------0');
  326. let searchFormList = { ...searchForm2.value }
  327. for (let key in searchFormList) {
  328. if (searchFormList[key]) {
  329. params[key] = searchFormList[key]
  330. }
  331. }
  332. BaseService.postN('/userw/centerServiceHall/page', params).then((res: any) => {
  333. // console.log(res, 'res')
  334. if (res && res.code === 0) {
  335. let bizContent = res.data
  336. let data = bizContent.result || [];
  337. data.forEach((item) => {
  338. if (item.models) item.models.forEach((i) => {
  339. if (i.agreementAnnex) i.fileList = [{ name: i.agreementAnnex }]
  340. })
  341. })
  342. // console.log("bizContent12222", data)
  343. tableItemData.value = data;
  344. crudRefTwo.value.tableLoding = false;
  345. zxqdFind.value.paging.total = bizContent.totalCount;
  346. } else {
  347. crudRefTwo.value.tableLoding = false;
  348. ElMessage.error(res.message)
  349. }
  350. })
  351. }
  352. // 添加
  353. const addBtn = () => {
  354. addForm.value.locationModels.push({
  355. address: '',
  356. latitude: '',
  357. longitude: '',
  358. name: '',
  359. radial: '',
  360. })
  361. }
  362. // 删除
  363. const deleteHandle = (index) => {
  364. addForm.value.locationModels.splice(index, 1)
  365. }
  366. // 搜索按钮
  367. function btnSearch() {
  368. field.value.paging.currentPage = 1
  369. getList()
  370. }
  371. // 搜索按钮
  372. function btnSearch2() {
  373. zxqdFind.value.paging.currentPage = 1
  374. getItmeLiet()
  375. }
  376. //标签分页
  377. function handleClick(tab, event) {
  378. orderStep.value = tab.props.name
  379. getItmeLiet();
  380. }
  381. //分页
  382. function handleCurrentChange(val: number) {
  383. field.value.paging.currentPage = val
  384. getList()
  385. }
  386. function handleAvatarSuccess(response: any, row) {
  387. // console.log(22222222222);
  388. // console.log(response, row, 22222222222);
  389. const { ossFilePath, originalFileName } = response.data
  390. url.value = ossFilePath
  391. // console.log(url.value, originalFileName)
  392. BaseService.postN('/userw/serviceHall/registerLocationBath', { excelFileUrl: url.value, serviceHallId: serviceHallId.value }).then((res: any) => {
  393. if (res && res.code === 0) {
  394. // console.log(res)
  395. const errUrl = res.data?.path ?? ''
  396. if (errUrl) {
  397. ElMessage.error("导入失败,请查看下载到本地文件的具体错误信息");
  398. BaseService.getDownload(
  399. import.meta.env.VITE_APP_EXPORT_URL_NEW + errUrl,
  400. '错误信息文件'
  401. )
  402. } else {
  403. ElMessage.success("导入成功");
  404. url.value = ''
  405. }
  406. }
  407. })
  408. }
  409. const handleExceed: UploadProps['onExceed'] = (files) => {
  410. upload.value!.clearFiles()
  411. const file = files[0] as UploadRawFile
  412. file.uid = genFileId()
  413. upload.value!.handleStart(file)
  414. upload.value!.submit()
  415. }
  416. // 搜索重置
  417. function refreshLeft() {
  418. searchForm.value = {
  419. name: '', //网点名称
  420. serviceHallId: '', //网点编号
  421. agencyId: '', //渠道编号
  422. agencyName: '', //机构
  423. orderSource: 'WEB',
  424. }
  425. field.value.paging.currentPage = 1
  426. getList()
  427. }
  428. // 搜索重置
  429. function refreshLeft2() {
  430. searchForm2.value = {
  431. name: '', //网点名称
  432. id:'',
  433. }
  434. zxqdFind.value.paging.currentPage = 1
  435. getItmeLiet()
  436. }
  437. // 导出
  438. function downloadHandle() {
  439. exportFn('/userw/serviceHall/serviceHallExport', searchForm.value, '网点导出')
  440. }
  441. //获取列表
  442. function getList() {
  443. crudRef.value.tableLoding = true
  444. let params: any = {
  445. pageNo: field.value.paging.currentPage,
  446. pageSize: field.value.paging.pageSize,
  447. }
  448. //赋值查询参数
  449. let searchFormList = { ...searchForm.value }
  450. for (let key in searchFormList) {
  451. if (searchFormList[key]) {
  452. params[key] = searchFormList[key]
  453. }
  454. }
  455. BaseService.postN('/userw/serviceHall/serviceHallSelect', params).then((res: any) => {
  456. if (res && res.code === 0) {
  457. //数据转换
  458. let bizContent = res.data
  459. let data = bizContent.result || []
  460. //数据渲染
  461. tableData.value = data
  462. crudRef.value.tableLoding = false
  463. //分页总数
  464. field.value.paging.total = bizContent.totalCount
  465. } else {
  466. crudRef.value.tableLoding = false
  467. ElMessage.error(res.message)
  468. }
  469. })
  470. }
  471. let formLabelWidth = '130px'
  472. let contentWidth = '100%'
  473. //表单数据配置
  474. let field = ref({
  475. tabSize: 'small', //Table 的尺寸 large / default /small (默认default)
  476. searchShow: IsPermission(route, 'QUERY_BASE'), //是否显示搜索模块(默认false)
  477. border: true, //是否添加边框(默认false)
  478. dialogCustom: true, //自定义Dialog (默认false)
  479. dialogFooter: true, //隐藏弹窗页脚显示 (默认false)
  480. dialogWidth: '60%', //dialog宽度 (默认40%)
  481. crudShow: true, //是否显示CURD操作栏 (默认true)
  482. crudChildShow: true, //是否显示CURD子操作栏 (默认true)
  483. paginStart: true, //是否显示分页查询 (默认false)
  484. titleDialog: '', //table 标题
  485. dataListLoading: false,
  486. operateTitle: '操作', //操作栏标题(默认为"")
  487. operateWidth: "300px", //操作栏宽度
  488. operateFixed: true, //操作栏是否固定(默认false)
  489. crud: {
  490. add: IsPermission(route, 'ADD_BASE'),
  491. },
  492. operate: {
  493. edit: false, //是否编辑(默认true)
  494. delete: false, //是否删除(默认true)
  495. remark: false, // 详情
  496. announcement: false, // 公告
  497. forbidden: false, // 禁用
  498. enable: false, // 启用
  499. authorization: false, // 授权
  500. cancel: false, // 取消订单
  501. },
  502. searchOperation: {
  503. isDownload: IsPermission(route, 'DERIVE_BASE'),
  504. isAdd: false,
  505. isTransferMachine: false,
  506. isToLead: false, // 导入
  507. isTemplate: false,
  508. templateUrl:
  509. import.meta.env.VITE_APP_EXPORT_URL_NEW +
  510. 'zhywpt-issuer/template/userw/网点信息导入模板.xlsx',
  511. templateFileName: '网点信息导入模板',
  512. },
  513. tableSize: -1,
  514. paging: {
  515. pageSize: 10,
  516. currentPage: 1,
  517. total: 0,
  518. },
  519. extend: [
  520. {
  521. label: '序号',
  522. type: 'index',
  523. width: '50px',
  524. },
  525. ],
  526. field: [
  527. {
  528. prop: 'agencyId',
  529. label: '渠道编号',
  530. width: '100px',
  531. },
  532. {
  533. prop: 'agencyName',
  534. label: '渠道名称',
  535. width: '150px',
  536. },
  537. {
  538. prop: 'superServiceHallId',
  539. label: '上级网点编号',
  540. width: '160px',
  541. },
  542. {
  543. prop: 'superServiceHallName',
  544. label: '上级网点名称',
  545. width: '160px',
  546. }, {
  547. prop: 'mapChannelId', //centerServiceHallId
  548. label: '中心网点编号',
  549. width: '160px',
  550. },
  551. {
  552. prop: 'serviceHallId',
  553. label: '网点编号',
  554. width: '160px',
  555. },
  556. {
  557. prop: 'name',
  558. label: '网点名称',
  559. width: '150px',
  560. },
  561. {
  562. prop: 'address',
  563. label: '网点地址',
  564. width: '150px',
  565. },
  566. {
  567. prop: 'tel',
  568. label: '联系人电话',
  569. width: '100px',
  570. },
  571. {
  572. prop: 'contact',
  573. label: '联系人',
  574. width: '100px',
  575. },
  576. {
  577. prop: 'createName',
  578. label: '创建人',
  579. width: '100px',
  580. },
  581. {
  582. prop: 'updateName',
  583. label: '修改人',
  584. width: '100px',
  585. },
  586. ],
  587. })
  588. const isFirstDot = ref(false)
  589. function getServiceHallId(e) {
  590. //获取网点编号
  591. BaseService.postN('/userw/serviceHall/getServiceHallId', {
  592. agencyId: e,
  593. }).then((res: any) => {
  594. // console.log(res, 'resresres');
  595. addForm.value.serviceHallId = res.data
  596. // load({isLeaf: false,key: res.data},()=>{})
  597. })
  598. }
  599. function getCenterServiceHall() {
  600. //获取中心网点编号信息 /userw/centerServiceHall/getCenterServiceHall
  601. BaseService.postN('/userw/centerServiceHall/getCenterServiceHall', {
  602. }).then((res: any) => {
  603. // console.log(res, 'resresres');
  604. centerServiceHallIdList.value = res.data
  605. })
  606. }
  607. //添加中心网点编号
  608. const centerServiceHallIdChange = (value) => {
  609. // console.log(value, 'eeee');
  610. addForm.value.mapChannelId = value
  611. // getServiceHallId(value)
  612. }
  613. function handleFirstDot() {
  614. //获取网点编号
  615. getCenterServiceHall()
  616. getServiceHallId(agencyId.value)
  617. isFirstDot.value = true
  618. crudRef.value.dialogFormVisible = true
  619. addForm.value.agencyId = agencyId.value
  620. }
  621. //添加一级网点切换所属渠道
  622. const agencyIdChange = (value) => {
  623. if (value === '' || value === null || value === undefined) {
  624. ElMessage.error("渠道不能为空!")
  625. return;
  626. }
  627. agencyIdC.value = value
  628. addForm.value.agencyId = value
  629. getServiceHallId(value)
  630. }
  631. const agencyList = ref<any>([])
  632. const centerServiceHallIdList = ref<any>([])
  633. // 获取所有渠道
  634. function getAgencyList() {
  635. BaseService.postN('/userw/agency/agencyqueryall').then((res: any) => {
  636. if (res && res.code === 0) {
  637. let bizContent = res.data
  638. // console.log(bizContent, '------');
  639. let data = bizContent || []
  640. let list = [] as IObject[]
  641. data.map((item) => {
  642. list.push({
  643. label: item.name,
  644. value: item.agencyId,
  645. })
  646. })
  647. agencyList.value = list
  648. } else {
  649. ElMessage.error(res.message)
  650. }
  651. })
  652. }
  653. function onSuccess(response: any) {
  654. importData(response.data.ossFilePath)
  655. }
  656. function importData(url) {
  657. //判断url是否以/开头,剔除/
  658. url = url.startsWith('/') ? url.substring(1) : url
  659. // importFn('a8f9dac698cb4793bb15f26fd608d2b3', getList(), { excelFileUrl: url })
  660. BaseService.postN('/userw/serviceHall/registerFullBath', { excelFileUrl: url }).then((res: any) => {
  661. if (res && res.code === 0) {
  662. // console.log(res)
  663. const errUrl = res.data?.path ?? ''
  664. if (errUrl) {
  665. ElMessage.error("导入失败,请查看下载到本地文件的具体错误信息");
  666. BaseService.getDownload(
  667. import.meta.env.VITE_APP_EXPORT_URL_NEW + errUrl,
  668. '错误信息文件'
  669. )
  670. } else {
  671. ElMessage.success("导入成功");
  672. }
  673. // //处理导入失败问题
  674. // if (res && res.code === 0) {
  675. // let bizContent = res.data
  676. // let url = bizContent.url || "";
  677. // let fileName = bizContent.fileName ? `${bizContent.fileName}` : ''
  678. // if (url) {
  679. // //window.open(url)
  680. // //处理下载有文件名
  681. // BaseService.getDownloadFileName(import.meta.env.VITE_APP_UPLOAD_URL + url, fileName)
  682. // // btnLoding.value = false;
  683. // // clearData();
  684. // // emit("refreshDataList");
  685. // // emit("closeHandle");
  686. // ElMessage.success("导入成功");
  687. // } else {
  688. // ElMessage.error("导入失败");
  689. // }
  690. // } else {
  691. // // btnLoding.value = false;
  692. // ElMessage.error(res.message);
  693. // }
  694. }
  695. });
  696. }
  697. function submitClick() {
  698. getCenterServiceHall()
  699. dataFormRef.value.validate((valid: boolean) => {
  700. if (!valid) {
  701. return false
  702. }
  703. let api = ''
  704. let params = {
  705. ...addForm.value,
  706. }
  707. if (typeOption.value === 'edit') {
  708. api = '/userw/serviceHall/serviceHallUpdate'
  709. } else {
  710. if (isFirstDot.value === false) {
  711. api = '/userw/serviceHall/serviceHallInsert'
  712. } else {
  713. delete params.superServiceHallId
  714. api = '/userw/serviceHall/serviceHallInsertnelevel'
  715. }
  716. }
  717. // if (!isFirstDot.value) {
  718. // params.agencyId = agencyId.value
  719. // }
  720. // agencyList.value.forEach(item => {
  721. // if (item.value === params.agencyId) {
  722. // params.agencyName = item.label
  723. // }
  724. // });
  725. if (!params.superServiceHallId) {
  726. params.superServiceHallId = null
  727. }
  728. params.latitude =Number(params.latitude)
  729. params.longitude = Number(params.longitude)
  730. params.radial = Number(params.radial)
  731. if(!(params.locationModels === '' || params.locationModels === undefined || params.locationModels === null)){
  732. let locationModels = params.locationModels
  733. locationModels.forEach( item => {
  734. item.latitude = Number(item.latitude)
  735. item.longitude = Number(item.longitude)
  736. item.radial = Number(item.radial)
  737. })
  738. }
  739. BaseService.postN(api, params).then((res: any) => {
  740. if (res && res.code === 0) {
  741. ElMessage.success('操作成功')
  742. getList()
  743. cancel()
  744. } else {
  745. ElMessage.error(res.message)
  746. }
  747. })
  748. })
  749. }
  750. function removeNullValues(obj) {
  751. Object.keys(obj).forEach(key => {
  752. if (obj[key] === null) {
  753. delete obj[key];
  754. }
  755. });
  756. return obj;
  757. }
  758. const submitHandle = useDebounce(submitClick)
  759. function handleAdd() {
  760. // console.log(1111);
  761. getServiceHallId(agencyId.value)
  762. getCenterServiceHall()
  763. isFirstDot.value = false
  764. addForm.value.agencyId = agencyId.value
  765. }
  766. const load = (node, resolve) => {
  767. // formLoding.value = true
  768. if (node.isLeaf) return resolve([])
  769. let serviceHallId = node.data.servicehallId
  770. // console.log(node);
  771. if (!serviceHallId) { // 第一次获取数据
  772. let cacheAccessToken = getCache(
  773. 'cacheAccessToken',
  774. { isSessionStorage: false },
  775. {}
  776. )
  777. serviceHallId = cacheAccessToken['serviceHallId']
  778. BaseService.postN('/userw/serviceHall/serviceHallSonSelect', { serviceHallId })
  779. .then((res: any) => {
  780. if (res && res.code === 0) {
  781. let data = res.data || {}
  782. data.forEach(item => {
  783. if (item.childrens && item.childrens.length === 0) {
  784. item.isLeaf = true
  785. }
  786. })
  787. setTimeout(() => {
  788. resolve(data)
  789. }, 400)
  790. } else {
  791. ElMessage.error(res.message)
  792. }
  793. })
  794. .finally(() => {
  795. formLoding.value = false
  796. })
  797. } else {
  798. formLoding.value = false
  799. const children = node.data?.childrens ?? []
  800. children.forEach(item => {
  801. if (item.childrens && item.childrens.length === 0) {
  802. item.isLeaf = true
  803. }
  804. })
  805. setTimeout(() => {
  806. resolve(children)
  807. }, 400)
  808. }
  809. }
  810. // 树形数据处理
  811. function selectDataHandle(data: IObject[]): IObject[] {
  812. if (data === null || typeof data === 'undefined') return []
  813. let newData = [] as IObject[]
  814. data.map((item) => {
  815. let children = [] as IObject[]
  816. if (
  817. !(item.childrens === null || typeof item.childrens === 'undefined') &&
  818. item.childrens.length > 0
  819. ) {
  820. children = selectDataHandle(item.children)
  821. }
  822. newData.push({
  823. label: item.servicehallName,
  824. value: item.serviceHallId,
  825. children: children,
  826. })
  827. })
  828. return newData
  829. }
  830. //导入
  831. function handleImport(row) {
  832. serviceHallId.value = row.serviceHallId
  833. }
  834. //模板下载
  835. function handleFileName(type) {
  836. if (type === 2) {
  837. BaseService.getDownload(
  838. import.meta.env.VITE_APP_EXPORT_URL_NEW + 'zhywpt-issuer/template/userw/办理地址信息导入模板.xlsx',
  839. '办理地址信息导入模板'
  840. )
  841. }else {
  842. BaseService.getDownload(
  843. import.meta.env.VITE_APP_EXPORT_URL_NEW + 'zhywpt-issuer/template/userw/网点信息导入模板.xlsx',
  844. '网点信息导入模板'
  845. )
  846. }
  847. }
  848. //编辑
  849. function handleEdit(row: IObject) {
  850. getCenterServiceHall()
  851. // console.log('每项数据', row)
  852. let params = {
  853. orderSource: 'WEB',
  854. serviceHallId: row.serviceHallId
  855. }
  856. BaseService.postN('/userw/serviceHall/queryLocations', params).then((res: any) => {
  857. if (res && res.code === 0) {
  858. // ElMessage.success('操作成功')
  859. // getList()
  860. // cancel()
  861. addForm.value.locationModels = res.data
  862. } else {
  863. ElMessage.error(res.message)
  864. }
  865. })
  866. if (row.superServiceHallId) {
  867. isFirstDot.value = false
  868. } else {
  869. isFirstDot.value = true
  870. }
  871. const data = toRaw(row)
  872. typeOption.value = 'edit'
  873. addForm.value = {
  874. ...addForm.value,
  875. ...data,
  876. serviceHallId: row.serviceHallId,
  877. }
  878. crudRef.value.title = '编辑'
  879. crudRef.value.dialogFormVisible = true
  880. }
  881. // 删除
  882. function handleDetele(row: IObject) {
  883. if (row.superServiceHallId) {
  884. isFirstDot.value = false
  885. } else {
  886. isFirstDot.value = true
  887. }
  888. ElMessageBox.confirm('确定要操作么?', '', {
  889. confirmButtonText: '确定',
  890. cancelButtonText: '取消',
  891. type: 'error',
  892. })
  893. .then(() => {
  894. BaseService.postN('/userw/serviceHall/serviceHallDelete', {
  895. status: row.state === 'ENABLE' ? 'DISABLE' : 'ENABLE',
  896. serviceHallId: row.serviceHallId,
  897. orderSource: 'WEB',
  898. id: row.id,
  899. }).then((res: any) => {
  900. if (res && res.code === 0) {
  901. getList()
  902. ElMessage.success(row.state === 'ENABLE' ? '禁用成功' : '启用成功')
  903. } else {
  904. ElMessage.error(res.message)
  905. }
  906. })
  907. })
  908. .catch(() => {
  909. // console.log('====取消')
  910. })
  911. }
  912. // 取消
  913. function cancel() {
  914. addForm.value = JSON.parse(JSON.stringify(initItem)) //清空数据
  915. dataFormRef.value.resetFields()
  916. crudRef.value.reset()
  917. crudRef.value.dialogFormVisible = false
  918. typeOption.value = ''
  919. crudRef.value.title = ''
  920. parentSelectList.value = []
  921. }
  922. </script>
  923. <style lang="scss" scoped>
  924. .as-bold{
  925. text-align: center;
  926. font-weight: bold;
  927. line-height: 25px;
  928. border-bottom: 1px solid rgb(153, 153, 153);
  929. border-top: 1px solid rgb(153, 153, 153);
  930. margin-bottom: 10px;
  931. }
  932. </style>