|
@@ -1,207 +1,254 @@
|
|
<template>
|
|
<template>
|
|
<a-button type="link" @click="showDrawer" size="small">编辑</a-button>
|
|
<a-button type="link" @click="showDrawer" size="small">编辑</a-button>
|
|
- <a-drawer
|
|
|
|
- v-model:open="open"
|
|
|
|
- class="custom-class"
|
|
|
|
- title="编辑每日一签"
|
|
|
|
- placement="right"
|
|
|
|
- width="600"
|
|
|
|
- :closable="false"
|
|
|
|
- >
|
|
|
|
- <a-form ref="formRef" :model="form" layout="vertical">
|
|
|
|
- <a-row :gutter="16">
|
|
|
|
- <a-col :span="24">
|
|
|
|
- <a-form-item label="描述" name="notes">
|
|
|
|
- <a-textarea v-model:value="form.notes" autoSize placeholder="输入描述" />
|
|
|
|
- </a-form-item>
|
|
|
|
- </a-col>
|
|
|
|
- <a-col :span="24">
|
|
|
|
- <a-form-item label="是否二维码" name="isqrcode" :rules="[{ required: true, message: '请选择',trigger:'change'}]">
|
|
|
|
- <a-radio-group v-model:value="form.isqrcode">
|
|
|
|
- <a-radio :value="1">有二维码</a-radio>
|
|
|
|
- <a-radio :value="0">无二维码</a-radio>
|
|
|
|
- </a-radio-group>
|
|
|
|
- </a-form-item>
|
|
|
|
- </a-col>
|
|
|
|
- <a-col :span="24" v-if="form.isqrcode == 1">
|
|
|
|
- <a-form-item label="扫码地址" name="qrcodecontent" :rules="[{ required: true, message: '请输入地址',trigger:'change'}]">
|
|
|
|
- <a-input-group compact>
|
|
|
|
- <a-input v-model:value="form.qrcodecontent" style="width: calc(100% - 116px)" />
|
|
|
|
- <a-button type="primary" @click="$refs.selectProduct.modeVisible=true">从产品添加</a-button>
|
|
|
|
- </a-input-group>
|
|
|
|
- </a-form-item>
|
|
|
|
- <SelectModel
|
|
|
|
- wdith="90%"
|
|
|
|
- ref="selectProduct"
|
|
|
|
- rowKey="itemid"
|
|
|
|
- :param="selectProductParam"
|
|
|
|
- :columns="utils.TBLayout('productList')" title="添加扫码地址"
|
|
|
|
- :isSelect="false"
|
|
|
|
- :custom="true"
|
|
|
|
|
|
+ <a-drawer
|
|
|
|
+ v-model:open="open"
|
|
|
|
+ class="custom-class"
|
|
|
|
+ title="编辑每日一签"
|
|
|
|
+ placement="right"
|
|
|
|
+ width="600"
|
|
|
|
+ :closable="false"
|
|
|
|
+ >
|
|
|
|
+ <a-form ref="formRef" :model="form" layout="vertical">
|
|
|
|
+ <a-row :gutter="16">
|
|
|
|
+ <a-col :span="24">
|
|
|
|
+ <a-form-item label="描述" name="notes">
|
|
|
|
+ <a-textarea
|
|
|
|
+ v-model:value="form.notes"
|
|
|
|
+ autoSize
|
|
|
|
+ placeholder="输入描述"
|
|
|
|
+ />
|
|
|
|
+ </a-form-item>
|
|
|
|
+ </a-col>
|
|
|
|
+ <a-col :span="24">
|
|
|
|
+ <a-form-item
|
|
|
|
+ label="是否二维码"
|
|
|
|
+ name="isqrcode"
|
|
|
|
+ :rules="[{ required: true, message: '请选择', trigger: 'change' }]"
|
|
|
|
+ >
|
|
|
|
+ <a-radio-group v-model:value="form.isqrcode">
|
|
|
|
+ <a-radio :value="1">有二维码</a-radio>
|
|
|
|
+ <a-radio :value="0">无二维码</a-radio>
|
|
|
|
+ </a-radio-group>
|
|
|
|
+ </a-form-item>
|
|
|
|
+ </a-col>
|
|
|
|
+ <a-col :span="24" v-if="form.isqrcode == 1">
|
|
|
|
+ <a-form-item
|
|
|
|
+ label="扫码地址"
|
|
|
|
+ name="qrcodecontent"
|
|
|
|
+ :rules="[
|
|
|
|
+ { required: true, message: '请输入地址', trigger: 'change' },
|
|
|
|
+ ]"
|
|
|
|
+ >
|
|
|
|
+ <a-input-group compact>
|
|
|
|
+ <a-input
|
|
|
|
+ v-model:value="form.qrcodecontent"
|
|
|
|
+ style="width: calc(100% - 116px)"
|
|
|
|
+ />
|
|
|
|
+ <a-button
|
|
|
|
+ type="primary"
|
|
|
|
+ @click="$refs.selectProduct.modeVisible = true"
|
|
|
|
+ >从产品添加</a-button
|
|
>
|
|
>
|
|
- <template #titleLeft>
|
|
|
|
- <div style="display: flex;align-items: center;">
|
|
|
|
- <span style="width:50px">类型:</span>
|
|
|
|
- <a-select
|
|
|
|
- style="width: 150px;"
|
|
|
|
- ref="select"
|
|
|
|
- v-model:value="selectProductParam.content.type"
|
|
|
|
- @change="$refs.selectProduct.list.listData()"
|
|
|
|
- >
|
|
|
|
- <a-select-option :value="3">单品</a-select-option>
|
|
|
|
- <a-select-option :value="1">效果图</a-select-option>
|
|
|
|
- <a-select-option :value="2">设计实景</a-select-option>
|
|
|
|
- </a-select>
|
|
|
|
- </div>
|
|
|
|
-
|
|
|
|
- </template>
|
|
|
|
- <template #custom="{data}">
|
|
|
|
- <template v-if="data.column.dataIndex == 'attinfos'">
|
|
|
|
- <a-image v-if="data.record.attinfos.length" :src=" data.record.attinfos[0].url" style="width:100px"></a-image>
|
|
|
|
- </template>
|
|
|
|
- <template v-else-if="data.column.dataIndex == 'operation'">
|
|
|
|
- <CustomButton type="link" @click="selectProductFun(data)">选择</CustomButton>
|
|
|
|
- </template>
|
|
|
|
- <template v-else>{{ data.record[data.column.dataIndex] }}</template>
|
|
|
|
- </template>
|
|
|
|
- <template v-slot:slot1>
|
|
|
|
-
|
|
|
|
- </template>
|
|
|
|
- </SelectModel>
|
|
|
|
- </a-col>
|
|
|
|
-
|
|
|
|
- <a-col :span="24">
|
|
|
|
- <a-form-item label="上档日期" name="ondate">
|
|
|
|
- <a-date-picker style="width:100%" v-model:value="form.ondate" value-format="YYYY-MM-DD" placeholder="请选择上档日期"/>
|
|
|
|
- </a-form-item>
|
|
|
|
- </a-col>
|
|
|
|
- <a-col :span="24">
|
|
|
|
- <a-form-item label="文件" name="attinfos" :rules="[{ required: true, message: '请选择文件',trigger:'change'}]">
|
|
|
|
- <!-- <Upload :multiple="false" ref="upload" :bindData="bindData" accept="image/*,video/*" @fileChange="form.attinfos='1'"></Upload> -->
|
|
|
|
- <Upload
|
|
|
|
- :bindData="bindData"
|
|
|
|
- @uploadSuccess="loading=false"
|
|
|
|
- @fileChange="form.attinfos='1';loading=true"
|
|
|
|
- :multiple="true"
|
|
|
|
- accept="image/* , video/*"
|
|
|
|
- ref="upload"
|
|
|
|
- ></Upload>
|
|
|
|
- </a-form-item>
|
|
|
|
- </a-col>
|
|
|
|
- </a-row>
|
|
|
|
- </a-form>
|
|
|
|
- <template #extra>
|
|
|
|
- <a-space>
|
|
|
|
- <CustomButton type="primary" size="samll" @click="submit">保存</CustomButton>
|
|
|
|
- </a-space>
|
|
|
|
- </template>
|
|
|
|
- </a-drawer>
|
|
|
|
- </template>
|
|
|
|
|
|
+ </a-input-group>
|
|
|
|
+ </a-form-item>
|
|
|
|
+ <SelectModel
|
|
|
|
+ wdith="90%"
|
|
|
|
+ ref="selectProduct"
|
|
|
|
+ rowKey="itemid"
|
|
|
|
+ :param="selectProductParam"
|
|
|
|
+ :columns="utils.TBLayout('productList')"
|
|
|
|
+ title="添加扫码地址"
|
|
|
|
+ :isSelect="false"
|
|
|
|
+ :custom="true"
|
|
|
|
+ >
|
|
|
|
+ <template #titleLeft>
|
|
|
|
+ <div style="display: flex; align-items: center">
|
|
|
|
+ <span style="width: 50px">类型:</span>
|
|
|
|
+ <a-select
|
|
|
|
+ style="width: 150px"
|
|
|
|
+ ref="select"
|
|
|
|
+ v-model:value="selectProductParam.content.type"
|
|
|
|
+ @change="$refs.selectProduct.list.listData()"
|
|
|
|
+ >
|
|
|
|
+ <a-select-option :value="3">单品</a-select-option>
|
|
|
|
+ <a-select-option :value="1">效果图</a-select-option>
|
|
|
|
+ <a-select-option :value="2">设计实景</a-select-option>
|
|
|
|
+ </a-select>
|
|
|
|
+ </div>
|
|
|
|
+ </template>
|
|
|
|
+ <template #custom="{ data }">
|
|
|
|
+ <template v-if="data.column.dataIndex == 'attinfos'">
|
|
|
|
+ <a-image
|
|
|
|
+ v-if="data.record.attinfos.length"
|
|
|
|
+ :src="data.record.attinfos[0].url"
|
|
|
|
+ style="width: 100px"
|
|
|
|
+ ></a-image>
|
|
|
|
+ </template>
|
|
|
|
+ <template v-else-if="data.column.dataIndex == 'operation'">
|
|
|
|
+ <CustomButton type="link" @click="selectProductFun(data)"
|
|
|
|
+ >选择</CustomButton
|
|
|
|
+ >
|
|
|
|
+ </template>
|
|
|
|
+ <template v-else>{{
|
|
|
|
+ data.record[data.column.dataIndex]
|
|
|
|
+ }}</template>
|
|
|
|
+ </template>
|
|
|
|
+ <template v-slot:slot1> </template>
|
|
|
|
+ </SelectModel>
|
|
|
|
+ </a-col>
|
|
|
|
+
|
|
|
|
+ <a-col :span="24">
|
|
|
|
+ <a-form-item label="上档日期" name="ondate">
|
|
|
|
+ <a-date-picker
|
|
|
|
+ style="width: 100%"
|
|
|
|
+ v-model:value="form.ondate"
|
|
|
|
+ value-format="YYYY-MM-DD"
|
|
|
|
+ placeholder="请选择上档日期"
|
|
|
|
+ />
|
|
|
|
+ </a-form-item>
|
|
|
|
+ </a-col>
|
|
|
|
+ <a-col :span="24">
|
|
|
|
+ <a-form-item
|
|
|
|
+ label="文件"
|
|
|
|
+ name="attinfos"
|
|
|
|
+ :rules="[
|
|
|
|
+ { required: true, message: '请选择文件', trigger: 'change' },
|
|
|
|
+ ]"
|
|
|
|
+ >
|
|
|
|
+ <!-- <Upload :multiple="false" ref="upload" :bindData="bindData" accept="image/*,video/*" @fileChange="form.attinfos='1'"></Upload> -->
|
|
|
|
+ <Upload
|
|
|
|
+ :bindData="bindData"
|
|
|
|
+ @uploadSuccess="loading = false"
|
|
|
|
+ @fileChange="
|
|
|
|
+ form.attinfos = '1';
|
|
|
|
+ loading = true;
|
|
|
|
+ "
|
|
|
|
+ :multiple="true"
|
|
|
|
+ accept="image/* , video/*"
|
|
|
|
+ ref="upload"
|
|
|
|
+ ></Upload>
|
|
|
|
+ </a-form-item>
|
|
|
|
+ </a-col>
|
|
|
|
+ </a-row>
|
|
|
|
+ </a-form>
|
|
|
|
+ <template #extra>
|
|
|
|
+ <a-space>
|
|
|
|
+ <CustomButton type="primary" size="samll" @click="submit"
|
|
|
|
+ >保存</CustomButton
|
|
|
|
+ >
|
|
|
|
+ </a-space>
|
|
|
|
+ </template>
|
|
|
|
+ </a-drawer>
|
|
|
|
+</template>
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
- import Upload from '@/MAR/assetsStore/detail/fileUpload.vue'
|
|
|
|
- // import Upload from '@/MAR/archivesMag/modules/workManage/fileUpload.vue'
|
|
|
|
- import SelectModel from '@/components/selectModel/index2.vue'
|
|
|
|
- import {ref,defineEmits, computed, nextTick, watch} from 'vue'
|
|
|
|
- import Api from '@/api/api'
|
|
|
|
- import utils from '@/utils/utils'
|
|
|
|
- import { useAuthStore } from '@/stores/modules/auth'
|
|
|
|
- const emit = defineEmits(['onSuccess'])
|
|
|
|
- const props = defineProps(['rowData'])
|
|
|
|
- const open = ref(false)
|
|
|
|
- let currentTime = computed(() => {
|
|
|
|
- let time = ''
|
|
|
|
- let date = new Date()
|
|
|
|
- let year = date.getFullYear()
|
|
|
|
- let month = date.getMonth() + 1
|
|
|
|
- let day = date.getDate()
|
|
|
|
- if (month < 10) month = '0' + month
|
|
|
|
- if (day < 10) day = '0' + day
|
|
|
|
- console.log(year,month,day);
|
|
|
|
- return `${year}-${month}-${day}`
|
|
|
|
- })
|
|
|
|
- const form = ref({
|
|
|
|
- "sat_sharematerialid": 0,
|
|
|
|
- "type": 1, //1:图片;2:视频;3:图文
|
|
|
|
- "notes": "",
|
|
|
|
- "isqrcode": 1,
|
|
|
|
- "qrcodecontent": "",
|
|
|
|
- "ondate": currentTime,
|
|
|
|
- "attinfos":''
|
|
|
|
- })
|
|
|
|
- let selectProductParam = ref({
|
|
|
|
- "id": 20240420095702,
|
|
|
|
- "content": {
|
|
|
|
- "type": 1, //1,效果图,2:设计实景,3:单品
|
|
|
|
- "pageNumber": 1,
|
|
|
|
- "pageSize": 20,
|
|
|
|
- "where": {
|
|
|
|
- "condition": ""
|
|
|
|
- }
|
|
|
|
|
|
+import Upload from "@/MAR/assetsStore/detail/fileUpload.vue";
|
|
|
|
+// import Upload from '@/MAR/archivesMag/modules/workManage/fileUpload.vue'
|
|
|
|
+import SelectModel from "@/components/selectModel/index2.vue";
|
|
|
|
+import { ref, defineEmits, computed, nextTick, watch } from "vue";
|
|
|
|
+import Api from "@/api/api";
|
|
|
|
+import utils from "@/utils/utils";
|
|
|
|
+import { useAuthStore } from "@/stores/modules/auth";
|
|
|
|
+const emit = defineEmits(["onSuccess"]);
|
|
|
|
+const props = defineProps(["rowData"]);
|
|
|
|
+const open = ref(false);
|
|
|
|
+let currentTime = computed(() => {
|
|
|
|
+ let time = "";
|
|
|
|
+ let date = new Date();
|
|
|
|
+ let year = date.getFullYear();
|
|
|
|
+ let month = date.getMonth() + 1;
|
|
|
|
+ let day = date.getDate();
|
|
|
|
+ if (month < 10) month = "0" + month;
|
|
|
|
+ if (day < 10) day = "0" + day;
|
|
|
|
+ console.log(year, month, day);
|
|
|
|
+ return `${year}-${month}-${day}`;
|
|
|
|
+});
|
|
|
|
+const form = ref({
|
|
|
|
+ sat_sharematerialid: 0,
|
|
|
|
+ type: 1, //1:图片;2:视频;3:图文
|
|
|
|
+ notes: "",
|
|
|
|
+ isqrcode: 1,
|
|
|
|
+ qrcodecontent: "",
|
|
|
|
+ ondate: currentTime,
|
|
|
|
+ attinfos: "",
|
|
|
|
+});
|
|
|
|
+let selectProductParam = ref({
|
|
|
|
+ id: 20240420095702,
|
|
|
|
+ content: {
|
|
|
|
+ type: 1, //1,效果图,2:设计实景,3:单品
|
|
|
|
+ pageNumber: 1,
|
|
|
|
+ pageSize: 20,
|
|
|
|
+ where: {
|
|
|
|
+ condition: "",
|
|
},
|
|
},
|
|
- })
|
|
|
|
|
|
+ },
|
|
|
|
+});
|
|
|
|
|
|
- let selectProduct = ref()
|
|
|
|
- const selectProductFun = (data) => {
|
|
|
|
- form.value.qrcodecontent = data.record.appleturl
|
|
|
|
- selectProduct.value.modeVisible = false
|
|
|
|
- }
|
|
|
|
- let loading = ref(false)
|
|
|
|
- let upload = ref()
|
|
|
|
- let bindData = ref({})
|
|
|
|
- const showDrawer = async ()=>{
|
|
|
|
- form.value = Object.assign({},form.value,props.rowData)
|
|
|
|
- open.value = true
|
|
|
|
- bindData.value = {
|
|
|
|
- "ownertable": 'sat_sharematerial',
|
|
|
|
- "ownerid": form.value.sat_sharematerialid,
|
|
|
|
- "usetype": 'default',
|
|
|
|
- }
|
|
|
|
- nextTick(() => {
|
|
|
|
- upload.value.fileList = form.value.attinfos
|
|
|
|
- })
|
|
|
|
- console.log(form.value);
|
|
|
|
- }
|
|
|
|
|
|
+let selectProduct = ref();
|
|
|
|
+const selectProductFun = (data) => {
|
|
|
|
+ form.value.qrcodecontent = data.record.appleturl;
|
|
|
|
+ selectProduct.value.modeVisible = false;
|
|
|
|
+};
|
|
|
|
+let loading = ref(false);
|
|
|
|
+let upload = ref();
|
|
|
|
+let bindData = ref({});
|
|
|
|
+const showDrawer = async () => {
|
|
|
|
+ form.value = Object.assign({}, form.value, props.rowData);
|
|
|
|
+ open.value = true;
|
|
|
|
+ bindData.value = {
|
|
|
|
+ ownertable: "sat_sharematerial",
|
|
|
|
+ ownerid: form.value.sat_sharematerialid,
|
|
|
|
+ usetype: "default",
|
|
|
|
+ };
|
|
|
|
+ nextTick(() => {
|
|
|
|
+ upload.value.fileList = form.value.attinfos;
|
|
|
|
+ });
|
|
|
|
+ console.log(form.value);
|
|
|
|
+};
|
|
|
|
|
|
- watch(() => open.value,(val) => {
|
|
|
|
- if(!val) {
|
|
|
|
- emit('onSuccess')
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
-
|
|
|
|
- const formRef = ref()
|
|
|
|
- const submit = async ()=>{
|
|
|
|
- try {
|
|
|
|
- console.log(form.value)
|
|
|
|
- const values = await formRef.value.validateFields();
|
|
|
|
- const res = await Api.requested({
|
|
|
|
- "id":"20240319103802",
|
|
|
|
- "content":form.value
|
|
|
|
- })
|
|
|
|
- if (!res.code) {
|
|
|
|
- loading.value = false
|
|
|
|
- return message.warning(res.msg)
|
|
|
|
- }
|
|
|
|
- utils.message(res,'操作成功',() => {
|
|
|
|
- open.value = false
|
|
|
|
- refresh()
|
|
|
|
- loading.value = false
|
|
|
|
- })
|
|
|
|
- } catch (errorInfo) {
|
|
|
|
- console.log('Failed:', errorInfo);
|
|
|
|
|
|
+watch(
|
|
|
|
+ () => open.value,
|
|
|
|
+ (val) => {
|
|
|
|
+ if (!val) {
|
|
|
|
+ props.rowData.attinfos = upload.value.fileList;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- const refresh = () => {
|
|
|
|
- form.value = {
|
|
|
|
- "sat_sharematerialid": 0,
|
|
|
|
- "type": "1", //1:图片;2:视频;3:图文
|
|
|
|
- "notes": "",
|
|
|
|
- "isqrcode": '1',
|
|
|
|
- "qrcodecontent": "",
|
|
|
|
- "ondate": currentTime,
|
|
|
|
- "attinfos":''
|
|
|
|
|
|
+);
|
|
|
|
+
|
|
|
|
+const formRef = ref();
|
|
|
|
+const submit = async () => {
|
|
|
|
+ try {
|
|
|
|
+ console.log(form.value);
|
|
|
|
+ const values = await formRef.value.validateFields();
|
|
|
|
+ const res = await Api.requested({
|
|
|
|
+ id: "20240319103802",
|
|
|
|
+ content: form.value,
|
|
|
|
+ });
|
|
|
|
+ if (!res.code) {
|
|
|
|
+ loading.value = false;
|
|
|
|
+ return message.warning(res.msg);
|
|
}
|
|
}
|
|
|
|
+ utils.message(res, "操作成功", () => {
|
|
|
|
+ open.value = false;
|
|
|
|
+ refresh();
|
|
|
|
+ loading.value = false;
|
|
|
|
+ emit("onSuccess");
|
|
|
|
+ });
|
|
|
|
+ } catch (errorInfo) {
|
|
|
|
+ console.log("Failed:", errorInfo);
|
|
}
|
|
}
|
|
- </script>
|
|
|
|
|
|
+};
|
|
|
|
+const refresh = () => {
|
|
|
|
+ form.value = {
|
|
|
|
+ sat_sharematerialid: 0,
|
|
|
|
+ type: "1", //1:图片;2:视频;3:图文
|
|
|
|
+ notes: "",
|
|
|
|
+ isqrcode: "1",
|
|
|
|
+ qrcodecontent: "",
|
|
|
|
+ ondate: currentTime,
|
|
|
|
+ attinfos: "",
|
|
|
|
+ };
|
|
|
|
+};
|
|
|
|
+</script>
|
|
<style>
|
|
<style>
|
|
- </style>
|
|
|
|
|
|
+</style>
|