Commit f86fc371 by liuguorong93

技术人员信息(新增)

parent 343d11bd
......@@ -4,3 +4,11 @@ export let baseUrl = '/api'
// 获取警犬技术人员管理列表接口
export const getArtisanList = params =>
postJson(`${baseUrl}/artisanController/getArtisanPage`, params)
// 技术人员信息(新增)
export const addArtisan = params =>
postJson(`${baseUrl}/artisanController/saveArtisan`, params)
// 技术人员信息(编辑)
export const editArtisan = params =>
postJson(`${baseUrl}/artisanController/updateArtisanById`, params)
\ No newline at end of file
......@@ -5,7 +5,6 @@
.detailContentClass {
position: relative;
width: 100%;
height: 100%;
padding: 24px;
.contents {
......
<template>
<div class="detailContentClass">
<div
class="detailContentClass"
v-loading="loading"
>
<div class="contents">
<el-form
:model="detailInfo"
......@@ -266,7 +269,10 @@
<div class="hengLine"></div>
<div class="elBtns">
<el-button size="medium">返回</el-button>
<el-button
size="medium"
@click="goBack"
>返回</el-button>
<el-button
type="primary"
size="medium"
......@@ -283,11 +289,14 @@ import moment from "moment";
import { getBirthAndSexForSfzh } from "@/utils/mk.js";
import { getJsonDataApi } from "@/utils/getJsonData.js";
import rules from "@/utils/rules2.js";
import { addArtisan, editArtisan } from "@/api/menuDataApi/artisanManageApi.js";
export default {
name: "artisanManageEdit",
data() {
return {
loading: false,
routeName: "",
detailInfo: {
personName: "",
idNo: "",
......@@ -352,8 +361,8 @@ export default {
workYears: [
{
required: true,
message: "请输入从事警犬技术工作时间",
trigger: "blur",
message: "请选择从事警犬技术工作时间",
trigger: "change",
},
],
xxdjryXm: [
......@@ -383,8 +392,8 @@ export default {
},
async mounted() {
// 判断是新增/编辑页面
let routeName = this.$route.name || "";
if (routeName === "artisanManageEdit") {
this.routeName = this.$route.name || "";
if (this.routeName === "artisanManageEdit") {
// 编辑
} else {
// 新增
......@@ -421,10 +430,79 @@ export default {
saveData() {
this.$refs.detailInfoRef.validate((result) => {
if (result) {
console.log("ok");
let jqxph = "";
if (this.tableData && this.tableData.length) {
this.tableData.forEach((item) => {
if (item.xinpianhao) jqxph = jqxph + item.xinpianhao + ",";
});
jqxph = jqxph.substr(0, jqxph.length - 1);
}
let params = {
personName: this.detailInfo.personName,
idNo: this.detailInfo.idNo,
gender: this.detailInfo.gender === "男" ? "1" : "0",
birthDate: this.detailInfo.birthDate,
isjwzy: this.detailInfo.isjwzy,
school: this.detailInfo.school,
unitName: this.detailInfo.unitName,
jwjsxl: this.detailInfo.jwjsxl,
workYears: String(this.detailInfo.workYears),
sxjq:
this.tableData && this.tableData.length
? String(this.tableData.length)
: "0",
jqxph,
xxdjryXm: this.detailInfo.xxdjryXm,
xxdjryGmsfhm: this.detailInfo.xxdjryGmsfhm,
xxdjdwGajgmc: this.detailInfo.xxdjdwGajgmc,
xxdjdwGajgjgdm: this.detailInfo.xxdjdwGajgjgdm,
djsj: moment().format("YYYY-MM-DD HH:mm:ss"),
id: this.detailInfo.id || "",
};
if (this.routeName === "artisanManageEdit") {
this.editParams(params);
} else {
this.addParams(params);
}
}
});
},
editParams(params) {},
addParams(params) {
this.loading = true;
addArtisan(params)
.then((res) => {
if (res.code === 200 && res.success) {
this.$message({
message: "保存成功",
type: "success",
duration: 1000,
});
this.loading = false;
return;
}
this.loading = false;
this.$message({
message: res.message,
type: "warning",
duration: 1000,
});
})
.catch((e) => {
console.log(e);
this.loading = false;
this.$message({
message: "更新失败",
type: "warning",
duration: 1000,
});
});
},
goBack() {
this.$router.push({ name: "artisanManage" });
},
},
watch: {},
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment