|
|
@@ -1,72 +1,87 @@
|
|
|
+<style>
|
|
|
+ .input-with-select .el-select .el-input {
|
|
|
+ width: 110px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .input-with-select .el-input-group__append {
|
|
|
+ background-color: #fff;
|
|
|
+ }
|
|
|
+
|
|
|
+</style>
|
|
|
+
|
|
|
<template>
|
|
|
<div>
|
|
|
-<el-breadcrumb class="heading">
|
|
|
- <el-breadcrumb-item :to="{ path: '/' }">平台首页</el-breadcrumb-item>
|
|
|
- <el-breadcrumb-item :to="{ path: '/setting/sampletype' }">样本类型</el-breadcrumb-item>
|
|
|
- <el-breadcrumb-item :to="{ path: '/setting/sampletype/sampletypeadd' }">添加样本类型</el-breadcrumb-item>
|
|
|
+ <el-card style="min-height: calc(100vh - 92px);">
|
|
|
+ <div slot="header" style="height: 20px;">
|
|
|
+ <span style="float: left;">
|
|
|
+ <i class="icon icon-table2"></i>
|
|
|
+ </span>
|
|
|
+ <el-breadcrumb class="heading" style="float: left; margin-left: 5px">
|
|
|
+ <el-breadcrumb-item :to="{ path: '/' }">平台首页</el-breadcrumb-item>
|
|
|
+ <el-breadcrumb-item :to="{ path: '/setting/sampletype' }">样本类型</el-breadcrumb-item>
|
|
|
+ <el-breadcrumb-item>添加样本类型</el-breadcrumb-item>
|
|
|
+ </el-breadcrumb>
|
|
|
+ <span style="float: right;">
|
|
|
+ <el-button size="mini" type="primary" class="el-button--small" style="margin-left: 8px"
|
|
|
+ @click="savedata('SampleTypeForm')">确定</el-button>
|
|
|
+ <el-button size="mini" type="primary" class="el-button--small" style="margin-left: 8px"
|
|
|
+ onclick="window.history.go(-1)">返回</el-button>
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
|
|
|
- </el-breadcrumb>
|
|
|
- <el-card class="box-card">
|
|
|
- <div slot="header">
|
|
|
- <span>
|
|
|
- <i class="icon icon-table2"></i> 添加样本类型
|
|
|
- </span>
|
|
|
- <span style="float: right;">
|
|
|
- <el-button type="primary" @click="savedata('SampleTypeForm')" class="el-button--small">保存</el-button>
|
|
|
- <el-button type="primary" class="el-button--small" onclick="window.history.go(-1)">返回</el-button>
|
|
|
- </span>
|
|
|
- </div>
|
|
|
- <div class="heading">
|
|
|
- </div>
|
|
|
- <el-form ref="SampleTypeForm" required :model="SampleTypeForm" :rules="rulessampletypeinfo" label-width="130px">
|
|
|
+ <el-form ref="SampleTypeForm" required :model="SampleTypeForm" :rules="rulessampletypeinfo" label-width="130px">
|
|
|
<el-row>
|
|
|
<el-col :span="8">
|
|
|
- <el-form-item label="编码" prop="Code" >
|
|
|
- <el-input style="width:100%" v-model="SampleTypeForm.Code" placeholder="请输入编码"></el-input>
|
|
|
+ <el-form-item label="编码" prop="Code">
|
|
|
+ <el-input style="width:100%" v-model="SampleTypeForm.Code" placeholder="请输入编码"></el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="默认单位">
|
|
|
<el-select style="width:100%" v-model="SampleTypeForm.Unit" placeholder="请选择默认单位">
|
|
|
- <el-option v-for="item in sampeunitlist"
|
|
|
- :label="item.Value"
|
|
|
- :value="item.Value" :key="item.value">
|
|
|
+ <el-option v-for="item in sampeunitlist" :label="item.Value" :value="item.Value" :key="item.value">
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
|
- <el-form-item label="名称" prop="Name" ><el-input v-model="SampleTypeForm.Name" placeholder="请输入名称"></el-input></el-form-item>
|
|
|
+ <el-form-item label="名称" prop="Name">
|
|
|
+ <el-input v-model="SampleTypeForm.Name" placeholder="请输入名称"></el-input>
|
|
|
+ </el-form-item>
|
|
|
<el-form-item label="默认容量">
|
|
|
- <el-input v-model="SampleTypeForm.DefaultCapacity" placeholder="请输入默认容量"></el-input>
|
|
|
+ <el-input v-model="SampleTypeForm.DefaultCapacity" placeholder="请输入默认容量"></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
|
<el-form-item label="分装份数" required>
|
|
|
- <el-input-number v-model="SampleTypeForm.SubpackageNum" style="width:100%" :min="1" :max="30"></el-input-number>
|
|
|
+ <el-input-number v-model="SampleTypeForm.SubpackageNum" style="width:100%" :min="1" :max="30">
|
|
|
+ </el-input-number>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="分装容量" required>
|
|
|
+ <el-input v-model="SampleTypeForm.SubpackageCapacity" placeholder="分装容量"></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col :span="8">
|
|
|
- <el-form-item label="分装容量" required>
|
|
|
- <el-input v-model="SampleTypeForm.SubpackageCapacity" placeholder="分装容量"></el-input>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
<el-col :span="8">
|
|
|
<el-form-item label="有效期 (小时)">
|
|
|
- <el-input-number :disabled="SampleTypeForm.Timelong" v-model="SampleTypeForm.ValidityHours" :min="0" ></el-input-number>
|
|
|
+ <el-input-number :disabled="SampleTypeForm.Timelong" v-model="SampleTypeForm.ValidityHours" :min="0">
|
|
|
+ </el-input-number>
|
|
|
<el-checkbox style="float:right" v-model="SampleTypeForm.Timelong">永久</el-checkbox>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
- <el-form-item label="描述" >
|
|
|
+ <el-form-item label="描述">
|
|
|
<el-input type="textarea" placeholder="请输入描述" :rows=2 v-model="SampleTypeForm.Remark"></el-input>
|
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item label="应用到设备">
|
|
|
<div style="border: 1px solid rgb(204, 204, 204); overflow: auto; height: 120px;" label-width="130px">
|
|
|
<el-checkbox-group v-model="selectdevices">
|
|
|
- <el-checkbox v-for="v in devicelist" @change="handleCheckeddeviceChange" style="margin-left:8px;" :label="v.Id+''" :key="v">{{v.Name}}</el-checkbox>
|
|
|
+ <el-checkbox v-for="v in devicelist" @change="handleCheckeddeviceChange" style="margin-left:8px;"
|
|
|
+ :label="v.Id+''" :key="v">{{v.Name}}</el-checkbox>
|
|
|
</el-checkbox-group>
|
|
|
</div>
|
|
|
- <el-checkbox style="margin-left:0px" v-model="checkAll" :indeterminate="isIndeterminate" @change="handleCheckAllChange">全选</el-checkbox>
|
|
|
+ <el-checkbox style="margin-left:0px" v-model="checkAll" :indeterminate="isIndeterminate"
|
|
|
+ @change="handleCheckAllChange">全选</el-checkbox>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="图片类型">
|
|
|
<el-radio class="radio" v-model="imgtype" label="0">本地图库</el-radio>
|
|
|
@@ -74,17 +89,15 @@
|
|
|
<div v-show="imgtype === '0'">
|
|
|
<el-row>
|
|
|
<el-col :span="2" v-for="item in systemqiguanimglist" :key="item">
|
|
|
- <div class="sampletypelist" v-bind:class="{'sampleselectedcss': selectsametyped == item.Id}" @click="selectsampletype(item.Id, item.ImgAddr)">
|
|
|
+ <div class="sampletypelist" v-bind:class="{'sampleselectedcss': selectsametyped == item.Id}"
|
|
|
+ @click="selectsampletype(item.Id, item.ImgAddr)">
|
|
|
<img :src="imghost + item.ImgAddr">
|
|
|
</div>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
</div>
|
|
|
- <el-upload v-show="imgtype === '1'" style="margin-top: 10px;"
|
|
|
- class="samptypeimg-uploader"
|
|
|
- :action="imghost + '/api/uploads/samplestypeimg'"
|
|
|
- :show-file-list="false"
|
|
|
- :on-success="handleAvatarSuccess"
|
|
|
+ <el-upload v-show="imgtype === '1'" style="margin-top: 10px;" class="samptypeimg-uploader"
|
|
|
+ :action="imghost + '/api/uploads/samplestypeimg'" :show-file-list="false" :on-success="handleAvatarSuccess"
|
|
|
:before-upload="beforeAvatarUpload">
|
|
|
<img v-if="imageUrl" :src="imageUrl" class="uploadsampletypeimg">
|
|
|
<i v-else class="el-icon-plus samptypeimg-uploader-icon"></i>
|
|
|
@@ -95,292 +108,309 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
-export default {
|
|
|
- name: "sampletypeadd",
|
|
|
- data() {
|
|
|
- return {
|
|
|
- imghost: "",
|
|
|
- rulessampletypeinfo: {
|
|
|
- Code: [{ required: true, message: "请输入编码", trigger: "blur" }],
|
|
|
- Name: [{ required: true, message: "请输入姓名", trigger: "blur" }]
|
|
|
- },
|
|
|
- currentItemCount: 0,
|
|
|
- currentPage: 1,
|
|
|
- size: 10,
|
|
|
- list: [],
|
|
|
- devicelist: [],
|
|
|
- checkAll: false,
|
|
|
- keyword: "",
|
|
|
- dialogtitle: "",
|
|
|
- operatingitem: 0,
|
|
|
- isIndeterminate: false,
|
|
|
- selectdevices: [],
|
|
|
- showquerydiv: false,
|
|
|
- systemqiguanimglist: [],
|
|
|
- imgtype: "0",
|
|
|
- selectsametyped: 0,
|
|
|
- imageUrl: "",
|
|
|
- SampleTypeForm: {
|
|
|
- Name: "",
|
|
|
- Code: "",
|
|
|
- DefaultCapacity: "",
|
|
|
- Unit: "",
|
|
|
- ValidityHours: 0,
|
|
|
- Timelong: false,
|
|
|
- id: 0,
|
|
|
- Remark: "",
|
|
|
- Sensors: [],
|
|
|
- Photo: "",
|
|
|
- PhotoType: 0,
|
|
|
- SubpackageCapacity: "", // 分装容量
|
|
|
- SubpackageNum: 1,
|
|
|
- },
|
|
|
- checked: false,
|
|
|
- num1: 1,
|
|
|
- sampeunitlist: [] // 样本单位
|
|
|
- };
|
|
|
- },
|
|
|
- created() {
|
|
|
- this.imghost = process.env.imgserverhost;
|
|
|
- // initial data
|
|
|
- this.initData();
|
|
|
- // 加载单位
|
|
|
- this.getsampetypeunit();
|
|
|
- },
|
|
|
- methods: {
|
|
|
- initData() {
|
|
|
- let _this = this;
|
|
|
- // paginate
|
|
|
- const params = {
|
|
|
- _currentPage: this.currentPage,
|
|
|
- _size: this.size,
|
|
|
- keyword: this.keyword
|
|
|
+ export default {
|
|
|
+ name: "sampletypeadd",
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ imghost: "",
|
|
|
+ rulessampletypeinfo: {
|
|
|
+ Code: [{
|
|
|
+ required: true,
|
|
|
+ message: "请输入编码",
|
|
|
+ trigger: "blur"
|
|
|
+ }],
|
|
|
+ Name: [{
|
|
|
+ required: true,
|
|
|
+ message: "请输入姓名",
|
|
|
+ trigger: "blur"
|
|
|
+ }]
|
|
|
+ },
|
|
|
+ currentItemCount: 0,
|
|
|
+ currentPage: 1,
|
|
|
+ size: 10,
|
|
|
+ list: [],
|
|
|
+ devicelist: [],
|
|
|
+ checkAll: false,
|
|
|
+ keyword: "",
|
|
|
+ dialogtitle: "",
|
|
|
+ operatingitem: 0,
|
|
|
+ isIndeterminate: false,
|
|
|
+ selectdevices: [],
|
|
|
+ showquerydiv: false,
|
|
|
+ systemqiguanimglist: [],
|
|
|
+ imgtype: "0",
|
|
|
+ selectsametyped: 0,
|
|
|
+ imageUrl: "",
|
|
|
+ SampleTypeForm: {
|
|
|
+ Name: "",
|
|
|
+ Code: "",
|
|
|
+ DefaultCapacity: "",
|
|
|
+ Unit: "",
|
|
|
+ ValidityHours: 0,
|
|
|
+ Timelong: false,
|
|
|
+ id: 0,
|
|
|
+ Remark: "",
|
|
|
+ Sensors: [],
|
|
|
+ Photo: "",
|
|
|
+ PhotoType: 0,
|
|
|
+ SubpackageCapacity: "", // 分装容量
|
|
|
+ SubpackageNum: 1,
|
|
|
+ },
|
|
|
+ checked: false,
|
|
|
+ num1: 1,
|
|
|
+ sampeunitlist: [] // 样本单位
|
|
|
};
|
|
|
- // request
|
|
|
- this.$axios
|
|
|
- .get("sampletype/list", { params })
|
|
|
- .then(res => {
|
|
|
- // response
|
|
|
- _this.list = res.data.items;
|
|
|
- // toggle loading
|
|
|
- // _this.loading = false
|
|
|
- _this.currentItemCount = res.data.currentItemCount;
|
|
|
- })
|
|
|
- .catch(err => {
|
|
|
- // handle error
|
|
|
- console.error(err);
|
|
|
- });
|
|
|
- this.$axios
|
|
|
- .get("sampletype/shebeilist", { _currentPage: -1 })
|
|
|
- .then(res => {
|
|
|
- _this.devicelist = res.data;
|
|
|
- })
|
|
|
- .catch(() => {});
|
|
|
- this.$axios
|
|
|
- .get("sampletype/imglist", { _currentPage: -1 })
|
|
|
- .then(res => {
|
|
|
- console.log("1111111111111",res.data)
|
|
|
- _this.systemqiguanimglist = res.data;
|
|
|
- })
|
|
|
- .catch(() => {});
|
|
|
- this.$axios
|
|
|
- .get("channels/list", { _currentPage: -1 })
|
|
|
- .then(res => {
|
|
|
- // response
|
|
|
- _this.devices = res.data.items;
|
|
|
- _this.devices.forEach((item, k) => {
|
|
|
- _this.devicesallid.push(item.Id);
|
|
|
- });
|
|
|
- })
|
|
|
- .catch(() => {});
|
|
|
},
|
|
|
- getsampetypeunit() {
|
|
|
- // 获取样本单位
|
|
|
- let _this = this;
|
|
|
- _this.$axios.get("sampletype/sunitajax", {}).then(res => {
|
|
|
- _this.sampeunitlist = res.data;
|
|
|
- });
|
|
|
+ created() {
|
|
|
+ this.imghost = process.env.imgserverhost;
|
|
|
+ // initial data
|
|
|
+ this.initData();
|
|
|
+ // 加载单位
|
|
|
+ this.getsampetypeunit();
|
|
|
},
|
|
|
- handleAvatarSuccess(res, file) {
|
|
|
- this.SampleTypeForm.Photo = res;
|
|
|
- this.imageUrl = URL.createObjectURL(file.raw);
|
|
|
- },
|
|
|
- beforeAvatarUpload(file) {
|
|
|
- const isimg = file.type.indexOf("image/") === 0;
|
|
|
- const isLt50k = file.size / 1024 / 50 < 1;
|
|
|
- if (!isimg) {
|
|
|
- this.$message.error("上传图片只能是 图片 格式!");
|
|
|
- return false;
|
|
|
- }
|
|
|
- if (!isLt50k) {
|
|
|
- this.$message.error("上传图片大小不能超过 50kb!");
|
|
|
- return false;
|
|
|
- }
|
|
|
- return true;
|
|
|
- },
|
|
|
- selectsampletype(v, imgpath) {
|
|
|
- if (v === this.selectsametyped) {
|
|
|
- this.selectsametyped = 0;
|
|
|
- this.SampleTypeForm.Photo = "";
|
|
|
- } else {
|
|
|
- this.selectsametyped = v;
|
|
|
- this.SampleTypeForm.Photo = imgpath;
|
|
|
- }
|
|
|
- },
|
|
|
- resetForm(formName) {
|
|
|
- this.$refs[formName].resetFields();
|
|
|
- },
|
|
|
- clearForm() {
|
|
|
- this.SampleTypeForm = {
|
|
|
- Code: "",
|
|
|
- Name: "",
|
|
|
- DefaultCapacity: "",
|
|
|
- Unit: "",
|
|
|
- ValidityHours: "",
|
|
|
- Remark: "",
|
|
|
- Sensors: [],
|
|
|
- Timelong: false,
|
|
|
- SubpackageCapacity: "", // 分装容量
|
|
|
- SubpackageNum: 1,
|
|
|
- };
|
|
|
- },
|
|
|
- savedata(formName) {
|
|
|
- let _this = this;
|
|
|
- this.$refs[formName].validate(valid => {
|
|
|
- if (valid) {
|
|
|
- if (_this.SampleTypeForm.Photo === "") {
|
|
|
- _this.$message({
|
|
|
- type: "warning",
|
|
|
- message: "请选择样本图片!"
|
|
|
- });
|
|
|
- return;
|
|
|
- }
|
|
|
- _this.SampleTypeForm.Sensors = _this.selectdevices;
|
|
|
- _this.SampleTypeForm.PhotoType = parseInt(_this.imgtype);
|
|
|
- _this.SampleTypeForm.DefaultCapacity = parseFloat(
|
|
|
- _this.SampleTypeForm.DefaultCapacity
|
|
|
- );
|
|
|
- _this.SampleTypeForm.SubpackageCapacity = parseFloat(
|
|
|
- _this.SampleTypeForm.SubpackageCapacity
|
|
|
- );
|
|
|
- _this.$axios
|
|
|
- .post("sampletype", _this.SampleTypeForm)
|
|
|
- .then(res => {
|
|
|
- // response
|
|
|
- if (res.data.code === 0) {
|
|
|
- _this.$message({
|
|
|
- type: "success",
|
|
|
- message: res.data.message
|
|
|
- });
|
|
|
- window.history.go(-1);
|
|
|
- } else {
|
|
|
- _this.$message({
|
|
|
- type: "warning",
|
|
|
- message: res.data.message
|
|
|
- });
|
|
|
- }
|
|
|
- })
|
|
|
- .catch(err => {
|
|
|
- // handle error
|
|
|
- console.error(err);
|
|
|
+ methods: {
|
|
|
+ initData() {
|
|
|
+ let _this = this;
|
|
|
+ const params = {
|
|
|
+ _currentPage: this.currentPage,
|
|
|
+ _size: this.size,
|
|
|
+ keyword: this.keyword
|
|
|
+ };
|
|
|
+ this.$axios
|
|
|
+ .get("sampletype/list", {
|
|
|
+ params
|
|
|
+ })
|
|
|
+ .then(res => {
|
|
|
+ _this.list = res.data.items;
|
|
|
+ _this.currentItemCount = res.data.currentItemCount;
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ console.error(err);
|
|
|
+ });
|
|
|
+ this.$axios
|
|
|
+ .get("equipment/elist", {
|
|
|
+ _currentPage: -1
|
|
|
+ })
|
|
|
+ .then(res => {
|
|
|
+ _this.devicelist = res.data;
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
+ this.$axios
|
|
|
+ .get("sampletype/imglist", {
|
|
|
+ _currentPage: -1
|
|
|
+ })
|
|
|
+ .then(res => {
|
|
|
+ _this.systemqiguanimglist = res.data;
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
+ this.$axios
|
|
|
+ .get("channels/list", {
|
|
|
+ _currentPage: -1
|
|
|
+ })
|
|
|
+ .then(res => {
|
|
|
+ // response
|
|
|
+ _this.devices = res.data.items;
|
|
|
+ _this.devices.forEach((item, k) => {
|
|
|
+ _this.devicesallid.push(item.Id);
|
|
|
});
|
|
|
- } else {
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
+ },
|
|
|
+ getsampetypeunit() {
|
|
|
+ // 获取样本单位
|
|
|
+ let _this = this;
|
|
|
+ _this.$axios.get("sampletype/sunitajax", {}).then(res => {
|
|
|
+ _this.sampeunitlist = res.data;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ handleAvatarSuccess(res, file) {
|
|
|
+ this.SampleTypeForm.Photo = res;
|
|
|
+ this.imageUrl = URL.createObjectURL(file.raw);
|
|
|
+ },
|
|
|
+ beforeAvatarUpload(file) {
|
|
|
+ const isimg = file.type.indexOf("image/") === 0;
|
|
|
+ const isLt50k = file.size / 1024 / 50 < 1;
|
|
|
+ if (!isimg) {
|
|
|
+ this.$message.error("上传图片只能是 图片 格式!");
|
|
|
return false;
|
|
|
}
|
|
|
- });
|
|
|
- },
|
|
|
- deletedata(val) {
|
|
|
- let _this = this;
|
|
|
- _this
|
|
|
- .$confirm("此操作将永久删除该数据, 是否继续?", "提示", {
|
|
|
- confirmButtonText: "确定",
|
|
|
- cancelButtonText: "取消",
|
|
|
- type: "warning"
|
|
|
- })
|
|
|
- .then(() => {
|
|
|
- _this.$axios
|
|
|
- .delete("sampletype" + val.Id, null)
|
|
|
- .then(res => {
|
|
|
- // response
|
|
|
- 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(() => {});
|
|
|
- },
|
|
|
- handleCheckeddeviceChange() {
|
|
|
- let checkedCount = this.selectdevices.length;
|
|
|
- this.checkAll = checkedCount === this.devicelist.length;
|
|
|
- this.isIndeterminate =
|
|
|
- checkedCount > 0 && checkedCount < this.devicelist.length;
|
|
|
- },
|
|
|
- handleCheckAllChange(val) {
|
|
|
- let _this = this;
|
|
|
- _this.selectdevices = [];
|
|
|
- if (val) {
|
|
|
- _this.devicelist.forEach((item, k) => {
|
|
|
- _this.selectdevices.push(item.Id + "");
|
|
|
+ if (!isLt50k) {
|
|
|
+ this.$message.error("上传图片大小不能超过 50kb!");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ },
|
|
|
+ selectsampletype(v, imgpath) {
|
|
|
+ if (v === this.selectsametyped) {
|
|
|
+ this.selectsametyped = 0;
|
|
|
+ this.SampleTypeForm.Photo = "";
|
|
|
+ } else {
|
|
|
+ this.selectsametyped = v;
|
|
|
+ this.SampleTypeForm.Photo = imgpath;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ resetForm(formName) {
|
|
|
+ this.$refs[formName].resetFields();
|
|
|
+ },
|
|
|
+ clearForm() {
|
|
|
+ this.SampleTypeForm = {
|
|
|
+ Code: "",
|
|
|
+ Name: "",
|
|
|
+ DefaultCapacity: "",
|
|
|
+ Unit: "",
|
|
|
+ ValidityHours: "",
|
|
|
+ Remark: "",
|
|
|
+ Sensors: [],
|
|
|
+ Timelong: false,
|
|
|
+ SubpackageCapacity: "", // 分装容量
|
|
|
+ SubpackageNum: 1,
|
|
|
+ };
|
|
|
+ },
|
|
|
+ savedata(formName) {
|
|
|
+ let _this = this;
|
|
|
+ this.$refs[formName].validate(valid => {
|
|
|
+ if (valid) {
|
|
|
+ if (_this.SampleTypeForm.Photo === "") {
|
|
|
+ _this.$message({
|
|
|
+ type: "warning",
|
|
|
+ message: "请选择样本图片!"
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ _this.SampleTypeForm.Sensors = _this.selectdevices;
|
|
|
+ _this.SampleTypeForm.PhotoType = parseInt(_this.imgtype);
|
|
|
+ _this.SampleTypeForm.DefaultCapacity = parseFloat(
|
|
|
+ _this.SampleTypeForm.DefaultCapacity
|
|
|
+ );
|
|
|
+ _this.SampleTypeForm.SubpackageCapacity = parseFloat(
|
|
|
+ _this.SampleTypeForm.SubpackageCapacity
|
|
|
+ );
|
|
|
+ _this.$axios
|
|
|
+ .post("sampletype", _this.SampleTypeForm)
|
|
|
+ .then(res => {
|
|
|
+ // response
|
|
|
+ if (res.data.code === 0) {
|
|
|
+ _this.$message({
|
|
|
+ type: "success",
|
|
|
+ message: res.data.message
|
|
|
+ });
|
|
|
+ window.history.go(-1);
|
|
|
+ } else {
|
|
|
+ _this.$message({
|
|
|
+ type: "warning",
|
|
|
+ message: res.data.message
|
|
|
+ });
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ // handle error
|
|
|
+ console.error(err);
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
});
|
|
|
+ },
|
|
|
+ deletedata(val) {
|
|
|
+ let _this = this;
|
|
|
+ _this
|
|
|
+ .$confirm("此操作将永久删除该数据, 是否继续?", "提示", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning"
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ _this.$axios
|
|
|
+ .delete("sampletype" + val.Id, null)
|
|
|
+ .then(res => {
|
|
|
+ // response
|
|
|
+ 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(() => {});
|
|
|
+ },
|
|
|
+ handleCheckeddeviceChange() {
|
|
|
+ let checkedCount = this.selectdevices.length;
|
|
|
+ this.checkAll = checkedCount === this.devicelist.length;
|
|
|
+ this.isIndeterminate =
|
|
|
+ checkedCount > 0 && checkedCount < this.devicelist.length;
|
|
|
+ },
|
|
|
+ handleCheckAllChange(val) {
|
|
|
+ let _this = this;
|
|
|
+ _this.selectdevices = [];
|
|
|
+ if (val) {
|
|
|
+ _this.devicelist.forEach((item, k) => {
|
|
|
+ _this.selectdevices.push(item.Id + "");
|
|
|
+ });
|
|
|
+ }
|
|
|
+ this.isIndeterminate = false;
|
|
|
}
|
|
|
- this.isIndeterminate = false;
|
|
|
}
|
|
|
- }
|
|
|
-};
|
|
|
+ };
|
|
|
+
|
|
|
</script>
|
|
|
|
|
|
<style>
|
|
|
-.samptypeimg-uploader .el-upload {
|
|
|
- border: 1px dashed #63b8ff;
|
|
|
- cursor: pointer;
|
|
|
- position: relative;
|
|
|
- overflow: hidden;
|
|
|
-}
|
|
|
-.samptypeimg-uploader .el-upload:hover {
|
|
|
- border-color: #228b22;
|
|
|
-}
|
|
|
-.samptypeimg-uploader-icon {
|
|
|
- font-size: 28px;
|
|
|
- color: #63b8ff;
|
|
|
- width: 88px;
|
|
|
- height: 88px;
|
|
|
- line-height: 88px;
|
|
|
- text-align: center;
|
|
|
-}
|
|
|
-.samptypeimg-uploader-icon:hover {
|
|
|
- color: #228b22;
|
|
|
-}
|
|
|
-.uploadsampletypeimg {
|
|
|
- width: 88px;
|
|
|
- height: 88px;
|
|
|
- display: block;
|
|
|
-}
|
|
|
-.sampletypelist {
|
|
|
- display: flex;
|
|
|
- justify-content: center;
|
|
|
- background: #add8e6;
|
|
|
- margin: 5px 3px 0 3px;
|
|
|
- min-height: 50px;
|
|
|
- min-width: 50px;
|
|
|
- max-height: 50px;
|
|
|
-}
|
|
|
-.sampletypelist:hover {
|
|
|
- box-shadow: 2px 0 8px rgba(0, 0, 0, 0.4);
|
|
|
- transform: scale(1.15);
|
|
|
-}
|
|
|
-.sampleselectedcss {
|
|
|
- background: #228b22;
|
|
|
-}
|
|
|
-</style>
|
|
|
+ .samptypeimg-uploader .el-upload {
|
|
|
+ border: 1px dashed #63b8ff;
|
|
|
+ cursor: pointer;
|
|
|
+ position: relative;
|
|
|
+ overflow: hidden;
|
|
|
+ }
|
|
|
|
|
|
+ .samptypeimg-uploader .el-upload:hover {
|
|
|
+ border-color: #228b22;
|
|
|
+ }
|
|
|
+
|
|
|
+ .samptypeimg-uploader-icon {
|
|
|
+ font-size: 28px;
|
|
|
+ color: #63b8ff;
|
|
|
+ width: 88px;
|
|
|
+ height: 88px;
|
|
|
+ line-height: 88px;
|
|
|
+ text-align: center;
|
|
|
+ }
|
|
|
+
|
|
|
+ .samptypeimg-uploader-icon:hover {
|
|
|
+ color: #228b22;
|
|
|
+ }
|
|
|
+
|
|
|
+ .uploadsampletypeimg {
|
|
|
+ width: 88px;
|
|
|
+ height: 88px;
|
|
|
+ display: block;
|
|
|
+ }
|
|
|
+
|
|
|
+ .sampletypelist {
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ background: #add8e6;
|
|
|
+ margin: 5px 3px 0 3px;
|
|
|
+ min-height: 50px;
|
|
|
+ min-width: 50px;
|
|
|
+ max-height: 50px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .sampletypelist:hover {
|
|
|
+ box-shadow: 2px 0 8px rgba(0, 0, 0, 0.4);
|
|
|
+ transform: scale(1.15);
|
|
|
+ }
|
|
|
+
|
|
|
+ .sampleselectedcss {
|
|
|
+ background: #228b22;
|
|
|
+ }
|
|
|
+
|
|
|
+</style>
|