委托清关修改及后台公告上传图片问题

dev
ZR20090193-陈敬勇 1 year ago
parent 68edde3402
commit aba2c3956e

@ -6,7 +6,7 @@ enum Api {
getDetailList = '/WmsClearance/GetWmsClearanceGoodsList',
getInfo = '/WmsClearance/GetWmsClearanceInfo',
editInfo = '/WmsClearance/EditWmsClearanceInfo',
editInfo = '/WmsClearance/EditWmsClearanceTrunckInfo',
auditInfo = '/WmsClearance/AuditWmsClearance',
}
export function getList(data: PageRequest) {

@ -19,39 +19,39 @@
</template>
<script lang="ts">
import type { Editor, RawEditorSettings } from 'tinymce';
import tinymce from 'tinymce/tinymce';
import 'tinymce/themes/silver';
import 'tinymce/icons/default/icons';
import 'tinymce/plugins/advlist';
import 'tinymce/plugins/anchor';
import 'tinymce/plugins/autolink';
import 'tinymce/plugins/autosave';
import 'tinymce/plugins/code';
import 'tinymce/plugins/codesample';
import 'tinymce/plugins/directionality';
import 'tinymce/plugins/fullscreen';
import 'tinymce/plugins/hr';
import 'tinymce/plugins/insertdatetime';
import 'tinymce/plugins/link';
import 'tinymce/plugins/lists';
import 'tinymce/plugins/media';
import 'tinymce/plugins/nonbreaking';
import 'tinymce/plugins/noneditable';
import 'tinymce/plugins/pagebreak';
import 'tinymce/plugins/paste';
import 'tinymce/plugins/preview';
import 'tinymce/plugins/print';
import 'tinymce/plugins/save';
import 'tinymce/plugins/searchreplace';
import 'tinymce/plugins/spellchecker';
import 'tinymce/plugins/tabfocus';
import type { Editor, RawEditorSettings } from 'tinymce'
import tinymce from 'tinymce/tinymce'
import 'tinymce/themes/silver'
import 'tinymce/icons/default/icons'
import 'tinymce/plugins/advlist'
import 'tinymce/plugins/anchor'
import 'tinymce/plugins/autolink'
import 'tinymce/plugins/autosave'
import 'tinymce/plugins/code'
import 'tinymce/plugins/codesample'
import 'tinymce/plugins/directionality'
import 'tinymce/plugins/fullscreen'
import 'tinymce/plugins/hr'
import 'tinymce/plugins/insertdatetime'
import 'tinymce/plugins/link'
import 'tinymce/plugins/lists'
import 'tinymce/plugins/media'
import 'tinymce/plugins/nonbreaking'
import 'tinymce/plugins/noneditable'
import 'tinymce/plugins/pagebreak'
import 'tinymce/plugins/paste'
import 'tinymce/plugins/preview'
import 'tinymce/plugins/print'
import 'tinymce/plugins/save'
import 'tinymce/plugins/searchreplace'
import 'tinymce/plugins/spellchecker'
import 'tinymce/plugins/tabfocus'
// import 'tinymce/plugins/table';
import 'tinymce/plugins/template';
import 'tinymce/plugins/textpattern';
import 'tinymce/plugins/visualblocks';
import 'tinymce/plugins/visualchars';
import 'tinymce/plugins/wordcount';
import 'tinymce/plugins/template'
import 'tinymce/plugins/textpattern'
import 'tinymce/plugins/visualblocks'
import 'tinymce/plugins/visualchars'
import 'tinymce/plugins/wordcount'
import {
defineComponent,
@ -62,17 +62,18 @@
watch,
onDeactivated,
onBeforeUnmount,
} from 'vue';
import ImgUpload from './ImgUpload.vue';
import { toolbar, plugins } from './tinymce';
import { buildShortUUID } from '/@/utils/uuid';
import { bindHandlers } from './helper';
import { onMountedOrActivated } from '/@/hooks/core/onMountedOrActivated';
import { useDesign } from '/@/hooks/web/useDesign';
import { isNumber } from '/@/utils/is';
import { useLocale } from '/@/locales/useLocale';
import { useAppStore } from '/@/store/modules/app';
} from 'vue'
import ImgUpload from './ImgUpload.vue'
import { toolbar, plugins } from './tinymce'
import { buildShortUUID } from '/@/utils/uuid'
import { bindHandlers } from './helper'
import { onMountedOrActivated } from '/@/hooks/core/onMountedOrActivated'
import { useDesign } from '/@/hooks/web/useDesign'
import { isNumber } from '/@/utils/is'
import { useLocale } from '/@/locales/useLocale'
import { useAppStore } from '/@/store/modules/app'
import { useGlobSetting } from '/@/hooks/setting'
const { viewUrl } = useGlobSetting()
const tinymceProps = {
options: {
type: Object as PropType<Partial<RawEditorSettings>>,
@ -107,7 +108,7 @@
type: Boolean,
default: true,
},
};
}
export default defineComponent({
name: 'Tinymce',
@ -116,37 +117,37 @@
props: tinymceProps,
emits: ['change', 'update:modelValue', 'inited', 'init-error'],
setup(props, { emit, attrs }) {
const editorRef = ref<Nullable<Editor>>(null);
const fullscreen = ref(false);
const tinymceId = ref<string>(buildShortUUID('tiny-vue'));
const elRef = ref<Nullable<HTMLElement>>(null);
const editorRef = ref<Nullable<Editor>>(null)
const fullscreen = ref(false)
const tinymceId = ref<string>(buildShortUUID('tiny-vue'))
const elRef = ref<Nullable<HTMLElement>>(null)
const { prefixCls } = useDesign('tinymce-container');
const { prefixCls } = useDesign('tinymce-container')
const appStore = useAppStore();
const appStore = useAppStore()
const tinymceContent = computed(() => props.modelValue);
const tinymceContent = computed(() => props.modelValue)
const containerWidth = computed(() => {
const width = props.width;
const width = props.width
if (isNumber(width)) {
return `${width}px`;
return `${width}px`
}
return width;
});
return width
})
const skinName = computed(() => {
return appStore.getDarkMode === 'light' ? 'oxide' : 'oxide-dark';
});
return appStore.getDarkMode === 'light' ? 'oxide' : 'oxide-dark'
})
const langName = computed(() => {
const lang = useLocale().getLocale.value;
return ['zh_CN', 'en'].includes(lang) ? lang : 'zh_CN';
});
const lang = useLocale().getLocale.value
return ['zh_CN', 'en'].includes(lang) ? lang : 'zh_CN'
})
const initOptions = computed((): RawEditorSettings => {
const { height, options, toolbar, plugins } = props;
const publicPath = import.meta.env.VITE_PUBLIC_PATH || '/';
const { height, options, toolbar, plugins } = props
const publicPath = import.meta.env.VITE_PUBLIC_PATH || '/'
return {
selector: `#${unref(tinymceId)}`,
height,
@ -166,83 +167,83 @@
publicPath + 'resource/tinymce/skins/ui/' + skinName.value + '/content.min.css',
...options,
setup: (editor: Editor) => {
editorRef.value = editor;
editor.on('init', (e) => initSetup(e));
editorRef.value = editor
editor.on('init', (e) => initSetup(e))
},
};
});
}
})
const disabled = computed(() => {
const { options } = props;
const getdDisabled = options && Reflect.get(options, 'readonly');
const editor = unref(editorRef);
const { options } = props
const getdDisabled = options && Reflect.get(options, 'readonly')
const editor = unref(editorRef)
if (editor) {
editor.setMode(getdDisabled ? 'readonly' : 'design');
editor.setMode(getdDisabled ? 'readonly' : 'design')
}
return getdDisabled ?? false;
});
return getdDisabled ?? false
})
watch(
() => attrs.disabled,
() => {
const editor = unref(editorRef);
const editor = unref(editorRef)
if (!editor) {
return;
return
}
editor.setMode(attrs.disabled ? 'readonly' : 'design');
editor.setMode(attrs.disabled ? 'readonly' : 'design')
},
);
)
onMountedOrActivated(() => {
if (!initOptions.value.inline) {
tinymceId.value = buildShortUUID('tiny-vue');
tinymceId.value = buildShortUUID('tiny-vue')
}
nextTick(() => {
setTimeout(() => {
initEditor();
}, 30);
});
});
initEditor()
}, 30)
})
})
onBeforeUnmount(() => {
destory();
});
destory()
})
onDeactivated(() => {
destory();
});
destory()
})
function destory() {
if (tinymce !== null) {
tinymce?.remove?.(unref(initOptions).selector!);
tinymce?.remove?.(unref(initOptions).selector!)
}
}
function initEditor() {
const el = unref(elRef);
const el = unref(elRef)
if (el) {
el.style.visibility = '';
el.style.visibility = ''
}
tinymce
.init(unref(initOptions))
.then((editor) => {
emit('inited', editor);
emit('inited', editor)
})
.catch((err) => {
emit('init-error', err);
});
emit('init-error', err)
})
}
function initSetup(e) {
const editor = unref(editorRef);
const editor = unref(editorRef)
if (!editor) {
return;
return
}
const value = props.modelValue || '';
const value = props.modelValue || ''
editor.setContent(value);
bindModelHandlers(editor);
bindHandlers(e, attrs, unref(editorRef));
editor.setContent(value)
bindModelHandlers(editor)
bindHandlers(e, attrs, unref(editorRef))
}
function setValue(editor: Recordable, val: string, prevVal?: string) {
@ -252,64 +253,65 @@
val !== prevVal &&
val !== editor.getContent({ format: attrs.outputFormat })
) {
editor.setContent(val);
editor.setContent(val)
}
}
function bindModelHandlers(editor: any) {
const modelEvents = attrs.modelEvents ? attrs.modelEvents : null;
const normalizedEvents = Array.isArray(modelEvents) ? modelEvents.join(' ') : modelEvents;
const modelEvents = attrs.modelEvents ? attrs.modelEvents : null
const normalizedEvents = Array.isArray(modelEvents) ? modelEvents.join(' ') : modelEvents
watch(
() => props.modelValue,
(val: string, prevVal: string) => {
setValue(editor, val, prevVal);
setValue(editor, val, prevVal)
},
);
)
watch(
() => props.value,
(val: string, prevVal: string) => {
setValue(editor, val, prevVal);
setValue(editor, val, prevVal)
},
{
immediate: true,
},
);
)
editor.on(normalizedEvents ? normalizedEvents : 'change keyup undo redo', () => {
const content = editor.getContent({ format: attrs.outputFormat });
emit('update:modelValue', content);
emit('change', content);
});
const content = editor.getContent({ format: attrs.outputFormat })
emit('update:modelValue', content)
emit('change', content)
})
editor.on('FullscreenStateChanged', (e) => {
fullscreen.value = e.state;
});
fullscreen.value = e.state
})
}
function handleImageUploading(name: string) {
const editor = unref(editorRef);
const editor = unref(editorRef)
if (!editor) {
return;
return
}
editor.execCommand('mceInsertContent', false, getUploadingImgName(name));
const content = editor?.getContent() ?? '';
setValue(editor, content);
editor.execCommand('mceInsertContent', false, getUploadingImgName(name))
const content = editor?.getContent() ?? ''
setValue(editor, content)
}
function handleDone(name: string, url: string) {
const editor = unref(editorRef);
const editor = unref(editorRef)
if (!editor) {
return;
return
}
const content = editor?.getContent() ?? '';
const val = content?.replace(getUploadingImgName(name), `<img src="${url}"/>`) ?? '';
setValue(editor, val);
const content = editor?.getContent() ?? ''
const val =
content?.replace(getUploadingImgName(name), `<img src="${viewUrl + url}"/>`) ?? ''
setValue(editor, val)
}
function getUploadingImgName(name: string) {
return `[uploading:${name}]`;
return `[uploading:${name}]`
}
return {
@ -324,9 +326,9 @@
editorRef,
fullscreen,
disabled,
};
}
},
});
})
</script>
<style lang="less" scoped></style>

