|
|
@@ -91,193 +91,193 @@
|
|
|
</template>
|
|
|
<script>
|
|
|
export default {
|
|
|
- name: "sampletypeedit",
|
|
|
- data() {
|
|
|
+ name: 'sampletypeedit',
|
|
|
+ data () {
|
|
|
return {
|
|
|
- imghost: "",
|
|
|
+ imghost: '',
|
|
|
rulessampletypeinfo: {
|
|
|
- Code: [{ required: true, message: "请输入编码", trigger: "blur" }],
|
|
|
- Name: [{ required: true, message: "请输入姓名", trigger: "blur" }]
|
|
|
+ Code: [{ required: true, message: '请输入编码', trigger: 'blur' }],
|
|
|
+ Name: [{ required: true, message: '请输入姓名', trigger: 'blur' }]
|
|
|
},
|
|
|
validityhours: 0,
|
|
|
currentItemCount: 0,
|
|
|
currentPage: 1,
|
|
|
size: 10,
|
|
|
list: [],
|
|
|
- keyword: "",
|
|
|
+ keyword: '',
|
|
|
dialogFormVisible: false,
|
|
|
- dialogtitle: "",
|
|
|
+ dialogtitle: '',
|
|
|
operatingitem: 0,
|
|
|
isIndeterminate: true,
|
|
|
selectdevices: [],
|
|
|
showquerydiv: false,
|
|
|
systemqiguanimglist: [],
|
|
|
- imgtype: "0",
|
|
|
+ imgtype: '0',
|
|
|
selectsametyped: 0,
|
|
|
- imageUrl: "",
|
|
|
+ imageUrl: '',
|
|
|
SampleTypeForm: {
|
|
|
- Name: "",
|
|
|
- Code: "",
|
|
|
- DefaultCapacity: "",
|
|
|
- Unit: "",
|
|
|
+ Name: '',
|
|
|
+ Code: '',
|
|
|
+ DefaultCapacity: '',
|
|
|
+ Unit: '',
|
|
|
ValidityHours: 0,
|
|
|
Timelong: false,
|
|
|
id: 0,
|
|
|
- Remark: "",
|
|
|
+ Remark: '',
|
|
|
Sensors: [],
|
|
|
- Photo: "",
|
|
|
+ Photo: '',
|
|
|
PhotoType: 0,
|
|
|
- SubpackageCapacity: "", // 分装容量
|
|
|
+ SubpackageCapacity: '', // 分装容量
|
|
|
SubpackageNum: 1
|
|
|
},
|
|
|
sampeunitlist: [] // 样本单位
|
|
|
- };
|
|
|
+ }
|
|
|
},
|
|
|
- created() {
|
|
|
- this.imghost = process.env.imgserverhost;
|
|
|
- let pid = this.$route.params.opera;
|
|
|
+ created () {
|
|
|
+ this.imghost = process.env.imgserverhost
|
|
|
+ let pid = this.$route.params.opera
|
|
|
// initial data
|
|
|
- this.initData(pid);
|
|
|
+ this.initData(pid)
|
|
|
// 加载单位
|
|
|
- this.getsampetypeunit();
|
|
|
+ this.getsampetypeunit()
|
|
|
},
|
|
|
methods: {
|
|
|
- initData(pid) {
|
|
|
- let _this = this;
|
|
|
+ initData (pid) {
|
|
|
+ let _this = this
|
|
|
// get 图片
|
|
|
this.$axios
|
|
|
- .get("sampletype/imglist", { _currentPage: -1 })
|
|
|
+ .get('sampletype/imglist', { _currentPage: -1 })
|
|
|
.then(res => {
|
|
|
- this.systemqiguanimglist = res.data;
|
|
|
+ this.systemqiguanimglist = res.data
|
|
|
})
|
|
|
- .catch(() => {});
|
|
|
+ .catch(() => {})
|
|
|
this.$axios
|
|
|
- .get("sampletype/getmodel/" + pid, {})
|
|
|
+ .get('sampletype/getmodel/' + pid, {})
|
|
|
.then(res => {
|
|
|
// response
|
|
|
- this.SampleTypeForm = res.data;
|
|
|
+ this.SampleTypeForm = res.data
|
|
|
// 有效期处理
|
|
|
if (this.SampleTypeForm.ValidityHours === -100) {
|
|
|
- this.SampleTypeForm.Timelong = true;
|
|
|
+ this.SampleTypeForm.Timelong = true
|
|
|
}
|
|
|
// 选中图片
|
|
|
- _this.imgtype = _this.SampleTypeForm.PhotoType + "";
|
|
|
+ _this.imgtype = _this.SampleTypeForm.PhotoType + ''
|
|
|
if (_this.SampleTypeForm.PhotoType === 1) {
|
|
|
- _this.imageUrl = _this.imghost + _this.SampleTypeForm.Photo;
|
|
|
+ _this.imageUrl = _this.imghost + _this.SampleTypeForm.Photo
|
|
|
} else {
|
|
|
for (var i = 0; i < _this.systemqiguanimglist.length; i++) {
|
|
|
if (
|
|
|
_this.systemqiguanimglist[i].ImgAddr ===
|
|
|
_this.SampleTypeForm.Photo
|
|
|
) {
|
|
|
- _this.selectsametyped = _this.systemqiguanimglist[i].Id;
|
|
|
- break;
|
|
|
+ _this.selectsametyped = _this.systemqiguanimglist[i].Id
|
|
|
+ break
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
.catch(err => {
|
|
|
// handle error
|
|
|
- console.error(err);
|
|
|
- });
|
|
|
+ console.error(err)
|
|
|
+ })
|
|
|
},
|
|
|
- getsampetypeunit() {
|
|
|
+ getsampetypeunit () {
|
|
|
// 获取样本单位
|
|
|
- let _this = this;
|
|
|
- _this.$axios.get("sampletype/sunitajax", {}).then(res => {
|
|
|
- _this.sampeunitlist = res.data;
|
|
|
- });
|
|
|
+ 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);
|
|
|
+ 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;
|
|
|
+ beforeAvatarUpload (file) {
|
|
|
+ const isimg = file.type.indexOf('image/') === 0
|
|
|
+ const isLt50k = file.size / 1024 / 50 < 1
|
|
|
if (!isimg) {
|
|
|
- this.$message.error("上传图片只能是 图片 格式!");
|
|
|
- return false;
|
|
|
+ this.$message.error('上传图片只能是 图片 格式!')
|
|
|
+ return false
|
|
|
}
|
|
|
if (!isLt50k) {
|
|
|
- this.$message.error("上传图片大小不能超过 50kb!");
|
|
|
- return false;
|
|
|
+ this.$message.error('上传图片大小不能超过 50kb!')
|
|
|
+ return false
|
|
|
}
|
|
|
- return true;
|
|
|
+ return true
|
|
|
},
|
|
|
- selectsampletype(v, imgpath) {
|
|
|
+ selectsampletype (v, imgpath) {
|
|
|
if (v === this.selectsametyped) {
|
|
|
- this.selectsametyped = 0;
|
|
|
- this.SampleTypeForm.Photo = "";
|
|
|
+ this.selectsametyped = 0
|
|
|
+ this.SampleTypeForm.Photo = ''
|
|
|
} else {
|
|
|
- this.selectsametyped = v;
|
|
|
- this.SampleTypeForm.Photo = imgpath;
|
|
|
+ this.selectsametyped = v
|
|
|
+ this.SampleTypeForm.Photo = imgpath
|
|
|
}
|
|
|
},
|
|
|
- resetForm(formName) {
|
|
|
- this.$refs[formName].resetFields();
|
|
|
+ resetForm (formName) {
|
|
|
+ this.$refs[formName].resetFields()
|
|
|
},
|
|
|
- savedata(formName) {
|
|
|
- let _this = this;
|
|
|
+ savedata (formName) {
|
|
|
+ let _this = this
|
|
|
this.$refs[formName].validate(valid => {
|
|
|
if (valid) {
|
|
|
- if (_this.SampleTypeForm.Photo === "") {
|
|
|
+ if (_this.SampleTypeForm.Photo === '') {
|
|
|
_this.$message({
|
|
|
- type: "warning",
|
|
|
- message: "请选择样本图片!"
|
|
|
- });
|
|
|
- return;
|
|
|
+ type: 'warning',
|
|
|
+ message: '请选择样本图片!'
|
|
|
+ })
|
|
|
+ return
|
|
|
}
|
|
|
- this.SampleTypeForm.id = this.$route.params.opera;
|
|
|
- _this.SampleTypeForm.PhotoType = parseInt(_this.imgtype);
|
|
|
+ this.SampleTypeForm.id = this.$route.params.opera
|
|
|
+ _this.SampleTypeForm.PhotoType = parseInt(_this.imgtype)
|
|
|
_this.SampleTypeForm.DefaultCapacity = parseFloat(
|
|
|
_this.SampleTypeForm.DefaultCapacity
|
|
|
- );
|
|
|
+ )
|
|
|
_this.SampleTypeForm.SubpackageCapacity = parseFloat(
|
|
|
_this.SampleTypeForm.SubpackageCapacity
|
|
|
- );
|
|
|
+ )
|
|
|
_this.$axios
|
|
|
- .put("sampletype/" + _this.SampleTypeForm.id, _this.SampleTypeForm)
|
|
|
+ .put('sampletype/' + _this.SampleTypeForm.id, _this.SampleTypeForm)
|
|
|
.then(res => {
|
|
|
// response
|
|
|
if (res.data.code === 0) {
|
|
|
_this.$message({
|
|
|
- type: "success",
|
|
|
+ type: 'success',
|
|
|
message: res.data.message
|
|
|
- });
|
|
|
+ })
|
|
|
// 返回
|
|
|
- window.history.go(-1);
|
|
|
+ window.history.go(-1)
|
|
|
} else {
|
|
|
_this.$message({
|
|
|
- type: "warning",
|
|
|
+ type: 'warning',
|
|
|
message: res.data.message
|
|
|
- });
|
|
|
+ })
|
|
|
}
|
|
|
})
|
|
|
- .catch(() => {});
|
|
|
+ .catch(() => {})
|
|
|
} else {
|
|
|
- return false;
|
|
|
+ return false
|
|
|
}
|
|
|
- });
|
|
|
+ })
|
|
|
},
|
|
|
- handleCheckedCitiesChange(value) {
|
|
|
- let checkedCount = value.length;
|
|
|
- this.checkAll = checkedCount === this.cities.length;
|
|
|
+ handleCheckedCitiesChange (value) {
|
|
|
+ let checkedCount = value.length
|
|
|
+ this.checkAll = checkedCount === this.cities.length
|
|
|
this.isIndeterminate =
|
|
|
- checkedCount > 0 && checkedCount < this.cities.length;
|
|
|
+ checkedCount > 0 && checkedCount < this.cities.length
|
|
|
},
|
|
|
- handleCheckAllChange(val) {
|
|
|
- let _this = this;
|
|
|
- _this.selectdevices = [];
|
|
|
+ handleCheckAllChange (val) {
|
|
|
+ let _this = this
|
|
|
+ _this.selectdevices = []
|
|
|
if (val) {
|
|
|
_this.devicelist.forEach((item, k) => {
|
|
|
- _this.selectdevices.push(item.Id);
|
|
|
- });
|
|
|
+ _this.selectdevices.push(item.Id)
|
|
|
+ })
|
|
|
}
|
|
|
- this.isIndeterminate = false;
|
|
|
+ this.isIndeterminate = false
|
|
|
}
|
|
|
}
|
|
|
-};
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<style>
|