|
|
@@ -11,8 +11,11 @@
|
|
|
<el-breadcrumb-item> 扩展项目</el-breadcrumb-item>
|
|
|
</el-breadcrumb>
|
|
|
<span style="float: right;">
|
|
|
- <el-button type="primary" size="mini" style="margin-left:10px; margin-top: -4px;" @click="ItemListDialog = true">添加扩展项目</el-button>
|
|
|
- <el-button type="primary" size="mini" style="margin-left:10px; margin-top: -4px;" @click="orderDialog = true">自定义排序</el-button>
|
|
|
+ <el-button type="primary" size="mini" style="margin-left:10px; margin-top: -4px;"
|
|
|
+ @click="ItemListDialog = true">添加扩展项目</el-button>
|
|
|
+ <el-button type="primary" size="mini" style="margin-left:10px; margin-top: -4px;" @click="openAppend()">追加扩展
|
|
|
+ </el-button>
|
|
|
+ <!-- <el-button type="primary" size="mini" style="margin-left:10px; margin-top: -4px;" @click="orderDialog = true">自定义排序</el-button> -->
|
|
|
<el-button type="primary" size="mini" style="margin-top: -4px;" onclick="window.history.go(-1)">返回</el-button>
|
|
|
</span>
|
|
|
<el-form ref="form" :inline="true" style="float: right; margin-top: -10px">
|
|
|
@@ -35,18 +38,22 @@
|
|
|
<el-table-column label="操作" width="70px" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
<el-button size="small" type="text" icon="el-icon-edit" title="编辑" @click="editItem(scope.row)"></el-button>
|
|
|
- <!-- <el-button size="small" type="text" style="margin-left: 3px" icon="el-icon-delete" title="删除" @click="deletedata(scope.row)"></el-button> -->
|
|
|
+ <el-button size="small" type="text" style="margin-left: 3px" icon="el-icon-delete" title="删除"
|
|
|
+ @click="deletedata(scope.row)"></el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="GroupName" align="center" label="分组名称" min-width="100px" show-overflow-tooltip></el-table-column>
|
|
|
- <el-table-column prop="Name" align="center" label="名称" min-width="100px" show-overflow-tooltip></el-table-column>
|
|
|
+ <el-table-column prop="GroupName" align="center" label="分组名称" min-width="100px" show-overflow-tooltip>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="Name" align="center" label="名称" min-width="100px" show-overflow-tooltip>
|
|
|
+ </el-table-column>
|
|
|
<el-table-column prop="FieldTypeName" align="center" label="字段类型" min-width="90px"></el-table-column>
|
|
|
<el-table-column prop="FieldDefault" sortable align="center" label="默认值" show-overflow-tooltip>
|
|
|
<template slot-scope="scope">
|
|
|
<p>{{jstimehandlebytype(scope.row)}}</p>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="FieldContent" align="center" label="列表值" min-width="120px" show-overflow-tooltip></el-table-column>
|
|
|
+ <el-table-column prop="FieldContent" align="center" label="列表值" min-width="120px" show-overflow-tooltip>
|
|
|
+ </el-table-column>
|
|
|
<el-table-column prop="CreateBy" align="center" label="添加人" width="120px"></el-table-column>
|
|
|
<el-table-column prop="CreateOn" align="center" label="添加时间">
|
|
|
<template slot-scope="scope">
|
|
|
@@ -55,7 +62,8 @@
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage"
|
|
|
- :page-sizes="[10, 15, 20, 25]" :page-size="size" layout="total, sizes, prev, pager, next, jumper" :total="currentItemCount">
|
|
|
+ :page-sizes="[10, 15, 20, 25]" :page-size="size" layout="total, sizes, prev, pager, next, jumper"
|
|
|
+ :total="currentItemCount">
|
|
|
</el-pagination>
|
|
|
</el-card>
|
|
|
|
|
|
@@ -77,6 +85,50 @@
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
|
|
|
+ <el-dialog title="追加样本扩展" :visible.sync="AppendItemDialog " width="700px">
|
|
|
+ <el-form :model="stypenItemForm" ref="stypenItemForm">
|
|
|
+ <el-form-item label="分组名称" prop="GroupName" label-width="120px">
|
|
|
+ <el-select ref="groupSelect" filterable default-first-option v-model="stypenItemForm.GroupName"
|
|
|
+ @change="getgroupItem()" placeholder="请选择分组名称" style="width: 100%">
|
|
|
+ <el-option v-for="item in groupList" :key="item.Key" :label="item.Value" :value="item.Value">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="显示名称" prop="Name" label-width="120px">
|
|
|
+ <el-select ref="nameSelect" filterable default-first-option v-model="stypenItemForm.Name"
|
|
|
+ @change="getItemdata()" placeholder="请选择显示名称" style="width: 100%">
|
|
|
+ <el-option v-for="item in groupItemList" :key="item.Key" :label="item.Name" :value="item.Name">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="字段类型" prop="FieldType" label-width="120px">
|
|
|
+ <el-select ref="typeSelect" v-model="stypenItemForm.FieldType" style="width:100%" placeholder="请选择字段类型" disabled>
|
|
|
+ <el-option label="字符型" value="1"></el-option>
|
|
|
+ <el-option label="列表型" value="2"></el-option>
|
|
|
+ <el-option label="文本型" value="3"></el-option>
|
|
|
+ <el-option label="日期型" value="4"></el-option>
|
|
|
+ <el-option label="图片型" value="5"></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="默认值" prop="FieldDefault"
|
|
|
+ v-if="stypenItemForm.FieldType == '1' || stypenItemForm.FieldType == '3'" label-width="120px">
|
|
|
+ <el-input v-model="stypenItemForm.FieldDefault" placeholder="默认值"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="列表项" v-if="stypenItemForm.FieldType == '2'" label-width="120px">
|
|
|
+ <el-select style="width:100%;" v-model="Listvalues" multiple filterable allow-create placeholder="请输入列表项内容">
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="默认值" v-if="stypenItemForm.FieldType == '4'" label-width="120px">
|
|
|
+ <el-date-picker v-model="stypenItemForm.FieldDefault" type="datetime" style="width:100%"
|
|
|
+ placeholder="请选择默认日期"></el-date-picker>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
+ <el-button @click="AppendItemDialog = false">取 消</el-button>
|
|
|
+ <el-button type="primary" @click="appendItemDetail()">确 定</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
<el-dialog title="编辑样本扩展" :visible.sync="ItemDialog" width="700px">
|
|
|
<el-form :model="stypenItemForm" ref="stypenItemForm">
|
|
|
<el-form-item label="分组名称:" prop="GroupName" label-width="120px">
|
|
|
@@ -88,8 +140,8 @@
|
|
|
<el-form-item label="字段类型:" prop="FieldType" label-width="120px">
|
|
|
<a>{{stypenItemForm.FieldTypeName}}</a>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="默认值" prop="FieldDefault" v-if="stypenItemForm.FieldType == '1' || stypenItemForm.FieldType == '3'"
|
|
|
- label-width="120px">
|
|
|
+ <el-form-item label="默认值" prop="FieldDefault"
|
|
|
+ v-if="stypenItemForm.FieldType == '1' || stypenItemForm.FieldType == '3'" label-width="120px">
|
|
|
<el-input v-model="stypenItemForm.FieldDefault" placeholder="默认值"></el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="列表项" v-if="stypenItemForm.FieldType == '2'" label-width="120px">
|
|
|
@@ -97,7 +149,8 @@
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="默认值" v-if="stypenItemForm.FieldType == '4'" label-width="120px">
|
|
|
- <el-date-picker v-model="stypenItemForm.FieldDefault" type="datetime" style="width:100%" placeholder="请选择默认日期"></el-date-picker>
|
|
|
+ <el-date-picker v-model="stypenItemForm.FieldDefault" type="datetime" style="width:100%"
|
|
|
+ placeholder="请选择默认日期"></el-date-picker>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
@@ -106,7 +159,7 @@
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
|
|
|
- <el-dialog title="自定义排序" :visible.sync="orderDialog" width="700px">
|
|
|
+ <!-- <el-dialog title="自定义排序" :visible.sync="orderDialog" width="700px">
|
|
|
<draggable v-model="alllist">
|
|
|
<transition-group class="stypemoteiemsort_ul_tags" tag="ul">
|
|
|
<li v-for="item in alllist" :key="item.Id">
|
|
|
@@ -118,7 +171,7 @@
|
|
|
<el-button @click="orderDialog = false">取 消</el-button>
|
|
|
<el-button type="primary" @click="saveshowfiled()">确 定</el-button>
|
|
|
</div>
|
|
|
- </el-dialog>
|
|
|
+ </el-dialog> -->
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
@@ -131,6 +184,7 @@
|
|
|
data() {
|
|
|
return {
|
|
|
pid: 0,
|
|
|
+ TypeName: '',
|
|
|
StypeItemIds: '',
|
|
|
currentItemCount: 0,
|
|
|
currentPage: 1,
|
|
|
@@ -142,6 +196,7 @@
|
|
|
selectItemDetail: [],
|
|
|
ItemListDialog: false,
|
|
|
ItemDialog: false,
|
|
|
+ AppendItemDialog: false,
|
|
|
isIndeterminate: true,
|
|
|
checkAll: false,
|
|
|
StypeitemForm: {},
|
|
|
@@ -162,20 +217,22 @@
|
|
|
SortCode: 0,
|
|
|
},
|
|
|
Listvalues: [],
|
|
|
- orderDialog: false,
|
|
|
+ groupList: [],
|
|
|
+ groupItemList: [],
|
|
|
+ // orderDialog: false,
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
this.pid = this.$route.params.opera
|
|
|
+ this.TypeName = this.$route.query.name + ''
|
|
|
this.StypeItemIds = this.$route.query.stypeitems + ''
|
|
|
this.initData()
|
|
|
this.getSampleitemList()
|
|
|
- this.getalllist()
|
|
|
+ //this.getalllist()
|
|
|
},
|
|
|
methods: {
|
|
|
initData() {
|
|
|
let _this = this
|
|
|
- // paginate
|
|
|
const params = {
|
|
|
_currentPage: this.currentPage,
|
|
|
_size: this.size,
|
|
|
@@ -185,16 +242,15 @@
|
|
|
params
|
|
|
})
|
|
|
.then(res => {
|
|
|
- // response
|
|
|
_this.list = res.data.items
|
|
|
_this.currentItemCount = res.data.currentItemCount
|
|
|
if (_this.StypeItemIds && _this.StypeItemIds != '') {
|
|
|
- var stypeitemIds = _this.StypeItemIds.split('%2F')
|
|
|
- _this.selectItemDetail = stypeitemIds[0].split('/')
|
|
|
+ var stypeitemArr = _this.StypeItemIds.split('%2F')
|
|
|
+ var stypeitemIds = stypeitemArr[0].substring(0, stypeitemArr[0].length - 1)
|
|
|
+ _this.selectItemDetail = stypeitemIds.split('/')
|
|
|
}
|
|
|
})
|
|
|
.catch(err => {
|
|
|
- // handle error
|
|
|
console.error(err)
|
|
|
})
|
|
|
},
|
|
|
@@ -202,7 +258,8 @@
|
|
|
let _this = this
|
|
|
let params = {
|
|
|
stypeItemId: _this.stypeItemId,
|
|
|
- sampleid: _this.pid
|
|
|
+ sampleid: _this.pid,
|
|
|
+ samtype: _this.TypeName
|
|
|
}
|
|
|
_this.$axios.get('stypenoteitem/addstypeitem', {
|
|
|
params
|
|
|
@@ -223,7 +280,6 @@
|
|
|
}
|
|
|
})
|
|
|
.catch(err => {
|
|
|
- // handle error
|
|
|
console.error(err)
|
|
|
})
|
|
|
},
|
|
|
@@ -247,8 +303,8 @@
|
|
|
},
|
|
|
clearStypeForm() {
|
|
|
this.stypenItemForm = {
|
|
|
- SampleType: '',
|
|
|
- SampleTypeName: '',
|
|
|
+ SampleType: this.pid,
|
|
|
+ SampleTypeName: this.TypeName,
|
|
|
GroupName: '',
|
|
|
Name: '',
|
|
|
FieldName: '',
|
|
|
@@ -262,10 +318,38 @@
|
|
|
}
|
|
|
this.Listvalues = []
|
|
|
},
|
|
|
+ deletedata(val) {
|
|
|
+ let _this = this;
|
|
|
+ _this.$confirm("此操作将永久删除该数据, 是否继续?", "提示", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning"
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ _this.$axios.delete("stypenoteitem/delstypeitem/" + val.Id + "?name=" + val.Name + "&itemid=" + val
|
|
|
+ .ItemId + "&samtype=" + val.SampleType, null)
|
|
|
+ .then(res => {
|
|
|
+ if (res.data.code === 0) {
|
|
|
+ _this.$message({
|
|
|
+ type: "success",
|
|
|
+ message: res.data.message
|
|
|
+ });
|
|
|
+ // 更新界面
|
|
|
+ _this.initData();
|
|
|
+ } else {
|
|
|
+ _this.$message({
|
|
|
+ type: "warning",
|
|
|
+ message: res.data.message
|
|
|
+ });
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
+ },
|
|
|
editItemDetail() {
|
|
|
this.$axios.put('stypenoteitem/edititemdetail/' + this.stypenItemForm.Id, this.stypenItemForm)
|
|
|
.then(res => {
|
|
|
- // response
|
|
|
if (res.data.code === 0) {
|
|
|
this.$message({
|
|
|
type: 'success',
|
|
|
@@ -283,16 +367,40 @@
|
|
|
})
|
|
|
.catch(() => {})
|
|
|
},
|
|
|
+ appendItemDetail() {
|
|
|
+ let _this = this;
|
|
|
+ if (_this.stypenItemForm.FieldType === '2') {
|
|
|
+ _this.stypenItemForm.FieldContent = _this.Listvalues + ''
|
|
|
+ }
|
|
|
+ _this.stypenItemForm.SampleType = parseInt(_this.pid)
|
|
|
+ console.log("wwwwwwwwwwwwwwwwwwwwwww",_this.stypenItemForm)
|
|
|
+ _this.$axios.post('stypenoteitem/appenditems', _this.stypenItemForm)
|
|
|
+ .then(res => {
|
|
|
+ if (res.data.code === 0) {
|
|
|
+ _this.$message({
|
|
|
+ type: 'success',
|
|
|
+ message: res.data.message
|
|
|
+ })
|
|
|
+ _this.AppendItemDialog = false
|
|
|
+ _this.initData()
|
|
|
+ } else {
|
|
|
+ _this.$message({
|
|
|
+ type: 'warning',
|
|
|
+ message: res.data.message
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ console.error(err)
|
|
|
+ })
|
|
|
+ },
|
|
|
getSampleitemList() {
|
|
|
let _this = this
|
|
|
this.$axios.get('stypenoteitem/sampleitemlist', {})
|
|
|
- // this.$axios.get('extends/list', {})
|
|
|
.then(res => {
|
|
|
- // response
|
|
|
_this.sampleItemList = res.data.items
|
|
|
})
|
|
|
.catch(err => {
|
|
|
- // handle error
|
|
|
console.error(err)
|
|
|
})
|
|
|
},
|
|
|
@@ -316,59 +424,90 @@
|
|
|
_this.isIndeterminate = false
|
|
|
}
|
|
|
},
|
|
|
- // 自定义排序操作
|
|
|
- saveshowfiled() {
|
|
|
- this.orderDialog = false
|
|
|
- let _this = this
|
|
|
- if (_this.alllist.length === 0) {
|
|
|
- _this.$message({
|
|
|
- type: 'success',
|
|
|
- message: '设置成功'
|
|
|
- })
|
|
|
- return
|
|
|
- }
|
|
|
- let ids = []
|
|
|
- for (var i = 0; i < _this.alllist.length; i++) {
|
|
|
- ids.push(_this.alllist[i].Id)
|
|
|
- }
|
|
|
- // paginate
|
|
|
- const params = {
|
|
|
- ids: ids
|
|
|
+ openAppend() {
|
|
|
+ this.clearStypeForm()
|
|
|
+ this.getGrouplist()
|
|
|
+ this.AppendItemDialog = true
|
|
|
+ },
|
|
|
+ getgroupItem() {
|
|
|
+ this.groupItemList = []
|
|
|
+ for (var i = 0; i < this.sampleItemList.length; i++) {
|
|
|
+ if (this.stypenItemForm.GroupName == this.sampleItemList[i].GroupName) {
|
|
|
+ this.groupItemList.push(this.sampleItemList[i])
|
|
|
+ }
|
|
|
}
|
|
|
- // request
|
|
|
- this.$axios.put('stypenoteitem/custorder', params)
|
|
|
- .then(res => {
|
|
|
- // response
|
|
|
- if (res.data.code === 0) {
|
|
|
- _this.$message({
|
|
|
- type: 'success',
|
|
|
- message: res.data.message
|
|
|
- })
|
|
|
- // 更新界面
|
|
|
- this.initData()
|
|
|
+ },
|
|
|
+ getItemdata() {
|
|
|
+ for (var i = 0; i < this.groupItemList.length; i++) {
|
|
|
+ if (this.groupItemList[i].Name == this.stypenItemForm.Name) {
|
|
|
+ this.stypenItemForm.ItemId = this.groupItemList[i].Id
|
|
|
+ this.stypenItemForm.FieldType = this.groupItemList[i].FieldType
|
|
|
+ this.stypenItemForm.FieldTypeName = this.groupItemList[i].FieldTypeName
|
|
|
+ if (this.groupItemList[i].FieldType == '4') {
|
|
|
+ this.stypenItemForm.FieldDefault = new Date(this.groupItemList[i].FieldDefault)
|
|
|
} else {
|
|
|
- _this.$message({
|
|
|
- type: 'warning',
|
|
|
- message: res.data.message
|
|
|
- })
|
|
|
+ this.stypenItemForm.FieldDefault = this.groupItemList[i].FieldDefault
|
|
|
}
|
|
|
- })
|
|
|
- .catch(err => {
|
|
|
- // handle error
|
|
|
- console.error(err)
|
|
|
- })
|
|
|
+ this.stypenItemForm.FieldDefault = this.groupItemList[i].FieldDefault
|
|
|
+ this.Listvalues = this.groupItemList[i].FieldContent.split(',')
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
- getalllist() {
|
|
|
+ getGrouplist() {
|
|
|
let _this = this
|
|
|
- this.$axios.get('stypenoteitem/getlist/' + this.pid, {})
|
|
|
+ _this.$axios.get('/extends/grouplist', {})
|
|
|
.then(res => {
|
|
|
- _this.alllist = res.data.items
|
|
|
- })
|
|
|
- .catch(err => {
|
|
|
- // handle error
|
|
|
- console.error(err)
|
|
|
+ _this.groupList = res.data
|
|
|
})
|
|
|
},
|
|
|
+ // 自定义排序操作
|
|
|
+ // saveshowfiled() {
|
|
|
+ // this.orderDialog = false
|
|
|
+ // let _this = this
|
|
|
+ // if (_this.alllist.length === 0) {
|
|
|
+ // _this.$message({
|
|
|
+ // type: 'success',
|
|
|
+ // message: '设置成功'
|
|
|
+ // })
|
|
|
+ // return
|
|
|
+ // }
|
|
|
+ // let ids = []
|
|
|
+ // for (var i = 0; i < _this.alllist.length; i++) {
|
|
|
+ // ids.push(_this.alllist[i].Id)
|
|
|
+ // }
|
|
|
+ // const params = {
|
|
|
+ // ids: ids
|
|
|
+ // }
|
|
|
+ // this.$axios.put('stypenoteitem/custorder', params)
|
|
|
+ // .then(res => {
|
|
|
+ // if (res.data.code === 0) {
|
|
|
+ // _this.$message({
|
|
|
+ // type: 'success',
|
|
|
+ // message: res.data.message
|
|
|
+ // })
|
|
|
+ // // 更新界面
|
|
|
+ // this.initData()
|
|
|
+ // } else {
|
|
|
+ // _this.$message({
|
|
|
+ // type: 'warning',
|
|
|
+ // message: res.data.message
|
|
|
+ // })
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // .catch(err => {
|
|
|
+ // console.error(err)
|
|
|
+ // })
|
|
|
+ // },
|
|
|
+ // getalllist() {
|
|
|
+ // let _this = this
|
|
|
+ // this.$axios.get('stypenoteitem/getlist/' + this.pid, {})
|
|
|
+ // .then(res => {
|
|
|
+ // _this.alllist = res.data.items
|
|
|
+ // })
|
|
|
+ // .catch(err => {
|
|
|
+ // console.error(err)
|
|
|
+ // })
|
|
|
+ // },
|
|
|
seachdata() {
|
|
|
this.currentPage = 1;
|
|
|
this.initData()
|