Commit 4a7599b0 authored by 周远喜's avatar 周远喜

Merge branch 'product' of http://git.mes123.com/zhouyx/mes-ui into product

parents 12c8bc91 6b5b68d7
import XLSX from 'xlsx'; import XLSX from 'xlsx';
import Api from '@/plugins/request'
let henq = {}; let henq = {};
let pdfInfo = '' let pdfInfo = ''
henq.clone = (obj) => { henq.clone = (obj) => {
...@@ -169,38 +170,37 @@ henq.findRoots = (arr1, id) => { ...@@ -169,38 +170,37 @@ henq.findRoots = (arr1, id) => {
//省市县pacc转为list //省市县pacc转为list
henq.treeToList1 = (tree) => { henq.treeToList1 = (tree) => {
let list = []; let list = [];
function treeToList1(data) { function treeToList1(data) {
data.map(u => { data.map(u => {
if (u.children&&u.level!=1) { if (u.children && u.level != 1) {
treeToList1(u.children, u) treeToList1(u.children, u)
} } else if (u.children && u.level == 1) {
else if(u.children&&u.level==1) list = list.concat(u.children);
{
list=list.concat(u.children);
} }
}) })
} }
treeToList1(tree, null) treeToList1(tree, null)
return list; return list;
} }
//根据departId返出上级所有name //根据departId返出上级所有name
henq.getDepartAllName = (list,id) => { henq.getDepartAllName = (list, id) => {
let names = ''; let names = '';
function getDepartAllName(list,id) {
function getDepartAllName(list, id) {
list.map(u => { list.map(u => {
if(id==u.id) if (id == u.id) {
{ names = u.name + "/" + names
names=u.name+"/"+names if (u.parent_Id > 0) {
if (u.parent_Id>0) { getDepartAllName(list, u.parent_Id)
getDepartAllName(list, u.parent_Id) }
} }
}
}) })
} }
getDepartAllName(list,id) getDepartAllName(list, id)
return names.slice(0,names.length-1); return names.slice(0, names.length - 1);
} }
//导出pdf //导出pdf
henq.outPdf = (ele, fileName) => { henq.outPdf = (ele, fileName) => {
...@@ -343,4 +343,212 @@ henq.dirCode = (code, v) => { ...@@ -343,4 +343,212 @@ henq.dirCode = (code, v) => {
} }
return items return items
} }
henq.makeRules = (list, apiUrl) => {
//测试数据start
list = [{ //普通输入框
columnDescription: "测试列1", // 中文名称
dbColumnName: "colums1", // 字段名称
dataType: "varchar", // 数据库中字段类型
propertyName: "colums1", //程序中的字段名称
propertyType: "String", // 程序中的字段类型
code: "", // 数据字典编码
isNullable: false, // 是否可空
isKey: false, // 是否主键
unit: "", // 单位
length: 50, //
decimalDigits: 0, // 精度
link: 0, //外键 表的
defaultValue: "", // 默认值
control: 0,
uniqueness: 0, // 唯一性 0 不限制 1 表内唯一 2 表内某条件下唯一
ruleType: "", // 邮箱 ,电话,等
},
{ //数据字典项
columnDescription: "测试列2",
dbColumnName: "colums2",
dataType: "int32",
propertyName: "colums2",
propertyType: "int",
code: "aps.plan.status",
isNullable: false,
isKey: false,
unit: "",
length: 50,
decimalDigits: 0,
link: 0,
defaultValue: "",
control: 0,
uniqueness: 0,
ruleType: "",
},
{ //手机号码
columnDescription: "测试列3",
dbColumnName: "colums3",
dataType: "varchar",
propertyName: "colums3",
propertyType: "int",
code: "",
isNullable: false,
isKey: false,
unit: "",
length: 50,
decimalDigits: 0,
link: 0,
defaultValue: "",
control: 0,
uniqueness: 0,
ruleType: "phone",
},
{ //电子邮件
columnDescription: "测试列4",
dbColumnName: "colums4",
dataType: "varchar",
propertyName: "colums4",
propertyType: "String",
code: "",
isNullable: false,
isKey: false,
unit: "",
length: 50,
decimalDigits: 0,
link: 0,
defaultValue: "",
control: 0,
uniqueness: 0,
ruleType: "email",
},
{ //唯一性api接口校验
columnDescription: "测试列5",
dbColumnName: "colums5",
dataType: "varchar",
propertyName: "colums5",
propertyType: "String",
code: "",
isNullable: false,
isKey: false,
unit: "",
length: 50,
decimalDigits: 0,
link: 0,
defaultValue: "",
control: 0,
uniqueness: 1, //表内唯一验证
ruleType: "",
},
{ //日期校验
columnDescription: "测试列6",
dbColumnName: "colums6",
dataType: "datetime",
propertyName: "colums6",
propertyType: "String",
code: "",
isNullable: false,
isKey: false,
unit: "",
length: 50,
decimalDigits: 0,
link: 0,
defaultValue: "",
control: 0,
uniqueness: 0, //表内唯一验证
ruleType: "datetime",
}
]
apiUrl = `${systemUrl}/user/list`
//测试数据end
//唯一性校验
const validateCol = (rule, value, callback) => {
if (!value) {
return callback(new Error("输入不能为空"));
}
var params1 = {
"conditions": [{
"fieldName": "cardNo",
"fieldValue": value,
"conditionalType": "Equal"
}],
"pageSize": 3
}
Api.post(apiUrl, params1).then((r) => {
if (r.result.length > 0) {
return callback(new Error("输入数据已经存在"));
} else {
callback();
}
})
};
//手机号验证
const valideTel = (rule, value, callback) => {
var re = /^1[3-9]{1}[0-9]{9}/;
if (value === "" || value === null) {
callback(new Error("请输入手机号"));
} else if (!re.test(value)) {
callback(new Error("请输入正确手机号"));
} else {
callback();
}
}
let rules = {}
list.forEach(el => {
if (!el.isNullable) {
let objInfo = {}
rules[el.propertyName] = []
if (el.code == '') { //不能为空,必填文本或数字类型
if (el.ruleType == '') {
objInfo = {
required: true,
message: "必填",
trigger: "blur"
}
if (el.uniqueness != 0) {
var objUniqueness = {
validator: validateCol,
trigger: "blur"
}
}
} else if (el.ruleType == 'email') {
objInfo = {
required: true,
message: '必填',
trigger: 'blur',
type: 'email'
}
} else if (el.ruleType == 'phone') {
objInfo = {
validator: valideTel,
required: true,
trigger: "blur"
}
}
else if (el.ruleType == 'datetime')
{
objInfo = {
required: true,
message: "请选择时间",
trigger: "change"
}
}
} else { //数据字典
objInfo = {
required: true,
message: "必选",
trigger: "change",
type: "number",
}
}
rules[el.propertyName].push(objInfo)
if (el.uniqueness != 0) {
rules[el.propertyName].push(objUniqueness)
}
}
})
return rules
}
export default henq; export default henq;
...@@ -322,9 +322,9 @@ export default { ...@@ -322,9 +322,9 @@ export default {
this.goMethod(params.row) : null, this.goMethod(params.row) : null,
}, },
}, },
params.row.mainRoutingSetStatus == 0 ? params.row.mainRoutingSetStatus == 0 && params.row.isPreschedule == 0 ?
"工艺派发" : "工艺派发" :
params.row.mainRoutingSetStatus == 1 ? params.row.mainRoutingSetStatus == 1 && params.row.isPreschedule == 0 ?
"移入排产" : "移入排产" :
"" ""
), ),
......
<template> <template>
<div style="width:100%;"> <div style="width:100%;">
<Form :model="orderSearchForm" :label-width="95" :rules="ruleValidate" ref="formValidate"> <Form :model="orderSearchForm" :label-width="95" :rules="ruleValidate" ref="formValidate">
<Row> <Row>
<Col span="8"> <Col span="8">
<FormItem label="产品名称" style="width:100%" prop="productId"> <FormItem label="产品名称" style="width:100%" prop="productId">
<Select <Select v-model="orderSearchForm.productId" :placeholder="placeholdeinfo" style="width:240px;">
v-model="orderSearchForm.productId" <Option v-for="(item,index) in list" :key="item.index" :value="item.value" :label="item.label" style="display:none"></Option>
:placeholder="placeholdeinfo" <Tree key="mytree" :data="data1" ref="mytree" :render="renderContent"></Tree>
style="width:240px;" </Select>
> </FormItem>
<Option </Col>
v-for="(item,index) in list" <Col span="8">
:key="item.index" <FormItem label="产品图号" style="width:100%">
:value="item.value" <Input v-model="orderSearchForm.drawnNumber" style="width:240px" disabled />
:label="item.label" <Input v-model="orderSearchForm.productName" style="width:240px" v-show="false" />
style="display:none" <Input v-model="orderSearchForm.bomId" style="width:240px" v-show="false" />
></Option> </FormItem>
<Tree key="mytree" :data="data1" ref="mytree" :render="renderContent"></Tree> </Col>
</Select> <Col span="8">
</FormItem> <FormItem label="任务类型" style="width:100%" prop="taskType">
</Col> <dictionary code="plan.order.taskType" v-model="orderSearchForm.taskType" style="width:240px"></dictionary>
<Col span="8"> </FormItem>
<FormItem label="产品图号" style="width:100%"> </Col>
<Input v-model="orderSearchForm.drawnNumber" style="width:240px" disabled /> </Row>
<Input v-model="orderSearchForm.productName" style="width:240px" v-show="false" /> <Row>
<Input v-model="orderSearchForm.bomId" style="width:240px" v-show="false" /> <Col span="8">
</FormItem> <FormItem label="数量" style="width:100%" prop="quantity">
</Col> <InputNumber :min="0" v-model="orderSearchForm.quantity" style="width:240px"></InputNumber>
<Col span="8"> </FormItem>
<FormItem label="任务类型" style="width:100%" prop="taskType"> </Col>
<dictionary <Col span="8">
code="plan.order.taskType" <FormItem label="开始时间" style="width:100%">
v-model="orderSearchForm.taskType" <DatePicker type="date" placeholder="请选择日期" style="width:240px" @on-change="getStartDate" v-model="orderSearchForm.demandStartDate"></DatePicker>
style="width:240px" </FormItem>
></dictionary> </Col>
</FormItem> <Col span="8">
</Col> <FormItem label="完成时间" style="width:100%">
</Row> <DatePicker type="date" placeholder="请选择日期" style="width:240px" @on-change="getFinishedDate" v-model="orderSearchForm.demandFinishDate"></DatePicker>
<Row> </FormItem>
<Col span="8"> </Col>
<FormItem label="数量" style="width:100%" prop="quantity"> </Row>
<InputNumber :min="0" v-model="orderSearchForm.quantity" style="width:240px"></InputNumber> <Row>
</FormItem> <Col span="8">
</Col> <FormItem label="项目号" style="width:100%">
<Col span="8"> <Input v-model="orderSearchForm.projectNumber" style="width:240px" />
<FormItem label="开始时间" style="width:100%"> </FormItem>
<DatePicker </Col>
type="date" <Col span="8">
placeholder="请选择日期" <FormItem label="批次号" style="width:100%">
style="width:240px" <Input v-model="orderSearchForm.batchNumber" style="width:240px" />
@on-change="getStartDate" </FormItem>
v-model="orderSearchForm.demandStartDate" </Col>
></DatePicker> <Col span="8">
</FormItem> <FormItem label="紧急程度" style="width:100%">
</Col> <dictionary style="width:240px" code="plan.order.urgencyLevel" v-model="orderSearchForm.urgencyLevel"></dictionary>
<Col span="8"> </FormItem>
<FormItem label="完成时间" style="width:100%"> </Col>
<DatePicker </Row>
type="date" <Row>
placeholder="请选择日期" <Col span="24">
style="width:240px" <FormItem label="任务要求" style="width:100%">
@on-change="getFinishedDate" <Input v-model="orderSearchForm.taskRequire" placeholder />
v-model="orderSearchForm.demandFinishDate" </FormItem>
></DatePicker> </Col>
</FormItem> <Col span="24">
</Col> <FormItem label="备注" style="width:100%">
</Row> <Input v-model="orderSearchForm.remark" placeholder type="textarea" :rows="3" />
<Row> </FormItem>
<Col span="8"> </Col>
<FormItem label="项目号" style="width:100%"> <Col span="24">
<Input v-model="orderSearchForm.projectNumber" style="width:240px" /> <FormItem>
</FormItem> <Button type="primary" @click="handleSubmit" v-noClick>保存</Button>
</Col> <Button @click="handleClose" class="ml20">取消</Button>
<Col span="8"> </FormItem>
<FormItem label="批次号" style="width:100%"> </Col>
<Input v-model="orderSearchForm.batchNumber" style="width:240px" /> </Row>
</FormItem>
</Col>
<Col span="8">
<FormItem label="紧急程度" style="width:100%">
<dictionary
style="width:240px"
code="plan.order.urgencyLevel"
v-model="orderSearchForm.urgencyLevel"
></dictionary>
</FormItem>
</Col>
</Row>
<Row>
<Col span="24">
<FormItem label="任务要求" style="width:100%">
<Input v-model="orderSearchForm.taskRequire" placeholder />
</FormItem>
</Col>
<Col span="24">
<FormItem label="备注" style="width:100%">
<Input v-model="orderSearchForm.remark" placeholder type="textarea" :rows="3" />
</FormItem>
</Col>
<Col span="24">
<FormItem>
<Button type="primary" @click="handleSubmit" v-noClick>保存</Button>
<Button @click="handleClose" class="ml20">取消</Button>
</FormItem>
</Col>
</Row>
</Form> </Form>
</div> </div>
</template> </template>
<script>
<script>
var myDate = new Date(); var myDate = new Date();
var dayTomorrow = new Date(); var dayTomorrow = new Date();
dayTomorrow.setTime(dayTomorrow.getTime() + 24 * 60 * 60 * 1000); dayTomorrow.setTime(dayTomorrow.getTime() + 24 * 60 * 60 * 1000);
var nowDate = var nowDate =
myDate.getFullYear() + "-" + (myDate.getMonth() + 1) + "-" + myDate.getDate(); myDate.getFullYear() + "-" + (myDate.getMonth() + 1) + "-" + myDate.getDate();
var tomorrowDate = var tomorrowDate =
dayTomorrow.getFullYear() + dayTomorrow.getFullYear() +
"-" + "-" +
(dayTomorrow.getMonth() + 1) + (dayTomorrow.getMonth() + 1) +
"-" + "-" +
dayTomorrow.getDate(); dayTomorrow.getDate();
import Api from "./api"; import Api from "./api";
export default { export default {
name: "Add", name: "Add",
data() { data() {
return { return {
divHeight: "260px", divHeight: "260px",
list: [], list: [],
data1: [], data1: [],
selectdata: [], selectdata: [],
placeholdeinfo: "请选择", placeholdeinfo: "请选择",
orderSearchForm: { orderSearchForm: {
id: null, id: null,
productId: null, //产品id productId: null, //产品id
productName: "", //产品名称 productName: "", //产品名称
drawnNumber: null, //图号 drawnNumber: null, //图号
taskType: null, //任务类型 taskType: null, //任务类型
quantity: 1, //数量 quantity: 1, //数量
taskRequire: "", //任务接点要求 taskRequire: "", //任务接点要求
demandStartDate: this.getFormatDate(nowDate), //开始时间 demandStartDate: this.getFormatDate(nowDate), //开始时间
demandFinishDate: this.getFormatDateEnd(tomorrowDate), //完成时间 demandFinishDate: this.getFormatDateEnd(tomorrowDate), //完成时间
remark: "", //备注 remark: "", //备注
projectNumber: "", //项目号 projectNumber: "", //项目号
batchNumber: "", //批次号 batchNumber: "", //批次号
urgencyLevel: null, //紧急程度 urgencyLevel: null, //紧急程度
bomId: null, bomId: null,
},
ruleValidate: {
productId: [
{
required: true,
message: "请选择产品名称",
type: "number",
trigger: "change",
},
],
taskType: [
{
required: true,
message: "请选择任务类型",
trigger: "change",
type: "number",
},
],
quantity: [
{
required: true,
message: "请输入数量",
type: "number",
trigger: "change",
},
],
},
wfstatu: 1,
};
},
mounted() {
let params = {
id: "123327da-42b3-41f6-b785-cf933f137a95",
};
this.$api.get(`${workflowUrl}/schema/getbyid`, params).then((res) => {
if (res.success) {
let wfStatus = res.result.status;
if (wfStatus == 0) {
this.wfstatu = 1;
} else {
this.wfstatu = 3;
}
}
});
this.loadTree();
},
methods: {
handleSubmit() {
this.$refs.formValidate.validate((v) => {
if (v) {
this.orderSearchForm.status = this.wfstatu;
Api.mesplancreate(this.orderSearchForm)
.then((r) => {
if (r.success) {
this.$Message.success("保存成功");
this.$emit("on-ok");
} else {
this.$Message.error("保存失败");
}
})
.catch((err) => {
this.$Message.error("保存失败");
console.warn(err);
});
}
});
},
handleClose() {
this.resetFields();
this.$emit("on-close");
},
l(key) {
key = "mes_plan" + "." + key;
return this.$t(key);
},
handleSelect(data) {
// console.log(data);
if (data.length > 0) {
this.selectdata = [];
this.selectdata = data;
this.list = [];
this.list.push({ label: data[0].title, value: data[0].id });
if (data[0].isProduct == 1) {
this.orderSearchForm.productName = data[0].title;
this.orderSearchForm.productId = data[0].productId;
this.orderSearchForm.drawnNumber = data[0].drawingNo;
this.orderSearchForm.bomId = data[0].bomId;
} else {
this.$Message.error("此节点不是产品,请选择产品节点!");
}
}
},
resetFields() {
this.orderSearchForm = {
productId: null, //产品id
productName: "", //产品名称
drawnNumber: null, //图号
taskType: null, //任务类型
quantity: 1, //数量
taskRequire: "", //任务接点要求
demandStartDate: this.getFormatDate(nowDate), //开始时间
demandFinishDate: this.getFormatDateEnd(tomorrowDate), //完成时间
remark: "", //备注
projectNumber: "", //项目号
batchNumber: "", //批次号
urgencyLevel: null, //紧急程度
};
},
loadTree() {
//打开新增订单窗口加载产品
this.resetFields();
var sumData = [];
this.$http.order.getallselecttree().then((res) => {
if (res.result) {
for (var i = 0; i < res.result.length; i++) {
sumData = sumData.concat(res.result[i]);
}
this.data1 = sumData;
} else {
this.$Message.error("加载产品树失败!");
}
});
},
renderContent(h, { root, node, data }) {
let type = "md-folder";
let title = data.title;
if (data.isProduct != 0) {
let version = this.$store.getters.dictionaryByCode(
"material.main.version",
data.version
);
type = "ios-image";
if (version) {
title = data.title + "(" + data.mmcode + "/" + version.name + ")";
} else {
title = data.title + "(" + data.mmcode + ")";
}
}
return h(
"span",
{
on: {
click: () => {
let arrTree = [];
arrTree.push(data);
this.handleSelect(arrTree); //手动选择树节点
},
},
},
[
h("Icon", {
props: {
type: type,
},
style: {
marginRight: "8px",
}, },
}), ruleValidate: {
h( productId: [{
"span", required: true,
{ message: "请选择产品名称",
style: { type: "number",
color: data.isProduct == 0 ? "#000" : "rgba(38, 128, 235, 1)", trigger: "change",
}, }, ],
taskType: [{
required: true,
message: "请选择任务类型",
trigger: "change",
type: "number",
}, ],
quantity: [{
required: true,
message: "请输入数量",
type: "number",
trigger: "change",
}, ],
}, },
title
), wfstatu: 1,
] };
);
},
//时间相关start
getStartDate(value) {
if (value == "") {
this.orderSearchForm.demandStartDate = this.getFormatDate(nowDate);
} else {
this.orderSearchForm.demandStartDate = this.getFormatDate(value);
}
},
getFinishedDate(value) {
if (value == "") {
this.orderSearchForm.demandFinishDate = this.getFormatDateEnd(
tomorrowDate
);
} else {
this.orderSearchForm.demandFinishDate = this.getFormatDateEnd(value);
}
},
getFormatDate(dates) {
const d = new Date(dates);
const resDate =
d.getFullYear() +
"-" +
this.p(d.getMonth() + 1) +
"-" +
this.p(d.getDate()) +
" 00:00:01";
return resDate;
}, },
getFormatDateEnd(dates) { mounted() {
const d = new Date(dates); let params = {
const resDate = id: "123327da-42b3-41f6-b785-cf933f137a95",
d.getFullYear() + };
"-" + this.$api.get(`${workflowUrl}/schema/getbyid`, params).then((res) => {
this.p(d.getMonth() + 1) + if (res.success) {
"-" + let wfStatus = res.result.status;
this.p(d.getDate()) + if (wfStatus == 0) {
" 23:59:59"; this.wfstatu = 1;
return resDate; } else {
this.wfstatu = 3;
}
}
});
this.loadTree();
}, },
p(s) { methods: {
return s < 10 ? "0" + s : s; handleSubmit() {
this.$refs.formValidate.validate((v) => {
if (v) {
this.orderSearchForm.status = this.wfstatu;
Api.mesplancreate(this.orderSearchForm)
.then((r) => {
if (r.success) {
this.$Message.success("保存成功");
this.$emit("on-ok");
} else {
this.$Message.error("保存失败");
}
})
.catch((err) => {
this.$Message.error("保存失败");
console.warn(err);
});
}
});
},
handleClose() {
this.resetFields();
this.$emit("on-close");
},
l(key) {
key = "mes_plan" + "." + key;
return this.$t(key);
},
handleSelect(data) {
// console.log(data);
if (data.length > 0) {
this.selectdata = [];
this.selectdata = data;
this.list = [];
this.list.push({
label: data[0].title,
value: data[0].id
});
if (data[0].isProduct == 1) {
this.orderSearchForm.productName = data[0].title;
this.orderSearchForm.productId = data[0].productId;
this.orderSearchForm.drawnNumber = data[0].drawingNo;
this.orderSearchForm.bomId = data[0].bomId;
} else {
this.$Message.error("此节点不是产品,请选择产品节点!");
}
}
},
resetFields() {
this.orderSearchForm = {
productId: null, //产品id
productName: "", //产品名称
drawnNumber: null, //图号
taskType: null, //任务类型
quantity: 1, //数量
taskRequire: "", //任务接点要求
demandStartDate: this.getFormatDate(nowDate), //开始时间
demandFinishDate: this.getFormatDateEnd(tomorrowDate), //完成时间
remark: "", //备注
projectNumber: "", //项目号
batchNumber: "", //批次号
urgencyLevel: null, //紧急程度
};
},
loadTree() {
//打开新增订单窗口加载产品
this.resetFields();
var sumData = [];
this.$http.order.getallselecttree().then((res) => {
if (res.result) {
for (var i = 0; i < res.result.length; i++) {
sumData = sumData.concat(res.result[i]);
}
this.data1 = sumData;
} else {
this.$Message.error("加载产品树失败!");
}
});
},
renderContent(h, {
root,
node,
data
}) {
let type = "md-folder";
let title = data.title;
if (data.isProduct != 0) {
let version = this.$store.getters.dictionaryByCode(
"material.main.version",
data.version
);
type = "ios-image";
if (version) {
title = data.title + "(" + data.mmcode + "/" + version.name + ")";
} else {
title = data.title + "(" + data.mmcode + ")";
}
}
return h(
"span", {
on: {
click: () => {
let arrTree = [];
arrTree.push(data);
this.handleSelect(arrTree); //手动选择树节点
},
},
},
[
h("Icon", {
props: {
type: type,
},
style: {
marginRight: "8px",
},
}),
h(
"span", {
style: {
color: data.isProduct == 0 ? "#000" : "rgba(38, 128, 235, 1)",
},
},
title
),
]
);
},
//时间相关start
getStartDate(value) {
if (value == "") {
this.orderSearchForm.demandStartDate = this.getFormatDate(nowDate);
} else {
this.orderSearchForm.demandStartDate = this.getFormatDate(value);
}
},
getFinishedDate(value) {
if (value == "") {
this.orderSearchForm.demandFinishDate = this.getFormatDateEnd(
tomorrowDate
);
} else {
this.orderSearchForm.demandFinishDate = this.getFormatDateEnd(value);
}
},
getFormatDate(dates) {
const d = new Date(dates);
const resDate =
d.getFullYear() +
"-" +
this.p(d.getMonth() + 1) +
"-" +
this.p(d.getDate()) +
" 00:00:01";
return resDate;
},
getFormatDateEnd(dates) {
const d = new Date(dates);
const resDate =
d.getFullYear() +
"-" +
this.p(d.getMonth() + 1) +
"-" +
this.p(d.getDate()) +
" 23:59:59";
return resDate;
},
p(s) {
return s < 10 ? "0" + s : s;
},
//时间相关end
}, },
//时间相关end
},
}; };
</script> </script>
<template> <template>
<Form ref="form" :model="entity" :rules="rules" :label-width="90"> <Form ref="form" :model="entity" :rules="rules" :label-width="90">
<Row> <Row>
<!-- <Col :span="12" <Col span="8">
<FormItem :label="l('picture')" prop="picture">
<inputFile
class="tphoto"
ref="refmovieFile1"
v-model="imgName"
:parms="parmsName"
/>
</FormItem>
<div class="img-touxiang">
<img :src="avatorPath" v-if="imgName" @click="imgUrl" class="img1" />
<img
src="@/assets/images/files_header.png"
v-else
width="100%"
height="100%"
/>
</div>
</Col>
<Col span="16">
<!-- <Col :span="12"
><FormItem :label="l('creationTime')" prop="creationTime"> ><FormItem :label="l('creationTime')" prop="creationTime">
<DatePicker <DatePicker
type="date" type="date"
v-model="entity.creationTime" v-model="entity.creationTime"
></DatePicker> </FormItem ></DatePicker> </FormItem
></Col> --> ></Col> -->
<!-- <Col :span="12" <!-- <Col :span="12"
><FormItem :label="l('creatorUserId')" prop="creatorUserId"> ><FormItem :label="l('creatorUserId')" prop="creatorUserId">
<InputNumber v-model="entity.creatorUserId"></InputNumber> </FormItem <InputNumber v-model="entity.creatorUserId"></InputNumber> </FormItem
></Col> --> ></Col> -->
<!-- <Col :span="12" <!-- <Col :span="12"
><FormItem ><FormItem
:label="l('lastModificationTime')" :label="l('lastModificationTime')"
prop="lastModificationTime" prop="lastModificationTime"
...@@ -22,13 +42,13 @@ ...@@ -22,13 +42,13 @@
v-model="entity.lastModificationTime" v-model="entity.lastModificationTime"
></DatePicker> </FormItem ></DatePicker> </FormItem
></Col> --> ></Col> -->
<!-- <Col :span="12" <!-- <Col :span="12"
><FormItem :label="l('lastModifierUserId')" prop="lastModifierUserId"> ><FormItem :label="l('lastModifierUserId')" prop="lastModifierUserId">
<InputNumber <InputNumber
v-model="entity.lastModifierUserId" v-model="entity.lastModifierUserId"
></InputNumber> </FormItem ></InputNumber> </FormItem
></Col> --> ></Col> -->
<!-- <Col :span="12" <!-- <Col :span="12"
><FormItem :label="l('isDeleted')" prop="isDeleted"> ><FormItem :label="l('isDeleted')" prop="isDeleted">
<InputNumber v-model="entity.isDeleted"></InputNumber> </FormItem <InputNumber v-model="entity.isDeleted"></InputNumber> </FormItem
></Col> ></Col>
...@@ -39,75 +59,74 @@ ...@@ -39,75 +59,74 @@
v-model="entity.deletionTime" v-model="entity.deletionTime"
></DatePicker> </FormItem ></DatePicker> </FormItem
></Col> --> ></Col> -->
<!-- <Col :span="12" <!-- <Col :span="12"
><FormItem :label="l('deleterUserId')" prop="deleterUserId"> ><FormItem :label="l('deleterUserId')" prop="deleterUserId">
<InputNumber v-model="entity.deleterUserId"></InputNumber> </FormItem <InputNumber v-model="entity.deleterUserId"></InputNumber> </FormItem
></Col> --> ></Col> -->
<Col :span="12" <Col :span="12"
><FormItem :label="l('title')" prop="title"> ><FormItem :label="l('title')" prop="title">
<Input v-model="entity.title"> </Input> </FormItem <Input v-model="entity.title"> </Input> </FormItem
></Col> ></Col>
<Col :span="12" <Col :span="12"
><FormItem :label="l('state')" prop="state"> ><FormItem :label="l('state')" prop="state">
<Dictionary <Dictionary
code="mes.project_main.State" code="project.main.state"
v-model="entity.state" v-model="entity.state"
></Dictionary> </FormItem ></Dictionary> </FormItem
></Col> ></Col>
<Col :span="12" <Col :span="12"
><FormItem :label="l('type')" prop="type"> ><FormItem :label="l('startDate')" prop="startDate">
<Dictionary <DatePicker
code="mes.project_main.Type" type="date"
v-model="entity.type" v-model="entity.startDate"
></Dictionary> </FormItem ></DatePicker> </FormItem
></Col> ></Col>
<Col :span="12" <Col :span="12"
><FormItem :label="l('picture')" prop="picture"> ><FormItem :label="l('endDate')" prop="endDate">
<Input v-model="entity.picture"> </Input> </FormItem <DatePicker
></Col> type="date"
<Col :span="12" v-model="entity.endDate"
><FormItem :label="l('attachment')" prop="attachment"> ></DatePicker> </FormItem
<Input v-model="entity.attachment"> </Input> </FormItem ></Col>
></Col> <Col :span="12"
<Col :span="12" ><FormItem :label="l('type')" prop="type">
><FormItem :label="l('phase')" prop="phase"> <Dictionary
<Dictionary code="project.main.type"
code="mes.project_main.Phase" v-model="entity.type"
v-model="entity.phase" ></Dictionary> </FormItem
></Dictionary> </FormItem ></Col>
></Col> <!--
<Col :span="12" <Col :span="12"
><FormItem :label="l('startDate')" prop="startDate"> ><FormItem :label="l('phase')" prop="phase">
<DatePicker <Dictionary
type="date" code="mes.project_main.Phase"
v-model="entity.startDate" v-model="entity.phase"
></DatePicker> </FormItem ></Dictionary> </FormItem
></Col> ></Col> -->
<Col :span="12"
><FormItem :label="l('endDate')" prop="endDate"> <!-- <Col :span="12"
<DatePicker ><FormItem :label="l('businessUnits')" prop="businessUnits">
type="date" <Input v-model="entity.businessUnits"> </Input> </FormItem
v-model="entity.endDate" ></Col> -->
></DatePicker> </FormItem <Col :span="24">
></Col> <FormItem :label="l('attachment')" prop="attachment">
<Col :span="12" <!-- <Input v-model="entity.template" type="textarea" :rows="5"></Input> -->
><FormItem :label="l('businessUnits')" prop="businessUnits"> <files ref="refFile" :parms="parms" files />
<Input v-model="entity.businessUnits"> </Input> </FormItem </FormItem>
></Col> </Col>
<Col :span="24" <Col :span="24"
><FormItem :label="l('note')" prop="note"> ><FormItem :label="l('note')" prop="note">
<Input <Input
v-model="entity.note" v-model="entity.note"
type="textarea" type="textarea"
:rows="5" :rows="5"
></Input> </FormItem ></Input> </FormItem
></Col> ></Col>
</Col>
</Row> </Row>
<FormItem> <FormItem>
<Button type="primary" @click="handleSubmit" :disabled="disabled" <Button type="primary" @click="handleSubmit" v-noClick>保存</Button>
>保存</Button
>
<Button @click="handleClose" class="ml20">取消</Button> <Button @click="handleClose" class="ml20">取消</Button>
</FormItem> </FormItem>
</Form> </Form>
...@@ -119,6 +138,8 @@ export default { ...@@ -119,6 +138,8 @@ export default {
data() { data() {
return { return {
disabled: false, disabled: false,
imgName: "",
avatorPath: "",
entity: { entity: {
// creationTime: null, // creationTime: null,
creatorUserId: this.$store.state.userInfo.userId, creatorUserId: this.$store.state.userInfo.userId,
...@@ -141,6 +162,13 @@ export default { ...@@ -141,6 +162,13 @@ export default {
rules: { rules: {
name: [{ required: true, message: "必填", trigger: "blur" }], name: [{ required: true, message: "必填", trigger: "blur" }],
}, },
parmsName: "app=material&eid=1&name=ProjectMain",
parms: {
app: "material",
eid: null,
name: "",
field: "",
},
}; };
}, },
props: { props: {
...@@ -148,15 +176,24 @@ export default { ...@@ -148,15 +176,24 @@ export default {
eid: Number, eid: Number,
}, },
mounted() { mounted() {
if (this.eid > 0) { // if (this.eid > 0) {
this.load(this.eid); // this.load(this.eid);
} // }
this.$refs.refmovieFile1.inputShow = false;
this.parms.eid = this.$u.guid();
}, },
methods: { methods: {
imgUrl() {
window.open(this.avatorPath, "_blank");
},
handleSubmit() { handleSubmit() {
this.$refs.form.validate((v) => { this.$refs.form.validate((v) => {
if (v) { if (v) {
this.disabled = true; if (this.$refs.refFile.nameList.length > 0) {
this.entity.attachment = this.parms.eid;
} else {
this.entity.attachment = "";
}
Api.create(this.entity) Api.create(this.entity)
.then((r) => { .then((r) => {
this.disabled = false; this.disabled = false;
...@@ -198,6 +235,12 @@ export default { ...@@ -198,6 +235,12 @@ export default {
this.load(v); this.load(v);
} }
}, },
imgName(newName, oldName) {
console.log(newName);
const imgPathsArr = JSON.parse(newName);
this.entity.picture = imgPathsArr[0].filePath;
this.avatorPath = fileUrlDown + imgPathsArr[0].filePath;
},
}, },
}; };
</script> </script>
\ No newline at end of file
<style lang="less"> <style lang="less">
.test_layout { .test_layout {
height: 100%; height: 100%;
.bg1 {
background: #fefefe; .bg1 {
} background: #fefefe;
// &.fg { }
// // overflow: auto;
// } // &.fg {
// // overflow: auto;
// }
} }
.layout-copy { .layout-copy {
text-align: center; text-align: center;
padding: 10px 0 20px; padding: 10px 0 20px;
color: #9ea7b4; color: #9ea7b4;
} }
</style> </style>
<template> <template>
<div class="flex fd test_layout"> <div class="flex fd test_layout">
<div> <div>
<Menu mode="horizontal" theme="light" active-name="a0"> <Menu mode="horizontal" theme="light" active-name="a0">
<div class="layout-assistant"> <div class="layout-assistant">
<MenuItem name="a0" to="/test/example">基础组件</MenuItem> <MenuItem name="a0" to="/test/example">基础组件</MenuItem>
<MenuItem name="a1" to="/test/user">人员选择</MenuItem> <MenuItem name="a1" to="/test/user">人员选择</MenuItem>
<MenuItem name="a2" to="/test/com">异步组件</MenuItem> <MenuItem name="a2" to="/test/com">异步组件</MenuItem>
<MenuItem name="a4" to="/test/resource">资源选择</MenuItem> <MenuItem name="a4" to="/test/resource">资源选择</MenuItem>
<MenuItem name="a3" to="/test/view">详情拖拽排版</MenuItem> <MenuItem name="a3" to="/test/view">详情拖拽排版</MenuItem>
</div> <MenuItem name="a5" to="/test/test1">colum验证</MenuItem>
</Menu> </div>
</Menu>
</div> </div>
<div class="fg"> <div class="fg">
<nuxt-child></nuxt-child> <nuxt-child></nuxt-child>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
export default { export default {
layout: "empty", layout: "empty",
async fetch({ store, params }) { async fetch({
await store.dispatch("loadDictionary"); // 加载数据字典 store,
} params
}) {
await store.dispatch("loadDictionary"); // 加载数据字典
}
}; };
</script> </script>
\ No newline at end of file
<template>
<div style="width:100%;">
<Form :model="orderSearchForm" :label-width="120" :rules="ruleValidate" ref="formValidate">
<Row>
<Col span="8">
<FormItem label="输入校验" style="width:100%" prop="colums1">
<Input v-model="orderSearchForm.colums1" style="width:240px" />
</FormItem>
</Col>
<Col span="8">
<FormItem label="数据字典" style="width:100%" prop="colums2">
<dictionary code="plan.order.taskType" v-model="orderSearchForm.colums2" style="width:240px"></dictionary>
</FormItem>
</Col>
<Col span="8">
<FormItem label="电话校验" style="width:100%" prop="colums3">
<Input v-model="orderSearchForm.colums3" style="width:240px" />
</FormItem>
</Col>
<Col span="8">
<FormItem label="email校验" style="width:100%" prop="colums4">
<Input v-model="orderSearchForm.colums4" style="width:240px" />
</FormItem>
</Col>
<Col span="8">
<FormItem label="唯一性校验(用户编号)" style="width:100%" prop="colums5">
<Input v-model="orderSearchForm.colums5" style="width:240px" />
</FormItem>
</Col>
<Col span="8">
<FormItem label="时间校验" style="width:100%" prop="colums6">
<DatePicker v-model="orderSearchForm.colums6" type="date" placeholder="请选择日期" @on-change="getTime"></DatePicker>
</FormItem>
</Col>
</Row>
<Row>
<Col span="24">
<FormItem>
<Button type="primary" @click="handleSubmit" v-noClick>保存</Button>
</FormItem>
</Col>
</Row>
</Form>
</div>
</template>
<script>
export default {
layout: 'empty',
name: "Test1",
data() {
return {
orderSearchForm: {
colums6: ""
},
ruleValidate: this.$u.makeRules(),
};
},
mounted() {
},
methods: {
handleSubmit() {
this.$refs.formValidate.validate((v) => {
if (v) {
this.$Message.success('验证通过')
}
});
},
getTime(value) {
if (value != '') {
this.orderSearchForm.colums6 = this.getFormatDateEnd(value);
}
},
getFormatDateEnd(dates) {
const d = new Date(dates);
const resDate =
d.getFullYear() +
"-" +
this.p(d.getMonth() + 1) +
"-" +
this.p(d.getDate()) +
" 23:59:59";
return resDate;
},
p(s) {
return s < 10 ? "0" + s : s;
},
},
};
</script>
<template> <template>
<div class="flex"> <div class="flex">
<div class="fg1"> <div class="fg1">
<Form ref="form" :model="entity" :rules="rules" :label-width="110"> <Form ref="form" :model="entity" :rules="rules" :label-width="110">
<Row class="view"> <Row class="view">
<Col :span="12" class="item" v-for="(li,i) in items" :key="i" v-dragging="{ item: li, list: items}"> <Col :span="12" class="item" v-for="(li,i) in items" :key="i" v-dragging="{ item: li, list: items}">
<FormItem :label="li.key" :prop="li.key"> <FormItem :label="li.key" :prop="li.key">
<component :is="li.control" :value="entity[li.key]" /> <component :is="li.control" :value="entity[li.key]" />
</FormItem> </FormItem>
</Col> </Col>
</Row> </Row>
<div> <div>
{{ {{
entity entity
}} }}
<Button type="primary" @click="con">conso</Button> <Button type="primary" @click="con">conso</Button>
</div> </div>
</Form> </Form>
</div> </div>
<div v-width="25"> <div v-width="25">
<ul> <ul>
...@@ -27,60 +27,63 @@ ...@@ -27,60 +27,63 @@
</li> </li>
</ul> </ul>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
export default { export default {
name: "", name: "",
data() { data() {
return { return {
items: [], items: [],
entity: {}, entity: {},
rules: null rules: null
}; };
}, },
created() { created() {
this.init(); this.init();
},
methods: {
con() {
console.warn("entity", this.entity);
}, },
init() { methods: {
let items = []; con() {
let controls = ["Input", "InputNumber", "Dictionary", "DatePicker"]; console.warn("entity", this.entity);
for (let i = 0; i < 5; i++) { },
this.entity["I" + i] = i; init() {
items.push({ let items = [];
key: "I" + i, let controls = ["Input", "InputNumber", "Dictionary", "DatePicker"];
name: "Item" + i, for (let i = 0; i < 5; i++) {
width: 4, this.entity["I" + i] = i;
control: controls[i % 4], items.push({
height: 1 key: "I" + i,
}); name: "Item" + i,
} width: 4,
this.items = items; control: controls[i % 4],
height: 1
});
}
this.items = items;
}
} }
}
}; };
</script> </script>
<style lang="less" > <style lang="less">
@line-height: 40px; @line-height: 40px;
@item-width: 12.5%; @item-width: 12.5%;
.view { .view {
margin: 30px; margin: 30px;
border: 1px solid #ddd; border: 1px solid #ddd;
line-height: @line-height; line-height: @line-height;
background-color: white; background-color: white;
.item {
border-right: 1px solid #ddd; .item {
border-top: 1px solid #ddd; border-right: 1px solid #ddd;
margin-right: -1px; border-top: 1px solid #ddd;
margin-top: -1px; margin-right: -1px;
border-bottom: 1px solid #ddd; margin-top: -1px;
text-align: center; border-bottom: 1px solid #ddd;
box-sizing: border-box; text-align: center;
} box-sizing: border-box;
}
} }
</style> </style>
\ No newline at end of file
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