index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351
  1. <template>
  2. <div class="card-search">
  3. <a-form ref="formRef" name="advanced_search" class="ant-advanced-search-form" :model="searchParams">
  4. <a-row :gutter="24">
  5. <a-col :span="6">
  6. <a-form-item label="企业名称" :label-col="{span:6}" name="companyName">
  7. <a-input v-model:value="searchParams.companyName" placeholder="" :allow-clear="true"/>
  8. </a-form-item>
  9. </a-col>
  10. <a-col :span="6">
  11. <a-form-item label="统一信用代码" :label-col="{span:6}" name="companyCode">
  12. <a-input v-model:value="searchParams.companyCode" placeholder="" :allow-clear="true"/>
  13. </a-form-item>
  14. </a-col>
  15. <a-col :span="6">
  16. <a-form-item label="企业状态" :label-col="{span:6}" name="recordStatus">
  17. <a-select
  18. ref="select"
  19. v-model:value="searchParams.recordStatus"
  20. :options="recordStatusList"
  21. :field-names="{ label: 'name', value: 'value' }"
  22. :allow-clear="true"
  23. @change="loadData"
  24. >
  25. </a-select>
  26. </a-form-item>
  27. </a-col>
  28. <a-col :span="6" style="text-align: left">
  29. <a-button type="primary" html-type="submit" @click="onSearch" >查询</a-button>
  30. <a-button
  31. style="margin: 0 8px"
  32. @click="
  33. () => {
  34. formRef.resetFields();
  35. loadData();
  36. }
  37. ">重置</a-button>
  38. <a style="font-size: 12px" @click="expand = !expand">
  39. <template v-if="expand">
  40. <UpOutlined />
  41. </template>
  42. <template v-else>
  43. <DownOutlined />
  44. </template>
  45. {{ expand ? '收缩' : '展开' }}
  46. </a>
  47. </a-col>
  48. </a-row>
  49. <a-row :gutter="24" v-show="expand">
  50. <a-col :span="6">
  51. <a-form-item label="所属县区" :label-col="{span:6}" name="regionCode">
  52. <a-select
  53. ref="select"
  54. v-model:value="searchParams.regionCode"
  55. :options="regionList"
  56. :field-names="{ label: 'name', value: 'code' }"
  57. :allow-clear="true"
  58. @change="changeCity"
  59. >
  60. </a-select>
  61. </a-form-item>
  62. </a-col>
  63. <a-col :span="6">
  64. <a-form-item label="所属街道" :label-col="{span:6}" name="streetCode">
  65. <a-select
  66. ref="select"
  67. v-model:value="searchParams.streetCode"
  68. :options="streetList"
  69. :field-names="{ label: 'name', value: 'code' }"
  70. :allow-clear="true"
  71. @change="loadData"
  72. >
  73. </a-select>
  74. </a-form-item>
  75. </a-col>
  76. <a-col :span="6">
  77. </a-col>
  78. <a-col :span="6">
  79. </a-col>
  80. </a-row>
  81. <a-row class="edit-operation">
  82. <a-col :span="24" style="text-align: right">
  83. <a-button type="primary" html-type="submit" @click='onAdd' functioncode="T01020102">新增</a-button>
  84. <BImportExcel functioncode="T01020105"
  85. :options="importOptions"
  86. @success="loadData"
  87. ></BImportExcel>
  88. <BExportExcel :title="'导出'" :filename="'企业信息'"
  89. :url="'companyService/company/export'"
  90. :params="{...exportSearchParams, isExport: true, rows:10000,companyIDList:formState.selectedRowKeys.join(',')}"></BExportExcel>
  91. </a-col>
  92. </a-row>
  93. </a-form>
  94. <div class="search-result-list">
  95. <a-table :columns="columns" :data-source="dataList" :scroll="{ x:'100%', y: 500 }" :pagination="pagination"
  96. :loading="formState.loading"
  97. @change="handleTableChange"
  98. :row-selection="{ selectedRowKeys: formState.selectedRowKeys, onChange: onSelectChange}"
  99. :row-key="record=>record.companyID"
  100. bordered>
  101. <template #bodyCell="{ column, text, record }">
  102. <template v-if="column.key === 'operation'">
  103. <div class="table-operation">
  104. <a-button type="link" size="small" @click='onDetail(record)' functioncode="T01020101">查看</a-button>
  105. <a-button type="link" size="small" @click='onEdit(record)' functioncode="T01020103">编辑</a-button>
  106. <a-button type="link" size="small" @click="onDel(record)" functioncode="T01020104">删除</a-button>
  107. </div>
  108. </template>
  109. <template v-if="column.key === 'postCount'">
  110. <div style="text-align: center;">
  111. <a-button v-if="record.postCount>0" name="postCount" type="link" size="small" @click='onShowPosition(record)' >{{ record.postCount }}</a-button>
  112. <a-button v-if="record.postCount==0" type="link" size="small" >0</a-button>
  113. </div>
  114. </template>
  115. </template>
  116. </a-table>
  117. </div>
  118. <PositionShowModal ref="modalShowRef" ></PositionShowModal>
  119. </div>
  120. </template>
  121. <script lang="ts">
  122. import {computed, createVNode, defineComponent, reactive, ref} from 'vue';
  123. import {DownOutlined, ExclamationCircleOutlined, UpOutlined} from '@ant-design/icons-vue';
  124. import type {FormInstance, TableColumnsType, TableProps} from 'ant-design-vue';
  125. import {Modal, SelectProps} from "ant-design-vue";
  126. import {del, getList} from '@/api/companyService/company';
  127. import BExportExcel from "@/components/basic/excel/exportExcel/exportExcel.vue";
  128. import BImportExcel from '@/components/basic/excel/importExcel/importExcel.vue';
  129. import {getPaginationTotalTitle} from "@/utils/common";
  130. import dayjs from "dayjs";
  131. import {useTabsViewStore} from '@/store/modules/tabsView';
  132. import {get} from "@/api/common";
  133. import type {ImportProps} from '@/components/basic/excel/importExcel/ImportProps';
  134. import PositionShowModal from './show.vue';
  135. export default defineComponent({
  136. components: {DownOutlined, UpOutlined, BExportExcel, BImportExcel, PositionShowModal},
  137. setup() {
  138. const formRef = ref<FormInstance>();
  139. const modalShowRef = ref();
  140. const searchParams = reactive({
  141. pageIndex: 1,
  142. pageSize: 20,
  143. companyName: '',
  144. companyCode: '',
  145. recordStatus: '',
  146. regionCode: '',
  147. streetCode: ''
  148. });
  149. // 导出Excel查询参数
  150. const exportSearchParams = computed(() => {
  151. let data = JSON.parse(JSON.stringify(searchParams));
  152. data.pageSize = formState.total;
  153. return data;
  154. })
  155. const formState = reactive({
  156. total: 0,
  157. selectedRowKeys: [],
  158. loading: false
  159. });
  160. const expand = ref(false);
  161. const importOptions = ref<ImportProps>({
  162. title: '导入',
  163. url: 'companyService/company/importCompany',
  164. columns: [
  165. {cnName: '统一信用代码', enName: 'companyCode', width: 140},
  166. {cnName: '企业名称', enName: 'companyName', width: 100},
  167. {cnName: '所属驿站', enName: 'SiteName', width: 100},
  168. {cnName: '企业办公地址', enName: 'companyAddress', width: 100},
  169. {cnName: '企业联系人', enName: 'userName', width: 100},
  170. {cnName: '企业联系电话', enName: 'userMobile', width: 100},
  171. {cnName: '企业状态', enName: 'recordStatusName', width: 100},
  172. {cnName: '是否缺工', enName: 'isShortageName', width: 100},
  173. {cnName: '法定代表人(负责人)', enName: 'frName', width: 140},
  174. {cnName: '营业执照有效期', enName: 'validTime', width: 100},
  175. {cnName: '企业邮箱', enName: 'companyEmail', width: 100},
  176. {cnName: '企业分类', enName: 'companyTypeStr', width: 100},
  177. {cnName: '所属县区', enName: 'regionName', width: 100},
  178. {cnName: '所属街道', enName: 'streetName', width: 100},
  179. {cnName: '企业规模', enName: 'companyModelStr', width: 100},
  180. {cnName: '用工情况(人)', enName: 'workSituation', width: 100},
  181. {cnName: '参保人数(人)', enName: 'insuredCount', width: 100},
  182. {cnName: '经营范围', enName: 'businScope', width: 100},
  183. {cnName: '企业简介', enName: 'companyDesc', width: 100}
  184. ],
  185. template: {
  186. tempFileName: '企业信息导入模板.xlsx',
  187. url: '',
  188. params: null,
  189. },
  190. });
  191. const columns: TableColumnsType = [
  192. {
  193. title: '序号',
  194. align: "center",
  195. key: 'companyID',
  196. width:60,
  197. customRender: item => `${searchParams.pageSize * (searchParams.pageIndex - 1) + item.index + 1}`
  198. },
  199. {title: '企业名称', dataIndex: 'companyName', key: 'companyName',width: 200, align: "center"},
  200. {title: '所属县区', dataIndex: 'regionName', key: 'regionName', width: 120, align: "center"},
  201. {title: '所属街道', dataIndex: 'streetName', key: 'streetName', width: 120,align: "center"},
  202. {title: '所属驿站', dataIndex: 'siteName', key: 'siteName', width: 200, align: "center"},
  203. {title: '统一信用代码', dataIndex: 'companyCode', key: 'companyCode', width: 200,align: "center"},
  204. {
  205. title: '企业状态', dataIndex: 'recordStatus', key: 'recordStatus',width: 120, align: "center", customRender: (item) => {
  206. return item.record.recordStatus == 1 ? "在营" : "关闭";
  207. }
  208. },
  209. {title: '参保人数', dataIndex: 'insuredCount', key: 'insuredCount', width: 100,align: "center"},
  210. {title: '企业规模', dataIndex: 'companyModelType', key: 'companyModelType',width: 120, align: "center"},
  211. {title: '当前岗位数量', dataIndex: 'postCount', key: 'postCount', width: 120,align: "center"},
  212. {title: '录入人', dataIndex: 'createUserName', key: 'createUserName', width: 120,align: "center"},
  213. {
  214. title: '录入时间 ', dataIndex: 'createTime', key: 'createTime',width: 120, align: "center", customRender: (item) => {
  215. return item.record.createTime == null ? "" : (dayjs(item.record.createTime).format('YYYY-MM-DD'))
  216. }
  217. },
  218. {title: '操作', key: 'operation', fixed: 'right', width: 150, align: "center"},
  219. ];
  220. const pagination = computed(() => ({
  221. total: formState.total,
  222. current: searchParams.pageIndex,
  223. pageSize: searchParams.pageSize,
  224. showSizeChanger: true,
  225. showTotal: total => getPaginationTotalTitle(total)
  226. }));
  227. const recordStatusList =ref<SelectProps['options']>([
  228. { value: 1, name: '在营' },
  229. { value: 0, name: '停业' },
  230. ]);
  231. const regionList = ref<SelectProps['options']>();
  232. const streetList = ref<SelectProps['options']>();
  233. const dataList = ref([]);
  234. const institutionEditModelRef = ref();
  235. const tabsViewStore = useTabsViewStore();
  236. const changeCity = () => {
  237. if(searchParams.regionCode){
  238. get('system/area/getAreaList', {code: searchParams.regionCode}).then(data => {
  239. // console.log(data);
  240. streetList.value = data;
  241. // console.log(streetList.value);
  242. })
  243. }
  244. loadData();
  245. }
  246. get('system/area/getCityList', {}).then(data => {
  247. regionList.value = data;
  248. // console.log(regionList.value);
  249. });
  250. const loadData = async function () {
  251. formState.loading = true;
  252. const result: any = await getList(searchParams);
  253. dataList.value = result.list;
  254. formState.total = result.total;
  255. formState.loading = false;
  256. }
  257. const handleTableChange: TableProps['onChange'] = (pag: { pageSize: number; current: number },) => {
  258. searchParams.pageIndex = pag.current;
  259. searchParams.pageSize = pag.pageSize;
  260. loadData();
  261. };
  262. const onSelectChange = (selectedRowKeys: any) => {
  263. formState.selectedRowKeys = selectedRowKeys;
  264. };
  265. const onSearch = () => {
  266. loadData();
  267. }
  268. const onShowPosition = async function(record){
  269. const curPositionList :any = await get("companyService/post/getPostsByCompanyID",{companyId:record.companyID});
  270. console.log(curPositionList);
  271. modalShowRef.value.show(curPositionList);
  272. }
  273. const onDel = (item: any) => {
  274. Modal.confirm({
  275. title: '确认删除选中的企业信息?',
  276. icon: createVNode(ExclamationCircleOutlined),
  277. content: '',
  278. okText: '确认删除',
  279. okType: 'danger',
  280. okButtonProps: {},
  281. cancelText: '取消',
  282. onOk() {
  283. del([item.companyID]).then(() => {
  284. loadData();
  285. });
  286. },
  287. onCancel() {
  288. },
  289. });
  290. };
  291. const onAdd = () => {
  292. tabsViewStore.addTabByPath('/companyService/enterprise/add', {id: null, op: 1});
  293. };
  294. const onEdit = (item: any) => {
  295. tabsViewStore.addTabByPath('/companyService/enterprise/edit', {id: item.companyID, op: 2});
  296. };
  297. const onDetail = (item: any) => {
  298. tabsViewStore.addTabByPath('/companyService/enterprise/detail', {id: item.companyID});
  299. };
  300. return {
  301. formRef,
  302. modalShowRef,
  303. searchParams,
  304. formState,
  305. columns,
  306. pagination,
  307. dataList,
  308. expand,
  309. institutionEditModelRef,
  310. handleTableChange,
  311. loadData,
  312. onSelectChange,
  313. changeCity,
  314. onSearch,
  315. onDel,
  316. onAdd,
  317. onEdit,
  318. onShowPosition,
  319. importOptions,
  320. recordStatusList,
  321. regionList,
  322. streetList,
  323. onDetail,
  324. exportSearchParams
  325. };
  326. },
  327. created() {
  328. this.loadData();
  329. },
  330. activated() {
  331. if (history.state.params?.reload)
  332. this.loadData();
  333. }
  334. });
  335. </script>