diff --git a/api/app/lib/controllers/projectRegime/projectSituation.js b/api/app/lib/controllers/projectRegime/projectSituation.js index 108233d..3214450 100644 --- a/api/app/lib/controllers/projectRegime/projectSituation.js +++ b/api/app/lib/controllers/projectRegime/projectSituation.js @@ -164,10 +164,10 @@ async function addPosition(ctx, next) { const models = ctx.fs.dc.models; let userInfo = ctx.fs.api.userInfo; const data = ctx.request.body; - const { longitude, latitude, name, describe, qrCode, projectId, } = data; + const { longitude, latitude, name, describe, qrCode, projectId, img } = data; let errMsg = data.id ? '点位编辑失败' : '点位新增失败' - let pointData = { longitude, latitude, name, describe, qrCode, projectId } + let pointData = { longitude, latitude, name, describe, qrCode, projectId, img } const alikeProject = await models.Point.findOne({ where: { diff --git a/api/app/lib/models/point.js b/api/app/lib/models/point.js index 978fc7c..34ec3e0 100644 --- a/api/app/lib/models/point.js +++ b/api/app/lib/models/point.js @@ -69,6 +69,15 @@ module.exports = dc => { field: "qr_code", autoIncrement: false }, + img: { + type: DataTypes.ARRAY(DataTypes.STRING), + allowNull: false, + defaultValue: null, + comment: null, + primaryKey: false, + field: "img", + autoIncrement: false + }, }, { tableName: "point", comment: "", diff --git a/script/1.0.3/schema/4.update_point.sql b/script/1.0.3/schema/4.update_point.sql new file mode 100644 index 0000000..fe06173 --- /dev/null +++ b/script/1.0.3/schema/4.update_point.sql @@ -0,0 +1,2 @@ +ALTER TABLE "public"."point" + ADD COLUMN "img" character varying[]; \ No newline at end of file diff --git a/web/client/src/sections/projectRegime/components/pointModel.js b/web/client/src/sections/projectRegime/components/pointModel.js index fdb2c2e..633cc3e 100644 --- a/web/client/src/sections/projectRegime/components/pointModel.js +++ b/web/client/src/sections/projectRegime/components/pointModel.js @@ -34,7 +34,7 @@ const ProjectAddModel = ({ dispatch, actions, user, modelData, close, success, q map: map }); //构造地点查询类 - function select (e) { + function select(e) { if (e) { placeSearch.setCity(e.poi.adcode); placeSearch.search(e.poi.name, function (status, result) { @@ -64,7 +64,10 @@ const ProjectAddModel = ({ dispatch, actions, user, modelData, close, success, q dispatch(projectRegime.addPosition({ ...r, id: modelData?.id, - projectId: qrCodeId + projectId: qrCodeId, + latitude: r?.latitude ? r?.latitude : null, + longitude: r?.longitude ? r?.longitude : null, + img: r.img ? r.img.map(u => u.storageUrl) : [], })).then(res => { if (res.success) { success() @@ -84,6 +87,13 @@ const ProjectAddModel = ({ dispatch, actions, user, modelData, close, success, q onFinish={r => { }} + initialValues={{ + img: (modelData.img || []).map(s => { + return { + storageUrl: s + } + }), + }} > -
+
{/* /^\d+$|^\d*\.\d+$/g */} - { const sjh = /^\d+$|^\d*\.\d+$/g; - if (value) { + if (value) { let valid = sjh.test(value); if (!valid) { return callback([new Error("横坐标填写错误")]); } callback(); } - return callback([new Error("请输入横坐标")]); + // return callback([new Error("请输入横坐标")]); + return Promise.resolve(); } }]} > ~ - { const sjh = /^\d+$|^\d*\.\d+$/g; - if (value) { + if (value) { let valid = sjh.test(value); if (!valid) { return callback([new Error("纵坐标填写错误")]); } callback(); } - return callback([new Error("请输入纵坐标")]); + // return callback([new Error("请输入纵坐标")]); + return Promise.resolve(); } }]} > @@ -152,6 +164,25 @@ const ProjectAddModel = ({ dispatch, actions, user, modelData, close, success, q rules={[{ required: true, message: '请输入描述内容', },]}>