Compare commits
2 Commits
eb1c8a4cb9
...
85738e34e3
| Author | SHA1 | Date |
|---|---|---|
|
|
85738e34e3 | |
|
|
6a2e9b76a8 |
|
|
@ -11,7 +11,7 @@
|
||||||
:send-id="crewId"
|
:send-id="crewId"
|
||||||
:show-sel="false"
|
:show-sel="false"
|
||||||
>
|
>
|
||||||
<template slot="btn" slot-scope="{ queryParams }">
|
<template slot="btn" >
|
||||||
<el-button type="primary" @click="handleAddMember()" icon="el-icon-plus" size="mini"
|
<el-button type="primary" @click="handleAddMember()" icon="el-icon-plus" size="mini"
|
||||||
>添加成员</el-button
|
>添加成员</el-button
|
||||||
>
|
>
|
||||||
|
|
|
||||||
|
|
@ -212,8 +212,8 @@ export default {
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
relPhone: [
|
relPhone: [
|
||||||
|
{ required: true, message: "联系方式不能为空", trigger: "blur" },
|
||||||
{
|
{
|
||||||
required: true,
|
|
||||||
message: "手机号格式不正确",
|
message: "手机号格式不正确",
|
||||||
validator: this.validatePhone,
|
validator: this.validatePhone,
|
||||||
trigger: "blur",
|
trigger: "blur",
|
||||||
|
|
|
||||||
|
|
@ -191,8 +191,8 @@ export default {
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
relPhone: [
|
relPhone: [
|
||||||
|
{ required: true, message: "联系方式不能为空", trigger: "blur" },
|
||||||
{
|
{
|
||||||
required: true,
|
|
||||||
message: "手机号格式不正确",
|
message: "手机号格式不正确",
|
||||||
validator: this.validatePhone,
|
validator: this.validatePhone,
|
||||||
trigger: "blur",
|
trigger: "blur",
|
||||||
|
|
|
||||||
|
|
@ -26,17 +26,17 @@
|
||||||
:label="item.label"
|
:label="item.label"
|
||||||
:value="item.value"
|
:value="item.value"
|
||||||
>
|
>
|
||||||
<template v-if="item.label.length > maxlength">
|
<template
|
||||||
|
v-if="item.label.length > maxlength">
|
||||||
<el-tooltip
|
<el-tooltip
|
||||||
class="item-tooltip"
|
class="item-tooltip"
|
||||||
effect="dark"
|
effect="dark"
|
||||||
:content="item.label"
|
:content="item.label"
|
||||||
placement="top"
|
placement="top"
|
||||||
>
|
>
|
||||||
<span class="ellipsis">{{
|
<span class="ellipsis">{{ item.label }}</span>
|
||||||
item.label
|
|
||||||
}}</span>
|
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
|
|
@ -64,11 +64,7 @@
|
||||||
<el-row type="flex" justify="space-between" :gutter="24">
|
<el-row type="flex" justify="space-between" :gutter="24">
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="申请人" prop="relUser">
|
<el-form-item label="申请人" prop="relUser">
|
||||||
<el-input
|
<el-input :maxlength="50" v-model="projectParams.relUser" placeholder="请输入" />
|
||||||
:maxlength="50"
|
|
||||||
v-model="projectParams.relUser"
|
|
||||||
placeholder="请输入"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
|
|
@ -103,47 +99,24 @@
|
||||||
>
|
>
|
||||||
</template>
|
</template>
|
||||||
<template slot="handle" slot-scope="{ data }">
|
<template slot="handle" slot-scope="{ data }">
|
||||||
<el-button
|
<el-button type="danger" size="mini" @click="handleDeleteEdge(data)"
|
||||||
type="danger"
|
|
||||||
size="mini"
|
|
||||||
@click="handleDeleteEdge(data)"
|
|
||||||
>删除</el-button
|
>删除</el-button
|
||||||
>
|
>
|
||||||
</template>
|
</template>
|
||||||
<template slot="devName" slot-scope="{ data }">
|
<template slot="devName" slot-scope="{ data }">
|
||||||
<el-input
|
<el-input :maxlength="50" v-model="data.devName" placeholder="请输入"></el-input>
|
||||||
:maxlength="50"
|
|
||||||
v-model="data.devName"
|
|
||||||
placeholder="请输入"
|
|
||||||
></el-input>
|
|
||||||
</template>
|
</template>
|
||||||
<template slot="devCode" slot-scope="{ data }">
|
<template slot="devCode" slot-scope="{ data }">
|
||||||
<el-input
|
<el-input :maxlength="50" v-model="data.devCode" placeholder="请输入"></el-input>
|
||||||
:maxlength="50"
|
|
||||||
v-model="data.devCode"
|
|
||||||
placeholder="请输入"
|
|
||||||
></el-input>
|
|
||||||
</template>
|
</template>
|
||||||
<template slot="unitName" slot-scope="{ data }">
|
<template slot="unitName" slot-scope="{ data }">
|
||||||
<el-input
|
<el-input :maxlength="50" v-model="data.unitName" placeholder="请输入"></el-input>
|
||||||
:maxlength="50"
|
|
||||||
v-model="data.unitName"
|
|
||||||
placeholder="请输入"
|
|
||||||
></el-input>
|
|
||||||
</template>
|
</template>
|
||||||
<template slot="areaName" slot-scope="{ data }">
|
<template slot="areaName" slot-scope="{ data }">
|
||||||
<el-input
|
<el-input :maxlength="50" v-model="data.areaName" placeholder="请输入"></el-input>
|
||||||
:maxlength="50"
|
|
||||||
v-model="data.areaName"
|
|
||||||
placeholder="请输入"
|
|
||||||
></el-input>
|
|
||||||
</template>
|
</template>
|
||||||
<template slot="devUser" slot-scope="{ data }">
|
<template slot="devUser" slot-scope="{ data }">
|
||||||
<el-input
|
<el-input :maxlength="50" v-model="data.devUser" placeholder="请输入"></el-input>
|
||||||
:maxlength="50"
|
|
||||||
v-model="data.devUser"
|
|
||||||
placeholder="请输入"
|
|
||||||
></el-input>
|
|
||||||
</template>
|
</template>
|
||||||
<template slot="devUserPhone" slot-scope="{ data }">
|
<template slot="devUserPhone" slot-scope="{ data }">
|
||||||
<el-input
|
<el-input
|
||||||
|
|
@ -159,7 +132,7 @@
|
||||||
<el-button
|
<el-button
|
||||||
@click="
|
@click="
|
||||||
() => {
|
() => {
|
||||||
this.$emit('closeDialog')
|
this.$emit('closeDialog');
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
>取消</el-button
|
>取消</el-button
|
||||||
|
|
@ -169,16 +142,16 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { columnsListInsert } from '../config-insert'
|
import { columnsListInsert } from "../config-insert";
|
||||||
import {
|
import {
|
||||||
addEdgeDeviceApi,
|
addEdgeDeviceApi,
|
||||||
editEdgeDeviceApi,
|
editEdgeDeviceApi,
|
||||||
queryEdgeDeviceByIdApi,
|
queryEdgeDeviceByIdApi,
|
||||||
} from '@/api/base/insert'
|
} from "@/api/base/insert";
|
||||||
import { queryProjApi } from '@/api/base/crew'
|
import { queryProjApi } from "@/api/base/crew";
|
||||||
import { queryProjDeptListApi } from '@/api/base/projDept'
|
import { queryProjDeptListApi } from "@/api/base/projDept";
|
||||||
export default {
|
export default {
|
||||||
name: 'FormProject',
|
name: "FormProject",
|
||||||
props: {
|
props: {
|
||||||
editParams: {
|
editParams: {
|
||||||
type: Object,
|
type: Object,
|
||||||
|
|
@ -192,21 +165,21 @@ export default {
|
||||||
async mounted() {
|
async mounted() {
|
||||||
this.open = true
|
this.open = true
|
||||||
if (this.editParams) {
|
if (this.editParams) {
|
||||||
await Object.assign(this.projectParams, this.editParams)
|
await Object.assign(this.projectParams, this.editParams);
|
||||||
// 查询所属设备
|
// 查询所属设备
|
||||||
await queryEdgeDeviceByIdApi(this.editParams.id)
|
await queryEdgeDeviceByIdApi(this.editParams.id)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
res.rows.forEach((item) => {
|
res.rows.forEach((item) => {
|
||||||
this.$refs.tableRef.tableList.unshift(item)
|
this.$refs.tableRef.tableList.unshift(item);
|
||||||
|
});
|
||||||
|
this.$refs.tableRef.total = res.rows.length;
|
||||||
})
|
})
|
||||||
this.$refs.tableRef.total = res.rows.length
|
.catch((err) => {});
|
||||||
})
|
this.subSort = 2;
|
||||||
.catch((err) => {})
|
|
||||||
this.subSort = 2
|
|
||||||
} else {
|
} else {
|
||||||
this.subSort = 1
|
this.subSort = 1;
|
||||||
}
|
}
|
||||||
await this.getRanges()
|
await this.getRanges();
|
||||||
this.open = false
|
this.open = false
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
|
|
@ -214,7 +187,7 @@ export default {
|
||||||
columnsListInsert,
|
columnsListInsert,
|
||||||
open: false,
|
open: false,
|
||||||
exportList: [],
|
exportList: [],
|
||||||
subSort: '', // 提交类型:新增 1 / 修改 2
|
subSort: "", // 提交类型:新增 1 / 修改 2
|
||||||
projectParams: {
|
projectParams: {
|
||||||
departId: undefined, //项目部
|
departId: undefined, //项目部
|
||||||
proId: undefined, //工程名称
|
proId: undefined, //工程名称
|
||||||
|
|
@ -226,30 +199,30 @@ export default {
|
||||||
departId: [
|
departId: [
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
message: '请输入项目部名称',
|
message: "请输入项目部名称",
|
||||||
trigger: 'blur',
|
trigger: "blur",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
proId: [
|
proId: [
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
message: '请输入工程名称',
|
message: "请输入工程名称",
|
||||||
trigger: 'blur',
|
trigger: "blur",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
relUser: [
|
relUser: [
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
message: '请输入申请人',
|
message: "请输入申请人",
|
||||||
trigger: 'blur',
|
trigger: "blur",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
relPhone: [
|
relPhone: [
|
||||||
|
{ required: true, message: "联系方式不能为空", trigger: "blur" },
|
||||||
{
|
{
|
||||||
required: true,
|
message: "手机号格式不正确",
|
||||||
message: '手机号格式不正确',
|
|
||||||
validator: this.validatePhone,
|
validator: this.validatePhone,
|
||||||
trigger: 'blur',
|
trigger: "blur",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
@ -260,48 +233,44 @@ export default {
|
||||||
// 手机正则
|
// 手机正则
|
||||||
phoneReg: /^(?:(?:\+|00)86)?1[3-9]\d{9}$/,
|
phoneReg: /^(?:(?:\+|00)86)?1[3-9]\d{9}$/,
|
||||||
testId: 1,
|
testId: 1,
|
||||||
}
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
/** 校验手机号 */
|
/** 校验手机号 */
|
||||||
validatePhone(rule, value, callback) {
|
validatePhone(rule, value, callback) {
|
||||||
if (!this.phoneReg.test(value)) {
|
if (!this.phoneReg.test(value)) {
|
||||||
callback(new Error('手机号格式不正确'))
|
callback(new Error("手机号格式不正确"));
|
||||||
} else {
|
} else {
|
||||||
callback()
|
callback();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getIdList(idList) {
|
getIdList(idList) {
|
||||||
this.exportList = []
|
this.exportList = [];
|
||||||
console.log(idList)
|
console.log(idList);
|
||||||
},
|
},
|
||||||
handleAddEdge() {
|
handleAddEdge() {
|
||||||
let setObj = {}
|
let setObj = {};
|
||||||
this.$set(setObj, 'testId', this.testId)
|
this.$set(setObj, "testId", this.testId);
|
||||||
this.testId++
|
this.testId++;
|
||||||
this.$set(setObj, 'devName', undefined)
|
this.$set(setObj, "devName", undefined);
|
||||||
this.$set(setObj, 'devCode', undefined)
|
this.$set(setObj, "devCode", undefined);
|
||||||
this.$set(setObj, 'unitName', undefined)
|
this.$set(setObj, "unitName", undefined);
|
||||||
this.$set(setObj, 'areaName', undefined)
|
this.$set(setObj, "areaName", undefined);
|
||||||
this.$set(setObj, 'devUser', undefined)
|
this.$set(setObj, "devUser", undefined);
|
||||||
this.$set(setObj, 'devUserPhone', undefined)
|
this.$set(setObj, "devUserPhone", undefined);
|
||||||
this.$refs.tableRef.tableList.push(setObj)
|
this.$refs.tableRef.tableList.push(setObj);
|
||||||
},
|
},
|
||||||
handleDeleteEdge(v) {
|
handleDeleteEdge(v) {
|
||||||
this.$modal
|
this.$modal
|
||||||
.confirm('是否确认删除该数据项?')
|
.confirm("是否确认删除该数据项?")
|
||||||
.then(() => {
|
.then(() => {
|
||||||
// 这个bug 是因为没有退出 forEach 循环导致的 需要加try catch 退出循环
|
|
||||||
try {
|
|
||||||
this.$refs.tableRef.tableList.forEach((item, index) => {
|
this.$refs.tableRef.tableList.forEach((item, index) => {
|
||||||
if (item.testId === v.testId) {
|
if (item.testId === v.testId) {
|
||||||
this.$refs.tableRef.tableList.splice(index, 1)
|
this.$refs.tableRef.tableList.splice(index, 1);
|
||||||
throw new Error()
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
})
|
})
|
||||||
} catch (error) {}
|
.catch(() => {});
|
||||||
})
|
|
||||||
.catch(() => {})
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/** 获取各类下拉框 */
|
/** 获取各类下拉框 */
|
||||||
|
|
@ -309,56 +278,57 @@ export default {
|
||||||
// 获取项目部下拉选
|
// 获取项目部下拉选
|
||||||
let deptRes = await queryProjDeptListApi({
|
let deptRes = await queryProjDeptListApi({
|
||||||
isAll: 0,
|
isAll: 0,
|
||||||
})
|
});
|
||||||
this.departRange = deptRes.data.map((item) => {
|
this.departRange = deptRes.data.map((item) => {
|
||||||
return {
|
return {
|
||||||
label: item.departName,
|
label: item.departName,
|
||||||
value: item.id,
|
value: item.id,
|
||||||
}
|
};
|
||||||
})
|
});
|
||||||
// 获取工程下拉选
|
// 获取工程下拉选
|
||||||
if (this.subSort == 1) {
|
if(this.subSort==1)
|
||||||
|
{
|
||||||
let projRes = await queryProjApi({
|
let projRes = await queryProjApi({
|
||||||
isAll: 0,
|
isAll: 0,
|
||||||
})
|
});
|
||||||
this.projRange = projRes.data.map((item) => {
|
this.projRange = projRes.data.map((item) => {
|
||||||
return {
|
return {
|
||||||
label: item.proName,
|
label: item.proName,
|
||||||
value: item.id,
|
value: item.id,
|
||||||
}
|
};
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
if(this.subSort==2){
|
if(this.subSort==2){
|
||||||
// 获取工程下拉选
|
// 获取工程下拉选
|
||||||
let projRes = queryProjApi({
|
let projRes = queryProjApi({
|
||||||
isAll: 0,
|
isAll: 0
|
||||||
}).then((projRes) => {
|
}).then(projRes =>{
|
||||||
this.projRange = projRes.data.map((item) => {
|
this.projRange = projRes.data.map((item) => {
|
||||||
return {
|
return {
|
||||||
label: item.proName,
|
label: item.proName,
|
||||||
value: item.id,
|
value: item.id,
|
||||||
}
|
};
|
||||||
})
|
});
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
departChange(e) {
|
departChange(e) {
|
||||||
this.departRange.forEach((item) => {
|
this.departRange.forEach((item) => {
|
||||||
if (e === item.value) {
|
if (e === item.value) {
|
||||||
this.projectParams.departName = item.label
|
this.projectParams.departName = item.label;
|
||||||
this.projectParams.proId = null
|
this.projectParams.proId = null;
|
||||||
if(this.subSort==2){
|
if(this.subSort==2){
|
||||||
// 获取工程下拉选
|
// 获取工程下拉选
|
||||||
let projRes = queryProjApi({
|
let projRes = queryProjApi({
|
||||||
isAll: 0,
|
isAll: 0,
|
||||||
departId: e,
|
departId: e,
|
||||||
}).then((projRes) => {
|
}).then(projRes =>{
|
||||||
this.projRange = projRes.data.map((item) => {
|
this.projRange = projRes.data.map((item) => {
|
||||||
return {
|
return {
|
||||||
label: item.proName,
|
label: item.proName,
|
||||||
value: item.id,
|
value: item.id,
|
||||||
}
|
};
|
||||||
})
|
});
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -367,63 +337,64 @@ export default {
|
||||||
let projRes = queryProjApi({
|
let projRes = queryProjApi({
|
||||||
isAll: 0,
|
isAll: 0,
|
||||||
departId: e,
|
departId: e,
|
||||||
}).then((projRes) => {
|
}).then(projRes =>{
|
||||||
this.projRange = projRes.data.map((item) => {
|
this.projRange = projRes.data.map((item) => {
|
||||||
return {
|
return {
|
||||||
label: item.proName,
|
label: item.proName,
|
||||||
value: item.id,
|
value: item.id,
|
||||||
}
|
};
|
||||||
})
|
});
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
|
||||||
|
});
|
||||||
},
|
},
|
||||||
projChange(e) {
|
projChange(e) {
|
||||||
this.projRange.forEach((item) => {
|
this.projRange.forEach(item => {
|
||||||
if (e === item.value) {
|
if (e === item.value) {
|
||||||
this.projectParams.proName = item.label
|
this.projectParams.proName = item.label;
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
/** 改变树结构 */
|
/** 改变树结构 */
|
||||||
changeTree(leaf) {
|
changeTree(leaf) {
|
||||||
leaf.map((item) => {
|
leaf.map((item) => {
|
||||||
item.value = item.id
|
item.value = item.id;
|
||||||
if (item.children) {
|
if (item.children) {
|
||||||
this.changeTree(item.children)
|
this.changeTree(item.children);
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
return leaf
|
return leaf;
|
||||||
},
|
},
|
||||||
/** 确认按钮 */
|
/** 确认按钮 */
|
||||||
onSubmit() {
|
onSubmit() {
|
||||||
console.log(this.$refs.tableRef.tableList, this.projectParams)
|
console.log(this.$refs.tableRef.tableList, this.projectParams);
|
||||||
this.$refs.projectParamsRef.validate(async (valid) => {
|
this.$refs.projectParamsRef.validate(async (valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
this.projectParams.recordList =
|
this.projectParams.recordList = this.$refs.tableRef.tableList;
|
||||||
this.$refs.tableRef.tableList
|
|
||||||
if (this.subSort === 1) {
|
if (this.subSort === 1) {
|
||||||
let res = await addEdgeDeviceApi(this.projectParams)
|
let res = await addEdgeDeviceApi(this.projectParams);
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
this.$modal.msgSuccess('操作成功')
|
this.$modal.msgSuccess("操作成功");
|
||||||
this.$emit('closeDialog', true)
|
this.$emit("closeDialog", true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let res = await editEdgeDeviceApi(this.projectParams)
|
let res = await editEdgeDeviceApi(this.projectParams);
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
this.$modal.msgSuccess('操作成功')
|
this.$modal.msgSuccess("操作成功");
|
||||||
this.$emit('closeDialog', true)
|
this.$emit("closeDialog", true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
||||||
.ellipsis {
|
.ellipsis {
|
||||||
display: block; /* 确保是块级元素 */
|
display: block; /* 确保是块级元素 */
|
||||||
white-space: nowrap; /* 防止换行 */
|
white-space: nowrap; /* 防止换行 */
|
||||||
|
|
|
||||||
|
|
@ -131,8 +131,8 @@ export default {
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
idCard: [
|
idCard: [
|
||||||
|
{ required: true, message: "身份证号不能为空", trigger: "blur" },
|
||||||
{
|
{
|
||||||
required: true,
|
|
||||||
message: '身份证号格式不正确',
|
message: '身份证号格式不正确',
|
||||||
validator: this.validateIdCard,
|
validator: this.validateIdCard,
|
||||||
trigger: 'blur',
|
trigger: 'blur',
|
||||||
|
|
@ -146,8 +146,8 @@ export default {
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
relPhone: [
|
relPhone: [
|
||||||
|
{ required: true, message: "手机号不能为空", trigger: "blur" },
|
||||||
{
|
{
|
||||||
required: true,
|
|
||||||
message: '手机号格式不正确',
|
message: '手机号格式不正确',
|
||||||
validator: this.validatePhone,
|
validator: this.validatePhone,
|
||||||
trigger: 'blur',
|
trigger: 'blur',
|
||||||
|
|
|
||||||
|
|
@ -123,17 +123,39 @@ export default {
|
||||||
departName: [
|
departName: [
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
message: '请输入项目部名称',
|
message: '请选择项目部名称',
|
||||||
trigger: 'blur',
|
trigger: 'change',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
departType: [
|
departType: [
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
message: '请输入项目部类型',
|
message: '请选择项目部类型',
|
||||||
|
trigger: 'change',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
areaId: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '请选择地区',
|
||||||
|
trigger: 'change',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
headUser: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '请输入负责人',
|
||||||
trigger: 'blur',
|
trigger: 'blur',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
headUserPhone: [
|
||||||
|
{ required: true, message: "负责人电话不能为空", trigger: "blur" },
|
||||||
|
{
|
||||||
|
pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
|
||||||
|
message: "请输入正确的手机号码",
|
||||||
|
trigger: "blur"
|
||||||
|
}
|
||||||
|
],
|
||||||
},
|
},
|
||||||
// 各类下拉
|
// 各类下拉
|
||||||
projRange: [],
|
projRange: [],
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,15 @@
|
||||||
'use strict'
|
"use strict";
|
||||||
const path = require('path')
|
const path = require("path");
|
||||||
|
|
||||||
function resolve(dir) {
|
function resolve(dir) {
|
||||||
return path.join(__dirname, dir)
|
return path.join(__dirname, dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
const CompressionPlugin = require('compression-webpack-plugin')
|
const CompressionPlugin = require("compression-webpack-plugin");
|
||||||
|
|
||||||
const name = process.env.VUE_APP_TITLE || '输变电工程施工现场安全风险预警系统' // 网页标题
|
const name = process.env.VUE_APP_TITLE || "输变电工程施工现场安全风险预警系统"; // 网页标题
|
||||||
|
|
||||||
const port = process.env.port || process.env.npm_config_port || 80 // 端口
|
const port = process.env.port || process.env.npm_config_port || 80; // 端口
|
||||||
|
|
||||||
// vue.config.js 配置说明
|
// vue.config.js 配置说明
|
||||||
//官方vue.config.js 参考文档 https://cli.vuejs.org/zh/config/#css-loaderoptions
|
//官方vue.config.js 参考文档 https://cli.vuejs.org/zh/config/#css-loaderoptions
|
||||||
|
|
@ -18,44 +18,44 @@ module.exports = {
|
||||||
// 部署生产环境和开发环境下的URL。
|
// 部署生产环境和开发环境下的URL。
|
||||||
// 默认情况下,Vue CLI 会假设你的应用是被部署在一个域名的根路径上
|
// 默认情况下,Vue CLI 会假设你的应用是被部署在一个域名的根路径上
|
||||||
// 例如 https://www.bonus.vip/。如果应用被部署在一个子路径上,你就需要用这个选项指定这个子路径。例如,如果你的应用被部署在 https://www.bonus.vip/admin/,则设置 baseUrl 为 /admin/。
|
// 例如 https://www.bonus.vip/。如果应用被部署在一个子路径上,你就需要用这个选项指定这个子路径。例如,如果你的应用被部署在 https://www.bonus.vip/admin/,则设置 baseUrl 为 /admin/。
|
||||||
publicPath: process.env.NODE_ENV === 'production' ? '/' : '/',
|
publicPath: process.env.NODE_ENV === "production" ? "/" : "/",
|
||||||
// 在npm run build 或 yarn build 时 ,生成文件的目录名称(要和baseUrl的生产环境路径一致)(默认dist)
|
// 在npm run build 或 yarn build 时 ,生成文件的目录名称(要和baseUrl的生产环境路径一致)(默认dist)
|
||||||
outputDir: 'dist',
|
outputDir: "dist",
|
||||||
// 用于放置生成的静态资源 (js、css、img、fonts) 的;(项目打包之后,静态资源会放在这个文件夹下)
|
// 用于放置生成的静态资源 (js、css、img、fonts) 的;(项目打包之后,静态资源会放在这个文件夹下)
|
||||||
assetsDir: 'static',
|
assetsDir: "static",
|
||||||
// 是否开启eslint保存检测,有效值:ture | false | 'error'
|
// 是否开启eslint保存检测,有效值:ture | false | 'error'
|
||||||
lintOnSave: process.env.NODE_ENV === 'development',
|
lintOnSave: process.env.NODE_ENV === "development",
|
||||||
// 如果你不需要生产环境的 source map,可以将其设置为 false 以加速生产环境构建。
|
// 如果你不需要生产环境的 source map,可以将其设置为 false 以加速生产环境构建。
|
||||||
productionSourceMap: false,
|
productionSourceMap: false,
|
||||||
// webpack-dev-server 相关配置
|
// webpack-dev-server 相关配置
|
||||||
devServer: {
|
devServer: {
|
||||||
host: '0.0.0.0',
|
host: "0.0.0.0",
|
||||||
port: port,
|
port: port,
|
||||||
open: true,
|
open: true,
|
||||||
proxy: {
|
proxy: {
|
||||||
// detail: https://cli.vuejs.org/config/#devserver-proxy
|
// detail: https://cli.vuejs.org/config/#devserver-proxy
|
||||||
[process.env.VUE_APP_BASE_API]: {
|
[process.env.VUE_APP_BASE_API]: {
|
||||||
target: `http://192.168.2.12:18080`,
|
target: `http://192.168.0.14:19900`,
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
pathRewrite: {
|
pathRewrite: {
|
||||||
['^' + process.env.VUE_APP_BASE_API]: '',
|
["^" + process.env.VUE_APP_BASE_API]: "",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"/api": {
|
||||||
|
target: "192.168.2.12:18080",
|
||||||
|
//设置允许跨域——此处我经过测试发现可有可无
|
||||||
|
changeOrigin: true,
|
||||||
|
pathRewrite: {
|
||||||
|
"^/api": "",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
// "/api": {
|
|
||||||
// target: "192.168.2.12:18080",
|
|
||||||
// //设置允许跨域——此处我经过测试发现可有可无
|
|
||||||
// changeOrigin: true,
|
|
||||||
// pathRewrite: {
|
|
||||||
// "^/api": "",
|
|
||||||
// },
|
|
||||||
// },
|
|
||||||
},
|
},
|
||||||
disableHostCheck: true,
|
disableHostCheck: true,
|
||||||
},
|
},
|
||||||
css: {
|
css: {
|
||||||
loaderOptions: {
|
loaderOptions: {
|
||||||
sass: {
|
sass: {
|
||||||
sassOptions: { outputStyle: 'expanded' },
|
sassOptions: { outputStyle: "expanded" },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
@ -63,7 +63,7 @@ module.exports = {
|
||||||
name: name,
|
name: name,
|
||||||
resolve: {
|
resolve: {
|
||||||
alias: {
|
alias: {
|
||||||
'@': resolve('src'),
|
"@": resolve("src"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
|
|
@ -71,67 +71,67 @@ module.exports = {
|
||||||
new CompressionPlugin({
|
new CompressionPlugin({
|
||||||
cache: false, // 不启用文件缓存
|
cache: false, // 不启用文件缓存
|
||||||
test: /\.(js|css|html|jpe?g|png|gif|svg)?$/i, // 压缩文件格式
|
test: /\.(js|css|html|jpe?g|png|gif|svg)?$/i, // 压缩文件格式
|
||||||
filename: '[path][base].gz[query]', // 压缩后的文件名
|
filename: "[path][base].gz[query]", // 压缩后的文件名
|
||||||
algorithm: 'gzip', // 使用gzip压缩
|
algorithm: "gzip", // 使用gzip压缩
|
||||||
minRatio: 0.8, // 压缩比例,小于 80% 的文件不会被压缩
|
minRatio: 0.8, // 压缩比例,小于 80% 的文件不会被压缩
|
||||||
deleteOriginalAssets: false, // 压缩后删除原文件
|
deleteOriginalAssets: false, // 压缩后删除原文件
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
chainWebpack(config) {
|
chainWebpack(config) {
|
||||||
config.plugins.delete('preload') // TODO: need test
|
config.plugins.delete("preload"); // TODO: need test
|
||||||
config.plugins.delete('prefetch') // TODO: need test
|
config.plugins.delete("prefetch"); // TODO: need test
|
||||||
|
|
||||||
// set svg-sprite-loader
|
// set svg-sprite-loader
|
||||||
config.module.rule('svg').exclude.add(resolve('src/assets/icons')).end()
|
config.module.rule("svg").exclude.add(resolve("src/assets/icons")).end();
|
||||||
config.module
|
config.module
|
||||||
.rule('icons')
|
.rule("icons")
|
||||||
.test(/\.svg$/)
|
.test(/\.svg$/)
|
||||||
.include.add(resolve('src/assets/icons'))
|
.include.add(resolve("src/assets/icons"))
|
||||||
.end()
|
.end()
|
||||||
.use('svg-sprite-loader')
|
.use("svg-sprite-loader")
|
||||||
.loader('svg-sprite-loader')
|
.loader("svg-sprite-loader")
|
||||||
.options({
|
.options({
|
||||||
symbolId: 'icon-[name]',
|
symbolId: "icon-[name]",
|
||||||
})
|
})
|
||||||
.end()
|
.end();
|
||||||
|
|
||||||
config.when(process.env.NODE_ENV !== 'development', (config) => {
|
config.when(process.env.NODE_ENV !== "development", (config) => {
|
||||||
config
|
config
|
||||||
.plugin('ScriptExtHtmlWebpackPlugin')
|
.plugin("ScriptExtHtmlWebpackPlugin")
|
||||||
.after('html')
|
.after("html")
|
||||||
.use('script-ext-html-webpack-plugin', [
|
.use("script-ext-html-webpack-plugin", [
|
||||||
{
|
{
|
||||||
// `runtime` must same as runtimeChunk name. default is `runtime`
|
// `runtime` must same as runtimeChunk name. default is `runtime`
|
||||||
inline: /runtime\..*\.js$/,
|
inline: /runtime\..*\.js$/,
|
||||||
},
|
},
|
||||||
])
|
])
|
||||||
.end()
|
.end();
|
||||||
|
|
||||||
config.optimization.splitChunks({
|
config.optimization.splitChunks({
|
||||||
chunks: 'all',
|
chunks: "all",
|
||||||
cacheGroups: {
|
cacheGroups: {
|
||||||
libs: {
|
libs: {
|
||||||
name: 'chunk-libs',
|
name: "chunk-libs",
|
||||||
test: /[\\/]node_modules[\\/]/,
|
test: /[\\/]node_modules[\\/]/,
|
||||||
priority: 10,
|
priority: 10,
|
||||||
chunks: 'initial', // only package third parties that are initially dependent
|
chunks: "initial", // only package third parties that are initially dependent
|
||||||
},
|
},
|
||||||
elementUI: {
|
elementUI: {
|
||||||
name: 'chunk-elementUI', // split elementUI into a single package
|
name: "chunk-elementUI", // split elementUI into a single package
|
||||||
test: /[\\/]node_modules[\\/]_?element-ui(.*)/, // in order to adapt to cnpm
|
test: /[\\/]node_modules[\\/]_?element-ui(.*)/, // in order to adapt to cnpm
|
||||||
priority: 20, // the weight needs to be larger than libs and app or it will be packaged into libs or app
|
priority: 20, // the weight needs to be larger than libs and app or it will be packaged into libs or app
|
||||||
},
|
},
|
||||||
commons: {
|
commons: {
|
||||||
name: 'chunk-commons',
|
name: "chunk-commons",
|
||||||
test: resolve('src/components'), // can customize your rules
|
test: resolve("src/components"), // can customize your rules
|
||||||
minChunks: 3, // minimum common number
|
minChunks: 3, // minimum common number
|
||||||
priority: 5,
|
priority: 5,
|
||||||
reuseExistingChunk: true,
|
reuseExistingChunk: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
});
|
||||||
config.optimization.runtimeChunk('single')
|
config.optimization.runtimeChunk("single");
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
}
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue