Commit a5d4a9ff authored by 仇晓婷's avatar 仇晓婷

物料优化

parent 57c55ca1
<template> <template>
<div>
<span v-if="type=='date'"> <span>
<Tooltip :content="value"> <Tooltip :content="value">
{{value.substr(0,10)}} {{date}}
</Tooltip> </Tooltip>
</span> </span>
<span v-else>{{value.substr(0,19)}}</span>
</div>
</template> </template>
<script> <script>
export default { export default {
name: 'dtSpan', name: 'dtSpan',
data() { data() {
return { return {
date:""
} }
}, },
props: { props: {
...@@ -25,10 +24,22 @@ export default { ...@@ -25,10 +24,22 @@ export default {
default: '2001-01-01 00:00:00' default: '2001-01-01 00:00:00'
}, },
}, },
created() {}, created() {
this.init()
},
methods: { methods: {
init(){
if(this.value&&this.value.length>=19){
this.date=this.value.substr(0,this.type=='date'?10:19)
}
return this.date;
}
}, },
computed: {}, computed: {},
watch: {} watch: {
value(){
this.init()
}
}
} }
</script> </script>
\ No newline at end of file
...@@ -58,7 +58,7 @@ ...@@ -58,7 +58,7 @@
<!-- <files ref="refFile" :parms="parms" fileFormat :Photos="true" @clickItem="clickData" /> --> <!-- <files ref="refFile" :parms="parms" fileFormat :Photos="true" @clickItem="clickData" /> -->
<InputFile v-if="li.dataType==7" v-model="entity[li.field]"></InputFile> <InputFile v-if="li.dataType==7" v-model="entity[li.field]"></InputFile>
<Input v-if="li.dataType==8" type="textarea" v-model="entity[li.field]"></Input> <Input v-if="li.dataType==8" type="textarea" v-model="entity[li.field]"></Input>
<state v-if="li.unitName" :value="li.unitName" code="material.main.unitName" type="tag"></state> <state v-if="li.unitName&&(li.dataType==1||li.dataType==2)" :value="li.unitName" code="material.main.unitName" type="tag"></state>
</FormItem> </FormItem>
</Col> </Col>
<!-- <Col :span="24"> <!-- <Col :span="24">
......
...@@ -2,23 +2,18 @@ ...@@ -2,23 +2,18 @@
<div> <div>
<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="12">
<FormItem label="编码" prop="code"> <FormItem label="编码" prop="code">
<Input v-model="entity.code" placeholder="请输入" disabled></Input> <Input v-model="entity.code" placeholder="请输入" disabled></Input>
</FormItem> </FormItem>
</Col> </Col>-->
<Col :span="12"> <Col :span="12">
<FormItem label="名称" prop="name"> <FormItem label="名称" prop="name">
<Input v-model="entity.name" placeholder="请输入"></Input> <Input v-model="entity.name" placeholder="请输入"></Input>
</FormItem> </FormItem>
</Col> </Col>
<Col :span="12"> <!-- <Col :span="12">
<FormItem <FormItem label="状态" prop="status" placeholder="请选择">
label="状态"
prop="status"
placeholder="请选择"
v-if="entity.status==3||entity.status==4"
>
<Dictionary <Dictionary
code="material.main.status" code="material.main.status"
v-model="entity.status" v-model="entity.status"
...@@ -27,7 +22,7 @@ ...@@ -27,7 +22,7 @@
:key="entity.status" :key="entity.status"
></Dictionary> ></Dictionary>
</FormItem> </FormItem>
</Col> </Col>-->
<Col :span="12"> <Col :span="12">
<FormItem label="版本" prop="version"> <FormItem label="版本" prop="version">
<Input v-model="entity.version" placeholder="请输入"></Input> <Input v-model="entity.version" placeholder="请输入"></Input>
...@@ -52,9 +47,9 @@ ...@@ -52,9 +47,9 @@
class="w100" class="w100"
></InputNumber> ></InputNumber>
<Dictionary v-if="li.dataType==3" v-model="entity[li.field]" :code="li.note"></Dictionary> <Dictionary v-if="li.dataType==3" v-model="entity[li.field]" :code="li.note"></Dictionary>
<Input v-if="li.dataType==4" v-model="entity[li.filed]"></Input> <Input v-if="li.dataType==5" type="textarea" v-model="entity[li.filed]"></Input>
<DatePicker <DatePicker
v-if="li.dataType==5" v-if="li.dataType==4"
v-model="entity[li.field]" v-model="entity[li.field]"
type="date" type="date"
:placeholder="'选择'+li.title" :placeholder="'选择'+li.title"
...@@ -63,6 +58,7 @@ ...@@ -63,6 +58,7 @@
<!-- <files ref="refFile" :parms="parms" fileFormat :Photos="true" @clickItem="clickData" /> --> <!-- <files ref="refFile" :parms="parms" fileFormat :Photos="true" @clickItem="clickData" /> -->
<InputFile v-if="li.dataType==7" v-model="entity[li.field]"></InputFile> <InputFile v-if="li.dataType==7" v-model="entity[li.field]"></InputFile>
<Input v-if="li.dataType==8" type="textarea" v-model="entity[li.field]"></Input> <Input v-if="li.dataType==8" type="textarea" v-model="entity[li.field]"></Input>
<state v-if="li.unitName&&(li.dataType==1||li.dataType==2)" :value="li.unitName" code="material.main.unitName" type="tag"></state>
</FormItem> </FormItem>
</Col> </Col>
<!-- <Col :span="24"> <!-- <Col :span="24">
......
...@@ -228,7 +228,7 @@ export default { ...@@ -228,7 +228,7 @@ export default {
search() { search() {
this.$refs.grid.reload(this.easySearch); this.$refs.grid.reload(this.easySearch);
}, },
initCols() { initCols(delay) {
let conditions = [ let conditions = [
{ {
conditionalType: "Equal", conditionalType: "Equal",
...@@ -252,6 +252,7 @@ export default { ...@@ -252,6 +252,7 @@ export default {
}); });
this.cols = this.$u.clone(this.columns); this.cols = this.$u.clone(this.columns);
let extra = items.map(u => { let extra = items.map(u => {
// console.log(u);
var col = { var col = {
key: u.field, key: u.field,
title: u.title title: u.title
...@@ -259,7 +260,10 @@ export default { ...@@ -259,7 +260,10 @@ export default {
if (u.dataType == 3) { if (u.dataType == 3) {
col.code = u.note; col.code = u.note;
} }
if (u.unitName) { if (u.dataType == 4) {
col.type = 'date';
}
if (u.unitName&&(u.dataType==1||u.dataType==2)) {
var units = this.$store.getters.dictionaryByKey( var units = this.$store.getters.dictionaryByKey(
"material.main.unitName" "material.main.unitName"
); );
...@@ -267,7 +271,7 @@ export default { ...@@ -267,7 +271,7 @@ export default {
let item = units.filter(p => { let item = units.filter(p => {
return p.code == u.unitName; return p.code == u.unitName;
}); });
console.log(units, item); // console.log(units, item);
col.title += "(" + item[0].name + ")"; col.title += "(" + item[0].name + ")";
} }
return col; return col;
...@@ -275,6 +279,10 @@ export default { ...@@ -275,6 +279,10 @@ export default {
this.cols = this.cols.concat(extra); this.cols = this.cols.concat(extra);
var action = this.cols.splice(this.columns.length - 1, 1); var action = this.cols.splice(this.columns.length - 1, 1);
this.cols.push(this.columns[this.columns.length - 1]); this.cols.push(this.columns[this.columns.length - 1]);
if(delay){
delay();
}
// console.log(this.cols)
} }
}); });
}, },
...@@ -341,12 +349,14 @@ export default { ...@@ -341,12 +349,14 @@ export default {
handler(newName, oldName) { handler(newName, oldName) {
console.log("ovo", newName, oldName); console.log("ovo", newName, oldName);
if (newName.rootCategoryId) { if (newName.rootCategoryId) {
this.initCols(); this.initCols(()=>{
}
if (newName.categoryId) { if (newName.categoryId) {
this.easySearch.categoryId.value = newName.ids; this.easySearch.categoryId.value = newName.ids;
this.$refs.grid.reload(this.easySearch); this.$refs.grid.reload(this.easySearch);
} else { }
});
}
if (!newName.categoryId) {
this.easySearch.categoryId.value = "-1"; this.easySearch.categoryId.value = "-1";
} }
}, },
......
...@@ -18,7 +18,8 @@ ...@@ -18,7 +18,8 @@
<div v-else-if="li.dataType==8">{{entity[li.field]}}</div> <div v-else-if="li.dataType==8">{{entity[li.field]}}</div>
<div v-else-if="li.dataType==5" v-html="entity[li.field]"></div> <div v-else-if="li.dataType==5" v-html="entity[li.field]"></div>
<span v-else>{{entity[li.field]}}</span> <span v-else>{{entity[li.field]}}</span>
<span v-if="li.unitName" v-text="li.unitName" class="ml10"></span> <State v-if="li.unitName" :code="li.note" :value="entity[li.field]" />
<!-- <span v-if="li.unitName" v-text="li.unitName" class="ml10"></span> -->
</Filed> </Filed>
</Row> </Row>
</div> </div>
...@@ -258,7 +259,6 @@ export default { ...@@ -258,7 +259,6 @@ export default {
codeList.push(this.entity.code); codeList.push(this.entity.code);
} else { } else {
codeList.push(this.eid); codeList.push(this.eid);
} }
idList.push(this.eid); idList.push(this.eid);
} else { } else {
...@@ -268,7 +268,6 @@ export default { ...@@ -268,7 +268,6 @@ export default {
codeList.push(e.code); codeList.push(e.code);
} else { } else {
codeList.push(e.id); codeList.push(e.id);
} }
}); });
} }
......
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