index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441
  1. <template>
  2. <div class="card-search">
  3. <a-form ref="formRef" :model="searchParams" class="ant-advanced-search-form" name="advanced_search">
  4. <a-row :gutter="24">
  5. <a-col :span="6">
  6. <a-form-item :label-col="{span:6}" label="姓名" name="userName">
  7. <a-input v-model:value="searchParams.userName" :allow-clear="true" placeholder=""/>
  8. </a-form-item>
  9. </a-col>
  10. <a-col :span="6">
  11. <a-form-item :label-col="{span:6}" label="备忘日期" name="workDate">
  12. <a-range-picker v-model:value="workDate" :placeholder="['开始日期', '结束日期']"
  13. format="YYYY-MM-DD" @change="onRangeChange"/>
  14. </a-form-item>
  15. </a-col>
  16. <a-col :span="6">
  17. <a-form-item :label-col="{span:6}" label="备忘类型" name="doTypeID">
  18. <a-select ref="select"
  19. v-model:value="searchParams.doTypeID" :allow-clear="true"
  20. :field-names="{ label: 'name', value: 'value' }" :options="logTypeList" @change="onSearch">
  21. </a-select>
  22. </a-form-item>
  23. </a-col>
  24. <a-col :span="6" style="text-align: left">
  25. <a-button html-type="submit" type="primary" @click="onSearch">查询</a-button>
  26. <a-button style="margin: 0 8px" @click="formRef.resetFields();onReset();">重置</a-button>
  27. <a style="font-size: 12px" @click="expand = !expand">
  28. <template v-if="expand">
  29. <UpOutlined/>
  30. </template>
  31. <template v-else>
  32. <DownOutlined/>
  33. </template>
  34. {{ expand ? '收缩' : '展开' }}
  35. </a>
  36. </a-col>
  37. </a-row>
  38. <a-row v-show="expand" :gutter="24">
  39. <a-col :span="6">
  40. <a-form-item :label-col="{span:6}" label="所属县区" name="regionCode">
  41. <a-select
  42. ref="select"
  43. v-model:value="searchParams.regionCode"
  44. :allow-clear="true"
  45. :field-names="{ label: 'name', value: 'code' }"
  46. :options="regionList"
  47. @change="changeRegion"
  48. >
  49. </a-select>
  50. </a-form-item>
  51. </a-col>
  52. <a-col :span="6">
  53. <a-form-item :label-col="{span:6}" label="所属街道" name="streetCode">
  54. <a-select
  55. ref="select"
  56. v-model:value="searchParams.streetCode"
  57. :allow-clear="true"
  58. :field-names="{ label: 'name', value: 'code' }"
  59. :options="streetList"
  60. @change="onSearch"
  61. >
  62. </a-select>
  63. </a-form-item>
  64. </a-col>
  65. <a-col :span="6">
  66. <a-form-item :label-col="{span:6}" label="所属驿站" name="streetCode">
  67. <a-select
  68. ref="select"
  69. v-model:value="searchParams.siteID"
  70. :options="siteList"
  71. :field-names="{ label: 'siteName', value: 'siteID' }"
  72. :allow-clear="true"
  73. @change="loadData"
  74. >
  75. </a-select>
  76. </a-form-item>
  77. </a-col>
  78. </a-row>
  79. <a-row v-show="expand" :gutter="24">
  80. <a-col :span="6">
  81. <a-form-item :label-col="{span:6}" label="登记时间" name="regionCode">
  82. <a-range-picker v-model:value="createDate" :placeholder="['开始日期', '结束日期']" format="YYYY-MM-DD"
  83. @change="onCreateTimeChange"/>
  84. </a-form-item>
  85. </a-col>
  86. </a-row>
  87. <a-row class="edit-operation">
  88. <a-col :span="24" class="flex-space-between">
  89. <div>
  90. <!-- 表格字段筛选按钮 -->
  91. <ColumnsSetting :table-columns="originalColumns" :checked-table-columns="columns"
  92. @on-check="columnsCheckSub"></ColumnsSetting>
  93. </div>
  94. <div>
  95. <a-button functioncode="T01040202" html-type="submit" type="primary" @click='onAdd'>新增</a-button>
  96. <BExportExcel :filename="'备忘信息'"
  97. :params="{...exportSearchParams, rows:100000,doWorkIDList:formState.selectedRowKeys.join(',')}"
  98. :title="'导出'"
  99. :url="'taskAndLog/doWork/export'"></BExportExcel>
  100. </div>
  101. </a-col>
  102. </a-row>
  103. </a-form>
  104. <div class="search-result-list">
  105. <a-table :columns="columns" :data-source="dataList" :loading="formState.loading" :pagination="pagination"
  106. :row-key="record=>record.doWorkID"
  107. :row-selection="{ selectedRowKeys: formState.selectedRowKeys, onChange: onSelectChange}"
  108. :scroll="{ x:'100%', y: 500 }"
  109. bordered
  110. @change="handleTableChange">
  111. <template #bodyCell="{ column, text, record }">
  112. <template v-if="column.key === 'RecordsCompanyNum'">
  113. <div>
  114. <a-button type="link" size="small" @click='onRecordsCompanyInfo(record)'>{{
  115. record.RecordsCompanyNum
  116. }}
  117. </a-button>
  118. </div>
  119. </template>
  120. <template v-if="column.key === 'RecordsJobuserNum'">
  121. <div >
  122. <a-button type="link" size="small" @click='onRecordsJobUserInfo(record)'>{{
  123. record.RecordsJobuserNum
  124. }}
  125. </a-button>
  126. </div>
  127. </template>
  128. <template v-if="column.key === 'operation'">
  129. <div class="table-operation">
  130. <a-button functioncode="T01040201" size="small" type="link" @click='onDetail(record.doWorkID)'>查看
  131. </a-button>
  132. <a-button functioncode="T01040203" size="small" type="link" @click='onEdit(record.doWorkID)'>编辑
  133. </a-button>
  134. <a-button functioncode="T01040204" size="small" type="link" @click="onDel(record)">删除</a-button>
  135. </div>
  136. </template>
  137. </template>
  138. </a-table>
  139. <!-- 企业数据表格对话框 -->
  140. <CompanyTableCom ref="companyTableComRef"></CompanyTableCom>
  141. <!-- 求职人员数据表格对话框 -->
  142. <JobUserTableCom ref="jobUserTableComRef"></JobUserTableCom>
  143. </div>
  144. </div>
  145. </template>
  146. <script lang="ts">
  147. import {computed, createVNode, defineComponent, reactive, ref} from 'vue';
  148. import {useTabsViewStore} from "@/store/modules/tabsView";
  149. import {DownOutlined, ExclamationCircleOutlined, UpOutlined} from '@ant-design/icons-vue';
  150. import type {FormInstance, SelectProps, TableProps} from 'ant-design-vue';
  151. import {message, Modal} from "ant-design-vue";
  152. import {delWorkLog, getList} from '@/api/taskAndLog/dowork';
  153. import {getRegionCodeList, getStreetCodeList} from '@/api/system/area/index';
  154. import {getSysDictionaryList} from "@/api/system/dictionary";
  155. import BExportExcel from "@/components/basic/excel/exportExcel/exportExcel.vue";
  156. import {getPaginationTotalTitle} from "@/utils/common";
  157. import dayjs from 'dayjs';
  158. import CompanyTableCom from "@/views/companyService/company/CompanyTableCom.vue";
  159. import JobUserTableCom from "@/views/jobUserManager/jobuser/JobUserTableCom.vue";
  160. import {getSiteList} from "@/api/baseSettings/siteInfo";
  161. import ColumnsSetting from "@/components/common/ColumnsSetting.vue";
  162. export default defineComponent({
  163. name: 'doTaskList',
  164. components: {ColumnsSetting, JobUserTableCom, CompanyTableCom, DownOutlined, UpOutlined, BExportExcel},
  165. setup() {
  166. const formRef = ref<FormInstance>();
  167. const tabsViewStore = useTabsViewStore();
  168. const expand = ref(false);
  169. const workDate = ref([]);
  170. const searchParams = reactive({
  171. pageIndex: 1,
  172. pageSize: 20,
  173. userName: '',
  174. workStartDate: '',
  175. workEndDate: '',
  176. doTypeID: null,
  177. regionCode: '',
  178. streetCode: '',
  179. siteID: "",
  180. startDate: "",
  181. endDate: ''
  182. });
  183. // 导出Excel查询参数
  184. const exportSearchParams = computed(() => {
  185. let data = JSON.parse(JSON.stringify(searchParams));
  186. data.pageSize = formState.total;
  187. return data;
  188. })
  189. const formState = reactive({
  190. total: 0,
  191. selectedRowKeys: [],
  192. loading: false
  193. });
  194. // 原始表格定义数据
  195. const originalColumns = [
  196. {
  197. title: '序号',
  198. align: "center",
  199. key: 'LogId',
  200. customRender: item => `${searchParams.pageSize * (searchParams.pageIndex - 1) + item.index + 1}`,
  201. isDisabled: true
  202. },
  203. {title: '姓名', dataIndex: 'userName', key: 'userName', align: "center"},
  204. {
  205. title: '工作备忘日期', dataIndex: 'workTime', key: 'workTime', width: 120, align: "center",
  206. customRender: (item) => {
  207. return item.record.workTime == null ? "" : (dayjs(item.record.workTime).format('YYYY-MM-DD'))
  208. },
  209. },
  210. {title: '备忘类型', dataIndex: 'logTypeName', key: 'logTypeName', align: "center"},
  211. {title: '工作备忘情况', dataIndex: 'workContent', key: 'workContent', align: "center"},
  212. {title: '所属驿站', dataIndex: 'siteName', key: 'siteName', align: "center"},
  213. {title: '所属县区', dataIndex: 'regionName', key: 'regionName', align: "center"},
  214. {title: '所属街道', dataIndex: 'streetName', key: 'streetName', align: "center", isDefaultClose: true},
  215. {
  216. title: '走访企业数量',
  217. dataIndex: 'RecordsCompanyNum',
  218. key: 'RecordsCompanyNum',
  219. align: "center",
  220. isDefaultClose: true
  221. },
  222. {
  223. title: '登记就业人员人数',
  224. dataIndex: 'RecordsJobuserNum',
  225. key: 'RecordsJobuserNum',
  226. align: "center",
  227. isDefaultClose: true
  228. },
  229. {title: '操作', key: 'operation', fixed: 'right', width: 150, align: "center", isDisabled: true},
  230. ];
  231. // 响应式表格定义
  232. const columns = ref<Array<any>>(originalColumns.filter(item => !item.isDefaultClose));
  233. const pagination = computed(() => ({
  234. total: formState.total,
  235. current: searchParams.pageIndex,
  236. pageSize: searchParams.pageSize,
  237. showSizeChanger: true,
  238. showTotal: total => getPaginationTotalTitle(total)
  239. }));
  240. const regionList = ref<SelectProps['options']>();
  241. const streetList = ref<SelectProps['options']>();
  242. const logTypeList = ref<SelectProps['options']>();
  243. const siteList = ref<any>([]);
  244. const dataList = ref([]);
  245. const createDate = ref([]);
  246. // 企业数据表格对话框
  247. const companyTableComRef = ref();
  248. // 就业人员表格对话框
  249. const jobUserTableComRef = ref();
  250. const getLogTypeList = async function () {
  251. const logTypeResult: any = await getSysDictionaryList("LogType");
  252. logTypeList.value = logTypeResult;
  253. }
  254. const getRegionList = async function () {
  255. const regionResult: any = await getRegionCodeList();
  256. // console.log('regionResult',regionResult);
  257. regionList.value = regionResult;
  258. }
  259. const getAllSites = () => {
  260. getSiteList({pageIndex: 1, pageSize: 9999}).then((result: any) => {
  261. siteList.value = result.list;
  262. })
  263. }
  264. const changeRegion = async function () {
  265. if (searchParams.regionCode) {
  266. const streetResult: any = await getStreetCodeList(searchParams.regionCode);
  267. // console.log('streetResult',streetResult);
  268. streetList.value = streetResult;
  269. }
  270. onSearch();
  271. }
  272. const loadData = async function () {
  273. formState.loading = true;
  274. await getLogTypeList();
  275. await getRegionList();
  276. const result: any = await getList(searchParams);
  277. dataList.value = result.list;
  278. // console.log("dataList",dataList.value);
  279. formState.total = result.total;
  280. formState.loading = false;
  281. }
  282. const handleTableChange: TableProps['onChange'] = (pag: { pageSize: number; current: number },) => {
  283. searchParams.pageIndex = pag.current;
  284. searchParams.pageSize = pag.pageSize;
  285. loadData();
  286. };
  287. const onSelectChange = (selectedRowKeys: any) => {
  288. formState.selectedRowKeys = selectedRowKeys;
  289. };
  290. const onRangeChange = (dateString) => {
  291. workDate.value = dateString;
  292. searchParams.workStartDate = dateString ? dateString[0].format("YYYY-MM-DD") : '';
  293. searchParams.workEndDate = dateString ? dateString[1].format("YYYY-MM-DD") : '';
  294. loadData();
  295. }
  296. const onSearch = () => {
  297. loadData();
  298. }
  299. const onDel = (item: any) => {
  300. formState.selectedRowKeys = [];
  301. if (item) {
  302. formState.selectedRowKeys.push(item.doWorkID as never)
  303. }
  304. if (formState.selectedRowKeys.length <= 0) {
  305. message.warning('请选择需要删除的数据!');
  306. return false;
  307. }
  308. Modal.confirm({
  309. title: '确认删除选中的日志信息?',
  310. icon: createVNode(ExclamationCircleOutlined),
  311. content: '',
  312. okText: '确认删除',
  313. okType: 'danger',
  314. okButtonProps: {},
  315. cancelText: '取消',
  316. onOk() {
  317. delWorkLog(formState.selectedRowKeys).then(() => {
  318. loadData();
  319. });
  320. },
  321. onCancel() {
  322. formState.selectedRowKeys = [];
  323. },
  324. });
  325. };
  326. const onAdd = () => {
  327. tabsViewStore.addTabByPath('/workLog/add', {id: null});
  328. };
  329. const onEdit = (id: string) => {
  330. tabsViewStore.addTabByPath('/workLog/edit', {id: id});
  331. };
  332. const onDetail = (id: string) => {
  333. tabsViewStore.addTabByPath('/workLog/detail', {id: id});
  334. }
  335. const onReset = () => {
  336. workDate.value = [];
  337. searchParams.workStartDate = '';
  338. searchParams.workEndDate = '';
  339. loadData();
  340. };
  341. // 开启录入企业信息弹窗
  342. function onRecordsCompanyInfo(record: any) {
  343. if (record.RecordsCompanyNum == 0) {
  344. return;
  345. }
  346. console.log(companyTableComRef)
  347. companyTableComRef.value.show(record)
  348. }
  349. // 开启录入求职人员信息弹窗
  350. function onRecordsJobUserInfo(record: any) {
  351. if (record.RecordsJobuserNum == 0) {
  352. return;
  353. }
  354. console.log(jobUserTableComRef)
  355. jobUserTableComRef.value.show(record)
  356. }
  357. // 登记时间组件调整
  358. const onCreateTimeChange = (dateString) => {
  359. createDate.value = dateString;
  360. searchParams.startDate = dateString ? dateString[0].format("YYYY-MM-DD") : '';
  361. searchParams.endDate = dateString ? dateString[1].format("YYYY-MM-DD") : '';
  362. loadData();
  363. }
  364. // 字段展示列选择完毕
  365. function columnsCheckSub(columnsKeys: Array<string>) {
  366. // 从原始表格定义数据中过滤出已选择的字段
  367. columns.value = originalColumns.filter((item: any) => columnsKeys.includes(item.key));
  368. }
  369. return {
  370. formRef,
  371. expand,
  372. workDate,
  373. logTypeList,
  374. regionList,
  375. streetList,
  376. searchParams,
  377. formState,
  378. originalColumns,
  379. columnsCheckSub,
  380. columns,
  381. pagination,
  382. dataList,
  383. handleTableChange,
  384. onSelectChange,
  385. onSearch,
  386. onAdd,
  387. onEdit,
  388. onDel,
  389. onReset,
  390. onRangeChange,
  391. loadData,
  392. changeRegion,
  393. dayjs,
  394. onDetail,
  395. onRecordsCompanyInfo,
  396. onRecordsJobUserInfo,
  397. companyTableComRef,
  398. jobUserTableComRef,
  399. exportSearchParams,
  400. siteList,
  401. getAllSites,
  402. createDate,
  403. onCreateTimeChange
  404. };
  405. },
  406. created() {
  407. this.loadData();
  408. this.getAllSites();
  409. },
  410. activated() {
  411. if (history.state.params?.reload)
  412. this.loadData();
  413. }
  414. });
  415. </script>
  416. <style lang="less" scoped></style>