|
@@ -56,7 +56,8 @@
|
|
|
v-model="info.unit"
|
|
|
placeholder="请输入单位"
|
|
|
/>
|
|
|
- </FormItem>
|
|
|
+ </FormItem>
|
|
|
+
|
|
|
<FormItem label="损耗(%)" v-show="info.detail.length == 0" prop="scale">
|
|
|
<Input
|
|
|
type="number"
|
|
@@ -71,7 +72,54 @@
|
|
|
v-model="info.remark"
|
|
|
placeholder="请输入描述"
|
|
|
/>
|
|
|
- </FormItem>
|
|
|
+ </FormItem>
|
|
|
+ <FormItem label="上传附件:">
|
|
|
+ <div class="product-img">
|
|
|
+ <div class="product-add">
|
|
|
+ <div class="img_items" v-if="this.info.img_url !== ''">
|
|
|
+ <img
|
|
|
+ @click="looks(info.img_url)"
|
|
|
+ :src="$store.state.ip + this.info.img_url"
|
|
|
+ alt=""
|
|
|
+ />
|
|
|
+ <Icon
|
|
|
+ v-if="type != 3"
|
|
|
+ size="20"
|
|
|
+ @click="delItems( )"
|
|
|
+ class="delete-img"
|
|
|
+ type="ios-close-circle"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ <div class="add-items" v-if="type != 3&&!info.img_url">
|
|
|
+ <div class="item">
|
|
|
+ <Icon size="50" type="ios-add" />
|
|
|
+ </div>
|
|
|
+ <span>支持jpg/png格式</span>
|
|
|
+ <input
|
|
|
+ @change="changeIpt($event, info.img_url)"
|
|
|
+ type="file"
|
|
|
+ class="ipt"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <!-- <Button type="primary"
|
|
|
+ style="margin-right:10px;"
|
|
|
+ ghost>上传附件</Button> -->
|
|
|
+ <!-- <Upload style="display: inline"
|
|
|
+ name="your_file"
|
|
|
+ :show-upload-list="false"
|
|
|
+ :headers="headers"
|
|
|
+ multiple
|
|
|
+ :data="uploadData"
|
|
|
+ :on-error="uploadError"
|
|
|
+ :on-progress="onProgress"
|
|
|
+ :on-success="uploadSuccess"
|
|
|
+ :action="$store.state.ip + '/api/deep_img_import'">
|
|
|
+ <Button type="primary"
|
|
|
+ style="margin-right: 10px">上传附件</Button>
|
|
|
+ </Upload> -->
|
|
|
+ </FormItem>
|
|
|
<FormItem label="安全库存" v-show="isShowInfoMinStock" prop="stock">
|
|
|
<Input
|
|
|
type="number"
|
|
@@ -162,7 +210,8 @@
|
|
|
v-model="rows.price"
|
|
|
placeholder="请输入金额"
|
|
|
/>
|
|
|
- </FormItem>
|
|
|
+ </FormItem>
|
|
|
+
|
|
|
<FormItem label="操作" v-if="isShowDetailBtn">
|
|
|
<div
|
|
|
style="width:100%;display:flex;height:100%;align-items:center;"
|
|
@@ -184,6 +233,7 @@
|
|
|
>
|
|
|
</div>
|
|
|
</FormItem>
|
|
|
+
|
|
|
</Form>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -209,6 +259,7 @@ export default {
|
|
|
type: 1,
|
|
|
info: {
|
|
|
m_id: "",
|
|
|
+ img_url:'',
|
|
|
detail: [
|
|
|
{
|
|
|
long: "",
|
|
@@ -263,6 +314,7 @@ export default {
|
|
|
: this.info.m_id;
|
|
|
this.axios("/api/basics_material_index").then((res) => {
|
|
|
this.materialList = res.data.data;
|
|
|
+ console.log(res)
|
|
|
});
|
|
|
if (this.id) {
|
|
|
this.getData(this.id);
|
|
@@ -327,8 +379,38 @@ export default {
|
|
|
},
|
|
|
},
|
|
|
methods: {
|
|
|
+ looks(img) {
|
|
|
+ const array = [{ img_url: img }];
|
|
|
+ this.$previewImg({
|
|
|
+ list: array,
|
|
|
+ baseUrl: this.$store.state.ip,
|
|
|
+ baseImgField: "img_url",
|
|
|
+ baseTitleField: "",
|
|
|
+ });
|
|
|
+ },
|
|
|
+ delItems() {
|
|
|
+ this.info.img_url = '';
|
|
|
+ this.$forceUpdate();
|
|
|
+ },
|
|
|
+ changeIpt(e, row) {
|
|
|
+ // if (this.info.img.length >= 3) {
|
|
|
+ // return this.$Message.warning("图片最多上传3张");
|
|
|
+ // }
|
|
|
+ let file = e.target.files[0];
|
|
|
+ this.postImg(file, row);
|
|
|
+ e.target.value = null;
|
|
|
+ },
|
|
|
+ postImg(file, row) {
|
|
|
+ let formData = new FormData();
|
|
|
+ formData.append("file", file);
|
|
|
+ this.axios.post("/api/upload_pic", formData).then((res) => {
|
|
|
+ this.info.img_url = res.data.url;
|
|
|
+ this.$forceUpdate();
|
|
|
+ });
|
|
|
+ },
|
|
|
getData(id) {
|
|
|
this.axios("/api/material", { params: { id: id } }).then((res) => {
|
|
|
+ console.log(res)
|
|
|
let data = res.data.shift();
|
|
|
this.info = data;
|
|
|
if (this.info.detail.length < 1) {
|
|
@@ -354,6 +436,7 @@ export default {
|
|
|
(this.info.detail[0].price = this.info.price));
|
|
|
type == 4 ? (this.info.id = "") : "";
|
|
|
this.axios.post("/api/material", this.info).then((res) => {
|
|
|
+ console.log(this.info)
|
|
|
if (res.code == 200) {
|
|
|
this.$Message.success(res.msg);
|
|
|
this.back();
|
|
@@ -408,4 +491,68 @@ export default {
|
|
|
position: relative;
|
|
|
margin: 20px 0;
|
|
|
}
|
|
|
+.product-img {
|
|
|
+ padding-top: 10px;
|
|
|
+}
|
|
|
+.product-add {
|
|
|
+ padding: 10px 0;
|
|
|
+ // display: flex;
|
|
|
+ flex-wrap: nowrap;
|
|
|
+ .ipt {
|
|
|
+ position: absolute;
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ opacity: 0;
|
|
|
+ cursor: pointer;
|
|
|
+ outline: none;
|
|
|
+ top: 0;
|
|
|
+ left: 0;
|
|
|
+ }
|
|
|
+ .add-items {
|
|
|
+ width: 120px;
|
|
|
+ height: 120px;
|
|
|
+ border: 1px dotted #e7e7e7;
|
|
|
+ border-radius: 5px;
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ align-items: center;
|
|
|
+ overflow: hidden;
|
|
|
+ position: relative;
|
|
|
+ flex-direction: column;
|
|
|
+ background: #f4f5f7;
|
|
|
+ .item {
|
|
|
+ width: 46px;
|
|
|
+ height: 46px;
|
|
|
+ background: #3764ff;
|
|
|
+ opacity: 0.6;
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ align-items: center;
|
|
|
+ border-radius: 50%;
|
|
|
+ color: #fff;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .img_items {
|
|
|
+ width: 120px;
|
|
|
+ height: 120px;
|
|
|
+ margin-bottom: 10px;
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ align-items: center;
|
|
|
+ background: #e7e7e7;
|
|
|
+ margin-right: 10px;
|
|
|
+ border-radius: 5px;
|
|
|
+ position: relative;
|
|
|
+ img {
|
|
|
+ max-width: 108px;
|
|
|
+ max-height: 108px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+.delete-img {
|
|
|
+ position: absolute;
|
|
|
+ right: 0px;
|
|
|
+ top: 0px;
|
|
|
+ color: red;
|
|
|
+}
|
|
|
</style>
|