diff --git a/src/api/yingji/enterprise.js b/src/api/yingji/enterprise.js index 174cf24..917d25d 100644 --- a/src/api/yingji/enterprise.js +++ b/src/api/yingji/enterprise.js @@ -20,7 +20,7 @@ export function getEnterprise(id) { // 新增计划企业 export function addEnterprise(data) { return request({ - url: '/system/enterprise', + url: '/pharmaceuticals/bPlanEnterprise', method: 'post', data: data }) @@ -29,7 +29,7 @@ export function addEnterprise(data) { // 修改计划企业 export function updateEnterprise(data) { return request({ - url: '/system/enterprise', + url: '/pharmaceuticals/bPlanEnterprise', method: 'put', data: data }) @@ -38,7 +38,7 @@ export function updateEnterprise(data) { // 删除计划企业 export function delEnterprise(id) { return request({ - url: '/system/enterprise/' + id, + url: '/pharmaceuticals/bPlanEnterprise?idList=' + id, method: 'delete' }) } diff --git a/src/api/yingji/index.js b/src/api/yingji/index.js index 578c6d5..ca78828 100644 --- a/src/api/yingji/index.js +++ b/src/api/yingji/index.js @@ -1,12 +1,12 @@ /* - * @Descripttion: - * @version: + * @Descripttion: + * @version: * @Author: JC9527 * @Date: 2023-09-11 15:38:21 * @LastEditors: JC9527 * @LastEditTime: 2023-09-30 00:52:32 */ -import request from '@/utils/request' +import request from "@/utils/request"; export default { // 行政区划 @@ -31,60 +31,59 @@ export default { url: "/pharmaceuticals/info/list", method: "get", params, - }) + }); }, // 查看,新增,修改,删除计划管理表 get\delete 传参是params put\post 传参是data - bPlanManage(method,data = null, params = null, id){ + bPlanManage(method, data = null, params = null, id) { return request({ - url: `/pharmaceuticals/bPlanManage${id ? `/${id}` : ''}`, + url: `/pharmaceuticals/bPlanManage${id ? `/${id}` : ""}`, method, data, - params + params, }); }, - bPlanManageTwo(id){ + bPlanManageTwo(id) { return request({ url: `/pharmaceuticals/bPlanEnterprise/${id}`, - method:'get', + method: "get", }); }, - dictdata(params){ + dictdata(params) { return request({ url: `/pharmaceuticals/dictdata`, - method:'get', - params + method: "get", + params, }); }, - bPlanEnterprise(method,data = null, params = null, id){ + bPlanEnterprise(method, data = null, params = null, id) { return request({ - url: `/pharmaceuticals/bPlanEnterprise${id ? `/${id}` : ''}`, + url: `/pharmaceuticals/bPlanEnterprise${id ? `/${id}` : ""}`, method, data, - params + params, }); }, // 查看计划明细 - planmx(params){ + planmx(params) { return request({ url: `/pharmaceuticals/bPlanEnterprise/planmx`, - method:'post', + method: "post", params, }); }, // 查询计划企业列表 - bPlanEnterpriseList(){ + bPlanEnterpriseList() { return request({ url: `/pharmaceuticals/bPlanEnterprise/list`, - method:'get', + method: "get", }); }, // 根据行政区划查询重点企业数量 - getBydistrict(params){ + getBydistrict(params) { return request({ url: `/pharmaceuticals/bKeyEnterprise/getBydistrict`, - method:'get', - params + method: "get", + params, }); }, - -}; \ No newline at end of file +}; diff --git a/src/views/components/AddDialog/index.vue b/src/views/components/AddDialog/index.vue index f449b2b..a5fe2cb 100644 --- a/src/views/components/AddDialog/index.vue +++ b/src/views/components/AddDialog/index.vue @@ -54,7 +54,7 @@
- +
@@ -87,6 +87,9 @@ export default { selectTab(index) { console.log(index); this.activeTab = index; + if (index == 2) { + this.$refs.tabs.getList(); + } }, // 打开 openDialog(item, dept) { diff --git a/src/views/components/AddDialog/tab1.vue b/src/views/components/AddDialog/tab1.vue index 552f88d..dc5723b 100644 --- a/src/views/components/AddDialog/tab1.vue +++ b/src/views/components/AddDialog/tab1.vue @@ -137,7 +137,7 @@ @@ -153,6 +153,13 @@ import dictzh from "@/utils/dictzh.js"; // 行政区域 import executive from "../../yingji/echarts/executive.vue"; import { listNew, getNew, delNew, addNew, updateNew } from "@/api/yingji/new"; +import { + listEnterprise, + getEnterprise, + delEnterprise, + addEnterprise, + updateEnterprise, +} from "@/api/yingji/enterprise"; export default { dicts: [ @@ -203,12 +210,47 @@ export default { form: {}, // 表单校验 rules: {}, + // 查询计划企业参数 + queryPlanEnterpriseParams: { + pageNum: 1, + pageSize: 10, + enterpriseId: null, + createId: null, + updateId: null, + userId: null, + deptId: null, + district: null, + plannedYear: null, + isPoint: "", + enterpriseName: null, + lawSort: null, + lawAreas: null, + lawLevel: null, + lawHierarchy: null, + plannedMonth: null, + status: 1, + checkStatus: null, + checkId: null, + checkAgeing: null, + }, + enterpriseList: [], + enterpriseTotal: 0, + // 表单参数 + formPlanEnterprise: {}, }; }, created() { this.getList(); + this.getPlanEnterpriseList(); }, methods: { + /** 查询计划企业列表 */ + getPlanEnterpriseList() { + listEnterprise(this.queryPlanEnterpriseParams).then((response) => { + this.enterpriseList = response.data; + this.enterpriseTotal = response.data.length; + }); + }, /** 查询企业新列表 */ getList() { this.loading = true; @@ -222,7 +264,53 @@ export default { this.$emit("nextTab", 1); }, // 加入草稿箱 - handleAddDrafts(row) {}, + handleAddDrafts(row) { + // console.log("1", row); + this.resetPlanEnterprise(); + this.formPlanEnterprise.plannedYear = this.$moment(new Date()).format( + "yyyy" + ); + this.formPlanEnterprise.plannedMonth = ""; + this.formPlanEnterprise.enterpriseId = row.enterpriseId; + this.formPlanEnterprise.enterpriseName = row.enterpriseName; + this.formPlanEnterprise.district = row.district; + this.formPlanEnterprise.status = 0; + // console.log("2", this.formPlanEnterprise); + addEnterprise(this.formPlanEnterprise).then((response) => { + this.$modal.msgSuccess("加入成功"); + this.getList(); //对应草稿箱的消失需要后台写 + this.getPlanEnterpriseList(); + }); + }, + // 表单重置 + resetPlanEnterprise() { + this.formPlanEnterprise = { + id: null, + enterpriseId: null, + createId: null, + createBy: null, + createTime: null, + updateId: null, + updateBy: null, + updateTime: null, + remark: null, + userId: null, + deptId: null, + district: null, + plannedYear: null, + isPoint: null, + enterpriseName: null, + lawSort: null, + lawAreas: null, + lawLevel: null, + lawHierarchy: null, + plannedMonth: null, + status: null, + checkStatus: null, + checkId: null, + checkAgeing: null, + }; + }, // 查看企业详情 handleInfo(row) { this.$refs.firmDialog.open(row); diff --git a/src/views/components/AddDialog/tab2.vue b/src/views/components/AddDialog/tab2.vue index 9c508bd..b71eab7 100644 --- a/src/views/components/AddDialog/tab2.vue +++ b/src/views/components/AddDialog/tab2.vue @@ -137,7 +137,7 @@ @@ -153,6 +153,13 @@ import dictzh from "@/utils/dictzh.js"; // 行政区域 import executive from "../../yingji/echarts/executive.vue"; import { listNew, getNew, delNew, addNew, updateNew } from "@/api/yingji/new"; +import { + listEnterprise, + getEnterprise, + delEnterprise, + addEnterprise, + updateEnterprise, +} from "@/api/yingji/enterprise"; export default { dicts: [ @@ -203,12 +210,47 @@ export default { form: {}, // 表单校验 rules: {}, + // 查询计划企业参数 + queryPlanEnterpriseParams: { + pageNum: 1, + pageSize: 10, + enterpriseId: null, + createId: null, + updateId: null, + userId: null, + deptId: null, + district: null, + plannedYear: null, + isPoint: "", + enterpriseName: null, + lawSort: null, + lawAreas: null, + lawLevel: null, + lawHierarchy: null, + plannedMonth: null, + status: 1, + checkStatus: null, + checkId: null, + checkAgeing: null, + }, + enterpriseList: [], + enterpriseTotal: 0, + // 表单参数 + formPlanEnterprise: {}, }; }, created() { this.getList(); + this.getPlanEnterpriseList(); }, methods: { + /** 查询计划企业列表 */ + getPlanEnterpriseList() { + listEnterprise(this.queryPlanEnterpriseParams).then((response) => { + this.enterpriseList = response.data; + this.enterpriseTotal = response.data.length; + }); + }, /** 查询企业新列表 */ getList() { this.loading = true; @@ -222,7 +264,53 @@ export default { this.$emit("nextTab", 2); }, // 加入草稿箱 - handleAddDrafts(row) {}, + handleAddDrafts(row) { + // console.log("1", row); + this.resetPlanEnterprise(); + this.formPlanEnterprise.plannedYear = this.$moment(new Date()).format( + "yyyy" + ); + this.formPlanEnterprise.plannedMonth = ""; + this.formPlanEnterprise.enterpriseId = row.enterpriseId; + this.formPlanEnterprise.enterpriseName = row.enterpriseName; + this.formPlanEnterprise.district = row.district; + this.formPlanEnterprise.status = 0; + // console.log("2", this.formPlanEnterprise); + addEnterprise(this.formPlanEnterprise).then((response) => { + this.$modal.msgSuccess("加入成功"); + this.getList(); //对应草稿箱的消失需要后台写 + this.getPlanEnterpriseList(); + }); + }, + // 表单重置 + resetPlanEnterprise() { + this.formPlanEnterprise = { + id: null, + enterpriseId: null, + createId: null, + createBy: null, + createTime: null, + updateId: null, + updateBy: null, + updateTime: null, + remark: null, + userId: null, + deptId: null, + district: null, + plannedYear: null, + isPoint: null, + enterpriseName: null, + lawSort: null, + lawAreas: null, + lawLevel: null, + lawHierarchy: null, + plannedMonth: null, + status: null, + checkStatus: null, + checkId: null, + checkAgeing: null, + }; + }, // 查看企业详情 handleInfo(row) { this.$refs.firmDialog.open(row); diff --git a/src/views/components/AddDialog/tab3.vue b/src/views/components/AddDialog/tab3.vue index d4cd1ed..b46d117 100644 --- a/src/views/components/AddDialog/tab3.vue +++ b/src/views/components/AddDialog/tab3.vue @@ -64,7 +64,7 @@ @@ -130,7 +130,7 @@ export default { lawLevel: null, lawHierarchy: null, plannedMonth: null, - status: 1, + status: 0, checkStatus: null, checkId: null, checkAgeing: null, @@ -147,6 +147,7 @@ export default { methods: { // 编辑月份 editMonth(row) { + let _this = this; this.$prompt("请输入月份", "编辑", { confirmButtonText: "确定", cancelButtonText: "取消", @@ -158,6 +159,14 @@ export default { }) .then(({ value }) => { // 调用接口 + if (row.id != null) { + row.createTime = null; + row.plannedMonth = value; + updateEnterprise(row).then((response) => { + this.$modal.msgSuccess("修改成功"); + _this.getList(); + }); + } }) .catch(() => { this.$message({ @@ -176,7 +185,18 @@ export default { }); }, // 删除 - handleDelete(row) {}, + handleDelete(row) { + this.$modal + .confirm("是否确认删除计划企业数据项?") + .then(function () { + return delEnterprise(row.id); + }) + .then(() => { + this.getList(); + this.$modal.msgSuccess("删除成功"); + }) + .catch(() => {}); + }, // 匹配行政区划 componendDistrict(district) { let fullName;