@ -15,12 +15,12 @@
</div>
</template>
<script lang="ts">
import { defineComponent, computed } from 'vue';
import { defineComponent, computed } from 'vue'
import { Upload } from 'ant-design-vue';
import { useDesign } from '/@/hooks/web/useDesign';
import { useGlobSetting } from '/@/hooks/setting';
import { useI18n } from '/@/hooks/web/useI18n';
import { Upload } from 'ant-design-vue'
import { useDesign } from '/@/hooks/web/useDesign'
import { useGlobSetting } from '/@/hooks/setting'
import { useI18n } from '/@/hooks/web/useI18n'
export default defineComponent({
name: 'TinymceImageUpload',
@ -36,36 +36,36 @@
},
emits: ['uploading', 'done', 'error'],
setup(props, { emit }) {
let uploading = false;
let uploading = false
const { uploadUrl } = useGlobSetting();
const { t } = useI18n();
const { prefixCls } = useDesign('tinymce-img-upload');
const { uploadUrl } = useGlobSetting()
const { t } = useI18n()
const { prefixCls } = useDesign('tinymce-img-upload')
const getButtonProps = computed(() => {
const { disabled } = props;
const { disabled } = props
return {
disabled,
};
});
}
})
function handleChange(info: Recordable) {
const file = info.file;
const status = file?.status;
const url = file?.response?.url;
const name = file?.name;
const file = info.file
const status = file?.status
const url = file?.response?.data
const name = file?.name
console.log(file, url, name)
if (status === 'uploading') {
if (!uploading) {
emit('uploading', name);
uploading = true;
emit('uploading', name)
uploading = true
}
} else if (status === 'done') {
emit('done', name, url);
uploading = false;
emit('done', name, url + name)
uploading = false
} else if (status === 'error') {
emit('error');
uploading = false;
emit('error')
uploading = false
}
}
@ -75,9 +75,9 @@
uploadUrl,
t,
getButtonProps,
};
}
},
});
})
</script>
<style lang="less" scoped>
@prefix-cls: ~'@{namespace}-tinymce-img-upload';

@ -54,6 +54,15 @@
style="margin-right: 0.8rem"
>取消</a-button
>
<a-button
v-show="isUpdate && billStatus === 0"
@click="handleSave(false)"
type="success"
:loading="loading"
preIcon="ant-design:check-outlined"
style="margin-right: 0.8rem"
>仅保存</a-button
>
</template>
<EidtTruckRecordModal @register="registerRecordModal" @success="handleRecordSuccess" />
</BasicModal>
@ -314,6 +323,58 @@
}
const getTitle = computed(() => (!unref(isUpdate) ? '预约清关-新增' : '预约清关-审批'))
async function handleSave(exit) {
try {
const values = await validate()
console.log(values)
setModalProps({ confirmLoading: true, loading: true })
loading.value = true
const postData = reactive({
wmsplanid: rowId.value,
truckno: values.truckno,
})
// var postData = Object.assign({}, values, { list: dataSource.value })
console.log(postData)
const res: API.DataResult = await editInfo(postData)
console.log(res)
if (res.succeeded) {
notification.success({ message: res.message, duration: 3 })
emit('success')
//
if (!exit) {
await refresh()
}
} else {
notification.error({ message: res.message, duration: 3 })
}
exit && closeModal()
} finally {
loading.value = false
setModalProps({ confirmLoading: false, loading: false })
}
}
async function refresh() {
const res: API.DataResult = await getInfo({ id: unref(rowId) })
await loadListData()
if (res.succeeded) {
await setFieldsValue({
...res.data,
})
const status = res.data.auditStatus
billStatus.value = parseInt(status)
console.log(status)
if (status === -1) {
chapter('未提交', '高速临空管理平台', 'red')
} else if (status === 0) {
chapter('待审批', '高速临空管理平台', 'blue')
} else if (status === 1) {
chapter('审核通过', '高速临空管理平台', 'green')
} else if (status === 2) {
chapter('审核驳回', '高速临空管理平台', 'orange')
}
}
}
async function handleAudit() {
try {
const values = await validate()

@ -240,6 +240,7 @@ export const formSchema: FormSchema[] = [
disabledDate: (current: dayjs.Dayjs) => {
return current && current < dayjs().add(-1, 'day').endOf('day')
},
disabled: true,
},
},
{
@ -264,6 +265,7 @@ export const formSchema: FormSchema[] = [
{ label: '托盘', value: '托盘' },
{ label: '散装', value: '散装' },
],
disabled: true,
},
},
{
@ -278,6 +280,7 @@ export const formSchema: FormSchema[] = [
{ label: '委托清关', value: '1' },
{ label: '自主清关', value: '2' },
],
disabled: true,
},
},
{
@ -292,6 +295,7 @@ export const formSchema: FormSchema[] = [
{ label: '是', value: true },
{ label: '否', value: false },
],
disabled: true,
},
},
{
@ -335,8 +339,12 @@ export const formSchema: FormSchema[] = [
colProps: {
span: 8,
},
componentProps: {
disabled: true,
// componentProps: {
// disabled: true,
// },
dynamicDisabled: ({ values }) => {
console.log(values.clearanceType)
return values.clearanceType === '2'
},
},
{

@ -220,9 +220,9 @@ public class WmsClearanceService : IWmsClearanceService
{
var gid = Guid.Parse(id);
var inPlan = db.Queryable<OP_WMS_CLEARANCE>().First(x => x.WMSPLANID == gid);
if (inPlan.TRUCKNO.IsNullOrEmpty())
if (inPlan.ClearanceType =="2" && inPlan.TRUCKNO.IsNullOrEmpty())
{
return DataResult.Failed("承运车辆不能为空!");
return DataResult.Failed("自主清关请维护承运车辆!");
}
if (inPlan.AuditStatus == AuditStatus.Approve.ToEnumInt() ||

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DS.WMS.Core.WmsModule.Dtos
{
public class WmsClearanceInput
{
public Guid? WMSPLANID { get; set; }
public string TRUCKNO { get; set; }
}
}

@ -33,4 +33,10 @@ public interface IWmsClearanceService
/// <param name="id"></param>
/// <returns></returns>
DataResult GetWmsClearanceGoodsList(string id);
/// <summary>
/// 维护清关车辆信息
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public DataResult EditWmsClearanceTrunckInfo(WmsClearanceInput model);
}

@ -178,4 +178,37 @@ public class WmsClearanceService:IWmsClearanceService
.Where(a => a.WMSPLANID == Guid.Parse(id)).ToList();
return DataResult.Successed("查询成功!", data);
}
public DataResult EditWmsClearanceTrunckInfo(WmsClearanceInput model) {
try
{
var gid = (Guid)model.WMSPLANID;
var plan = db.Queryable<OP_WMS_CLEARANCE>().First(x => x.WMSPLANID == gid);
if (plan.AuditStatus == (short)AuditStatus.Auditing)
{
return DataResult.Failed("已提交审核,不能修改!");
}
if (plan.AuditStatus == (short)AuditStatus.Approve)
{
return DataResult.Failed("已审核通过,不能修改!");
}
//开启事务
db.Ado.BeginTran();
plan.TRUCKNO = model.TRUCKNO;
db.Updateable(plan).IgnoreColumns(ignoreAllNullColumns: true)
.IgnoreColumns(x => new { x.AuditStatus, x.AuditNote }).ExecuteCommand();
db.Ado.CommitTran();
return DataResult.Successed("更新成功!");
}
catch (Exception ex)
{
db.Ado.RollbackTran();
return DataResult.Failed("更新失败!" + ex);
}
}
}

@ -1191,6 +1191,13 @@
<param name="id"></param>
<returns></returns>
</member>
<member name="M:DS.WMS.WebApi.Controllers.WmsClearanceController.EditWmsClearanceTrunckInfo(DS.WMS.Core.WmsModule.Dtos.WmsClearanceInput)">
<summary>
维护清关车辆信息
</summary>
<param name="model"></param>
<returns></returns>
</member>
<member name="T:DS.WMS.WebApi.Controllers.WmsFeeController">
<summary>
费用模块

@ -70,4 +70,16 @@ public class WmsClearanceController : ApiController
var res = _invokeService.GetWmsClearanceGoodsList(id);
return res;
}
/// <summary>
/// 维护清关车辆信息
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
[HttpPost]
[Route("EditWmsClearanceTrunckInfo")]
public DataResult EditWmsClearanceTrunckInfo([FromBody] WmsClearanceInput model)
{
var res = _invokeService.EditWmsClearanceTrunckInfo(model);
return res;
}
}

@ -8988,3 +8988,24 @@
2023-08-21 10:41:23.3419 Info Adding target ColoredConsoleTarget(Name=console)
2023-08-21 10:41:23.3892 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\sdgslk-wms-solution\gslk-wmsapi-service-server\DS.WMS.WebApi\bin\Debug\net6.0\nlog.config
2023-08-21 10:41:23.3892 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2023-08-21 16:23:41.5701 Info Message Template Auto Format enabled
2023-08-21 16:23:41.5795 Info Loading assembly: NLog.Web.AspNetCore
2023-08-21 16:23:41.6781 Info Adding target FileTarget(Name=allfile)
2023-08-21 16:23:41.6845 Info Adding target FileTarget(Name=ownFile-web)
2023-08-21 16:23:41.7020 Info Adding target ColoredConsoleTarget(Name=console)
2023-08-21 16:23:41.7667 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\sdgslk-wms-solution\gslk-wmsapi-service-server\DS.WMS.WebApi\bin\Debug\net6.0\nlog.config
2023-08-21 16:23:41.7843 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2023-08-22 13:55:05.1073 Info Message Template Auto Format enabled
2023-08-22 13:55:05.1372 Info Loading assembly: NLog.Web.AspNetCore
2023-08-22 13:55:05.3489 Info Adding target FileTarget(Name=allfile)
2023-08-22 13:55:05.3489 Info Adding target FileTarget(Name=ownFile-web)
2023-08-22 13:55:05.3848 Info Adding target ColoredConsoleTarget(Name=console)
2023-08-22 13:55:05.4419 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\sdgslk-wms-solution\gslk-wmsapi-service-server\DS.WMS.WebApi\bin\Debug\net6.0\nlog.config
2023-08-22 13:55:05.4614 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2023-08-22 14:41:11.2050 Info Message Template Auto Format enabled
2023-08-22 14:41:11.2491 Info Loading assembly: NLog.Web.AspNetCore
2023-08-22 14:41:11.6317 Info Adding target FileTarget(Name=allfile)
2023-08-22 14:41:11.6961 Info Adding target FileTarget(Name=ownFile-web)
2023-08-22 14:41:11.7447 Info Adding target ColoredConsoleTarget(Name=console)
2023-08-22 14:41:11.9806 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\sdgslk-wms-solution\gslk-wmsapi-service-server\DS.WMS.WebApi\bin\Debug\net6.0\nlog.config
2023-08-22 14:41:12.0164 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile

Loading…
Cancel
Save